summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2021-01-23 13:23:20 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2021-01-23 13:23:20 (GMT)
commit3348d98619c7b4ae631bde35f8e384360fd8c3de (patch)
treeb3a458cc075cbbc01f08699fb78158b178a46e59 /generic
parentbe894d0b4df59a4717ecf07ccd8ffd5c62c811fd (diff)
parent6567f685e6ec1b046219ee8c5615ba4a084ac231 (diff)
downloadtk-3348d98619c7b4ae631bde35f8e384360fd8c3de.zip
tk-3348d98619c7b4ae631bde35f8e384360fd8c3de.tar.gz
tk-3348d98619c7b4ae631bde35f8e384360fd8c3de.tar.bz2
Merge main, Tk_CreatePhotoImageFormatVersion3: stubs position from 279 to 280, masterPtr->modelPtr
Diffstat (limited to 'generic')
-rw-r--r--generic/ks_names.h875
-rwxr-xr-xgeneric/nanosvg.h442
-rw-r--r--generic/nanosvgrast.h200
-rw-r--r--generic/tk.decls93
-rw-r--r--generic/tk.h35
-rw-r--r--generic/tk3d.c4
-rw-r--r--generic/tk3d.h2
-rw-r--r--generic/tkArgv.c4
-rw-r--r--generic/tkArray.h2
-rw-r--r--generic/tkAtom.c4
-rw-r--r--generic/tkBind.c313
-rw-r--r--generic/tkBitmap.c4
-rw-r--r--generic/tkBusy.c20
-rw-r--r--generic/tkButton.c6
-rw-r--r--generic/tkButton.h2
-rw-r--r--generic/tkCanvArc.c43
-rw-r--r--generic/tkCanvBmap.c4
-rw-r--r--generic/tkCanvImg.c4
-rw-r--r--generic/tkCanvLine.c61
-rw-r--r--generic/tkCanvPoly.c14
-rw-r--r--generic/tkCanvPs.c6
-rw-r--r--generic/tkCanvText.c21
-rw-r--r--generic/tkCanvUtil.c4
-rw-r--r--generic/tkCanvWind.c20
-rw-r--r--generic/tkCanvas.c52
-rw-r--r--generic/tkCanvas.h6
-rw-r--r--generic/tkClipboard.c23
-rw-r--r--generic/tkCmds.c49
-rw-r--r--generic/tkColor.c4
-rw-r--r--generic/tkColor.h2
-rw-r--r--generic/tkConfig.c186
-rw-r--r--generic/tkConsole.c40
-rw-r--r--generic/tkCursor.c4
-rw-r--r--generic/tkDList.h2
-rw-r--r--generic/tkDecls.h71
-rw-r--r--generic/tkEntry.c102
-rw-r--r--generic/tkEntry.h2
-rw-r--r--generic/tkError.c4
-rw-r--r--generic/tkEvent.c55
-rw-r--r--generic/tkFileFilter.c8
-rw-r--r--generic/tkFileFilter.h2
-rw-r--r--generic/tkFocus.c12
-rw-r--r--generic/tkFont.c133
-rw-r--r--generic/tkFont.h2
-rw-r--r--generic/tkFrame.c28
-rw-r--r--generic/tkGC.c4
-rw-r--r--generic/tkGeometry.c384
-rw-r--r--generic/tkGet.c12
-rw-r--r--generic/tkGrab.c40
-rw-r--r--generic/tkGrid.c1262
-rw-r--r--generic/tkImage.c263
-rw-r--r--generic/tkImgBmap.c276
-rw-r--r--generic/tkImgGIF.c12
-rw-r--r--generic/tkImgListFormat.c10
-rw-r--r--generic/tkImgPNG.c34
-rw-r--r--generic/tkImgPPM.c36
-rw-r--r--generic/tkImgPhInstance.c195
-rw-r--r--generic/tkImgPhoto.c760
-rw-r--r--generic/tkImgPhoto.h40
-rw-r--r--generic/tkImgSVGnano.c103
-rw-r--r--generic/tkImgUtil.c2
-rw-r--r--generic/tkInt.decls47
-rw-r--r--generic/tkInt.h85
-rw-r--r--generic/tkIntDecls.h73
-rw-r--r--generic/tkIntPlatDecls.h36
-rw-r--r--generic/tkIntXlibDecls.h16
-rw-r--r--generic/tkListbox.c26
-rw-r--r--generic/tkMacWinMenu.c2
-rw-r--r--generic/tkMain.c15
-rw-r--r--generic/tkMenu.c120
-rw-r--r--generic/tkMenu.h18
-rw-r--r--generic/tkMenuDraw.c2
-rw-r--r--generic/tkMenubutton.c7
-rw-r--r--generic/tkMenubutton.h2
-rw-r--r--generic/tkMessage.c8
-rw-r--r--generic/tkObj.c19
-rw-r--r--generic/tkOldConfig.c47
-rw-r--r--generic/tkOldTest.c58
-rw-r--r--generic/tkOption.c15
-rw-r--r--generic/tkPack.c794
-rw-r--r--generic/tkPanedWindow.c855
-rw-r--r--generic/tkPkgConfig.c11
-rw-r--r--generic/tkPlace.c781
-rw-r--r--generic/tkPlatDecls.h118
-rw-r--r--generic/tkPointer.c11
-rw-r--r--generic/tkRectOval.c4
-rw-r--r--generic/tkScale.c18
-rw-r--r--generic/tkScale.h4
-rw-r--r--generic/tkScrollbar.c18
-rw-r--r--generic/tkScrollbar.h2
-rw-r--r--generic/tkSelect.c14
-rw-r--r--generic/tkSelect.h2
-rw-r--r--generic/tkSquare.c4
-rw-r--r--generic/tkStubInit.c104
-rw-r--r--generic/tkStubLib.c28
-rw-r--r--generic/tkStyle.c17
-rw-r--r--generic/tkTest.c215
-rw-r--r--generic/tkText.c93
-rw-r--r--generic/tkText.h4
-rw-r--r--generic/tkTextBTree.c24
-rw-r--r--generic/tkTextDisp.c127
-rw-r--r--generic/tkTextImage.c56
-rw-r--r--generic/tkTextIndex.c6
-rw-r--r--generic/tkTextMark.c53
-rw-r--r--generic/tkTextTag.c12
-rw-r--r--generic/tkTextWind.c58
-rw-r--r--generic/tkTrig.c4
-rw-r--r--generic/tkUndo.c4
-rw-r--r--generic/tkUndo.h2
-rw-r--r--generic/tkUtil.c38
-rw-r--r--generic/tkVisual.c4
-rw-r--r--generic/tkWindow.c66
-rw-r--r--generic/ttk/ttkBlink.c2
-rw-r--r--generic/ttk/ttkButton.c35
-rw-r--r--generic/ttk/ttkCache.c2
-rw-r--r--generic/ttk/ttkClamTheme.c4
-rw-r--r--generic/ttk/ttkClassicTheme.c4
-rw-r--r--generic/ttk/ttkDecls.h6
-rw-r--r--generic/ttk/ttkDefaultTheme.c2
-rw-r--r--generic/ttk/ttkElements.c2
-rw-r--r--generic/ttk/ttkEntry.c86
-rw-r--r--generic/ttk/ttkFrame.c67
-rw-r--r--generic/ttk/ttkImage.c14
-rw-r--r--generic/ttk/ttkInit.c27
-rw-r--r--generic/ttk/ttkLabel.c19
-rw-r--r--generic/ttk/ttkLayout.c12
-rw-r--r--generic/ttk/ttkManager.c355
-rw-r--r--generic/ttk/ttkManager.h79
-rw-r--r--generic/ttk/ttkNotebook.c281
-rw-r--r--generic/ttk/ttkPanedwindow.c218
-rw-r--r--generic/ttk/ttkProgress.c49
-rw-r--r--generic/ttk/ttkScale.c34
-rw-r--r--generic/ttk/ttkScroll.c8
-rw-r--r--generic/ttk/ttkScrollbar.c24
-rw-r--r--generic/ttk/ttkSeparator.c10
-rw-r--r--generic/ttk/ttkSquare.c24
-rw-r--r--generic/ttk/ttkState.c2
-rw-r--r--generic/ttk/ttkStubInit.c2
-rw-r--r--generic/ttk/ttkStubLib.c14
-rw-r--r--generic/ttk/ttkTagSet.c2
-rw-r--r--generic/ttk/ttkTheme.c81
-rw-r--r--generic/ttk/ttkTrace.c14
-rw-r--r--generic/ttk/ttkTrack.c2
-rw-r--r--generic/ttk/ttkTreeview.c57
-rw-r--r--generic/ttk/ttkWidget.c26
-rw-r--r--generic/ttk/ttkWidget.h11
146 files changed, 5850 insertions, 6275 deletions
diff --git a/generic/ks_names.h b/generic/ks_names.h
index 7d11cae..9a9a51a 100644
--- a/generic/ks_names.h
+++ b/generic/ks_names.h
@@ -20,12 +20,7 @@
{ "Scroll_Lock", 0xFF14 },
{ "Sys_Req", 0xFF15 },
{ "Escape", 0xFF1B },
-{ "Delete", 0xFFFF },
{ "Multi_key", 0xFF20 },
-{ "Codeinput", 0xFF37 },
-{ "SingleCandidate", 0xFF3C },
-{ "MultipleCandidate", 0xFF3D },
-{ "PreviousCandidate", 0xFF3E },
{ "Kanji", 0xFF21 },
{ "Muhenkan", 0xFF22 },
{ "Henkan_Mode", 0xFF23 },
@@ -43,9 +38,21 @@
{ "Kana_Shift", 0xFF2E },
{ "Eisu_Shift", 0xFF2F },
{ "Eisu_toggle", 0xFF30 },
-{ "Kanji_Bangou", 0xFF37 },
-{ "Zen_Koho", 0xFF3D },
-{ "Mae_Koho", 0xFF3E },
+{ "Hangul", 0xFF31 },
+{ "Hangul_Start", 0xFF32 },
+{ "Hangul_End", 0xFF33 },
+{ "Hangul_Hanja", 0xFF34 },
+{ "Hangul_Jamo", 0xFF35 },
+{ "Hangul_Romaja", 0xFF36 },
+{ "Codeinput", 0xFF37 },
+{ "Hangul_Jeonja", 0xFF38 },
+{ "Hangul_Banja", 0xFF39 },
+{ "Hangul_PreHanja", 0xFF3A },
+{ "Hangul_PostHanja", 0xFF3B },
+{ "SingleCandidate", 0xFF3C },
+{ "MultipleCandidate", 0xFF3D },
+{ "PreviousCandidate", 0xFF3E },
+{ "Hangul_Special", 0xFF3F },
{ "Home", 0xFF50 },
{ "Left", 0xFF51 },
{ "Up", 0xFF52 },
@@ -57,9 +64,6 @@
{ "Page_Down", 0xFF56 },
{ "End", 0xFF57 },
{ "Begin", 0xFF58 },
-{ "Win_L", 0xFF5B },
-{ "Win_R", 0xFF5C },
-{ "App", 0xFF5D },
{ "Select", 0xFF60 },
{ "Print", 0xFF61 },
{ "Execute", 0xFF62 },
@@ -67,12 +71,21 @@
{ "Undo", 0xFF65 },
{ "Redo", 0xFF66 },
{ "Menu", 0xFF67 },
+#ifndef TK_NO_DEPRECATED
+{ "App", 0xFF67 },
+#endif
{ "Find", 0xFF68 },
{ "Cancel", 0xFF69 },
{ "Help", 0xFF6A },
{ "Break", 0xFF6B },
{ "Mode_switch", 0xFF7E },
+#ifndef TK_NO_DEPRECATED
{ "script_switch", 0xFF7E },
+{ "kana_switch", 0xFF7E },
+{ "Arabic_switch", 0xFF7E },
+{ "Greek_switch", 0xFF7E },
+{ "Hebrew_switch", 0xFF7E },
+#endif
{ "Num_Lock", 0xFF7F },
{ "KP_Space", 0xFF80 },
{ "KP_Tab", 0xFF89 },
@@ -94,7 +107,6 @@
{ "KP_Begin", 0xFF9D },
{ "KP_Insert", 0xFF9E },
{ "KP_Delete", 0xFF9F },
-{ "KP_Equal", 0xFFBD },
{ "KP_Multiply", 0xFFAA },
{ "KP_Add", 0xFFAB },
{ "KP_Separator", 0xFFAC },
@@ -111,6 +123,7 @@
{ "KP_7", 0xFFB7 },
{ "KP_8", 0xFFB8 },
{ "KP_9", 0xFFB9 },
+{ "KP_Equal", 0xFFBD },
{ "F1", 0xFFBE },
{ "F2", 0xFFBF },
{ "F3", 0xFFC0 },
@@ -182,18 +195,31 @@
{ "Alt_L", 0xFFE9 },
{ "Alt_R", 0xFFEA },
{ "Super_L", 0xFFEB },
+#ifndef TK_NO_DEPRECATED
+{ "Win_L", 0xFFEB },
+#endif
{ "Super_R", 0xFFEC },
+#ifndef TK_NO_DEPRECATED
+{ "Win_R", 0xFFEC },
+#endif
{ "Hyper_L", 0xFFED },
{ "Hyper_R", 0xFFEE },
+{ "braille_dot_1", 0xFFF1 },
+{ "braille_dot_2", 0xFFF2 },
+{ "braille_dot_3", 0xFFF3 },
+{ "braille_dot_4", 0xFFF4 },
+{ "braille_dot_5", 0xFFF5 },
+{ "braille_dot_6", 0xFFF6 },
+{ "braille_dot_7", 0xFFF7 },
+{ "braille_dot_8", 0xFFF8 },
+{ "braille_dot_9", 0xFFF9 },
+{ "braille_dot_10", 0xFFFA },
+{ "Delete", 0xFFFF },
{ "ISO_Lock", 0xFE01 },
{ "ISO_Level2_Latch", 0xFE02 },
{ "ISO_Level3_Shift", 0xFE03 },
{ "ISO_Level3_Latch", 0xFE04 },
{ "ISO_Level3_Lock", 0xFE05 },
-{ "ISO_Level5_Shift", 0xFE11 },
-{ "ISO_Level5_Latch", 0xFE12 },
-{ "ISO_Level5_Lock", 0xFE13 },
-{ "ISO_Group_Shift", 0xFF7E },
{ "ISO_Group_Latch", 0xFE06 },
{ "ISO_Group_Lock", 0xFE07 },
{ "ISO_Next_Group", 0xFE08 },
@@ -204,6 +230,9 @@
{ "ISO_First_Group_Lock", 0xFE0D },
{ "ISO_Last_Group", 0xFE0E },
{ "ISO_Last_Group_Lock", 0xFE0F },
+{ "ISO_Level5_Shift", 0xFE11 },
+{ "ISO_Level5_Latch", 0xFE12 },
+{ "ISO_Level5_Lock", 0xFE13 },
{ "ISO_Left_Tab", 0xFE20 },
{ "ISO_Move_Line_Up", 0xFE21 },
{ "ISO_Move_Line_Down", 0xFE22 },
@@ -260,10 +289,17 @@
{ "dead_invertedbreve", 0xFE6D },
{ "dead_belowcomma", 0xFE6E },
{ "dead_currency", 0xFE6F },
-{ "dead_lowline", 0xFE90 },
-{ "dead_aboveverticalline", 0xFE91 },
-{ "dead_belowverticalline", 0xFE92 },
-{ "dead_longsolidusoverlay", 0xFE93 },
+{ "AccessX_Enable", 0xFE70 },
+{ "AccessX_Feedback_Enable", 0xFE71 },
+{ "RepeatKeys_Enable", 0xFE72 },
+{ "SlowKeys_Enable", 0xFE73 },
+{ "BounceKeys_Enable", 0xFE74 },
+{ "StickyKeys_Enable", 0xFE75 },
+{ "MouseKeys_Enable", 0xFE76 },
+{ "MouseKeys_Accel_Enable", 0xFE77 },
+{ "Overlay1_Enable", 0xFE78 },
+{ "Overlay2_Enable", 0xFE79 },
+{ "AudibleBell_Enable", 0xFE7A },
{ "dead_a", 0xFE80 },
{ "dead_A", 0xFE81 },
{ "dead_e", 0xFE82 },
@@ -277,22 +313,21 @@
{ "dead_small_schwa", 0xFE8A },
{ "dead_capital_schwa", 0xFE8B },
{ "dead_greek", 0xFE8C },
+{ "dead_lowline", 0xFE90 },
+{ "dead_aboveverticalline", 0xFE91 },
+{ "dead_belowverticalline", 0xFE92 },
+{ "dead_longsolidusoverlay", 0xFE93 },
+{ "ch", 0xFEA0 },
+{ "Ch", 0xFEA1 },
+{ "CH", 0xFEA2 },
+{ "c_h", 0xFEA3 },
+{ "C_h", 0xFEA4 },
+{ "C_H", 0xFEA5 },
{ "First_Virtual_Screen", 0xFED0 },
{ "Prev_Virtual_Screen", 0xFED1 },
{ "Next_Virtual_Screen", 0xFED2 },
{ "Last_Virtual_Screen", 0xFED4 },
{ "Terminate_Server", 0xFED5 },
-{ "AccessX_Enable", 0xFE70 },
-{ "AccessX_Feedback_Enable", 0xFE71 },
-{ "RepeatKeys_Enable", 0xFE72 },
-{ "SlowKeys_Enable", 0xFE73 },
-{ "BounceKeys_Enable", 0xFE74 },
-{ "StickyKeys_Enable", 0xFE75 },
-{ "MouseKeys_Enable", 0xFE76 },
-{ "MouseKeys_Accel_Enable", 0xFE77 },
-{ "Overlay1_Enable", 0xFE78 },
-{ "Overlay2_Enable", 0xFE79 },
-{ "AudibleBell_Enable", 0xFE7A },
{ "Pointer_Left", 0xFEE0 },
{ "Pointer_Right", 0xFEE1 },
{ "Pointer_Up", 0xFEE2 },
@@ -318,17 +353,11 @@
{ "Pointer_Drag2", 0xFEF6 },
{ "Pointer_Drag3", 0xFEF7 },
{ "Pointer_Drag4", 0xFEF8 },
-{ "Pointer_Drag5", 0xFEFD },
{ "Pointer_EnableKeys", 0xFEF9 },
{ "Pointer_Accelerate", 0xFEFA },
{ "Pointer_DfltBtnNext", 0xFEFB },
{ "Pointer_DfltBtnPrev", 0xFEFC },
-{ "ch", 0xFEA0 },
-{ "Ch", 0xFEA1 },
-{ "CH", 0xFEA2 },
-{ "c_h", 0xFEA3 },
-{ "C_h", 0xFEA4 },
-{ "C_H", 0xFEA5 },
+{ "Pointer_Drag5", 0xFEFD },
{ "3270_Duplicate", 0xFD01 },
{ "3270_FieldMark", 0xFD02 },
{ "3270_Right2", 0xFD03 },
@@ -360,10 +389,13 @@
{ "3270_PrintScreen", 0xFD1D },
{ "3270_Enter", 0xFD1E },
{ "space", 0x20 },
+#ifndef TK_NO_DEPRECATED
{ "exclam", 0x21 },
+#endif
{ "quotedbl", 0x22 },
{ "numbersign", 0x23 },
{ "dollar", 0x24 },
+#ifndef TK_NO_DEPRECATED
{ "percent", 0x25 },
{ "ampersand", 0x26 },
{ "apostrophe", 0x27 },
@@ -373,7 +405,9 @@
{ "asterisk", 0x2A },
{ "plus", 0x2B },
{ "comma", 0x2C },
+#endif
{ "minus", 0x2D },
+#ifndef TK_NO_DEPRECATED
{ "period", 0x2E },
{ "slash", 0x2F },
{ "0", 0x30 },
@@ -387,10 +421,14 @@
{ "8", 0x38 },
{ "9", 0x39 },
{ "colon", 0x3A },
+#endif
{ "semicolon", 0x3B },
{ "less", 0x3C },
+#ifndef TK_NO_DEPRECATED
{ "equal", 0x3D },
+#endif
{ "greater", 0x3E },
+#ifndef TK_NO_DEPRECATED
{ "question", 0x3F },
{ "at", 0x40 },
{ "A", 0x41 },
@@ -419,9 +457,11 @@
{ "X", 0x58 },
{ "Y", 0x59 },
{ "Z", 0x5A },
+#endif
{ "bracketleft", 0x5B },
{ "backslash", 0x5C },
{ "bracketright", 0x5D },
+#ifndef TK_NO_DEPRECATED
{ "asciicircum", 0x5E },
{ "underscore", 0x5F },
{ "grave", 0x60 },
@@ -452,11 +492,17 @@
{ "x", 0x78 },
{ "y", 0x79 },
{ "z", 0x7A },
+#endif
{ "braceleft", 0x7B },
+#ifndef TK_NO_DEPRECATED
{ "bar", 0x7C },
+#endif
{ "braceright", 0x7D },
+#ifndef TK_NO_DEPRECATED
{ "asciitilde", 0x7E },
+#endif
{ "nobreakspace", 0xA0 },
+#ifndef TK_NO_DEPRECATED
{ "exclamdown", 0xA1 },
{ "cent", 0xA2 },
{ "sterling", 0xA3 },
@@ -550,9 +596,6 @@
{ "odiaeresis", 0xF6 },
{ "division", 0xF7 },
{ "oslash", 0xF8 },
-#ifndef TK_NO_DEPRECATED
-{ "ooblique", 0xF8 },
-#endif
{ "ugrave", 0xF9 },
{ "uacute", 0xFA },
{ "ucircumflex", 0xFB },
@@ -560,6 +603,7 @@
{ "yacute", 0xFD },
{ "thorn", 0xFE },
{ "ydiaeresis", 0xFF },
+#endif /* TK_NO_DEPRECATED */
{ "Aogonek", 0x1A1 },
{ "breve", 0x1A2 },
{ "Lstroke", 0x1A3 },
@@ -680,32 +724,6 @@
{ "uogonek", 0x3F9 },
{ "utilde", 0x3FD },
{ "umacron", 0x3FE },
-{ "Wcircumflex", 0x1000174 },
-{ "wcircumflex", 0x1000175 },
-{ "Ycircumflex", 0x1000176 },
-{ "ycircumflex", 0x1000177 },
-{ "Babovedot", 0x1001E02 },
-{ "babovedot", 0x1001E03 },
-{ "Dabovedot", 0x1001E0A },
-{ "dabovedot", 0x1001E0B },
-{ "Fabovedot", 0x1001E1E },
-{ "fabovedot", 0x1001E1F },
-{ "Mabovedot", 0x1001E40 },
-{ "mabovedot", 0x1001E41 },
-{ "Pabovedot", 0x1001E56 },
-{ "pabovedot", 0x1001E57 },
-{ "Sabovedot", 0x1001E60 },
-{ "sabovedot", 0x1001E61 },
-{ "Tabovedot", 0x1001E6A },
-{ "tabovedot", 0x1001E6B },
-{ "Wgrave", 0x1001E80 },
-{ "wgrave", 0x1001E81 },
-{ "Wacute", 0x1001E82 },
-{ "wacute", 0x1001E83 },
-{ "Wdiaeresis", 0x1001E84 },
-{ "wdiaeresis", 0x1001E85 },
-{ "Ygrave", 0x1001EF2 },
-{ "ygrave", 0x1001EF3 },
{ "OE", 0x13BC },
{ "oe", 0x13BD },
{ "Ydiaeresis", 0x13BE },
@@ -788,36 +806,7 @@
{ "kana_N", 0x4DD },
{ "voicedsound", 0x4DE },
{ "semivoicedsound", 0x4DF },
-{ "kana_switch", 0xFF7E },
-{ "Farsi_0", 0x10006F0 },
-{ "Farsi_1", 0x10006F1 },
-{ "Farsi_2", 0x10006F2 },
-{ "Farsi_3", 0x10006F3 },
-{ "Farsi_4", 0x10006F4 },
-{ "Farsi_5", 0x10006F5 },
-{ "Farsi_6", 0x10006F6 },
-{ "Farsi_7", 0x10006F7 },
-{ "Farsi_8", 0x10006F8 },
-{ "Farsi_9", 0x10006F9 },
-{ "Arabic_percent", 0x100066A },
-{ "Arabic_superscript_alef", 0x1000670 },
-{ "Arabic_tteh", 0x1000679 },
-{ "Arabic_peh", 0x100067E },
-{ "Arabic_tcheh", 0x1000686 },
-{ "Arabic_ddal", 0x1000688 },
-{ "Arabic_rreh", 0x1000691 },
{ "Arabic_comma", 0x5AC },
-{ "Arabic_fullstop", 0x10006D4 },
-{ "Arabic_0", 0x1000660 },
-{ "Arabic_1", 0x1000661 },
-{ "Arabic_2", 0x1000662 },
-{ "Arabic_3", 0x1000663 },
-{ "Arabic_4", 0x1000664 },
-{ "Arabic_5", 0x1000665 },
-{ "Arabic_6", 0x1000666 },
-{ "Arabic_7", 0x1000667 },
-{ "Arabic_8", 0x1000668 },
-{ "Arabic_9", 0x1000669 },
{ "Arabic_semicolon", 0x5BB },
{ "Arabic_question_mark", 0x5BF },
{ "Arabic_hamza", 0x5C1 },
@@ -868,50 +857,6 @@
{ "Arabic_kasra", 0x5F0 },
{ "Arabic_shadda", 0x5F1 },
{ "Arabic_sukun", 0x5F2 },
-{ "Arabic_madda_above", 0x1000653 },
-{ "Arabic_hamza_above", 0x1000654 },
-{ "Arabic_hamza_below", 0x1000655 },
-{ "Arabic_jeh", 0x1000698 },
-{ "Arabic_veh", 0x10006A4 },
-{ "Arabic_keheh", 0x10006A9 },
-{ "Arabic_gaf", 0x10006AF },
-{ "Arabic_noon_ghunna", 0x10006BA },
-{ "Arabic_heh_doachashmee", 0x10006BE },
-{ "Farsi_yeh", 0x10006CC },
-{ "Arabic_farsi_yeh", 0x10006CC },
-{ "Arabic_yeh_baree", 0x10006D2 },
-{ "Arabic_heh_goal", 0x10006C1 },
-{ "Arabic_switch", 0xFF7E },
-{ "Cyrillic_GHE_bar", 0x1000492 },
-{ "Cyrillic_ghe_bar", 0x1000493 },
-{ "Cyrillic_ZHE_descender", 0x1000496 },
-{ "Cyrillic_zhe_descender", 0x1000497 },
-{ "Cyrillic_KA_descender", 0x100049A },
-{ "Cyrillic_ka_descender", 0x100049B },
-{ "Cyrillic_KA_vertstroke", 0x100049C },
-{ "Cyrillic_ka_vertstroke", 0x100049D },
-{ "Cyrillic_EN_descender", 0x10004A2 },
-{ "Cyrillic_en_descender", 0x10004A3 },
-{ "Cyrillic_U_straight", 0x10004AE },
-{ "Cyrillic_u_straight", 0x10004AF },
-{ "Cyrillic_U_straight_bar", 0x10004B0 },
-{ "Cyrillic_u_straight_bar", 0x10004B1 },
-{ "Cyrillic_HA_descender", 0x10004B2 },
-{ "Cyrillic_ha_descender", 0x10004B3 },
-{ "Cyrillic_CHE_descender", 0x10004B6 },
-{ "Cyrillic_che_descender", 0x10004B7 },
-{ "Cyrillic_CHE_vertstroke", 0x10004B8 },
-{ "Cyrillic_che_vertstroke", 0x10004B9 },
-{ "Cyrillic_SHHA", 0x10004BA },
-{ "Cyrillic_shha", 0x10004BB },
-{ "Cyrillic_SCHWA", 0x10004D8 },
-{ "Cyrillic_schwa", 0x10004D9 },
-{ "Cyrillic_I_macron", 0x10004E2 },
-{ "Cyrillic_i_macron", 0x10004E3 },
-{ "Cyrillic_O_bar", 0x10004E8 },
-{ "Cyrillic_o_bar", 0x10004E9 },
-{ "Cyrillic_U_macron", 0x10004EE },
-{ "Cyrillic_u_macron", 0x10004EF },
{ "Serbian_dje", 0x6A1 },
{ "Macedonia_gje", 0x6A2 },
{ "Cyrillic_io", 0x6A3 },
@@ -1054,7 +999,9 @@
{ "Greek_ETAaccent", 0x7A3 },
{ "Greek_IOTAaccent", 0x7A4 },
{ "Greek_IOTAdieresis", 0x7A5 },
+#ifndef TK_NO_DEPRECATED
{ "Greek_IOTAdiaeresis", 0x7A5 },
+#endif
{ "Greek_IOTAaccentdiaeresis", 0x7A6 },
{ "Greek_OMICRONaccent", 0x7A7 },
{ "Greek_UPSILONaccent", 0x7A8 },
@@ -1125,7 +1072,6 @@
{ "Greek_chi", 0x7F7 },
{ "Greek_psi", 0x7F8 },
{ "Greek_omega", 0x7F9 },
-{ "Greek_switch", 0xFF7E },
{ "leftradical", 0x8A1 },
{ "topleftradical", 0x8A2 },
{ "horizconnector", 0x8A3 },
@@ -1363,7 +1309,6 @@
#ifndef TK_NO_DEPRECATED
{ "hebrew_taf", 0xCFA },
#endif
-{ "Hebrew_switch", 0xFF7E },
{ "Thai_kokai", 0xDA1 },
{ "Thai_khokhai", 0xDA2 },
{ "Thai_khokhuat", 0xDA3 },
@@ -1448,22 +1393,6 @@
{ "Thai_lekchet", 0xDF7 },
{ "Thai_lekpaet", 0xDF8 },
{ "Thai_lekkao", 0xDF9 },
-{ "Hangul", 0xFF31 },
-{ "Hangul_Start", 0xFF32 },
-{ "Hangul_End", 0xFF33 },
-{ "Hangul_Hanja", 0xFF34 },
-{ "Hangul_Jamo", 0xFF35 },
-{ "Hangul_Romaja", 0xFF36 },
-{ "Hangul_Codeinput", 0xFF37 },
-{ "Hangul_Jeonja", 0xFF38 },
-{ "Hangul_Banja", 0xFF39 },
-{ "Hangul_PreHanja", 0xFF3A },
-{ "Hangul_PostHanja", 0xFF3B },
-{ "Hangul_SingleCandidate", 0xFF3C },
-{ "Hangul_MultipleCandidate", 0xFF3D },
-{ "Hangul_PreviousCandidate", 0xFF3E },
-{ "Hangul_Special", 0xFF3F },
-{ "Hangul_switch", 0xFF7E },
{ "Hangul_Kiyeog", 0xEA1 },
{ "Hangul_SsangKiyeog", 0xEA2 },
{ "Hangul_KiyeogSios", 0xEA3 },
@@ -1555,636 +1484,6 @@
{ "Hangul_J_KkogjiDalrinIeung", 0xEF9 },
{ "Hangul_J_YeorinHieuh", 0xEFA },
{ "Korean_Won", 0xEFF },
-{ "Armenian_ligature_ew", 0x1000587 },
-{ "Armenian_full_stop", 0x1000589 },
-{ "Armenian_verjaket", 0x1000589 },
-{ "Armenian_separation_mark", 0x100055D },
-{ "Armenian_but", 0x100055D },
-{ "Armenian_hyphen", 0x100058A },
-{ "Armenian_yentamna", 0x100058A },
-{ "Armenian_exclam", 0x100055C },
-{ "Armenian_amanak", 0x100055C },
-{ "Armenian_accent", 0x100055B },
-{ "Armenian_shesht", 0x100055B },
-{ "Armenian_question", 0x100055E },
-{ "Armenian_paruyk", 0x100055E },
-{ "Armenian_AYB", 0x1000531 },
-{ "Armenian_ayb", 0x1000561 },
-{ "Armenian_BEN", 0x1000532 },
-{ "Armenian_ben", 0x1000562 },
-{ "Armenian_GIM", 0x1000533 },
-{ "Armenian_gim", 0x1000563 },
-{ "Armenian_DA", 0x1000534 },
-{ "Armenian_da", 0x1000564 },
-{ "Armenian_YECH", 0x1000535 },
-{ "Armenian_yech", 0x1000565 },
-{ "Armenian_ZA", 0x1000536 },
-{ "Armenian_za", 0x1000566 },
-{ "Armenian_E", 0x1000537 },
-{ "Armenian_e", 0x1000567 },
-{ "Armenian_AT", 0x1000538 },
-{ "Armenian_at", 0x1000568 },
-{ "Armenian_TO", 0x1000539 },
-{ "Armenian_to", 0x1000569 },
-{ "Armenian_ZHE", 0x100053A },
-{ "Armenian_zhe", 0x100056A },
-{ "Armenian_INI", 0x100053B },
-{ "Armenian_ini", 0x100056B },
-{ "Armenian_LYUN", 0x100053C },
-{ "Armenian_lyun", 0x100056C },
-{ "Armenian_KHE", 0x100053D },
-{ "Armenian_khe", 0x100056D },
-{ "Armenian_TSA", 0x100053E },
-{ "Armenian_tsa", 0x100056E },
-{ "Armenian_KEN", 0x100053F },
-{ "Armenian_ken", 0x100056F },
-{ "Armenian_HO", 0x1000540 },
-{ "Armenian_ho", 0x1000570 },
-{ "Armenian_DZA", 0x1000541 },
-{ "Armenian_dza", 0x1000571 },
-{ "Armenian_GHAT", 0x1000542 },
-{ "Armenian_ghat", 0x1000572 },
-{ "Armenian_TCHE", 0x1000543 },
-{ "Armenian_tche", 0x1000573 },
-{ "Armenian_MEN", 0x1000544 },
-{ "Armenian_men", 0x1000574 },
-{ "Armenian_HI", 0x1000545 },
-{ "Armenian_hi", 0x1000575 },
-{ "Armenian_NU", 0x1000546 },
-{ "Armenian_nu", 0x1000576 },
-{ "Armenian_SHA", 0x1000547 },
-{ "Armenian_sha", 0x1000577 },
-{ "Armenian_VO", 0x1000548 },
-{ "Armenian_vo", 0x1000578 },
-{ "Armenian_CHA", 0x1000549 },
-{ "Armenian_cha", 0x1000579 },
-{ "Armenian_PE", 0x100054A },
-{ "Armenian_pe", 0x100057A },
-{ "Armenian_JE", 0x100054B },
-{ "Armenian_je", 0x100057B },
-{ "Armenian_RA", 0x100054C },
-{ "Armenian_ra", 0x100057C },
-{ "Armenian_SE", 0x100054D },
-{ "Armenian_se", 0x100057D },
-{ "Armenian_VEV", 0x100054E },
-{ "Armenian_vev", 0x100057E },
-{ "Armenian_TYUN", 0x100054F },
-{ "Armenian_tyun", 0x100057F },
-{ "Armenian_RE", 0x1000550 },
-{ "Armenian_re", 0x1000580 },
-{ "Armenian_TSO", 0x1000551 },
-{ "Armenian_tso", 0x1000581 },
-{ "Armenian_VYUN", 0x1000552 },
-{ "Armenian_vyun", 0x1000582 },
-{ "Armenian_PYUR", 0x1000553 },
-{ "Armenian_pyur", 0x1000583 },
-{ "Armenian_KE", 0x1000554 },
-{ "Armenian_ke", 0x1000584 },
-{ "Armenian_O", 0x1000555 },
-{ "Armenian_o", 0x1000585 },
-{ "Armenian_FE", 0x1000556 },
-{ "Armenian_fe", 0x1000586 },
-{ "Armenian_apostrophe", 0x100055A },
-{ "Georgian_an", 0x10010D0 },
-{ "Georgian_ban", 0x10010D1 },
-{ "Georgian_gan", 0x10010D2 },
-{ "Georgian_don", 0x10010D3 },
-{ "Georgian_en", 0x10010D4 },
-{ "Georgian_vin", 0x10010D5 },
-{ "Georgian_zen", 0x10010D6 },
-{ "Georgian_tan", 0x10010D7 },
-{ "Georgian_in", 0x10010D8 },
-{ "Georgian_kan", 0x10010D9 },
-{ "Georgian_las", 0x10010DA },
-{ "Georgian_man", 0x10010DB },
-{ "Georgian_nar", 0x10010DC },
-{ "Georgian_on", 0x10010DD },
-{ "Georgian_par", 0x10010DE },
-{ "Georgian_zhar", 0x10010DF },
-{ "Georgian_rae", 0x10010E0 },
-{ "Georgian_san", 0x10010E1 },
-{ "Georgian_tar", 0x10010E2 },
-{ "Georgian_un", 0x10010E3 },
-{ "Georgian_phar", 0x10010E4 },
-{ "Georgian_khar", 0x10010E5 },
-{ "Georgian_ghan", 0x10010E6 },
-{ "Georgian_qar", 0x10010E7 },
-{ "Georgian_shin", 0x10010E8 },
-{ "Georgian_chin", 0x10010E9 },
-{ "Georgian_can", 0x10010EA },
-{ "Georgian_jil", 0x10010EB },
-{ "Georgian_cil", 0x10010EC },
-{ "Georgian_char", 0x10010ED },
-{ "Georgian_xan", 0x10010EE },
-{ "Georgian_jhan", 0x10010EF },
-{ "Georgian_hae", 0x10010F0 },
-{ "Georgian_he", 0x10010F1 },
-{ "Georgian_hie", 0x10010F2 },
-{ "Georgian_we", 0x10010F3 },
-{ "Georgian_har", 0x10010F4 },
-{ "Georgian_hoe", 0x10010F5 },
-{ "Georgian_fi", 0x10010F6 },
-{ "Xabovedot", 0x1001E8A },
-{ "Ibreve", 0x100012C },
-{ "Zstroke", 0x10001B5 },
-{ "Gcaron", 0x10001E6 },
-{ "Ocaron", 0x10001D1 },
-{ "Obarred", 0x100019F },
-{ "xabovedot", 0x1001E8B },
-{ "ibreve", 0x100012D },
-{ "zstroke", 0x10001B6 },
-{ "gcaron", 0x10001E7 },
-{ "ocaron", 0x10001D2 },
-{ "obarred", 0x1000275 },
-{ "SCHWA", 0x100018F },
-{ "schwa", 0x1000259 },
-{ "EZH", 0x10001B7 },
-{ "ezh", 0x1000292 },
-{ "Lbelowdot", 0x1001E36 },
-{ "lbelowdot", 0x1001E37 },
-{ "Abelowdot", 0x1001EA0 },
-{ "abelowdot", 0x1001EA1 },
-{ "Ahook", 0x1001EA2 },
-{ "ahook", 0x1001EA3 },
-{ "Acircumflexacute", 0x1001EA4 },
-{ "acircumflexacute", 0x1001EA5 },
-{ "Acircumflexgrave", 0x1001EA6 },
-{ "acircumflexgrave", 0x1001EA7 },
-{ "Acircumflexhook", 0x1001EA8 },
-{ "acircumflexhook", 0x1001EA9 },
-{ "Acircumflextilde", 0x1001EAA },
-{ "acircumflextilde", 0x1001EAB },
-{ "Acircumflexbelowdot", 0x1001EAC },
-{ "acircumflexbelowdot", 0x1001EAD },
-{ "Abreveacute", 0x1001EAE },
-{ "abreveacute", 0x1001EAF },
-{ "Abrevegrave", 0x1001EB0 },
-{ "abrevegrave", 0x1001EB1 },
-{ "Abrevehook", 0x1001EB2 },
-{ "abrevehook", 0x1001EB3 },
-{ "Abrevetilde", 0x1001EB4 },
-{ "abrevetilde", 0x1001EB5 },
-{ "Abrevebelowdot", 0x1001EB6 },
-{ "abrevebelowdot", 0x1001EB7 },
-{ "Ebelowdot", 0x1001EB8 },
-{ "ebelowdot", 0x1001EB9 },
-{ "Ehook", 0x1001EBA },
-{ "ehook", 0x1001EBB },
-{ "Etilde", 0x1001EBC },
-{ "etilde", 0x1001EBD },
-{ "Ecircumflexacute", 0x1001EBE },
-{ "ecircumflexacute", 0x1001EBF },
-{ "Ecircumflexgrave", 0x1001EC0 },
-{ "ecircumflexgrave", 0x1001EC1 },
-{ "Ecircumflexhook", 0x1001EC2 },
-{ "ecircumflexhook", 0x1001EC3 },
-{ "Ecircumflextilde", 0x1001EC4 },
-{ "ecircumflextilde", 0x1001EC5 },
-{ "Ecircumflexbelowdot", 0x1001EC6 },
-{ "ecircumflexbelowdot", 0x1001EC7 },
-{ "Ihook", 0x1001EC8 },
-{ "ihook", 0x1001EC9 },
-{ "Ibelowdot", 0x1001ECA },
-{ "ibelowdot", 0x1001ECB },
-{ "Obelowdot", 0x1001ECC },
-{ "obelowdot", 0x1001ECD },
-{ "Ohook", 0x1001ECE },
-{ "ohook", 0x1001ECF },
-{ "Ocircumflexacute", 0x1001ED0 },
-{ "ocircumflexacute", 0x1001ED1 },
-{ "Ocircumflexgrave", 0x1001ED2 },
-{ "ocircumflexgrave", 0x1001ED3 },
-{ "Ocircumflexhook", 0x1001ED4 },
-{ "ocircumflexhook", 0x1001ED5 },
-{ "Ocircumflextilde", 0x1001ED6 },
-{ "ocircumflextilde", 0x1001ED7 },
-{ "Ocircumflexbelowdot", 0x1001ED8 },
-{ "ocircumflexbelowdot", 0x1001ED9 },
-{ "Ohornacute", 0x1001EDA },
-{ "ohornacute", 0x1001EDB },
-{ "Ohorngrave", 0x1001EDC },
-{ "ohorngrave", 0x1001EDD },
-{ "Ohornhook", 0x1001EDE },
-{ "ohornhook", 0x1001EDF },
-{ "Ohorntilde", 0x1001EE0 },
-{ "ohorntilde", 0x1001EE1 },
-{ "Ohornbelowdot", 0x1001EE2 },
-{ "ohornbelowdot", 0x1001EE3 },
-{ "Ubelowdot", 0x1001EE4 },
-{ "ubelowdot", 0x1001EE5 },
-{ "Uhook", 0x1001EE6 },
-{ "uhook", 0x1001EE7 },
-{ "Uhornacute", 0x1001EE8 },
-{ "uhornacute", 0x1001EE9 },
-{ "Uhorngrave", 0x1001EEA },
-{ "uhorngrave", 0x1001EEB },
-{ "Uhornhook", 0x1001EEC },
-{ "uhornhook", 0x1001EED },
-{ "Uhorntilde", 0x1001EEE },
-{ "uhorntilde", 0x1001EEF },
-{ "Uhornbelowdot", 0x1001EF0 },
-{ "uhornbelowdot", 0x1001EF1 },
-{ "Ybelowdot", 0x1001EF4 },
-{ "ybelowdot", 0x1001EF5 },
-{ "Yhook", 0x1001EF6 },
-{ "yhook", 0x1001EF7 },
-{ "Ytilde", 0x1001EF8 },
-{ "ytilde", 0x1001EF9 },
-{ "Ohorn", 0x10001A0 },
-{ "ohorn", 0x10001A1 },
-{ "Uhorn", 0x10001AF },
-{ "uhorn", 0x10001B0 },
-{ "EcuSign", 0x10020A0 },
-{ "ColonSign", 0x10020A1 },
-{ "CruzeiroSign", 0x10020A2 },
-{ "FFrancSign", 0x10020A3 },
-{ "LiraSign", 0x10020A4 },
-{ "MillSign", 0x10020A5 },
-{ "NairaSign", 0x10020A6 },
-{ "PesetaSign", 0x10020A7 },
-{ "RupeeSign", 0x10020A8 },
-{ "WonSign", 0x10020A9 },
-{ "NewSheqelSign", 0x10020AA },
-{ "DongSign", 0x10020AB },
-{ "EuroSign", 0x20AC },
-{ "zerosuperior", 0x1002070 },
-{ "foursuperior", 0x1002074 },
-{ "fivesuperior", 0x1002075 },
-{ "sixsuperior", 0x1002076 },
-{ "sevensuperior", 0x1002077 },
-{ "eightsuperior", 0x1002078 },
-{ "ninesuperior", 0x1002079 },
-{ "zerosubscript", 0x1002080 },
-{ "onesubscript", 0x1002081 },
-{ "twosubscript", 0x1002082 },
-{ "threesubscript", 0x1002083 },
-{ "foursubscript", 0x1002084 },
-{ "fivesubscript", 0x1002085 },
-{ "sixsubscript", 0x1002086 },
-{ "sevensubscript", 0x1002087 },
-{ "eightsubscript", 0x1002088 },
-{ "ninesubscript", 0x1002089 },
-{ "partdifferential", 0x1002202 },
-{ "emptyset", 0x1002205 },
-{ "elementof", 0x1002208 },
-{ "notelementof", 0x1002209 },
-{ "containsas", 0x100220B },
-{ "squareroot", 0x100221A },
-{ "cuberoot", 0x100221B },
-{ "fourthroot", 0x100221C },
-{ "dintegral", 0x100222C },
-{ "tintegral", 0x100222D },
-{ "because", 0x1002235 },
-{ "approxeq", 0x1002248 },
-{ "notapproxeq", 0x1002247 },
-{ "notidentical", 0x1002262 },
-{ "stricteq", 0x1002263 },
-{ "braille_dot_1", 0xFFF1 },
-{ "braille_dot_2", 0xFFF2 },
-{ "braille_dot_3", 0xFFF3 },
-{ "braille_dot_4", 0xFFF4 },
-{ "braille_dot_5", 0xFFF5 },
-{ "braille_dot_6", 0xFFF6 },
-{ "braille_dot_7", 0xFFF7 },
-{ "braille_dot_8", 0xFFF8 },
-{ "braille_dot_9", 0xFFF9 },
-{ "braille_dot_10", 0xFFFA },
-{ "braille_blank", 0x1002800 },
-{ "braille_dots_1", 0x1002801 },
-{ "braille_dots_2", 0x1002802 },
-{ "braille_dots_12", 0x1002803 },
-{ "braille_dots_3", 0x1002804 },
-{ "braille_dots_13", 0x1002805 },
-{ "braille_dots_23", 0x1002806 },
-{ "braille_dots_123", 0x1002807 },
-{ "braille_dots_4", 0x1002808 },
-{ "braille_dots_14", 0x1002809 },
-{ "braille_dots_24", 0x100280A },
-{ "braille_dots_124", 0x100280B },
-{ "braille_dots_34", 0x100280C },
-{ "braille_dots_134", 0x100280D },
-{ "braille_dots_234", 0x100280E },
-{ "braille_dots_1234", 0x100280F },
-{ "braille_dots_5", 0x1002810 },
-{ "braille_dots_15", 0x1002811 },
-{ "braille_dots_25", 0x1002812 },
-{ "braille_dots_125", 0x1002813 },
-{ "braille_dots_35", 0x1002814 },
-{ "braille_dots_135", 0x1002815 },
-{ "braille_dots_235", 0x1002816 },
-{ "braille_dots_1235", 0x1002817 },
-{ "braille_dots_45", 0x1002818 },
-{ "braille_dots_145", 0x1002819 },
-{ "braille_dots_245", 0x100281A },
-{ "braille_dots_1245", 0x100281B },
-{ "braille_dots_345", 0x100281C },
-{ "braille_dots_1345", 0x100281D },
-{ "braille_dots_2345", 0x100281E },
-{ "braille_dots_12345", 0x100281F },
-{ "braille_dots_6", 0x1002820 },
-{ "braille_dots_16", 0x1002821 },
-{ "braille_dots_26", 0x1002822 },
-{ "braille_dots_126", 0x1002823 },
-{ "braille_dots_36", 0x1002824 },
-{ "braille_dots_136", 0x1002825 },
-{ "braille_dots_236", 0x1002826 },
-{ "braille_dots_1236", 0x1002827 },
-{ "braille_dots_46", 0x1002828 },
-{ "braille_dots_146", 0x1002829 },
-{ "braille_dots_246", 0x100282A },
-{ "braille_dots_1246", 0x100282B },
-{ "braille_dots_346", 0x100282C },
-{ "braille_dots_1346", 0x100282D },
-{ "braille_dots_2346", 0x100282E },
-{ "braille_dots_12346", 0x100282F },
-{ "braille_dots_56", 0x1002830 },
-{ "braille_dots_156", 0x1002831 },
-{ "braille_dots_256", 0x1002832 },
-{ "braille_dots_1256", 0x1002833 },
-{ "braille_dots_356", 0x1002834 },
-{ "braille_dots_1356", 0x1002835 },
-{ "braille_dots_2356", 0x1002836 },
-{ "braille_dots_12356", 0x1002837 },
-{ "braille_dots_456", 0x1002838 },
-{ "braille_dots_1456", 0x1002839 },
-{ "braille_dots_2456", 0x100283A },
-{ "braille_dots_12456", 0x100283B },
-{ "braille_dots_3456", 0x100283C },
-{ "braille_dots_13456", 0x100283D },
-{ "braille_dots_23456", 0x100283E },
-{ "braille_dots_123456", 0x100283F },
-{ "braille_dots_7", 0x1002840 },
-{ "braille_dots_17", 0x1002841 },
-{ "braille_dots_27", 0x1002842 },
-{ "braille_dots_127", 0x1002843 },
-{ "braille_dots_37", 0x1002844 },
-{ "braille_dots_137", 0x1002845 },
-{ "braille_dots_237", 0x1002846 },
-{ "braille_dots_1237", 0x1002847 },
-{ "braille_dots_47", 0x1002848 },
-{ "braille_dots_147", 0x1002849 },
-{ "braille_dots_247", 0x100284A },
-{ "braille_dots_1247", 0x100284B },
-{ "braille_dots_347", 0x100284C },
-{ "braille_dots_1347", 0x100284D },
-{ "braille_dots_2347", 0x100284E },
-{ "braille_dots_12347", 0x100284F },
-{ "braille_dots_57", 0x1002850 },
-{ "braille_dots_157", 0x1002851 },
-{ "braille_dots_257", 0x1002852 },
-{ "braille_dots_1257", 0x1002853 },
-{ "braille_dots_357", 0x1002854 },
-{ "braille_dots_1357", 0x1002855 },
-{ "braille_dots_2357", 0x1002856 },
-{ "braille_dots_12357", 0x1002857 },
-{ "braille_dots_457", 0x1002858 },
-{ "braille_dots_1457", 0x1002859 },
-{ "braille_dots_2457", 0x100285A },
-{ "braille_dots_12457", 0x100285B },
-{ "braille_dots_3457", 0x100285C },
-{ "braille_dots_13457", 0x100285D },
-{ "braille_dots_23457", 0x100285E },
-{ "braille_dots_123457", 0x100285F },
-{ "braille_dots_67", 0x1002860 },
-{ "braille_dots_167", 0x1002861 },
-{ "braille_dots_267", 0x1002862 },
-{ "braille_dots_1267", 0x1002863 },
-{ "braille_dots_367", 0x1002864 },
-{ "braille_dots_1367", 0x1002865 },
-{ "braille_dots_2367", 0x1002866 },
-{ "braille_dots_12367", 0x1002867 },
-{ "braille_dots_467", 0x1002868 },
-{ "braille_dots_1467", 0x1002869 },
-{ "braille_dots_2467", 0x100286A },
-{ "braille_dots_12467", 0x100286B },
-{ "braille_dots_3467", 0x100286C },
-{ "braille_dots_13467", 0x100286D },
-{ "braille_dots_23467", 0x100286E },
-{ "braille_dots_123467", 0x100286F },
-{ "braille_dots_567", 0x1002870 },
-{ "braille_dots_1567", 0x1002871 },
-{ "braille_dots_2567", 0x1002872 },
-{ "braille_dots_12567", 0x1002873 },
-{ "braille_dots_3567", 0x1002874 },
-{ "braille_dots_13567", 0x1002875 },
-{ "braille_dots_23567", 0x1002876 },
-{ "braille_dots_123567", 0x1002877 },
-{ "braille_dots_4567", 0x1002878 },
-{ "braille_dots_14567", 0x1002879 },
-{ "braille_dots_24567", 0x100287A },
-{ "braille_dots_124567", 0x100287B },
-{ "braille_dots_34567", 0x100287C },
-{ "braille_dots_134567", 0x100287D },
-{ "braille_dots_234567", 0x100287E },
-{ "braille_dots_1234567", 0x100287F },
-{ "braille_dots_8", 0x1002880 },
-{ "braille_dots_18", 0x1002881 },
-{ "braille_dots_28", 0x1002882 },
-{ "braille_dots_128", 0x1002883 },
-{ "braille_dots_38", 0x1002884 },
-{ "braille_dots_138", 0x1002885 },
-{ "braille_dots_238", 0x1002886 },
-{ "braille_dots_1238", 0x1002887 },
-{ "braille_dots_48", 0x1002888 },
-{ "braille_dots_148", 0x1002889 },
-{ "braille_dots_248", 0x100288A },
-{ "braille_dots_1248", 0x100288B },
-{ "braille_dots_348", 0x100288C },
-{ "braille_dots_1348", 0x100288D },
-{ "braille_dots_2348", 0x100288E },
-{ "braille_dots_12348", 0x100288F },
-{ "braille_dots_58", 0x1002890 },
-{ "braille_dots_158", 0x1002891 },
-{ "braille_dots_258", 0x1002892 },
-{ "braille_dots_1258", 0x1002893 },
-{ "braille_dots_358", 0x1002894 },
-{ "braille_dots_1358", 0x1002895 },
-{ "braille_dots_2358", 0x1002896 },
-{ "braille_dots_12358", 0x1002897 },
-{ "braille_dots_458", 0x1002898 },
-{ "braille_dots_1458", 0x1002899 },
-{ "braille_dots_2458", 0x100289A },
-{ "braille_dots_12458", 0x100289B },
-{ "braille_dots_3458", 0x100289C },
-{ "braille_dots_13458", 0x100289D },
-{ "braille_dots_23458", 0x100289E },
-{ "braille_dots_123458", 0x100289F },
-{ "braille_dots_68", 0x10028A0 },
-{ "braille_dots_168", 0x10028A1 },
-{ "braille_dots_268", 0x10028A2 },
-{ "braille_dots_1268", 0x10028A3 },
-{ "braille_dots_368", 0x10028A4 },
-{ "braille_dots_1368", 0x10028A5 },
-{ "braille_dots_2368", 0x10028A6 },
-{ "braille_dots_12368", 0x10028A7 },
-{ "braille_dots_468", 0x10028A8 },
-{ "braille_dots_1468", 0x10028A9 },
-{ "braille_dots_2468", 0x10028AA },
-{ "braille_dots_12468", 0x10028AB },
-{ "braille_dots_3468", 0x10028AC },
-{ "braille_dots_13468", 0x10028AD },
-{ "braille_dots_23468", 0x10028AE },
-{ "braille_dots_123468", 0x10028AF },
-{ "braille_dots_568", 0x10028B0 },
-{ "braille_dots_1568", 0x10028B1 },
-{ "braille_dots_2568", 0x10028B2 },
-{ "braille_dots_12568", 0x10028B3 },
-{ "braille_dots_3568", 0x10028B4 },
-{ "braille_dots_13568", 0x10028B5 },
-{ "braille_dots_23568", 0x10028B6 },
-{ "braille_dots_123568", 0x10028B7 },
-{ "braille_dots_4568", 0x10028B8 },
-{ "braille_dots_14568", 0x10028B9 },
-{ "braille_dots_24568", 0x10028BA },
-{ "braille_dots_124568", 0x10028BB },
-{ "braille_dots_34568", 0x10028BC },
-{ "braille_dots_134568", 0x10028BD },
-{ "braille_dots_234568", 0x10028BE },
-{ "braille_dots_1234568", 0x10028BF },
-{ "braille_dots_78", 0x10028C0 },
-{ "braille_dots_178", 0x10028C1 },
-{ "braille_dots_278", 0x10028C2 },
-{ "braille_dots_1278", 0x10028C3 },
-{ "braille_dots_378", 0x10028C4 },
-{ "braille_dots_1378", 0x10028C5 },
-{ "braille_dots_2378", 0x10028C6 },
-{ "braille_dots_12378", 0x10028C7 },
-{ "braille_dots_478", 0x10028C8 },
-{ "braille_dots_1478", 0x10028C9 },
-{ "braille_dots_2478", 0x10028CA },
-{ "braille_dots_12478", 0x10028CB },
-{ "braille_dots_3478", 0x10028CC },
-{ "braille_dots_13478", 0x10028CD },
-{ "braille_dots_23478", 0x10028CE },
-{ "braille_dots_123478", 0x10028CF },
-{ "braille_dots_578", 0x10028D0 },
-{ "braille_dots_1578", 0x10028D1 },
-{ "braille_dots_2578", 0x10028D2 },
-{ "braille_dots_12578", 0x10028D3 },
-{ "braille_dots_3578", 0x10028D4 },
-{ "braille_dots_13578", 0x10028D5 },
-{ "braille_dots_23578", 0x10028D6 },
-{ "braille_dots_123578", 0x10028D7 },
-{ "braille_dots_4578", 0x10028D8 },
-{ "braille_dots_14578", 0x10028D9 },
-{ "braille_dots_24578", 0x10028DA },
-{ "braille_dots_124578", 0x10028DB },
-{ "braille_dots_34578", 0x10028DC },
-{ "braille_dots_134578", 0x10028DD },
-{ "braille_dots_234578", 0x10028DE },
-{ "braille_dots_1234578", 0x10028DF },
-{ "braille_dots_678", 0x10028E0 },
-{ "braille_dots_1678", 0x10028E1 },
-{ "braille_dots_2678", 0x10028E2 },
-{ "braille_dots_12678", 0x10028E3 },
-{ "braille_dots_3678", 0x10028E4 },
-{ "braille_dots_13678", 0x10028E5 },
-{ "braille_dots_23678", 0x10028E6 },
-{ "braille_dots_123678", 0x10028E7 },
-{ "braille_dots_4678", 0x10028E8 },
-{ "braille_dots_14678", 0x10028E9 },
-{ "braille_dots_24678", 0x10028EA },
-{ "braille_dots_124678", 0x10028EB },
-{ "braille_dots_34678", 0x10028EC },
-{ "braille_dots_134678", 0x10028ED },
-{ "braille_dots_234678", 0x10028EE },
-{ "braille_dots_1234678", 0x10028EF },
-{ "braille_dots_5678", 0x10028F0 },
-{ "braille_dots_15678", 0x10028F1 },
-{ "braille_dots_25678", 0x10028F2 },
-{ "braille_dots_125678", 0x10028F3 },
-{ "braille_dots_35678", 0x10028F4 },
-{ "braille_dots_135678", 0x10028F5 },
-{ "braille_dots_235678", 0x10028F6 },
-{ "braille_dots_1235678", 0x10028F7 },
-{ "braille_dots_45678", 0x10028F8 },
-{ "braille_dots_145678", 0x10028F9 },
-{ "braille_dots_245678", 0x10028FA },
-{ "braille_dots_1245678", 0x10028FB },
-{ "braille_dots_345678", 0x10028FC },
-{ "braille_dots_1345678", 0x10028FD },
-{ "braille_dots_2345678", 0x10028FE },
-{ "braille_dots_12345678", 0x10028FF },
-{ "Sinh_ng", 0x1000D82 },
-{ "Sinh_h2", 0x1000D83 },
-{ "Sinh_a", 0x1000D85 },
-{ "Sinh_aa", 0x1000D86 },
-{ "Sinh_ae", 0x1000D87 },
-{ "Sinh_aee", 0x1000D88 },
-{ "Sinh_i", 0x1000D89 },
-{ "Sinh_ii", 0x1000D8A },
-{ "Sinh_u", 0x1000D8B },
-{ "Sinh_uu", 0x1000D8C },
-{ "Sinh_ri", 0x1000D8D },
-{ "Sinh_rii", 0x1000D8E },
-{ "Sinh_lu", 0x1000D8F },
-{ "Sinh_luu", 0x1000D90 },
-{ "Sinh_e", 0x1000D91 },
-{ "Sinh_ee", 0x1000D92 },
-{ "Sinh_ai", 0x1000D93 },
-{ "Sinh_o", 0x1000D94 },
-{ "Sinh_oo", 0x1000D95 },
-{ "Sinh_au", 0x1000D96 },
-{ "Sinh_ka", 0x1000D9A },
-{ "Sinh_kha", 0x1000D9B },
-{ "Sinh_ga", 0x1000D9C },
-{ "Sinh_gha", 0x1000D9D },
-{ "Sinh_ng2", 0x1000D9E },
-{ "Sinh_nga", 0x1000D9F },
-{ "Sinh_ca", 0x1000DA0 },
-{ "Sinh_cha", 0x1000DA1 },
-{ "Sinh_ja", 0x1000DA2 },
-{ "Sinh_jha", 0x1000DA3 },
-{ "Sinh_nya", 0x1000DA4 },
-{ "Sinh_jnya", 0x1000DA5 },
-{ "Sinh_nja", 0x1000DA6 },
-{ "Sinh_tta", 0x1000DA7 },
-{ "Sinh_ttha", 0x1000DA8 },
-{ "Sinh_dda", 0x1000DA9 },
-{ "Sinh_ddha", 0x1000DAA },
-{ "Sinh_nna", 0x1000DAB },
-{ "Sinh_ndda", 0x1000DAC },
-{ "Sinh_tha", 0x1000DAD },
-{ "Sinh_thha", 0x1000DAE },
-{ "Sinh_dha", 0x1000DAF },
-{ "Sinh_dhha", 0x1000DB0 },
-{ "Sinh_na", 0x1000DB1 },
-{ "Sinh_ndha", 0x1000DB3 },
-{ "Sinh_pa", 0x1000DB4 },
-{ "Sinh_pha", 0x1000DB5 },
-{ "Sinh_ba", 0x1000DB6 },
-{ "Sinh_bha", 0x1000DB7 },
-{ "Sinh_ma", 0x1000DB8 },
-{ "Sinh_mba", 0x1000DB9 },
-{ "Sinh_ya", 0x1000DBA },
-{ "Sinh_ra", 0x1000DBB },
-{ "Sinh_la", 0x1000DBD },
-{ "Sinh_va", 0x1000DC0 },
-{ "Sinh_sha", 0x1000DC1 },
-{ "Sinh_ssha", 0x1000DC2 },
-{ "Sinh_sa", 0x1000DC3 },
-{ "Sinh_ha", 0x1000DC4 },
-{ "Sinh_lla", 0x1000DC5 },
-{ "Sinh_fa", 0x1000DC6 },
-{ "Sinh_al", 0x1000DCA },
-{ "Sinh_aa2", 0x1000DCF },
-{ "Sinh_ae2", 0x1000DD0 },
-{ "Sinh_aee2", 0x1000DD1 },
-{ "Sinh_i2", 0x1000DD2 },
-{ "Sinh_ii2", 0x1000DD3 },
-{ "Sinh_u2", 0x1000DD4 },
-{ "Sinh_uu2", 0x1000DD6 },
-{ "Sinh_ru2", 0x1000DD8 },
-{ "Sinh_e2", 0x1000DD9 },
-{ "Sinh_ee2", 0x1000DDA },
-{ "Sinh_ai2", 0x1000DDB },
-{ "Sinh_o2", 0x1000DDC },
-{ "Sinh_oo2", 0x1000DDD },
-{ "Sinh_au2", 0x1000DDE },
-{ "Sinh_lu2", 0x1000DDF },
-{ "Sinh_ruu2", 0x1000DF2 },
-{ "Sinh_luu2", 0x1000DF3 },
-{ "Sinh_kunddaliya", 0x1000DF4 },
{ "XF86ModeLock", 0x1008FF01 },
{ "XF86MonBrightnessUp", 0x1008FF02 },
{ "XF86MonBrightnessDown", 0x1008FF03 },
diff --git a/generic/nanosvg.h b/generic/nanosvg.h
index 7bb13d2..5142bf3 100755
--- a/generic/nanosvg.h
+++ b/generic/nanosvg.h
@@ -33,27 +33,28 @@
extern "C" {
#endif
-// NanoSVG is a simple stupid single-header-file SVG parse. The output of the parser is a list of cubic bezier shapes.
-//
-// The library suits well for anything from rendering scalable icons in your editor application to prototyping a game.
-//
-// NanoSVG supports a wide range of SVG features, but something may be missing, feel free to create a pull request!
-//
-// The shapes in the SVG images are transformed by the viewBox and converted to specified units.
-// That is, you should get the same looking data as your designed in your favorite app.
-//
-// NanoSVG can return the paths in few different units. For example if you want to render an image, you may choose
-// to get the paths in pixels, or if you are feeding the data into a CNC-cutter, you may want to use millimeters.
-//
-// The units passed to NanoVG should be one of: 'px', 'pt', 'pc' 'mm', 'cm', or 'in'.
-// DPI (dots-per-inch) controls how the unit conversion is done.
-//
-// If you don't know or care about the units stuff, "px" and 96 should get you going.
+/* NanoSVG is a simple stupid single-header-file SVG parse. The output of the parser is a list of cubic bezier shapes.
+ *
+ * The library suits well for anything from rendering scalable icons in your editor application to prototyping a game.
+ *
+ * NanoSVG supports a wide range of SVG features, but something may be missing, feel free to create a pull request!
+ *
+ * The shapes in the SVG images are transformed by the viewBox and converted to specified units.
+ * That is, you should get the same looking data as your designed in your favorite app.
+ *
+ * NanoSVG can return the paths in few different units. For example if you want to render an image, you may choose
+ * to get the paths in pixels, or if you are feeding the data into a CNC-cutter, you may want to use millimeters.
+ *
+ * The units passed to NanoSVG should be one of: 'px', 'pt', 'pc' 'mm', 'cm', or 'in'.
+ * DPI (dots-per-inch) controls how the unit conversion is done.
+ *
+ * If you don't know or care about the units stuff, "px" and 96 should get you going.
+ */
/* Example Usage:
- // Load
- NSVGImage* image;
+ // Load SVG
+ NSVGimage* image;
image = nsvgParseFromFile("test.svg", "px", 96);
printf("size: %f x %f\n", image->width, image->height);
// Use...
@@ -85,8 +86,8 @@ extern "C" {
#define NANOSVG_free free
#endif
-// float emulation for MS VC6++ compiler
-#if (_MSC_VER == 1200)
+/* float emulation for MS VC6++ compiler */
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
#define tanf(a) (float)tan(a)
#define cosf(a) (float)cos(a)
#define sinf(a) (float)sin(a)
@@ -98,8 +99,8 @@ extern "C" {
#define fmodf(a,b) (float)fmod(a,b)
#define floorf(a) (float)floor(a)
#endif
-// float emulation for MS VC8++ compiler
-#if (_MSC_VER == 1400)
+/* float emulation for MS VC8++ compiler */
+#if defined(_MSC_VER) && (_MSC_VER == 1400)
#define fabsf(a) (float)fabs(a)
#endif
@@ -160,55 +161,55 @@ typedef struct NSVGpaint {
typedef struct NSVGpath
{
- float* pts; // Cubic bezier points: x0,y0, [cpx1,cpx1,cpx2,cpy2,x1,y1], ...
- int npts; // Total number of bezier points.
- char closed; // Flag indicating if shapes should be treated as closed.
- float bounds[4]; // Tight bounding box of the shape [minx,miny,maxx,maxy].
- struct NSVGpath* next; // Pointer to next path, or NULL if last element.
+ float* pts; /* Cubic bezier points: x0,y0, [cpx1,cpx1,cpx2,cpy2,x1,y1], ... */
+ int npts; /* Total number of bezier points. */
+ char closed; /* Flag indicating if shapes should be treated as closed. */
+ float bounds[4]; /* Tight bounding box of the shape [minx,miny,maxx,maxy]. */
+ struct NSVGpath* next; /* Pointer to next path, or NULL if last element. */
} NSVGpath;
typedef struct NSVGshape
{
- char id[64]; // Optional 'id' attr of the shape or its group
- NSVGpaint fill; // Fill paint
- NSVGpaint stroke; // Stroke paint
- float opacity; // Opacity of the shape.
- float strokeWidth; // Stroke width (scaled).
- float strokeDashOffset; // Stroke dash offset (scaled).
- float strokeDashArray[8]; // Stroke dash array (scaled).
- char strokeDashCount; // Number of dash values in dash array.
- char strokeLineJoin; // Stroke join type.
- char strokeLineCap; // Stroke cap type.
- float miterLimit; // Miter limit
- char fillRule; // Fill rule, see NSVGfillRule.
- unsigned char flags; // Logical or of NSVG_FLAGS_* flags
- float bounds[4]; // Tight bounding box of the shape [minx,miny,maxx,maxy].
- NSVGpath* paths; // Linked list of paths in the image.
- struct NSVGshape* next; // Pointer to next shape, or NULL if last element.
+ char id[64]; /* Optional 'id' attr of the shape or its group */
+ NSVGpaint fill; /* Fill paint */
+ NSVGpaint stroke; /* Stroke paint */
+ float opacity; /* Opacity of the shape. */
+ float strokeWidth; /* Stroke width (scaled). */
+ float strokeDashOffset; /* Stroke dash offset (scaled). */
+ float strokeDashArray[8]; /* Stroke dash array (scaled). */
+ char strokeDashCount; /* Number of dash values in dash array. */
+ char strokeLineJoin; /* Stroke join type. */
+ char strokeLineCap; /* Stroke cap type. */
+ float miterLimit; /* Miter limit */
+ char fillRule; /* Fill rule, see NSVGfillRule. */
+ unsigned char flags; /* Logical or of NSVG_FLAGS_* flags */
+ float bounds[4]; /* Tight bounding box of the shape [minx,miny,maxx,maxy]. */
+ NSVGpath* paths; /* Linked list of paths in the image. */
+ struct NSVGshape* next; /* Pointer to next shape, or NULL if last element. */
} NSVGshape;
typedef struct NSVGimage
{
- float width; // Width of the image.
- float height; // Height of the image.
- NSVGshape* shapes; // Linked list of shapes in the image.
+ float width; /* Width of the image. */
+ float height; /* Height of the image. */
+ NSVGshape* shapes; /* Linked list of shapes in the image. */
} NSVGimage;
-// Parses SVG file from a file, returns SVG image as paths.
+/* Parses SVG file from a file, returns SVG image as paths. */
NANOSVG_SCOPE NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi);
-// Parses SVG file from a null terminated string, returns SVG image as paths.
-// Important note: changes the string.
+/* Parses SVG file from a null terminated string, returns SVG image as paths. */
+/* Important note: changes the string. */
NANOSVG_SCOPE NSVGimage* nsvgParse(char* input, const char* units, float dpi);
-// Deletes list of paths.
+/* Deletes list of paths. */
NANOSVG_SCOPE void nsvgDelete(NSVGimage* image);
#ifdef __cplusplus
}
#endif
-#endif // NANOSVG_H
+#endif /* NANOSVG_H */
#ifdef NANOSVG_IMPLEMENTATION
@@ -217,7 +218,7 @@ NANOSVG_SCOPE void nsvgDelete(NSVGimage* image);
#include <math.h>
#define NSVG_PI (3.14159265358979323846264338327f)
-#define NSVG_KAPPA90 (0.5522847493f) // Length proportional to radius of a cubic bezier handle for 90deg arcs.
+#define NSVG_KAPPA90 (0.5522847493f) /* Length proportional to radius of a cubic bezier handle for 90deg arcs. */
#define NSVG_ALIGN_MIN 0
#define NSVG_ALIGN_MID 1
@@ -230,14 +231,14 @@ NANOSVG_SCOPE void nsvgDelete(NSVGimage* image);
#define NSVG_RGB(r, g, b) (((unsigned int)r) | ((unsigned int)g << 8) | ((unsigned int)b << 16))
#ifdef _MSC_VER
- #pragma warning (disable: 4996) // Switch off security warnings
- #pragma warning (disable: 4100) // Switch off unreferenced formal parameter warnings
+ #pragma warning (disable: 4996) /* Switch off security warnings */
+ #pragma warning (disable: 4100) /* Switch off unreferenced formal parameter warnings */
#ifdef __cplusplus
#define NSVG_INLINE inline
#else
#define NSVG_INLINE
#endif
- #if !defined(strtoll) // old MSVC versions do not have strtoll()
+ #if !defined(strtoll) /* old MSVC versions do not have strtoll() */
#define strtoll _strtoi64
#endif
#else
@@ -255,16 +256,11 @@ static int nsvg__isdigit(char c)
return c >= '0' && c <= '9';
}
-static int nsvg__isnum(char c)
-{
- return strchr("0123456789+-.eE", c) != 0;
-}
-
static NSVG_INLINE float nsvg__minf(float a, float b) { return a < b ? a : b; }
static NSVG_INLINE float nsvg__maxf(float a, float b) { return a > b ? a : b; }
-// Simple XML parser
+/* Simple XML parser */
#define NSVG_XML_TAG 1
#define NSVG_XML_CONTENT 2
@@ -274,7 +270,7 @@ static void nsvg__parseContent(char* s,
void (*contentCb)(void* ud, const char* s),
void* ud)
{
- // Trim start white spaces
+ /* Trim start white spaces */
while (*s && nsvg__isspace(*s)) s++;
if (!*s) return;
@@ -289,15 +285,15 @@ static void nsvg__parseElement(char* s,
{
const char* attr[NSVG_XML_MAX_ATTRIBS];
int nattr = 0;
- char* name;
+ char* cbname;
int start = 0;
int end = 0;
char quote;
- // Skip white space after the '<'
+ /* Skip white space after the '<' */
while (*s && nsvg__isspace(*s)) s++;
- // Check if the tag is end tag
+ /* Check if the tag is end tag */
if (*s == '/') {
s++;
end = 1;
@@ -305,21 +301,21 @@ static void nsvg__parseElement(char* s,
start = 1;
}
- // Skip comments, data and preprocessor stuff.
+ /* Skip comments, data and preprocessor stuff. */
if (!*s || *s == '?' || *s == '!')
return;
- // Get tag name
- name = s;
+ /* Get tag name */
+ cbname = s;
while (*s && !nsvg__isspace(*s)) s++;
if (*s) { *s++ = '\0'; }
- // Get attribs
+ /* Get attribs */
while (!end && *s && nattr < NSVG_XML_MAX_ATTRIBS-3) {
char* name = NULL;
char* value = NULL;
- // Skip white space before the attrib name
+ /* Skip white space before the attrib name */
while (*s && nsvg__isspace(*s)) s++;
if (!*s) break;
if (*s == '/') {
@@ -327,35 +323,35 @@ static void nsvg__parseElement(char* s,
break;
}
name = s;
- // Find end of the attrib name.
+ /* Find end of the attrib name. */
while (*s && !nsvg__isspace(*s) && *s != '=') s++;
if (*s) { *s++ = '\0'; }
- // Skip until the beginning of the value.
+ /* Skip until the beginning of the value. */
while (*s && *s != '\"' && *s != '\'') s++;
if (!*s) break;
quote = *s;
s++;
- // Store value and find the end of it.
+ /* Store value and find the end of it. */
value = s;
while (*s && *s != quote) s++;
if (*s) { *s++ = '\0'; }
- // Store only well formed attributes
+ /* Store only well formed attributes */
if (name && value) {
attr[nattr++] = name;
attr[nattr++] = value;
}
}
- // List terminator
+ /* List terminator */
attr[nattr++] = 0;
attr[nattr++] = 0;
- // Call callbacks.
+ /* Call callbacks. */
if (start && startelCb)
- (*startelCb)(ud, name, attr);
+ (*startelCb)(ud, cbname, attr);
if (end && endelCb)
- (*endelCb)(ud, name);
+ (*endelCb)(ud, cbname);
}
NANOSVG_SCOPE
@@ -370,13 +366,13 @@ int nsvg__parseXML(char* input,
int state = NSVG_XML_CONTENT;
while (*s) {
if (*s == '<' && state == NSVG_XML_CONTENT) {
- // Start of a tag
+ /* Start of a tag */
*s++ = '\0';
nsvg__parseContent(mark, contentCb, ud);
mark = s;
state = NSVG_XML_TAG;
} else if (*s == '>' && state == NSVG_XML_TAG) {
- // Start of a content or new tag.
+ /* Start of a content or new tag. */
*s++ = '\0';
nsvg__parseContent(mark, contentCb, ud);
nsvg__parseElement(mark, startelCb, endelCb, ud);
@@ -620,18 +616,18 @@ static void nsvg__curveBounds(float* bounds, float* curve)
float* v2 = &curve[4];
float* v3 = &curve[6];
- // Start the bounding box by end points
+ /* Start the bounding box by end points */
bounds[0] = nsvg__minf(v0[0], v3[0]);
bounds[1] = nsvg__minf(v0[1], v3[1]);
bounds[2] = nsvg__maxf(v0[0], v3[0]);
bounds[3] = nsvg__maxf(v0[1], v3[1]);
- // Bezier curve fits inside the convex hull of it's control points.
- // If control points are inside the bounds, we're done.
+ /* Bezier curve fits inside the convex hull of it's control points. */
+ /* If control points are inside the bounds, we're done. */
if (nsvg__ptInBounds(v1, bounds) && nsvg__ptInBounds(v2, bounds))
return;
- // Add bezier curve inflection points in X and Y.
+ /* Add bezier curve inflection points in X and Y. */
for (i = 0; i < 2; i++) {
a = -3.0 * v0[i] + 9.0 * v1[i] - 9.0 * v2[i] + 3.0 * v3[i];
b = 6.0 * v0[i] - 12.0 * v1[i] + 6.0 * v2[i];
@@ -673,7 +669,7 @@ static NSVGparser* nsvg__createParser(void)
if (p->image == NULL) goto error;
memset(p->image, 0, sizeof(NSVGimage));
- // Init style
+ /* Init style */
nsvg__xformIdentity(p->attr[0].xform);
memset(p->attr[0].id, 0, sizeof p->attr[0].id);
p->attr[0].fillColor = NSVG_RGB(0,0,0);
@@ -795,9 +791,11 @@ static void nsvg__lineTo(NSVGparser* p, float x, float y)
static void nsvg__cubicBezTo(NSVGparser* p, float cpx1, float cpy1, float cpx2, float cpy2, float x, float y)
{
- nsvg__addPoint(p, cpx1, cpy1);
- nsvg__addPoint(p, cpx2, cpy2);
- nsvg__addPoint(p, x, y);
+ if (p->npts > 0) {
+ nsvg__addPoint(p, cpx1, cpy1);
+ nsvg__addPoint(p, cpx2, cpy2);
+ nsvg__addPoint(p, x, y);
+ }
}
static NSVGattrib* nsvg__getAttr(NSVGparser* p)
@@ -857,7 +855,7 @@ static float nsvg__convertToPixels(NSVGparser* p, NSVGcoordinate c, float orig,
case NSVG_UNITS_CM: return c.value / 2.54f * p->dpi;
case NSVG_UNITS_IN: return c.value * p->dpi;
case NSVG_UNITS_EM: return c.value * attr->fontSize;
- case NSVG_UNITS_EX: return c.value * attr->fontSize * 0.52f; // x-height of Helvetica.
+ case NSVG_UNITS_EX: return c.value * attr->fontSize * 0.52f; /* x-height of Helvetica. */
case NSVG_UNITS_PERCENT: return orig + c.value / 100.0f * length;
default: return c.value;
}
@@ -867,7 +865,9 @@ static float nsvg__convertToPixels(NSVGparser* p, NSVGcoordinate c, float orig,
static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id)
{
NSVGgradientData* grad = p->gradients;
- while (grad) {
+ if (id == NULL || *id == '\0')
+ return NULL;
+ while (grad != NULL) {
if (strcmp(grad->id, id) == 0)
return grad;
grad = grad->next;
@@ -884,26 +884,33 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const f
NSVGgradient* grad;
float ox, oy, sw, sh, sl;
int nstops = 0;
+ int refIter;
data = nsvg__findGradientData(p, id);
if (data == NULL) return NULL;
- // TODO: use ref to fill in all unset values too.
+ /* TODO: use ref to fill in all unset values too. */
ref = data;
+ refIter = 0;
while (ref != NULL) {
+ NSVGgradientData* nextRef = NULL;
if (stops == NULL && ref->stops != NULL) {
stops = ref->stops;
nstops = ref->nstops;
break;
}
- ref = nsvg__findGradientData(p, ref->ref);
+ nextRef = nsvg__findGradientData(p, ref->ref);
+ if (nextRef == ref) break; /* prevent infite loops on malformed data */
+ ref = nextRef;
+ refIter++;
+ if (refIter > 32) break; /* prevent infite loops on malformed data */
}
if (stops == NULL) return NULL;
grad = (NSVGgradient*)NANOSVG_malloc(sizeof(NSVGgradient) + sizeof(NSVGgradientStop)*(nstops-1));
if (grad == NULL) return NULL;
- // The shape width and height.
+ /* The shape width and height. */
if (data->units == NSVG_OBJECT_SPACE) {
ox = localBounds[0];
oy = localBounds[1];
@@ -923,7 +930,7 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const f
y1 = nsvg__convertToPixels(p, data->linear.y1, oy, sh);
x2 = nsvg__convertToPixels(p, data->linear.x2, ox, sw);
y2 = nsvg__convertToPixels(p, data->linear.y2, oy, sh);
- // Calculate transform aligned to the line
+ /* Calculate transform aligned to the line */
dx = x2 - x1;
dy = y2 - y1;
grad->xform[0] = dy; grad->xform[1] = -dx;
@@ -936,7 +943,7 @@ static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const f
fx = nsvg__convertToPixels(p, data->radial.fx, ox, sw);
fy = nsvg__convertToPixels(p, data->radial.fy, oy, sh);
r = nsvg__convertToPixels(p, data->radial.r, 0, sl);
- // Calculate transform aligned to the circle
+ /* Calculate transform aligned to the circle */
grad->xform[0] = r; grad->xform[1] = 0;
grad->xform[2] = 0; grad->xform[3] = r;
grad->xform[4] = cx; grad->xform[5] = cy;
@@ -1024,7 +1031,7 @@ static void nsvg__addShape(NSVGparser* p)
shape->paths = p->plist;
p->plist = NULL;
- // Calculate shape bounds
+ /* Calculate shape bounds */
shape->bounds[0] = shape->paths->bounds[0];
shape->bounds[1] = shape->paths->bounds[1];
shape->bounds[2] = shape->paths->bounds[2];
@@ -1036,7 +1043,7 @@ static void nsvg__addShape(NSVGparser* p)
shape->bounds[3] = nsvg__maxf(shape->bounds[3], path->bounds[3]);
}
- // Set fill
+ /* Set fill */
if (attr->hasFill == 0) {
shape->fill.type = NSVG_PAINT_NONE;
} else if (attr->hasFill == 1) {
@@ -1053,7 +1060,7 @@ static void nsvg__addShape(NSVGparser* p)
}
}
- // Set stroke
+ /* Set stroke */
if (attr->hasStroke == 0) {
shape->stroke.type = NSVG_PAINT_NONE;
} else if (attr->hasStroke == 1) {
@@ -1069,10 +1076,10 @@ static void nsvg__addShape(NSVGparser* p)
shape->stroke.type = NSVG_PAINT_NONE;
}
- // Set flags
+ /* Set flags */
shape->flags = ((attr->visible & NSVG_VIS_DISPLAY) && (attr->visible & NSVG_VIS_VISIBLE) ? NSVG_FLAGS_VISIBLE : 0x00);
- // Add to tail
+ /* Add to tail */
if (p->image->shapes == NULL)
p->image->shapes = shape;
else
@@ -1099,6 +1106,10 @@ static void nsvg__addPath(NSVGparser* p, char closed)
if (closed)
nsvg__lineTo(p, p->pts[0], p->pts[1]);
+ /* Expect 1 + N*3 points (N = number of cubic bezier segments). */
+ if ((p->npts % 3) != 1)
+ return;
+
path = (NSVGpath*)NANOSVG_malloc(sizeof(NSVGpath));
if (path == NULL) goto error;
memset(path, 0, sizeof(NSVGpath));
@@ -1108,11 +1119,11 @@ static void nsvg__addPath(NSVGparser* p, char closed)
path->closed = closed;
path->npts = p->npts;
- // Transform path.
+ /* Transform path. */
for (i = 0; i < p->npts; ++i)
nsvg__xformPoint(&path->pts[i*2], &path->pts[i*2+1], p->pts[i*2], p->pts[i*2+1], attr->xform);
- // Find bounds
+ /* Find bounds */
for (i = 0; i < path->npts-1; i += 3) {
curve = &path->pts[i*2];
nsvg__curveBounds(bounds, curve);
@@ -1141,20 +1152,20 @@ error:
}
}
-// We roll our own string to float because the std library one uses locale and messes things up.
+/* We roll our own string to float because the std library one uses locale and messes things up. */
static double nsvg__atof(const char* s)
{
char* cur = (char*)s;
char* end = NULL;
double res = 0.0, sign = 1.0;
-#if (_MSC_VER == 1200)
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
__int64 intPart = 0, fracPart = 0;
#else
long long intPart = 0, fracPart = 0;
#endif
char hasIntPart = 0, hasFracPart = 0;
- // Parse optional sign
+ /* Parse optional sign */
if (*cur == '+') {
cur++;
} else if (*cur == '-') {
@@ -1162,10 +1173,10 @@ static double nsvg__atof(const char* s)
cur++;
}
- // Parse integer part
+ /* Parse integer part */
if (nsvg__isdigit(*cur)) {
- // Parse digit sequence
-#if (_MSC_VER == 1200)
+ /* Parse digit sequence */
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
intPart = strtol(cur, &end, 10);
#else
intPart = strtoll(cur, &end, 10);
@@ -1177,12 +1188,12 @@ static double nsvg__atof(const char* s)
}
}
- // Parse fractional part.
+ /* Parse fractional part. */
if (*cur == '.') {
- cur++; // Skip '.'
+ cur++; /* Skip '.' */
if (nsvg__isdigit(*cur)) {
- // Parse digit sequence
-#if (_MSC_VER == 1200)
+ /* Parse digit sequence */
+#if defined(_MSC_VER) && (_MSC_VER == 1200)
fracPart = strtol(cur, &end, 10);
#else
fracPart = strtoll(cur, &end, 10);
@@ -1195,15 +1206,15 @@ static double nsvg__atof(const char* s)
}
}
- // A valid number should have integer or fractional part.
+ /* A valid number should have integer or fractional part. */
if (!hasIntPart && !hasFracPart)
return 0.0;
- // Parse optional exponent
+ /* Parse optional exponent */
if (*cur == 'e' || *cur == 'E') {
int expPart = 0;
- cur++; // skip 'E'
- expPart = strtol(cur, &end, 10); // Parse digit sequence with sign
+ cur++; /* skip 'E' */
+ expPart = strtol(cur, &end, 10); /* Parse digit sequence with sign */
if (cur != end) {
res *= pow(10.0, (double)expPart);
}
@@ -1218,27 +1229,27 @@ static const char* nsvg__parseNumber(const char* s, char* it, const int size)
const int last = size-1;
int i = 0;
- // sign
+ /* sign */
if (*s == '-' || *s == '+') {
if (i < last) it[i++] = *s;
s++;
}
- // integer part
+ /* integer part */
while (*s && nsvg__isdigit(*s)) {
if (i < last) it[i++] = *s;
s++;
}
if (*s == '.') {
- // decimal point
+ /* decimal point */
if (i < last) it[i++] = *s;
s++;
- // fraction part
+ /* fraction part */
while (*s && nsvg__isdigit(*s)) {
if (i < last) it[i++] = *s;
s++;
}
}
- // exponent
+ /* exponent */
if (*s == 'e' || *s == 'E') {
if (i < last) it[i++] = *s;
s++;
@@ -1259,13 +1270,13 @@ static const char* nsvg__parseNumber(const char* s, char* it, const int size)
static const char* nsvg__getNextPathItem(const char* s, char* it)
{
it[0] = '\0';
- // Skip white spaces and commas
+ /* Skip white spaces and commas */
while (*s && (nsvg__isspace(*s) || *s == ',')) s++;
if (!*s) return s;
if (*s == '-' || *s == '+' || *s == '.' || nsvg__isdigit(*s)) {
s = nsvg__parseNumber(s, it, 64);
} else {
- // Parse command
+ /* Parse command */
it[0] = *s++;
it[1] = '\0';
return s;
@@ -1278,8 +1289,8 @@ static unsigned int nsvg__parseColorHex(const char* str)
{
unsigned int c = 0, r = 0, g = 0, b = 0;
int n = 0;
- str++; // skip #
- // Calculate number of characters.
+ str++; /* skip # */
+ /* Calculate number of characters. */
while(str[n] && !nsvg__isspace(str[n]))
n++;
if (n == 6) {
@@ -1531,6 +1542,15 @@ static int nsvg__parseUnits(const char* units)
return NSVG_UNITS_USER;
}
+static int nsvg__isCoordinate(const char* s)
+{
+ /* optional sign */
+ if (*s == '-' || *s == '+')
+ s++;
+ /* must have at least one digit, or start by a dot */
+ return (nsvg__isdigit(*s) || *s == '.');
+}
+
static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str)
{
NSVGcoordinate coord = {0, NSVG_UNITS_USER};
@@ -1670,25 +1690,32 @@ static int nsvg__parseRotate(float* xform, const char* str)
static void nsvg__parseTransform(float* xform, const char* str)
{
float t[6];
+ int len;
nsvg__xformIdentity(xform);
while (*str)
{
if (strncmp(str, "matrix", 6) == 0)
- str += nsvg__parseMatrix(t, str);
+ len = nsvg__parseMatrix(t, str);
else if (strncmp(str, "translate", 9) == 0)
- str += nsvg__parseTranslate(t, str);
+ len = nsvg__parseTranslate(t, str);
else if (strncmp(str, "scale", 5) == 0)
- str += nsvg__parseScale(t, str);
+ len = nsvg__parseScale(t, str);
else if (strncmp(str, "rotate", 6) == 0)
- str += nsvg__parseRotate(t, str);
+ len = nsvg__parseRotate(t, str);
else if (strncmp(str, "skewX", 5) == 0)
- str += nsvg__parseSkewX(t, str);
+ len = nsvg__parseSkewX(t, str);
else if (strncmp(str, "skewY", 5) == 0)
- str += nsvg__parseSkewY(t, str);
+ len = nsvg__parseSkewY(t, str);
else{
++str;
continue;
}
+ if (len != 0) {
+ str += len;
+ } else {
+ ++str;
+ continue;
+ }
nsvg__xformPremultiply(xform, t);
}
@@ -1697,7 +1724,7 @@ static void nsvg__parseTransform(float* xform, const char* str)
static void nsvg__parseUrl(char* id, const char* str)
{
int i = 0;
- str += 4; // "url(";
+ str += 4; /* "url("; */
if (*str == '#')
str++;
while (i < 63 && *str != ')') {
@@ -1715,7 +1742,7 @@ static char nsvg__parseLineCap(const char* str)
return NSVG_CAP_ROUND;
else if (strcmp(str, "square") == 0)
return NSVG_CAP_SQUARE;
- // TODO: handle inherit.
+ /* TODO: handle inherit. */
return NSVG_CAP_BUTT;
}
@@ -1727,7 +1754,7 @@ static char nsvg__parseLineJoin(const char* str)
return NSVG_JOIN_ROUND;
else if (strcmp(str, "bevel") == 0)
return NSVG_JOIN_BEVEL;
- // TODO: handle inherit.
+ /* TODO: handle inherit. */
return NSVG_JOIN_MITER;
}
@@ -1737,7 +1764,7 @@ static char nsvg__parseFillRule(const char* str)
return NSVG_FILLRULE_NONZERO;
else if (strcmp(str, "evenodd") == 0)
return NSVG_FILLRULE_EVENODD;
- // TODO: handle inherit.
+ /* TODO: handle inherit. */
return NSVG_FILLRULE_NONZERO;
}
@@ -1745,9 +1772,9 @@ static const char* nsvg__getNextDashItem(const char* s, char* it)
{
int n = 0;
it[0] = '\0';
- // Skip white spaces and commas
+ /* Skip white spaces and commas */
while (*s && (nsvg__isspace(*s) || *s == ',')) s++;
- // Advance until whitespace, comma or end.
+ /* Advance until whitespace, comma or end. */
while (*s && (!nsvg__isspace(*s) && *s != ',')) {
if (n < 63)
it[n++] = *s;
@@ -1763,11 +1790,11 @@ static int nsvg__parseStrokeDashArray(NSVGparser* p, const char* str, float* str
int count = 0, i;
float sum = 0.0f;
- // Handle "none"
+ /* Handle "none" */
if (str[0] == 'n')
return 0;
- // Parse dashes
+ /* Parse dashes */
while (*str) {
str = nsvg__getNextDashItem(str, item);
if (!*item) break;
@@ -1796,7 +1823,7 @@ static int nsvg__parseAttr(NSVGparser* p, const char* name, const char* value)
} else if (strcmp(name, "display") == 0) {
if (strcmp(value, "none") == 0)
attr->visible &= ~NSVG_VIS_DISPLAY;
- // Don't reset ->visible on display:inline, one display:none hides the whole subtree
+ /* Don't reset ->visible on display:inline, one display:none hides the whole subtree */
} else if (strcmp(name, "visibility") == 0) {
if (strcmp(value, "hidden") == 0) {
@@ -1888,7 +1915,7 @@ static int nsvg__parseNameValue(NSVGparser* p, const char* start, const char* en
val = str;
- // Right Trim
+ /* Right Trim */
while (str > start && (*str == ':' || nsvg__isspace(*str))) --str;
++str;
@@ -1913,13 +1940,13 @@ static void nsvg__parseStyle(NSVGparser* p, const char* str)
const char* end;
while (*str) {
- // Left Trim
+ /* Left Trim */
while(*str && nsvg__isspace(*str)) ++str;
start = str;
while(*str && *str != ';') ++str;
end = str;
- // Right Trim
+ /* Right Trim */
while (end > start && (*end == ';' || nsvg__isspace(*end))) --end;
++end;
@@ -1966,8 +1993,11 @@ static int nsvg__getArgsPerElement(char cmd)
case 'a':
case 'A':
return 7;
+ case 'z':
+ case 'Z':
+ return 0;
}
- return 0;
+ return -1;
}
static void nsvg__pathMoveTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel)
@@ -2091,7 +2121,7 @@ static void nsvg__pathQuadBezTo(NSVGparser* p, float* cpx, float* cpy,
y2 = args[3];
}
- // Convert to cubic bezier
+ /* Convert to cubic bezier */
cx1 = x1 + 2.0f/3.0f*(cx - x1);
cy1 = y1 + 2.0f/3.0f*(cy - y1);
cx2 = x2 + 2.0f/3.0f*(cx - x2);
@@ -2124,7 +2154,7 @@ static void nsvg__pathQuadBezShortTo(NSVGparser* p, float* cpx, float* cpy,
cx = 2*x1 - *cpx2;
cy = 2*y1 - *cpy2;
- // Convert to cubix bezier
+ /* Convert to cubix bezier */
cx1 = x1 + 2.0f/3.0f*(cx - x1);
cy1 = y1 + 2.0f/3.0f*(cy - y1);
cx2 = x2 + 2.0f/3.0f*(cx - x2);
@@ -2156,7 +2186,7 @@ static float nsvg__vecang(float ux, float uy, float vx, float vy)
static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel)
{
- // Ported from canvg (https://code.google.com/p/canvg/)
+ /* Ported from canvg (https://code.google.com/p/canvg/) */
float rx, ry, rotx;
float x1, y1, x2, y2, cx, cy, dx, dy, d;
float x1p, y1p, cxp, cyp, s, sa, sb;
@@ -2167,14 +2197,14 @@ static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args,
int i, ndivs;
float hda, kappa;
- rx = fabsf(args[0]); // y radius
- ry = fabsf(args[1]); // x radius
- rotx = args[2] / 180.0f * NSVG_PI; // x rotation angle
- fa = fabsf(args[3]) > 1e-6 ? 1 : 0; // Large arc
- fs = fabsf(args[4]) > 1e-6 ? 1 : 0; // Sweep direction
- x1 = *cpx; // start point
+ rx = fabsf(args[0]); /* y radius */
+ ry = fabsf(args[1]); /* x radius */
+ rotx = args[2] / 180.0f * NSVG_PI; /* x rotation angle */
+ fa = fabsf(args[3]) > 1e-6 ? 1 : 0; /* Large arc */
+ fs = fabsf(args[4]) > 1e-6 ? 1 : 0; /* Sweep direction */
+ x1 = *cpx; /* start point */
y1 = *cpy;
- if (rel) { // end point
+ if (rel) { /* end point */
x2 = *cpx + args[5];
y2 = *cpy + args[6];
} else {
@@ -2186,7 +2216,7 @@ static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args,
dy = y1 - y2;
d = sqrtf(dx*dx + dy*dy);
if (d < 1e-6f || rx < 1e-6f || ry < 1e-6f) {
- // The arc degenerates to a line
+ /* The arc degenerates to a line */
nsvg__lineTo(p, x2, y2);
*cpx = x2;
*cpy = y2;
@@ -2196,9 +2226,9 @@ static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args,
sinrx = sinf(rotx);
cosrx = cosf(rotx);
- // Convert to center point parameterization.
- // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
- // 1) Compute x1', y1'
+ /* Convert to center point parameterization. */
+ /* http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes */
+ /* 1) Compute x1', y1' */
x1p = cosrx * dx / 2.0f + sinrx * dy / 2.0f;
y1p = -sinrx * dx / 2.0f + cosrx * dy / 2.0f;
d = nsvg__sqr(x1p)/nsvg__sqr(rx) + nsvg__sqr(y1p)/nsvg__sqr(ry);
@@ -2207,7 +2237,7 @@ static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args,
rx *= d;
ry *= d;
}
- // 2) Compute cx', cy'
+ /* 2) Compute cx', cy' */
s = 0.0f;
sa = nsvg__sqr(rx)*nsvg__sqr(ry) - nsvg__sqr(rx)*nsvg__sqr(y1p) - nsvg__sqr(ry)*nsvg__sqr(x1p);
sb = nsvg__sqr(rx)*nsvg__sqr(y1p) + nsvg__sqr(ry)*nsvg__sqr(x1p);
@@ -2219,33 +2249,33 @@ static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args,
cxp = s * rx * y1p / ry;
cyp = s * -ry * x1p / rx;
- // 3) Compute cx,cy from cx',cy'
+ /* 3) Compute cx,cy from cx',cy' */
cx = (x1 + x2)/2.0f + cosrx*cxp - sinrx*cyp;
cy = (y1 + y2)/2.0f + sinrx*cxp + cosrx*cyp;
- // 4) Calculate theta1, and delta theta.
+ /* 4) Calculate theta1, and delta theta. */
ux = (x1p - cxp) / rx;
uy = (y1p - cyp) / ry;
vx = (-x1p - cxp) / rx;
vy = (-y1p - cyp) / ry;
- a1 = nsvg__vecang(1.0f,0.0f, ux,uy); // Initial angle
- da = nsvg__vecang(ux,uy, vx,vy); // Delta angle
+ a1 = nsvg__vecang(1.0f,0.0f, ux,uy); /* Initial angle */
+ da = nsvg__vecang(ux,uy, vx,vy); /* Delta angle */
-// if (vecrat(ux,uy,vx,vy) <= -1.0f) da = NSVG_PI;
-// if (vecrat(ux,uy,vx,vy) >= 1.0f) da = 0;
+/* if (vecrat(ux,uy,vx,vy) <= -1.0f) da = NSVG_PI; */
+/* if (vecrat(ux,uy,vx,vy) >= 1.0f) da = 0; */
if (fs == 0 && da > 0)
da -= 2 * NSVG_PI;
else if (fs == 1 && da < 0)
da += 2 * NSVG_PI;
- // Approximate the arc using cubic spline segments.
+ /* Approximate the arc using cubic spline segments. */
t[0] = cosrx; t[1] = sinrx;
t[2] = -sinrx; t[3] = cosrx;
t[4] = cx; t[5] = cy;
- // Split arc into max 90 degree segments.
- // The loop assumes an iteration per end point (including start and end), this +1.
+ /* Split arc into max 90 degree segments. */
+ /* The loop assumes an iteration per end point (including start and end), this +1. */
ndivs = (int)(fabsf(da) / (NSVG_PI*0.5f) + 1.0f);
hda = (da / (float)ndivs) / 2.0f;
kappa = fabsf(4.0f / 3.0f * (1.0f - cosf(hda)) / sinf(hda));
@@ -2256,8 +2286,8 @@ static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args,
a = a1 + da * ((float)i/(float)ndivs);
dx = cosf(a);
dy = sinf(a);
- nsvg__xformPoint(&x, &y, dx*rx, dy*ry, t); // position
- nsvg__xformVec(&tanx, &tany, -dy*rx * kappa, dx*ry * kappa, t); // tangent
+ nsvg__xformPoint(&x, &y, dx*rx, dy*ry, t); /* position */
+ nsvg__xformVec(&tanx, &tany, -dy*rx * kappa, dx*ry * kappa, t); /* tangent */
if (i > 0)
nsvg__cubicBezTo(p, px+ptanx,py+ptany, x-tanx, y-tany, x, y);
px = x;
@@ -2277,6 +2307,7 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
float args[10];
int nargs;
int rargs = 0;
+ char initPoint;
float cpx, cpy, cpx2, cpy2;
const char* tmp[4];
char closedFlag;
@@ -2299,13 +2330,14 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
nsvg__resetPath(p);
cpx = 0; cpy = 0;
cpx2 = 0; cpy2 = 0;
+ initPoint = 0;
closedFlag = 0;
nargs = 0;
while (*s) {
s = nsvg__getNextPathItem(s, item);
if (!*item) break;
- if (nsvg__isnum(item[0])) {
+ if (cmd != '\0' && nsvg__isCoordinate(item)) {
if (nargs < 10)
args[nargs++] = (float)nsvg__atof(item);
if (nargs >= rargs) {
@@ -2313,11 +2345,12 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
case 'm':
case 'M':
nsvg__pathMoveTo(p, &cpx, &cpy, args, cmd == 'm' ? 1 : 0);
- // Moveto can be followed by multiple coordinate pairs,
- // which should be treated as linetos.
+ /* Moveto can be followed by multiple coordinate pairs, */
+ /* which should be treated as linetos. */
cmd = (cmd == 'm') ? 'l' : 'L';
rargs = nsvg__getArgsPerElement(cmd);
cpx2 = cpx; cpy2 = cpy;
+ initPoint = 1;
break;
case 'l':
case 'L':
@@ -2367,34 +2400,43 @@ static void nsvg__parsePath(NSVGparser* p, const char** attr)
}
} else {
cmd = item[0];
- rargs = nsvg__getArgsPerElement(cmd);
if (cmd == 'M' || cmd == 'm') {
- // Commit path.
+ /* Commit path. */
if (p->npts > 0)
nsvg__addPath(p, closedFlag);
- // Start new subpath.
+ /* Start new subpath. */
nsvg__resetPath(p);
closedFlag = 0;
nargs = 0;
- } else if (cmd == 'Z' || cmd == 'z') {
+ } else if (initPoint == 0) {
+ /* Do not allow other commands until initial point has been set (moveTo called once). */
+ cmd = '\0';
+ }
+ if (cmd == 'Z' || cmd == 'z') {
closedFlag = 1;
- // Commit path.
+ /* Commit path. */
if (p->npts > 0) {
- // Move current point to first point
+ /* Move current point to first point */
cpx = p->pts[0];
cpy = p->pts[1];
cpx2 = cpx; cpy2 = cpy;
nsvg__addPath(p, closedFlag);
}
- // Start new subpath.
+ /* Start new subpath. */
nsvg__resetPath(p);
nsvg__moveTo(p, cpx, cpy);
closedFlag = 0;
nargs = 0;
}
+ rargs = nsvg__getArgsPerElement(cmd);
+ if (rargs == -1) {
+ /* Command not recognized */
+ cmd = '\0';
+ rargs = 0;
+ }
}
}
- // Commit path.
+ /* Commit path. */
if (p->npts)
nsvg__addPath(p, closedFlag);
}
@@ -2408,7 +2450,7 @@ static void nsvg__parseRect(NSVGparser* p, const char** attr)
float y = 0.0f;
float w = 0.0f;
float h = 0.0f;
- float rx = -1.0f; // marks not set
+ float rx = -1.0f; /* marks not set */
float ry = -1.0f;
int i;
@@ -2439,7 +2481,7 @@ static void nsvg__parseRect(NSVGparser* p, const char** attr)
nsvg__lineTo(p, x+w, y+h);
nsvg__lineTo(p, x, y+h);
} else {
- // Rounded rectangle
+ /* Rounded rectangle */
nsvg__moveTo(p, x+rx, y);
nsvg__lineTo(p, x+w-rx, y);
nsvg__cubicBezTo(p, x+w-rx*(1-NSVG_KAPPA90), y, x+w, y+ry*(1-NSVG_KAPPA90), x+w, y+ry);
@@ -2596,24 +2638,24 @@ static void nsvg__parseSVG(NSVGparser* p, const char** attr)
sscanf(attr[i + 1], "%f%*[%%, \t]%f%*[%%, \t]%f%*[%%, \t]%f", &p->viewMinx, &p->viewMiny, &p->viewWidth, &p->viewHeight);
} else if (strcmp(attr[i], "preserveAspectRatio") == 0) {
if (strstr(attr[i + 1], "none") != 0) {
- // No uniform scaling
+ /* No uniform scaling */
p->alignType = NSVG_ALIGN_NONE;
} else {
- // Parse X align
+ /* Parse X align */
if (strstr(attr[i + 1], "xMin") != 0)
p->alignX = NSVG_ALIGN_MIN;
else if (strstr(attr[i + 1], "xMid") != 0)
p->alignX = NSVG_ALIGN_MID;
else if (strstr(attr[i + 1], "xMax") != 0)
p->alignX = NSVG_ALIGN_MAX;
- // Parse X align
+ /* Parse X align */
if (strstr(attr[i + 1], "yMin") != 0)
p->alignY = NSVG_ALIGN_MIN;
else if (strstr(attr[i + 1], "yMid") != 0)
p->alignY = NSVG_ALIGN_MID;
else if (strstr(attr[i + 1], "yMax") != 0)
p->alignY = NSVG_ALIGN_MAX;
- // Parse meet/slice
+ /* Parse meet/slice */
p->alignType = NSVG_ALIGN_MEET;
if (strstr(attr[i + 1], "slice") != 0)
p->alignType = NSVG_ALIGN_SLICE;
@@ -2708,7 +2750,7 @@ static void nsvg__parseGradientStop(NSVGparser* p, const char** attr)
nsvg__parseAttr(p, attr[i], attr[i + 1]);
}
- // Add stop to the last gradient.
+ /* Add stop to the last gradient. */
grad = p->gradients;
if (grad == NULL) return;
@@ -2716,7 +2758,7 @@ static void nsvg__parseGradientStop(NSVGparser* p, const char** attr)
grad->stops = (NSVGgradientStop*)NANOSVG_realloc(grad->stops, sizeof(NSVGgradientStop)*grad->nstops);
if (grad->stops == NULL) return;
- // Insert
+ /* Insert */
idx = grad->nstops-1;
for (i = 0; i < grad->nstops-1; i++) {
if (curAttr->stopOffset < grad->stops[i].offset) {
@@ -2740,7 +2782,7 @@ static void nsvg__startElement(void* ud, const char* el, const char** attr)
NSVGparser* p = (NSVGparser*)ud;
if (p->defsFlag) {
- // Skip everything but gradients in defs
+ /* Skip everything but gradients in defs */
if (strcmp(el, "linearGradient") == 0) {
nsvg__parseGradient(p, attr, NSVG_PAINT_LINEAR_GRADIENT);
} else if (strcmp(el, "radialGradient") == 0) {
@@ -2755,7 +2797,7 @@ static void nsvg__startElement(void* ud, const char* el, const char** attr)
nsvg__pushAttr(p);
nsvg__parseAttribs(p, attr);
} else if (strcmp(el, "path") == 0) {
- if (p->pathFlag) // Do not allow nested paths.
+ if (p->pathFlag) /* Do not allow nested paths. */
return;
nsvg__pushAttr(p);
nsvg__parsePath(p, attr);
@@ -2908,7 +2950,7 @@ static float nsvg__viewAlign(float content, float container, int type)
return 0;
else if (type == NSVG_ALIGN_MAX)
return container - content;
- // mid
+ /* mid */
return (container - content) * 0.5f;
}
@@ -2930,7 +2972,7 @@ static void nsvg__scaleToViewbox(NSVGparser* p, const char* units)
int i;
float* pt;
- // Guess image size if not set completely.
+ /* Guess image size if not set completely. */
nsvg__imageBounds(p, bounds);
if (p->viewWidth == 0) {
@@ -2958,23 +3000,23 @@ static void nsvg__scaleToViewbox(NSVGparser* p, const char* units)
ty = -p->viewMiny;
sx = p->viewWidth > 0 ? p->image->width / p->viewWidth : 0;
sy = p->viewHeight > 0 ? p->image->height / p->viewHeight : 0;
- // Unit scaling
+ /* Unit scaling */
us = 1.0f / nsvg__convertToPixels(p, nsvg__coord(1.0f, nsvg__parseUnits(units)), 0.0f, 1.0f);
- // Fix aspect ratio
+ /* Fix aspect ratio */
if (p->alignType == NSVG_ALIGN_MEET) {
- // fit whole image into viewbox
+ /* fit whole image into viewbox */
sx = sy = nsvg__minf(sx, sy);
tx += nsvg__viewAlign(p->viewWidth*sx, p->image->width, p->alignX) / sx;
ty += nsvg__viewAlign(p->viewHeight*sy, p->image->height, p->alignY) / sy;
} else if (p->alignType == NSVG_ALIGN_SLICE) {
- // fill whole viewbox with image
+ /* fill whole viewbox with image */
sx = sy = nsvg__maxf(sx, sy);
tx += nsvg__viewAlign(p->viewWidth*sx, p->image->width, p->alignX) / sx;
ty += nsvg__viewAlign(p->viewHeight*sy, p->image->height, p->alignY) / sy;
}
- // Transform
+ /* Transform */
sx *= us;
sy *= us;
avgs = (sx+sy) / 2.0f;
@@ -3027,7 +3069,7 @@ NSVGimage* nsvgParse(char* input, const char* units, float dpi)
nsvg__parseXML(input, nsvg__startElement, nsvg__endElement, nsvg__content, p);
- // Scale to viewBox
+ /* Scale to viewBox */
nsvg__scaleToViewbox(p, units);
ret = p->image;
@@ -3054,7 +3096,7 @@ NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi)
data = (char*)NANOSVG_malloc(size+1);
if (data == NULL) goto error;
if (fread(data, 1, size, fp) != size) goto error;
- data[size] = '\0'; // Must be null terminated.
+ data[size] = '\0'; /* Must be null terminated. */
fclose(fp);
image = nsvgParse(data, units, dpi);
NANOSVG_free(data);
diff --git a/generic/nanosvgrast.h b/generic/nanosvgrast.h
index 2720ce5..b288bcf 100644
--- a/generic/nanosvgrast.h
+++ b/generic/nanosvgrast.h
@@ -59,23 +59,24 @@ typedef struct NSVGrasterizer NSVGrasterizer;
nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4);
*/
-// Allocated rasterizer context.
+/* Allocated rasterizer context. */
NANOSVG_SCOPE NSVGrasterizer* nsvgCreateRasterizer(void);
-// Rasterizes SVG image, returns RGBA image (non-premultiplied alpha)
-// r - pointer to rasterizer context
-// image - pointer to image to rasterize
-// tx,ty - image offset (applied after scaling)
-// scale - image scale
-// dst - pointer to destination image data, 4 bytes per pixel (RGBA)
-// w - width of the image to render
-// h - height of the image to render
-// stride - number of bytes per scaleline in the destination buffer
+/* Rasterizes SVG image, returns RGBA image (non-premultiplied alpha)
+ * r - pointer to rasterizer context
+ * image - pointer to image to rasterize
+ * tx,ty - image offset (applied after scaling)
+ * scale - image scale
+ * dst - pointer to destination image data, 4 bytes per pixel (RGBA)
+ * w - width of the image to render
+ * h - height of the image to render
+ * stride - number of bytes per scaleline in the destination buffer
NANOSVG_SCOPE void nsvgRasterize(NSVGrasterizer* r,
NSVGimage* image, float tx, float ty, float scale,
unsigned char* dst, int w, int h, int stride);
+ */
-// Deletes rasterizer context.
+/* Deletes rasterizer context. */
NANOSVG_SCOPE void nsvgDeleteRasterizer(NSVGrasterizer*);
@@ -83,7 +84,7 @@ NANOSVG_SCOPE void nsvgDeleteRasterizer(NSVGrasterizer*);
}
#endif
-#endif // NANOSVGRAST_H
+#endif /* NANOSVGRAST_H */
#ifdef NANOSVGRAST_IMPLEMENTATION
@@ -202,17 +203,17 @@ static NSVGmemPage* nsvg__nextPage(NSVGrasterizer* r, NSVGmemPage* cur)
{
NSVGmemPage *newp;
- // If using existing chain, return the next page in chain
+ /* If using existing chain, return the next page in chain */
if (cur != NULL && cur->next != NULL) {
return cur->next;
}
- // Alloc new page
+ /* Alloc new page */
newp = (NSVGmemPage*)NANOSVG_malloc(sizeof(NSVGmemPage));
if (newp == NULL) return NULL;
memset(newp, 0, sizeof(NSVGmemPage));
- // Add to linked list
+ /* Add to linked list */
if (cur != NULL)
cur->next = newp;
else
@@ -302,7 +303,7 @@ static void nsvg__addEdge(NSVGrasterizer* r, float x0, float y0, float x1, float
{
NSVGedge* e;
- // Skip horizontal edges
+ /* Skip horizontal edges */
if (y0 == y1)
return;
@@ -388,15 +389,15 @@ static void nsvg__flattenShape(NSVGrasterizer* r, NSVGshape* shape, float scale)
for (path = shape->paths; path != NULL; path = path->next) {
r->npoints = 0;
- // Flatten path
+ /* Flatten path */
nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0);
for (i = 0; i < path->npts-1; i += 3) {
float* p = &path->pts[i*2];
nsvg__flattenCubicBez(r, p[0]*scale,p[1]*scale, p[2]*scale,p[3]*scale, p[4]*scale,p[5]*scale, p[6]*scale,p[7]*scale, 0, 0);
}
- // Close path
+ /* Close path */
nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0);
- // Build edges
+ /* Build edges */
for (i = 0, j = r->npoints-1; i < r->npoints; j = i++)
nsvg__addEdge(r, r->points[j].x, r->points[j].y, r->points[i].x, r->points[i].y);
}
@@ -619,20 +620,20 @@ static int nsvg__curveDivs(float r, float arc, float tol)
static void nsvg__expandStroke(NSVGrasterizer* r, NSVGpoint* points, int npoints, int closed, int lineJoin, int lineCap, float lineWidth)
{
- int ncap = nsvg__curveDivs(lineWidth*0.5f, NSVG_PI, r->tessTol); // Calculate divisions per half circle.
+ int ncap = nsvg__curveDivs(lineWidth*0.5f, NSVG_PI, r->tessTol); /* Calculate divisions per half circle. */
NSVGpoint left = {0,0,0,0,0,0,0,0}, right = {0,0,0,0,0,0,0,0}, firstLeft = {0,0,0,0,0,0,0,0}, firstRight = {0,0,0,0,0,0,0,0};
NSVGpoint* p0, *p1;
int j, s, e;
- // Build stroke edges
+ /* Build stroke edges */
if (closed) {
- // Looping
+ /* Looping */
p0 = &points[npoints-1];
p1 = &points[0];
s = 0;
e = npoints;
} else {
- // Add cap
+ /* Add cap */
p0 = &points[0];
p1 = &points[1];
s = 1;
@@ -644,7 +645,7 @@ static void nsvg__expandStroke(NSVGrasterizer* r, NSVGpoint* points, int npoints
firstLeft = left;
firstRight = right;
} else {
- // Add cap
+ /* Add cap */
float dx = p1->x - p0->x;
float dy = p1->y - p0->y;
nsvg__normalize(&dx, &dy);
@@ -671,11 +672,11 @@ static void nsvg__expandStroke(NSVGrasterizer* r, NSVGpoint* points, int npoints
}
if (closed) {
- // Loop it
+ /* Loop it */
nsvg__addEdge(r, firstLeft.x, firstLeft.y, left.x, left.y);
nsvg__addEdge(r, right.x, right.y, firstRight.x, firstRight.y);
} else {
- // Add cap
+ /* Add cap */
float dx = p1->x - p0->x;
float dy = p1->y - p0->y;
nsvg__normalize(&dx, &dy);
@@ -696,15 +697,15 @@ static void nsvg__prepareStroke(NSVGrasterizer* r, float miterLimit, int lineJoi
p0 = &r->points[r->npoints-1];
p1 = &r->points[0];
for (i = 0; i < r->npoints; i++) {
- // Calculate segment direction and length
+ /* Calculate segment direction and length */
p0->dx = p1->x - p0->x;
p0->dy = p1->y - p0->y;
p0->len = nsvg__normalize(&p0->dx, &p0->dy);
- // Advance
+ /* Advance */
p0 = p1++;
}
- // calculate joins
+ /* calculate joins */
p0 = &r->points[r->npoints-1];
p1 = &r->points[0];
for (j = 0; j < r->npoints; j++) {
@@ -713,7 +714,7 @@ static void nsvg__prepareStroke(NSVGrasterizer* r, float miterLimit, int lineJoi
dly0 = -p0->dx;
dlx1 = p1->dy;
dly1 = -p1->dx;
- // Calculate extrusions
+ /* Calculate extrusions */
p1->dmx = (dlx0 + dlx1) * 0.5f;
p1->dmy = (dly0 + dly1) * 0.5f;
dmr2 = p1->dmx*p1->dmx + p1->dmy*p1->dmy;
@@ -726,15 +727,15 @@ static void nsvg__prepareStroke(NSVGrasterizer* r, float miterLimit, int lineJoi
p1->dmy *= s2;
}
- // Clear flags, but keep the corner.
+ /* Clear flags, but keep the corner. */
p1->flags = (p1->flags & NSVG_PT_CORNER) ? NSVG_PT_CORNER : 0;
- // Keep track of left turns.
+ /* Keep track of left turns. */
cross = p1->dx * p0->dy - p0->dx * p1->dy;
if (cross > 0.0f)
p1->flags |= NSVG_PT_LEFT;
- // Check to see if the corner needs to be beveled.
+ /* Check to see if the corner needs to be beveled. */
if (p1->flags & NSVG_PT_CORNER) {
if ((dmr2 * miterLimit*miterLimit) < 1.0f || lineJoin == NSVG_JOIN_BEVEL || lineJoin == NSVG_JOIN_ROUND) {
p1->flags |= NSVG_PT_BEVEL;
@@ -756,7 +757,7 @@ static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float
float lineWidth = shape->strokeWidth * scale;
for (path = shape->paths; path != NULL; path = path->next) {
- // Flatten path
+ /* Flatten path */
r->npoints = 0;
nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, NSVG_PT_CORNER);
for (i = 0; i < path->npts-1; i += 3) {
@@ -768,7 +769,7 @@ static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float
closed = path->closed;
- // If the first and last points are the same, remove the last, mark as closed path.
+ /* If the first and last points are the same, remove the last, mark as closed path. */
p0 = &r->points[r->npoints-1];
p1 = &r->points[0];
if (nsvg__ptEquals(p0->x,p0->y, p1->x,p1->y, r->distTol)) {
@@ -785,20 +786,20 @@ static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float
if (closed)
nsvg__appendPathPoint(r, r->points[0]);
- // Duplicate points -> points2.
+ /* Duplicate points -> points2. */
nsvg__duplicatePoints(r);
r->npoints = 0;
cur = r->points2[0];
nsvg__appendPathPoint(r, cur);
- // Figure out dash offset.
+ /* Figure out dash offset. */
allDashLen = 0;
for (j = 0; j < shape->strokeDashCount; j++)
allDashLen += shape->strokeDashArray[j];
if (shape->strokeDashCount & 1)
allDashLen *= 2.0f;
- // Find location inside pattern
+ /* Find location inside pattern */
dashOffset = fmodf(shape->strokeDashOffset, allDashLen);
if (dashOffset < 0.0f)
dashOffset += allDashLen;
@@ -815,22 +816,22 @@ static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float
float dist = sqrtf(dx*dx + dy*dy);
if ((totalDist + dist) > dashLen) {
- // Calculate intermediate point
+ /* Calculate intermediate point */
float d = (dashLen - totalDist) / dist;
float x = cur.x + dx * d;
float y = cur.y + dy * d;
nsvg__addPathPoint(r, x, y, NSVG_PT_CORNER);
- // Stroke
+ /* Stroke */
if (r->npoints > 1 && dashState) {
nsvg__prepareStroke(r, miterLimit, lineJoin);
nsvg__expandStroke(r, r->points, r->npoints, 0, lineJoin, lineCap, lineWidth);
}
- // Advance dash pattern
+ /* Advance dash pattern */
dashState = !dashState;
idash = (idash+1) % shape->strokeDashCount;
dashLen = shape->strokeDashArray[idash] * scale;
- // Restart
+ /* Restart */
cur.x = x;
cur.y = y;
cur.flags = NSVG_PT_CORNER;
@@ -844,7 +845,7 @@ static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float
j++;
}
}
- // Stroke any leftover path
+ /* Stroke any leftover path */
if (r->npoints > 1 && dashState)
nsvg__expandStroke(r, r->points, r->npoints, 0, lineJoin, lineCap, lineWidth);
} else {
@@ -871,24 +872,24 @@ static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float sta
float dxdy;
if (r->freelist != NULL) {
- // Restore from freelist.
+ /* Restore from freelist. */
z = r->freelist;
r->freelist = z->next;
} else {
- // Alloc new edge.
+ /* Alloc new edge. */
z = (NSVGactiveEdge*)nsvg__alloc(r, sizeof(NSVGactiveEdge));
if (z == NULL) return NULL;
}
dxdy = (e->x1 - e->x0) / (e->y1 - e->y0);
-// STBTT_assert(e->y0 <= start_point);
- // round dx down to avoid going too far
+/* STBTT_assert(e->y0 <= start_point); */
+ /* round dx down to avoid going too far */
if (dxdy < 0)
z->dx = (int)(-floorf(NSVG__FIX * -dxdy));
else
z->dx = (int)floorf(NSVG__FIX * dxdy);
z->x = (int)floorf(NSVG__FIX * (e->x0 + dxdy * (startPoint - e->y0)));
-// z->x -= off_x * FIX;
+/* z->x -= off_x * FIX; */
z->ey = e->y1;
z->next = 0;
z->dir = e->dir;
@@ -910,52 +911,53 @@ static void nsvg__fillScanline(unsigned char* scanline, int len, int x0, int x1,
if (j > *xmax) *xmax = j;
if (i < len && j >= 0) {
if (i == j) {
- // x0,x1 are the same pixel, so compute combined coverage
+ /* x0,x1 are the same pixel, so compute combined coverage */
scanline[i] = (unsigned char)(scanline[i] + ((x1 - x0) * maxWeight >> NSVG__FIXSHIFT));
} else {
- if (i >= 0) // add antialiasing for x0
+ if (i >= 0) /* add antialiasing for x0 */
scanline[i] = (unsigned char)(scanline[i] + (((NSVG__FIX - (x0 & NSVG__FIXMASK)) * maxWeight) >> NSVG__FIXSHIFT));
else
- i = -1; // clip
+ i = -1; /* clip */
- if (j < len) // add antialiasing for x1
+ if (j < len) /* add antialiasing for x1 */
scanline[j] = (unsigned char)(scanline[j] + (((x1 & NSVG__FIXMASK) * maxWeight) >> NSVG__FIXSHIFT));
else
- j = len; // clip
+ j = len; /* clip */
- for (++i; i < j; ++i) // fill pixels between x0 and x1
+ for (++i; i < j; ++i) /* fill pixels between x0 and x1 */
scanline[i] = (unsigned char)(scanline[i] + maxWeight);
}
}
}
-// note: this routine clips fills that extend off the edges... ideally this
-// wouldn't happen, but it could happen if the truetype glyph bounding boxes
-// are wrong, or if the user supplies a too-small bitmap
+/* note: this routine clips fills that extend off the edges... ideally this
+ * wouldn't happen, but it could happen if the truetype glyph bounding boxes
+ * are wrong, or if the user supplies a too-small bitmap
+ */
static void nsvg__fillActiveEdges(unsigned char* scanline, int len, NSVGactiveEdge* e, int maxWeight, int* xmin, int* xmax, char fillRule)
{
- // non-zero winding fill
+ /* non-zero winding fill */
int x0 = 0, w = 0;
if (fillRule == NSVG_FILLRULE_NONZERO) {
- // Non-zero
+ /* Non-zero */
while (e != NULL) {
if (w == 0) {
- // if we're currently at zero, we need to record the edge start point
+ /* if we're currently at zero, we need to record the edge start point */
x0 = e->x; w += e->dir;
} else {
int x1 = e->x; w += e->dir;
- // if we went to zero, we need to draw
+ /* if we went to zero, we need to draw */
if (w == 0)
nsvg__fillScanline(scanline, len, x0, x1, maxWeight, xmin, xmax);
}
e = e->next;
}
} else if (fillRule == NSVG_FILLRULE_EVENODD) {
- // Even-odd
+ /* Even-odd */
while (e != NULL) {
if (w == 0) {
- // if we're currently at zero, we need to record the edge start point
+ /* if we're currently at zero, we need to record the edge start point */
x0 = e->x; w = 1;
} else {
int x1 = e->x; w = 0;
@@ -1013,12 +1015,12 @@ static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* co
int r,g,b;
int a = nsvg__div255((int)cover[0] * ca);
int ia = 255 - a;
- // Premultiply
+ /* Premultiply */
r = nsvg__div255(cr * a);
g = nsvg__div255(cg * a);
b = nsvg__div255(cb * a);
- // Blend over
+ /* Blend over */
r += nsvg__div255(ia * (int)dst[0]);
g += nsvg__div255(ia * (int)dst[1]);
b += nsvg__div255(ia * (int)dst[2]);
@@ -1033,8 +1035,8 @@ static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* co
dst += 4;
}
} else if (cache->type == NSVG_PAINT_LINEAR_GRADIENT) {
- // TODO: spread modes.
- // TODO: plenty of opportunities to optimize.
+ /* TODO: spread modes. */
+ /* TODO: plenty of opportunities to optimize. */
float fx, fy, dx, gy;
float* t = cache->xform;
int i, cr, cg, cb, ca;
@@ -1056,12 +1058,12 @@ static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* co
a = nsvg__div255((int)cover[0] * ca);
ia = 255 - a;
- // Premultiply
+ /* Premultiply */
r = nsvg__div255(cr * a);
g = nsvg__div255(cg * a);
b = nsvg__div255(cb * a);
- // Blend over
+ /* Blend over */
r += nsvg__div255(ia * (int)dst[0]);
g += nsvg__div255(ia * (int)dst[1]);
b += nsvg__div255(ia * (int)dst[2]);
@@ -1077,9 +1079,9 @@ static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* co
fx += dx;
}
} else if (cache->type == NSVG_PAINT_RADIAL_GRADIENT) {
- // TODO: spread modes.
- // TODO: plenty of opportunities to optimize.
- // TODO: focus (fx,fy)
+ /* TODO: spread modes. */
+ /* TODO: plenty of opportunities to optimize. */
+ /* TODO: focus (fx,fy) */
float fx, fy, dx, gx, gy, gd;
float* t = cache->xform;
int i, cr, cg, cb, ca;
@@ -1103,12 +1105,12 @@ static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* co
a = nsvg__div255((int)cover[0] * ca);
ia = 255 - a;
- // Premultiply
+ /* Premultiply */
r = nsvg__div255(cr * a);
g = nsvg__div255(cg * a);
b = nsvg__div255(cb * a);
- // Blend over
+ /* Blend over */
r += nsvg__div255(ia * (int)dst[0]);
g += nsvg__div255(ia * (int)dst[1]);
b += nsvg__div255(ia * (int)dst[2]);
@@ -1131,7 +1133,7 @@ static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, fl
NSVGactiveEdge *active = NULL;
int y, s;
int e = 0;
- int maxWeight = (255 / NSVG__SUBSAMPLES); // weight per vertical scanline
+ int maxWeight = (255 / NSVG__SUBSAMPLES); /* weight per vertical scanline */
int xmin, xmax;
for (y = 0; y < r->height; y++) {
@@ -1139,25 +1141,25 @@ static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, fl
xmin = r->width;
xmax = 0;
for (s = 0; s < NSVG__SUBSAMPLES; ++s) {
- // find center of pixel for this scanline
+ /* find center of pixel for this scanline */
float scany = (float)(y*NSVG__SUBSAMPLES + s) + 0.5f;
NSVGactiveEdge **step = &active;
- // update all active edges;
- // remove all active edges that terminate before the center of this scanline
+ /* update all active edges; */
+ /* remove all active edges that terminate before the center of this scanline */
while (*step) {
NSVGactiveEdge *z = *step;
if (z->ey <= scany) {
- *step = z->next; // delete from list
-// NSVG__assert(z->valid);
+ *step = z->next; /* delete from list */
+/* NSVG__assert(z->valid); */
nsvg__freeActive(r, z);
} else {
- z->x += z->dx; // advance to position for current scanline
- step = &((*step)->next); // advance through list
+ z->x += z->dx; /* advance to position for current scanline */
+ step = &((*step)->next); /* advance through list */
}
}
- // resort the list if needed
+ /* resort the list if needed */
for (;;) {
int changed = 0;
step = &active;
@@ -1175,24 +1177,24 @@ static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, fl
if (!changed) break;
}
- // insert all edges that start before the center of this scanline -- omit ones that also end on this scanline
+ /* insert all edges that start before the center of this scanline -- omit ones that also end on this scanline */
while (e < r->nedges && r->edges[e].y0 <= scany) {
if (r->edges[e].y1 > scany) {
NSVGactiveEdge* z = nsvg__addActive(r, &r->edges[e], scany);
if (z == NULL) break;
- // find insertion point
+ /* find insertion point */
if (active == NULL) {
active = z;
} else if (z->x < active->x) {
- // insert at front
+ /* insert at front */
z->next = active;
active = z;
} else {
- // find thing to insert AFTER
+ /* find thing to insert AFTER */
NSVGactiveEdge* p = active;
while (p->next && p->next->x < z->x)
p = p->next;
- // at this point, p->next->x is NOT < z->x
+ /* at this point, p->next->x is NOT < z->x */
z->next = p->next;
p->next = z;
}
@@ -1200,11 +1202,11 @@ static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, fl
e++;
}
- // now process all active edges in non-zero fashion
+ /* now process all active edges in non-zero fashion */
if (active != NULL)
nsvg__fillActiveEdges(r->scanline, r->width, active, maxWeight, &xmin, &xmax, fillRule);
}
- // Blit
+ /* Blit */
if (xmin < 0) xmin = 0;
if (xmax > r->width-1) xmax = r->width-1;
if (xmin <= xmax) {
@@ -1218,7 +1220,7 @@ static void nsvg__unpremultiplyAlpha(unsigned char* image, int w, int h, int str
{
int x,y;
- // Unpremultiply
+ /* Unpremultiply */
for (y = 0; y < h; y++) {
unsigned char *row = &image[y*stride];
for (x = 0; x < w; x++) {
@@ -1232,7 +1234,7 @@ static void nsvg__unpremultiplyAlpha(unsigned char* image, int w, int h, int str
}
}
- // Defringe
+ /* Defringe */
for (y = 0; y < h; y++) {
unsigned char *row = &image[y*stride];
for (x = 0; x < w; x++) {
@@ -1411,7 +1413,7 @@ void nsvgRasterize(NSVGrasterizer* r,
nsvg__flattenShape(r, shape, scale);
- // Scale and translate edges
+ /* Scale and translate edges */
for (i = 0; i < r->nedges; i++) {
e = &r->edges[i];
e->x0 = tx + e->x0;
@@ -1420,10 +1422,10 @@ void nsvgRasterize(NSVGrasterizer* r,
e->y1 = (ty + e->y1) * NSVG__SUBSAMPLES;
}
- // Rasterize edges
+ /* Rasterize edges */
qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge);
- // now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
+ /* now, traverse the scanlines and find the intersections on each scanline, use non-zero rule */
nsvg__initPaint(&cache, &shape->fill, shape->opacity);
nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, shape->fillRule);
@@ -1435,9 +1437,9 @@ void nsvgRasterize(NSVGrasterizer* r,
nsvg__flattenShapeStroke(r, shape, scale);
-// dumpEdges(r, "edge.svg");
+/* dumpEdges(r, "edge.svg"); */
- // Scale and translate edges
+ /* Scale and translate edges */
for (i = 0; i < r->nedges; i++) {
e = &r->edges[i];
e->x0 = tx + e->x0;
@@ -1446,10 +1448,10 @@ void nsvgRasterize(NSVGrasterizer* r,
e->y1 = (ty + e->y1) * NSVG__SUBSAMPLES;
}
- // Rasterize edges
+ /* Rasterize edges */
qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge);
- // now, traverse the scanlines and find the intersections on each scanline, use non-zero rule
+ /* now, traverse the scanlines and find the intersections on each scanline, use non-zero rule */
nsvg__initPaint(&cache, &shape->stroke, shape->opacity);
nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, NSVG_FILLRULE_NONZERO);
diff --git a/generic/tk.decls b/generic/tk.decls
index 4ba7307..418ae35 100644
--- a/generic/tk.decls
+++ b/generic/tk.decls
@@ -5,8 +5,8 @@
# 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>
+# Copyright © 1998-2000 Ajuba Solutions.
+# Copyright © 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.
@@ -403,7 +403,7 @@ declare 97 {
Tk_ImageChangedProc *changeProc, ClientData clientData)
}
declare 98 {
- ClientData Tk_GetImageMasterData(Tcl_Interp *interp,
+ ClientData Tk_GetImageModelData(Tcl_Interp *interp,
const char *name, const Tk_ImageType **typePtrPtr)
}
declare 99 {
@@ -472,7 +472,7 @@ declare 116 {
Tk_Window Tk_IdToWindow(Display *display, Window window)
}
declare 117 {
- void Tk_ImageChanged(Tk_ImageMaster master, int x, int y,
+ void Tk_ImageChanged(Tk_ImageModel model, int x, int y,
int width, int height, int imageWidth, int imageHeight)
}
declare 118 {
@@ -486,8 +486,8 @@ declare 120 {
int width, int height)
}
declare 121 {
- void Tk_MaintainGeometry(Tk_Window slave,
- Tk_Window master, int x, int y, int width, int height)
+ void Tk_MaintainGeometry(Tk_Window window,
+ Tk_Window container, int x, int y, int width, int height)
}
declare 122 {
Tk_Window Tk_MainWindow(Tcl_Interp *interp)
@@ -539,7 +539,7 @@ declare 136 {
const char *Tk_NameOfFont(Tk_Font font)
}
declare 137 {
- const char *Tk_NameOfImage(Tk_ImageMaster imageMaster)
+ const char *Tk_NameOfImage(Tk_ImageModel model)
}
declare 138 {
const char *Tk_NameOfJoinStyle(int join)
@@ -692,7 +692,7 @@ declare 180 {
void Tk_Ungrab(Tk_Window tkwin)
}
declare 181 {
- void Tk_UnmaintainGeometry(Tk_Window slave, Tk_Window master)
+ void Tk_UnmaintainGeometry(Tk_Window window, Tk_Window container)
}
declare 182 {
void Tk_UnmapWindow(Tk_Window tkwin)
@@ -1068,13 +1068,35 @@ declare 272 {
declare 273 {
void Tk_CreateOldPhotoImageFormat(const Tk_PhotoImageFormat *formatPtr)
}
-# New in Tk8.7
+
+# TIP#580
declare 274 {
+ int Tk_AlwaysShowSelection(Tk_Window tkwin)
+}
+declare 275 {
+ unsigned Tk_GetButtonMask(unsigned button)
+}
+declare 276 {
+ int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp, Tk_Window tkwin,
+ Tcl_Obj *objPtr, double *doublePtr)
+}
+declare 277 {
+ Tcl_Obj *Tk_NewWindowObj(Tk_Window tkwin)
+}
+declare 278 {
+ void Tk_SendVirtualEvent(Tk_Window tkwin, const char *eventName,
+ Tcl_Obj *detail)
+}
+declare 279 {
+ Tcl_Obj *Tk_FontGetDescription(Tk_Font tkfont)
+}
+
+# TIP#529
+declare 280 {
void Tk_CreatePhotoImageFormatVersion3(
const Tk_PhotoImageFormatVersion3 *formatPtr)
}
-
# Define the platform specific public Tk interface. These functions are
# only available on the designated platform.
@@ -1105,37 +1127,24 @@ declare 5 win {
################################
# Aqua specific functions
-
-declare 0 aqua {
- 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)
-}
-declare 2 aqua {
- void Tk_MacOSXTkOwnsCursor(int tkOwnsIt)
-}
-declare 3 aqua {
- void TkMacOSXInitMenus(Tcl_Interp *interp)
-}
+# Stub removed because the function no longer exists.
+#declare 3 aqua {
+# void TkMacOSXInitMenus(Tcl_Interp *interp)
+#}
declare 4 aqua {
void TkMacOSXInitAppleEvents(Tcl_Interp *interp)
}
declare 5 aqua {
- void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y, int width,
+ void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y, int width,
int height, int flags)
}
declare 6 aqua {
void TkMacOSXInvalClipRgns(Tk_Window tkwin)
}
-declare 7 aqua {
- void *TkMacOSXGetDrawablePort(Drawable drawable)
-}
+# Stub removed because it just returned NULL.
+#declare 7 aqua {
+# void *TkMacOSXGetDrawablePort(Drawable drawable)
+#}
declare 8 aqua {
void *TkMacOSXGetRootControl(Drawable drawable)
}
@@ -1146,27 +1155,17 @@ declare 10 aqua {
int Tk_MacOSXIsAppInFront(void)
}
declare 11 aqua {
- void Tk_MacOSXSetEmbedHandler_(
- Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr,
- Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr,
- Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr,
- Tk_MacOSXEmbedGetClipProc *getClipProc,
- Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc)
+ Tk_Window Tk_MacOSXGetTkWindow(void *w)
}
declare 12 aqua {
- void Tk_MacOSXTurnOffMenus_(void)
+ void *Tk_MacOSXGetCGContextForDrawable(Drawable drawable)
}
+# Replaces TkMacOSXDrawable
declare 13 aqua {
- void Tk_MacOSXTkOwnsCursor_(int tkOwnsIt)
-}
-declare 14 aqua {
- void TkMacOSXInitMenus_(Tcl_Interp *interp)
-}
-declare 15 aqua {
- void TkMacOSXInitAppleEvents_(Tcl_Interp *interp)
+ void *Tk_MacOSXGetNSWindowForDrawable(Drawable drawable)
}
declare 16 aqua {
- void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y, int width,
+ void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y, int width,
int height, int flags)
}
diff --git a/generic/tk.h b/generic/tk.h
index 910c22a..3f4c92a 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -94,10 +94,7 @@ extern "C" {
# include <X11/X.h>
# endif
#endif
-#if defined(STDC_HEADERS) || defined(__STDC__) || defined(__C99__FUNC__) \
- || defined(__cplusplus) || defined(_MSC_VER) || defined(__ICC)
-# include <stddef.h>
-#endif
+#include <stddef.h>
#ifdef BUILD_tk
#undef TCL_STORAGE_CLASS
@@ -122,13 +119,14 @@ extern "C" {
* Dummy types that are used by clients:
*/
+#define Tk_ImageMaster Tk_ImageModel
typedef struct Tk_BindingTable_ *Tk_BindingTable;
typedef struct Tk_Canvas_ *Tk_Canvas;
typedef struct Tk_Cursor_ *Tk_Cursor;
typedef struct Tk_ErrorHandler_ *Tk_ErrorHandler;
typedef struct Tk_Font_ *Tk_Font;
typedef struct Tk_Image__ *Tk_Image;
-typedef struct Tk_ImageMaster_ *Tk_ImageMaster;
+typedef struct Tk_ImageModel_ *Tk_ImageModel;
typedef struct Tk_OptionTable_ *Tk_OptionTable;
typedef struct Tk_PostscriptInfo_ *Tk_PostscriptInfo;
typedef struct Tk_TextLayout_ *Tk_TextLayout;
@@ -650,21 +648,22 @@ typedef struct Tk_ClassProcs {
* the geometry manager to carry out certain functions.
*/
+#define Tk_GeomLostSlaveProc Tk_GeomLostContentProc
typedef void (Tk_GeomRequestProc) (ClientData clientData, Tk_Window tkwin);
-typedef void (Tk_GeomLostSlaveProc) (ClientData clientData, Tk_Window tkwin);
+typedef void (Tk_GeomLostContentProc) (ClientData clientData, Tk_Window tkwin);
typedef struct Tk_GeomMgr {
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
+ /* Procedure to invoke when a content's
* requested geometry changes. */
- Tk_GeomLostSlaveProc *lostSlaveProc;
- /* Procedure to invoke when a slave is taken
+ Tk_GeomLostContentProc *lostContentProc;
+ /* Procedure to invoke when content is taken
* away from one geometry manager by another.
* NULL means geometry manager doesn't care
- * when slaves are lost. */
+ * when content lost. */
} Tk_GeomMgr;
/*
@@ -1303,19 +1302,19 @@ typedef struct Tk_Outline {
typedef struct Tk_ImageType Tk_ImageType;
#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 && defined(USE_OLD_IMAGE)
typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, char *name, int argc,
- char **argv, Tk_ImageType *typePtr, Tk_ImageMaster master,
- ClientData *masterDataPtr);
+ char **argv, Tk_ImageType *typePtr, Tk_ImageModel model,
+ ClientData *clientDataPtr);
#else
typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, const char *name, int objc,
- Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageMaster master,
- ClientData *masterDataPtr);
+ Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model,
+ ClientData *clientDataPtr);
#endif /* USE_OLD_IMAGE */
-typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData masterData);
-typedef void (Tk_ImageDisplayProc) (ClientData instanceData, Display *display,
+typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData clientData);
+typedef void (Tk_ImageDisplayProc) (ClientData clientData, Display *display,
Drawable drawable, int imageX, int imageY, int width, int height,
int drawableX, int drawableY);
-typedef void (Tk_ImageFreeProc) (ClientData instanceData, Display *display);
-typedef void (Tk_ImageDeleteProc) (ClientData masterData);
+typedef void (Tk_ImageFreeProc) (ClientData clientData, Display *display);
+typedef void (Tk_ImageDeleteProc) (ClientData clientData);
typedef void (Tk_ImageChangedProc) (ClientData clientData, int x, int y,
int width, int height, int imageWidth, int imageHeight);
typedef int (Tk_ImagePostscriptProc) (ClientData clientData,
diff --git a/generic/tk3d.c b/generic/tk3d.c
index 155f6ae..249d62c 100644
--- a/generic/tk3d.c
+++ b/generic/tk3d.c
@@ -4,8 +4,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
diff --git a/generic/tk3d.h b/generic/tk3d.h
index d36b95e..7c22398 100644
--- a/generic/tk3d.h
+++ b/generic/tk3d.h
@@ -3,7 +3,7 @@
*
* Declarations of types and functions shared by the 3d border module.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright © 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.
diff --git a/generic/tkArgv.c b/generic/tkArgv.c
index 81e7a44..e16dd3c 100644
--- a/generic/tkArgv.c
+++ b/generic/tkArgv.c
@@ -4,8 +4,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
diff --git a/generic/tkArray.h b/generic/tkArray.h
index 81f3198..dbb43ba 100644
--- a/generic/tkArray.h
+++ b/generic/tkArray.h
@@ -5,7 +5,7 @@
* Random access to any item is very fast. New items can be either appended
* or prepended. An array may be traversed in the forward or backward direction.
*
- * Copyright (c) 2018-2019 by Gregor Cramer.
+ * Copyright © 2018-2019 Gregor Cramer.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/generic/tkAtom.c b/generic/tkAtom.c
index a4e1e11..0f86b0b 100644
--- a/generic/tkAtom.c
+++ b/generic/tkAtom.c
@@ -6,8 +6,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
diff --git a/generic/tkBind.c b/generic/tkBind.c
index 8ffcc1d..0f885f3 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -4,10 +4,10 @@
* 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.
- * Copyright (c) 2018-2019 by Gregor Cramer.
+ * Copyright © 1989-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998 Scriptics Corporation.
+ * Copyright © 2018-2019 Gregor Cramer.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -137,17 +137,10 @@ typedef struct {
* this count considers the detail (keySym or button). */
} Event;
-/*
- * We need a structure providing a list of pattern sequences.
- */
-
-typedef unsigned EventMask;
-typedef unsigned long ModMask;
-
struct PatSeq; /* forward declaration */
/* We need this array for bookkeeping the last matching modifier mask per pattern. */
-TK_ARRAY_DEFINE(PSModMaskArr, ModMask);
+TK_ARRAY_DEFINE(PSModMaskArr, unsigned);
typedef struct PSEntry {
TK_DLIST_LINKS(PSEntry); /* Makes this struct a double linked list; must be first entry. */
@@ -203,7 +196,7 @@ typedef struct Tk_BindingTable_ {
/* Containing the most recent event for every event type. */
PromArr *promArr; /* Contains the promoted pattern sequences. */
Event *curEvent; /* Pointing to most recent event. */
- ModMask curModMask; /* Containing the current modifier mask. */
+ unsigned curModMask; /* Containing the current modifier mask. */
LookupTables lookupTables; /* Containing hash tables for fast lookup. */
Tcl_HashTable objectTable; /* Used to map from an object to a list of patterns associated with
* that object. Keys are ClientData, values are (PatSeq *). */
@@ -265,7 +258,7 @@ typedef struct {
typedef struct {
unsigned eventType; /* Type of X event, e.g. ButtonPress. */
unsigned count; /* Multi-event count, e.g. double-clicks, triple-clicks, etc. */
- ModMask modMask; /* Mask of modifiers that must be present (zero means no modifiers
+ unsigned modMask; /* Mask of modifiers that must be present (zero means no modifiers
* are required). */
Info info; /* Additional information that must match event. Normally this is zero,
* meaning no additional information must match. For KeyPress and
@@ -416,7 +409,7 @@ static Tcl_HashTable nameTable; /* keyArray hashed by keysym name. */
typedef struct {
const char *name; /* Name of modifier. */
- ModMask mask; /* Button/modifier mask value, such as Button1Mask. */
+ unsigned mask; /* Button/modifier mask value, such as Button1Mask. */
unsigned flags; /* Various flags; see below for definitions. */
} ModInfo;
@@ -439,7 +432,9 @@ static const ModInfo modArray[] = {
{"Shift", ShiftMask, 0},
{"Lock", LockMask, 0},
{"Meta", META_MASK, 0},
+#ifndef TK_NO_DEPRECATED
{"M", META_MASK, 0},
+#endif
{"Alt", ALT_MASK, 0},
{"Extended", EXTENDED_MASK, 0},
{"B1", Button1Mask, 0},
@@ -462,10 +457,20 @@ static const ModInfo modArray[] = {
{"Button9", Button9Mask, 0},
{"Mod1", Mod1Mask, 0},
{"M1", Mod1Mask, 0},
+#ifdef MAC_OSX_TK
{"Command", Mod1Mask, 0},
+#elif defined (_WIN32)
+ {"Command", ControlMask, 0},
+#else
+ {"Command", META_MASK, 0},
+#endif
{"Mod2", Mod2Mask, 0},
{"M2", Mod2Mask, 0},
+#ifdef MAC_OSX_TK
{"Option", Mod2Mask, 0},
+#else
+ {"Option", ALT_MASK, 0},
+#endif
{"Mod3", Mod3Mask, 0},
{"M3", Mod3Mask, 0},
{"Mod4", Mod4Mask, 0},
@@ -501,10 +506,14 @@ typedef struct {
static const EventInfo eventArray[] = {
{"Key", KeyPress, KeyPressMask},
+#ifndef TK_NO_DEPRECATED
{"KeyPress", KeyPress, KeyPressMask},
+#endif
{"KeyRelease", KeyRelease, KeyPressMask|KeyReleaseMask},
{"Button", ButtonPress, ButtonPressMask},
+#ifndef TK_NO_DEPRECATED
{"ButtonPress", ButtonPress, ButtonPressMask},
+#endif
{"ButtonRelease", ButtonRelease, ButtonPressMask|ButtonReleaseMask},
{"Motion", MotionNotify, ButtonPressMask|PointerMotionMask},
{"Enter", EnterNotify, EnterWindowMask},
@@ -721,7 +730,7 @@ static void ExpandPercents(TkWindow *winPtr, const char *before, Event *eventPt
unsigned scriptCount, Tcl_DString *dsPtr);
static PatSeq * FindSequence(Tcl_Interp *interp, LookupTables *lookupTables,
ClientData object, const char *eventString, int create,
- int allowVirtual, EventMask *maskPtr);
+ int allowVirtual, unsigned *maskPtr);
static void GetAllVirtualEvents(Tcl_Interp *interp, VirtualEventTable *vetPtr);
static const char * GetField(const char *p, char *copy, unsigned size);
static Tcl_Obj * GetPatternObj(const PatSeq *psPtr);
@@ -737,8 +746,7 @@ static PatSeq * MatchPatterns(TkDisplay *dispPtr, Tk_BindingTable bindPtr, PSLi
static int NameToWindow(Tcl_Interp *interp, Tk_Window main,
Tcl_Obj *objPtr, Tk_Window *tkwinPtr);
static unsigned ParseEventDescription(Tcl_Interp *interp, const char **eventStringPtr,
- TkPattern *patPtr, EventMask *eventMaskPtr);
-static void DoWarp(ClientData clientData);
+ TkPattern *patPtr, unsigned *eventMaskPtr);
static PSList * GetLookupForEvent(LookupTables* lookupPtr, const Event *eventPtr,
Tcl_Obj *object, int onlyConsiderDetailedEvents);
static void ClearLookupTable(LookupTables *lookupTables, ClientData object);
@@ -769,8 +777,8 @@ static int TestNearbyCoords(int lhs, int rhs) { return Abs(lhs - rhs) <= NEARBY_
static int
IsSubsetOf(
- ModMask lhsMask, /* this is a subset */
- ModMask rhsMask) /* of this bit field? */
+ unsigned lhsMask, /* this is a subset */
+ unsigned rhsMask) /* of this bit field? */
{
return (lhsMask & rhsMask) == lhsMask;
}
@@ -800,8 +808,10 @@ static unsigned
GetButtonNumber(
const char *field)
{
+ unsigned button;
assert(field);
- return (field[0] >= '1' && field[0] <= '9' && field[1] == '\0') ? field[0] - '0' : 0;
+ button = (field[0] >= '1' && field[0] <= '9' && field[1] == '\0') ? field[0] - '0' : 0;
+ return (button > 3) ? (button + 4) : button;
}
static Time
@@ -957,11 +967,10 @@ ClearList(
static PSEntry *
FreePatSeqEntry(
- PSList *pool,
+ TCL_UNUSED(PSList *),
PSEntry *entry)
{
PSEntry *next = PSList_Next(entry);
- (void)pool;
PSModMaskArr_Free(&entry->lastModMaskArr);
ckfree(entry);
@@ -977,13 +986,13 @@ ResolveModifiers(
if (dispPtr->metaModMask) {
if (modMask & META_MASK) {
- modMask &= ~(ModMask)META_MASK;
+ modMask &= ~META_MASK;
modMask |= dispPtr->metaModMask;
}
}
if (dispPtr->altModMask) {
if (modMask & ALT_MASK) {
- modMask &= ~(ModMask)ALT_MASK;
+ modMask &= ~ALT_MASK;
modMask |= dispPtr->altModMask;
}
}
@@ -993,7 +1002,7 @@ ResolveModifiers(
static int
ButtonNumberFromState(
- ModMask state)
+ unsigned state)
{
if (!(state & ALL_BUTTONS)) { return 0; }
if (state & Button1Mask) { return 1; }
@@ -1648,7 +1657,7 @@ Tk_CreateBinding(
* existing binding will always be replaced. */
{
PatSeq *psPtr;
- EventMask eventMask;
+ unsigned eventMask;
char *oldStr;
char *newStr;
@@ -2173,7 +2182,7 @@ Tk_BindEvent(
TkDisplay *dispPtr;
TkDisplay *oldDispPtr;
Event *curEvent;
- TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *)tkwin;
BindInfo *bindInfoPtr;
Tcl_InterpState interpState;
LookupTables *physTables;
@@ -2463,7 +2472,6 @@ Tk_BindEvent(
LookupTables *virtTables = &bindInfoPtr->virtualEventTable.lookupTables;
PatSeq *matchPtr = matchPtrArr[k];
PatSeq *mPtr;
- PSList *psl[2];
/*
* Note that virtual events cannot promote.
@@ -2741,8 +2749,8 @@ static int
CompareModMasks(
const PSModMaskArr *fstModMaskArr,
const PSModMaskArr *sndModMaskArr,
- ModMask fstModMask,
- ModMask sndModMask)
+ unsigned fstModMask,
+ unsigned sndModMask)
{
int fstCount = 0;
int sndCount = 0;
@@ -2766,11 +2774,11 @@ CompareModMasks(
assert(PSModMaskArr_Size(fstModMaskArr) == PSModMaskArr_Size(sndModMaskArr));
for (i = PSModMaskArr_Size(fstModMaskArr) - 1; i >= 0; --i) {
- ModMask fstModMask = *PSModMaskArr_Get(fstModMaskArr, i);
- ModMask sndModMask = *PSModMaskArr_Get(sndModMaskArr, i);
+ unsigned fstiModMask = *PSModMaskArr_Get(fstModMaskArr, i);
+ unsigned sndiModMask = *PSModMaskArr_Get(sndModMaskArr, i);
- if (IsSubsetOf(fstModMask, sndModMask)) { ++sndCount; }
- if (IsSubsetOf(sndModMask, fstModMask)) { ++fstCount; }
+ if (IsSubsetOf(fstiModMask, sndiModMask)) { ++sndCount; }
+ if (IsSubsetOf(sndiModMask, fstiModMask)) { ++fstCount; }
}
}
@@ -2800,7 +2808,7 @@ MatchPatterns(
PSEntry *psEntry;
PatSeq *bestPtr;
PatSeq *bestPhysPtr;
- ModMask bestModMask;
+ unsigned bestModMask;
const PSModMaskArr *bestModMaskArr = NULL;
int i, isModKeyOnly = 0;
@@ -2867,8 +2875,8 @@ MatchPatterns(
* cannot be done in ParseEventDescription, otherwise this function would
* be the better place.
*/
- ModMask modMask = ResolveModifiers(dispPtr, patPtr->modMask);
- ModMask curModMask = ResolveModifiers(dispPtr, bindPtr->curModMask);
+ unsigned modMask = ResolveModifiers(dispPtr, patPtr->modMask);
+ unsigned curModMask = ResolveModifiers(dispPtr, bindPtr->curModMask);
psEntry->expired = 1; /* remove it from promotion list */
psEntry->keepIt = 0; /* don't keep matching patterns */
@@ -3002,8 +3010,8 @@ ExpandPercents(
while (1) {
char numStorage[TCL_INTEGER_SPACE];
const char *string;
- Tcl_WideInt number; /* signed */
- Tcl_WideUInt unumber; /* unsigned */
+ long long number; /* signed */
+ unsigned long long unumber; /* unsigned */
/*
* Find everything up to the next % character and append it to the
@@ -3520,7 +3528,7 @@ DeleteVirtualEventTable(
* already defined, the new definition augments those that already exist.
*
* Results:
- * The return value is TCL_ERROR if an error occured while creating the
+ * The return value is TCL_ERROR if an error occurred 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.
*
@@ -3864,7 +3872,7 @@ HandleEventGenerate(
Tk_Window tkwin;
Tk_Window tkwin2;
TkWindow *mainPtr;
- EventMask eventMask;
+ unsigned eventMask;
Tcl_Obj *userDataObj;
int synch;
int warp;
@@ -4048,6 +4056,9 @@ HandleEventGenerate(
return TCL_ERROR;
}
if (flags & BUTTON) {
+ if (number >= Button4) {
+ number += (Button8 - Button4);
+ }
event.general.xbutton.button = number;
} else {
badOpt = 1;
@@ -4402,17 +4413,6 @@ HandleEventGenerate(
}
/*
- * Now we have constructed the event, inject it into the event handling
- * code.
- */
-
- if (synch) {
- Tk_HandleEvent(&event.general);
- } else {
- Tk_QueueWindowEvent(&event.general, pos);
- }
-
- /*
* We only allow warping if the window is mapped.
*/
@@ -4421,11 +4421,6 @@ HandleEventGenerate(
Tk_Window warpWindow = Tk_IdToWindow(dispPtr->display, event.general.xmotion.window);
- if (!(dispPtr->flags & TK_DISPLAY_IN_WARP)) {
- Tcl_DoWhenIdle(DoWarp, dispPtr);
- dispPtr->flags |= TK_DISPLAY_IN_WARP;
- }
-
if (warpWindow != dispPtr->warpWindow) {
if (warpWindow) {
Tcl_Preserve(warpWindow);
@@ -4438,6 +4433,31 @@ HandleEventGenerate(
dispPtr->warpMainwin = mainWin;
dispPtr->warpX = event.general.xmotion.x;
dispPtr->warpY = event.general.xmotion.y;
+
+ /*
+ * Warping with respect to a window will be done when Tk_handleEvent
+ * below will run the event handlers and in particular TkPointerEvent.
+ * This allows to make grabs and warping work together robustly, that
+ * is without depending on a precise sequence of events.
+ * Warping with respect to the whole screen (i.e. dispPtr->warpWindow
+ * is NULL) is run directly here.
+ */
+
+ if (!dispPtr->warpWindow) {
+ TkpWarpPointer(dispPtr);
+ XForceScreenSaver(dispPtr->display, ScreenSaverReset);
+ }
+ }
+
+ /*
+ * Now we have constructed the event, inject it into the event handling
+ * code.
+ */
+
+ if (synch) {
+ Tk_HandleEvent(&event.general);
+ } else {
+ Tk_QueueWindowEvent(&event.general, pos);
}
}
@@ -4510,46 +4530,47 @@ NameToWindow(
/*
*-------------------------------------------------------------------------
*
- * DoWarp --
+ * TkDoWarpWrtWin --
*
- * Perform Warping of X pointer. Executed as an idle handler only.
+ * Perform warping of mouse pointer with respect to a window.
*
* Results:
* None
*
* Side effects:
- * X Pointer will move to a new location.
+ * Mouse pointer moves to a new location.
*
*-------------------------------------------------------------------------
*/
-static void
-DoWarp(
- ClientData clientData)
+void
+TkDoWarpWrtWin(
+ TkDisplay *dispPtr)
{
- TkDisplay *dispPtr = (TkDisplay *)clientData;
-
- assert(clientData);
+ assert(dispPtr);
/*
- * DoWarp was scheduled only if the window was mapped. It needs to be
- * still mapped at the time the present idle callback is executed. Also
- * one needs to guard against window destruction in the meantime.
- * Finally, the case warpWindow == NULL is special in that it means
- * the whole screen.
+ * A NULL warpWindow means warping with respect to the whole screen.
+ * We want to warp here only if we're warping with respect to a window.
*/
- if (!dispPtr->warpWindow ||
- (Tk_IsMapped(dispPtr->warpWindow) && Tk_WindowId(dispPtr->warpWindow) != None)) {
- TkpWarpPointer(dispPtr);
- XForceScreenSaver(dispPtr->display, ScreenSaverReset);
- }
-
if (dispPtr->warpWindow) {
- Tcl_Release(dispPtr->warpWindow);
- dispPtr->warpWindow = NULL;
+
+ /*
+ * Warping with respect to a window can only be done if the window is
+ * mapped. This was checked in HandleEvent. The window needs to be
+ * still mapped at the time the present code is executed. Also
+ * one needs to guard against window destruction in the meantime,
+ * which could have happened as a side effect of an event handler.
+ */
+
+ if (Tk_IsMapped(dispPtr->warpWindow) && Tk_WindowId(dispPtr->warpWindow) != None) {
+ TkpWarpPointer(dispPtr);
+ XForceScreenSaver(dispPtr->display, ScreenSaverReset);
+ }
+ Tcl_Release(dispPtr->warpWindow);
+ dispPtr->warpWindow = NULL;
}
- dispPtr->flags &= ~TK_DISPLAY_IN_WARP;
}
/*
@@ -4636,7 +4657,7 @@ FindSequence(
* 1 means create. */
int allowVirtual, /* 0 means that virtual events are not allowed in the sequence.
* 1 otherwise. */
- EventMask *maskPtr) /* *maskPtr is filled in with the event types on which this
+ unsigned *maskPtr) /* *maskPtr is filled in with the event types on which this
* pattern sequence depends. */
{
unsigned patsBufSize = 1;
@@ -4650,8 +4671,8 @@ FindSequence(
int isNew;
unsigned count;
unsigned maxCount = 0;
- EventMask eventMask = 0;
- ModMask modMask = 0;
+ unsigned eventMask = 0;
+ unsigned modMask = 0;
PatternTableKey key;
assert(lookupTables);
@@ -4825,10 +4846,10 @@ ParseEventDescription(
const char **eventStringPtr,/* On input, holds a pointer to start of event string. On exit,
* gets pointer to rest of string after parsed event. */
TkPattern *patPtr, /* Filled with the pattern parsed from the event string. */
- EventMask *eventMaskPtr) /* Filled with event mask of matched event. */
+ unsigned *eventMaskPtr) /* Filled with event mask of matched event. */
{
const char *p;
- EventMask eventMask = 0;
+ unsigned eventMask = 0;
unsigned count = 1;
assert(eventStringPtr);
@@ -5001,7 +5022,7 @@ ParseEventDescription(
"NON_BUTTON");
}
#if SUPPORT_ADDITIONAL_MOTION_SYNTAX
- patPtr->modMask |= TkGetButtonMask(button);
+ patPtr->modMask |= Tk_GetButtonMask(button);
p = SkipFieldDelims(p);
while (*p && *p != '>') {
p = SkipFieldDelims(GetField(p, field, sizeof(field)));
@@ -5011,7 +5032,7 @@ ParseEventDescription(
patPtr, 0,
Tcl_ObjPrintf("bad button number \"%s\"", field), "BUTTON");
}
- patPtr->modMask |= TkGetButtonMask(button);
+ patPtr->modMask |= Tk_GetButtonMask(button);
}
patPtr->info = ButtonNumberFromState(patPtr->modMask);
#endif
@@ -5141,7 +5162,7 @@ GetPatternObj(
assert(patPtr->name);
Tcl_AppendPrintfToObj(patternObj, "<<%s>>", patPtr->name);
} else {
- ModMask modMask;
+ unsigned modMask;
const ModInfo *modPtr;
/*
@@ -5189,16 +5210,16 @@ GetPatternObj(
}
case ButtonPress:
case ButtonRelease:
- assert(patPtr->info <= Button9);
- Tcl_AppendPrintfToObj(patternObj, "-%d", (int) patPtr->info);
+ assert(patPtr->info <= 13);
+ Tcl_AppendPrintfToObj(patternObj, "-%u", (unsigned) ((patPtr->info > 7) ? (patPtr->info - 4) : patPtr->info));
break;
#if PRINT_SHORT_MOTION_SYNTAX
case MotionNotify: {
- ModMask mask = patPtr->modMask;
+ unsigned mask = patPtr->modMask;
while (mask & ALL_BUTTONS) {
- int button = ButtonNumberFromState(mask);
- Tcl_AppendPrintfToObj(patternObj, "-%d", button);
- mask &= ~TkGetButtonMask(button);
+ unsigned button = ButtonNumberFromState(mask);
+ Tcl_AppendPrintfToObj(patternObj, "-%u", (button > 7) ? (button - 4) : button);
+ mask &= ~Tk_GetButtonMask(button);
}
break;
}
@@ -5235,14 +5256,48 @@ TkStringToKeysym(
const char *name) /* Name of a keysym. */
{
#ifdef REDO_KEYSYM_LOOKUP
- Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&keySymTable, name);
-
+ Tcl_HashEntry *hPtr;
+#endif /* REDO_KEYSYM_LOOKUP */
+ int keysym;
+
+ size_t len = TkUtfToUniChar(name, &keysym);
+ if (name[len] == '\0') {
+ if (!Tcl_UniCharIsPrint(keysym)) {
+ /* This form not supported */
+ } else if ((unsigned)(keysym - 0x21) <= 0x5D) {
+ return keysym;
+ } else if ((unsigned)(keysym - 0xA1) <= 0x5E) {
+ return keysym;
+ } else if (keysym == 0x20AC) {
+ return 0x20AC;
+ } else {
+ return keysym + 0x1000000;
+ }
+ }
+#ifdef REDO_KEYSYM_LOOKUP
+ if ((name[0] == 'U') && ((unsigned)(name[1] - '0') <= 9)) {
+ char *p = (char *)name + 1;
+ keysym = strtol(p, &p, 16);
+ if ((p >= name + 5) && (p <= name + 9) && !*p && (keysym >= 0x20)
+ && ((unsigned)(keysym - 0x7F) > 0x20)) {
+ if ((unsigned)(keysym - 0x21) <= 0x5D) {
+ return keysym;
+ } else if ((unsigned)(keysym - 0xA1) <= 0x5E) {
+ return keysym;
+ } else if (keysym == 0x20AC) {
+ return keysym;
+ }
+ return keysym + 0x1000000;
+ }
+ }
+#endif
+#ifdef REDO_KEYSYM_LOOKUP
+ hPtr = Tcl_FindHashEntry(&keySymTable, name);
if (hPtr) {
return (KeySym) Tcl_GetHashValue(hPtr);
}
- assert(name);
- if (strlen(name) == 1u) {
- KeySym keysym = (KeySym) (unsigned char) name[0];
+ if (((unsigned)(name[0]-1) < 0x7F) && !name[1]) {
+ keysym = (unsigned char) name[0];
if (TkKeysymToString(keysym)) {
return keysym;
@@ -5275,16 +5330,37 @@ TkKeysymToString(
KeySym keysym)
{
#ifdef REDO_KEYSYM_LOOKUP
- Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&nameTable, (char *)keysym);
+ Tcl_HashEntry *hPtr;
+#endif
+
+ if ((unsigned)(keysym - 0x21) <= 0x5D) {
+ keysym += 0x1000000;
+ } else if ((unsigned)(keysym - 0xA1) <= 0x5E) {
+ keysym += 0x1000000;
+ } else if (keysym == 0x20AC) {
+ keysym += 0x1000000;
+ }
+ if ((keysym >= 0x1000020) && (keysym <= 0x110FFFF)
+ && ((unsigned)(keysym - 0x100007F) > 0x20)) {
+ char buf[10];
+ if (Tcl_UniCharIsPrint(keysym-0x1000000)) {
+ buf[TkUniCharToUtf(keysym - 0x1000000, buf)] = '\0';
+ } else if (keysym >= 0x1010000) {
+ sprintf(buf, "U%08X", (int)(keysym - 0x1000000));
+ } else {
+ sprintf(buf, "U%04X", (int)(keysym - 0x1000000));
+ }
+ return Tk_GetUid(buf);
+ }
+
+#ifdef REDO_KEYSYM_LOOKUP
+ hPtr = Tcl_FindHashEntry(&nameTable, INT2PTR(keysym));
if (hPtr) {
return (const char *)Tcl_GetHashValue(hPtr);
}
#endif /* REDO_KEYSYM_LOOKUP */
- if (keysym > (KeySym)0x1008FFFF) {
- return NULL;
- }
return XKeysymToString(keysym);
}
@@ -5320,35 +5396,6 @@ TkpGetBindingXEvent(
/*
*----------------------------------------------------------------------
*
- * TkpCancelWarp --
- *
- * This function cancels an outstanding pointer warp and
- * is called during tear down of the display.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkpCancelWarp(
- TkDisplay *dispPtr)
-{
- assert(dispPtr);
-
- if (dispPtr->flags & TK_DISPLAY_IN_WARP) {
- Tcl_CancelIdleCall(DoWarp, dispPtr);
- dispPtr->flags &= ~TK_DISPLAY_IN_WARP;
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkpDumpPS --
*
* Dump given pattern sequence to stdout.
diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c
index 36fb382..9c2fccc 100644
--- a/generic/tkBitmap.c
+++ b/generic/tkBitmap.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
diff --git a/generic/tkBusy.c b/generic/tkBusy.c
index 5014eeb..f6ae494 100644
--- a/generic/tkBusy.c
+++ b/generic/tkBusy.c
@@ -125,10 +125,9 @@ SetWindowInstanceData(
static void
BusyCustodyProc(
ClientData clientData, /* Information about the busy window. */
- Tk_Window tkwin) /* Not used. */
+ TCL_UNUSED(Tk_Window)) /* Not used. */
{
Busy *busyPtr = (Busy *)clientData;
- (void)tkwin;
Tk_DeleteEventHandler(busyPtr->tkBusy, StructureNotifyMask, BusyEventProc,
busyPtr);
@@ -158,14 +157,11 @@ BusyCustodyProc(
static void
BusyGeometryProc(
- ClientData dummy, /* Information about window that got new
+ TCL_UNUSED(void *), /* Information about window that got new
* preferred geometry. */
- Tk_Window tkwin) /* Other Tk-related information about the
+ TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the
* window. */
{
- (void)dummy;
- (void)tkwin;
-
/* Should never get here */
}
@@ -809,7 +805,7 @@ Tk_BusyObjCmd(
};
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "options ?arg arg ...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "options ?arg ...?");
return TCL_ERROR;
}
@@ -819,7 +815,7 @@ Tk_BusyObjCmd(
if (Tcl_GetString(objv[1])[0] == '.') {
if (objc%2 == 1) {
- Tcl_WrongNumArgs(interp, 1, objv, "window ?option value ...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "window ?-option value ...?");
return TCL_ERROR;
}
return HoldBusy(busyTablePtr, interp, objv[1], objc-2, objv+2);
@@ -865,7 +861,7 @@ Tk_BusyObjCmd(
case BUSY_CONFIGURE:
if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?option? ?value ...?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?-option value ...?");
return TCL_ERROR;
}
busyPtr = GetBusy(interp, busyTablePtr, objv[2]);
@@ -900,7 +896,7 @@ Tk_BusyObjCmd(
if (pattern == NULL ||
Tcl_StringCaseMatch(Tk_PathName(busyPtr->tkRef), pattern, 0)) {
Tcl_ListObjAppendElement(interp, objPtr,
- TkNewWindowObj(busyPtr->tkRef));
+ Tk_NewWindowObj(busyPtr->tkRef));
}
}
Tcl_SetObjResult(interp, objPtr);
@@ -922,7 +918,7 @@ Tk_BusyObjCmd(
case BUSY_HOLD:
if (objc < 3 || objc%2 != 1) {
- Tcl_WrongNumArgs(interp, 2, objv, "window ?option value ...?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?-option value ...?");
return TCL_ERROR;
}
return HoldBusy(busyTablePtr, interp, objv[2], objc-3, objv+3);
diff --git a/generic/tkButton.c b/generic/tkButton.c
index 8056f31..04c9d78 100644
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -760,7 +760,7 @@ ButtonCreate(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(butPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(butPtr->tkwin));
return TCL_OK;
}
diff --git a/generic/tkButton.h b/generic/tkButton.h
index edf7efe..fb45bb0 100644
--- a/generic/tkButton.h
+++ b/generic/tkButton.h
@@ -4,7 +4,7 @@
* Declarations of types and functions used to implement button-like
* widgets.
*
- * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
+ * Copyright © 1996-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.
diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c
index c711f1d..b9cc335 100644
--- a/generic/tkCanvArc.c
+++ b/generic/tkCanvArc.c
@@ -3,8 +3,8 @@
*
* This file implements arc items for canvas widgets.
*
- * Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -707,12 +707,11 @@ ComputeArcParametersFromHeight(
static void
DeleteArc(
- Tk_Canvas canvas, /* Info about overall canvas. */
+ TCL_UNUSED(Tk_Canvas), /* Info about overall canvas. */
Tk_Item *itemPtr, /* Item that is being deleted. */
Display *display) /* Display containing window for canvas. */
{
- ArcItem *arcPtr = (ArcItem *) itemPtr;
- (void)canvas;
+ ArcItem *arcPtr = (ArcItem *)itemPtr;
Tk_DeleteOutline(display, &(arcPtr->outline));
if (arcPtr->numOutlinePoints != 0) {
@@ -794,13 +793,13 @@ ComputeArcBbox(
*/
if (arcPtr->bbox[1] > arcPtr->bbox[3]) {
- double tmp = arcPtr->bbox[3];
+ tmp = arcPtr->bbox[3];
arcPtr->bbox[3] = arcPtr->bbox[1];
arcPtr->bbox[1] = tmp;
}
if (arcPtr->bbox[0] > arcPtr->bbox[2]) {
- double tmp = arcPtr->bbox[2];
+ tmp = arcPtr->bbox[2];
arcPtr->bbox[2] = arcPtr->bbox[0];
arcPtr->bbox[0] = tmp;
@@ -900,8 +899,10 @@ DisplayArc(
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). */
+ TCL_UNUSED(int), /* Describes region of canvas that must be */
+ TCL_UNUSED(int), /* redisplayed (not used). */
+ TCL_UNUSED(int),
+ TCL_UNUSED(int))
{
ArcItem *arcPtr = (ArcItem *) itemPtr;
short x1, y1, x2, y2;
@@ -909,10 +910,6 @@ DisplayArc(
double lineWidth;
Tk_State state = itemPtr->state;
Pixmap stipple;
- (void)x;
- (void)y;
- (void)width;
- (void)height;
if (state == TK_STATE_NULL) {
state = Canvas(canvas)->canvas_state;
@@ -1648,7 +1645,7 @@ ComputeArcOutline(
* curved arc segment, which are marked with X's in the figure below:
*
*
- * * * *
+ * * * *
* * *
* * * * *
* * * * *
@@ -2001,7 +1998,7 @@ 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
+ TCL_UNUSED(int)) /* 1 means this is a prepass to collect font
* information; 0 means final Postscript is
* being created. */
{
@@ -2014,7 +2011,6 @@ ArcToPostscript(
Tk_State state = itemPtr->state;
Tcl_Obj *psObj;
Tcl_InterpState interpState;
- (void)prepass;
y1 = Tk_CanvasPsY(canvas, arcPtr->bbox[1]);
y2 = Tk_CanvasPsY(canvas, arcPtr->bbox[3]);
@@ -2197,9 +2193,9 @@ ArcToPostscript(
static int
StyleParseProc(
- ClientData dummy, /* some flags.*/
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Used for reporting errors. */
- Tk_Window tkwin, /* Window containing canvas widget. */
+ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
TkSizeT offset) /* Offset into item. */
@@ -2207,8 +2203,6 @@ StyleParseProc(
int c;
size_t length;
Style *stylePtr = (Style *) (widgRec + offset);
- (void)dummy;
- (void)tkwin;
if (value == NULL || *value == 0) {
*stylePtr = PIESLICE_STYLE;
@@ -2262,18 +2256,15 @@ StyleParseProc(
static const char *
StylePrintProc(
- ClientData dummy, /* Ignored. */
- Tk_Window tkwin, /* Ignored. */
+ TCL_UNUSED(void *), /* Ignored. */
+ TCL_UNUSED(Tk_Window), /* Ignored. */
char *widgRec, /* Pointer to record for item. */
TkSizeT offset, /* Offset into item. */
- Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
+ TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with
* information about how to reclaim storage
* for return string. */
{
Style *stylePtr = (Style *) (widgRec + offset);
- (void)dummy;
- (void)tkwin;
- (void)freeProcPtr;
if (*stylePtr == ARC_STYLE) {
return "arc";
diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c
index b2dc012..18618b3 100644
--- a/generic/tkCanvBmap.c
+++ b/generic/tkCanvBmap.c
@@ -3,8 +3,8 @@
*
* This file implements bitmap items for canvas widgets.
*
- * Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 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.
diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c
index 53e9c25..fcdebf0 100644
--- a/generic/tkCanvImg.c
+++ b/generic/tkCanvImg.c
@@ -3,8 +3,8 @@
*
* This file implements image items for canvas widgets.
*
- * Copyright (c) 1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 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.
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index 88ddc97..e7e8904 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -3,9 +3,9 @@
*
* This file implements line items for canvas widgets.
*
- * 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.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -605,12 +605,11 @@ ConfigureLine(
static void
DeleteLine(
- Tk_Canvas canvas, /* Info about overall canvas widget. */
+ TCL_UNUSED(Tk_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;
- (void)canvas;
Tk_DeleteOutline(display, &linePtr->outline);
if (linePtr->coordPtr != NULL) {
@@ -710,7 +709,7 @@ ComputeLineBbox(
tsoffset = &linePtr->outline.tsoffset;
if (tsoffset->flags & TK_OFFSET_INDEX) {
- double *coordPtr = linePtr->coordPtr
+ coordPtr = linePtr->coordPtr
+ (tsoffset->flags & ~TK_OFFSET_INDEX);
if (tsoffset->flags <= 0) {
@@ -834,20 +833,17 @@ DisplayLine(
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). */
+ TCL_UNUSED(int), /* Describes region of canvas that must be */
+ TCL_UNUSED(int), /* redisplayed (not used). */
+ TCL_UNUSED(int),
+ TCL_UNUSED(int))
{
- LineItem *linePtr = (LineItem *) itemPtr;
+ LineItem *linePtr = (LineItem *)itemPtr;
XPoint staticPoints[MAX_STATIC_POINTS*3];
XPoint *pointPtr;
double linewidth;
int numPoints;
Tk_State state = itemPtr->state;
- (void)x;
- (void)y;
- (void)width;
- (void)height;
if (!linePtr->numPoints || (linePtr->outline.gc == NULL)) {
return;
@@ -1701,8 +1697,6 @@ ScaleLine(
linePtr->firstArrowPtr = NULL;
}
if (linePtr->lastArrowPtr != NULL) {
- int i;
-
i = 2*(linePtr->numPoints-1);
linePtr->coordPtr[i] = linePtr->lastArrowPtr[0];
linePtr->coordPtr[i+1] = linePtr->lastArrowPtr[1];
@@ -1766,7 +1760,7 @@ GetLineIndex(
return TCL_OK;
}
- string = TkGetStringFromObj(obj, &length);
+ string = Tcl_GetStringFromObj(obj, &length);
if (string[0] == '@') {
int i;
@@ -1931,9 +1925,9 @@ RotateLine(
static int
ParseArrowShape(
- ClientData dummy, /* Not used. */
+ TCL_UNUSED(void *), /* Not used. */
Tcl_Interp *interp, /* Used for error reporting. */
- Tk_Window tkwin, /* Not used. */
+ TCL_UNUSED(Tk_Window), /* Not used. */
const char *value, /* Textual specification of arrow shape. */
char *recordPtr, /* Pointer to item record in which to store
* arrow information. */
@@ -1944,8 +1938,6 @@ ParseArrowShape(
double a, b, c;
int argc;
const char **argv = NULL;
- (void)dummy;
- (void)tkwin;
if ((size_t)offset != offsetof(LineItem, arrowShapeA)) {
Tcl_Panic("ParseArrowShape received bogus offset");
@@ -2001,19 +1993,16 @@ ParseArrowShape(
static const char *
PrintArrowShape(
- ClientData dummy, /* Not used. */
- Tk_Window tkwin, /* Window associated with linePtr's widget. */
+ TCL_UNUSED(void *), /* Not used. */
+ TCL_UNUSED(Tk_Window), /* Window associated with linePtr's widget. */
char *recordPtr, /* Pointer to item record containing current
* shape information. */
- TkSizeT offset, /* Offset of arrow information in record. */
+ TCL_UNUSED(TkSizeT), /* 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 = (char *)ckalloc(120);
- (void)dummy;
- (void)tkwin;
- (void)offset;
sprintf(buffer, "%.5g %.5g %.5g", linePtr->arrowShapeA,
linePtr->arrowShapeB, linePtr->arrowShapeC);
@@ -2041,9 +2030,9 @@ PrintArrowShape(
static int
ArrowParseProc(
- ClientData dummy, /* some flags.*/
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Used for reporting errors. */
- Tk_Window tkwin, /* Window containing canvas widget. */
+ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
TkSizeT offset) /* Offset into item. */
@@ -2051,8 +2040,6 @@ ArrowParseProc(
int c;
size_t length;
Arrows *arrowPtr = (Arrows *) (widgRec + offset);
- (void)dummy;
- (void)tkwin;
if (value == NULL || *value == 0) {
*arrowPtr = ARROWS_NONE;
@@ -2110,18 +2097,15 @@ ArrowParseProc(
static const char *
ArrowPrintProc(
- ClientData dummy, /* Ignored. */
- Tk_Window tkwin, /* Window containing canvas widget. */
+ TCL_UNUSED(void *), /* Ignored. */
+ TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */
char *widgRec, /* Pointer to record for item. */
TkSizeT offset, /* Offset into item. */
- Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with
+ TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with
* information about how to reclaim storage
* for return string. */
{
Arrows *arrowPtr = (Arrows *) (widgRec + offset);
- (void)dummy;
- (void)tkwin;
- (void)freeProcPtr;
switch (*arrowPtr) {
case ARROWS_FIRST:
@@ -2316,7 +2300,7 @@ 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
+ TCL_UNUSED(int)) /* 1 means this is a prepass to collect font
* information; 0 means final Postscript is
* being created. */
{
@@ -2328,7 +2312,6 @@ LineToPostscript(
Tk_State state = itemPtr->state;
Tcl_Obj *psObj;
Tcl_InterpState interpState;
- (void)prepass;
if (state == TK_STATE_NULL) {
state = Canvas(canvas)->canvas_state;
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index 88f63e8..1620914 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.c
@@ -3,9 +3,9 @@
*
* This file implements polygon items for canvas widgets.
*
- * Copyright (c) 1991-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998-2000 Ajuba Solutions.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 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.
@@ -876,12 +876,10 @@ DisplayPolygon(
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. */
- TCL_UNUSED(int),
- TCL_UNUSED(int),
+ TCL_UNUSED(int), /* Describes region of canvas that must be */
+ TCL_UNUSED(int), /* redisplayed (not used). */
TCL_UNUSED(int),
TCL_UNUSED(int))
- /* Describes region of canvas that must be
- * redisplayed (not used). */
{
PolygonItem *polyPtr = (PolygonItem *) itemPtr;
Tk_State state = itemPtr->state;
@@ -1692,7 +1690,7 @@ GetPolygonIndex(
return TCL_OK;
}
- string = TkGetStringFromObj(obj, &length);
+ string = Tcl_GetStringFromObj(obj, &length);
if (string[0] == '@') {
int i;
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index 2d075e0..b1e7b72 100644
--- a/generic/tkCanvPs.c
+++ b/generic/tkCanvPs.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -1603,7 +1603,7 @@ Tk_PostscriptPhoto(
/*
* 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
+ * transparencies we need to output two lines: one for the black
* pixels, one for the white ones.
*/
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index 304e009..3f4a3a9 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.c
@@ -3,8 +3,8 @@
*
* This file implements text items for canvas widgets.
*
- * Copyright (c) 1991-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -1020,7 +1020,7 @@ TextInsert(
const char *string;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
- string = TkGetStringFromObj(obj, &byteCount);
+ string = Tcl_GetStringFromObj(obj, &byteCount);
text = textPtr->text;
@@ -1375,7 +1375,7 @@ TranslateText(
static int
GetTextIndex(
Tcl_Interp *interp, /* Used for error reporting. */
- Tk_Canvas canvas, /* Canvas containing item. */
+ TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */
Tk_Item *itemPtr, /* Item for which the index is being
* specified. */
Tcl_Obj *obj, /* Specification of a particular character in
@@ -1388,7 +1388,6 @@ GetTextIndex(
int c;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
const char *string;
- (void)canvas;
if (TCL_OK == TkGetIntForIndex(obj, textPtr->numChars - 1, 1, &idx)) {
if (idx == TCL_INDEX_NONE) {
@@ -1400,7 +1399,7 @@ GetTextIndex(
return TCL_OK;
}
- string = TkGetStringFromObj(obj, &length);
+ string = Tcl_GetStringFromObj(obj, &length);
c = string[0];
if ((c == 'i')
@@ -1426,7 +1425,7 @@ GetTextIndex(
*indexPtr = textInfoPtr->selectLast;
} else if (c == '@') {
int x, y;
- double tmp, c = textPtr->cosine, s = textPtr->sine;
+ double tmp, cs = textPtr->cosine, s = textPtr->sine;
char *end;
const char *p;
@@ -1445,7 +1444,7 @@ GetTextIndex(
x -= (int) textPtr->drawOrigin[0];
y -= (int) textPtr->drawOrigin[1];
*indexPtr = Tk_PointToChar(textPtr->textLayout,
- (int) (x*c - y*s), (int) (y*c + x*s));
+ (int) (x*cs - y*s), (int) (y*cs + x*s));
} else {
/*
* Some of the paths here leave messages in the interp's result, so we
@@ -1478,14 +1477,13 @@ GetTextIndex(
static void
SetTextCursor(
- Tk_Canvas canvas, /* Record describing canvas widget. */
+ TCL_UNUSED(Tk_Canvas), /* Record describing canvas widget. */
Tk_Item *itemPtr, /* Text item in which cursor position is to be
* set. */
TkSizeT index) /* Character index of character just before
* which cursor is to be positioned. */
{
TextItem *textPtr = (TextItem *) itemPtr;
- (void)canvas;
if (index == TCL_INDEX_NONE) {
textPtr->insertPos = 0;
@@ -1518,7 +1516,7 @@ SetTextCursor(
static TkSizeT
GetSelText(
- Tk_Canvas canvas, /* Canvas containing selection. */
+ TCL_UNUSED(Tk_Canvas), /* Canvas containing selection. */
Tk_Item *itemPtr, /* Text item containing selection. */
TkSizeT offset, /* Byte offset within selection of first
* character to be returned. */
@@ -1532,7 +1530,6 @@ GetSelText(
char *text;
const char *selStart, *selEnd;
Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr;
- (void)canvas;
if (((int)textInfoPtr->selectFirst < 0) ||
(textInfoPtr->selectFirst + 1 > textInfoPtr->selectLast + 1)) {
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index a1fe265..121bfe8 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.c
@@ -4,7 +4,7 @@
* This file contains a collection of utility functions used by the
* implementations of various canvas item types.
*
- * Copyright (c) 1994 Sun Microsystems, Inc.
+ * Copyright © 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.
@@ -774,7 +774,7 @@ TkSmoothParseProc(
}
/*
- * Backward compatability hack.
+ * Backward compatibility hack.
*/
if (strncmp(value, "bezier", length) == 0) {
diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c
index 8028c14..9de843a 100644
--- a/generic/tkCanvWind.c
+++ b/generic/tkCanvWind.c
@@ -3,8 +3,8 @@
*
* This file implements window items for canvas widgets.
*
- * Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -87,7 +87,7 @@ static void TranslateWinItem(Tk_Canvas canvas,
static int WinItemCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
Tcl_Obj *const objv[]);
-static void WinItemLostSlaveProc(ClientData clientData,
+static void WinItemLostContentProc(ClientData clientData,
Tk_Window tkwin);
static void WinItemRequestProc(ClientData clientData,
Tk_Window tkwin);
@@ -144,7 +144,7 @@ Tk_ItemType tkWindowType = {
static const Tk_GeomMgr canvasGeomType = {
"canvas", /* name */
WinItemRequestProc, /* requestProc */
- WinItemLostSlaveProc, /* lostSlaveProc */
+ WinItemLostContentProc, /* lostContentProc */
};
/*
@@ -1102,25 +1102,25 @@ WinItemRequestProc(
/*
*--------------------------------------------------------------
*
- * WinItemLostSlaveProc --
+ * WinItemLostContentProc --
*
* This function is invoked by Tk whenever some other geometry claims
- * control over a slave that used to be managed by us.
+ * control over a content window that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all canvas-related information about the slave.
+ * Forgets all canvas-related information about the content window.
*
*--------------------------------------------------------------
*/
static void
-WinItemLostSlaveProc(
- ClientData clientData, /* WindowItem structure for slave window that
+WinItemLostContentProc(
+ ClientData clientData, /* WindowItem structure for content window window that
* was stolen away. */
- Tk_Window tkwin) /* Tk's handle for the slave window. */
+ Tk_Window tkwin) /* Tk's handle for the content window. */
{
WindowItem *winItemPtr = (WindowItem *)clientData;
Tk_Window canvasTkwin = Tk_CanvasTkwin(winItemPtr->canvas);
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 193d877..a8b9734 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -5,9 +5,9 @@
* 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.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -799,7 +799,7 @@ Tk_CanvasObjCmd(
goto error;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(canvasPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(canvasPtr->tkwin));
return TCL_OK;
error:
@@ -839,8 +839,8 @@ CanvasWidgetCmd(
TagSearch *searchPtr = NULL;/* Allocated by first TagSearchScan, freed by
* TagSearchDestroy */
- int index;
- static const char *const optionStrings[] = {
+ int idx;
+ static const char *const canvasOptionStrings[] = {
"addtag", "bbox", "bind", "canvasx",
"canvasy", "cget", "configure", "coords",
"create", "dchars", "delete", "dtag",
@@ -852,7 +852,7 @@ CanvasWidgetCmd(
"scan", "select", "type", "xview",
"yview", NULL
};
- enum options {
+ enum canvasOptionStringsEnum {
CANV_ADDTAG, CANV_BBOX, CANV_BIND, CANV_CANVASX,
CANV_CANVASY, CANV_CGET, CANV_CONFIGURE, CANV_COORDS,
CANV_CREATE, CANV_DCHARS, CANV_DELETE, CANV_DTAG,
@@ -869,14 +869,14 @@ CanvasWidgetCmd(
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0,
- &index) != TCL_OK) {
+ if (Tcl_GetIndexFromObj(interp, objv[1], canvasOptionStrings, "option", 0,
+ &idx) != TCL_OK) {
return TCL_ERROR;
}
Tcl_Preserve(canvasPtr);
result = TCL_OK;
- switch ((enum options) index) {
+ switch ((enum canvasOptionStringsEnum)idx) {
case CANV_ADDTAG:
if (objc < 4) {
Tcl_WrongNumArgs(interp, 2, objv, "tag searchCommand ?arg ...?");
@@ -988,7 +988,7 @@ CanvasWidgetCmd(
if (objc == 5) {
int append = 0;
- unsigned long mask;
+ unsigned int mask;
const char *argv4 = Tcl_GetString(objv[4]);
if (argv4[0] == 0) {
@@ -1036,7 +1036,7 @@ CanvasWidgetCmd(
result = TCL_ERROR;
goto done;
}
- if (mask & ~(unsigned long)(ButtonMotionMask|Button1MotionMask
+ if (mask & ~(ButtonMotionMask|Button1MotionMask
|Button2MotionMask|Button3MotionMask|Button4MotionMask
|Button5MotionMask|ButtonPressMask|ButtonReleaseMask
|EnterWindowMask|LeaveWindowMask|KeyPressMask
@@ -1247,7 +1247,6 @@ CanvasWidgetCmd(
case CANV_CREATE: {
Tk_ItemType *typePtr;
Tk_ItemType *matchPtr = NULL;
- Tk_Item *itemPtr;
int isNew = 0;
Tcl_HashEntry *entryPtr;
const char *arg;
@@ -1258,7 +1257,7 @@ CanvasWidgetCmd(
result = TCL_ERROR;
goto done;
}
- arg = TkGetStringFromObj(objv[2], &length);
+ arg = Tcl_GetStringFromObj(objv[2], &length);
c = arg[0];
/*
@@ -1663,7 +1662,6 @@ CanvasWidgetCmd(
}
break;
case CANV_LOWER: {
- Tk_Item *itemPtr;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?belowThis?");
@@ -1927,10 +1925,10 @@ CanvasWidgetCmd(
Tcl_WrongNumArgs(interp, 2, objv, "mark|dragto x y ?dragGain?");
result = TCL_ERROR;
} else if (Tcl_GetIndexFromObj(interp, objv[2], optionStrings,
- "scan option", 0, &index) != TCL_OK) {
+ "scan option", 0, &idx) != TCL_OK) {
result = TCL_ERROR;
- } else if ((objc != 5) && (objc != 5+index)) {
- Tcl_WrongNumArgs(interp, 3, objv, index?"x y ?gain?":"x y");
+ } else if ((objc != 5) && (objc != 5+idx)) {
+ Tcl_WrongNumArgs(interp, 3, objv, idx?"x y ?gain?":"x y");
result = TCL_ERROR;
} else if ((Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK)
|| (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)){
@@ -1938,7 +1936,7 @@ CanvasWidgetCmd(
} else if ((objc == 6) &&
(Tcl_GetIntFromObj(interp, objv[5], &gain) != TCL_OK)) {
result = TCL_ERROR;
- } else if (!index) {
+ } else if (!idx) {
canvasPtr->scanX = x;
canvasPtr->scanXOrigin = canvasPtr->xOrigin;
canvasPtr->scanY = y;
@@ -2503,7 +2501,7 @@ CanvasWorldChanged(
*/
static void
DecomposeMaskToShiftAndBits(
- unsigned long mask, /* The pixel mask to examine */
+ unsigned int mask, /* The pixel mask to examine */
int *shift, /* Where to put the shift count (position of lowest bit) */
int *bits) /* Where to put the bit count (width of the pixel mask) */
{
@@ -2849,7 +2847,7 @@ DrawCanvas(
#endif
for(x = 0; x < blockPtr.width; ++x) {
- unsigned long pixel = 0;
+ unsigned int pixel = 0;
switch (ximagePtr->bits_per_pixel) {
@@ -2881,7 +2879,7 @@ DrawCanvas(
*/
case 32 :
- pixel = *((unsigned long *)(ximagePtr->data + bytesPerPixel * x
+ pixel = *((unsigned int *)(ximagePtr->data + bytesPerPixel * x
+ ximagePtr->bytes_per_line * y));
if ((IS_BIG_ENDIAN && ximagePtr->byte_order == LSBFirst)
|| (!IS_BIG_ENDIAN && ximagePtr->byte_order == MSBFirst))
@@ -3763,7 +3761,7 @@ TagSearchScan(
*/
searchPtr->rewritebufferAllocated = 100;
- searchPtr->rewritebuffer =(char *) ckalloc(searchPtr->rewritebufferAllocated);
+ searchPtr->rewritebuffer = (char *)ckalloc(searchPtr->rewritebufferAllocated);
}
TagSearchExprInit(&searchPtr->expr);
@@ -4596,7 +4594,7 @@ DoItem(
Tk_Uid *newTagPtr;
itemPtr->tagSpace += 5;
- newTagPtr = (Tk_Uid*)ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid));
+ newTagPtr = (Tk_Uid *)ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid));
memcpy((void *) newTagPtr, itemPtr->tagPtr,
itemPtr->numTags * sizeof(Tk_Uid));
if (itemPtr->tagPtr != itemPtr->staticTagSpace) {
@@ -5082,7 +5080,7 @@ CanvasBindProc(
XEvent *eventPtr) /* Pointer to X event that just happened. */
{
TkCanvas *canvasPtr = (TkCanvas *)clientData;
- unsigned long mask;
+ unsigned mask;
Tcl_Preserve(canvasPtr);
@@ -5095,7 +5093,7 @@ CanvasBindProc(
switch (eventPtr->type) {
case ButtonPress:
case ButtonRelease:
- mask = TkGetButtonMask(eventPtr->xbutton.button);
+ mask = Tk_GetButtonMask(eventPtr->xbutton.button);
/*
* For button press events, repick the current item using the button
@@ -5178,7 +5176,7 @@ PickCurrentItem(
* ButtonRelease, or MotionNotify. */
{
double coords[2];
- unsigned long buttonDown;
+ unsigned int buttonDown;
Tk_Item *prevItemPtr;
SearchUids *searchUids = GetStaticUids();
diff --git a/generic/tkCanvas.h b/generic/tkCanvas.h
index f1adbc4..e4fb8fc 100644
--- a/generic/tkCanvas.h
+++ b/generic/tkCanvas.h
@@ -3,9 +3,9 @@
*
* 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.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 1994-1995 Sun Microsystems, Inc.
+ * Copyright © 1998 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c
index 8a7ffee..a972230 100644
--- a/generic/tkClipboard.c
+++ b/generic/tkClipboard.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -173,16 +173,12 @@ ClipboardAppHandler(
static TkSizeT
ClipboardWindowHandler(
- ClientData dummy, /* Not used. */
- TkSizeT offset, /* Return selection bytes starting at this
+ TCL_UNUSED(void *), /* Not used. */
+ TCL_UNUSED(TkSizeT), /* Return selection bytes starting at this
* offset. */
char *buffer, /* Place to store converted selection. */
- TkSizeT maxBytes) /* Maximum # of bytes to store at buffer. */
+ TCL_UNUSED(TkSizeT)) /* Maximum # of bytes to store at buffer. */
{
- (void)dummy;
- (void)offset;
- (void)maxBytes;
-
buffer[0] = '.';
buffer[1] = 0;
return 1;
@@ -458,7 +454,7 @@ Tk_ClipboardObjCmd(
TkSizeT length;
for (i = 2; i < objc - 1; i++) {
- string = TkGetStringFromObj(objv[i], &length);
+ string = Tcl_GetStringFromObj(objv[i], &length);
if (string[0] != '-') {
break;
}
@@ -641,11 +637,10 @@ Tk_ClipboardObjCmd(
int
TkClipInit(
- Tcl_Interp *dummy, /* Interpreter to use for error reporting. */
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter to use for error reporting. */
TkDisplay *dispPtr)/* Display to initialize. */
{
XSetWindowAttributes atts;
- (void)dummy;
dispPtr->clipTargetPtr = NULL;
dispPtr->clipboardActive = 0;
@@ -710,12 +705,10 @@ static int
ClipboardGetProc(
ClientData clientData, /* Dynamic string holding partially assembled
* selection. */
- Tcl_Interp *dummy, /* Interpreter used for error reporting (not
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter used for error reporting (not
* used). */
const char *portion) /* New information to be appended. */
{
- (void)dummy;
-
Tcl_DStringAppend((Tcl_DString *)clientData, portion, -1);
return TCL_OK;
}
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index c9026ef..e57f21e 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -4,9 +4,9 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -897,13 +897,12 @@ UseinputmethodsCmd(
int
WindowingsystemCmd(
- ClientData dummy, /* Main window associated with interpreter. */
+ TCL_UNUSED(void *), /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
const char *windowingsystem;
- (void)dummy;
if (objc != 1) {
Tcl_WrongNumArgs(interp, 1, objv, NULL);
@@ -1114,16 +1113,12 @@ Tk_TkwaitObjCmd(
static char *
WaitVariableProc(
ClientData clientData, /* Pointer to integer to set to 1. */
- Tcl_Interp *dummy, /* Interpreter containing variable. */
- const char *name1, /* Name of variable. */
- const char *name2, /* Second part of variable name. */
- int flags) /* Information about what happened. */
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter containing variable. */
+ TCL_UNUSED(const char *), /* Name of variable. */
+ TCL_UNUSED(const char *), /* Second part of variable name. */
+ TCL_UNUSED(int)) /* Information about what happened. */
{
int *donePtr = (int *)clientData;
- (void)dummy;
- (void)name1;
- (void)name2;
- (void)flags;
*donePtr = 1;
return NULL;
@@ -1174,7 +1169,7 @@ WaitWindowProc(
int
Tk_UpdateObjCmd(
- ClientData dummy, /* Main window associated with interpreter. */
+ TCL_UNUSED(void *), /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1183,7 +1178,6 @@ Tk_UpdateObjCmd(
int flags, index;
TkDisplay *dispPtr;
int code = TCL_OK;
- (void)dummy;
if (objc == 1) {
flags = TCL_DONT_WAIT;
@@ -1741,7 +1735,23 @@ Tk_WinfoObjCmd(
if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin) != TCL_OK) {
return TCL_ERROR;
}
+#ifdef TK_HAS_DYNAMIC_COLORS
+
+ /*
+ * Make sure that the TkColor used for the winfo rgb command is
+ * destroyed when we are through with it, so we do not get stale RGB
+ * values next time.
+ */
+
+ {
+ Colormap temp = Tk_Colormap(tkwin);
+ Tk_Colormap(tkwin) = TK_DYNAMIC_COLORMAP;
+ colorPtr = Tk_GetColor(interp, tkwin, Tcl_GetString(objv[3]));
+ Tk_Colormap(tkwin) = temp;
+ }
+#else
colorPtr = Tk_GetColor(interp, tkwin, Tcl_GetString(objv[3]));
+#endif
if (colorPtr == NULL) {
return TCL_ERROR;
}
@@ -1852,7 +1862,7 @@ TkGetDisplayOf(
if (objc < 1) {
return 0;
}
- string = TkGetStringFromObj(objv[0], &length);
+ string = Tcl_GetStringFromObj(objv[0], &length);
if ((length >= 2) &&
(strncmp(string, "-displayof", length) == 0)) {
if (objc < 2) {
@@ -1890,14 +1900,11 @@ TkGetDisplayOf(
int
TkDeadAppObjCmd(
- ClientData dummy, /* Dummy. */
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ TCL_UNUSED(int), /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- (void)dummy;
- (void)objc;
-
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't invoke \"%s\" command: application has been destroyed",
Tcl_GetString(objv[0])));
diff --git a/generic/tkColor.c b/generic/tkColor.c
index cf5c5f6..0f57b8c 100644
--- a/generic/tkColor.c
+++ b/generic/tkColor.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
diff --git a/generic/tkColor.h b/generic/tkColor.h
index bcd71fe..59344c1 100644
--- a/generic/tkColor.h
+++ b/generic/tkColor.h
@@ -3,7 +3,7 @@
*
* Declarations of data types and functions used by the Tk color module.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright © 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.
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index d4ffa7c..a3ccb50 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -4,7 +4,7 @@
* This file contains functions that manage configuration options for
* widgets and other things.
*
- * Copyright (c) 1997-1998 Sun Microsystems, Inc.
+ * Copyright © 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.
@@ -67,7 +67,7 @@ typedef struct TkOption {
* monochrome displays. */
struct TkOption *synonymPtr;
/* For synonym options, this points to the
- * master entry. */
+ * original entry. */
const struct Tk_ObjCustomOption *custom;
/* For TK_OPTION_CUSTOM. */
} extra;
@@ -237,8 +237,8 @@ Tk_CreateOptionTable(
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 original option that it refers
+ * to and create a pointer from the synonym to the origin.
*/
for (specPtr2 = templatePtr, i = 0; ; specPtr2++, i++) {
@@ -663,7 +663,7 @@ DoObjConfig(
}
if (internalPtr != NULL) {
if (valuePtr != NULL) {
- value = TkGetStringFromObj(valuePtr, &length);
+ value = Tcl_GetStringFromObj(valuePtr, &length);
newStr = (char *)ckalloc(length + 1);
strcpy(newStr, value);
} else {
@@ -1405,8 +1405,6 @@ Tk_RestoreSavedOptions(
CLANG_ASSERT(internalPtr);
switch (specPtr->type) {
case TK_OPTION_BOOLEAN:
- *((int *) internalPtr) = *((int *) ptr);
- break;
case TK_OPTION_INT:
*((int *) internalPtr) = *((int *) ptr);
break;
@@ -1499,9 +1497,8 @@ Tk_FreeSavedOptions(
Tk_FreeSavedOptions(savePtr->nextPtr);
ckfree(savePtr->nextPtr);
}
- for (count = savePtr->numItems,
- savedOptionPtr = &savePtr->items[savePtr->numItems-1];
- count > 0; count--, savedOptionPtr--) {
+ for (count = savePtr->numItems; count > 0; count--) {
+ savedOptionPtr = &savePtr->items[count-1];
if (savedOptionPtr->optionPtr->flags & OPTION_NEEDS_FREEING) {
FreeResources(savedOptionPtr->optionPtr, savedOptionPtr->valuePtr,
(char *) &savedOptionPtr->internalForm, savePtr->tkwin);
@@ -1874,106 +1871,106 @@ GetObjectForOption(
void *internalPtr; /* Points to internal value of option in
* record. */
- internalPtr = (char *)recordPtr + optionPtr->specPtr->internalOffset;
objPtr = NULL;
- switch (optionPtr->specPtr->type) {
- case TK_OPTION_BOOLEAN:
- objPtr = Tcl_NewWideIntObj(*((int *) internalPtr));
- break;
- case TK_OPTION_INT:
- objPtr = Tcl_NewWideIntObj(*((int *) internalPtr));
- break;
- case TK_OPTION_DOUBLE:
- objPtr = Tcl_NewDoubleObj(*((double *) internalPtr));
- break;
- case TK_OPTION_STRING:
- objPtr = Tcl_NewStringObj(*((char **) internalPtr), -1);
- break;
- 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 (optionPtr->specPtr->internalOffset != TCL_INDEX_NONE) {
+ internalPtr = (char *)recordPtr + optionPtr->specPtr->internalOffset;
+ switch (optionPtr->specPtr->type) {
+ case TK_OPTION_BOOLEAN:
+ case TK_OPTION_INT:
+ objPtr = Tcl_NewWideIntObj(*((int *)internalPtr));
+ break;
+ case TK_OPTION_DOUBLE:
+ objPtr = Tcl_NewDoubleObj(*((double *) internalPtr));
+ break;
+ case TK_OPTION_STRING:
+ objPtr = Tcl_NewStringObj(*((char **)internalPtr), -1);
+ break;
+ 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);
+ if (colorPtr != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_FONT: {
- Tk_Font tkfont = *((Tk_Font *) internalPtr);
+ case TK_OPTION_FONT: {
+ Tk_Font tkfont = *((Tk_Font *)internalPtr);
- if (tkfont != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1);
+ if (tkfont != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_STYLE: {
- Tk_Style style = *((Tk_Style *) internalPtr);
+ case TK_OPTION_STYLE: {
+ Tk_Style style = *((Tk_Style *)internalPtr);
- if (style != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1);
+ if (style != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_BITMAP: {
- Pixmap pixmap = *((Pixmap *) internalPtr);
+ case TK_OPTION_BITMAP: {
+ Pixmap pixmap = *((Pixmap *)internalPtr);
- if (pixmap != None) {
- objPtr = Tcl_NewStringObj(
+ if (pixmap != None) {
+ objPtr = Tcl_NewStringObj(
Tk_NameOfBitmap(Tk_Display(tkwin), pixmap), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_BORDER: {
- Tk_3DBorder border = *((Tk_3DBorder *) internalPtr);
+ case TK_OPTION_BORDER: {
+ Tk_3DBorder border = *((Tk_3DBorder *)internalPtr);
- if (border != NULL) {
- objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1);
+ if (border != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_RELIEF:
- objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *) internalPtr)), -1);
- break;
- case TK_OPTION_CURSOR: {
- Tk_Cursor cursor = *((Tk_Cursor *) internalPtr);
+ 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 != NULL) {
- objPtr = Tcl_NewStringObj(
- Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1);
+ if (cursor != NULL) {
+ objPtr = Tcl_NewStringObj(
+ Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1);
+ }
+ break;
}
- 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_NewWideIntObj(*((int *) internalPtr));
- break;
- case TK_OPTION_WINDOW: {
- Tk_Window tkwin = *((Tk_Window *) internalPtr);
+ 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_NewWideIntObj(*((int *)internalPtr));
+ break;
+ case TK_OPTION_WINDOW: {
+ tkwin = *((Tk_Window *) internalPtr);
- if (tkwin != NULL) {
- objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
+ if (tkwin != NULL) {
+ objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
+ }
+ break;
}
- break;
- }
- case TK_OPTION_CUSTOM: {
- const Tk_ObjCustomOption *custom = optionPtr->extra.custom;
+ case TK_OPTION_CUSTOM: {
+ const Tk_ObjCustomOption *custom = optionPtr->extra.custom;
- objPtr = custom->getProc(custom->clientData, tkwin, (char *)recordPtr,
- optionPtr->specPtr->internalOffset);
- break;
- }
- default:
- Tcl_Panic("bad option type in GetObjectForOption");
+ objPtr = custom->getProc(custom->clientData, tkwin, (char *)recordPtr,
+ optionPtr->specPtr->internalOffset);
+ break;
+ }
+ default:
+ Tcl_Panic("bad option type in GetObjectForOption");
+ }
}
if (objPtr == NULL) {
objPtr = Tcl_NewObj();
@@ -2065,7 +2062,7 @@ Tk_GetOptionValue(
Tcl_Obj *
TkDebugConfig(
- Tcl_Interp *dummy, /* Interpreter in which the table is
+ TCL_UNUSED(Tcl_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
@@ -2077,7 +2074,6 @@ TkDebugConfig(
Tcl_Obj *objPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)dummy;
objPtr = Tcl_NewObj();
if (!tablePtr || !tsdPtr->initialized) {
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index 0ab2954..15f4490 100644
--- a/generic/tkConsole.c
+++ b/generic/tkConsole.c
@@ -5,7 +5,7 @@
* 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.
+ * Copyright © 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.
@@ -67,7 +67,7 @@ static int InterpreterObjCmd(ClientData clientData, Tcl_Interp *interp,
static const Tcl_ChannelType consoleChannelType = {
"console", /* Type name. */
- TCL_CHANNEL_VERSION_5, /* v4 channel */
+ TCL_CHANNEL_VERSION_5, /* v5 channel */
(Tcl_DriverCloseProc *)ConsoleClose, /* Close proc. */
ConsoleInput, /* Input proc. */
ConsoleOutput, /* Output proc. */
@@ -561,17 +561,12 @@ ConsoleOutput(
static int
ConsoleInput(
- void *dummy, /* Unused. */
- char *buf, /* Where to store data read. */
- int bufSize, /* How much space is available in the
+ TCL_UNUSED(void *),
+ TCL_UNUSED(char *), /* Where to store data read. */
+ TCL_UNUSED(int), /* How much space is available in the
* buffer? */
- int *errorCode) /* Where to store error code. */
+ TCL_UNUSED(int *)) /* Where to store error code. */
{
- (void)dummy;
- (void)buf;
- (void)bufSize;
- (void)errorCode;
-
return 0; /* Always return EOF. */
}
@@ -594,11 +589,10 @@ ConsoleInput(
static int
ConsoleClose(
ClientData instanceData,
- Tcl_Interp *dummy) /* Unused. */
+ TCL_UNUSED(Tcl_Interp *))
{
ChannelData *data = (ChannelData *)instanceData;
ConsoleInfo *info = data->info;
- (void)dummy;
if (info) {
if (info->refCount-- <= 1) {
@@ -645,13 +639,11 @@ Console2Close(
static void
ConsoleWatch(
- ClientData dummy, /* Device ID for the channel. */
- int mask) /* OR-ed combination of TCL_READABLE,
+ TCL_UNUSED(void *), /* Device ID for the channel. */
+ TCL_UNUSED(int)) /* OR-ed combination of TCL_READABLE,
* TCL_WRITABLE and TCL_EXCEPTION, for the
* events we are interested in. */
{
- (void)dummy;
- (void)mask;
}
/*
@@ -673,16 +665,12 @@ ConsoleWatch(
static int
ConsoleHandle(
- ClientData dummy, /* Device ID for the channel. */
- int direction, /* TCL_READABLE or TCL_WRITABLE to indicate
+ TCL_UNUSED(void *), /* Device ID for the channel. */
+ TCL_UNUSED(int), /* TCL_READABLE or TCL_WRITABLE to indicate
* which direction of the channel is being
* requested. */
- ClientData *handlePtr) /* Where to store handle */
+ TCL_UNUSED(void **)) /* Where to store handle */
{
- (void)dummy;
- (void)direction;
- (void)handlePtr;
-
return TCL_ERROR;
}
@@ -824,7 +812,7 @@ InterpreterObjCmd(
if ((otherInterp == NULL) || Tcl_InterpDeleted(otherInterp)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "no active master interp", -1));
+ "no active parent interp", -1));
Tcl_SetErrorCode(interp, "TK", "CONSOLE", "NO_INTERP", NULL);
return TCL_ERROR;
}
@@ -947,7 +935,7 @@ ConsoleDeleteProc(
*
* ConsoleEventProc --
*
- * This event function is registered on the main window of the slave
+ * This event function is registered on the main window of the child
* 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".
diff --git a/generic/tkCursor.c b/generic/tkCursor.c
index 98f018a..5849706 100644
--- a/generic/tkCursor.c
+++ b/generic/tkCursor.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
diff --git a/generic/tkDList.h b/generic/tkDList.h
index 57af7d8..f6c70d9 100644
--- a/generic/tkDList.h
+++ b/generic/tkDList.h
@@ -7,7 +7,7 @@
* before or after an existing element or at the head/tail of the list.
* A list may be traversed in the forward or backward direction.
*
- * Copyright (c) 2018 by Gregor Cramer.
+ * Copyright © 2018 Gregor Cramer.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/generic/tkDecls.h b/generic/tkDecls.h
index fce0598..b7b0c14 100644
--- a/generic/tkDecls.h
+++ b/generic/tkDecls.h
@@ -3,7 +3,7 @@
*
* Declarations of functions in the platform independent public Tcl API.
*
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright (c) 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -355,7 +355,7 @@ EXTERN Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin,
Tk_ImageChangedProc *changeProc,
ClientData clientData);
/* 98 */
-EXTERN ClientData Tk_GetImageMasterData(Tcl_Interp *interp,
+EXTERN ClientData Tk_GetImageModelData(Tcl_Interp *interp,
const char *name,
const Tk_ImageType **typePtrPtr);
/* 99 */
@@ -411,7 +411,7 @@ EXTERN void Tk_HandleEvent(XEvent *eventPtr);
/* 116 */
EXTERN Tk_Window Tk_IdToWindow(Display *display, Window window);
/* 117 */
-EXTERN void Tk_ImageChanged(Tk_ImageMaster master, int x, int y,
+EXTERN void Tk_ImageChanged(Tk_ImageModel model, int x, int y,
int width, int height, int imageWidth,
int imageHeight);
/* 118 */
@@ -422,8 +422,8 @@ EXTERN Atom Tk_InternAtom(Tk_Window tkwin, const char *name);
EXTERN int Tk_IntersectTextLayout(Tk_TextLayout layout, int x,
int y, int width, int height);
/* 121 */
-EXTERN void Tk_MaintainGeometry(Tk_Window slave,
- Tk_Window master, int x, int y, int width,
+EXTERN void Tk_MaintainGeometry(Tk_Window window,
+ Tk_Window container, int x, int y, int width,
int height);
/* 122 */
EXTERN Tk_Window Tk_MainWindow(Tcl_Interp *interp);
@@ -461,7 +461,7 @@ EXTERN const char * Tk_NameOfCursor(Display *display, Tk_Cursor cursor);
/* 136 */
EXTERN const char * Tk_NameOfFont(Tk_Font font);
/* 137 */
-EXTERN const char * Tk_NameOfImage(Tk_ImageMaster imageMaster);
+EXTERN const char * Tk_NameOfImage(Tk_ImageModel model);
/* 138 */
EXTERN const char * Tk_NameOfJoinStyle(int join);
/* 139 */
@@ -594,8 +594,8 @@ EXTERN void Tk_UnderlineTextLayout(Display *display,
/* 180 */
EXTERN void Tk_Ungrab(Tk_Window tkwin);
/* 181 */
-EXTERN void Tk_UnmaintainGeometry(Tk_Window slave,
- Tk_Window master);
+EXTERN void Tk_UnmaintainGeometry(Tk_Window window,
+ Tk_Window container);
/* 182 */
EXTERN void Tk_UnmapWindow(Tk_Window tkwin);
/* 183 */
@@ -879,6 +879,21 @@ EXTERN void Tk_CreateOldImageType(const Tk_ImageType *typePtr);
EXTERN void Tk_CreateOldPhotoImageFormat(
const Tk_PhotoImageFormat *formatPtr);
/* 274 */
+EXTERN int Tk_AlwaysShowSelection(Tk_Window tkwin);
+/* 275 */
+EXTERN unsigned Tk_GetButtonMask(unsigned button);
+/* 276 */
+EXTERN int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj *objPtr,
+ double *doublePtr);
+/* 277 */
+EXTERN Tcl_Obj * Tk_NewWindowObj(Tk_Window tkwin);
+/* 278 */
+EXTERN void Tk_SendVirtualEvent(Tk_Window tkwin,
+ const char *eventName, Tcl_Obj *detail);
+/* 279 */
+EXTERN Tcl_Obj * Tk_FontGetDescription(Tk_Font tkfont);
+/* 280 */
EXTERN void Tk_CreatePhotoImageFormatVersion3(
const Tk_PhotoImageFormatVersion3 *formatPtr);
@@ -991,7 +1006,7 @@ typedef struct TkStubs {
void (*tk_GetFontMetrics) (Tk_Font font, Tk_FontMetrics *fmPtr); /* 95 */
GC (*tk_GetGC) (Tk_Window tkwin, unsigned long valueMask, XGCValues *valuePtr); /* 96 */
Tk_Image (*tk_GetImage) (Tcl_Interp *interp, Tk_Window tkwin, const char *name, Tk_ImageChangedProc *changeProc, ClientData clientData); /* 97 */
- ClientData (*tk_GetImageMasterData) (Tcl_Interp *interp, const char *name, const Tk_ImageType **typePtrPtr); /* 98 */
+ ClientData (*tk_GetImageModelData) (Tcl_Interp *interp, const char *name, const Tk_ImageType **typePtrPtr); /* 98 */
Tk_ItemType * (*tk_GetItemTypes) (void); /* 99 */
int (*tk_GetJoinStyle) (Tcl_Interp *interp, const char *str, int *joinPtr); /* 100 */
int (*tk_GetJustify) (Tcl_Interp *interp, const char *str, Tk_Justify *justifyPtr); /* 101 */
@@ -1010,11 +1025,11 @@ typedef struct TkStubs {
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 */
+ void (*tk_ImageChanged) (Tk_ImageModel model, 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 */
+ void (*tk_MaintainGeometry) (Tk_Window window, Tk_Window container, 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 */
@@ -1030,7 +1045,7 @@ typedef struct TkStubs {
const char * (*tk_NameOfColor) (XColor *colorPtr); /* 134 */
const char * (*tk_NameOfCursor) (Display *display, Tk_Cursor cursor); /* 135 */
const char * (*tk_NameOfFont) (Tk_Font font); /* 136 */
- const char * (*tk_NameOfImage) (Tk_ImageMaster imageMaster); /* 137 */
+ const char * (*tk_NameOfImage) (Tk_ImageModel model); /* 137 */
const char * (*tk_NameOfJoinStyle) (int join); /* 138 */
const char * (*tk_NameOfJustify) (Tk_Justify justify); /* 139 */
const char * (*tk_NameOfRelief) (int relief); /* 140 */
@@ -1074,7 +1089,7 @@ typedef struct TkStubs {
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_UnmaintainGeometry) (Tk_Window window, Tk_Window container); /* 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 */
@@ -1167,8 +1182,14 @@ typedef struct TkStubs {
Tcl_Interp * (*tk_Interp) (Tk_Window tkwin); /* 271 */
void (*tk_CreateOldImageType) (const Tk_ImageType *typePtr); /* 272 */
void (*tk_CreateOldPhotoImageFormat) (const Tk_PhotoImageFormat *formatPtr); /* 273 */
+ int (*tk_AlwaysShowSelection) (Tk_Window tkwin); /* 274 */
+ unsigned (*tk_GetButtonMask) (unsigned button); /* 275 */
+ int (*tk_GetDoublePixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 276 */
+ Tcl_Obj * (*tk_NewWindowObj) (Tk_Window tkwin); /* 277 */
+ void (*tk_SendVirtualEvent) (Tk_Window tkwin, const char *eventName, Tcl_Obj *detail); /* 278 */
+ Tcl_Obj * (*tk_FontGetDescription) (Tk_Font tkfont); /* 279 */
void (*tk_CreatePhotoImageFormatVersion3) (
- const Tk_PhotoImageFormatVersion3 *formatPtr); /* 274 */
+ const Tk_PhotoImageFormatVersion3 *formatPtr); /* 280 */
} TkStubs;
extern const TkStubs *tkStubsPtr;
@@ -1379,8 +1400,8 @@ extern const TkStubs *tkStubsPtr;
(tkStubsPtr->tk_GetGC) /* 96 */
#define Tk_GetImage \
(tkStubsPtr->tk_GetImage) /* 97 */
-#define Tk_GetImageMasterData \
- (tkStubsPtr->tk_GetImageMasterData) /* 98 */
+#define Tk_GetImageModelData \
+ (tkStubsPtr->tk_GetImageModelData) /* 98 */
#define Tk_GetItemTypes \
(tkStubsPtr->tk_GetItemTypes) /* 99 */
#define Tk_GetJoinStyle \
@@ -1729,8 +1750,20 @@ extern const TkStubs *tkStubsPtr;
(tkStubsPtr->tk_CreateOldImageType) /* 272 */
#define Tk_CreateOldPhotoImageFormat \
(tkStubsPtr->tk_CreateOldPhotoImageFormat) /* 273 */
+#define Tk_AlwaysShowSelection \
+ (tkStubsPtr->tk_AlwaysShowSelection) /* 274 */
+#define Tk_GetButtonMask \
+ (tkStubsPtr->tk_GetButtonMask) /* 275 */
+#define Tk_GetDoublePixelsFromObj \
+ (tkStubsPtr->tk_GetDoublePixelsFromObj) /* 276 */
+#define Tk_NewWindowObj \
+ (tkStubsPtr->tk_NewWindowObj) /* 277 */
+#define Tk_SendVirtualEvent \
+ (tkStubsPtr->tk_SendVirtualEvent) /* 278 */
+#define Tk_FontGetDescription \
+ (tkStubsPtr->tk_FontGetDescription) /* 279 */
#define Tk_CreatePhotoImageFormatVersion3 \
- (tkStubsPtr->tk_CreatePhotoImageFormatVersion3) /* 274 */
+ (tkStubsPtr->tk_CreatePhotoImageFormatVersion3) /* 280 */
#endif /* defined(USE_TK_STUBS) */
@@ -1748,7 +1781,7 @@ extern const TkStubs *tkStubsPtr;
#undef Tk_FreeStyleFromObj
#define Tk_GetStyleFromObj(obj) Tk_AllocStyleFromObj(NULL, obj)
#define Tk_FreeStyleFromObj(obj) /* no-op */
-
+#define Tk_GetImageMasterData Tk_GetImageModelData
#if defined(_WIN32) && defined(UNICODE)
# define Tk_MainEx Tk_MainExW
@@ -1770,4 +1803,6 @@ extern const TkStubs *tkStubsPtr;
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
+#undef TkUnusedStubEntry
+
#endif /* _TKDECLS */
diff --git a/generic/tkEntry.c b/generic/tkEntry.c
index 5f39b89..0e7f87c 100644
--- a/generic/tkEntry.c
+++ b/generic/tkEntry.c
@@ -6,10 +6,10 @@
* 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.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 2000 Ajuba Solutions.
- * Copyright (c) 2002 ActiveState Corporation.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2000 Ajuba Solutions.
+ * Copyright © 2002 ActiveState Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -574,7 +574,7 @@ Tk_EntryObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(entryPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(entryPtr->tkwin));
return TCL_OK;
}
@@ -737,7 +737,7 @@ EntryWidgetObjCmd(
&index) != TCL_OK) {
goto error;
}
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
break;
}
@@ -1684,7 +1684,7 @@ DisplayEntry(
* Hide the selection whenever we don't have the focus, unless we
* always want to show selection.
*/
- if (TkpAlwaysShowSelection(entryPtr->tkwin)) {
+ if (Tk_AlwaysShowSelection(entryPtr->tkwin)) {
showSelection = 1;
} else {
showSelection = (entryPtr->flags & GOT_FOCUS);
@@ -1766,34 +1766,56 @@ DisplayEntry(
}
}
- /*
- * Draw the text in two pieces: first the unselected portion, then the
- * selected portion on top of it.
- */
+ if ((entryPtr->numChars == 0) && (entryPtr->placeholderChars != 0)) {
- if ((entryPtr->numChars != 0) || (entryPtr->placeholderChars == 0)) {
- Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
- entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
- entryPtr->leftIndex, entryPtr->numChars);
- } else {
- Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->placeholderGC,
+ /*
+ * Draw the placeholder text.
+ */
+
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->placeholderGC,
entryPtr->placeholderLayout, entryPtr->placeholderX, entryPtr->layoutY,
entryPtr->placeholderLeftIndex, entryPtr->placeholderChars);
- }
- if (showSelection && (entryPtr->state != STATE_DISABLED)
- && (entryPtr->selTextGC != entryPtr->textGC)
- && (entryPtr->selectFirst + 1 < entryPtr->selectLast + 1)) {
- int selFirst;
+ } else {
- if (entryPtr->selectFirst + 1 < entryPtr->leftIndex + 1) {
- selFirst = entryPtr->leftIndex;
- } else {
- selFirst = entryPtr->selectFirst;
- }
- Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->selTextGC,
- entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
- selFirst, entryPtr->selectLast);
+ if (showSelection && (entryPtr->state != STATE_DISABLED)
+ && (entryPtr->selTextGC != entryPtr->textGC)
+ && (entryPtr->selectFirst + 1 < entryPtr->selectLast + 1)) {
+
+ /*
+ * Draw the selected and unselected portions separately.
+ */
+
+ TkSizeT selFirst;
+
+ if (entryPtr->selectFirst + 1 < entryPtr->leftIndex + 1) {
+ selFirst = entryPtr->leftIndex;
+ } else {
+ selFirst = entryPtr->selectFirst;
+ }
+ if (entryPtr->leftIndex < selFirst) {
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
+ entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
+ entryPtr->leftIndex, selFirst);
+ }
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->selTextGC,
+ entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
+ selFirst, entryPtr->selectLast);
+ if (entryPtr->selectLast < entryPtr->numChars) {
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
+ entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
+ entryPtr->selectLast, entryPtr->numChars);
+ }
+ } else {
+
+ /*
+ * Draw the entire visible text
+ */
+
+ Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC,
+ entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY,
+ entryPtr->leftIndex, entryPtr->numChars);
+ }
}
if (entryPtr->type == TK_SPINBOX) {
@@ -2668,7 +2690,7 @@ GetEntryIndex(
return TCL_OK;
}
- string = TkGetStringFromObj(indexObj, &length);
+ string = Tcl_GetStringFromObj(indexObj, &length);
switch (string[0]) {
case 'a':
@@ -2956,7 +2978,7 @@ EntryLostSelection(
* This is controlled by ::tk::AlwaysShowSelection.
*/
- if (TkpAlwaysShowSelection(entryPtr->tkwin)
+ if (Tk_AlwaysShowSelection(entryPtr->tkwin)
&& (entryPtr->selectFirst != TCL_INDEX_NONE) && entryPtr->exportSelection
&& (!Tcl_IsSafe(entryPtr->interp))) {
entryPtr->selectFirst = TCL_INDEX_NONE;
@@ -3385,17 +3407,21 @@ EntryValidateChange(
if (entryPtr->validateCmd == NULL ||
entryPtr->validate == VALIDATE_NONE) {
+ if (entryPtr->flags & VALIDATING) {
+ entryPtr->flags |= VALIDATE_ABORT;
+ }
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. Set
+ * validate to none to disallow further validations, arrange for flags
+ * to prevent current validation from finishing, and return.
*/
if (entryPtr->flags & VALIDATING) {
entryPtr->validate = VALIDATE_NONE;
+ entryPtr->flags |= VALIDATE_ABORT;
return (varValidate ? TCL_ERROR : TCL_OK);
}
@@ -3781,7 +3807,7 @@ Tk_SpinboxObjCmd(
goto error;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(entryPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(entryPtr->tkwin));
return TCL_OK;
error:
@@ -3969,7 +3995,7 @@ SpinboxWidgetObjCmd(
&index) != TCL_OK) {
goto error;
}
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj((int)index));
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
break;
}
@@ -4407,7 +4433,7 @@ SpinboxInvoke(
Tcl_ListObjGetElements(interp, sbPtr->listObj, &listc, &listv);
for (i = 0; i < listc; i++) {
- bytes = TkGetStringFromObj(listv[i], &elemLen);
+ bytes = Tcl_GetStringFromObj(listv[i], &elemLen);
if ((length == elemLen) &&
(memcmp(bytes, entryPtr->string,
length) == 0)) {
diff --git a/generic/tkEntry.h b/generic/tkEntry.h
index 293a9db..fe0f2f7 100644
--- a/generic/tkEntry.h
+++ b/generic/tkEntry.h
@@ -6,7 +6,7 @@
* 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 Inc.
+ * Copyright © 2002 Apple Inc.
*/
#ifndef _TKENTRY
diff --git a/generic/tkError.c b/generic/tkError.c
index 938afc3..ec72d1b 100644
--- a/generic/tkError.c
+++ b/generic/tkError.c
@@ -6,8 +6,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index bd312ad..bb9b12d 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -4,10 +4,10 @@
* 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
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1995 Sun Microsystems, Inc.
+ * Copyright © 1998-2000 Ajuba Solutions.
+ * Copyright © 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.
@@ -513,9 +513,12 @@ RefreshKeyboardMappingIfNeeded(
/*
*----------------------------------------------------------------------
*
- * TkGetButtonMask --
+ * Tk_GetButtonMask --
*
- * Return the proper Button${n}Mask for the button.
+ * Return the proper Button${n}Mask for the button. Don't care about
+ * Button4 - Button7, because those are not actually buttons: Those
+ * are used for the horizontal or vertical mouse wheels. Button4Mask
+ * and higher is actually used for Button 8 and higher.
*
* Results:
* A button mask.
@@ -526,14 +529,14 @@ RefreshKeyboardMappingIfNeeded(
*----------------------------------------------------------------------
*/
-static const unsigned long buttonMasks[] = {
- 0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask,
- Button6Mask, Button7Mask, Button8Mask, Button9Mask
+static const unsigned buttonMasks[] = {
+ 0, Button1Mask, Button2Mask, Button3Mask, 0, 0, 0, 0, Button4Mask, \
+ Button5Mask, Button6Mask, Button7Mask, Button8Mask, Button9Mask
};
-unsigned long
-TkGetButtonMask(
- unsigned int button)
+unsigned
+Tk_GetButtonMask(
+ unsigned button)
{
return (button > Button9) ? 0 : buttonMasks[button];
}
@@ -691,7 +694,7 @@ Tk_CreateEventHandler(
ClientData clientData) /* Arbitrary data to pass to proc. */
{
TkEventHandler *handlerPtr;
- TkWindow *winPtr = (TkWindow *) token;
+ TkWindow *winPtr = (TkWindow *)token;
/*
* Skim through the list of existing handlers to (a) compute the overall
@@ -1040,10 +1043,9 @@ TkEventInit(void)
static int
TkXErrorHandler(
ClientData clientData, /* Pointer to flag we set. */
- XErrorEvent *errEventPtr) /* X error info. */
+ TCL_UNUSED(XErrorEvent *)) /* X error info. */
{
int *error = (int *)clientData;
- (void)errEventPtr;
*error = 1;
return 0;
@@ -1138,6 +1140,23 @@ Tk_HandleEvent(
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+
+#if !defined(_WIN32) && !defined(MAC_OSX_TK)
+ if ((eventPtr->xbutton.button >= Button4) && (eventPtr->xbutton.button < Button8)) {
+ if (eventPtr->type == ButtonRelease) {
+ return;
+ } else if (eventPtr->type == ButtonPress) {
+ int but = eventPtr->xbutton.button;
+ eventPtr->type = MouseWheelEvent;
+ eventPtr->xany.send_event = -1;
+ eventPtr->xkey.keycode = (but & 1) ? -120 : 120;
+ if (but > Button5) {
+ eventPtr->xkey.state ^= ShiftMask;
+ }
+ }
+ }
+#endif
+
/*
* If the generic handler processed this event we are done and can return.
*/
@@ -2003,10 +2022,9 @@ TkDeleteThreadExitHandler(
void
TkFinalize(
- ClientData dummy) /* Arbitrary value to pass to proc. */
+ TCL_UNUSED(void *)) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr;
- (void)dummy;
#if defined(_WIN32) && !defined(STATIC_BUILD)
if (!tclStubsPtr) {
@@ -2056,12 +2074,11 @@ TkFinalize(
void
TkFinalizeThread(
- ClientData dummy) /* Arbitrary value to pass to proc. */
+ TCL_UNUSED(void *)) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)dummy;
Tcl_DeleteThreadExitHandler(TkFinalizeThread, NULL);
diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c
index 038129f..8a84f8e 100644
--- a/generic/tkFileFilter.c
+++ b/generic/tkFileFilter.c
@@ -4,7 +4,7 @@
* Process the -filetypes option for the file dialogs on Windows and the
* Mac.
*
- * Copyright (c) 1996 Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -263,7 +263,7 @@ AddClause(
for (i=0; i<ostypeCount; i++) {
TkSizeT len;
- const char *strType = TkGetStringFromObj(ostypeList[i], &len);
+ const char *strType = Tcl_GetStringFromObj(ostypeList[i], &len);
/*
* If len is < 4, it is definitely an error. If equal or longer,
@@ -323,7 +323,7 @@ AddClause(
for (i=0; i<globCount; i++) {
GlobPattern *globPtr = (GlobPattern *)ckalloc(sizeof(GlobPattern));
TkSizeT len;
- const char *str = TkGetStringFromObj(globList[i], &len);
+ const char *str = Tcl_GetStringFromObj(globList[i], &len);
len = (len + 1) * sizeof(char);
if (str[0] && str[0] != '*') {
@@ -377,7 +377,7 @@ AddClause(
Tcl_DString osTypeDS;
TkSizeT len;
MacFileType *mfPtr = (MacFileType *)ckalloc(sizeof(MacFileType));
- const char *strType = TkGetStringFromObj(ostypeList[i], &len);
+ const char *strType = Tcl_GetStringFromObj(ostypeList[i], &len);
char *string;
/*
diff --git a/generic/tkFileFilter.h b/generic/tkFileFilter.h
index 22db9e8..07d4d33 100644
--- a/generic/tkFileFilter.h
+++ b/generic/tkFileFilter.h
@@ -4,7 +4,7 @@
* Declarations for the file filter processing routines needed by the
* file selection dialogs.
*
- * Copyright (c) 1996 Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index 8066afd..5dc542a 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -3,8 +3,8 @@
*
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -128,7 +128,7 @@ Tk_FocusObjCmd(
Tk_Window focusWin = (Tk_Window) TkGetFocusWin(winPtr);
if (focusWin != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj(focusWin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(focusWin));
}
return TCL_OK;
}
@@ -179,7 +179,7 @@ Tk_FocusObjCmd(
}
newPtr = TkGetFocusWin(newPtr);
if (newPtr != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) newPtr));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window) newPtr));
}
break;
case 1: /* -force */
@@ -212,12 +212,12 @@ Tk_FocusObjCmd(
for (tlFocusPtr = newPtr->mainPtr->tlFocusPtr; tlFocusPtr != NULL;
tlFocusPtr = tlFocusPtr->nextPtr) {
if (tlFocusPtr->topLevelPtr == topLevelPtr) {
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window)
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window)
tlFocusPtr->focusWinPtr));
return TCL_OK;
}
}
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window) topLevelPtr));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window) topLevelPtr));
return TCL_OK;
}
break;
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 98a10f4..6664cbb 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -4,8 +4,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -13,6 +13,9 @@
#include "tkInt.h"
#include "tkFont.h"
+#if defined(MAC_OSX_TK)
+#include "tkMacOSXInt.h" /* Defines TK_DRAW_IN_CONTEXT */
+#endif
/*
* The following structure is used to keep track of all the fonts that exist
@@ -93,7 +96,7 @@ typedef struct TextLayout {
* layout. */
int numChunks; /* Number of chunks actually used in following
* array. */
- LayoutChunk chunks[1]; /* Array of chunks. The actual size will be
+ LayoutChunk chunks[TKFLEXARRAY];/* Array of chunks. The actual size will be
* maxChunks. THIS FIELD MUST BE THE LAST IN
* THE STRUCTURE. */
} TextLayout;
@@ -553,7 +556,7 @@ Tk_FontObjCmd(
if (objc < 3 || n < objc) {
Tcl_WrongNumArgs(interp, 2, objv,
- "font ?-displayof window? ?option? ?--? ?char?");
+ "font ?-displayof window? ?-option? ?--? ?char?");
return TCL_ERROR;
}
@@ -730,7 +733,7 @@ Tk_FontObjCmd(
if (tkfont == NULL) {
return TCL_ERROR;
}
- string = TkGetStringFromObj(objv[3 + skip], &length);
+ string = Tcl_GetStringFromObj(objv[3 + skip], &length);
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(
Tk_TextWidth(tkfont, string, length)));
Tk_FreeFont(tkfont);
@@ -738,7 +741,7 @@ Tk_FontObjCmd(
}
case FONT_METRICS: {
Tk_Font tkfont;
- int skip, index, i;
+ int skip, i;
const TkFontMetrics *fmPtr;
static const char *const switches[] = {
"-ascent", "-descent", "-linespace", "-fixed", NULL
@@ -750,7 +753,7 @@ Tk_FontObjCmd(
}
if ((objc < 3) || ((objc - skip) > 4)) {
Tcl_WrongNumArgs(interp, 2, objv,
- "font ?-displayof window? ?option?");
+ "font ?-displayof window? ?-option?");
return TCL_ERROR;
}
tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]);
@@ -881,7 +884,7 @@ TheWorldHasChanged(
* This is ignored on other platforms.
*/
- if (!TkpWillDrawWidget(NULL)) {
+ if (TkpWillDrawWidget(NULL)) {
return;
}
@@ -1359,11 +1362,10 @@ Tk_GetFontFromObj(
static int
SetFontFromAny(
- Tcl_Interp *dummy, /* Used for error reporting if not NULL. */
+ TCL_UNUSED(Tcl_Interp *), /* Used for error reporting if not NULL. */
Tcl_Obj *objPtr) /* The object to convert. */
{
const Tcl_ObjType *typePtr;
- (void)dummy;
/*
* Free the old internalRep before setting the new one.
@@ -1966,7 +1968,7 @@ Tk_ComputeTextLayout(
int *heightPtr) /* Filled with height of string. */
{
TkFont *fontPtr = (TkFont *) tkfont;
- const char *start, *end, *special;
+ const char *start, *endp, *special;
int n, y, bytesThisChunk, maxChunks, curLine, layoutHeight;
int baseline, height, curX, newX, maxWidth, *lineLengths;
TextLayout *layoutPtr;
@@ -1999,8 +2001,8 @@ Tk_ComputeTextLayout(
maxChunks = 1;
- layoutPtr = (TextLayout *)ckalloc(sizeof(TextLayout)
- + (maxChunks-1) * sizeof(LayoutChunk));
+ layoutPtr = (TextLayout *)ckalloc(offsetof(TextLayout, chunks)
+ + maxChunks * sizeof(LayoutChunk));
layoutPtr->tkfont = tkfont;
layoutPtr->string = string;
layoutPtr->numChunks = 0;
@@ -2014,12 +2016,12 @@ Tk_ComputeTextLayout(
curX = 0;
- end = Tcl_UtfAtIndex(string, numChars);
+ endp = Tcl_UtfAtIndex(string, numChars);
special = string;
flags &= TK_IGNORE_TABS | TK_IGNORE_NEWLINES;
flags |= TK_WHOLE_WORDS | TK_AT_LEAST_ONE;
- for (start = string; start < end; ) {
+ for (start = string; start < endp; ) {
if (start >= special) {
/*
* Find the next special character in the string.
@@ -2030,7 +2032,7 @@ Tk_ComputeTextLayout(
* whitespace set.
*/
- for (special = start; special < end; special++) {
+ for (special = start; special < endp; special++) {
if (!(flags & TK_IGNORE_NEWLINES)) {
if ((*special == '\n') || (*special == '\r')) {
break;
@@ -2064,7 +2066,7 @@ Tk_ComputeTextLayout(
}
}
- if ((start == special) && (special < end)) {
+ if ((start == special) && (special < endp)) {
/*
* Handle the special character.
*
@@ -2081,7 +2083,7 @@ Tk_ComputeTextLayout(
start++;
curX = newX;
flags &= ~TK_AT_LEAST_ONE;
- if ((start < end) &&
+ if ((start < endp) &&
((wrapLength <= 0) || (newX <= wrapLength))) {
/*
* More chars can still fit on this line.
@@ -2103,7 +2105,7 @@ Tk_ComputeTextLayout(
* Consume all extra spaces at end of line.
*/
- while ((start < end) && isspace(UCHAR(*start))) { /* INTL: ISO space */
+ while ((start < endp) && isspace(UCHAR(*start))) { /* INTL: ISO space */
if (!(flags & TK_IGNORE_NEWLINES)) {
if ((*start == '\n') || (*start == '\r')) {
break;
@@ -2291,12 +2293,16 @@ Tk_DrawTextLayout(
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
+ * from the given text item. 0 specifies 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. */
{
+#if 0
+ /* Use TkDrawAngledTextLayout() implementation - testing purposes at this point */
+ TkDrawAngledTextLayout(display, drawable, gc, layout, x, y, 0.0, firstChar, lastChar);
+#else
TextLayout *layoutPtr = (TextLayout *) layout;
int i, numDisplayChars, drawX;
const char *firstByte, *lastByte;
@@ -2326,8 +2332,15 @@ Tk_DrawTextLayout(
numDisplayChars = lastChar;
}
lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars);
+#ifdef TK_DRAW_IN_CONTEXT
+ TkpDrawCharsInContext(display, drawable, gc, layoutPtr->tkfont,
+ chunkPtr->start, chunkPtr->numBytes,
+ firstByte - chunkPtr->start, lastByte - firstByte,
+ x+chunkPtr->x, y+chunkPtr->y);
+#else /* !TK_DRAW_IN_CONTEXT */
Tk_DrawChars(display, drawable, gc, layoutPtr->tkfont, firstByte,
lastByte - firstByte, x+chunkPtr->x+drawX, y+chunkPtr->y);
+#endif /* TK_DRAW_IN_CONTEXT */
}
firstChar -= chunkPtr->numChars;
lastChar -= chunkPtr->numChars;
@@ -2336,6 +2349,7 @@ Tk_DrawTextLayout(
}
chunkPtr++;
}
+#endif /* Use TkDrawAngledTextLayout() implementation */
}
void
@@ -2350,7 +2364,7 @@ TkDrawAngledTextLayout(
* which to draw (pixels). */
double angle,
int firstChar, /* The index of the first character to draw
- * from the given text item. 0 specfies the
+ * from the given text item. 0 specifies the
* beginning. */
int lastChar) /* The index just after the last character to
* draw from the given text item. A number < 0
@@ -2388,6 +2402,21 @@ TkDrawAngledTextLayout(
numDisplayChars = lastChar;
}
lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars);
+#ifdef TK_DRAW_IN_CONTEXT
+ dx = cosA * (chunkPtr->x) + sinA * (chunkPtr->y);
+ dy = -sinA * (chunkPtr->x) + cosA * (chunkPtr->y);
+ if (angle == 0.0) {
+ TkpDrawCharsInContext(display, drawable, gc,
+ layoutPtr->tkfont, chunkPtr->start, chunkPtr->numBytes,
+ firstByte - chunkPtr->start, lastByte - firstByte,
+ (int)(x + dx), (int)(y + dy));
+ } else {
+ TkpDrawAngledCharsInContext(display, drawable, gc,
+ layoutPtr->tkfont, chunkPtr->start, chunkPtr->numBytes,
+ firstByte - chunkPtr->start, lastByte - firstByte,
+ x+dx, y+dy, angle);
+ }
+#else /* !TK_DRAW_IN_CONTEXT */
dx = cosA * (chunkPtr->x + drawX) + sinA * (chunkPtr->y);
dy = -sinA * (chunkPtr->x + drawX) + cosA * (chunkPtr->y);
if (angle == 0.0) {
@@ -2398,6 +2427,7 @@ TkDrawAngledTextLayout(
TkDrawAngledChars(display, drawable, gc, layoutPtr->tkfont,
firstByte, lastByte - firstByte, x+dx, y+dy, angle);
}
+#endif /* TK_DRAW_IN_CONTEXT */
}
firstChar -= chunkPtr->numChars;
lastChar -= chunkPtr->numChars;
@@ -2707,7 +2737,7 @@ Tk_CharBbox(
* index, if non-NULL. */
{
TextLayout *layoutPtr = (TextLayout *) layout;
- LayoutChunk *chunkPtr;
+ LayoutChunk *chunkPtr = layoutPtr->chunks;
int i, x = 0, w;
Tk_Font tkfont;
TkFont *fontPtr;
@@ -2717,7 +2747,6 @@ Tk_CharBbox(
return 0;
}
- chunkPtr = layoutPtr->chunks;
tkfont = layoutPtr->tkfont;
fontPtr = (TkFont *) tkfont;
@@ -3315,7 +3344,7 @@ Tk_TextLayoutToPostscript(
sprintf(uindex, "%04X", ch); /* endianness? */
glyphname = Tcl_GetVar2(interp, "::tk::psglyphs", uindex, 0);
if (glyphname) {
- ps = TkGetStringFromObj(psObj, &len);
+ ps = Tcl_GetStringFromObj(psObj, &len);
if (ps[len-1] == '(') {
/*
* In-place edit. Ewww!
@@ -3370,7 +3399,7 @@ noMapping: ;
static int
ConfigAttributesObj(
Tcl_Interp *interp, /* Interp for error return. */
- Tk_Window tkwin, /* For display on which font will be used. */
+ TCL_UNUSED(Tk_Window), /* 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
@@ -3380,7 +3409,6 @@ ConfigAttributesObj(
int i, n, index;
Tcl_Obj *optionPtr, *valuePtr;
const char *value;
- (void)tkwin;
for (i = 0; i < objc; i += 2) {
optionPtr = objv[i];
@@ -3546,6 +3574,57 @@ GetAttributeInfoObj(
/*
*---------------------------------------------------------------------------
*
+ * Tk_FontGetDescription --
+ *
+ * Return information about the font description as a Tcl list. One
+ * possible result is "{{DejaVu Sans} -16 bold underline}".
+ *
+ * Results:
+ * The list of descriptions.
+ *
+ * Side effects:
+ * None.
+ *
+ *---------------------------------------------------------------------------
+ */
+
+Tcl_Obj *
+Tk_FontGetDescription(
+ Tk_Font tkfont) /* Font whose description is desired. */
+{
+ const TkFontAttributes *faPtr = GetFontAttributes(tkfont);
+ Tcl_Obj *resultPtr = Tcl_NewObj();
+ const char *str;
+
+ str = faPtr->family;
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, str ? -1 : 0));
+ if (faPtr->size >= 0.0) {
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewWideIntObj((int)(faPtr->size + 0.5)));
+ } else {
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewWideIntObj(-(int)(-faPtr->size + 0.5)));
+ }
+ if (faPtr->weight != TK_FW_NORMAL) {
+ str = TkFindStateString(weightMap, faPtr->weight);
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1));
+ }
+ if (faPtr->slant != TK_FS_ROMAN) {
+ str = TkFindStateString(slantMap, faPtr->slant);
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1));
+ }
+ if (faPtr->underline) {
+ str = TkFindStateString(underlineMap, faPtr->underline);
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1));
+ }
+ if (faPtr->overstrike) {
+ str = TkFindStateString(overstrikeMap, faPtr->overstrike);
+ Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1));
+ }
+ return resultPtr;
+}
+
+/*
+ *---------------------------------------------------------------------------
+ *
* ParseFontNameObj --
*
* Converts a object into a set of font attributes that can be used to
@@ -3746,7 +3825,7 @@ NewChunk(
maxChunks = *maxPtr;
if (layoutPtr->numChunks == maxChunks) {
maxChunks *= 2;
- s = sizeof(TextLayout) + ((maxChunks - 1) * sizeof(LayoutChunk));
+ s = offsetof(TextLayout, chunks) + (maxChunks * sizeof(LayoutChunk));
layoutPtr = (TextLayout *)ckrealloc(layoutPtr, s);
*layoutPtrPtr = layoutPtr;
diff --git a/generic/tkFont.h b/generic/tkFont.h
index ceabee3..892d8da 100644
--- a/generic/tkFont.h
+++ b/generic/tkFont.h
@@ -5,7 +5,7 @@
* parts of the font package. This information is not visible outside of
* the font package.
*
- * Copyright (c) 1996-1997 Sun Microsystems, Inc.
+ * Copyright © 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.
diff --git a/generic/tkFrame.c b/generic/tkFrame.c
index df370af..9dbee48 100644
--- a/generic/tkFrame.c
+++ b/generic/tkFrame.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -344,7 +344,7 @@ static void FrameBgImageProc(ClientData clientData,
static void FrameCmdDeletedProc(ClientData clientData);
static void FrameEventProc(ClientData clientData,
XEvent *eventPtr);
-static void FrameLostSlaveProc(ClientData clientData,
+static void FrameLostContentProc(ClientData clientData,
Tk_Window tkwin);
static void FrameRequestProc(ClientData clientData,
Tk_Window tkwin);
@@ -376,7 +376,7 @@ static const Tk_ClassProcs frameClass = {
static const Tk_GeomMgr frameGeomType = {
"labelframe", /* name */
FrameRequestProc, /* requestProc */
- FrameLostSlaveProc /* lostSlaveProc */
+ FrameLostContentProc /* lostContentProc */
};
/*
@@ -547,7 +547,7 @@ CreateFrame(
className = colormapName = screenName = visualName = useOption = NULL;
colormap = None;
for (i = 2; i < objc; i += 2) {
- arg = TkGetStringFromObj(objv[i], &length);
+ arg = Tcl_GetStringFromObj(objv[i], &length);
if (length < 2) {
continue;
}
@@ -732,7 +732,7 @@ CreateFrame(
if (type == TYPE_TOPLEVEL) {
Tcl_DoWhenIdle(MapFrame, framePtr);
}
- Tcl_SetObjResult(interp, TkNewWindowObj(newWin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(newWin));
return TCL_OK;
error:
@@ -820,7 +820,7 @@ FrameWidgetObjCmd(
*/
for (i = 2; i < objc; i++) {
- const char *arg = TkGetStringFromObj(objv[i], &length);
+ const char *arg = Tcl_GetStringFromObj(objv[i], &length);
if (length < 2) {
continue;
@@ -839,7 +839,7 @@ FrameWidgetObjCmd(
|| ((c == 'v')
&& (strncmp(arg, "-visual", length) == 0))) {
-#ifdef SUPPORT_CONFIG_EMBEDDED
+#ifdef _WIN32
if (c == 'u') {
const char *string = Tcl_GetString(objv[i+1]);
@@ -2016,25 +2016,25 @@ FrameRequestProc(
/*
*--------------------------------------------------------------
*
- * FrameLostSlaveProc --
+ * FrameLostContentProc --
*
* This function is invoked by Tk whenever some other geometry claims
- * control over a slave that used to be managed by us.
+ * control over a content window that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all frame-related information about the slave.
+ * Forgets all frame-related information about the content window.
*
*--------------------------------------------------------------
*/
static void
-FrameLostSlaveProc(
- ClientData clientData, /* Frame structure for slave window that was
+FrameLostContentProc(
+ ClientData clientData, /* Frame structure for content window window that was
* stolen away. */
- Tk_Window tkwin) /* Tk's handle for the slave window. */
+ Tk_Window tkwin) /* Tk's handle for the content window window. */
{
Frame *framePtr = (Frame *)clientData;
Labelframe *labelframePtr = (Labelframe *)clientData;
diff --git a/generic/tkGC.c b/generic/tkGC.c
index 47931a6..591e887 100644
--- a/generic/tkGC.c
+++ b/generic/tkGC.c
@@ -4,8 +4,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c
index 30a57a9..35bf58e 100644
--- a/generic/tkGeometry.c
+++ b/generic/tkGeometry.c
@@ -4,8 +4,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -15,29 +15,29 @@
/*
* 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.
+ * each content managed by Tk_MaintainGeometry, there is one of these structures
+ * associated with its container.
*/
-typedef struct MaintainSlave {
- Tk_Window slave; /* The slave window being positioned. */
- Tk_Window master; /* The master that determines slave's
+typedef struct MaintainContent {
+ Tk_Window content; /* The content window being positioned. */
+ Tk_Window container; /* The container that determines content's
* position; it must be a descendant of
- * slave's parent. */
- int x, y; /* Desired position of slave relative to
- * master. */
- int width, height; /* Desired dimensions of slave. */
- struct MaintainSlave *nextPtr;
+ * content's parent. */
+ int x, y; /* Desired position of content relative to
+ * container. */
+ int width, height; /* Desired dimensions of content. */
+ struct MaintainContent *nextPtr;
/* Next in list of Maintains associated with
- * master. */
-} MaintainSlave;
+ * container. */
+} MaintainContent;
/*
- * For each window that has been specified as a master to Tk_MaintainGeometry,
+ * For each window that has been specified as a content to Tk_MaintainGeometry,
* there is a structure of the following type:
*/
-typedef struct MaintainMaster {
+typedef struct MaintainContainer {
Tk_Window ancestor; /* The lowest ancestor of this window for
* which we have *not* created a
* StructureNotify handler. May be the same as
@@ -45,18 +45,18 @@ typedef struct MaintainMaster {
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;
+ MaintainContent *contentPtr; /* First in list of all content associated with
+ * this container. */
+} MaintainContainer;
/*
* Prototypes for static procedures in this file:
*/
static void MaintainCheckProc(ClientData clientData);
-static void MaintainMasterProc(ClientData clientData,
+static void MaintainContainerProc(ClientData clientData,
XEvent *eventPtr);
-static void MaintainSlaveProc(ClientData clientData,
+static void MaintainContentProc(ClientData clientData,
XEvent *eventPtr);
/*
@@ -65,7 +65,7 @@ static void MaintainSlaveProc(ClientData clientData,
* Tk_ManageGeometry --
*
* Arrange for a particular procedure to manage the geometry of a given
- * slave window.
+ * content window.
*
* Results:
* None.
@@ -75,7 +75,7 @@ static void MaintainSlaveProc(ClientData clientData,
* 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.
+ * from the new one, it is notified by calling its lostContentProc.
*
*--------------------------------------------------------------
*/
@@ -95,8 +95,8 @@ Tk_ManageGeometry(
if ((winPtr->geomMgrPtr != NULL) && (mgrPtr != NULL)
&& ((winPtr->geomMgrPtr != mgrPtr)
|| (winPtr->geomData != clientData))
- && (winPtr->geomMgrPtr->lostSlaveProc != NULL)) {
- winPtr->geomMgrPtr->lostSlaveProc(winPtr->geomData, tkwin);
+ && (winPtr->geomMgrPtr->lostContentProc != NULL)) {
+ winPtr->geomMgrPtr->lostContentProc(winPtr->geomData, tkwin);
}
winPtr->geomMgrPtr = mgrPtr;
@@ -218,7 +218,7 @@ Tk_SetInternalBorderEx(
}
/*
- * All the slaves for which this is the master window must now be
+ * All the content for which this is the container window must now be
* repositioned to take account of the new internal border width. To
* signal all the geometry managers to do this, trigger a ConfigureNotify
* event. This will cause geometry managers to recompute everything.
@@ -303,78 +303,78 @@ Tk_SetMinimumRequestSize(
/*
*----------------------------------------------------------------------
*
- * TkSetGeometryMaster --
+ * TkSetGeometryContainer --
*
- * Set a geometry master for this window. Only one master may own
+ * Set a geometry container for this window. Only one container may own
* a window at any time.
*
* Results:
* A standard Tcl result.
*
* Side effects:
- * The geometry master is recorded for the window.
+ * The geometry container is recorded for the window.
*
*----------------------------------------------------------------------
*/
int
-TkSetGeometryMaster(
+TkSetGeometryContainer(
Tcl_Interp *interp, /* Current interpreter, for error. */
- Tk_Window tkwin, /* Window that will have geometry master
+ Tk_Window tkwin, /* Window that will have geometry container
* set. */
- const char *master) /* The master identity. */
+ const char *name) /* The name of the geometry manager. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
if (winPtr->geomMgrName != NULL &&
- strcmp(winPtr->geomMgrName, master) == 0) {
+ strcmp(winPtr->geomMgrName, name) == 0) {
return TCL_OK;
}
if (winPtr->geomMgrName != NULL) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "cannot use geometry manager %s inside %s which already"
- " has slaves managed by %s",
- master, Tk_PathName(tkwin), winPtr->geomMgrName));
+ "cannot use geometry manager %s inside %s because"
+ " %s is already managing it's content windows",
+ name, Tk_PathName(tkwin), winPtr->geomMgrName));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "FIGHT", NULL);
}
return TCL_ERROR;
}
- winPtr->geomMgrName = (char *)ckalloc(strlen(master) + 1);
- strcpy(winPtr->geomMgrName, master);
+ winPtr->geomMgrName = (char *)ckalloc(strlen(name) + 1);
+ strcpy(winPtr->geomMgrName, name);
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
- * TkFreeGeometryMaster --
+ * TkFreeGeometryContainer --
*
- * Remove a geometry master for this window. Only one master may own
+ * Remove a geometry container for this window. Only one container may own
* a window at any time.
*
* Results:
* None.
*
* Side effects:
- * The geometry master is cleared for the window.
+ * The geometry container is cleared for the window.
*
*----------------------------------------------------------------------
*/
void
-TkFreeGeometryMaster(
- Tk_Window tkwin, /* Window that will have geometry master
+TkFreeGeometryContainer(
+ Tk_Window tkwin, /* Window that will have geometry container
* cleared. */
- const char *master) /* The master identity. */
+ const char *name) /* The name of the geometry manager. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
if (winPtr->geomMgrName != NULL &&
- strcmp(winPtr->geomMgrName, master) != 0) {
+ strcmp(winPtr->geomMgrName, name) != 0) {
Tcl_Panic("Trying to free %s from geometry manager %s",
- winPtr->geomMgrName, master);
+ winPtr->geomMgrName, name);
}
if (winPtr->geomMgrName != NULL) {
ckfree(winPtr->geomMgrName);
@@ -387,12 +387,12 @@ TkFreeGeometryMaster(
*
* 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
+ * This procedure is invoked by geometry managers to handle content whose
+ * container's are not their parents. It translates the desired geometry for
+ * the content into the coordinate system of the parent and respositions
+ * the content if it isn't already at the right place. Furthermore, it sets
+ * up event handlers so that if the container (or any of its ancestors up to
+ * the content's parent) is mapped, unmapped, or moved, then the content will
* be adjusted to match.
*
* Results:
@@ -400,7 +400,7 @@ TkFreeGeometryMaster(
*
* Side effects:
* Event handlers are created and state is allocated to keep track of
- * slave. Note: if slave was already managed for master by
+ * content. Note: if content was already managed for container 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
@@ -411,40 +411,39 @@ TkFreeGeometryMaster(
void
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. */
+ Tk_Window window, /* Window for geometry management. */
+ Tk_Window container, /* Container for window; must be a descendant of
+ * window's parent. */
+ int x, int y, /* Desired position of window within container. */
+ int width, int height) /* Desired dimensions for window. */
{
Tcl_HashEntry *hPtr;
- MaintainMaster *masterPtr;
- MaintainSlave *slavePtr;
+ MaintainContainer *containerPtr;
+ MaintainContent *contentPtr;
int isNew, map;
Tk_Window ancestor, parent;
- TkDisplay *dispPtr = ((TkWindow *) master)->dispPtr;
+ TkDisplay *dispPtr = ((TkWindow *) container)->dispPtr;
- ((TkWindow *)slave)->maintainerPtr = (TkWindow *)master;
+ ((TkWindow *)window)->maintainerPtr = (TkWindow *)container;
- ((TkWindow *)slave)->maintainerPtr = (TkWindow *)master;
- if (master == Tk_Parent(slave)) {
+ if (container == Tk_Parent(window)) {
/*
- * If the slave is a direct descendant of the master, don't bother
+ * If the window is a direct descendant of the container, don't bother
* setting up the extra infrastructure for management, just make a
* call to Tk_MoveResizeWindow; the parent/child relationship will
* take care of the rest.
*/
- Tk_MoveResizeWindow(slave, x, y, width, height);
+ Tk_MoveResizeWindow(window, x, y, width, height);
/*
- * Map the slave if the master is already mapped; otherwise, wait
- * until the master is mapped later (in which case mapping the slave
+ * Map the window if the container is already mapped; otherwise, wait
+ * until the container is mapped later (in which case mapping the window
* is taken care of elsewhere).
*/
- if (Tk_IsMapped(master)) {
- Tk_MapWindow(slave);
+ if (Tk_IsMapped(container)) {
+ Tk_MapWindow(window);
}
return;
}
@@ -455,55 +454,55 @@ Tk_MaintainGeometry(
}
/*
- * See if there is already a MaintainMaster structure for the master; if
+ * See if there is already a MaintainContainer structure for the container; if
* not, then create one.
*/
- parent = Tk_Parent(slave);
+ parent = Tk_Parent(window);
hPtr = Tcl_CreateHashEntry(&dispPtr->maintainHashTable,
- (char *) master, &isNew);
+ (char *) container, &isNew);
if (!isNew) {
- masterPtr = (MaintainMaster *)Tcl_GetHashValue(hPtr);
+ containerPtr = (MaintainContainer *)Tcl_GetHashValue(hPtr);
} else {
- masterPtr = (MaintainMaster *)ckalloc(sizeof(MaintainMaster));
- masterPtr->ancestor = master;
- masterPtr->checkScheduled = 0;
- masterPtr->slavePtr = NULL;
- Tcl_SetHashValue(hPtr, masterPtr);
+ containerPtr = (MaintainContainer *)ckalloc(sizeof(MaintainContainer));
+ containerPtr->ancestor = container;
+ containerPtr->checkScheduled = 0;
+ containerPtr->contentPtr = NULL;
+ Tcl_SetHashValue(hPtr, containerPtr);
}
/*
- * Create a MaintainSlave structure for the slave if there isn't already
+ * Create a MaintainContent structure for the window if there isn't already
* one.
*/
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- if (slavePtr->slave == slave) {
- goto gotSlave;
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ if (contentPtr->content == window) {
+ goto gotContent;
}
}
- slavePtr = (MaintainSlave *)ckalloc(sizeof(MaintainSlave));
- slavePtr->slave = slave;
- slavePtr->master = master;
- slavePtr->nextPtr = masterPtr->slavePtr;
- masterPtr->slavePtr = slavePtr;
- Tk_CreateEventHandler(slave, StructureNotifyMask, MaintainSlaveProc,
- slavePtr);
+ contentPtr = (MaintainContent *)ckalloc(sizeof(MaintainContent));
+ contentPtr->content = window;
+ contentPtr->container = container;
+ contentPtr->nextPtr = containerPtr->contentPtr;
+ containerPtr->contentPtr = contentPtr;
+ Tk_CreateEventHandler(window, StructureNotifyMask, MaintainContentProc,
+ contentPtr);
/*
* 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).
+ * between container and windows's parent (including container but not window's
+ * parent). There may already be handlers for container and some of its
+ * ancestors (containerPtr->ancestor tells how many).
*/
- for (ancestor = master; ancestor != parent;
+ for (ancestor = container; ancestor != parent;
ancestor = Tk_Parent(ancestor)) {
- if (ancestor == masterPtr->ancestor) {
+ if (ancestor == containerPtr->ancestor) {
Tk_CreateEventHandler(ancestor, StructureNotifyMask,
- MaintainMasterProc, masterPtr);
- masterPtr->ancestor = Tk_Parent(ancestor);
+ MaintainContainerProc, containerPtr);
+ containerPtr->ancestor = Tk_Parent(ancestor);
}
}
@@ -512,27 +511,27 @@ Tk_MaintainGeometry(
* if it's not currently in the right place or state.
*/
- gotSlave:
- slavePtr->x = x;
- slavePtr->y = y;
- slavePtr->width = width;
- slavePtr->height = height;
+ gotContent:
+ contentPtr->x = x;
+ contentPtr->y = y;
+ contentPtr->width = width;
+ contentPtr->height = height;
map = 1;
- for (ancestor = slavePtr->master; ; ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = contentPtr->container; ; ancestor = Tk_Parent(ancestor)) {
if (!Tk_IsMapped(ancestor) && (ancestor != parent)) {
map = 0;
}
if (ancestor == parent) {
- if ((x != Tk_X(slavePtr->slave))
- || (y != Tk_Y(slavePtr->slave))
- || (width != Tk_Width(slavePtr->slave))
- || (height != Tk_Height(slavePtr->slave))) {
- Tk_MoveResizeWindow(slavePtr->slave, x, y, width, height);
+ if ((x != Tk_X(contentPtr->content))
+ || (y != Tk_Y(contentPtr->content))
+ || (width != Tk_Width(contentPtr->content))
+ || (height != Tk_Height(contentPtr->content))) {
+ Tk_MoveResizeWindow(contentPtr->content, x, y, width, height);
}
if (map) {
- Tk_MapWindow(slavePtr->slave);
+ Tk_MapWindow(contentPtr->content);
} else {
- Tk_UnmapWindow(slavePtr->slave);
+ Tk_UnmapWindow(contentPtr->content);
}
break;
}
@@ -547,37 +546,36 @@ Tk_MaintainGeometry(
* Tk_UnmaintainGeometry --
*
* This procedure cancels a previous Tk_MaintainGeometry call, so that
- * the relationship between slave and master is no longer maintained.
+ * the relationship between window and container 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 window is unmapped and state is released, so that window won't track
+ * container any more. If we weren't previously managing window relative to
+ * container, then this procedure has no effect.
*
*----------------------------------------------------------------------
*/
void
Tk_UnmaintainGeometry(
- Tk_Window slave, /* Slave for geometry management. */
- Tk_Window master) /* Master for slave; must be a descendant of
- * slave's parent. */
+ Tk_Window window, /* WIndow for geometry management. */
+ Tk_Window container) /* Container for window; must be a descendant of
+ * window's parent. */
{
Tcl_HashEntry *hPtr;
- MaintainMaster *masterPtr;
- MaintainSlave *slavePtr, *prevPtr;
+ MaintainContainer *containerPtr;
+ MaintainContent *contentPtr, *prevPtr;
Tk_Window ancestor;
- TkDisplay *dispPtr = ((TkWindow *) slave)->dispPtr;
+ TkDisplay *dispPtr = ((TkWindow *) window)->dispPtr;
- ((TkWindow *)slave)->maintainerPtr = NULL;
+ ((TkWindow *)window)->maintainerPtr = NULL;
- ((TkWindow *)slave)->maintainerPtr = NULL;
- if (master == Tk_Parent(slave)) {
+ if (container == Tk_Parent(window)) {
/*
- * If the slave is a direct descendant of the master,
+ * If the window is a direct descendant of the container,
* Tk_MaintainGeometry will not have set up any of the extra
* infrastructure. Don't even bother to look for it, just return.
*/
@@ -589,57 +587,57 @@ Tk_UnmaintainGeometry(
Tcl_InitHashTable(&dispPtr->maintainHashTable, TCL_ONE_WORD_KEYS);
}
- if (!(((TkWindow *) slave)->flags & TK_ALREADY_DEAD)) {
- Tk_UnmapWindow(slave);
+ if (!(((TkWindow *) window)->flags & TK_ALREADY_DEAD)) {
+ Tk_UnmapWindow(window);
}
- hPtr = Tcl_FindHashEntry(&dispPtr->maintainHashTable, master);
+ hPtr = Tcl_FindHashEntry(&dispPtr->maintainHashTable, container);
if (hPtr == NULL) {
return;
}
- masterPtr = (MaintainMaster *)Tcl_GetHashValue(hPtr);
- slavePtr = masterPtr->slavePtr;
- if (slavePtr->slave == slave) {
- masterPtr->slavePtr = slavePtr->nextPtr;
+ containerPtr = (MaintainContainer *)Tcl_GetHashValue(hPtr);
+ contentPtr = containerPtr->contentPtr;
+ if (contentPtr->content == window) {
+ containerPtr->contentPtr = contentPtr->nextPtr;
} else {
- for (prevPtr = slavePtr, slavePtr = slavePtr->nextPtr; ;
- prevPtr = slavePtr, slavePtr = slavePtr->nextPtr) {
- if (slavePtr == NULL) {
+ for (prevPtr = contentPtr, contentPtr = contentPtr->nextPtr; ;
+ prevPtr = contentPtr, contentPtr = contentPtr->nextPtr) {
+ if (contentPtr == NULL) {
return;
}
- if (slavePtr->slave == slave) {
- prevPtr->nextPtr = slavePtr->nextPtr;
+ if (contentPtr->content == window) {
+ prevPtr->nextPtr = contentPtr->nextPtr;
break;
}
}
}
- Tk_DeleteEventHandler(slavePtr->slave, StructureNotifyMask,
- MaintainSlaveProc, slavePtr);
- ckfree(slavePtr);
- if (masterPtr->slavePtr == NULL) {
- if (masterPtr->ancestor != NULL) {
- for (ancestor = master; ; ancestor = Tk_Parent(ancestor)) {
+ Tk_DeleteEventHandler(contentPtr->content, StructureNotifyMask,
+ MaintainContentProc, contentPtr);
+ ckfree(contentPtr);
+ if (containerPtr->contentPtr == NULL) {
+ if (containerPtr->ancestor != NULL) {
+ for (ancestor = container; ; ancestor = Tk_Parent(ancestor)) {
Tk_DeleteEventHandler(ancestor, StructureNotifyMask,
- MaintainMasterProc, masterPtr);
- if (ancestor == masterPtr->ancestor) {
+ MaintainContainerProc, containerPtr);
+ if (ancestor == containerPtr->ancestor) {
break;
}
}
}
- if (masterPtr->checkScheduled) {
- Tcl_CancelIdleCall(MaintainCheckProc, masterPtr);
+ if (containerPtr->checkScheduled) {
+ Tcl_CancelIdleCall(MaintainCheckProc, containerPtr);
}
Tcl_DeleteHashEntry(hPtr);
- ckfree(masterPtr);
+ ckfree(containerPtr);
}
}
/*
*----------------------------------------------------------------------
*
- * MaintainMasterProc --
+ * MaintainContainerProc --
*
* This procedure is invoked by the Tk event dispatcher in response to
- * StructureNotify events on the master or one of its ancestors, on
+ * StructureNotify events on the container or one of its ancestors, on
* behalf of Tk_MaintainGeometry.
*
* Results:
@@ -648,43 +646,43 @@ Tk_UnmaintainGeometry(
* 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
+ * maintained windows of the container. Or, if the container window is being
* deleted then state is cleaned up.
*
*----------------------------------------------------------------------
*/
static void
-MaintainMasterProc(
- ClientData clientData, /* Pointer to MaintainMaster structure for the
- * master window. */
+MaintainContainerProc(
+ ClientData clientData, /* Pointer to MaintainContainer structure for the
+ * container window. */
XEvent *eventPtr) /* Describes what just happened. */
{
- MaintainMaster *masterPtr = (MaintainMaster *)clientData;
- MaintainSlave *slavePtr;
+ MaintainContainer *containerPtr = (MaintainContainer *)clientData;
+ MaintainContent *contentPtr;
int done;
if ((eventPtr->type == ConfigureNotify)
|| (eventPtr->type == MapNotify)
|| (eventPtr->type == UnmapNotify)) {
- if (!masterPtr->checkScheduled) {
- masterPtr->checkScheduled = 1;
- Tcl_DoWhenIdle(MaintainCheckProc, masterPtr);
+ if (!containerPtr->checkScheduled) {
+ containerPtr->checkScheduled = 1;
+ Tcl_DoWhenIdle(MaintainCheckProc, containerPtr);
}
} 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
+ * Delete all of the state associated with this container, but be careful
+ * not to use containerPtr after the last window is deleted, since its
* memory will have been freed.
*/
done = 0;
do {
- slavePtr = masterPtr->slavePtr;
- if (slavePtr->nextPtr == NULL) {
+ contentPtr = containerPtr->contentPtr;
+ if (contentPtr->nextPtr == NULL) {
done = 1;
}
- Tk_UnmaintainGeometry(slavePtr->slave, slavePtr->master);
+ Tk_UnmaintainGeometry(contentPtr->content, contentPtr->container);
} while (!done);
}
}
@@ -692,10 +690,10 @@ MaintainMasterProc(
/*
*----------------------------------------------------------------------
*
- * MaintainSlaveProc --
+ * MaintainContentProc --
*
* This procedure is invoked by the Tk event dispatcher in response to
- * StructureNotify events on a slave being managed by
+ * StructureNotify events on a window being managed by
* Tk_MaintainGeometry.
*
* Results:
@@ -703,21 +701,21 @@ MaintainMasterProc(
*
* Side effects:
* If the event is a DestroyNotify event then the Maintain state and
- * event handlers for this slave are deleted.
+ * event handlers for this window are deleted.
*
*----------------------------------------------------------------------
*/
static void
-MaintainSlaveProc(
- ClientData clientData, /* Pointer to MaintainSlave structure for
- * master-slave pair. */
+MaintainContentProc(
+ ClientData clientData, /* Pointer to MaintainContent structure for
+ * container-window pair. */
XEvent *eventPtr) /* Describes what just happened. */
{
- MaintainSlave *slavePtr = (MaintainSlave *)clientData;
+ MaintainContent *contentPtr = (MaintainContent *)clientData;
if (eventPtr->type == DestroyNotify) {
- Tk_UnmaintainGeometry(slavePtr->slave, slavePtr->master);
+ Tk_UnmaintainGeometry(contentPtr->content, contentPtr->container);
}
}
@@ -727,50 +725,50 @@ MaintainSlaveProc(
* 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.
+ * handler, when a container or one of its ancestors has been reconfigured,
+ * mapped, or unmapped. Its job is to scan all of the windows for the
+ * container and reposition them, map them, or unmap them as needed to
+ * maintain their geometry relative to the container.
*
* Results:
* None.
*
* Side effects:
- * Slaves can get repositioned, mapped, or unmapped.
+ * Windows can get repositioned, mapped, or unmapped.
*
*----------------------------------------------------------------------
*/
static void
MaintainCheckProc(
- ClientData clientData) /* Pointer to MaintainMaster structure for the
- * master window. */
+ ClientData clientData) /* Pointer to MaintainContainer structure for the
+ * container window. */
{
- MaintainMaster *masterPtr = (MaintainMaster *)clientData;
- MaintainSlave *slavePtr;
+ MaintainContainer *containerPtr = (MaintainContainer *)clientData;
+ MaintainContent *contentPtr;
Tk_Window ancestor, parent;
int x, y, map;
- masterPtr->checkScheduled = 0;
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- parent = Tk_Parent(slavePtr->slave);
- x = slavePtr->x;
- y = slavePtr->y;
+ containerPtr->checkScheduled = 0;
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ parent = Tk_Parent(contentPtr->content);
+ x = contentPtr->x;
+ y = contentPtr->y;
map = 1;
- for (ancestor = slavePtr->master; ; ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = contentPtr->container; ; ancestor = Tk_Parent(ancestor)) {
if (!Tk_IsMapped(ancestor) && (ancestor != parent)) {
map = 0;
}
if (ancestor == parent) {
- if ((x != Tk_X(slavePtr->slave))
- || (y != Tk_Y(slavePtr->slave))) {
- Tk_MoveWindow(slavePtr->slave, x, y);
+ if ((x != Tk_X(contentPtr->content))
+ || (y != Tk_Y(contentPtr->content))) {
+ Tk_MoveWindow(contentPtr->content, x, y);
}
if (map) {
- Tk_MapWindow(slavePtr->slave);
+ Tk_MapWindow(contentPtr->content);
} else {
- Tk_UnmapWindow(slavePtr->slave);
+ Tk_UnmapWindow(contentPtr->content);
}
break;
}
diff --git a/generic/tkGet.c b/generic/tkGet.c
index 7ca4d17..ec3641f 100644
--- a/generic/tkGet.c
+++ b/generic/tkGet.c
@@ -6,8 +6,8 @@
* 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.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -493,11 +493,10 @@ Tk_NameOfJustify(
static void
FreeUidThreadExitProc(
- ClientData dummy) /* Not used. */
+ TCL_UNUSED(void *))
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)dummy;
Tcl_DeleteHashTable(&tsdPtr->uidTable);
tsdPtr->initialized = 0;
@@ -695,6 +694,11 @@ TkGetDoublePixels(
char *end;
double d;
+ if (!tkwin) {
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad screen"));
+ Tcl_SetErrorCode(interp, "TK", "VALUE", "FRACTIONAL_PIXELS", NULL);
+ return TCL_ERROR;
+ }
d = strtod((char *) string, &end);
if (end == string) {
goto error;
diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index 012d434..c1955a0 100644
--- a/generic/tkGrab.c
+++ b/generic/tkGrab.c
@@ -3,8 +3,8 @@
*
* 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.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -215,7 +215,7 @@ Tk_GrabObjCmd(
* First check for a window name or "-global" as the first argument.
*/
- arg = TkGetStringFromObj(objv[1], &len);
+ arg = Tcl_GetStringFromObj(objv[1], &len);
if (arg[0] == '.') {
/* [grab window] */
if (objc != 2) {
@@ -270,7 +270,7 @@ Tk_GrabObjCmd(
}
dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (dispPtr->eventualGrabWinPtr != NULL) {
- Tcl_SetObjResult(interp, TkNewWindowObj((Tk_Window)
+ Tcl_SetObjResult(interp, Tk_NewWindowObj((Tk_Window)
dispPtr->eventualGrabWinPtr));
}
} else {
@@ -279,7 +279,7 @@ Tk_GrabObjCmd(
for (dispPtr = TkGetDisplayList(); dispPtr != NULL;
dispPtr = dispPtr->nextPtr) {
if (dispPtr->eventualGrabWinPtr != NULL) {
- Tcl_ListObjAppendElement(NULL, resultObj, TkNewWindowObj(
+ Tcl_ListObjAppendElement(NULL, resultObj, Tk_NewWindowObj(
(Tk_Window) dispPtr->eventualGrabWinPtr));
}
}
@@ -666,6 +666,9 @@ ReleaseButtonGrab(
* This function is called for each pointer-related event, before the
* event has been processed. It does various things to make grabs work
* correctly.
+ * Also, this function takes care of warping the mouse pointer with
+ * respect to a given window, both when there is a grab in effect and
+ * when there is none.
*
* Results:
* If the return value is 1 it means the event should be processed (event
@@ -677,6 +680,7 @@ ReleaseButtonGrab(
* 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.
+ * The mouse pointer may be moved.
*
*----------------------------------------------------------------------
*/
@@ -773,10 +777,24 @@ TkPointerEvent(
return 1;
}
+ if ((eventPtr->type == MotionNotify) && !appGrabbed) {
+
+ /*
+ * Warp the mouse pointer with respect to window dispPtr->warpWindow
+ * if such a window was set in HandleEventGenerate.
+ */
+
+ TkDoWarpWrtWin(dispPtr);
+ }
+
if (!appGrabbed) {
return 1;
}
+ /*
+ * From this point on, there is a grab in effect.
+ */
+
if (eventPtr->type == MotionNotify) {
/*
* When grabs are active, X reports motion events relative to the
@@ -799,6 +817,13 @@ TkPointerEvent(
Tk_QueueWindowEvent(eventPtr, TCL_QUEUE_HEAD);
return 0;
}
+
+ /*
+ * Warp the mouse pointer with respect to window dispPtr->warpWindow
+ * if such a window was set in HandleEventGenerate.
+ */
+
+ TkDoWarpWrtWin(dispPtr);
return 1;
}
@@ -871,7 +896,7 @@ TkPointerEvent(
} else {
if (eventPtr->xbutton.button != AnyButton &&
((eventPtr->xbutton.state & ALL_BUTTONS)
- == TkGetButtonMask(eventPtr->xbutton.button))) {
+ == Tk_GetButtonMask(eventPtr->xbutton.button))) {
ReleaseButtonGrab(dispPtr); /* Note 4. */
}
}
@@ -1370,12 +1395,11 @@ QueueGrabWindowChange(
static int
GrabWinEventProc(
Tcl_Event *evPtr, /* Event of type NewGrabWinEvent. */
- int flags) /* Flags argument to Tcl_DoOneEvent: indicates
+ TCL_UNUSED(int)) /* Flags argument to Tcl_DoOneEvent: indicates
* what kinds of events are being processed
* right now. */
{
NewGrabWinEvent *grabEvPtr = (NewGrabWinEvent *) evPtr;
- (void)flags;
grabEvPtr->dispPtr->grabWinPtr = (TkWindow *) Tk_IdToWindow(
grabEvPtr->dispPtr->display, grabEvPtr->grabWindow);
diff --git a/generic/tkGrid.c b/generic/tkGrid.c
index 32246ae..1ca3fa7 100644
--- a/generic/tkGrid.c
+++ b/generic/tkGrid.c
@@ -3,7 +3,7 @@
*
* Grid based geometry manager.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright © 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.
@@ -66,7 +66,7 @@
#define GRID_DEFAULT_ANCHOR TK_ANCHOR_NW
/*
- * Structure to hold information for grid masters. A slot is either a row or
+ * Structure to hold information for grid containers. A slot is either a row or
* column.
*/
@@ -80,7 +80,7 @@ typedef struct SlotInfo {
* 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. */
+ * content in the slot. */
Tk_Uid uniform; /* Value of -uniform option. It is used to
* group slots that should have the same
* size. */
@@ -99,13 +99,13 @@ typedef struct SlotInfo {
*/
typedef struct GridLayout {
- struct Gridder *binNextPtr; /* The next slave window in this bin. Each bin
- * contains a list of all slaves whose spans
+ struct Gridder *binNextPtr; /* The next content window in this bin. Each bin
+ * contains a list of all content 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,
+ * any content contained entirely in this slot,
* adjusted for any slot constrants, such as
* size or padding. */
int pad; /* Padding needed for this slot */
@@ -124,31 +124,31 @@ typedef struct GridLayout {
} GridLayout;
/*
- * Keep one of these for each geometry master.
+ * Keep one of these for each geometry container.
*/
typedef struct {
SlotInfo *columnPtr; /* Pointer to array of column constraints. */
SlotInfo *rowPtr; /* Pointer to array of row constraints. */
- int columnEnd; /* The last column occupied by any slave. */
+ int columnEnd; /* The last column occupied by any content. */
int columnMax; /* The number of columns with constraints. */
int columnSpace; /* The number of slots currently allocated for
* column constraints. */
- int rowEnd; /* The last row occupied by any slave. */
+ int rowEnd; /* The last row occupied by any content. */
int rowMax; /* The number of rows with constraints. */
int rowSpace; /* The number of slots currently allocated for
* row constraints. */
int startX; /* Pixel offset of this layout within its
- * master. */
+ * container. */
int startY; /* Pixel offset of this layout within its
- * master. */
+ * container. */
Tk_Anchor anchor; /* Value of anchor option: specifies where a
* grid without weight should be placed. */
-} GridMaster;
+} GridContainer;
/*
* 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
+ * managed by the grid or because the window has content that are managed by
* the grid), there is a structure of the following type:
*/
@@ -157,18 +157,18 @@ typedef struct Gridder {
* 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
+ struct Gridder *containerPtr; /* Container 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.
+ struct Gridder *nextPtr; /* Next window managed within same container.
* 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. */
- Tcl_Obj *in; /* Store master name when removed. */
+ struct Gridder *contentPtr; /* First in list of content managed inside this
+ * window (NULL means no grid content). */
+ GridContainer *containerDataPtr; /* Additional data for geometry container. */
+ Tcl_Obj *in; /* Store container name when removed. */
int column, row; /* Location in the grid (starting from
* zero). */
- int numCols, numRows; /* Number of columns or rows this slave spans.
+ int numCols, numRows; /* Number of columns or rows this content 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
@@ -185,12 +185,12 @@ typedef struct Gridder {
* 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 master. */
+ * re-arranged within its container. */
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
+ * for example, if tkwin or any of its content
* is deleted. */
int flags; /* Miscellaneous flags; see below for
* definitions. */
@@ -199,9 +199,9 @@ typedef struct Gridder {
* These fields are used temporarily for layout calculations only.
*/
- struct Gridder *binNextPtr; /* Link to next span>1 slave in this bin. */
+ struct Gridder *binNextPtr; /* Link to next span>1 content in this bin. */
int size; /* Nominal size (width or height) in pixels of
- * the slave. This includes the padding. */
+ * the content. This includes the padding. */
} Gridder;
/*
@@ -235,32 +235,32 @@ 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
+ * been made to re-arrange all the content of this
* window.
* DONT_PROPAGATE 1 means don't set this window's requested
- * size. 0 means if this window is a master then
+ * size. 0 means if this window is a container then
* Tk will set its requested size to fit the
- * needs of its slaves.
- * ALLOCED_MASTER 1 means that Grid has allocated itself as
- * geometry master for this window.
+ * needs of its content.
+ * ALLOCED_CONTAINER 1 means that Grid has allocated itself as
+ * geometry container for this window.
*/
#define REQUESTED_RELAYOUT 1
#define DONT_PROPAGATE 2
-#define ALLOCED_MASTER 4
+#define ALLOCED_CONTAINER 4
/*
* Prototypes for procedures used only in this file:
*/
-static void AdjustForSticky(Gridder *slavePtr, int *xPtr,
+static void AdjustForSticky(Gridder *contentPtr, 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,
+static int CheckSlotData(Gridder *containerPtr, int slot,
int slotType, int checkOnly);
-static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin,
+static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin,
int objc, Tcl_Obj *const objv[]);
static void DestroyGrid(void *memPtr);
static Gridder * GetGrid(Tk_Window tkwin);
@@ -284,22 +284,22 @@ static int GridRowColumnConfigureCommand(Tk_Window tkwin,
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,
+static int GridContentCommand(Tk_Window tkwin, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
static void GridStructureProc(ClientData clientData,
XEvent *eventPtr);
-static void GridLostSlaveProc(ClientData clientData,
+static void GridLostContentProc(ClientData clientData,
Tk_Window tkwin);
static void GridReqProc(ClientData clientData, Tk_Window tkwin);
-static void InitMasterData(Gridder *masterPtr);
+static void InitContainerData(Gridder *containerPtr);
static Tcl_Obj * NewPairObj(Tcl_WideInt, Tcl_WideInt);
static Tcl_Obj * NewQuadObj(Tcl_WideInt, Tcl_WideInt, Tcl_WideInt, Tcl_WideInt);
static int ResolveConstraints(Gridder *gridPtr, int rowOrColumn,
int maxOffset);
static void SetGridSize(Gridder *gridPtr);
-static int SetSlaveColumn(Tcl_Interp *interp, Gridder *slavePtr,
+static int SetContentColumn(Tcl_Interp *interp, Gridder *contentPtr,
int column, int numCols);
-static int SetSlaveRow(Tcl_Interp *interp, Gridder *slavePtr,
+static int SetContentRow(Tcl_Interp *interp, Gridder *contentPtr,
int row, int numRows);
static Tcl_Obj * StickyToObj(int flags);
static int StringToSticky(const char *string);
@@ -308,7 +308,7 @@ static void Unlink(Gridder *gridPtr);
static const Tk_GeomMgr gridMgrType = {
"grid", /* name */
GridReqProc, /* requestProc */
- GridLostSlaveProc, /* lostSlaveProc */
+ GridLostContentProc, /* lostContentProc */
};
/*
@@ -338,13 +338,18 @@ Tk_GridObjCmd(
Tk_Window tkwin = (Tk_Window)clientData;
static const char *const optionStrings[] = {
"anchor", "bbox", "columnconfigure", "configure",
- "forget", "info", "location", "propagate", "remove",
- "rowconfigure", "size", "slaves", NULL
+ "content", "forget", "info", "location", "propagate",
+ "remove", "rowconfigure", "size", "slaves", NULL
+ };
+ static const char *const optionStringsNoDep[] = {
+ "anchor", "bbox", "columnconfigure", "configure",
+ "content", "forget", "info", "location", "propagate",
+ "remove", "rowconfigure", "size", NULL
};
enum options {
GRID_ANCHOR, GRID_BBOX, GRID_COLUMNCONFIGURE, GRID_CONFIGURE,
- GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE, GRID_REMOVE,
- GRID_ROWCONFIGURE, GRID_SIZE, GRID_SLAVES
+ GRID_CONTENT, GRID_FORGET, GRID_INFO, GRID_LOCATION, GRID_PROPAGATE,
+ GRID_REMOVE, GRID_ROWCONFIGURE, GRID_SIZE, GRID_SLAVES
};
int index;
@@ -353,7 +358,7 @@ Tk_GridObjCmd(
if ((argv1[0] == '.') || (argv1[0] == REL_SKIP) ||
(argv1[0] == REL_VERT)) {
- return ConfigureSlaves(interp, tkwin, objc-1, objv+1);
+ return ConfigureContent(interp, tkwin, objc-1, objv+1);
}
}
if (objc < 3) {
@@ -361,8 +366,16 @@ Tk_GridObjCmd(
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
+ if (Tcl_GetIndexFromObjStruct(NULL, objv[1], optionStrings,
sizeof(char *), "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
+ * deprecated and new options.
+ */
+
+ Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep,
+ sizeof(char *), "option", 0, &index);
return TCL_ERROR;
}
@@ -372,7 +385,7 @@ Tk_GridObjCmd(
case GRID_BBOX:
return GridBboxCommand(tkwin, interp, objc, objv);
case GRID_CONFIGURE:
- return ConfigureSlaves(interp, tkwin, objc-2, objv+2);
+ return ConfigureContent(interp, tkwin, objc-2, objv+2);
case GRID_FORGET:
case GRID_REMOVE:
return GridForgetRemoveCommand(tkwin, interp, objc, objv);
@@ -385,15 +398,16 @@ Tk_GridObjCmd(
case GRID_SIZE:
return GridSizeCommand(tkwin, interp, objc, objv);
case GRID_SLAVES:
- return GridSlavesCommand(tkwin, interp, objc, objv);
+ case GRID_CONTENT:
+ return GridContentCommand(tkwin, interp, objc, objv);
/*
* Sample argument combinations:
- * grid columnconfigure <master> <index> -option
- * grid columnconfigure <master> <index> -option value -option value
- * grid rowconfigure <master> <index>
- * grid rowconfigure <master> <index> -option
- * grid rowconfigure <master> <index> -option value -option value.
+ * grid columnconfigure <container> <index> -option
+ * grid columnconfigure <container> <index> -option value -option value
+ * grid rowconfigure <container> <index>
+ * grid rowconfigure <container> <index> -option
+ * grid rowconfigure <container> <index> -option value -option value.
*/
case GRID_COLUMNCONFIGURE:
@@ -431,9 +445,9 @@ GridAnchorCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr;
- GridMaster *gridPtr;
+ Tk_Window container;
+ Gridder *containerPtr;
+ GridContainer *gridPtr;
Tk_Anchor old;
if (objc > 4) {
@@ -441,21 +455,21 @@ GridAnchorCommand(
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
if (objc == 3) {
- gridPtr = masterPtr->masterDataPtr;
+ gridPtr = containerPtr->containerDataPtr;
Tcl_SetObjResult(interp, Tcl_NewStringObj(
Tk_NameOfAnchor(gridPtr?gridPtr->anchor:GRID_DEFAULT_ANCHOR),
-1));
return TCL_OK;
}
- InitMasterData(masterPtr);
- gridPtr = masterPtr->masterDataPtr;
+ InitContainerData(containerPtr);
+ gridPtr = containerPtr->containerDataPtr;
old = gridPtr->anchor;
if (Tk_GetAnchorFromObj(interp, objv[3], &gridPtr->anchor) != TCL_OK) {
return TCL_ERROR;
@@ -466,12 +480,12 @@ GridAnchorCommand(
*/
if (old != gridPtr->anchor) {
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_RELAYOUT)) {
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
}
return TCL_OK;
@@ -500,9 +514,9 @@ GridBboxCommand(
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 */
+ Tk_Window container;
+ Gridder *containerPtr; /* container grid record */
+ GridContainer *gridPtr; /* pointer to grid data */
int row, column; /* origin for bounding box */
int row2, column2; /* end of bounding box */
int endX, endY; /* last column/row in the layout */
@@ -510,14 +524,14 @@ GridBboxCommand(
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??");
+ Tcl_WrongNumArgs(interp, 2, objv, "window ?column row ?column row??");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
if (objc >= 5) {
if (Tcl_GetIntFromObj(interp, objv[3], &column) != TCL_OK) {
@@ -539,13 +553,13 @@ GridBboxCommand(
}
}
- gridPtr = masterPtr->masterDataPtr;
+ gridPtr = containerPtr->containerDataPtr;
if (gridPtr == NULL) {
Tcl_SetObjResult(interp, NewQuadObj(0, 0, 0, 0));
return TCL_OK;
}
- SetGridSize(masterPtr);
+ SetGridSize(containerPtr);
endX = MAX(gridPtr->columnEnd, gridPtr->columnMax);
endY = MAX(gridPtr->rowEnd, gridPtr->rowMax);
@@ -630,67 +644,67 @@ GridForgetRemoveCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window slave;
- Gridder *slavePtr;
+ Tk_Window content;
+ Gridder *contentPtr;
int i;
const 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) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) {
return TCL_ERROR;
}
- slavePtr = GetGrid(slave);
- if (slavePtr->masterPtr != NULL) {
+ contentPtr = GetGrid(content);
+ if (contentPtr->containerPtr != NULL) {
/*
* For "forget", reset all the settings to their defaults
*/
if (c == 'f') {
- slavePtr->column = -1;
- slavePtr->row = -1;
- slavePtr->numCols = 1;
- slavePtr->numRows = 1;
- 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;
+ contentPtr->column = -1;
+ contentPtr->row = -1;
+ contentPtr->numCols = 1;
+ contentPtr->numRows = 1;
+ contentPtr->padX = 0;
+ contentPtr->padY = 0;
+ contentPtr->padLeft = 0;
+ contentPtr->padTop = 0;
+ contentPtr->iPadX = 0;
+ contentPtr->iPadY = 0;
+ if (contentPtr->in != NULL) {
+ Tcl_DecrRefCount(contentPtr->in);
+ contentPtr->in = NULL;
}
- slavePtr->doubleBw = 2*Tk_Changes(tkwin)->border_width;
- if (slavePtr->flags & REQUESTED_RELAYOUT) {
- Tcl_CancelIdleCall(ArrangeGrid, slavePtr);
+ contentPtr->doubleBw = 2*Tk_Changes(tkwin)->border_width;
+ if (contentPtr->flags & REQUESTED_RELAYOUT) {
+ Tcl_CancelIdleCall(ArrangeGrid, contentPtr);
}
- slavePtr->flags = 0;
- slavePtr->sticky = 0;
+ contentPtr->flags = 0;
+ contentPtr->sticky = 0;
} else {
/*
- * When removing, store name of master to be able to
- * restore it later, even if the master is recreated.
+ * When removing, store name of container to be able to
+ * restore it later, even if the container is recreated.
*/
- if (slavePtr->in != NULL) {
- Tcl_DecrRefCount(slavePtr->in);
- slavePtr->in = NULL;
+ if (contentPtr->in != NULL) {
+ Tcl_DecrRefCount(contentPtr->in);
+ contentPtr->in = NULL;
}
- if (slavePtr->masterPtr != NULL) {
- slavePtr->in = Tcl_NewStringObj(
- Tk_PathName(slavePtr->masterPtr->tkwin), -1);
- Tcl_IncrRefCount(slavePtr->in);
+ if (contentPtr->containerPtr != NULL) {
+ contentPtr->in = Tcl_NewStringObj(
+ Tk_PathName(contentPtr->containerPtr->tkwin), -1);
+ Tcl_IncrRefCount(contentPtr->in);
}
}
- Tk_ManageGeometry(slave, NULL, NULL);
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin,
- slavePtr->masterPtr->tkwin);
+ Tk_ManageGeometry(content, NULL, NULL);
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin,
+ contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Unlink(contentPtr);
+ Tk_UnmapWindow(contentPtr->tkwin);
}
}
return TCL_OK;
@@ -720,40 +734,40 @@ GridInfoCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Gridder *slavePtr;
- Tk_Window slave;
+ Gridder *contentPtr;
+ Tk_Window content;
Tcl_Obj *infoObj;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &content) != TCL_OK) {
return TCL_ERROR;
}
- slavePtr = GetGrid(slave);
- if (slavePtr->masterPtr == NULL) {
+ contentPtr = GetGrid(content);
+ if (contentPtr->containerPtr == NULL) {
Tcl_ResetResult(interp);
return TCL_OK;
}
infoObj = Tcl_NewObj();
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1),
- TkNewWindowObj(slavePtr->masterPtr->tkwin));
+ Tk_NewWindowObj(contentPtr->containerPtr->tkwin));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", -1),
- Tcl_NewWideIntObj(slavePtr->column));
+ Tcl_NewWideIntObj(contentPtr->column));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", -1),
- Tcl_NewWideIntObj(slavePtr->row));
+ Tcl_NewWideIntObj(contentPtr->row));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-columnspan", -1),
- Tcl_NewWideIntObj(slavePtr->numCols));
+ Tcl_NewWideIntObj(contentPtr->numCols));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-rowspan", -1),
- Tcl_NewWideIntObj(slavePtr->numRows));
- TkAppendPadAmount(infoObj, "-ipadx", slavePtr->iPadX/2, slavePtr->iPadX);
- TkAppendPadAmount(infoObj, "-ipady", slavePtr->iPadY/2, slavePtr->iPadY);
- TkAppendPadAmount(infoObj, "-padx", slavePtr->padLeft, slavePtr->padX);
- TkAppendPadAmount(infoObj, "-pady", slavePtr->padTop, slavePtr->padY);
+ Tcl_NewWideIntObj(contentPtr->numRows));
+ TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX);
+ TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY);
+ TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft, contentPtr->padX);
+ TkAppendPadAmount(infoObj, "-pady", contentPtr->padTop, contentPtr->padY);
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-sticky", -1),
- StickyToObj(slavePtr->sticky));
+ StickyToObj(contentPtr->sticky));
Tcl_SetObjResult(interp, infoObj);
return TCL_OK;
}
@@ -782,36 +796,36 @@ GridLocationCommand(
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. */
+ Tk_Window container;
+ Gridder *containerPtr; /* Container grid record. */
+ GridContainer *gridPtr; /* Pointer to grid data. */
SlotInfo *slotPtr;
- int x, y; /* Offset in pixels, from edge of master. */
+ int x, y; /* Offset in pixels, from edge of container. */
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");
+ Tcl_WrongNumArgs(interp, 2, objv, "window x y");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- if (Tk_GetPixelsFromObj(interp, master, objv[3], &x) != TCL_OK) {
+ if (Tk_GetPixelsFromObj(interp, container, objv[3], &x) != TCL_OK) {
return TCL_ERROR;
}
- if (Tk_GetPixelsFromObj(interp, master, objv[4], &y) != TCL_OK) {
+ if (Tk_GetPixelsFromObj(interp, container, objv[4], &y) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
- if (masterPtr->masterDataPtr == NULL) {
+ containerPtr = GetGrid(container);
+ if (containerPtr->containerDataPtr == NULL) {
Tcl_SetObjResult(interp, NewPairObj(-1, -1));
return TCL_OK;
}
- gridPtr = masterPtr->masterDataPtr;
+ gridPtr = containerPtr->containerDataPtr;
/*
* Update any pending requests. This is not always the steady state value,
@@ -819,29 +833,29 @@ GridLocationCommand(
* its easy to get.
*/
- while (masterPtr->flags & REQUESTED_RELAYOUT) {
- Tcl_CancelIdleCall(ArrangeGrid, masterPtr);
- ArrangeGrid(masterPtr);
+ while (containerPtr->flags & REQUESTED_RELAYOUT) {
+ Tcl_CancelIdleCall(ArrangeGrid, containerPtr);
+ ArrangeGrid(containerPtr);
}
- SetGridSize(masterPtr);
+ SetGridSize(containerPtr);
endX = MAX(gridPtr->columnEnd, gridPtr->columnMax);
endY = MAX(gridPtr->rowEnd, gridPtr->rowMax);
- slotPtr = masterPtr->masterDataPtr->columnPtr;
- if (x < masterPtr->masterDataPtr->startX) {
+ slotPtr = containerPtr->containerDataPtr->columnPtr;
+ if (x < containerPtr->containerDataPtr->startX) {
i = -1;
} else {
- x -= masterPtr->masterDataPtr->startX;
+ x -= containerPtr->containerDataPtr->startX;
for (i = 0; slotPtr[i].offset < x && i < endX; i++) {
/* null body */
}
}
- slotPtr = masterPtr->masterDataPtr->rowPtr;
- if (y < masterPtr->masterDataPtr->startY) {
+ slotPtr = containerPtr->containerDataPtr->rowPtr;
+ if (y < containerPtr->containerDataPtr->startY) {
j = -1;
} else {
- y -= masterPtr->masterDataPtr->startY;
+ y -= containerPtr->containerDataPtr->startY;
for (j = 0; slotPtr[j].offset < y && j < endY; j++) {
/* null body */
}
@@ -875,8 +889,8 @@ GridPropagateCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr;
+ Tk_Window container;
+ Gridder *containerPtr;
int propagate, old;
if (objc > 4) {
@@ -884,13 +898,13 @@ GridPropagateCommand(
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
if (objc == 3) {
Tcl_SetObjResult(interp,
- Tcl_NewBooleanObj(!(masterPtr->flags & DONT_PROPAGATE)));
+ Tcl_NewBooleanObj(!(containerPtr->flags & DONT_PROPAGATE)));
return TCL_OK;
}
if (Tcl_GetBooleanFromObj(interp, objv[3], &propagate) != TCL_OK) {
@@ -901,39 +915,39 @@ GridPropagateCommand(
* Only request a relayout if the propagation bit changes.
*/
- old = !(masterPtr->flags & DONT_PROPAGATE);
+ old = !(containerPtr->flags & DONT_PROPAGATE);
if (propagate != old) {
if (propagate) {
/*
- * If we have slaves, we need to register as geometry master.
+ * If we have content, we need to register as geometry container.
*/
- if (masterPtr->slavePtr != NULL) {
- if (TkSetGeometryMaster(interp, master, "grid") != TCL_OK) {
+ if (containerPtr->contentPtr != NULL) {
+ if (TkSetGeometryContainer(interp, container, "grid") != TCL_OK) {
return TCL_ERROR;
}
- masterPtr->flags |= ALLOCED_MASTER;
+ containerPtr->flags |= ALLOCED_CONTAINER;
}
- masterPtr->flags &= ~DONT_PROPAGATE;
+ containerPtr->flags &= ~DONT_PROPAGATE;
} else {
- if (masterPtr->flags & ALLOCED_MASTER) {
- TkFreeGeometryMaster(master, "grid");
- masterPtr->flags &= ~ALLOCED_MASTER;
+ if (containerPtr->flags & ALLOCED_CONTAINER) {
+ TkFreeGeometryContainer(container, "grid");
+ containerPtr->flags &= ~ALLOCED_CONTAINER;
}
- masterPtr->flags |= DONT_PROPAGATE;
+ containerPtr->flags |= DONT_PROPAGATE;
}
/*
- * Re-arrange the master to allow new geometry information to
- * propagate upwards to the master's master.
+ * Re-arrange the container to allow new geometry information to
+ * propagate upwards to the container's container.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_RELAYOUT)) {
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
}
return TCL_OK;
@@ -963,8 +977,8 @@ GridRowColumnConfigureCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master, slave;
- Gridder *masterPtr, *slavePtr;
+ Tk_Window container, content;
+ Gridder *containerPtr, *contentPtr;
SlotInfo *slotPtr = NULL;
int slot; /* the column or row number */
int slotType; /* COLUMN or ROW */
@@ -984,11 +998,11 @@ GridRowColumnConfigureCommand(
Tcl_Obj *listCopy;
if (((objc % 2 != 0) && (objc > 6)) || (objc < 4)) {
- Tcl_WrongNumArgs(interp, 2, objv, "master index ?-option value ...?");
+ Tcl_WrongNumArgs(interp, 2, objv, "window index ?-option value ...?");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
@@ -1009,7 +1023,7 @@ GridRowColumnConfigureCommand(
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
first = 0;
last = 0;
@@ -1029,11 +1043,11 @@ GridRowColumnConfigureCommand(
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
}
- ok = CheckSlotData(masterPtr, slot, slotType, /* checkOnly */ 1);
+ ok = CheckSlotData(containerPtr, slot, slotType, /* checkOnly */ 1);
if (ok == TCL_OK) {
slotPtr = (slotType == COLUMN) ?
- masterPtr->masterDataPtr->columnPtr :
- masterPtr->masterDataPtr->rowPtr;
+ containerPtr->containerDataPtr->columnPtr :
+ containerPtr->containerDataPtr->rowPtr;
}
/*
@@ -1101,36 +1115,36 @@ GridRowColumnConfigureCommand(
}
for (j = 0; j < lObjc; j++) {
- int allSlaves = 0;
+ int allContent = 0;
if (Tcl_GetIntFromObj(NULL, lObjv[j], &slot) == TCL_OK) {
first = slot;
last = slot;
- slavePtr = NULL;
+ contentPtr = NULL;
} else if (strcmp(Tcl_GetString(lObjv[j]), "all") == 0) {
/*
- * Make sure master is initialised.
+ * Make sure container is initialised.
*/
- InitMasterData(masterPtr);
+ InitContainerData(containerPtr);
- slavePtr = masterPtr->slavePtr;
- if (slavePtr == NULL) {
+ contentPtr = containerPtr->contentPtr;
+ if (contentPtr == NULL) {
continue;
}
- allSlaves = 1;
- } else if (TkGetWindowFromObj(NULL, tkwin, lObjv[j], &slave)
+ allContent = 1;
+ } else if (TkGetWindowFromObj(NULL, tkwin, lObjv[j], &content)
== TCL_OK) {
/*
- * Is it gridded in this master?
+ * Is it gridded in this container?
*/
- slavePtr = GetGrid(slave);
- if (slavePtr->masterPtr != masterPtr) {
+ contentPtr = GetGrid(content);
+ if (contentPtr->containerPtr != containerPtr) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"the window \"%s\" is not managed by \"%s\"",
Tcl_GetString(lObjv[j]), Tcl_GetString(objv[2])));
- Tcl_SetErrorCode(interp, "TK", "GRID", "NOT_MASTER", NULL);
+ Tcl_SetErrorCode(interp, "TK", "GRID", "NOT_MANAGED", NULL);
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
}
@@ -1147,15 +1161,15 @@ GridRowColumnConfigureCommand(
*/
do {
- if (slavePtr != NULL) {
+ if (contentPtr != NULL) {
first = (slotType == COLUMN) ?
- slavePtr->column : slavePtr->row;
+ contentPtr->column : contentPtr->row;
last = first - 1 + ((slotType == COLUMN) ?
- slavePtr->numCols : slavePtr->numRows);
+ contentPtr->numCols : contentPtr->numRows);
}
for (slot = first; slot <= last; slot++) {
- ok = CheckSlotData(masterPtr, slot, slotType, /*checkOnly*/ 0);
+ ok = CheckSlotData(containerPtr, slot, slotType, /*checkOnly*/ 0);
if (ok != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"\"%s\" is out of range",
@@ -1166,8 +1180,8 @@ GridRowColumnConfigureCommand(
return TCL_ERROR;
}
slotPtr = (slotType == COLUMN) ?
- masterPtr->masterDataPtr->columnPtr :
- masterPtr->masterDataPtr->rowPtr;
+ containerPtr->containerDataPtr->columnPtr :
+ containerPtr->containerDataPtr->rowPtr;
/*
* Loop through each option value pair, setting the values as
@@ -1181,7 +1195,7 @@ GridRowColumnConfigureCommand(
return TCL_ERROR;
}
if (index == ROWCOL_MINSIZE) {
- if (Tk_GetPixelsFromObj(interp, master, objv[i+1],
+ if (Tk_GetPixelsFromObj(interp, container, objv[i+1],
&size) != TCL_OK) {
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
@@ -1208,7 +1222,7 @@ GridRowColumnConfigureCommand(
slotPtr[slot].uniform = NULL;
}
} else if (index == ROWCOL_PAD) {
- if (Tk_GetPixelsFromObj(interp, master, objv[i+1],
+ if (Tk_GetPixelsFromObj(interp, container, objv[i+1],
&size) != TCL_OK) {
Tcl_DecrRefCount(listCopy);
return TCL_ERROR;
@@ -1221,10 +1235,10 @@ GridRowColumnConfigureCommand(
}
}
}
- if (slavePtr != NULL) {
- slavePtr = slavePtr->nextPtr;
+ if (contentPtr != NULL) {
+ contentPtr = contentPtr->nextPtr;
}
- } while ((allSlaves == 1) && (slavePtr != NULL));
+ } while ((allContent == 1) && (contentPtr != NULL));
}
Tcl_DecrRefCount(listCopy);
@@ -1235,32 +1249,32 @@ GridRowColumnConfigureCommand(
if (slotPtr != NULL) {
if (slotType == ROW) {
- int last = masterPtr->masterDataPtr->rowMax - 1;
+ last = containerPtr->containerDataPtr->rowMax - 1;
while ((last >= 0) && (slotPtr[last].weight == 0)
&& (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0)
&& (slotPtr[last].uniform == NULL)) {
last--;
}
- masterPtr->masterDataPtr->rowMax = last+1;
+ containerPtr->containerDataPtr->rowMax = last+1;
} else {
- int last = masterPtr->masterDataPtr->columnMax - 1;
+ last = containerPtr->containerDataPtr->columnMax - 1;
while ((last >= 0) && (slotPtr[last].weight == 0)
&& (slotPtr[last].pad == 0) && (slotPtr[last].minSize == 0)
&& (slotPtr[last].uniform == NULL)) {
last--;
}
- masterPtr->masterDataPtr->columnMax = last + 1;
+ containerPtr->containerDataPtr->columnMax = last + 1;
}
}
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_RELAYOUT)) {
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
return TCL_OK;
@@ -1296,23 +1310,23 @@ GridSizeCommand(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window master;
- Gridder *masterPtr;
- GridMaster *gridPtr; /* pointer to grid data */
+ Tk_Window container;
+ Gridder *containerPtr;
+ GridContainer *gridPtr; /* pointer to grid data */
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
- if (masterPtr->masterDataPtr != NULL) {
- SetGridSize(masterPtr);
- gridPtr = masterPtr->masterDataPtr;
+ if (containerPtr->containerDataPtr != NULL) {
+ SetGridSize(containerPtr);
+ gridPtr = containerPtr->containerDataPtr;
Tcl_SetObjResult(interp, NewPairObj(
MAX(gridPtr->columnEnd, gridPtr->columnMax),
MAX(gridPtr->rowEnd, gridPtr->rowMax)));
@@ -1325,37 +1339,37 @@ GridSizeCommand(
/*
*----------------------------------------------------------------------
*
- * GridSlavesCommand --
+ * GridContentCommand --
*
- * Implementation of the [grid slaves] subcommand. See the user
+ * Implementation of the [grid content] 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 content windows of the specified window in the
+ * interpreter's result field.
*
*----------------------------------------------------------------------
*/
static int
-GridSlavesCommand(
+GridContentCommand(
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;
+ Tk_Window container;
+ Gridder *containerPtr; /* container grid record */
+ Gridder *contentPtr;
int i, value, index;
int row = -1, column = -1;
static const char *const optionStrings[] = {
"-column", "-row", NULL
};
- enum options { SLAVES_COLUMN, SLAVES_ROW };
+ enum options { CONTENT_COLUMN, CONTENT_ROW };
Tcl_Obj *res;
if ((objc < 3) || ((objc % 2) == 0)) {
@@ -1377,30 +1391,30 @@ GridSlavesCommand(
Tcl_SetErrorCode(interp, "TK", "GRID", "NEG_INDEX", NULL);
return TCL_ERROR;
}
- if (index == SLAVES_COLUMN) {
+ if (index == CONTENT_COLUMN) {
column = value;
} else {
row = value;
}
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(master);
+ containerPtr = GetGrid(container);
res = Tcl_NewListObj(0, NULL);
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- if ((column >= 0) && (slavePtr->column > column
- || slavePtr->column+slavePtr->numCols-1 < column)) {
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ if ((column >= 0) && (contentPtr->column > column
+ || contentPtr->column+contentPtr->numCols-1 < column)) {
continue;
}
- if ((row >= 0) && (slavePtr->row > row ||
- slavePtr->row+slavePtr->numRows-1 < row)) {
+ if ((row >= 0) && (contentPtr->row > row ||
+ contentPtr->row+contentPtr->numRows-1 < row)) {
continue;
}
- Tcl_ListObjAppendElement(interp,res, TkNewWindowObj(slavePtr->tkwin));
+ Tcl_ListObjAppendElement(interp,res, Tk_NewWindowObj(contentPtr->tkwin));
}
Tcl_SetObjResult(interp, res);
return TCL_OK;
@@ -1428,13 +1442,12 @@ static void
GridReqProc(
ClientData clientData, /* Grid's information about window that got
* new preferred geometry. */
- Tk_Window tkwin) /* Other Tk-related information about the
+ TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the
* window. */
{
Gridder *gridPtr = (Gridder *)clientData;
- (void)tkwin;
- gridPtr = gridPtr->masterPtr;
+ gridPtr = gridPtr->containerPtr;
if (gridPtr && !(gridPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->flags |= REQUESTED_RELAYOUT;
Tcl_DoWhenIdle(ArrangeGrid, gridPtr);
@@ -1444,34 +1457,33 @@ GridReqProc(
/*
*----------------------------------------------------------------------
*
- * GridLostSlaveProc --
+ * GridLostContentProc --
*
* This procedure is invoked by Tk whenever some other geometry claims
- * control over a slave that used to be managed by us.
+ * control over a content that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all grid-related information about the slave.
+ * Forgets all grid-related information about the content.
*
*----------------------------------------------------------------------
*/
static void
-GridLostSlaveProc(
- ClientData clientData, /* Grid structure for slave window that was
+GridLostContentProc(
+ ClientData clientData, /* Grid structure for content window that was
* stolen away. */
- Tk_Window tkwin) /* Tk's handle for the slave window. */
+ TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */
{
- Gridder *slavePtr = (Gridder *)clientData;
- (void)tkwin;
+ Gridder *contentPtr = (Gridder *)clientData;
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Unlink(contentPtr);
+ Tk_UnmapWindow(contentPtr->tkwin);
}
/*
@@ -1645,12 +1657,12 @@ AdjustOffsets(
*
* AdjustForSticky --
*
- * This procedure adjusts the size of a slave in its cavity based on its
+ * This procedure adjusts the size of a content 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.
+ * coordinates of the content.
*
* Side effects:
* None.
@@ -1660,29 +1672,29 @@ AdjustOffsets(
static void
AdjustForSticky(
- Gridder *slavePtr, /* Slave window to arrange in its cavity. */
+ Gridder *contentPtr, /* Content 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 sticky = slavePtr->sticky;
+ int diffx = 0; /* Cavity width - content width. */
+ int diffy = 0; /* Cavity hight - content height. */
+ int sticky = contentPtr->sticky;
- *xPtr += slavePtr->padLeft;
- *widthPtr -= slavePtr->padX;
- *yPtr += slavePtr->padTop;
- *heightPtr -= slavePtr->padY;
+ *xPtr += contentPtr->padLeft;
+ *widthPtr -= contentPtr->padX;
+ *yPtr += contentPtr->padTop;
+ *heightPtr -= contentPtr->padY;
- if (*widthPtr > (Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX)) {
- diffx = *widthPtr - (Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX);
- *widthPtr = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->iPadX;
+ if (*widthPtr > (Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX)) {
+ diffx = *widthPtr - (Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX);
+ *widthPtr = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->iPadX;
}
- if (*heightPtr > (Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY)) {
- diffy = *heightPtr - (Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY);
- *heightPtr = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->iPadY;
+ if (*heightPtr > (Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY)) {
+ diffy = *heightPtr - (Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY);
+ *heightPtr = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->iPadY;
}
if (sticky&STICK_EAST && sticky&STICK_WEST) {
@@ -1713,37 +1725,37 @@ AdjustForSticky(
* None.
*
* Side effects:
- * The slaves of masterPtr may get resized or moved.
+ * The content of containerPtr may get resized or moved.
*
*----------------------------------------------------------------------
*/
static void
ArrangeGrid(
- ClientData clientData) /* Structure describing master whose slaves
+ ClientData clientData) /* Structure describing container whose content
* are to be re-layed out. */
{
- Gridder *masterPtr = (Gridder *)clientData;
- Gridder *slavePtr;
- GridMaster *slotPtr = masterPtr->masterDataPtr;
+ Gridder *containerPtr = (Gridder *)clientData;
+ Gridder *contentPtr;
+ GridContainer *slotPtr = containerPtr->containerDataPtr;
int abort;
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;
+ containerPtr->flags &= ~REQUESTED_RELAYOUT;
/*
- * If the master has no slaves anymore, then don't change the master size.
- * Otherwise there is no way to "relinquish" control over the master
+ * If the container has no content anymore, then don't change the container size.
+ * Otherwise there is no way to "relinquish" control over the container
* so another geometry manager can take over.
*/
- if (masterPtr->slavePtr == NULL) {
+ if (containerPtr->contentPtr == NULL) {
return;
}
- if (masterPtr->masterDataPtr == NULL) {
+ if (containerPtr->containerDataPtr == NULL) {
return;
}
@@ -1753,128 +1765,127 @@ ArrangeGrid(
* necessary.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- masterPtr->abortPtr = &abort;
+ containerPtr->abortPtr = &abort;
abort = 0;
- Tcl_Preserve(masterPtr);
+ Tcl_Preserve(containerPtr);
/*
* Call the constraint engine to fill in the row and column offsets.
*/
- SetGridSize(masterPtr);
- 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);
+ SetGridSize(containerPtr);
+ width = ResolveConstraints(containerPtr, COLUMN, 0);
+ height = ResolveConstraints(containerPtr, ROW, 0);
+ width += Tk_InternalBorderLeft(containerPtr->tkwin) +
+ Tk_InternalBorderRight(containerPtr->tkwin);
+ height += Tk_InternalBorderTop(containerPtr->tkwin) +
+ Tk_InternalBorderBottom(containerPtr->tkwin);
- if (width < Tk_MinReqWidth(masterPtr->tkwin)) {
- width = Tk_MinReqWidth(masterPtr->tkwin);
+ if (width < Tk_MinReqWidth(containerPtr->tkwin)) {
+ width = Tk_MinReqWidth(containerPtr->tkwin);
}
- if (height < Tk_MinReqHeight(masterPtr->tkwin)) {
- height = Tk_MinReqHeight(masterPtr->tkwin);
+ if (height < Tk_MinReqHeight(containerPtr->tkwin)) {
+ height = Tk_MinReqHeight(containerPtr->tkwin);
}
- if (((width != Tk_ReqWidth(masterPtr->tkwin))
- || (height != Tk_ReqHeight(masterPtr->tkwin)))
- && !(masterPtr->flags & DONT_PROPAGATE)) {
- Tk_GeometryRequest(masterPtr->tkwin, width, height);
+ if (((width != Tk_ReqWidth(containerPtr->tkwin))
+ || (height != Tk_ReqHeight(containerPtr->tkwin)))
+ && !(containerPtr->flags & DONT_PROPAGATE)) {
+ Tk_GeometryRequest(containerPtr->tkwin, width, height);
if (width>1 && height>1) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
- masterPtr->abortPtr = NULL;
- Tcl_Release(masterPtr);
+ containerPtr->abortPtr = NULL;
+ Tcl_Release(containerPtr);
return;
}
/*
- * If the currently requested layout size doesn't match the master's
+ * If the currently requested layout size doesn't match the container'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) -
- Tk_InternalBorderLeft(masterPtr->tkwin) -
- Tk_InternalBorderRight(masterPtr->tkwin);
- realHeight = Tk_Height(masterPtr->tkwin) -
- Tk_InternalBorderTop(masterPtr->tkwin) -
- Tk_InternalBorderBottom(masterPtr->tkwin);
+ realWidth = Tk_Width(containerPtr->tkwin) -
+ Tk_InternalBorderLeft(containerPtr->tkwin) -
+ Tk_InternalBorderRight(containerPtr->tkwin);
+ realHeight = Tk_Height(containerPtr->tkwin) -
+ Tk_InternalBorderTop(containerPtr->tkwin) -
+ Tk_InternalBorderBottom(containerPtr->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,
+ TkComputeAnchor(containerPtr->containerDataPtr->anchor, containerPtr->tkwin,
0, 0, usedX, usedY, &slotPtr->startX, &slotPtr->startY);
/*
- * Now adjust the actual size of the slave to its cavity by computing the
+ * Now adjust the actual size of the content 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) {
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL && !abort;
+ contentPtr = contentPtr->nextPtr) {
int x, y; /* Top left coordinate */
- int width, height; /* Slot or slave size */
- int col = slavePtr->column;
- int row = slavePtr->row;
+ int col = contentPtr->column;
+ int row = contentPtr->row;
x = (col>0) ? slotPtr->columnPtr[col-1].offset : 0;
y = (row>0) ? slotPtr->rowPtr[row-1].offset : 0;
- width = slotPtr->columnPtr[slavePtr->numCols+col-1].offset - x;
- height = slotPtr->rowPtr[slavePtr->numRows+row-1].offset - y;
+ width = slotPtr->columnPtr[contentPtr->numCols+col-1].offset - x;
+ height = slotPtr->rowPtr[contentPtr->numRows+row-1].offset - y;
x += slotPtr->startX;
y += slotPtr->startY;
- AdjustForSticky(slavePtr, &x, &y, &width, &height);
+ AdjustForSticky(contentPtr, &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
+ * from tkPack.c.) If the content is a child of the container, then do this
* here. Otherwise let Tk_MaintainGeometry do the work.
*/
- if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) {
+ if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) {
if ((width <= 0) || (height <= 0)) {
- Tk_UnmapWindow(slavePtr->tkwin);
+ Tk_UnmapWindow(contentPtr->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 ((x != Tk_X(contentPtr->tkwin))
+ || (y != Tk_Y(contentPtr->tkwin))
+ || (width != Tk_Width(contentPtr->tkwin))
+ || (height != Tk_Height(contentPtr->tkwin))) {
+ Tk_MoveResizeWindow(contentPtr->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.
+ * Don't map the content if the container isn't mapped: wait until
+ * the container gets mapped later.
*/
- if (Tk_IsMapped(masterPtr->tkwin)) {
- Tk_MapWindow(slavePtr->tkwin);
+ if (Tk_IsMapped(containerPtr->tkwin)) {
+ Tk_MapWindow(contentPtr->tkwin);
}
}
} else if ((width <= 0) || (height <= 0)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin);
+ Tk_UnmapWindow(contentPtr->tkwin);
} else {
- Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin, x, y,
+ Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin, x, y,
width, height);
}
}
- masterPtr->abortPtr = NULL;
- Tcl_Release(masterPtr);
+ containerPtr->abortPtr = NULL;
+ Tcl_Release(containerPtr);
}
/*
@@ -1892,20 +1903,20 @@ ArrangeGrid(
*
* Side effects:
* The slot offsets are copied into the SlotInfo structure for the
- * geometry master.
+ * geometry container.
*
*----------------------------------------------------------------------
*/
static int
ResolveConstraints(
- Gridder *masterPtr, /* The geometry master for this grid. */
+ Gridder *containerPtr, /* The geometry container 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). */
{
SlotInfo *slotPtr; /* Pointer to row/col constraints. */
- Gridder *slavePtr; /* List of slave windows in this grid. */
+ Gridder *contentPtr; /* List of content windows in this grid. */
int constraintCount; /* Count of rows or columns that have
* constraints. */
int slotCount; /* Last occupied row or column. */
@@ -1914,7 +1925,7 @@ ResolveConstraints(
GridLayout *layoutPtr; /* Temporary layout structure. */
int requiredSize; /* The natural size of the grid (pixels).
* This is the minimum size needed to
- * accommodate all of the slaves at their
+ * accommodate all of the content at their
* requested sizes. */
int offset; /* The pixel offset of the right edge of the
* current slot from the beginning of the
@@ -1931,7 +1942,7 @@ ResolveConstraints(
int uniformGroups; /* Number of currently used uniform groups. */
int uniformGroupsAlloced; /* Size of allocated space for uniform
* groups. */
- int weight, minSize;
+ int minSize;
int prevGrow, accWeight, grow;
/*
@@ -1942,13 +1953,13 @@ ResolveConstraints(
GridLayout layoutData[TYPICAL_SIZE + 1];
if (slotType == COLUMN) {
- constraintCount = masterPtr->masterDataPtr->columnMax;
- slotCount = masterPtr->masterDataPtr->columnEnd;
- slotPtr = masterPtr->masterDataPtr->columnPtr;
+ constraintCount = containerPtr->containerDataPtr->columnMax;
+ slotCount = containerPtr->containerDataPtr->columnEnd;
+ slotPtr = containerPtr->containerDataPtr->columnPtr;
} else {
- constraintCount = masterPtr->masterDataPtr->rowMax;
- slotCount = masterPtr->masterDataPtr->rowEnd;
- slotPtr = masterPtr->masterDataPtr->rowPtr;
+ constraintCount = containerPtr->containerDataPtr->rowMax;
+ slotCount = containerPtr->containerDataPtr->rowEnd;
+ slotPtr = containerPtr->containerDataPtr->rowPtr;
}
/*
@@ -1998,29 +2009,29 @@ ResolveConstraints(
/*
* 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
+ * Content with a span of 1 are used to determine the minimum size of each
+ * slot. Content 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
+ * Bin all content 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.
+ * slot boundary, without the need to re-sort the content.
*/
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;
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ int rightEdge = contentPtr->column + contentPtr->numCols - 1;
+
+ contentPtr->size = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->padX
+ + contentPtr->iPadX + contentPtr->doubleBw;
+ if (contentPtr->numCols > 1) {
+ contentPtr->binNextPtr = layoutPtr[rightEdge].binNextPtr;
+ layoutPtr[rightEdge].binNextPtr = contentPtr;
} else if (rightEdge >= 0) {
- int size = slavePtr->size + layoutPtr[rightEdge].pad;
+ int size = contentPtr->size + layoutPtr[rightEdge].pad;
if (size > layoutPtr[rightEdge].minSize) {
layoutPtr[rightEdge].minSize = size;
@@ -2029,17 +2040,17 @@ ResolveConstraints(
}
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;
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ int rightEdge = contentPtr->row + contentPtr->numRows - 1;
+
+ contentPtr->size = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->padY
+ + contentPtr->iPadY + contentPtr->doubleBw;
+ if (contentPtr->numRows > 1) {
+ contentPtr->binNextPtr = layoutPtr[rightEdge].binNextPtr;
+ layoutPtr[rightEdge].binNextPtr = contentPtr;
} else if (rightEdge >= 0) {
- int size = slavePtr->size + layoutPtr[rightEdge].pad;
+ int size = contentPtr->size + layoutPtr[rightEdge].pad;
if (size > layoutPtr[rightEdge].minSize) {
layoutPtr[rightEdge].minSize = size;
@@ -2060,6 +2071,7 @@ ResolveConstraints(
for (slot = 0; slot < gridCount; slot++) {
if (layoutPtr[slot].uniform != NULL) {
+ int weight;
for (start = 0; start < uniformGroups; start++) {
if (uniformGroupPtr[start].group == layoutPtr[slot].uniform) {
break;
@@ -2112,7 +2124,7 @@ ResolveConstraints(
for (start = 0; start < uniformGroups; start++) {
if (uniformGroupPtr[start].group ==
layoutPtr[slot].uniform) {
- weight = layoutPtr[slot].weight;
+ int weight = layoutPtr[slot].weight;
weight = weight > 0 ? weight : 1;
layoutPtr[slot].minSize =
uniformGroupPtr[start].minSize * weight;
@@ -2130,16 +2142,16 @@ ResolveConstraints(
/*
* Step 3.
* Determine the minimum slot offsets going from left to right that would
- * fit all of the slaves. This determines the minimum
+ * fit all of the content. This determines the minimum
*/
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) {
+ for (contentPtr = layoutPtr[slot].binNextPtr; contentPtr != NULL;
+ contentPtr = contentPtr->binNextPtr) {
int span = (slotType == COLUMN) ?
- slavePtr->numCols : slavePtr->numRows;
- int required = slavePtr->size + layoutPtr[slot - span].minOffset;
+ contentPtr->numCols : contentPtr->numRows;
+ int required = contentPtr->size + layoutPtr[slot - span].minOffset;
if (required > layoutPtr[slot].minOffset) {
layoutPtr[slot].minOffset = required;
@@ -2150,7 +2162,7 @@ ResolveConstraints(
/*
* 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
+ * It might be prudent to stop here if our "container" will resize itself to
* this size.
*/
@@ -2171,11 +2183,11 @@ ResolveConstraints(
layoutPtr[slot].maxOffset = offset;
}
for (slot=gridCount-1; slot > 0;) {
- for (slavePtr = layoutPtr[slot].binNextPtr; slavePtr != NULL;
- slavePtr = slavePtr->binNextPtr) {
+ for (contentPtr = layoutPtr[slot].binNextPtr; contentPtr != NULL;
+ contentPtr = contentPtr->binNextPtr) {
int span = (slotType == COLUMN) ?
- slavePtr->numCols : slavePtr->numRows;
- int require = offset - slavePtr->size;
+ contentPtr->numCols : contentPtr->numRows;
+ int require = offset - contentPtr->size;
int startSlot = slot - span;
if (startSlot >=0 && require < layoutPtr[startSlot].maxOffset) {
@@ -2385,7 +2397,7 @@ ResolveConstraints(
/*
* Step 6.
* All of the space has been apportioned; copy the layout information back
- * into the master.
+ * into the container.
*/
for (slot=0; slot < gridCount; slot++) {
@@ -2444,10 +2456,10 @@ GetGrid(
}
gridPtr = (Gridder *)ckalloc(sizeof(Gridder));
gridPtr->tkwin = tkwin;
- gridPtr->masterPtr = NULL;
- gridPtr->masterDataPtr = NULL;
+ gridPtr->containerPtr = NULL;
+ gridPtr->containerDataPtr = NULL;
gridPtr->nextPtr = NULL;
- gridPtr->slavePtr = NULL;
+ gridPtr->contentPtr = NULL;
gridPtr->binNextPtr = NULL;
gridPtr->column = -1;
@@ -2467,7 +2479,7 @@ GetGrid(
gridPtr->sticky = 0;
gridPtr->size = 0;
gridPtr->in = NULL;
- gridPtr->masterDataPtr = NULL;
+ gridPtr->containerDataPtr = NULL;
Tcl_SetHashValue(hPtr, gridPtr);
Tk_CreateEventHandler(tkwin, StructureNotifyMask,
GridStructureProc, gridPtr);
@@ -2479,13 +2491,13 @@ GetGrid(
*
* SetGridSize --
*
- * This internal procedure sets the size of the grid occupied by slaves.
+ * This internal procedure sets the size of the grid occupied by content.
*
* Results:
* None
*
* Side effects:
- * The width and height arguments are filled in the master data
+ * The width and height arguments are filled in the container data
* structure. Additional space is allocated for the constraints to
* accommodate the offsets.
*
@@ -2494,50 +2506,50 @@ GetGrid(
static void
SetGridSize(
- Gridder *masterPtr) /* The geometry master for this grid. */
+ Gridder *containerPtr) /* The geometry container for this grid. */
{
- Gridder *slavePtr; /* Current slave window. */
+ Gridder *contentPtr; /* Current content 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);
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ maxX = MAX(maxX, contentPtr->numCols + contentPtr->column);
+ maxY = MAX(maxY, contentPtr->numRows + contentPtr->row);
}
- masterPtr->masterDataPtr->columnEnd = maxX;
- masterPtr->masterDataPtr->rowEnd = maxY;
- CheckSlotData(masterPtr, maxX, COLUMN, CHECK_SPACE);
- CheckSlotData(masterPtr, maxY, ROW, CHECK_SPACE);
+ containerPtr->containerDataPtr->columnEnd = maxX;
+ containerPtr->containerDataPtr->rowEnd = maxY;
+ CheckSlotData(containerPtr, maxX, COLUMN, CHECK_SPACE);
+ CheckSlotData(containerPtr, maxY, ROW, CHECK_SPACE);
}
/*
*----------------------------------------------------------------------
*
- * SetSlaveColumn --
+ * SetContentColumn --
*
- * Update column data for a slave, checking that MAX_ELEMENT bound
+ * Update column data for a content, checking that MAX_ELEMENT bound
* is not passed.
*
* Results:
* TCL_ERROR if out of bounds, TCL_OK otherwise
*
* Side effects:
- * Slave fields are updated.
+ * Content fields are updated.
*
*----------------------------------------------------------------------
*/
static int
-SetSlaveColumn(
+SetContentColumn(
Tcl_Interp *interp, /* Interp for error message. */
- Gridder *slavePtr, /* Slave to be updated. */
+ Gridder *contentPtr, /* Content 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;
- newNumCols = (numCols >= 1) ? numCols : slavePtr->numCols;
+ newColumn = (column >= 0) ? column : contentPtr->column;
+ newNumCols = (numCols >= 1) ? numCols : contentPtr->numCols;
lastCol = ((newColumn >= 0) ? newColumn : 0) + newNumCols;
if (lastCol >= MAX_ELEMENT) {
@@ -2546,39 +2558,39 @@ SetSlaveColumn(
return TCL_ERROR;
}
- slavePtr->column = newColumn;
- slavePtr->numCols = newNumCols;
+ contentPtr->column = newColumn;
+ contentPtr->numCols = newNumCols;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
- * SetSlaveRow --
+ * SetContentRow --
*
- * Update row data for a slave, checking that MAX_ELEMENT bound
+ * Update row data for a content, checking that MAX_ELEMENT bound
* is not passed.
*
* Results:
* TCL_ERROR if out of bounds, TCL_OK otherwise
*
* Side effects:
- * Slave fields are updated.
+ * Content fields are updated.
*
*----------------------------------------------------------------------
*/
static int
-SetSlaveRow(
+SetContentRow(
Tcl_Interp *interp, /* Interp for error message. */
- Gridder *slavePtr, /* Slave to be updated. */
+ Gridder *contentPtr, /* Content 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;
- newNumRows = (numRows >= 1) ? numRows : slavePtr->numRows;
+ newRow = (row >= 0) ? row : contentPtr->row;
+ newNumRows = (numRows >= 1) ? numRows : contentPtr->numRows;
lastRow = ((newRow >= 0) ? newRow : 0) + newNumRows;
if (lastRow >= MAX_ELEMENT) {
@@ -2587,8 +2599,8 @@ SetSlaveRow(
return TCL_ERROR;
}
- slavePtr->row = newRow;
- slavePtr->numRows = newNumRows;
+ contentPtr->row = newRow;
+ contentPtr->numRows = newNumRows;
return TCL_OK;
}
@@ -2604,7 +2616,7 @@ SetSlaveRow(
* TRUE if the index is OK, False otherwise.
*
* Side effects:
- * A new master grid structure may be created. If so, then it is
+ * A new container 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.
@@ -2614,7 +2626,7 @@ SetSlaveRow(
static int
CheckSlotData(
- Gridder *masterPtr, /* The geometry master for this grid. */
+ Gridder *containerPtr, /* The geometry container for this grid. */
int slot, /* Which slot to look at. */
int slotType, /* ROW or COLUMN. */
int checkOnly) /* Don't allocate new space if true. */
@@ -2630,7 +2642,7 @@ CheckSlotData(
return TCL_ERROR;
}
- if ((checkOnly == CHECK_ONLY) && (masterPtr->masterDataPtr == NULL)) {
+ if ((checkOnly == CHECK_ONLY) && (containerPtr->containerDataPtr == NULL)) {
return TCL_ERROR;
}
@@ -2640,39 +2652,39 @@ CheckSlotData(
* of the offsets as well.
*/
- InitMasterData(masterPtr);
- end = (slotType == ROW) ? masterPtr->masterDataPtr->rowMax :
- masterPtr->masterDataPtr->columnMax;
+ InitContainerData(containerPtr);
+ end = (slotType == ROW) ? containerPtr->containerDataPtr->rowMax :
+ containerPtr->containerDataPtr->columnMax;
if (checkOnly == CHECK_ONLY) {
return ((end < slot) ? TCL_ERROR : TCL_OK);
} else {
- numSlot = (slotType == ROW) ? masterPtr->masterDataPtr->rowSpace
- : masterPtr->masterDataPtr->columnSpace;
+ numSlot = (slotType == ROW) ? containerPtr->containerDataPtr->rowSpace
+ : containerPtr->containerDataPtr->columnSpace;
if (slot >= numSlot) {
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;
+ ? containerPtr->containerDataPtr->rowPtr
+ : containerPtr->containerDataPtr->columnPtr;
memcpy(newSI, oldSI, oldSize);
memset(newSI+numSlot, 0, newSize - oldSize);
ckfree(oldSI);
if (slotType == ROW) {
- masterPtr->masterDataPtr->rowPtr = newSI;
- masterPtr->masterDataPtr->rowSpace = newNumSlot;
+ containerPtr->containerDataPtr->rowPtr = newSI;
+ containerPtr->containerDataPtr->rowSpace = newNumSlot;
} else {
- masterPtr->masterDataPtr->columnPtr = newSI;
- masterPtr->masterDataPtr->columnSpace = newNumSlot;
+ containerPtr->containerDataPtr->columnPtr = newSI;
+ containerPtr->containerDataPtr->columnSpace = newNumSlot;
}
}
if (slot >= end && checkOnly != CHECK_SPACE) {
if (slotType == ROW) {
- masterPtr->masterDataPtr->rowMax = slot+1;
+ containerPtr->containerDataPtr->rowMax = slot+1;
} else {
- masterPtr->masterDataPtr->columnMax = slot+1;
+ containerPtr->containerDataPtr->columnMax = slot+1;
}
}
return TCL_OK;
@@ -2682,28 +2694,28 @@ CheckSlotData(
/*
*----------------------------------------------------------------------
*
- * InitMasterData --
+ * InitContainerData --
*
* This internal procedure is used to allocate and initialize the data
- * for a geometry master, if the data doesn't exist already.
+ * for a geometry container, if the data doesn't exist already.
*
* Results:
* none
*
* Side effects:
- * A new master grid structure may be created. If so, then it is
+ * A new container grid structure may be created. If so, then it is
* initialized.
*
*----------------------------------------------------------------------
*/
static void
-InitMasterData(
- Gridder *masterPtr)
+InitContainerData(
+ Gridder *containerPtr)
{
- if (masterPtr->masterDataPtr == NULL) {
- GridMaster *gridPtr = masterPtr->masterDataPtr = (GridMaster *)
- ckalloc(sizeof(GridMaster));
+ if (containerPtr->containerDataPtr == NULL) {
+ GridContainer *gridPtr = containerPtr->containerDataPtr = (GridContainer *)
+ ckalloc(sizeof(GridContainer));
size_t size = sizeof(SlotInfo) * TYPICAL_SIZE;
gridPtr->columnEnd = 0;
@@ -2728,13 +2740,13 @@ InitMasterData(
*
* Unlink --
*
- * Remove a grid from its master's list of slaves.
+ * Remove a grid from its container's list of content.
*
* Results:
* None.
*
* Side effects:
- * The master will be scheduled for re-arranging, and the size of the
+ * The container will be scheduled for re-arranging, and the size of the
* grid will be adjusted accordingly
*
*----------------------------------------------------------------------
@@ -2742,51 +2754,51 @@ InitMasterData(
static void
Unlink(
- Gridder *slavePtr) /* Window to unlink. */
+ Gridder *contentPtr) /* Window to unlink. */
{
- Gridder *masterPtr, *slavePtr2;
+ Gridder *containerPtr, *contentPtr2;
- masterPtr = slavePtr->masterPtr;
- if (masterPtr == NULL) {
+ containerPtr = contentPtr->containerPtr;
+ if (containerPtr == NULL) {
return;
}
- if (masterPtr->slavePtr == slavePtr) {
- masterPtr->slavePtr = slavePtr->nextPtr;
+ if (containerPtr->contentPtr == contentPtr) {
+ containerPtr->contentPtr = contentPtr->nextPtr;
} else {
- for (slavePtr2=masterPtr->slavePtr ; ; slavePtr2=slavePtr2->nextPtr) {
- if (slavePtr2 == NULL) {
+ for (contentPtr2=containerPtr->contentPtr ; ; contentPtr2=contentPtr2->nextPtr) {
+ if (contentPtr2 == NULL) {
Tcl_Panic("Unlink couldn't find previous window");
}
- if (slavePtr2->nextPtr == slavePtr) {
- slavePtr2->nextPtr = slavePtr->nextPtr;
+ if (contentPtr2->nextPtr == contentPtr) {
+ contentPtr2->nextPtr = contentPtr->nextPtr;
break;
}
}
}
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_RELAYOUT)) {
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- SetGridSize(slavePtr->masterPtr);
- slavePtr->masterPtr = NULL;
+ SetGridSize(contentPtr->containerPtr);
+ contentPtr->containerPtr = NULL;
/*
- * If we have emptied this master from slaves it means we are no longer
+ * If we have emptied this container from content it means we are no longer
* handling it and should mark it as free.
*
- * Send the event "NoManagedChild" to the master to inform it about there
+ * Send the event "NoManagedChild" to the container to inform it about there
* being no managed children inside it.
*/
- if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) {
- TkFreeGeometryMaster(masterPtr->tkwin, "grid");
- masterPtr->flags &= ~ALLOCED_MASTER;
- TkSendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL);
+ if ((containerPtr->contentPtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) {
+ TkFreeGeometryContainer(containerPtr->tkwin, "grid");
+ containerPtr->flags &= ~ALLOCED_CONTAINER;
+ Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL);
}
}
@@ -2798,7 +2810,7 @@ Unlink(
* 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
+ * structure for all windows and the container structure for geometry
* managers.
*
* Results:
@@ -2816,14 +2828,14 @@ DestroyGrid(
{
Gridder *gridPtr = (Gridder *)memPtr;
- if (gridPtr->masterDataPtr != NULL) {
- if (gridPtr->masterDataPtr->rowPtr != NULL) {
- ckfree(gridPtr->masterDataPtr -> rowPtr);
+ if (gridPtr->containerDataPtr != NULL) {
+ if (gridPtr->containerDataPtr->rowPtr != NULL) {
+ ckfree(gridPtr->containerDataPtr -> rowPtr);
}
- if (gridPtr->masterDataPtr->columnPtr != NULL) {
- ckfree(gridPtr->masterDataPtr -> columnPtr);
+ if (gridPtr->containerDataPtr->columnPtr != NULL) {
+ ckfree(gridPtr->containerDataPtr -> columnPtr);
}
- ckfree(gridPtr->masterDataPtr);
+ ckfree(gridPtr->containerDataPtr);
}
if (gridPtr->in != NULL) {
Tcl_DecrRefCount(gridPtr->in);
@@ -2844,7 +2856,7 @@ DestroyGrid(
*
* 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 content, if any.
*
*----------------------------------------------------------------------
*/
@@ -2859,32 +2871,32 @@ GridStructureProc(
TkDisplay *dispPtr = ((TkWindow *) gridPtr->tkwin)->dispPtr;
if (eventPtr->type == ConfigureNotify) {
- if ((gridPtr->slavePtr != NULL)
+ if ((gridPtr->contentPtr != NULL)
&& !(gridPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->flags |= REQUESTED_RELAYOUT;
Tcl_DoWhenIdle(ArrangeGrid, gridPtr);
}
- if ((gridPtr->masterPtr != NULL) &&
+ if ((gridPtr->containerPtr != NULL) &&
(gridPtr->doubleBw != 2*Tk_Changes(gridPtr->tkwin)->border_width)) {
- if (!(gridPtr->masterPtr->flags & REQUESTED_RELAYOUT)) {
+ if (!(gridPtr->containerPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->doubleBw = 2*Tk_Changes(gridPtr->tkwin)->border_width;
- gridPtr->masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, gridPtr->masterPtr);
+ gridPtr->containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, gridPtr->containerPtr);
}
}
} else if (eventPtr->type == DestroyNotify) {
- Gridder *slavePtr, *nextPtr;
+ Gridder *contentPtr, *nextPtr;
- if (gridPtr->masterPtr != NULL) {
+ if (gridPtr->containerPtr != NULL) {
Unlink(gridPtr);
}
- for (slavePtr = gridPtr->slavePtr; slavePtr != NULL;
- slavePtr = nextPtr) {
- Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL);
- Tk_UnmapWindow(slavePtr->tkwin);
- slavePtr->masterPtr = NULL;
- nextPtr = slavePtr->nextPtr;
- slavePtr->nextPtr = NULL;
+ for (contentPtr = gridPtr->contentPtr; contentPtr != NULL;
+ contentPtr = nextPtr) {
+ Tk_ManageGeometry(contentPtr->tkwin, NULL, NULL);
+ Tk_UnmapWindow(contentPtr->tkwin);
+ contentPtr->containerPtr = NULL;
+ nextPtr = contentPtr->nextPtr;
+ contentPtr->nextPtr = NULL;
}
Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable,
gridPtr->tkwin));
@@ -2894,17 +2906,17 @@ GridStructureProc(
gridPtr->tkwin = NULL;
Tcl_EventuallyFree(gridPtr, (Tcl_FreeProc *)DestroyGrid);
} else if (eventPtr->type == MapNotify) {
- if ((gridPtr->slavePtr != NULL)
+ if ((gridPtr->contentPtr != NULL)
&& !(gridPtr->flags & REQUESTED_RELAYOUT)) {
gridPtr->flags |= REQUESTED_RELAYOUT;
Tcl_DoWhenIdle(ArrangeGrid, gridPtr);
}
} else if (eventPtr->type == UnmapNotify) {
- Gridder *slavePtr;
+ Gridder *contentPtr;
- for (slavePtr = gridPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- Tk_UnmapWindow(slavePtr->tkwin);
+ for (contentPtr = gridPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ Tk_UnmapWindow(contentPtr->tkwin);
}
}
}
@@ -2912,11 +2924,11 @@ GridStructureProc(
/*
*----------------------------------------------------------------------
*
- * ConfigureSlaves --
+ * ConfigureContent --
*
* 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 content and configuration options, it arranges for the grid to
+ * manage the content and sets the specified options. Arguments consist
* of windows or window shortcuts followed by "-option value" pairs.
*
* Results:
@@ -2924,26 +2936,26 @@ GridStructureProc(
* and the interp's result is set to contain an error message.
*
* Side effects:
- * Slave windows get taken over by the grid.
+ * Content windows get taken over by the grid.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureSlaves(
+ConfigureContent(
Tcl_Interp *interp, /* Interpreter for error reporting. */
Tk_Window tkwin, /* Any window in application containing
- * slaves. Used to look up slave names. */
+ * content. Used to look up content 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 = NULL;
- Gridder *slavePtr;
- Tk_Window other, slave, parent, ancestor;
- TkWindow *master;
+ Gridder *containerPtr = NULL;
+ Gridder *contentPtr;
+ Tk_Window other, content, parent, ancestor;
+ TkWindow *container;
int i, j, tmp;
int numWindows;
int width;
@@ -2974,39 +2986,39 @@ ConfigureSlaves(
TkSizeT length;
char prevChar = firstChar;
- string = TkGetStringFromObj(objv[i], &length);
+ string = Tcl_GetStringFromObj(objv[i], &length);
firstChar = string[0];
if (firstChar == '.') {
/*
- * Check that windows are valid, and locate the first slave's
+ * Check that windows are valid, and locate the first content's
* parent window (default for -in).
*/
- if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) {
return TCL_ERROR;
}
- if (masterPtr == NULL) {
+ if (containerPtr == NULL) {
/*
- * Is there any saved -in from a removed slave?
+ * Is there any saved -in from a removed content?
* If there is, it becomes default for -in.
- * If the stored master does not exist, just ignore it.
+ * If the stored container does not exist, just ignore it.
*/
- struct Gridder *slavePtr = GetGrid(slave);
- if (slavePtr->in != NULL) {
- if (TkGetWindowFromObj(interp, slave, slavePtr->in, &parent)
+ contentPtr = GetGrid(content);
+ if (contentPtr->in != NULL) {
+ if (TkGetWindowFromObj(interp, content, contentPtr->in, &parent)
== TCL_OK) {
- masterPtr = GetGrid(parent);
- InitMasterData(masterPtr);
+ containerPtr = GetGrid(parent);
+ InitContainerData(containerPtr);
}
}
}
- if (masterPtr == NULL) {
- parent = Tk_Parent(slave);
+ if (containerPtr == NULL) {
+ parent = Tk_Parent(content);
if (parent != NULL) {
- masterPtr = GetGrid(parent);
- InitMasterData(masterPtr);
+ containerPtr = GetGrid(parent);
+ InitContainerData(containerPtr);
}
}
numWindows++;
@@ -3074,8 +3086,8 @@ ConfigureSlaves(
TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetGrid(other);
- InitMasterData(masterPtr);
+ containerPtr = GetGrid(other);
+ InitContainerData(containerPtr);
} else if (index == CONF_ROW) {
if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK
|| tmp < 0) {
@@ -3091,23 +3103,23 @@ ConfigureSlaves(
/*
* If no -row is given, use the next row after the highest occupied row
- * of the master.
+ * of the container.
*/
if (defaultRow < 0) {
- if (masterPtr != NULL && masterPtr->masterDataPtr != NULL) {
- SetGridSize(masterPtr);
- defaultRow = masterPtr->masterDataPtr->rowEnd;
+ if (containerPtr != NULL && containerPtr->containerDataPtr != NULL) {
+ SetGridSize(containerPtr);
+ defaultRow = containerPtr->containerDataPtr->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
+ * Iterate over all of the content windows and short-cuts, parsing options
+ * for each content. It's a bit wasteful to re-parse the options for each
+ * content, but things get too messy if we try to parse the arguments just
+ * once at the beginning. For example, if a content 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.
@@ -3120,7 +3132,7 @@ ConfigureSlaves(
/*
* '^' and 'x' cause us to skip a column. '-' is processed as part of
- * its preceeding slave.
+ * its preceeding content.
*/
if ((firstChar == REL_VERT) || (firstChar == REL_SKIP)) {
@@ -3133,34 +3145,34 @@ ConfigureSlaves(
for (defaultColumnSpan = 1; j + defaultColumnSpan < numWindows;
defaultColumnSpan++) {
- const char *string = Tcl_GetString(objv[j + defaultColumnSpan]);
+ string = Tcl_GetString(objv[j + defaultColumnSpan]);
if (*string != REL_HORIZ) {
break;
}
}
- if (TkGetWindowFromObj(interp, tkwin, objv[j], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[j], &content) != TCL_OK) {
return TCL_ERROR;
}
- if (Tk_TopWinHierarchy(slave)) {
+ if (Tk_TopWinHierarchy(content)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't manage \"%s\": it's a top-level window",
Tcl_GetString(objv[j])));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL);
return TCL_ERROR;
}
- slavePtr = GetGrid(slave);
+ contentPtr = GetGrid(content);
/*
* The following statement is taken from tkPack.c:
*
- * "If the slave isn't currently managed, reset all of its
+ * "If the content isn't currently managed, reset all of its
* 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
+ * I [D.S.] disagree with this statement. If a content 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
@@ -3181,7 +3193,7 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", NULL);
return TCL_ERROR;
}
- if (SetSlaveColumn(interp, slavePtr, tmp, -1) != TCL_OK) {
+ if (SetContentColumn(interp, contentPtr, tmp, -1) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -3194,7 +3206,7 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", NULL);
return TCL_ERROR;
}
- if (SetSlaveColumn(interp, slavePtr, -1, tmp) != TCL_OK) {
+ if (SetContentColumn(interp, contentPtr, -1, tmp) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -3203,15 +3215,15 @@ ConfigureSlaves(
&other) != TCL_OK) {
return TCL_ERROR;
}
- if (other == slave) {
+ if (other == content) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"window can't be managed in itself", -1));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL);
return TCL_ERROR;
}
positionGiven = 1;
- masterPtr = GetGrid(other);
- InitMasterData(masterPtr);
+ containerPtr = GetGrid(other);
+ InitContainerData(containerPtr);
break;
case CONF_STICKY: {
int sticky = StringToSticky(Tcl_GetString(objv[i+1]));
@@ -3224,11 +3236,11 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "STICKY", NULL);
return TCL_ERROR;
}
- slavePtr->sticky = sticky;
+ contentPtr->sticky = sticky;
break;
}
case CONF_IPADX:
- if ((Tk_GetPixelsFromObj(NULL, slave, objv[i+1],
+ if ((Tk_GetPixelsFromObj(NULL, content, objv[i+1],
&tmp) != TCL_OK) || (tmp < 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad ipadx value \"%s\": must be positive screen distance",
@@ -3236,10 +3248,10 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL);
return TCL_ERROR;
}
- slavePtr->iPadX = tmp * 2;
+ contentPtr->iPadX = tmp * 2;
break;
case CONF_IPADY:
- if ((Tk_GetPixelsFromObj(NULL, slave, objv[i+1],
+ if ((Tk_GetPixelsFromObj(NULL, content, objv[i+1],
&tmp) != TCL_OK) || (tmp < 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad ipady value \"%s\": must be positive screen distance",
@@ -3247,17 +3259,17 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL);
return TCL_ERROR;
}
- slavePtr->iPadY = tmp * 2;
+ contentPtr->iPadY = tmp * 2;
break;
case CONF_PADX:
if (TkParsePadAmount(interp, tkwin, objv[i+1],
- &slavePtr->padLeft, &slavePtr->padX) != TCL_OK) {
+ &contentPtr->padLeft, &contentPtr->padX) != TCL_OK) {
return TCL_ERROR;
}
break;
case CONF_PADY:
if (TkParsePadAmount(interp, tkwin, objv[i+1],
- &slavePtr->padTop, &slavePtr->padY) != TCL_OK) {
+ &contentPtr->padTop, &contentPtr->padY) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -3270,7 +3282,7 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "COLUMN", NULL);
return TCL_ERROR;
}
- if (SetSlaveRow(interp, slavePtr, tmp, -1) != TCL_OK) {
+ if (SetContentRow(interp, contentPtr, tmp, -1) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -3283,7 +3295,7 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "SPAN", NULL);
return TCL_ERROR;
}
- if (SetSlaveRow(interp, slavePtr, -1, tmp) != TCL_OK) {
+ if (SetContentRow(interp, contentPtr, -1, tmp) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -3291,12 +3303,12 @@ ConfigureSlaves(
}
/*
- * If no position was specified via -in and the slave is already
+ * If no position was specified via -in and the content is already
* packed, then leave it in its current location.
*/
- if (!positionGiven && (slavePtr->masterPtr != NULL)) {
- masterPtr = slavePtr->masterPtr;
+ if (!positionGiven && (contentPtr->containerPtr != NULL)) {
+ containerPtr = contentPtr->containerPtr;
goto scheduleLayout;
}
@@ -3305,54 +3317,54 @@ ConfigureSlaves(
* its current location.
*/
- if (positionGiven && (masterPtr == slavePtr->masterPtr)) {
+ if (positionGiven && (containerPtr == contentPtr->containerPtr)) {
goto scheduleLayout;
}
/*
- * Make sure we have a geometry master. We look at:
+ * Make sure we have a geometry container. We look at:
* 1) the -in flag
- * 2) the parent of the first slave.
+ * 2) the parent of the first content.
*/
- parent = Tk_Parent(slave);
- if (masterPtr == NULL) {
- masterPtr = GetGrid(parent);
- InitMasterData(masterPtr);
+ parent = Tk_Parent(content);
+ if (containerPtr == NULL) {
+ containerPtr = GetGrid(parent);
+ InitContainerData(containerPtr);
}
- if (slavePtr->masterPtr != NULL && slavePtr->masterPtr != masterPtr) {
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if (contentPtr->containerPtr != NULL && contentPtr->containerPtr != containerPtr) {
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
- slavePtr->masterPtr = NULL;
+ Unlink(contentPtr);
+ contentPtr->containerPtr = NULL;
}
- if (slavePtr->masterPtr == NULL) {
- Gridder *tempPtr = masterPtr->slavePtr;
+ if (contentPtr->containerPtr == NULL) {
+ Gridder *tempPtr = containerPtr->contentPtr;
- slavePtr->masterPtr = masterPtr;
- masterPtr->slavePtr = slavePtr;
- slavePtr->nextPtr = tempPtr;
+ contentPtr->containerPtr = containerPtr;
+ containerPtr->contentPtr = contentPtr;
+ contentPtr->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
+ * Make sure that the content's parent is either the container or an
+ * ancestor of the container, and that the container and content aren't the
* same.
*/
- for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == parent) {
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't put %s inside %s", Tcl_GetString(objv[j]),
- Tk_PathName(masterPtr->tkwin)));
+ "can't put \"%s\" inside \"%s\"", Tcl_GetString(objv[j]),
+ Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
- Unlink(slavePtr);
+ Unlink(contentPtr);
return TCL_ERROR;
}
}
@@ -3361,65 +3373,65 @@ ConfigureSlaves(
* Check for management loops.
*/
- for (master = (TkWindow *)masterPtr->tkwin; master != NULL;
- master = (TkWindow *)TkGetGeomMaster(master)) {
- if (master == (TkWindow *)slave) {
+ for (container = (TkWindow *)containerPtr->tkwin; container != NULL;
+ container = (TkWindow *)TkGetContainer(container)) {
+ if (container == (TkWindow *)content) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't put %s inside %s, would cause management loop",
- Tcl_GetString(objv[j]), Tk_PathName(masterPtr->tkwin)));
+ "can't put \"%s\" inside \"%s\": would cause management loop",
+ Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
- Unlink(slavePtr);
+ Unlink(contentPtr);
return TCL_ERROR;
}
}
- if (masterPtr->tkwin != Tk_Parent(slave)) {
- ((TkWindow *)slave)->maintainerPtr = (TkWindow *)masterPtr->tkwin;
+ if (containerPtr->tkwin != Tk_Parent(content)) {
+ ((TkWindow *)content)->maintainerPtr = (TkWindow *)containerPtr->tkwin;
}
- Tk_ManageGeometry(slave, &gridMgrType, slavePtr);
+ Tk_ManageGeometry(content, &gridMgrType, contentPtr);
- if (!(masterPtr->flags & DONT_PROPAGATE)) {
- if (TkSetGeometryMaster(interp, masterPtr->tkwin, "grid")
+ if (!(containerPtr->flags & DONT_PROPAGATE)) {
+ if (TkSetGeometryContainer(interp, containerPtr->tkwin, "grid")
!= TCL_OK) {
- Tk_ManageGeometry(slave, NULL, NULL);
- Unlink(slavePtr);
+ Tk_ManageGeometry(content, NULL, NULL);
+ Unlink(contentPtr);
return TCL_ERROR;
}
- masterPtr->flags |= ALLOCED_MASTER;
+ containerPtr->flags |= ALLOCED_CONTAINER;
}
/*
* Assign default position information.
*/
- if (slavePtr->column == -1) {
- if (SetSlaveColumn(interp, slavePtr, defaultColumn,-1) != TCL_OK){
+ if (contentPtr->column == -1) {
+ if (SetContentColumn(interp, contentPtr, defaultColumn,-1) != TCL_OK){
return TCL_ERROR;
}
}
- if (SetSlaveColumn(interp, slavePtr, -1,
- slavePtr->numCols + defaultColumnSpan - 1) != TCL_OK) {
+ if (SetContentColumn(interp, contentPtr, -1,
+ contentPtr->numCols + defaultColumnSpan - 1) != TCL_OK) {
return TCL_ERROR;
}
- if (slavePtr->row == -1) {
- if (SetSlaveRow(interp, slavePtr, defaultRow, -1) != TCL_OK) {
+ if (contentPtr->row == -1) {
+ if (SetContentRow(interp, contentPtr, defaultRow, -1) != TCL_OK) {
return TCL_ERROR;
}
}
- defaultColumn += slavePtr->numCols;
+ defaultColumn += contentPtr->numCols;
defaultColumnSpan = 1;
/*
- * Arrange for the master to be re-arranged at the first idle moment.
+ * Arrange for the container to be re-arranged at the first idle moment.
*/
scheduleLayout:
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_RELAYOUT)) {
- masterPtr->flags |= REQUESTED_RELAYOUT;
- Tcl_DoWhenIdle(ArrangeGrid, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_RELAYOUT)) {
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ Tcl_DoWhenIdle(ArrangeGrid, containerPtr);
}
}
@@ -3435,9 +3447,9 @@ ConfigureSlaves(
int lastRow, lastColumn; /* Implied end of table. */
string = Tcl_GetString(objv[j]);
- firstChar = string[0];
+ firstChar = string[0];
- if (firstChar == '.') {
+ if (firstChar == '.') {
lastWindow = string;
numSkip = 0;
}
@@ -3448,9 +3460,9 @@ ConfigureSlaves(
continue;
}
- if (masterPtr == NULL) {
+ if (containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can't use '^', cant find master", -1));
+ "can't use '^', can't find container window", -1));
Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL);
return TCL_ERROR;
}
@@ -3460,7 +3472,7 @@ ConfigureSlaves(
*/
for (width = 1; width + j < numWindows; width++) {
- const char *string = Tcl_GetString(objv[j+width]);
+ string = Tcl_GetString(objv[j+width]);
if (*string != REL_VERT) {
break;
@@ -3484,19 +3496,19 @@ ConfigureSlaves(
lastColumn += numSkip;
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) {
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+
+ if (contentPtr->column == lastColumn
+ && contentPtr->row + contentPtr->numRows - 1 == lastRow) {
+ if (contentPtr->numCols <= width) {
+ if (SetContentRow(interp, contentPtr, -1,
+ contentPtr->numRows + 1) != TCL_OK) {
return TCL_ERROR;
}
match++;
- j += slavePtr->numCols - 1;
- lastWindow = Tk_PathName(slavePtr->tkwin);
+ j += contentPtr->numCols - 1;
+ lastWindow = Tk_PathName(contentPtr->tkwin);
numSkip = 0;
break;
}
@@ -3504,32 +3516,32 @@ ConfigureSlaves(
}
if (!match) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can't find slave to extend with \"^\"", -1));
+ "can't find content to extend with \"^\"", -1));
Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL);
return TCL_ERROR;
}
}
- if (masterPtr == NULL) {
+ if (containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "can't determine master window", -1));
+ "can't determine container window", -1));
Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL);
return TCL_ERROR;
}
- SetGridSize(masterPtr);
+ SetGridSize(containerPtr);
/*
- * If we have emptied this master from slaves it means we are no longer
+ * If we have emptied this container from content it means we are no longer
* handling it and should mark it as free.
*
- * Send the event "NoManagedChild" to the master to inform it about there
+ * Send the event "NoManagedChild" to the container to inform it about there
* being no managed children inside it.
*/
- if (masterPtr->slavePtr == NULL && masterPtr->flags & ALLOCED_MASTER) {
- TkFreeGeometryMaster(masterPtr->tkwin, "grid");
- masterPtr->flags &= ~ALLOCED_MASTER;
- TkSendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL);
+ if (containerPtr->contentPtr == NULL && containerPtr->flags & ALLOCED_CONTAINER) {
+ TkFreeGeometryContainer(containerPtr->tkwin, "grid");
+ containerPtr->flags &= ~ALLOCED_CONTAINER;
+ Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL);
}
return TCL_OK;
diff --git a/generic/tkImage.c b/generic/tkImage.c
index 1874d38..ca9dac6 100644
--- a/generic/tkImage.c
+++ b/generic/tkImage.c
@@ -4,8 +4,8 @@
* 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.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -26,8 +26,8 @@ typedef struct Image {
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
+ struct ImageModel *modelPtr;
+ /* Model for this image (identifiers image
* manager, for example). */
ClientData instanceData; /* One word argument to pass to image manager
* when dealing with this image instance. */
@@ -40,17 +40,17 @@ typedef struct Image {
} Image;
/*
- * For each image master there is one of the following structures, which
+ * For each image model 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 {
+typedef struct ImageModel {
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
+ ClientData modelData; /* One-word argument to pass to image mgr when
+ * dealing with the model, as opposed to
* instances. */
int width, height; /* Last known dimensions for image. */
Tcl_HashTable *tablePtr; /* Pointer to hash table containing image (the
@@ -64,7 +64,7 @@ typedef struct ImageMaster {
int deleted; /* Flag set when image is being deleted. */
TkWindow *winPtr; /* Main window of interpreter (used to detect
* when the world is falling apart.) */
-} ImageMaster;
+} ImageModel;
typedef struct {
Tk_ImageType *imageTypeList;/* First in a list of all known image
@@ -82,8 +82,8 @@ static Tcl_ThreadDataKey dataKey;
*/
static void ImageTypeThreadExitProc(ClientData clientData);
-static void DeleteImage(ImageMaster *masterPtr);
-static void EventuallyDeleteImage(ImageMaster *masterPtr,
+static void DeleteImage(ImageModel *modelPtr);
+static void EventuallyDeleteImage(ImageModel *modelPtr,
int forgetImageHashNow);
/*
@@ -104,12 +104,11 @@ static void EventuallyDeleteImage(ImageMaster *masterPtr,
static void
ImageTypeThreadExitProc(
- ClientData dummy) /* not used */
+ TCL_UNUSED(void *))
{
Tk_ImageType *freePtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)dummy;
while (tsdPtr->oldImageTypeList != NULL) {
freePtr = tsdPtr->oldImageTypeList;
@@ -219,7 +218,7 @@ Tk_ImageObjCmd(
TkWindow *winPtr = (TkWindow *)clientData;
int i, isNew, firstOption, index;
Tk_ImageType *typePtr;
- ImageMaster *masterPtr;
+ ImageModel *modelPtr;
Image *imagePtr;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
@@ -298,7 +297,7 @@ Tk_ImageObjCmd(
/*
* Need to check if the _command_ that we are about to create is
- * the name of the current master widget command (normally "." but
+ * the name of the current model widget command (normally "." but
* could have been renamed) and fail in that case before a really
* nasty and hard to stop crash happens.
*/
@@ -319,37 +318,37 @@ Tk_ImageObjCmd(
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(masterPtr->winPtr);
- Tcl_SetHashValue(hPtr, masterPtr);
+ modelPtr = (ImageModel *)ckalloc(sizeof(ImageModel));
+ modelPtr->typePtr = NULL;
+ modelPtr->modelData = NULL;
+ modelPtr->width = modelPtr->height = 1;
+ modelPtr->tablePtr = &winPtr->mainPtr->imageTable;
+ modelPtr->hPtr = hPtr;
+ modelPtr->instancePtr = NULL;
+ modelPtr->deleted = 0;
+ modelPtr->winPtr = winPtr->mainPtr->winPtr;
+ Tcl_Preserve(modelPtr->winPtr);
+ Tcl_SetHashValue(hPtr, modelPtr);
} else {
/*
* An image already exists by this name. Disconnect the instances
- * from the master.
+ * from the model.
*/
- masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr);
- if (masterPtr->typePtr != NULL) {
- for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->typePtr != NULL) {
+ for (imagePtr = modelPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
- masterPtr->typePtr->freeProc(imagePtr->instanceData,
+ modelPtr->typePtr->freeProc(imagePtr->instanceData,
imagePtr->display);
imagePtr->changeProc(imagePtr->widgetClientData, 0, 0,
- masterPtr->width, masterPtr->height,
- masterPtr->width, masterPtr->height);
+ modelPtr->width, modelPtr->height,
+ modelPtr->width, modelPtr->height);
}
- masterPtr->typePtr->deleteProc(masterPtr->masterData);
- masterPtr->typePtr = NULL;
+ modelPtr->typePtr->deleteProc(modelPtr->modelData);
+ modelPtr->typePtr = NULL;
}
- masterPtr->deleted = 0;
+ modelPtr->deleted = 0;
}
/*
@@ -362,33 +361,31 @@ Tk_ImageObjCmd(
objc -= firstOption;
args = (Tcl_Obj **) objv;
if (oldimage) {
- int i;
-
args = (Tcl_Obj **)ckalloc((objc+1) * sizeof(Tcl_Obj *));
for (i = 0; i < objc; i++) {
args[i] = (Tcl_Obj *) Tcl_GetString(objv[i]);
}
args[objc] = NULL;
}
- Tcl_Preserve(masterPtr);
+ Tcl_Preserve(modelPtr);
if (typePtr->createProc(interp, name, objc, args, typePtr,
- (Tk_ImageMaster)masterPtr, &masterPtr->masterData) != TCL_OK){
- EventuallyDeleteImage(masterPtr, 0);
- Tcl_Release(masterPtr);
+ (Tk_ImageModel)modelPtr, &modelPtr->modelData) != TCL_OK){
+ EventuallyDeleteImage(modelPtr, 0);
+ Tcl_Release(modelPtr);
if (oldimage) {
ckfree(args);
}
return TCL_ERROR;
}
- Tcl_Release(masterPtr);
+ Tcl_Release(modelPtr);
if (oldimage) {
ckfree(args);
}
- masterPtr->typePtr = typePtr;
- for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
+ modelPtr->typePtr = typePtr;
+ for (imagePtr = modelPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
imagePtr->instanceData = typePtr->getProc(imagePtr->tkwin,
- masterPtr->masterData);
+ modelPtr->modelData);
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(
(const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1));
@@ -401,11 +398,11 @@ Tk_ImageObjCmd(
if (hPtr == NULL) {
goto alreadyDeleted;
}
- masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr);
- if (masterPtr->deleted) {
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->deleted) {
goto alreadyDeleted;
}
- DeleteImage(masterPtr);
+ DeleteImage(modelPtr);
}
break;
case IMAGE_NAMES:
@@ -416,8 +413,8 @@ Tk_ImageObjCmd(
hPtr = Tcl_FirstHashEntry(&winPtr->mainPtr->imageTable, &search);
resultObj = Tcl_NewObj();
for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr);
- if (masterPtr->deleted) {
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->deleted) {
continue;
}
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj(
@@ -450,7 +447,7 @@ Tk_ImageObjCmd(
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
+ * see if three args are given. Then get a non-deleted model from the
* third arg.
*/
@@ -464,8 +461,8 @@ Tk_ImageObjCmd(
if (hPtr == NULL) {
goto alreadyDeleted;
}
- masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr);
- if (masterPtr->deleted) {
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->deleted) {
goto alreadyDeleted;
}
@@ -475,20 +472,20 @@ Tk_ImageObjCmd(
switch ((enum options) index) {
case IMAGE_HEIGHT:
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(masterPtr->height));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(modelPtr->height));
break;
case IMAGE_INUSE:
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(
- masterPtr->typePtr && masterPtr->instancePtr));
+ modelPtr->typePtr && modelPtr->instancePtr));
break;
case IMAGE_TYPE:
- if (masterPtr->typePtr != NULL) {
+ if (modelPtr->typePtr != NULL) {
Tcl_SetObjResult(interp,
- Tcl_NewStringObj(masterPtr->typePtr->name, -1));
+ Tcl_NewStringObj(modelPtr->typePtr->name, -1));
}
break;
case IMAGE_WIDTH:
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(masterPtr->width));
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(modelPtr->width));
break;
default:
Tcl_Panic("can't happen");
@@ -524,7 +521,7 @@ Tk_ImageObjCmd(
void
Tk_ImageChanged(
- Tk_ImageMaster imageMaster, /* Image that needs redisplay. */
+ Tk_ImageModel imageModel, /* 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
@@ -535,12 +532,12 @@ Tk_ImageChanged(
int imageWidth, int imageHeight)
/* New dimensions of image. */
{
- ImageMaster *masterPtr = (ImageMaster *) imageMaster;
+ ImageModel *modelPtr = (ImageModel *) imageModel;
Image *imagePtr;
- masterPtr->width = imageWidth;
- masterPtr->height = imageHeight;
- for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
+ modelPtr->width = imageWidth;
+ modelPtr->height = imageHeight;
+ for (imagePtr = modelPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
imagePtr->changeProc(imagePtr->widgetClientData, x, y, width, height,
imageWidth, imageHeight);
@@ -552,11 +549,11 @@ Tk_ImageChanged(
*
* Tk_NameOfImage --
*
- * Given a token for an image master, this function returns the name of
+ * Given a token for an image model, this function returns the name of
* the image.
*
* Results:
- * The return value is the string name for imageMaster.
+ * The return value is the string name for imageModel.
*
* Side effects:
* None.
@@ -566,14 +563,14 @@ Tk_ImageChanged(
const char *
Tk_NameOfImage(
- Tk_ImageMaster imageMaster) /* Token for image. */
+ Tk_ImageModel imageModel) /* Token for image. */
{
- ImageMaster *masterPtr = (ImageMaster *) imageMaster;
+ ImageModel *modelPtr = (ImageModel *) imageModel;
- if (masterPtr->hPtr == NULL) {
+ if (modelPtr->hPtr == NULL) {
return NULL;
}
- return (const char *)Tcl_GetHashKey(masterPtr->tablePtr, masterPtr->hPtr);
+ return (const char *)Tcl_GetHashKey(modelPtr->tablePtr, modelPtr->hPtr);
}
/*
@@ -611,30 +608,30 @@ Tk_GetImage(
ClientData clientData) /* One-word argument to pass to damageProc. */
{
Tcl_HashEntry *hPtr;
- ImageMaster *masterPtr;
+ ImageModel *modelPtr;
Image *imagePtr;
hPtr = Tcl_FindHashEntry(&((TkWindow *) tkwin)->mainPtr->imageTable, name);
if (hPtr == NULL) {
goto noSuchImage;
}
- masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr);
- if (masterPtr->typePtr == NULL) {
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->typePtr == NULL) {
goto noSuchImage;
}
- if (masterPtr->deleted) {
+ if (modelPtr->deleted) {
goto noSuchImage;
}
imagePtr = (Image *)ckalloc(sizeof(Image));
imagePtr->tkwin = tkwin;
imagePtr->display = Tk_Display(tkwin);
- imagePtr->masterPtr = masterPtr;
+ imagePtr->modelPtr = modelPtr;
imagePtr->instanceData =
- masterPtr->typePtr->getProc(tkwin, masterPtr->masterData);
+ modelPtr->typePtr->getProc(tkwin, modelPtr->modelData);
imagePtr->changeProc = changeProc;
imagePtr->widgetClientData = clientData;
- imagePtr->nextPtr = masterPtr->instancePtr;
- masterPtr->instancePtr = imagePtr;
+ imagePtr->nextPtr = modelPtr->instancePtr;
+ modelPtr->instancePtr = imagePtr;
return (Tk_Image) imagePtr;
noSuchImage:
@@ -670,20 +667,20 @@ Tk_FreeImage(
* a widget. */
{
Image *imagePtr = (Image *) image;
- ImageMaster *masterPtr = imagePtr->masterPtr;
+ ImageModel *modelPtr = imagePtr->modelPtr;
Image *prevPtr;
/*
* Clean up the particular instance.
*/
- if (masterPtr->typePtr != NULL) {
- masterPtr->typePtr->freeProc(imagePtr->instanceData,
+ if (modelPtr->typePtr != NULL) {
+ modelPtr->typePtr->freeProc(imagePtr->instanceData,
imagePtr->display);
}
- prevPtr = masterPtr->instancePtr;
+ prevPtr = modelPtr->instancePtr;
if (prevPtr == imagePtr) {
- masterPtr->instancePtr = imagePtr->nextPtr;
+ modelPtr->instancePtr = imagePtr->nextPtr;
} else {
while (prevPtr->nextPtr != imagePtr) {
prevPtr = prevPtr->nextPtr;
@@ -693,16 +690,16 @@ Tk_FreeImage(
ckfree(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 model, and if the model
+ * image has been deleted, then delete the model too.
*/
- if ((masterPtr->typePtr == NULL) && (masterPtr->instancePtr == NULL)) {
- if (masterPtr->hPtr != NULL) {
- Tcl_DeleteHashEntry(masterPtr->hPtr);
+ if ((modelPtr->typePtr == NULL) && (modelPtr->instancePtr == NULL)) {
+ if (modelPtr->hPtr != NULL) {
+ Tcl_DeleteHashEntry(modelPtr->hPtr);
}
- Tcl_Release(masterPtr->winPtr);
- ckfree(masterPtr);
+ Tcl_Release(modelPtr->winPtr);
+ ckfree(modelPtr);
}
}
@@ -742,9 +739,9 @@ Tk_PostscriptImage(
GC newGC;
XGCValues gcValues;
- if (imagePtr->masterPtr->typePtr == NULL) {
+ if (imagePtr->modelPtr->typePtr == NULL) {
/*
- * No master for image, so nothing to display on postscript.
+ * No model for image, so nothing to display on postscript.
*/
return TCL_OK;
@@ -755,9 +752,9 @@ Tk_PostscriptImage(
* otherwise go on with generic code.
*/
- if (imagePtr->masterPtr->typePtr->postscriptProc != NULL) {
- return imagePtr->masterPtr->typePtr->postscriptProc(
- imagePtr->masterPtr->masterData, interp, tkwin, psinfo,
+ if (imagePtr->modelPtr->typePtr->postscriptProc != NULL) {
+ return imagePtr->modelPtr->typePtr->postscriptProc(
+ imagePtr->modelPtr->modelData, interp, tkwin, psinfo,
x, y, width, height, prepass);
}
@@ -838,9 +835,9 @@ Tk_RedrawImage(
{
Image *imagePtr = (Image *) image;
- if (imagePtr->masterPtr->typePtr == NULL) {
+ if (imagePtr->modelPtr->typePtr == NULL) {
/*
- * No master for image, so nothing to display.
+ * No model for image, so nothing to display.
*/
return;
@@ -860,13 +857,13 @@ Tk_RedrawImage(
drawableY -= imageY;
imageY = 0;
}
- if ((imageX + width) > imagePtr->masterPtr->width) {
- width = imagePtr->masterPtr->width - imageX;
+ if ((imageX + width) > imagePtr->modelPtr->width) {
+ width = imagePtr->modelPtr->width - imageX;
}
- if ((imageY + height) > imagePtr->masterPtr->height) {
- height = imagePtr->masterPtr->height - imageY;
+ if ((imageY + height) > imagePtr->modelPtr->height) {
+ height = imagePtr->modelPtr->height - imageY;
}
- imagePtr->masterPtr->typePtr->displayProc(imagePtr->instanceData,
+ imagePtr->modelPtr->typePtr->displayProc(imagePtr->instanceData,
imagePtr->display, drawable, imageX, imageY, width, height,
drawableX, drawableY);
}
@@ -896,8 +893,8 @@ Tk_SizeOfImage(
{
Image *imagePtr = (Image *) image;
- *widthPtr = imagePtr->masterPtr->width;
- *heightPtr = imagePtr->masterPtr->height;
+ *widthPtr = imagePtr->modelPtr->width;
+ *heightPtr = imagePtr->modelPtr->height;
}
/*
@@ -934,7 +931,7 @@ Tk_DeleteImage(
if (hPtr == NULL) {
return;
}
- DeleteImage((ImageMaster *)Tcl_GetHashValue(hPtr));
+ DeleteImage((ImageModel *)Tcl_GetHashValue(hPtr));
}
/*
@@ -949,7 +946,7 @@ Tk_DeleteImage(
*
* Side effects:
* The connection is dropped between instances of this image and an image
- * master. Image instances will redisplay themselves as empty areas, but
+ * model. Image instances will redisplay themselves as empty areas, but
* existing instances will not be deleted.
*
*----------------------------------------------------------------------
@@ -957,31 +954,31 @@ Tk_DeleteImage(
static void
DeleteImage(
- ImageMaster *masterPtr) /* Pointer to main data structure for image. */
+ ImageModel *modelPtr) /* Pointer to main data structure for image. */
{
Image *imagePtr;
Tk_ImageType *typePtr;
- typePtr = masterPtr->typePtr;
- masterPtr->typePtr = NULL;
+ typePtr = modelPtr->typePtr;
+ modelPtr->typePtr = NULL;
if (typePtr != NULL) {
- for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
+ for (imagePtr = modelPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
typePtr->freeProc(imagePtr->instanceData, imagePtr->display);
imagePtr->changeProc(imagePtr->widgetClientData, 0, 0,
- masterPtr->width, masterPtr->height, masterPtr->width,
- masterPtr->height);
+ modelPtr->width, modelPtr->height, modelPtr->width,
+ modelPtr->height);
}
- typePtr->deleteProc(masterPtr->masterData);
+ typePtr->deleteProc(modelPtr->modelData);
}
- if (masterPtr->instancePtr == NULL) {
- if (masterPtr->hPtr != NULL) {
- Tcl_DeleteHashEntry(masterPtr->hPtr);
+ if (modelPtr->instancePtr == NULL) {
+ if (modelPtr->hPtr != NULL) {
+ Tcl_DeleteHashEntry(modelPtr->hPtr);
}
- Tcl_Release(masterPtr->winPtr);
- ckfree(masterPtr);
+ Tcl_Release(modelPtr->winPtr);
+ ckfree(modelPtr);
} else {
- masterPtr->deleted = 1;
+ modelPtr->deleted = 1;
}
}
@@ -1005,16 +1002,16 @@ DeleteImage(
static void
EventuallyDeleteImage(
- ImageMaster *masterPtr, /* Pointer to main data structure for image. */
+ ImageModel *modelPtr, /* Pointer to main data structure for image. */
int forgetImageHashNow) /* Flag to say whether the hash table is about
* to vanish. */
{
if (forgetImageHashNow) {
- masterPtr->hPtr = NULL;
+ modelPtr->hPtr = NULL;
}
- if (!masterPtr->deleted) {
- masterPtr->deleted = 1;
- Tcl_EventuallyFree(masterPtr, (Tcl_FreeProc *) DeleteImage);
+ if (!modelPtr->deleted) {
+ modelPtr->deleted = 1;
+ Tcl_EventuallyFree(modelPtr, (Tcl_FreeProc *) DeleteImage);
}
}
@@ -1046,7 +1043,7 @@ TkDeleteAllImages(
for (hPtr = Tcl_FirstHashEntry(&mainPtr->imageTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- EventuallyDeleteImage((ImageMaster *)Tcl_GetHashValue(hPtr), 1);
+ EventuallyDeleteImage((ImageModel *)Tcl_GetHashValue(hPtr), 1);
}
Tcl_DeleteHashTable(&mainPtr->imageTable);
}
@@ -1054,10 +1051,10 @@ TkDeleteAllImages(
/*
*----------------------------------------------------------------------
*
- * Tk_GetImageMasterData --
+ * Tk_GetImageModelData --
*
* Given the name of an image, this function returns the type of the
- * image and the clientData associated with its master.
+ * image and the clientData associated with its model.
*
* Results:
* If there is no image by the given name, then NULL is returned and a
@@ -1072,7 +1069,7 @@ TkDeleteAllImages(
*/
ClientData
-Tk_GetImageMasterData(
+Tk_GetImageModelData(
Tcl_Interp *interp, /* Interpreter in which the image was
* created. */
const char *name, /* Name of image. */
@@ -1082,20 +1079,20 @@ Tk_GetImageMasterData(
{
TkWindow *winPtr = (TkWindow *) Tk_MainWindow(interp);
Tcl_HashEntry *hPtr;
- ImageMaster *masterPtr;
+ ImageModel *modelPtr;
hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->imageTable, name);
if (hPtr == NULL) {
*typePtrPtr = NULL;
return NULL;
}
- masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr);
- if (masterPtr->deleted) {
+ modelPtr = (ImageModel *)Tcl_GetHashValue(hPtr);
+ if (modelPtr->deleted) {
*typePtrPtr = NULL;
return NULL;
}
- *typePtrPtr = masterPtr->typePtr;
- return masterPtr->masterData;
+ *typePtrPtr = modelPtr->typePtr;
+ return modelPtr->modelData;
}
/*
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index a43d2b7..023c14b 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -3,9 +3,9 @@
*
* This procedure implements images of type "bitmap" for Tk.
*
- * Copyright (c) 1994 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1999 by Scriptics Corporation.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -14,12 +14,12 @@
#include "tkInt.h"
/*
- * The following data structure represents the master for a bitmap
+ * The following data structure represents the model for a bitmap
* image:
*/
-typedef struct BitmapMaster {
- Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means the
+typedef struct {
+ Tk_ImageModel tkModel; /* Tk's token for image model. NULL means the
* image is being deleted. */
Tcl_Interp *interp; /* Interpreter for application that is using
* image. */
@@ -40,8 +40,8 @@ typedef struct BitmapMaster {
char *maskDataString; /* Value of -maskdata option (malloc'ed). */
struct BitmapInstance *instancePtr;
/* First in list of all instances associated
- * with this master. */
-} BitmapMaster;
+ * with this model. */
+} BitmapModel;
/*
* The following data structure represents all of the instances of an image
@@ -51,7 +51,7 @@ typedef struct BitmapMaster {
typedef struct BitmapInstance {
size_t refCount; /* Number of instances that share this data
* structure. */
- BitmapMaster *masterPtr; /* Pointer to master for image. */
+ BitmapModel *modelPtr; /* Pointer to model for image. */
Tk_Window tkwin; /* Window in which the instances will be
* displayed. */
XColor *fg; /* Foreground color for displaying image. */
@@ -65,7 +65,7 @@ typedef struct BitmapInstance {
* displayed. */
struct BitmapInstance *nextPtr;
/* Next in list of all instance structures
- * associated with masterPtr (NULL means end
+ * associated with modelPtr (NULL means end
* of list). */
} BitmapInstance;
@@ -76,7 +76,7 @@ typedef struct BitmapInstance {
static int GetByte(Tcl_Channel chan);
static int ImgBmapCreate(Tcl_Interp *interp,
const char *name, int argc, Tcl_Obj *const objv[],
- const Tk_ImageType *typePtr, Tk_ImageMaster master,
+ const Tk_ImageType *typePtr, Tk_ImageModel model,
ClientData *clientDataPtr);
static ClientData ImgBmapGet(Tk_Window tkwin, ClientData clientData);
static void ImgBmapDisplay(ClientData clientData,
@@ -108,17 +108,17 @@ Tk_ImageType tkBitmapImageType = {
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_UID, "-background", NULL, NULL,
- "", offsetof(BitmapMaster, bgUid), 0, NULL},
+ "", offsetof(BitmapModel, bgUid), 0, NULL},
{TK_CONFIG_STRING, "-data", NULL, NULL,
- NULL, offsetof(BitmapMaster, dataString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapModel, dataString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_STRING, "-file", NULL, NULL,
- NULL, offsetof(BitmapMaster, fileString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapModel, fileString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_UID, "-foreground", NULL, NULL,
- "#000000", offsetof(BitmapMaster, fgUid), 0, NULL},
+ "#000000", offsetof(BitmapModel, fgUid), 0, NULL},
{TK_CONFIG_STRING, "-maskdata", NULL, NULL,
- NULL, offsetof(BitmapMaster, maskDataString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapModel, maskDataString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_STRING, "-maskfile", NULL, NULL,
- NULL, offsetof(BitmapMaster, maskFileString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(BitmapModel, maskFileString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -149,7 +149,7 @@ 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,
+static int ImgBmapConfigureModel(BitmapModel *modelPtr,
int argc, Tcl_Obj *const objv[], int flags);
static int NextBitmapWord(ParseInfo *parseInfoPtr);
@@ -178,40 +178,40 @@ ImgBmapCreate(
Tcl_Obj *const argv[], /* Argument objects for options (doesn't
* include image name or type). */
const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */
- Tk_ImageMaster master, /* Token for image, to be used by us in later
+ Tk_ImageModel model, /* 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 = (BitmapMaster *)ckalloc(sizeof(BitmapMaster));
+ BitmapModel *modelPtr = (BitmapModel *)ckalloc(sizeof(BitmapModel));
(void)typePtr;
- masterPtr->tkMaster = master;
- masterPtr->interp = interp;
- masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd,
- masterPtr, ImgBmapCmdDeletedProc);
- masterPtr->width = masterPtr->height = 0;
- masterPtr->data = NULL;
- masterPtr->maskData = NULL;
- masterPtr->fgUid = NULL;
- masterPtr->bgUid = NULL;
- masterPtr->fileString = NULL;
- masterPtr->dataString = NULL;
- masterPtr->maskFileString = NULL;
- masterPtr->maskDataString = NULL;
- masterPtr->instancePtr = NULL;
- if (ImgBmapConfigureMaster(masterPtr, argc, argv, 0) != TCL_OK) {
- ImgBmapDelete(masterPtr);
+ modelPtr->tkModel = model;
+ modelPtr->interp = interp;
+ modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd,
+ modelPtr, ImgBmapCmdDeletedProc);
+ modelPtr->width = modelPtr->height = 0;
+ modelPtr->data = NULL;
+ modelPtr->maskData = NULL;
+ modelPtr->fgUid = NULL;
+ modelPtr->bgUid = NULL;
+ modelPtr->fileString = NULL;
+ modelPtr->dataString = NULL;
+ modelPtr->maskFileString = NULL;
+ modelPtr->maskDataString = NULL;
+ modelPtr->instancePtr = NULL;
+ if (ImgBmapConfigureModel(modelPtr, argc, argv, 0) != TCL_OK) {
+ ImgBmapDelete(modelPtr);
return TCL_ERROR;
}
- *clientDataPtr = masterPtr;
+ *clientDataPtr = modelPtr;
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
- * ImgBmapConfigureMaster --
+ * ImgBmapConfigureModel --
*
* This procedure is called when a bitmap image is created or
* reconfigured. It process configuration options and resets any
@@ -219,7 +219,7 @@ ImgBmapCreate(
*
* Results:
* A standard Tcl return value. If TCL_ERROR is returned then an error
- * message is left in the masterPtr->interp's result.
+ * message is left in the modelPtr->interp's result.
*
* Side effects:
* Existing instances of the image will be redisplayed to match the new
@@ -229,8 +229,8 @@ ImgBmapCreate(
*/
static int
-ImgBmapConfigureMaster(
- BitmapMaster *masterPtr, /* Pointer to data structure describing
+ImgBmapConfigureModel(
+ BitmapModel *modelPtr, /* 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. */
@@ -246,8 +246,8 @@ ImgBmapConfigureMaster(
}
argv[objc] = NULL;
- if (Tk_ConfigureWidget(masterPtr->interp, Tk_MainWindow(masterPtr->interp),
- configSpecs, objc, argv, (char *) masterPtr, flags) != TCL_OK) {
+ if (Tk_ConfigureWidget(modelPtr->interp, Tk_MainWindow(modelPtr->interp),
+ configSpecs, objc, argv, (char *) modelPtr, flags) != TCL_OK) {
ckfree(argv);
return TCL_ERROR;
}
@@ -258,44 +258,44 @@ ImgBmapConfigureMaster(
* bitmap and mask have the same dimensions.
*/
- if (masterPtr->data != NULL) {
- ckfree(masterPtr->data);
- masterPtr->data = NULL;
+ if (modelPtr->data != NULL) {
+ ckfree(modelPtr->data);
+ modelPtr->data = NULL;
}
- if ((masterPtr->fileString != NULL) || (masterPtr->dataString != NULL)) {
- masterPtr->data = TkGetBitmapData(masterPtr->interp,
- masterPtr->dataString, masterPtr->fileString,
- &masterPtr->width, &masterPtr->height, &dummy1, &dummy2);
- if (masterPtr->data == NULL) {
+ if ((modelPtr->fileString != NULL) || (modelPtr->dataString != NULL)) {
+ modelPtr->data = TkGetBitmapData(modelPtr->interp,
+ modelPtr->dataString, modelPtr->fileString,
+ &modelPtr->width, &modelPtr->height, &dummy1, &dummy2);
+ if (modelPtr->data == NULL) {
return TCL_ERROR;
}
}
- if (masterPtr->maskData != NULL) {
- ckfree(masterPtr->maskData);
- masterPtr->maskData = NULL;
+ if (modelPtr->maskData != NULL) {
+ ckfree(modelPtr->maskData);
+ modelPtr->maskData = NULL;
}
- if ((masterPtr->maskFileString != NULL)
- || (masterPtr->maskDataString != NULL)) {
- if (masterPtr->data == NULL) {
- Tcl_SetObjResult(masterPtr->interp, Tcl_NewStringObj(
+ if ((modelPtr->maskFileString != NULL)
+ || (modelPtr->maskDataString != NULL)) {
+ if (modelPtr->data == NULL) {
+ Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj(
"can't have mask without bitmap", -1));
- Tcl_SetErrorCode(masterPtr->interp, "TK", "IMAGE", "BITMAP",
+ Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP",
"NO_BITMAP", NULL);
return TCL_ERROR;
}
- masterPtr->maskData = TkGetBitmapData(masterPtr->interp,
- masterPtr->maskDataString, masterPtr->maskFileString,
+ modelPtr->maskData = TkGetBitmapData(modelPtr->interp,
+ modelPtr->maskDataString, modelPtr->maskFileString,
&maskWidth, &maskHeight, &dummy1, &dummy2);
- if (masterPtr->maskData == NULL) {
+ if (modelPtr->maskData == NULL) {
return TCL_ERROR;
}
- if ((maskWidth != masterPtr->width)
- || (maskHeight != masterPtr->height)) {
- ckfree(masterPtr->maskData);
- masterPtr->maskData = NULL;
- Tcl_SetObjResult(masterPtr->interp, Tcl_NewStringObj(
+ if ((maskWidth != modelPtr->width)
+ || (maskHeight != modelPtr->height)) {
+ ckfree(modelPtr->maskData);
+ modelPtr->maskData = NULL;
+ Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj(
"bitmap and mask have different sizes", -1));
- Tcl_SetErrorCode(masterPtr->interp, "TK", "IMAGE", "BITMAP",
+ Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP",
"MASK_SIZE", NULL);
return TCL_ERROR;
}
@@ -307,12 +307,12 @@ ImgBmapConfigureMaster(
* everywhere that it is used.
*/
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
ImgBmapConfigureInstance(instancePtr);
}
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width,
- masterPtr->height, masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, modelPtr->width,
+ modelPtr->height, modelPtr->width, modelPtr->height);
return TCL_OK;
}
@@ -322,8 +322,8 @@ ImgBmapConfigureMaster(
* 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
+ * image instance based on the configuration information in the model.
+ * It is invoked both when new instances are created and when the model
* is reconfigured.
*
* Results:
@@ -340,7 +340,7 @@ static void
ImgBmapConfigureInstance(
BitmapInstance *instancePtr)/* Instance to reconfigure. */
{
- BitmapMaster *masterPtr = instancePtr->masterPtr;
+ BitmapModel *modelPtr = instancePtr->modelPtr;
XColor *colorPtr;
XGCValues gcValues;
GC gc;
@@ -348,13 +348,13 @@ ImgBmapConfigureInstance(
Pixmap oldBitmap, oldMask;
/*
- * For each of the options in masterPtr, translate the string form into an
+ * For each of the options in modelPtr, translate the string form into an
* internal form appropriate for instancePtr.
*/
- if (*masterPtr->bgUid != 0) {
- colorPtr = Tk_GetColor(masterPtr->interp, instancePtr->tkwin,
- masterPtr->bgUid);
+ if (*modelPtr->bgUid != 0) {
+ colorPtr = Tk_GetColor(modelPtr->interp, instancePtr->tkwin,
+ modelPtr->bgUid);
if (colorPtr == NULL) {
goto error;
}
@@ -366,8 +366,8 @@ ImgBmapConfigureInstance(
}
instancePtr->bg = colorPtr;
- colorPtr = Tk_GetColor(masterPtr->interp, instancePtr->tkwin,
- masterPtr->fgUid);
+ colorPtr = Tk_GetColor(modelPtr->interp, instancePtr->tkwin,
+ modelPtr->fgUid);
if (colorPtr == NULL) {
goto error;
}
@@ -388,19 +388,19 @@ ImgBmapConfigureInstance(
oldMask = instancePtr->mask;
instancePtr->mask = None;
- if (masterPtr->data != NULL) {
+ if (modelPtr->data != NULL) {
instancePtr->bitmap = XCreateBitmapFromData(
Tk_Display(instancePtr->tkwin),
RootWindowOfScreen(Tk_Screen(instancePtr->tkwin)),
- masterPtr->data, (unsigned) masterPtr->width,
- (unsigned) masterPtr->height);
+ modelPtr->data, (unsigned) modelPtr->width,
+ (unsigned) modelPtr->height);
}
- if (masterPtr->maskData != NULL) {
+ if (modelPtr->maskData != NULL) {
instancePtr->mask = XCreateBitmapFromData(
Tk_Display(instancePtr->tkwin),
RootWindowOfScreen(Tk_Screen(instancePtr->tkwin)),
- masterPtr->maskData, (unsigned) masterPtr->width,
- (unsigned) masterPtr->height);
+ modelPtr->maskData, (unsigned) modelPtr->width,
+ (unsigned) modelPtr->height);
}
if (oldMask != None) {
@@ -410,7 +410,7 @@ ImgBmapConfigureInstance(
Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldBitmap);
}
- if (masterPtr->data != NULL) {
+ if (modelPtr->data != NULL) {
gcValues.foreground = instancePtr->fg->pixel;
gcValues.graphics_exposures = False;
mask = GCForeground|GCGraphicsExposures;
@@ -445,10 +445,10 @@ ImgBmapConfigureInstance(
Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc);
}
instancePtr->gc = NULL;
- Tcl_AppendObjToErrorInfo(masterPtr->interp, Tcl_ObjPrintf(
+ Tcl_AppendObjToErrorInfo(modelPtr->interp, Tcl_ObjPrintf(
"\n (while configuring image \"%s\")", Tk_NameOfImage(
- masterPtr->tkMaster)));
- Tcl_BackgroundException(masterPtr->interp, TCL_ERROR);
+ modelPtr->tkModel)));
+ Tcl_BackgroundException(modelPtr->interp, TCL_ERROR);
}
/*
@@ -751,13 +751,13 @@ NextBitmapWord(
static int
ImgBmapCmd(
- ClientData clientData, /* Information about the image master. */
+ ClientData clientData, /* Information about the image model. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
static const char *const bmapOptions[] = {"cget", "configure", NULL};
- BitmapMaster *masterPtr = (BitmapMaster *)clientData;
+ BitmapModel *modelPtr = (BitmapModel *)clientData;
int index;
if (objc < 2) {
@@ -775,17 +775,17 @@ ImgBmapCmd(
return TCL_ERROR;
}
return Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs,
- (char *) masterPtr, Tcl_GetString(objv[2]), 0);
+ (char *) modelPtr, Tcl_GetString(objv[2]), 0);
case 1: /* configure */
if (objc == 2) {
return Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr, NULL, 0);
+ configSpecs, (char *) modelPtr, NULL, 0);
} else if (objc == 3) {
return Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr,
+ configSpecs, (char *) modelPtr,
Tcl_GetString(objv[2]), 0);
} else {
- return ImgBmapConfigureMaster(masterPtr, objc-2, objv+2,
+ return ImgBmapConfigureModel(modelPtr, objc-2, objv+2,
TK_CONFIG_ARGV_ONLY);
}
default:
@@ -816,10 +816,10 @@ static ClientData
ImgBmapGet(
Tk_Window tkwin, /* Window in which the instance will be
* used. */
- ClientData masterData) /* Pointer to our master structure for the
+ ClientData modelData) /* Pointer to our model structure for the
* image. */
{
- BitmapMaster *masterPtr = (BitmapMaster *)masterData;
+ BitmapModel *modelPtr = (BitmapModel *)modelData;
BitmapInstance *instancePtr;
/*
@@ -827,7 +827,7 @@ ImgBmapGet(
* re-use it.
*/
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
if (instancePtr->tkwin == tkwin) {
instancePtr->refCount++;
@@ -842,15 +842,15 @@ ImgBmapGet(
instancePtr = (BitmapInstance *)ckalloc(sizeof(BitmapInstance));
instancePtr->refCount = 1;
- instancePtr->masterPtr = masterPtr;
+ instancePtr->modelPtr = modelPtr;
instancePtr->tkwin = tkwin;
instancePtr->fg = NULL;
instancePtr->bg = NULL;
instancePtr->bitmap = None;
instancePtr->mask = None;
instancePtr->gc = NULL;
- instancePtr->nextPtr = masterPtr->instancePtr;
- masterPtr->instancePtr = instancePtr;
+ instancePtr->nextPtr = modelPtr->instancePtr;
+ modelPtr->instancePtr = instancePtr;
ImgBmapConfigureInstance(instancePtr);
/*
@@ -858,8 +858,8 @@ ImgBmapGet(
*/
if (instancePtr->nextPtr == NULL) {
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, masterPtr->width,
- masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width,
+ modelPtr->height);
}
return instancePtr;
@@ -975,10 +975,10 @@ ImgBmapFree(
if (instancePtr->gc != NULL) {
Tk_FreeGC(display, instancePtr->gc);
}
- if (instancePtr->masterPtr->instancePtr == instancePtr) {
- instancePtr->masterPtr->instancePtr = instancePtr->nextPtr;
+ if (instancePtr->modelPtr->instancePtr == instancePtr) {
+ instancePtr->modelPtr->instancePtr = instancePtr->nextPtr;
} else {
- for (prevPtr = instancePtr->masterPtr->instancePtr;
+ for (prevPtr = instancePtr->modelPtr->instancePtr;
prevPtr->nextPtr != instancePtr; prevPtr = prevPtr->nextPtr) {
/* Empty loop body */
}
@@ -992,7 +992,7 @@ ImgBmapFree(
*
* ImgBmapDelete --
*
- * This procedure is called by the image code to delete the master
+ * This procedure is called by the image code to delete the model
* structure for an image.
*
* Results:
@@ -1006,26 +1006,26 @@ ImgBmapFree(
static void
ImgBmapDelete(
- ClientData masterData) /* Pointer to BitmapMaster structure for
+ ClientData modelData) /* Pointer to BitmapModel structure for
* image. Must not have any more instances. */
{
- BitmapMaster *masterPtr = (BitmapMaster *)masterData;
+ BitmapModel *modelPtr = (BitmapModel *)modelData;
- if (masterPtr->instancePtr != NULL) {
+ if (modelPtr->instancePtr != NULL) {
Tcl_Panic("tried to delete bitmap image when instances still exist");
}
- masterPtr->tkMaster = NULL;
- if (masterPtr->imageCmd != NULL) {
- Tcl_DeleteCommandFromToken(masterPtr->interp, masterPtr->imageCmd);
+ modelPtr->tkModel = NULL;
+ if (modelPtr->imageCmd != NULL) {
+ Tcl_DeleteCommandFromToken(modelPtr->interp, modelPtr->imageCmd);
}
- if (masterPtr->data != NULL) {
- ckfree(masterPtr->data);
+ if (modelPtr->data != NULL) {
+ ckfree(modelPtr->data);
}
- if (masterPtr->maskData != NULL) {
- ckfree(masterPtr->maskData);
+ if (modelPtr->maskData != NULL) {
+ ckfree(modelPtr->maskData);
}
- Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0);
- ckfree(masterPtr);
+ Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0);
+ ckfree(modelPtr);
}
/*
@@ -1047,14 +1047,14 @@ ImgBmapDelete(
static void
ImgBmapCmdDeletedProc(
- ClientData clientData) /* Pointer to BitmapMaster structure for
+ ClientData clientData) /* Pointer to BitmapModel structure for
* image. */
{
- BitmapMaster *masterPtr = (BitmapMaster *)clientData;
+ BitmapModel *modelPtr = (BitmapModel *)clientData;
- masterPtr->imageCmd = NULL;
- if (masterPtr->tkMaster != NULL) {
- Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster));
+ modelPtr->imageCmd = NULL;
+ if (modelPtr->tkModel != NULL) {
+ Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkModel));
}
}
@@ -1082,7 +1082,7 @@ GetByte(
size_t size;
size = Tcl_Read(chan, &buffer, 1);
- if ((size + 1) < 2) {
+ if (size != 1) {
return EOF;
} else {
return buffer;
@@ -1197,7 +1197,7 @@ ImgBmapPostscript(
int x, int y, int width, int height,
int prepass)
{
- BitmapMaster *masterPtr = (BitmapMaster *)clientData;
+ BitmapModel *modelPtr = (BitmapModel *)clientData;
Tcl_InterpState interpState;
Tcl_Obj *psObj;
@@ -1209,7 +1209,7 @@ ImgBmapPostscript(
* 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 || modelPtr->width<=0 || modelPtr->height<=0){
return TCL_OK;
}
@@ -1219,7 +1219,7 @@ ImgBmapPostscript(
* we bail out.
*/
- if (masterPtr->width*masterPtr->height > 60000) {
+ if (modelPtr->width*modelPtr->height > 60000) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"unable to generate postscript for bitmaps larger than 60000"
" pixels", -1));
@@ -1258,10 +1258,10 @@ ImgBmapPostscript(
* color to the bits specified by the mask.
*/
- if ((masterPtr->bgUid != NULL) && (masterPtr->bgUid[0] != '\000')) {
+ if ((modelPtr->bgUid != NULL) && (modelPtr->bgUid[0] != '\000')) {
XColor color;
- TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), masterPtr->bgUid,
+ TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), modelPtr->bgUid,
&color);
Tcl_ResetResult(interp);
if (Tk_PostscriptColor(interp, psinfo, &color) != TCL_OK) {
@@ -1269,13 +1269,13 @@ ImgBmapPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- if (masterPtr->maskData == NULL) {
+ if (modelPtr->maskData == NULL) {
Tcl_AppendToObj(psObj,
"0 0 moveto 1 0 rlineto 0 1 rlineto -1 0 rlineto "
"closepath fill\n", -1);
} else {
- ImgBmapPsImagemask(psObj, masterPtr->width, masterPtr->height,
- masterPtr->maskData);
+ ImgBmapPsImagemask(psObj, modelPtr->width, modelPtr->height,
+ modelPtr->maskData);
}
}
@@ -1283,10 +1283,10 @@ ImgBmapPostscript(
* Draw the bitmap foreground, assuming there is one.
*/
- if ((masterPtr->fgUid != NULL) && (masterPtr->data != NULL)) {
+ if ((modelPtr->fgUid != NULL) && (modelPtr->data != NULL)) {
XColor color;
- TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), masterPtr->fgUid,
+ TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), modelPtr->fgUid,
&color);
Tcl_ResetResult(interp);
if (Tk_PostscriptColor(interp, psinfo, &color) != TCL_OK) {
@@ -1294,8 +1294,8 @@ ImgBmapPostscript(
}
Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp));
- ImgBmapPsImagemask(psObj, masterPtr->width, masterPtr->height,
- masterPtr->data);
+ ImgBmapPsImagemask(psObj, modelPtr->width, modelPtr->height,
+ modelPtr->data);
}
/*
diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c
index 79e778b..588ca97 100644
--- a/generic/tkImgGIF.c
+++ b/generic/tkImgGIF.c
@@ -8,10 +8,10 @@
* 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-2010 Donal K. Fellows
+ * Copyright © Reed Wade (wade@cs.utk.edu), University of Tennessee
+ * Copyright © 1995-1997 Sun Microsystems, Inc.
+ * Copyright © 1997 Australian National University
+ * Copyright © 2005-2010 Donal K. Fellows
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -854,7 +854,7 @@ StringMatchGIF(
TkSizeT got, length;
MFile handle;
- data = TkGetByteArrayFromObj(dataObj, &length);
+ data = Tcl_GetByteArrayFromObj(dataObj, &length);
/*
* Header is a minimum of 10 bytes.
@@ -924,7 +924,7 @@ StringReadGIF(
MFile handle, *hdlPtr = &handle;
TkSizeT length;
const char *xferFormat;
- unsigned char *data = TkGetByteArrayFromObj(dataObj, &length);
+ unsigned char *data = Tcl_GetByteArrayFromObj(dataObj, &length);
mInit(data, hdlPtr, length);
diff --git a/generic/tkImgListFormat.c b/generic/tkImgListFormat.c
index 70efc96..98a56cf 100644
--- a/generic/tkImgListFormat.c
+++ b/generic/tkImgListFormat.c
@@ -12,10 +12,10 @@
* data only.
*
*
- * Copyright (c) 1994 The Australian National University.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 2002-2003 Donal K. Fellows
- * Copyright (c) 2003 ActiveState Corporation.
+ * Copyright © 1994 The Australian National University.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2002-2003 Donal K. Fellows
+ * Copyright © 2003 ActiveState Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -781,7 +781,7 @@ ParseColor(
* Find out which color format we have
*/
- specString = TkGetStringFromObj(specObj, &charCount);
+ specString = Tcl_GetStringFromObj(specObj, &charCount);
if (charCount == 0) {
/* Empty string */
diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c
index 316e58b..5e802d5 100644
--- a/generic/tkImgPNG.c
+++ b/generic/tkImgPNG.c
@@ -3,8 +3,8 @@
*
* A Tk photo image file handler for PNG files.
*
- * Copyright (c) 2006-2008 Muonics, Inc.
- * Copyright (c) 2008 Donal K. Fellows
+ * Copyright © 2006-2008 Muonics, Inc.
+ * Copyright © 2008 Donal K. Fellows
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -336,7 +336,7 @@ InitPNGImage(
Tcl_IncrRefCount(objPtr);
pngPtr->objDataPtr = objPtr;
pngPtr->strDataBuf =
- TkGetByteArrayFromObj(objPtr, &pngPtr->strDataLen);
+ Tcl_GetByteArrayFromObj(objPtr, &pngPtr->strDataLen);
}
/*
@@ -647,10 +647,10 @@ ReadData(
}
while (destSz) {
- size_t blockSz = PNG_MIN(destSz, PNG_BLOCK_SZ);
+ TkSizeT blockSz = PNG_MIN(destSz, PNG_BLOCK_SZ);
- blockSz = (size_t)Tcl_Read(pngPtr->channel, (char *)destPtr, blockSz);
- if (blockSz == (size_t)-1) {
+ blockSz = Tcl_Read(pngPtr->channel, (char *)destPtr, blockSz);
+ if (blockSz == TCL_IO_FAILURE) {
/* TODO: failure info... */
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"channel read failed: %s", Tcl_PosixError(interp)));
@@ -1287,7 +1287,7 @@ ReadIHDR(
*/
if (mismatch && pngPtr->strDataBuf) {
- pngPtr->strDataBuf = TkGetByteArrayFromObj(pngPtr->objDataPtr,
+ pngPtr->strDataBuf = Tcl_GetByteArrayFromObj(pngPtr->objDataPtr,
&pngPtr->strDataLen);
pngPtr->base64Data = pngPtr->strDataBuf;
@@ -1810,9 +1810,9 @@ UnfilterLine(
PNGImage *pngPtr)
{
unsigned char *thisLine =
- Tcl_GetByteArrayFromObj(pngPtr->thisLineObj, NULL);
+ Tcl_GetByteArrayFromObj(pngPtr->thisLineObj, (int *)NULL);
unsigned char *lastLine =
- Tcl_GetByteArrayFromObj(pngPtr->lastLineObj, NULL);
+ Tcl_GetByteArrayFromObj(pngPtr->lastLineObj, (int *)NULL);
#define PNG_FILTER_NONE 0
#define PNG_FILTER_SUB 1
@@ -1942,7 +1942,7 @@ DecodeLine(
int colStep = 1; /* Column increment each pass */
int pixStep = 0; /* extra pixelPtr increment each pass */
unsigned char lastPixel[6];
- unsigned char *p = Tcl_GetByteArrayFromObj(pngPtr->thisLineObj, NULL);
+ unsigned char *p = Tcl_GetByteArrayFromObj(pngPtr->thisLineObj, (int *)NULL);
p++;
if (UnfilterLine(interp, pngPtr) == TCL_ERROR) {
@@ -2248,12 +2248,12 @@ ReadIDAT(
*/
getNextLine:
- TkGetByteArrayFromObj(pngPtr->thisLineObj, &len1);
+ Tcl_GetByteArrayFromObj(pngPtr->thisLineObj, &len1);
if (Tcl_ZlibStreamGet(pngPtr->stream, pngPtr->thisLineObj,
pngPtr->phaseSize - len1) == TCL_ERROR) {
return TCL_ERROR;
}
- TkGetByteArrayFromObj(pngPtr->thisLineObj, &len2);
+ Tcl_GetByteArrayFromObj(pngPtr->thisLineObj, &len2);
if (len2 == (TkSizeT)pngPtr->phaseSize) {
if (pngPtr->phase > 7) {
@@ -2397,7 +2397,7 @@ ParseFormat(
static const char *const fmtOptions[] = {
"-alpha", NULL
};
- enum fmtOptions {
+ enum fmtOptionsEnum {
OPT_ALPHA
};
@@ -2434,7 +2434,7 @@ ParseFormat(
objc--;
objv++;
- switch ((enum fmtOptions) optIndex) {
+ switch ((enum fmtOptionsEnum) optIndex) {
case OPT_ALPHA:
if (Tcl_GetDoubleFromObj(interp, objv[0],
&pngPtr->alpha) == TCL_ERROR) {
@@ -2936,7 +2936,7 @@ StringMatchPNG(
InitPNGImage(NULL, &png, NULL, pObjData, TCL_ZLIB_STREAM_INFLATE);
- png.strDataBuf = TkGetByteArrayFromObj(pObjData, &png.strDataLen);
+ png.strDataBuf = Tcl_GetByteArrayFromObj(pObjData, &png.strDataLen);
if (ReadIHDR(interp, &png) == TCL_OK) {
*widthPtr = png.block.width;
@@ -3047,7 +3047,7 @@ WriteData(
TkSizeT objSz;
unsigned char *destPtr;
- TkGetByteArrayFromObj(pngPtr->objDataPtr, &objSz);
+ Tcl_GetByteArrayFromObj(pngPtr->objDataPtr, &objSz);
if (objSz + srcSz > INT_MAX) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -3431,7 +3431,7 @@ WriteIDAT(
outputObj = Tcl_NewObj();
(void) Tcl_ZlibStreamGet(pngPtr->stream, outputObj, -1);
- outputBytes = TkGetByteArrayFromObj(outputObj, &outputSize);
+ outputBytes = Tcl_GetByteArrayFromObj(outputObj, &outputSize);
result = WriteChunk(interp, pngPtr, CHUNK_IDAT, outputBytes, outputSize);
Tcl_DecrRefCount(outputObj);
return result;
diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c
index 91d809b..6a4426b 100644
--- a/generic/tkImgPPM.c
+++ b/generic/tkImgPPM.c
@@ -3,8 +3,8 @@
*
* A photo image file handler for PPM (Portable PixMap) files.
*
- * Copyright (c) 1994 The Australian National University.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1994 The Australian National University.
+ * Copyright © 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.
@@ -94,18 +94,15 @@ static int ReadPPMStringHeader(Tcl_Obj *dataObj, int *widthPtr,
static int
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. */
+ TCL_UNUSED(const char *), /* The name of the image file. */
+ TCL_UNUSED(Tcl_Obj *), /* 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 */
+ TCL_UNUSED(Tcl_Interp *)) /* unused */
{
int dummy;
- (void)fileName;
- (void)format;
- (void)interp;
return ReadPPMFileHeader(chan, widthPtr, heightPtr, &dummy);
}
@@ -134,7 +131,7 @@ 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. */
+ TCL_UNUSED(Tcl_Obj *), /* 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. */
@@ -148,7 +145,6 @@ FileReadPPM(
size_t nBytes, count;
unsigned char *pixelPtr;
Tk_PhotoImageBlock block;
- (void)format;
type = ReadPPMFileHeader(chan, &fileWidth, &fileHeight, &maxIntensity);
if (type == 0) {
@@ -205,7 +201,7 @@ FileReadPPM(
}
if (srcY > 0) {
- Tcl_Seek(chan, (Tcl_WideInt)(srcY * block.pitch), SEEK_CUR);
+ Tcl_Seek(chan, (long long)srcY * block.pitch, SEEK_CUR);
}
nLines = (MAX_MEMORY + block.pitch - 1) / block.pitch;
@@ -286,7 +282,7 @@ static int
FileWritePPM(
Tcl_Interp *interp,
const char *fileName,
- Tcl_Obj *format,
+ TCL_UNUSED(Tcl_Obj *),
Tk_PhotoImageBlock *blockPtr)
{
Tcl_Channel chan;
@@ -294,7 +290,6 @@ FileWritePPM(
size_t nBytes;
unsigned char *pixelPtr, *pixLinePtr;
char header[16 + TCL_INTEGER_SPACE * 2];
- (void)format;
chan = Tcl_OpenFileChannel(interp, fileName, "w", 0666);
if (chan == NULL) {
@@ -375,14 +370,13 @@ FileWritePPM(
static int
StringWritePPM(
Tcl_Interp *interp,
- Tcl_Obj *format,
+ TCL_UNUSED(Tcl_Obj *),
Tk_PhotoImageBlock *blockPtr)
{
int w, h, size, greenOffset, blueOffset;
unsigned char *pixLinePtr, *byteArray;
char header[16 + TCL_INTEGER_SPACE * 2];
Tcl_Obj *byteArrayObj;
- (void)format;
sprintf(header, "P6\n%d %d\n255\n", blockPtr->width, blockPtr->height);
@@ -452,16 +446,14 @@ StringWritePPM(
static int
StringMatchPPM(
Tcl_Obj *dataObj, /* The image data. */
- Tcl_Obj *format, /* User-specified format string, or NULL. */
+ TCL_UNUSED(Tcl_Obj *), /* 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 */
+ TCL_UNUSED(Tcl_Interp *)) /* unused */
{
int dummy;
- (void)format;
- (void)interp;
return ReadPPMStringHeader(dataObj, widthPtr, heightPtr,
&dummy, NULL, NULL);
@@ -489,7 +481,7 @@ static int
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. */
+ TCL_UNUSED(Tcl_Obj *), /* 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. */
@@ -502,7 +494,6 @@ StringReadPPM(
int nLines, nBytes, h, type, count, dataSize, bytesPerChannel = 1;
unsigned char *pixelPtr, *dataBuffer;
Tk_PhotoImageBlock block;
- (void)format;
type = ReadPPMStringHeader(dataObj, &fileWidth, &fileHeight,
&maxIntensity, &dataBuffer, &dataSize);
@@ -611,7 +602,6 @@ StringReadPPM(
*p = (((int) *dataBuffer) * 255)/maxIntensity;
}
} else {
- unsigned char *p;
unsigned int value;
for (p = pixelPtr,count=nBytes; count > 1; count-=2, p += 2) {
@@ -777,7 +767,7 @@ ReadPPMStringHeader(
TkSizeT dataSize;
unsigned char *dataBuffer;
- dataBuffer = TkGetByteArrayFromObj(dataPtr, &dataSize);
+ dataBuffer = Tcl_GetByteArrayFromObj(dataPtr, &dataSize);
/*
* Read 4 space-separated fields from the string, ignoring comments (any
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c
index 81b196c..d8244de 100644
--- a/generic/tkImgPhInstance.c
+++ b/generic/tkImgPhInstance.c
@@ -5,10 +5,10 @@
* 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-2008 Donal K. Fellows
- * Copyright (c) 2003 ActiveState Corporation.
+ * Copyright © 1994 The Australian National University.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2002-2008 Donal K. Fellows
+ * Copyright © 2003 ActiveState Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -19,9 +19,7 @@
*/
#include "tkImgPhoto.h"
-#ifdef MAC_OSX_TK
-#define TKPUTIMAGE_CAN_BLEND
-#endif
+#include "tkPort.h"
/*
* Declaration for internal Xlib function used here:
@@ -46,7 +44,7 @@ static void BlendComplexAlpha(XImage *bgImg, PhotoInstance *iPtr,
#endif
static int IsValidPalette(PhotoInstance *instancePtr,
const char *palette);
-static int CountBits(pixel mask);
+static int CountBits(unsigned mask);
static void GetColorTable(PhotoInstance *instancePtr);
static void FreeColorTable(ColorTable *colorPtr, int force);
static void AllocateColors(ColorTable *colorPtr);
@@ -68,8 +66,8 @@ static int imgPhotoColorHashInitialized;
* TkImgPhotoConfigureInstance --
*
* 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
+ * image instance based on the configuration information in the model.
+ * It is invoked both when new instances are created and when the model
* is reconfigured.
*
* Results:
@@ -86,25 +84,25 @@ void
TkImgPhotoConfigureInstance(
PhotoInstance *instancePtr) /* Instance to reconfigure. */
{
- PhotoMaster *masterPtr = instancePtr->masterPtr;
+ PhotoModel *modelPtr = instancePtr->modelPtr;
XImage *imagePtr;
int bitsPerPixel;
ColorTable *colorTablePtr;
XRectangle validBox;
/*
- * If the -palette configuration option has been set for the master, use
+ * If the -palette configuration option has been set for the model, 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.
+ * for our windows. Use the gamma value specified the model.
*/
- if ((masterPtr->palette && masterPtr->palette[0])
- && IsValidPalette(instancePtr, masterPtr->palette)) {
- instancePtr->palette = masterPtr->palette;
+ if ((modelPtr->palette && modelPtr->palette[0])
+ && IsValidPalette(instancePtr, modelPtr->palette)) {
+ instancePtr->palette = modelPtr->palette;
} else {
instancePtr->palette = instancePtr->defaultPalette;
}
- instancePtr->gamma = masterPtr->gamma;
+ instancePtr->gamma = modelPtr->gamma;
/*
* If we don't currently have a color table, or if the one we have no
@@ -168,15 +166,15 @@ TkImgPhotoConfigureInstance(
}
/*
- * If the user has specified a width and/or height for the master which is
+ * If the user has specified a width and/or height for the model 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)
- || (instancePtr->width != masterPtr->width)
- || (instancePtr->height != masterPtr->height)) {
+ || (instancePtr->width != modelPtr->width)
+ || (instancePtr->height != modelPtr->height)) {
TkImgPhotoInstanceSetSize(instancePtr);
}
@@ -184,9 +182,9 @@ TkImgPhotoConfigureInstance(
* Redither this instance if necessary.
*/
- if ((masterPtr->flags & IMAGE_CHANGED)
+ if ((modelPtr->flags & IMAGE_CHANGED)
|| (instancePtr->colorTablePtr != colorTablePtr)) {
- TkClipBox(masterPtr->validRegion, &validBox);
+ TkClipBox(modelPtr->validRegion, &validBox);
if ((validBox.width > 0) && (validBox.height > 0)) {
TkImgDitherInstance(instancePtr, validBox.x, validBox.y,
validBox.width, validBox.height);
@@ -216,10 +214,10 @@ ClientData
TkImgPhotoGet(
Tk_Window tkwin, /* Window in which the instance will be
* used. */
- ClientData masterData) /* Pointer to our master structure for the
+ ClientData modelData) /* Pointer to our model structure for the
* image. */
{
- PhotoMaster *masterPtr = (PhotoMaster *)masterData;
+ PhotoModel *modelPtr = (PhotoModel *)modelData;
PhotoInstance *instancePtr;
Colormap colormap;
int mono, nRed, nGreen, nBlue, numVisuals;
@@ -256,7 +254,7 @@ TkImgPhotoGet(
*/
colormap = Tk_Colormap(tkwin);
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
if ((colormap == instancePtr->colormap)
&& (Tk_Display(tkwin) == instancePtr->display)) {
@@ -286,7 +284,7 @@ TkImgPhotoGet(
*/
instancePtr = (PhotoInstance *)ckalloc(sizeof(PhotoInstance));
- instancePtr->masterPtr = masterPtr;
+ instancePtr->modelPtr = modelPtr;
instancePtr->display = Tk_Display(tkwin);
instancePtr->colormap = Tk_Colormap(tkwin);
Tk_PreserveColormap(instancePtr->display, instancePtr->colormap);
@@ -297,8 +295,8 @@ TkImgPhotoGet(
instancePtr->width = 0;
instancePtr->height = 0;
instancePtr->imagePtr = 0;
- instancePtr->nextPtr = masterPtr->instancePtr;
- masterPtr->instancePtr = instancePtr;
+ instancePtr->nextPtr = modelPtr->instancePtr;
+ modelPtr->instancePtr = instancePtr;
/*
* Obtain information about the visual and decide on the default palette.
@@ -358,8 +356,8 @@ TkImgPhotoGet(
* Make a GC with background = black and foreground = white.
*/
- white = Tk_GetColor(masterPtr->interp, tkwin, "white");
- black = Tk_GetColor(masterPtr->interp, tkwin, "black");
+ white = Tk_GetColor(modelPtr->interp, tkwin, "white");
+ black = Tk_GetColor(modelPtr->interp, tkwin, "black");
gcValues.foreground = (white != NULL)? white->pixel:
WhitePixelOfScreen(Tk_Screen(tkwin));
gcValues.background = (black != NULL)? black->pixel:
@@ -382,8 +380,8 @@ TkImgPhotoGet(
*/
if (instancePtr->nextPtr == NULL) {
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0,
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0,
+ modelPtr->width, modelPtr->height);
}
return instancePtr;
@@ -416,9 +414,6 @@ TkImgPhotoGet(
*
* Note that Win32 pre-defines those operations that we really need.
*
- * Note that on MacOS, if the background comes from a Retina display
- * then it will be twice as wide and twice as high as the photoimage.
- *
*----------------------------------------------------------------------
*/
#ifndef TKPUTIMAGE_CAN_BLEND
@@ -446,8 +441,8 @@ BlendComplexAlpha(
{
int x, y, line;
unsigned long pixel;
- unsigned char r, g, b, alpha, unalpha, *masterPtr;
- unsigned char *alphaAr = iPtr->masterPtr->pix32;
+ unsigned char r, g, b, alpha, unalpha, *modelPtr;
+ unsigned char *alphaAr = iPtr->modelPtr->pix32;
/*
* This blending is an integer version of the Source-Over compositing rule
@@ -504,10 +499,10 @@ BlendComplexAlpha(
green_mlen = 8 - CountBits(green_mask >> green_shift);
blue_mlen = 8 - CountBits(blue_mask >> blue_shift);
for (y = 0; y < height; y++) {
- line = (y + yOffset) * iPtr->masterPtr->width;
+ line = (y + yOffset) * iPtr->modelPtr->width;
for (x = 0; x < width; x++) {
- masterPtr = alphaAr + ((line + x + xOffset) * 4);
- alpha = masterPtr[3];
+ modelPtr = alphaAr + ((line + x + xOffset) * 4);
+ alpha = modelPtr[3];
/*
* Ignore pixels that are fully transparent
@@ -519,9 +514,9 @@ BlendComplexAlpha(
* 24 and 32 bit displays, but this seems "fast enough".
*/
- r = masterPtr[0];
- g = masterPtr[1];
- b = masterPtr[2];
+ r = modelPtr[0];
+ g = modelPtr[1];
+ b = modelPtr[2];
if (alpha != 255) {
/*
* Only blend pixels that have some transparency
@@ -547,10 +542,10 @@ BlendComplexAlpha(
#endif /* !_WIN32 */
for (y = 0; y < height; y++) {
- line = (y + yOffset) * iPtr->masterPtr->width;
+ line = (y + yOffset) * iPtr->modelPtr->width;
for (x = 0; x < width; x++) {
- masterPtr = alphaAr + ((line + x + xOffset) * 4);
- alpha = masterPtr[3];
+ modelPtr = alphaAr + ((line + x + xOffset) * 4);
+ alpha = modelPtr[3];
/*
* Ignore pixels that are fully transparent
@@ -562,9 +557,9 @@ BlendComplexAlpha(
* and 32 bit displays, but this seems "fast enough".
*/
- r = masterPtr[0];
- g = masterPtr[1];
- b = masterPtr[2];
+ r = modelPtr[0];
+ g = modelPtr[1];
+ b = modelPtr[2];
if (alpha != 255) {
/*
* Only blend pixels that have some transparency
@@ -638,7 +633,7 @@ TkImgPhotoDisplay(
* no need to call XGetImage or to do the Porter-Duff compositing by hand.
*/
- unsigned char *rgbaPixels = instancePtr->masterPtr->pix32;
+ unsigned char *rgbaPixels = instancePtr->modelPtr->pix32;
XImage *photo = XCreateImage(display, NULL, 32, ZPixmap, 0, (char*)rgbaPixels,
(unsigned int)instancePtr->width,
(unsigned int)instancePtr->height,
@@ -650,7 +645,7 @@ TkImgPhotoDisplay(
XDestroyImage(photo);
#else
- if ((instancePtr->masterPtr->flags & COMPLEX_ALPHA)
+ if ((instancePtr->modelPtr->flags & COMPLEX_ALPHA)
&& visInfo.depth >= 15
&& (visInfo.c_class == DirectColor || visInfo.c_class == TrueColor)) {
Tk_ErrorHandler handler;
@@ -691,14 +686,14 @@ TkImgPhotoDisplay(
Tk_DeleteErrorHandler(handler);
} else {
/*
- * masterPtr->region describes which parts of the image contain valid
+ * modelPtr->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.
*/
fallBack:
TkSetRegion(display, instancePtr->gc,
- instancePtr->masterPtr->validRegion);
+ instancePtr->modelPtr->validRegion);
XSetClipOrigin(display, instancePtr->gc, drawableX - imageX,
drawableY - imageY);
XCopyArea(display, instancePtr->pixels, drawable, instancePtr->gc,
@@ -781,23 +776,23 @@ void
TkImgPhotoInstanceSetSize(
PhotoInstance *instancePtr) /* Instance whose size is to be changed. */
{
- PhotoMaster *masterPtr;
+ PhotoModel *modelPtr;
schar *newError, *errSrcPtr, *errDestPtr;
int h, offset;
XRectangle validBox;
Pixmap newPixmap;
- masterPtr = instancePtr->masterPtr;
- TkClipBox(masterPtr->validRegion, &validBox);
+ modelPtr = instancePtr->modelPtr;
+ TkClipBox(modelPtr->validRegion, &validBox);
- if ((instancePtr->width != masterPtr->width)
- || (instancePtr->height != masterPtr->height)
+ if ((instancePtr->width != modelPtr->width)
+ || (instancePtr->height != modelPtr->height)
|| (instancePtr->pixels == None)) {
newPixmap = Tk_GetPixmap(instancePtr->display,
RootWindow(instancePtr->display,
instancePtr->visualInfo.screen),
- (masterPtr->width > 0) ? masterPtr->width: 1,
- (masterPtr->height > 0) ? masterPtr->height: 1,
+ (modelPtr->width > 0) ? modelPtr->width: 1,
+ (modelPtr->height > 0) ? modelPtr->height: 1,
instancePtr->visualInfo.depth);
if (!newPixmap) {
Tcl_Panic("Fail to create pixmap with Tk_GetPixmap in TkImgPhotoInstanceSetSize");
@@ -827,17 +822,17 @@ TkImgPhotoInstanceSetSize(
instancePtr->pixels = newPixmap;
}
- if ((instancePtr->width != masterPtr->width)
- || (instancePtr->height != masterPtr->height)
+ if ((instancePtr->width != modelPtr->width)
+ || (instancePtr->height != modelPtr->height)
|| (instancePtr->error == NULL)) {
- if (masterPtr->height > 0 && masterPtr->width > 0) {
+ if (modelPtr->height > 0 && modelPtr->width > 0) {
/*
* TODO: use attemptckalloc() here once there is a strategy that
* will allow us to recover from failure. Right now, there's no
* such possibility.
*/
- newError = (schar *)ckalloc(masterPtr->height * masterPtr->width
+ newError = (schar *)ckalloc(modelPtr->height * modelPtr->width
* 3 * sizeof(schar));
/*
@@ -846,21 +841,21 @@ TkImgPhotoInstanceSetSize(
*/
if ((instancePtr->error != NULL)
- && ((instancePtr->width == masterPtr->width)
- || (validBox.width == masterPtr->width))) {
+ && ((instancePtr->width == modelPtr->width)
+ || (validBox.width == modelPtr->width))) {
if (validBox.y > 0) {
memset(newError, 0, (size_t)
- validBox.y * masterPtr->width * 3 * sizeof(schar));
+ validBox.y * modelPtr->width * 3 * sizeof(schar));
}
h = validBox.y + validBox.height;
- if (h < masterPtr->height) {
- memset(newError + h*masterPtr->width*3, 0,
- (size_t) (masterPtr->height - h)
- * masterPtr->width * 3 * sizeof(schar));
+ if (h < modelPtr->height) {
+ memset(newError + h*modelPtr->width*3, 0,
+ (size_t) (modelPtr->height - h)
+ * modelPtr->width * 3 * sizeof(schar));
}
} else {
memset(newError, 0, (size_t)
- masterPtr->height * masterPtr->width *3*sizeof(schar));
+ modelPtr->height * modelPtr->width *3*sizeof(schar));
}
} else {
newError = NULL;
@@ -872,22 +867,22 @@ TkImgPhotoInstanceSetSize(
* array.
*/
- if (masterPtr->width == instancePtr->width) {
- offset = validBox.y * masterPtr->width * 3;
+ if (modelPtr->width == instancePtr->width) {
+ offset = validBox.y * modelPtr->width * 3;
memcpy(newError + offset, instancePtr->error + offset,
(size_t) validBox.height
- * masterPtr->width * 3 * sizeof(schar));
+ * modelPtr->width * 3 * sizeof(schar));
} else if (validBox.width > 0 && validBox.height > 0) {
errDestPtr = newError +
- (validBox.y * masterPtr->width + validBox.x) * 3;
+ (validBox.y * modelPtr->width + validBox.x) * 3;
errSrcPtr = instancePtr->error +
(validBox.y * instancePtr->width + validBox.x) * 3;
for (h = validBox.height; h > 0; --h) {
memcpy(errDestPtr, errSrcPtr,
validBox.width * 3 * sizeof(schar));
- errDestPtr += masterPtr->width * 3;
+ errDestPtr += modelPtr->width * 3;
errSrcPtr += instancePtr->width * 3;
}
}
@@ -897,8 +892,8 @@ TkImgPhotoInstanceSetSize(
instancePtr->error = newError;
}
- instancePtr->width = masterPtr->width;
- instancePtr->height = masterPtr->height;
+ instancePtr->width = modelPtr->width;
+ instancePtr->height = modelPtr->height;
}
/*
@@ -1004,7 +999,7 @@ IsValidPalette(
static int
CountBits(
- pixel mask) /* Value to count the 1 bits in. */
+ unsigned mask) /* Value to count the 1 bits in. */
{
int n;
@@ -1610,10 +1605,10 @@ TkImgDisposeInstance(
FreeColorTable(instancePtr->colorTablePtr, 1);
}
- if (instancePtr->masterPtr->instancePtr == instancePtr) {
- instancePtr->masterPtr->instancePtr = instancePtr->nextPtr;
+ if (instancePtr->modelPtr->instancePtr == instancePtr) {
+ instancePtr->modelPtr->instancePtr = instancePtr->nextPtr;
} else {
- for (prevPtr = instancePtr->masterPtr->instancePtr;
+ for (prevPtr = instancePtr->modelPtr->instancePtr;
prevPtr->nextPtr != instancePtr; prevPtr = prevPtr->nextPtr) {
/* Empty loop body. */
}
@@ -1629,7 +1624,7 @@ TkImgDisposeInstance(
* TkImgDitherInstance --
*
* This function is called to update an area of an instance's pixmap by
- * dithering the corresponding area of the master.
+ * dithering the corresponding area of the model.
*
* Results:
* None.
@@ -1647,14 +1642,14 @@ TkImgDitherInstance(
* block to be dithered. */
int width, int height) /* Dimensions of the block to be dithered. */
{
- PhotoMaster *masterPtr = instancePtr->masterPtr;
+ PhotoModel *modelPtr = instancePtr->modelPtr;
ColorTable *colorPtr = instancePtr->colorTablePtr;
XImage *imagePtr;
int nLines, bigEndian, i, c, x, y, xEnd, doDithering = 1;
int bitsPerPixel, bytesPerLine, lineLength;
unsigned char *srcLinePtr;
schar *errLinePtr;
- pixel firstBit, word, mask;
+ unsigned firstBit, word, mask;
/*
* Turn dithering off in certain cases where it is not needed (TrueColor,
@@ -1705,8 +1700,8 @@ TkImgDitherInstance(
bigEndian = imagePtr->bitmap_bit_order == MSBFirst;
firstBit = bigEndian? (1 << (imagePtr->bitmap_unit - 1)): 1;
- lineLength = masterPtr->width * 3;
- srcLinePtr = masterPtr->pix32 + (yStart * masterPtr->width + xStart) * 4;
+ lineLength = modelPtr->width * 3;
+ srcLinePtr = modelPtr->pix32 + (yStart * modelPtr->width + xStart) * 4;
errLinePtr = instancePtr->error + yStart * lineLength + xStart * 3;
xEnd = xStart + width;
@@ -1727,7 +1722,7 @@ TkImgDitherInstance(
unsigned char *srcPtr = srcLinePtr;
schar *errPtr = errLinePtr;
unsigned char *destBytePtr = dstLinePtr;
- pixel *destLongPtr = (pixel *) dstLinePtr;
+ unsigned *destLongPtr = (unsigned *) dstLinePtr;
if (colorPtr->flags & COLOR_WINDOW) {
/*
@@ -1761,7 +1756,7 @@ TkImgDitherInstance(
c += errPtr[-lineLength-3];
}
c += errPtr[-lineLength] * 5;
- if ((x + 1) < masterPtr->width) {
+ if ((x + 1) < modelPtr->width) {
c += errPtr[-lineLength+3] * 3;
}
}
@@ -1818,7 +1813,7 @@ TkImgDitherInstance(
* sizes.
*/
- case NBBY * sizeof(pixel):
+ case NBBY * sizeof(unsigned):
*destLongPtr++ = i;
break;
#endif
@@ -1832,7 +1827,7 @@ TkImgDitherInstance(
/*
* 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 model image is in color, use the
* luminance computed as
* 0.344 * red + 0.5 * green + 0.156 * blue.
*/
@@ -1844,13 +1839,13 @@ TkImgDitherInstance(
c += errPtr[-lineLength-1];
}
c += errPtr[-lineLength] * 5;
- if (x + 1 < masterPtr->width) {
+ if (x + 1 < modelPtr->width) {
c += errPtr[-lineLength+1] * 3;
}
}
c = ((c + 2056) >> 4) - 128;
- if (masterPtr->flags & COLOR_IMAGE) {
+ if (modelPtr->flags & COLOR_IMAGE) {
c += (unsigned) (srcPtr[0] * 11 + srcPtr[1] * 16
+ srcPtr[2] * 5 + 16) >> 5;
} else {
@@ -1880,7 +1875,7 @@ TkImgDitherInstance(
* sizes.
*/
- case NBBY * sizeof(pixel):
+ case NBBY * sizeof(unsigned):
*destLongPtr++ = i;
break;
#endif
@@ -1917,13 +1912,13 @@ TkImgDitherInstance(
c += errPtr[-lineLength-1];
}
c += errPtr[-lineLength] * 5;
- if (x + 1 < masterPtr->width) {
+ if (x + 1 < modelPtr->width) {
c += errPtr[-lineLength+1] * 3;
}
}
c = ((c + 2056) >> 4) - 128;
- if (masterPtr->flags & COLOR_IMAGE) {
+ if (modelPtr->flags & COLOR_IMAGE) {
c += (unsigned)(srcPtr[0] * 11 + srcPtr[1] * 16
+ srcPtr[2] * 5 + 16) >> 5;
} else {
@@ -1946,7 +1941,7 @@ TkImgDitherInstance(
}
*destLongPtr = word;
}
- srcLinePtr += masterPtr->width * 4;
+ srcLinePtr += modelPtr->width * 4;
errLinePtr += lineLength;
dstLinePtr += bytesPerLine;
}
@@ -1990,8 +1985,8 @@ TkImgResetDither(
{
if (instancePtr->error) {
memset(instancePtr->error, 0,
- (size_t) instancePtr->masterPtr->width
- * instancePtr->masterPtr->height * 3 * sizeof(schar));
+ (size_t) instancePtr->modelPtr->width
+ * instancePtr->modelPtr->height * 3 * sizeof(schar));
}
}
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 8a73fed..37b18db 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -5,10 +5,10 @@
* 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-2003 Donal K. Fellows
- * Copyright (c) 2003 ActiveState Corporation.
+ * Copyright © 1994 The Australian National University.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2002-2003 Donal K. Fellows
+ * Copyright © 2003 ActiveState Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -111,7 +111,7 @@ static const char *const optionNames[] = {
static int ImgPhotoCreate(Tcl_Interp *interp, const char *name,
int objc, Tcl_Obj *const objv[],
- const Tk_ImageType *typePtr, Tk_ImageMaster master,
+ const Tk_ImageType *typePtr, Tk_ImageModel model,
ClientData *clientDataPtr);
static void ImgPhotoDelete(ClientData clientData);
static int ImgPhotoPostscript(ClientData clientData,
@@ -167,15 +167,15 @@ static Tcl_ThreadDataKey dataKey;
static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_STRING, "-file", NULL, NULL,
- NULL, offsetof(PhotoMaster, fileString), TK_CONFIG_NULL_OK, NULL},
+ NULL, offsetof(PhotoModel, fileString), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_DOUBLE, "-gamma", NULL, NULL,
- DEF_PHOTO_GAMMA, offsetof(PhotoMaster, gamma), 0, NULL},
+ DEF_PHOTO_GAMMA, offsetof(PhotoModel, gamma), 0, NULL},
{TK_CONFIG_INT, "-height", NULL, NULL,
- DEF_PHOTO_HEIGHT, offsetof(PhotoMaster, userHeight), 0, NULL},
+ DEF_PHOTO_HEIGHT, offsetof(PhotoModel, userHeight), 0, NULL},
{TK_CONFIG_UID, "-palette", NULL, NULL,
- DEF_PHOTO_PALETTE, offsetof(PhotoMaster, palette), 0, NULL},
+ DEF_PHOTO_PALETTE, offsetof(PhotoModel, palette), 0, NULL},
{TK_CONFIG_INT, "-width", NULL, NULL,
- DEF_PHOTO_WIDTH, offsetof(PhotoMaster, userWidth), 0, NULL},
+ DEF_PHOTO_WIDTH, offsetof(PhotoModel, userWidth), 0, NULL},
{TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
@@ -191,13 +191,13 @@ static int ParseSubcommandOptions(
Tcl_Interp *interp, int allowedOptions,
int *indexPtr, int objc, Tcl_Obj *const objv[]);
static void ImgPhotoCmdDeletedProc(ClientData clientData);
-static int ImgPhotoConfigureMaster(Tcl_Interp *interp,
- PhotoMaster *masterPtr, int objc,
+static int ImgPhotoConfigureModel(Tcl_Interp *interp,
+ PhotoModel *modelPtr, int objc,
Tcl_Obj *const objv[], int flags);
-static int ToggleComplexAlphaIfNeeded(PhotoMaster *mPtr);
-static int ImgPhotoSetSize(PhotoMaster *masterPtr, int width,
+static int ToggleComplexAlphaIfNeeded(PhotoModel *mPtr);
+static int ImgPhotoSetSize(PhotoModel *modelPtr, int width,
int height);
-static char * ImgGetPhoto(PhotoMaster *masterPtr,
+static char * ImgGetPhoto(PhotoModel *modelPtr,
Tk_PhotoImageBlock *blockPtr,
struct SubcommandOptions *optPtr);
static int MatchFileFormat(Tcl_Interp *interp, Tcl_Channel chan,
@@ -390,38 +390,38 @@ ImgPhotoCreate(
Tcl_Obj *const objv[], /* Argument objects for options (doesn't
* include image name or type). */
TCL_UNUSED(const Tk_ImageType *),/* Pointer to our type record (not used). */
- Tk_ImageMaster master, /* Token for image, to be used by us in later
+ Tk_ImageModel model, /* 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;
+ PhotoModel *modelPtr;
/*
- * Allocate and initialize the photo image master record.
+ * Allocate and initialize the photo image model record.
*/
- masterPtr = (PhotoMaster *)ckalloc(sizeof(PhotoMaster));
- memset(masterPtr, 0, sizeof(PhotoMaster));
- masterPtr->tkMaster = master;
- masterPtr->interp = interp;
- masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd,
- masterPtr, ImgPhotoCmdDeletedProc);
- masterPtr->palette = NULL;
- masterPtr->pix32 = NULL;
- masterPtr->instancePtr = NULL;
- masterPtr->validRegion = TkCreateRegion();
+ modelPtr = (PhotoModel *)ckalloc(sizeof(PhotoModel));
+ memset(modelPtr, 0, sizeof(PhotoModel));
+ modelPtr->tkModel = model;
+ modelPtr->interp = interp;
+ modelPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd,
+ modelPtr, ImgPhotoCmdDeletedProc);
+ modelPtr->palette = NULL;
+ modelPtr->pix32 = NULL;
+ modelPtr->instancePtr = NULL;
+ modelPtr->validRegion = TkCreateRegion();
/*
* Process configuration options given in the image create command.
*/
- if (ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, 0) != TCL_OK) {
- ImgPhotoDelete(masterPtr);
+ if (ImgPhotoConfigureModel(interp, modelPtr, objc, objv, 0) != TCL_OK) {
+ ImgPhotoDelete(modelPtr);
return TCL_ERROR;
}
- *clientDataPtr = masterPtr;
+ *clientDataPtr = modelPtr;
return TCL_OK;
}
@@ -445,7 +445,7 @@ ImgPhotoCreate(
static int
ImgPhotoCmd(
- ClientData clientData, /* Information about photo master. */
+ ClientData clientData, /* Information about photo model. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -460,7 +460,7 @@ ImgPhotoCmd(
PHOTO_WRITE
};
- PhotoMaster *masterPtr = (PhotoMaster *)clientData;
+ PhotoModel *modelPtr = (PhotoModel *)clientData;
int result, index, x, y, width, height;
struct SubcommandOptions options;
unsigned char *pixelPtr;
@@ -491,7 +491,7 @@ ImgPhotoCmd(
*/
if (objc == 2) {
- Tk_PhotoBlank(masterPtr);
+ Tk_PhotoBlank(modelPtr);
return TCL_OK;
} else {
Tcl_WrongNumArgs(interp, 2, objv, NULL);
@@ -505,22 +505,22 @@ ImgPhotoCmd(
Tcl_WrongNumArgs(interp, 2, objv, "option");
return TCL_ERROR;
}
- arg = TkGetStringFromObj(objv[2], &length);
+ arg = Tcl_GetStringFromObj(objv[2], &length);
if (strncmp(arg,"-data", length) == 0) {
- if (masterPtr->dataString) {
- Tcl_SetObjResult(interp, masterPtr->dataString);
+ if (modelPtr->dataString) {
+ Tcl_SetObjResult(interp, modelPtr->dataString);
}
} else if (strncmp(arg,"-format", length) == 0) {
- if (masterPtr->format) {
- Tcl_SetObjResult(interp, masterPtr->format);
+ if (modelPtr->format) {
+ Tcl_SetObjResult(interp, modelPtr->format);
}
} else if (strncmp(arg, "-metadata", length) == 0) {
- if (masterPtr->metadata) {
- Tcl_SetObjResult(interp, masterPtr->metadata);
+ if (modelPtr->metadata) {
+ Tcl_SetObjResult(interp, modelPtr->metadata);
}
} else {
Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs,
- (char *) masterPtr, Tcl_GetString(objv[2]), 0);
+ (char *) modelPtr, Tcl_GetString(objv[2]), 0);
}
return TCL_OK;
}
@@ -534,28 +534,28 @@ ImgPhotoCmd(
Tcl_Obj *obj, *subobj;
result = Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr, NULL, 0);
+ configSpecs, (char *) modelPtr, NULL, 0);
if (result != TCL_OK) {
return result;
}
obj = Tcl_NewObj();
subobj = Tcl_NewStringObj("-data {} {} {}", 14);
- if (masterPtr->dataString) {
- Tcl_ListObjAppendElement(NULL, subobj, masterPtr->dataString);
+ if (modelPtr->dataString) {
+ Tcl_ListObjAppendElement(NULL, subobj, modelPtr->dataString);
} else {
Tcl_AppendStringsToObj(subobj, " {}", NULL);
}
Tcl_ListObjAppendElement(interp, obj, subobj);
subobj = Tcl_NewStringObj("-format {} {} {}", 16);
- if (masterPtr->format) {
- Tcl_ListObjAppendElement(NULL, subobj, masterPtr->format);
+ if (modelPtr->format) {
+ Tcl_ListObjAppendElement(NULL, subobj, modelPtr->format);
} else {
Tcl_AppendStringsToObj(subobj, " {}", NULL);
}
Tcl_ListObjAppendElement(interp, obj, subobj);
subobj = Tcl_NewStringObj("-metadata {} {} {}", 16);
- if (masterPtr->metadata) {
- Tcl_ListObjAppendElement(NULL, subobj, masterPtr->metadata);
+ if (modelPtr->metadata) {
+ Tcl_ListObjAppendElement(NULL, subobj, modelPtr->metadata);
} else {
Tcl_AppendStringsToObj(subobj, " {}", NULL);
}
@@ -565,17 +565,17 @@ ImgPhotoCmd(
return TCL_OK;
} else if (objc == 3) {
- const char *arg = TkGetStringFromObj(objv[2], &length);
+ const char *arg = Tcl_GetStringFromObj(objv[2], &length);
if (length > 1 && !strncmp(arg, "-data", length)) {
Tcl_AppendResult(interp, "-data {} {} {}", NULL);
- if (masterPtr->dataString) {
+ if (modelPtr->dataString) {
/*
* TODO: Modifying result is bad!
*/
Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp),
- masterPtr->dataString);
+ modelPtr->dataString);
} else {
Tcl_AppendResult(interp, " {}", NULL);
}
@@ -583,13 +583,13 @@ ImgPhotoCmd(
} else if (length > 1 &&
!strncmp(arg, "-format", length)) {
Tcl_AppendResult(interp, "-format {} {} {}", NULL);
- if (masterPtr->format) {
+ if (modelPtr->format) {
/*
* TODO: Modifying result is bad!
*/
Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp),
- masterPtr->format);
+ modelPtr->format);
} else {
Tcl_AppendResult(interp, " {}", NULL);
}
@@ -597,23 +597,23 @@ ImgPhotoCmd(
} else if (length > 1 &&
!strncmp(arg, "-metadata", length)) {
Tcl_AppendResult(interp, "-metadata {} {} {}", NULL);
- if (masterPtr->metadata) {
+ if (modelPtr->metadata) {
/*
* TODO: Modifying result is bad!
*/
Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp),
- masterPtr->metadata);
+ modelPtr->metadata);
} else {
Tcl_AppendResult(interp, " {}", NULL);
}
return TCL_OK;
} else {
return Tk_ConfigureInfo(interp, Tk_MainWindow(interp),
- configSpecs, (char *) masterPtr, arg, 0);
+ configSpecs, (char *) modelPtr, arg, 0);
}
} else {
- return ImgPhotoConfigureMaster(interp, masterPtr, objc-2, objv+2,
+ return ImgPhotoConfigureModel(interp, modelPtr, objc-2, objv+2,
TK_CONFIG_ARGV_ONLY);
}
@@ -672,7 +672,7 @@ ImgPhotoCmd(
* has a simple alpha channel.
*/
- if (!(((PhotoMaster *) srcHandle)->flags & COMPLEX_ALPHA)) {
+ if (!(((PhotoModel *) srcHandle)->flags & COMPLEX_ALPHA)) {
options.compositingRule |= SOURCE_IS_SIMPLE_ALPHA_PHOTO;
}
@@ -716,7 +716,7 @@ ImgPhotoCmd(
+ options.fromY * block.pitch;
block.width = options.fromX2 - options.fromX;
block.height = options.fromY2 - options.fromY;
- result = Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) masterPtr,
+ result = Tk_PhotoPutZoomedBlock(interp, (Tk_PhotoHandle) modelPtr,
&block, options.toX, options.toY, options.toX2 - options.toX,
options.toY2 - options.toY, options.zoomX, options.zoomY,
options.subsampleX, options.subsampleY,
@@ -730,7 +730,7 @@ ImgPhotoCmd(
*/
if (options.options & OPT_SHRINK) {
- if (ImgPhotoSetSize(masterPtr, options.toX2,
+ if (ImgPhotoSetSize(modelPtr, options.toX2,
options.toY2) != TCL_OK) {
if (options.background) {
Tk_FreeColor(options.background);
@@ -741,8 +741,8 @@ ImgPhotoCmd(
return TCL_ERROR;
}
}
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0,
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0,
+ modelPtr->width, modelPtr->height);
if (options.background) {
Tk_FreeColor(options.background);
}
@@ -777,10 +777,10 @@ ImgPhotoCmd(
Tcl_WrongNumArgs(interp, 2, objv, "?-option value ...?");
return TCL_ERROR;
}
- if ((options.fromX > masterPtr->width)
- || (options.fromY > masterPtr->height)
- || (options.fromX2 > masterPtr->width)
- || (options.fromY2 > masterPtr->height)) {
+ if ((options.fromX > modelPtr->width)
+ || (options.fromY > modelPtr->height)
+ || (options.fromX2 > modelPtr->width)
+ || (options.fromY2 > modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"coordinates for -from option extend outside image", -1));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL);
@@ -792,8 +792,8 @@ ImgPhotoCmd(
*/
if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) {
- options.fromX2 = masterPtr->width;
- options.fromY2 = masterPtr->height;
+ options.fromX2 = modelPtr->width;
+ options.fromY2 = modelPtr->height;
}
if (!(options.options & OPT_FORMAT)) {
options.format = Tcl_NewStringObj("default", -1);
@@ -807,7 +807,7 @@ ImgPhotoCmd(
if (NULL != options.metadata) {
metadataIn = options.metadata;
} else {
- metadataIn = masterPtr->metadata;
+ metadataIn = modelPtr->metadata;
}
/*
@@ -874,7 +874,7 @@ ImgPhotoCmd(
* Call the handler's string write function to write out the image.
*/
- data = ImgGetPhoto(masterPtr, &block, &options);
+ data = ImgGetPhoto(modelPtr, &block, &options);
if (stringWriteProc == NULL) {
result = (stringWriteProcVersion3)(interp,
@@ -952,8 +952,8 @@ ImgPhotoCmd(
|| (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
return TCL_ERROR;
}
- if ((x < 0) || (x >= masterPtr->width)
- || (y < 0) || (y >= masterPtr->height)) {
+ if ((x < 0) || (x >= modelPtr->width)
+ || (y < 0) || (y >= modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s get: coordinates out of range",
Tcl_GetString(objv[0])));
@@ -966,7 +966,7 @@ ImgPhotoCmd(
* Extract the value of the desired pixel and format it as a list.
*/
- pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
channels[0] = Tcl_NewWideIntObj(pixelPtr[0]);
channels[1] = Tcl_NewWideIntObj(pixelPtr[1]);
channels[2] = Tcl_NewWideIntObj(pixelPtr[2]);
@@ -1029,7 +1029,7 @@ ImgPhotoCmd(
if (imageFormat != NULL) {
if (imageFormat->stringReadProc(interp, data, format,
- (Tk_PhotoHandle) masterPtr, options.toX, options.toY,
+ (Tk_PhotoHandle) modelPtr, options.toX, options.toY,
options.toX2 - options.toX,
options.toY2 - options.toY, 0, 0) != TCL_OK) {
return TCL_ERROR;
@@ -1037,7 +1037,7 @@ ImgPhotoCmd(
} else {
if (imageFormatVersion3->stringReadProc(interp, data, format,
options.metadata,
- (Tk_PhotoHandle) masterPtr, options.toX, options.toY,
+ (Tk_PhotoHandle) modelPtr, options.toX, options.toY,
options.toX2 - options.toX,
options.toY2 - options.toY, 0, 0,
NULL)
@@ -1052,7 +1052,7 @@ ImgPhotoCmd(
* takes care to notify the changed image and to set/unset the
* IMAGE_CHANGED bit.
*/
- masterPtr->flags |= IMAGE_CHANGED;
+ modelPtr->flags |= IMAGE_CHANGED;
return TCL_OK;
}
@@ -1146,7 +1146,7 @@ ImgPhotoCmd(
*/
if (options.options & OPT_SHRINK) {
- if (ImgPhotoSetSize(masterPtr, options.toX + width,
+ if (ImgPhotoSetSize(modelPtr, options.toX + width,
options.toY + height) != TCL_OK) {
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -1169,12 +1169,12 @@ ImgPhotoCmd(
if (imageFormat != NULL) {
result = imageFormat->fileReadProc(interp, chan,
Tcl_GetString(options.name),
- format, (Tk_PhotoHandle) masterPtr, options.toX,
+ format, (Tk_PhotoHandle) modelPtr, options.toX,
options.toY, width, height, options.fromX, options.fromY);
} else {
result = imageFormatVersion3->fileReadProc(interp, chan,
Tcl_GetString(options.name),
- format, options.metadata, (Tk_PhotoHandle) masterPtr,
+ format, options.metadata, (Tk_PhotoHandle) modelPtr,
options.toX, options.toY, width, height, options.fromX,
options.fromY, NULL);
}
@@ -1196,27 +1196,27 @@ readCleanup:
* present.
*/
- x = masterPtr->ditherX;
- y = masterPtr->ditherY;
- if (masterPtr->ditherX != 0) {
- Tk_DitherPhoto((Tk_PhotoHandle) masterPtr, x, y,
- masterPtr->width - x, 1);
+ x = modelPtr->ditherX;
+ y = modelPtr->ditherY;
+ if (modelPtr->ditherX != 0) {
+ Tk_DitherPhoto((Tk_PhotoHandle) modelPtr, x, y,
+ modelPtr->width - x, 1);
}
- if (masterPtr->ditherY < masterPtr->height) {
+ if (modelPtr->ditherY < modelPtr->height) {
x = 0;
- Tk_DitherPhoto((Tk_PhotoHandle)masterPtr, 0,
- masterPtr->ditherY, masterPtr->width,
- masterPtr->height - masterPtr->ditherY);
+ Tk_DitherPhoto((Tk_PhotoHandle)modelPtr, 0,
+ modelPtr->ditherY, modelPtr->width,
+ modelPtr->height - modelPtr->ditherY);
}
- if (y < masterPtr->height) {
+ if (y < modelPtr->height) {
/*
* Tell the core image code that part of the image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y,
- (masterPtr->width - x), (masterPtr->height - y),
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, x, y,
+ (modelPtr->width - x), (modelPtr->height - y),
+ modelPtr->width, modelPtr->height);
}
return TCL_OK;
@@ -1273,8 +1273,8 @@ readCleanup:
boolMode = 0;
}
- if ((x < 0) || (x >= masterPtr->width)
- || (y < 0) || (y >= masterPtr->height)) {
+ if ((x < 0) || (x >= modelPtr->width)
+ || (y < 0) || (y >= modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s transparency get: coordinates out of range",
Tcl_GetString(objv[0])));
@@ -1286,7 +1286,7 @@ readCleanup:
/*
* Extract and return the desired value
*/
- pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
if (boolMode) {
Tcl_SetObjResult(interp, Tcl_NewBooleanObj( ! pixelPtr[3]));
} else {
@@ -1332,8 +1332,8 @@ readCleanup:
boolMode = 0;
}
- if ((x < 0) || (x >= masterPtr->width)
- || (y < 0) || (y >= masterPtr->height)) {
+ if ((x < 0) || (x >= modelPtr->width)
+ || (y < 0) || (y >= modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s transparency set: coordinates out of range",
Tcl_GetString(objv[0])));
@@ -1364,7 +1364,7 @@ readCleanup:
* Set new alpha value for the pixel
*/
- pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ pixelPtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
if (boolMode) {
pixelPtr[3] = newVal ? 0 : 255;
} else {
@@ -1382,11 +1382,11 @@ readCleanup:
modRegion = TkCreateRegion();
TkUnionRectWithRegion(&setBox, modRegion, modRegion);
if (pixelPtr[3]) {
- TkUnionRectWithRegion(&setBox, masterPtr->validRegion,
- masterPtr->validRegion);
+ TkUnionRectWithRegion(&setBox, modelPtr->validRegion,
+ modelPtr->validRegion);
} else {
- TkSubtractRegion(masterPtr->validRegion, modRegion,
- masterPtr->validRegion);
+ TkSubtractRegion(modelPtr->validRegion, modRegion,
+ modelPtr->validRegion);
}
TkDestroyRegion(modRegion);
@@ -1395,9 +1395,9 @@ readCleanup:
* has (potentially) changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y, 1, 1,
- masterPtr->width, masterPtr->height);
- masterPtr->flags &= ~IMAGE_CHANGED;
+ Tk_ImageChanged(modelPtr->tkModel, x, y, 1, 1,
+ modelPtr->width, modelPtr->height);
+ modelPtr->flags &= ~IMAGE_CHANGED;
return TCL_OK;
}
@@ -1441,10 +1441,10 @@ readCleanup:
Tcl_WrongNumArgs(interp, 2, objv, "fileName ?-option value ...?");
return TCL_ERROR;
}
- if ((options.fromX > masterPtr->width)
- || (options.fromY > masterPtr->height)
- || (options.fromX2 > masterPtr->width)
- || (options.fromY2 > masterPtr->height)) {
+ if ((options.fromX > modelPtr->width)
+ || (options.fromY > modelPtr->height)
+ || (options.fromX2 > modelPtr->width)
+ || (options.fromY2 > modelPtr->height)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"coordinates for -from option extend outside image", -1));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL);
@@ -1458,8 +1458,8 @@ readCleanup:
*/
if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) {
- options.fromX2 = masterPtr->width;
- options.fromY2 = masterPtr->height;
+ options.fromX2 = modelPtr->width;
+ options.fromY2 = modelPtr->height;
}
if (options.format == NULL) {
fmtString = GetExtension(Tcl_GetString(options.name));
@@ -1477,7 +1477,7 @@ readCleanup:
if (NULL != options.metadata) {
metadataIn = options.metadata;
} else {
- metadataIn = masterPtr->metadata;
+ metadataIn = modelPtr->metadata;
}
/*
@@ -1563,7 +1563,7 @@ readCleanup:
* Call the handler's file write function to write out the image.
*/
- data = ImgGetPhoto(masterPtr, &block, &options);
+ data = ImgGetPhoto(modelPtr, &block, &options);
format = options.format;
if (oldformat && format) {
format = (Tcl_Obj *) Tcl_GetString(options.format);
@@ -1675,7 +1675,7 @@ ParseSubcommandOptions(
* optPtr->name.
*/
- expandedOption = option = TkGetStringFromObj(objv[index], &length);
+ expandedOption = option = Tcl_GetStringFromObj(objv[index], &length);
if (option[0] != '-') {
if (optPtr->name == NULL) {
optPtr->name = objv[index];
@@ -1924,7 +1924,7 @@ ParseSubcommandOptions(
/*
*----------------------------------------------------------------------
*
- * ImgPhotoConfigureMaster --
+ * ImgPhotoConfigureModel --
*
* This function is called when a photo image is created or reconfigured.
* It processes configuration options and resets any instances of the
@@ -1932,7 +1932,7 @@ ParseSubcommandOptions(
*
* Results:
* A standard Tcl return value. If TCL_ERROR is returned then an error
- * message is left in the masterPtr->interp's result.
+ * message is left in the modelPtr->interp's result.
*
* Side effects:
* Existing instances of the image will be redisplayed to match the new
@@ -1942,9 +1942,9 @@ ParseSubcommandOptions(
*/
static int
-ImgPhotoConfigureMaster(
+ImgPhotoConfigureModel(
Tcl_Interp *interp, /* Interpreter to use for reporting errors. */
- PhotoMaster *masterPtr, /* Pointer to data structure describing
+ PhotoModel *modelPtr, /* 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. */
@@ -1966,7 +1966,7 @@ ImgPhotoConfigureMaster(
args = (const char **)ckalloc((objc + 1) * sizeof(char *));
for (i = 0, j = 0; i < objc; i++,j++) {
- args[j] = TkGetStringFromObj(objv[i], &length);
+ args[j] = Tcl_GetStringFromObj(objv[i], &length);
if ((length > 1) && (args[j][0] == '-')) {
if ((args[j][1] == 'd') &&
!strncmp(args[j], "-data", length)) {
@@ -2018,28 +2018,28 @@ ImgPhotoConfigureMaster(
* the format string influences how "-data" or "-file" is interpreted.
*/
- oldFileString = masterPtr->fileString;
+ oldFileString = modelPtr->fileString;
if (oldFileString == NULL) {
- oldData = masterPtr->dataString;
+ oldData = modelPtr->dataString;
if (oldData != NULL) {
Tcl_IncrRefCount(oldData);
}
} else {
oldData = NULL;
}
- oldFormat = masterPtr->format;
+ oldFormat = modelPtr->format;
if (oldFormat != NULL) {
Tcl_IncrRefCount(oldFormat);
}
- oldPaletteString = masterPtr->palette;
- oldGamma = masterPtr->gamma;
+ oldPaletteString = modelPtr->palette;
+ oldGamma = modelPtr->gamma;
/*
* Process the configuration options specified.
*/
if (Tk_ConfigureWidget(interp, Tk_MainWindow(interp), configSpecs,
- j, args, (char *) masterPtr, flags) != TCL_OK) {
+ j, args, (char *) modelPtr, flags) != TCL_OK) {
ckfree(args);
goto errorExit;
}
@@ -2049,9 +2049,9 @@ ImgPhotoConfigureMaster(
* Regard the empty string for -file, -data, -format or -metadata as the null value.
*/
- if ((masterPtr->fileString != NULL) && (masterPtr->fileString[0] == 0)) {
- ckfree(masterPtr->fileString);
- masterPtr->fileString = NULL;
+ if ((modelPtr->fileString != NULL) && (modelPtr->fileString[0] == 0)) {
+ ckfree(modelPtr->fileString);
+ modelPtr->fileString = NULL;
}
if (data) {
/*
@@ -2060,16 +2060,16 @@ ImgPhotoConfigureMaster(
*/
TkSizeT bytesize;
- (void) TkGetByteArrayFromObj(data, &bytesize);
+ (void) Tcl_GetByteArrayFromObj(data, &bytesize);
if (bytesize) {
Tcl_IncrRefCount(data);
} else {
data = NULL;
}
- if (masterPtr->dataString) {
- Tcl_DecrRefCount(masterPtr->dataString);
+ if (modelPtr->dataString) {
+ Tcl_DecrRefCount(modelPtr->dataString);
}
- masterPtr->dataString = data;
+ modelPtr->dataString = data;
}
if (format) {
/*
@@ -2083,10 +2083,10 @@ ImgPhotoConfigureMaster(
} else {
format = NULL;
}
- if (masterPtr->format) {
- Tcl_DecrRefCount(masterPtr->format);
+ if (modelPtr->format) {
+ Tcl_DecrRefCount(modelPtr->format);
}
- masterPtr->format = format;
+ modelPtr->format = format;
}
if (metadataInObj) {
/*
@@ -2109,18 +2109,18 @@ ImgPhotoConfigureMaster(
} else {
metadataInObj = NULL;
}
- if (masterPtr->metadata) {
- Tcl_DecrRefCount(masterPtr->metadata);
+ if (modelPtr->metadata) {
+ Tcl_DecrRefCount(modelPtr->metadata);
}
- masterPtr->metadata = metadataInObj;
+ modelPtr->metadata = metadataInObj;
}
/*
* 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) {
+ if (ImgPhotoSetSize(modelPtr, modelPtr->width,
+ modelPtr->height) != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
@@ -2132,9 +2132,9 @@ ImgPhotoConfigureMaster(
* -file or -data option.
*/
- if ((masterPtr->fileString != NULL)
- && ((masterPtr->fileString != oldFileString)
- || (masterPtr->format != oldFormat))) {
+ if ((modelPtr->fileString != NULL)
+ && ((modelPtr->fileString != oldFileString)
+ || (modelPtr->format != oldFormat))) {
/*
* Prevent file system access in a safe interpreter.
@@ -2149,7 +2149,7 @@ ImgPhotoConfigureMaster(
goto errorExit;
}
- chan = Tcl_OpenFileChannel(interp, masterPtr->fileString, "r", 0);
+ chan = Tcl_OpenFileChannel(interp, modelPtr->fileString, "r", 0);
if (chan == NULL) {
goto errorExit;
}
@@ -2167,14 +2167,14 @@ ImgPhotoConfigureMaster(
if ((Tcl_SetChannelOption(interp, chan,
"-translation", "binary") != TCL_OK) ||
- (MatchFileFormat(interp, chan, masterPtr->fileString,
- masterPtr->format, masterPtr->metadata, metadataOutObj,
+ (MatchFileFormat(interp, chan, modelPtr->fileString,
+ modelPtr->format, modelPtr->metadata, metadataOutObj,
&imageFormat, &imageFormatVersion3,
&imageWidth, &imageHeight, &oldformat) != TCL_OK)) {
Tcl_Close(NULL, chan);
goto errorExit;
}
- result = ImgPhotoSetSize(masterPtr, imageWidth, imageHeight);
+ result = ImgPhotoSetSize(modelPtr, imageWidth, imageHeight);
if (result != TCL_OK) {
Tcl_Close(NULL, chan);
Tcl_SetObjResult(interp, Tcl_NewStringObj(
@@ -2182,19 +2182,19 @@ ImgPhotoConfigureMaster(
Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
goto errorExit;
}
- tempformat = masterPtr->format;
+ tempformat = modelPtr->format;
if (oldformat && tempformat) {
tempformat = (Tcl_Obj *) Tcl_GetString(tempformat);
}
if (imageFormat != NULL) {
result = imageFormat->fileReadProc(interp, chan,
- masterPtr->fileString, tempformat,
- (Tk_PhotoHandle) masterPtr,
+ modelPtr->fileString, tempformat,
+ (Tk_PhotoHandle) modelPtr,
0, 0, imageWidth, imageHeight, 0, 0);
} else {
result = imageFormatVersion3->fileReadProc(interp, chan,
- masterPtr->fileString, tempformat, masterPtr->metadata,
- (Tk_PhotoHandle) masterPtr,
+ modelPtr->fileString, tempformat, modelPtr->metadata,
+ (Tk_PhotoHandle) modelPtr,
0, 0, imageWidth, imageHeight, 0, 0,
metadataOutObj);
}
@@ -2205,12 +2205,12 @@ ImgPhotoConfigureMaster(
}
Tcl_ResetResult(interp);
- masterPtr->flags |= IMAGE_CHANGED;
+ modelPtr->flags |= IMAGE_CHANGED;
}
- if ((masterPtr->fileString == NULL) && (masterPtr->dataString != NULL)
- && ((masterPtr->dataString != oldData)
- || (masterPtr->format != oldFormat))) {
+ if ((modelPtr->fileString == NULL) && (modelPtr->dataString != NULL)
+ && ((modelPtr->dataString != oldData)
+ || (modelPtr->format != oldFormat))) {
/*
* Flag that we want the metadata result dict
@@ -2219,20 +2219,20 @@ ImgPhotoConfigureMaster(
metadataOutObj = Tcl_NewDictObj();
Tcl_IncrRefCount(metadataOutObj);
- if (MatchStringFormat(interp, masterPtr->dataString,
- masterPtr->format, masterPtr->metadata, metadataOutObj,
+ if (MatchStringFormat(interp, modelPtr->dataString,
+ modelPtr->format, modelPtr->metadata, metadataOutObj,
&imageFormat, &imageFormatVersion3, &imageWidth,
&imageHeight, &oldformat) != TCL_OK) {
goto errorExit;
}
- if (ImgPhotoSetSize(masterPtr, imageWidth, imageHeight) != TCL_OK) {
+ if (ImgPhotoSetSize(modelPtr, imageWidth, imageHeight) != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL);
goto errorExit;
}
- tempformat = masterPtr->format;
- tempdata = masterPtr->dataString;
+ tempformat = modelPtr->format;
+ tempdata = modelPtr->dataString;
if (oldformat) {
if (tempformat) {
tempformat = (Tcl_Obj *) Tcl_GetString(tempformat);
@@ -2241,21 +2241,21 @@ ImgPhotoConfigureMaster(
}
if (imageFormat != NULL) {
if (imageFormat->stringReadProc(interp, tempdata, tempformat,
- (Tk_PhotoHandle) masterPtr, 0, 0, imageWidth, imageHeight,
+ (Tk_PhotoHandle) modelPtr, 0, 0, imageWidth, imageHeight,
0, 0) != TCL_OK) {
goto errorExit;
}
} else {
if (imageFormatVersion3->stringReadProc(interp, tempdata, tempformat,
- masterPtr->metadata, (Tk_PhotoHandle) masterPtr, 0, 0,
+ modelPtr->metadata, (Tk_PhotoHandle) modelPtr, 0, 0,
imageWidth, imageHeight, 0, 0, metadataOutObj) != TCL_OK) {
goto errorExit;
}
}
Tcl_ResetResult(interp);
- masterPtr->flags |= IMAGE_CHANGED;
+ modelPtr->flags |= IMAGE_CHANGED;
}
/*
@@ -2276,18 +2276,18 @@ ImgPhotoConfigureMaster(
* We have driver return metadata
*/
- if (masterPtr->metadata == NULL) {
- masterPtr->metadata = metadataOutObj;
+ if (modelPtr->metadata == NULL) {
+ modelPtr->metadata = metadataOutObj;
metadataOutObj = NULL;
} else {
Tcl_DictSearch search;
Tcl_Obj *key, *value;
int done;
- if (Tcl_IsShared(masterPtr->metadata)) {
- Tcl_DecrRefCount(masterPtr->metadata);
- masterPtr->metadata = Tcl_DuplicateObj(masterPtr->metadata);
- Tcl_IncrRefCount(masterPtr->metadata);
+ if (Tcl_IsShared(modelPtr->metadata)) {
+ Tcl_DecrRefCount(modelPtr->metadata);
+ modelPtr->metadata = Tcl_DuplicateObj(modelPtr->metadata);
+ Tcl_IncrRefCount(modelPtr->metadata);
}
if (Tcl_DictObjFirst(interp, metadataOutObj, &search, &key,
@@ -2295,7 +2295,7 @@ ImgPhotoConfigureMaster(
goto errorExit;
}
for (; !done ; Tcl_DictObjNext(&search, &key, &value, &done)) {
- Tcl_DictObjPut(interp, masterPtr->metadata, key, value);
+ Tcl_DictObjPut(interp, modelPtr->metadata, key, value);
}
}
}
@@ -2305,13 +2305,13 @@ ImgPhotoConfigureMaster(
* Enforce a reasonable value for gamma.
*/
- if (masterPtr->gamma <= 0) {
- masterPtr->gamma = 1.0;
+ if (modelPtr->gamma <= 0) {
+ modelPtr->gamma = 1.0;
}
- if ((masterPtr->gamma != oldGamma)
- || (masterPtr->palette != oldPaletteString)) {
- masterPtr->flags |= IMAGE_CHANGED;
+ if ((modelPtr->gamma != oldGamma)
+ || (modelPtr->palette != oldPaletteString)) {
+ modelPtr->flags |= IMAGE_CHANGED;
}
/*
@@ -2320,7 +2320,7 @@ ImgPhotoConfigureMaster(
* everywhere that it is used.
*/
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgPhotoConfigureInstance(instancePtr);
}
@@ -2329,9 +2329,9 @@ ImgPhotoConfigureMaster(
* Inform the generic image code that the image has (potentially) changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width,
- masterPtr->height, masterPtr->width, masterPtr->height);
- masterPtr->flags &= ~IMAGE_CHANGED;
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, modelPtr->width,
+ modelPtr->height, modelPtr->width, modelPtr->height);
+ modelPtr->flags &= ~IMAGE_CHANGED;
if (oldData != NULL) {
Tcl_DecrRefCount(oldData);
@@ -2343,7 +2343,7 @@ ImgPhotoConfigureMaster(
Tcl_DecrRefCount(metadataOutObj);
}
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
return TCL_OK;
@@ -2373,14 +2373,14 @@ ImgPhotoConfigureMaster(
* None.
*
* Side effects:
- * (Re)sets COMPLEX_ALPHA flag of master.
+ * (Re)sets COMPLEX_ALPHA flag of model.
*
*----------------------------------------------------------------------
*/
static int
ToggleComplexAlphaIfNeeded(
- PhotoMaster *mPtr)
+ PhotoModel *mPtr)
{
size_t len = (size_t)MAX(mPtr->userWidth, mPtr->width) *
(size_t)MAX(mPtr->userHeight, mPtr->height) * 4;
@@ -2411,7 +2411,7 @@ ToggleComplexAlphaIfNeeded(
*
* ImgPhotoDelete --
*
- * This function is called by the image code to delete the master
+ * This function is called by the image code to delete the model
* structure for an image.
*
* Results:
@@ -2425,40 +2425,40 @@ ToggleComplexAlphaIfNeeded(
static void
ImgPhotoDelete(
- ClientData masterData) /* Pointer to PhotoMaster structure for image.
+ ClientData modelData) /* Pointer to PhotoModel structure for image.
* Must not have any more instances. */
{
- PhotoMaster *masterPtr = (PhotoMaster *)masterData;
+ PhotoModel *modelPtr = (PhotoModel *)modelData;
PhotoInstance *instancePtr;
- while ((instancePtr = masterPtr->instancePtr) != NULL) {
+ while ((instancePtr = modelPtr->instancePtr) != NULL) {
if (instancePtr->refCount > 0) {
Tcl_Panic("tried to delete photo image when instances still exist");
}
Tcl_CancelIdleCall(TkImgDisposeInstance, instancePtr);
TkImgDisposeInstance(instancePtr);
}
- masterPtr->tkMaster = NULL;
- if (masterPtr->imageCmd != NULL) {
- Tcl_DeleteCommandFromToken(masterPtr->interp, masterPtr->imageCmd);
+ modelPtr->tkModel = NULL;
+ if (modelPtr->imageCmd != NULL) {
+ Tcl_DeleteCommandFromToken(modelPtr->interp, modelPtr->imageCmd);
}
- if (masterPtr->pix32 != NULL) {
- ckfree(masterPtr->pix32);
+ if (modelPtr->pix32 != NULL) {
+ ckfree(modelPtr->pix32);
}
- if (masterPtr->validRegion != NULL) {
- TkDestroyRegion(masterPtr->validRegion);
+ if (modelPtr->validRegion != NULL) {
+ TkDestroyRegion(modelPtr->validRegion);
}
- if (masterPtr->dataString != NULL) {
- Tcl_DecrRefCount(masterPtr->dataString);
+ if (modelPtr->dataString != NULL) {
+ Tcl_DecrRefCount(modelPtr->dataString);
}
- if (masterPtr->format != NULL) {
- Tcl_DecrRefCount(masterPtr->format);
+ if (modelPtr->format != NULL) {
+ Tcl_DecrRefCount(modelPtr->format);
}
- if (masterPtr->metadata != NULL) {
- Tcl_DecrRefCount(masterPtr->metadata);
+ if (modelPtr->metadata != NULL) {
+ Tcl_DecrRefCount(modelPtr->metadata);
}
- Tk_FreeOptions(configSpecs, (char *) masterPtr, NULL, 0);
- ckfree(masterPtr);
+ Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0);
+ ckfree(modelPtr);
}
/*
@@ -2480,14 +2480,14 @@ ImgPhotoDelete(
static void
ImgPhotoCmdDeletedProc(
- ClientData clientData) /* Pointer to PhotoMaster structure for
+ ClientData clientData) /* Pointer to PhotoModel structure for
* image. */
{
- PhotoMaster *masterPtr = (PhotoMaster *)clientData;
+ PhotoModel *modelPtr = (PhotoModel *)clientData;
- masterPtr->imageCmd = NULL;
- if (masterPtr->tkMaster != NULL) {
- Tk_DeleteImage(masterPtr->interp, Tk_NameOfImage(masterPtr->tkMaster));
+ modelPtr->imageCmd = NULL;
+ if (modelPtr->tkModel != NULL) {
+ Tk_DeleteImage(modelPtr->interp, Tk_NameOfImage(modelPtr->tkModel));
}
}
@@ -2505,14 +2505,14 @@ ImgPhotoCmdDeletedProc(
* with memory allocation.)
*
* Side effects:
- * Storage gets reallocated, for the master and all its instances.
+ * Storage gets reallocated, for the model and all its instances.
*
*----------------------------------------------------------------------
*/
static int
ImgPhotoSetSize(
- PhotoMaster *masterPtr,
+ PhotoModel *modelPtr,
int width, int height)
{
unsigned char *newPix32 = NULL;
@@ -2522,11 +2522,11 @@ ImgPhotoSetSize(
TkRegion clipRegion;
PhotoInstance *instancePtr;
- if (masterPtr->userWidth > 0) {
- width = masterPtr->userWidth;
+ if (modelPtr->userWidth > 0) {
+ width = modelPtr->userWidth;
}
- if (masterPtr->userHeight > 0) {
- height = masterPtr->userHeight;
+ if (modelPtr->userHeight > 0) {
+ height = modelPtr->userHeight;
}
if (width > INT_MAX / 4) {
@@ -2540,8 +2540,8 @@ ImgPhotoSetSize(
* failures will leave the photo unchanged.
*/
- if ((width != masterPtr->width) || (height != masterPtr->height)
- || (masterPtr->pix32 == NULL)) {
+ if ((width != modelPtr->width) || (height != modelPtr->height)
+ || (modelPtr->pix32 == NULL)) {
unsigned newPixSize;
if (pitch && height > (int)(UINT_MAX / pitch)) {
@@ -2568,7 +2568,7 @@ ImgPhotoSetSize(
* image size.
*/
- TkClipBox(masterPtr->validRegion, &validBox);
+ TkClipBox(modelPtr->validRegion, &validBox);
if ((validBox.x + validBox.width > width)
|| (validBox.y + validBox.height > height)) {
clipBox.x = 0;
@@ -2577,10 +2577,10 @@ ImgPhotoSetSize(
clipBox.height = height;
clipRegion = TkCreateRegion();
TkUnionRectWithRegion(&clipBox, clipRegion, clipRegion);
- TkIntersectRegion(masterPtr->validRegion, clipRegion,
- masterPtr->validRegion);
+ TkIntersectRegion(modelPtr->validRegion, clipRegion,
+ modelPtr->validRegion);
TkDestroyRegion(clipRegion);
- TkClipBox(masterPtr->validRegion, &validBox);
+ TkClipBox(modelPtr->validRegion, &validBox);
}
/*
@@ -2596,8 +2596,8 @@ ImgPhotoSetSize(
* or written to a file.
*/
- if ((masterPtr->pix32 != NULL)
- && ((width == masterPtr->width) || (width == validBox.width))) {
+ if ((modelPtr->pix32 != NULL)
+ && ((width == modelPtr->width) || (width == validBox.width))) {
if (validBox.y > 0) {
memset(newPix32, 0, ((size_t) validBox.y * pitch));
}
@@ -2609,20 +2609,20 @@ ImgPhotoSetSize(
memset(newPix32, 0, ((size_t)height * pitch));
}
- if (masterPtr->pix32 != NULL) {
+ if (modelPtr->pix32 != NULL) {
/*
* Copy the common area over to the new array array and free the
* old array.
*/
- if (width == masterPtr->width) {
+ if (width == modelPtr->width) {
/*
* The region to be copied is contiguous.
*/
offset = validBox.y * pitch;
- memcpy(newPix32 + offset, masterPtr->pix32 + offset,
+ memcpy(newPix32 + offset, modelPtr->pix32 + offset,
((size_t)validBox.height * pitch));
} else if ((validBox.width > 0) && (validBox.height > 0)) {
@@ -2631,21 +2631,21 @@ ImgPhotoSetSize(
*/
destPtr = newPix32 + (validBox.y * width + validBox.x) * 4;
- srcPtr = masterPtr->pix32 + (validBox.y * masterPtr->width
+ srcPtr = modelPtr->pix32 + (validBox.y * modelPtr->width
+ validBox.x) * 4;
for (h = validBox.height; h > 0; h--) {
memcpy(destPtr, srcPtr, ((size_t)validBox.width * 4));
destPtr += width * 4;
- srcPtr += masterPtr->width * 4;
+ srcPtr += modelPtr->width * 4;
}
}
- ckfree(masterPtr->pix32);
+ ckfree(modelPtr->pix32);
}
- masterPtr->pix32 = newPix32;
- masterPtr->width = width;
- masterPtr->height = height;
+ modelPtr->pix32 = newPix32;
+ modelPtr->width = width;
+ modelPtr->height = height;
/*
* Dithering will be correct up to the end of the last pre-existing
@@ -2653,27 +2653,27 @@ ImgPhotoSetSize(
*/
if ((validBox.x > 0) || (validBox.y > 0)) {
- masterPtr->ditherX = 0;
- masterPtr->ditherY = 0;
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY = 0;
} else if (validBox.width == width) {
- if ((int) validBox.height < masterPtr->ditherY) {
- masterPtr->ditherX = 0;
- masterPtr->ditherY = validBox.height;
+ if ((int) validBox.height < modelPtr->ditherY) {
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY = validBox.height;
}
- } else if ((masterPtr->ditherY > 0)
- || ((int) validBox.width < masterPtr->ditherX)) {
- masterPtr->ditherX = validBox.width;
- masterPtr->ditherY = 0;
+ } else if ((modelPtr->ditherY > 0)
+ || ((int) validBox.width < modelPtr->ditherX)) {
+ modelPtr->ditherX = validBox.width;
+ modelPtr->ditherY = 0;
}
}
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
/*
* Now adjust the sizes of the pixmaps for all of the instances.
*/
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgPhotoInstanceSetSize(instancePtr);
}
@@ -3145,7 +3145,7 @@ MatchStringFormat(
* Tk_FindPhoto --
*
* This function is called to get an opaque handle (actually a
- * PhotoMaster *) for a given image, which can be used in subsequent
+ * PhotoModel *) for a given image, which can be used in subsequent
* calls to Tk_PhotoPutBlock, etc. The `name' parameter is the name of
* the image.
*
@@ -3167,7 +3167,7 @@ Tk_FindPhoto(
{
const Tk_ImageType *typePtr;
ClientData clientData =
- Tk_GetImageMasterData(interp, imageName, &typePtr);
+ Tk_GetImageModelData(interp, imageName, &typePtr);
if ((typePtr == NULL) || (typePtr->name != tkPhotoImageType.name)) {
return NULL;
@@ -3210,7 +3210,7 @@ Tk_PhotoPutBlock(
int compRule) /* Compositing rule to use when processing
* transparent pixels. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
Tk_PhotoImageBlock sourceBlock;
unsigned char *memToFree;
int xEnd, yEnd, greenOffset, blueOffset, alphaOffset;
@@ -3229,12 +3229,12 @@ Tk_PhotoPutBlock(
compRule &= ~SOURCE_IS_SIMPLE_ALPHA_PHOTO;
- if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) {
- width = masterPtr->userWidth - x;
+ if ((modelPtr->userWidth != 0) && ((x + width) > modelPtr->userWidth)) {
+ width = modelPtr->userWidth - x;
}
- if ((masterPtr->userHeight != 0)
- && ((y + height) > masterPtr->userHeight)) {
- height = masterPtr->userHeight - y;
+ if ((modelPtr->userHeight != 0)
+ && ((y + height) > modelPtr->userHeight)) {
+ height = modelPtr->userHeight - y;
}
if ((width <= 0) || (height <= 0)) {
return TCL_OK;
@@ -3255,18 +3255,18 @@ Tk_PhotoPutBlock(
*/
sourceBlock = *blockPtr;
memToFree = NULL;
- if (sourceBlock.pixelPtr >= masterPtr->pix32
- && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width
- * masterPtr->height * 4) {
+ if (sourceBlock.pixelPtr >= modelPtr->pix32
+ && sourceBlock.pixelPtr <= modelPtr->pix32 + modelPtr->width
+ * modelPtr->height * 4) {
/*
* Fix 5c51be6411: avoid reading
*
* (sourceBlock.pitch - sourceBlock.width * sourceBlock.pixelSize)
*
- * bytes past the end of masterPtr->pix32[] when
+ * bytes past the end of modelPtr->pix32[] when
*
- * blockPtr->pixelPtr > (masterPtr->pix32 +
- * 4 * masterPtr->width * masterPtr->height -
+ * blockPtr->pixelPtr > (modelPtr->pix32 +
+ * 4 * modelPtr->width * modelPtr->height -
* sourceBlock.height * sourceBlock.pitch)
*/
unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch +
@@ -3288,9 +3288,9 @@ Tk_PhotoPutBlock(
xEnd = x + width;
yEnd = y + height;
- if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) {
- if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width),
- MAX(yEnd, masterPtr->height)) == TCL_ERROR) {
+ if ((xEnd > modelPtr->width) || (yEnd > modelPtr->height)) {
+ if (ImgPhotoSetSize(modelPtr, MAX(xEnd, modelPtr->width),
+ MAX(yEnd, modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -3300,14 +3300,14 @@ Tk_PhotoPutBlock(
}
}
- if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY)
- && (x < masterPtr->ditherX))) {
+ if ((y < modelPtr->ditherY) || ((y == modelPtr->ditherY)
+ && (x < modelPtr->ditherX))) {
/*
* The dithering isn't correct past the start of this block.
*/
- masterPtr->ditherX = x;
- masterPtr->ditherY = y;
+ modelPtr->ditherX = x;
+ modelPtr->ditherY = y;
}
/*
@@ -3325,7 +3325,7 @@ Tk_PhotoPutBlock(
alphaOffset -= sourceBlock.offset[0];
}
if ((greenOffset != 0) || (blueOffset != 0)) {
- masterPtr->flags |= COLOR_IMAGE;
+ modelPtr->flags |= COLOR_IMAGE;
}
/*
@@ -3333,8 +3333,8 @@ Tk_PhotoPutBlock(
* single memmove, we do.
*/
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
- pitch = masterPtr->width * 4;
+ destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
+ pitch = modelPtr->width * 4;
/*
* Test to see if we can do the whole write in a single copy. This test is
@@ -3345,7 +3345,7 @@ Tk_PhotoPutBlock(
if ((sourceBlock.pixelSize == 4)
&& (greenOffset == 1) && (blueOffset == 2) && (alphaOffset == 3)
&& (width <= sourceBlock.width) && (height <= sourceBlock.height)
- && ((height == 1) || ((x == 0) && (width == masterPtr->width)
+ && ((height == 1) || ((x == 0) && (width == modelPtr->width)
&& (sourceBlock.pitch == pitch)))
&& (compRule == TK_PHOTO_COMPOSITE_SET)) {
memmove(destLinePtr, sourceBlock.pixelPtr + sourceBlock.offset[0],
@@ -3527,8 +3527,8 @@ Tk_PhotoPutBlock(
rect.width = width;
rect.height = height;
TkUnionRectWithRegion(&rect, workRgn, workRgn);
- TkSubtractRegion(masterPtr->validRegion, workRgn,
- masterPtr->validRegion);
+ TkSubtractRegion(modelPtr->validRegion, workRgn,
+ modelPtr->validRegion);
TkDestroyRegion(workRgn);
}
@@ -3537,17 +3537,17 @@ Tk_PhotoPutBlock(
* allow for more efficient per-platform implementations. [Bug 919066]
*/
- TkpBuildRegionFromAlphaData(masterPtr->validRegion, (unsigned) x,
+ TkpBuildRegionFromAlphaData(modelPtr->validRegion, (unsigned) x,
(unsigned) y, (unsigned) width, (unsigned) height,
- masterPtr->pix32 + (y * masterPtr->width + x) * 4 + 3,
- 4, (unsigned) masterPtr->width * 4);
+ modelPtr->pix32 + (y * modelPtr->width + x) * 4 + 3,
+ 4, (unsigned) modelPtr->width * 4);
} else {
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
- TkUnionRectWithRegion(&rect, masterPtr->validRegion,
- masterPtr->validRegion);
+ TkUnionRectWithRegion(&rect, modelPtr->validRegion,
+ modelPtr->validRegion);
}
/*
@@ -3562,21 +3562,21 @@ Tk_PhotoPutBlock(
* [Patch 1539990]
*/
- if (!(masterPtr->flags & COMPLEX_ALPHA)) {
+ if (!(modelPtr->flags & COMPLEX_ALPHA)) {
int x1;
for (x1=x ; x1<x+width ; x1++) {
unsigned char newAlpha;
- destLinePtr = masterPtr->pix32 + (y*masterPtr->width + x1)*4;
+ destLinePtr = modelPtr->pix32 + (y*modelPtr->width + x1)*4;
newAlpha = destLinePtr[3];
if (newAlpha && newAlpha != 255) {
- masterPtr->flags |= COMPLEX_ALPHA;
+ modelPtr->flags |= COMPLEX_ALPHA;
break;
}
}
}
- } else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) {
+ } else if ((alphaOffset != 0) || (modelPtr->flags & COMPLEX_ALPHA)) {
/*
* Check for partial transparency if alpha pixels are specified, or
* rescan if we already knew such pixels existed. To restrict this
@@ -3584,21 +3584,21 @@ Tk_PhotoPutBlock(
* the alpha pixels are.
*/
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
}
/*
* Update each instance.
*/
- Tk_DitherPhoto((Tk_PhotoHandle)masterPtr, x, y, width, height);
+ Tk_DitherPhoto((Tk_PhotoHandle)modelPtr, x, y, width, height);
/*
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height,
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, x, y, width, height,
+ modelPtr->width, modelPtr->height);
if (memToFree) ckfree(memToFree);
@@ -3648,7 +3648,7 @@ Tk_PhotoPutZoomedBlock(
int compRule) /* Compositing rule to use when processing
* transparent pixels. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
Tk_PhotoImageBlock sourceBlock;
unsigned char *memToFree;
int xEnd, yEnd, greenOffset, blueOffset, alphaOffset;
@@ -3676,12 +3676,12 @@ Tk_PhotoPutZoomedBlock(
if (zoomX <= 0 || zoomY <= 0) {
return TCL_OK;
}
- if ((masterPtr->userWidth != 0) && ((x + width) > masterPtr->userWidth)) {
- width = masterPtr->userWidth - x;
+ if ((modelPtr->userWidth != 0) && ((x + width) > modelPtr->userWidth)) {
+ width = modelPtr->userWidth - x;
}
- if ((masterPtr->userHeight != 0)
- && ((y + height) > masterPtr->userHeight)) {
- height = masterPtr->userHeight - y;
+ if ((modelPtr->userHeight != 0)
+ && ((y + height) > modelPtr->userHeight)) {
+ height = modelPtr->userHeight - y;
}
if (width <= 0 || height <= 0) {
return TCL_OK;
@@ -3701,18 +3701,18 @@ Tk_PhotoPutZoomedBlock(
*/
sourceBlock = *blockPtr;
memToFree = NULL;
- if (sourceBlock.pixelPtr >= masterPtr->pix32
- && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width
- * masterPtr->height * 4) {
+ if (sourceBlock.pixelPtr >= modelPtr->pix32
+ && sourceBlock.pixelPtr <= modelPtr->pix32 + modelPtr->width
+ * modelPtr->height * 4) {
/*
* Fix 5c51be6411: avoid reading
*
* (sourceBlock.pitch - sourceBlock.width * sourceBlock.pixelSize)
*
- * bytes past the end of masterPtr->pix32[] when
+ * bytes past the end of modelPtr->pix32[] when
*
- * blockPtr->pixelPtr > (masterPtr->pix32 +
- * 4 * masterPtr->width * masterPtr->height -
+ * blockPtr->pixelPtr > (modelPtr->pix32 +
+ * 4 * modelPtr->width * modelPtr->height -
* sourceBlock.height * sourceBlock.pitch)
*/
unsigned int cpyLen = (sourceBlock.height - 1) * sourceBlock.pitch +
@@ -3733,9 +3733,9 @@ Tk_PhotoPutZoomedBlock(
xEnd = x + width;
yEnd = y + height;
- if ((xEnd > masterPtr->width) || (yEnd > masterPtr->height)) {
- if (ImgPhotoSetSize(masterPtr, MAX(xEnd, masterPtr->width),
- MAX(yEnd, masterPtr->height)) == TCL_ERROR) {
+ if ((xEnd > modelPtr->width) || (yEnd > modelPtr->height)) {
+ if (ImgPhotoSetSize(modelPtr, MAX(xEnd, modelPtr->width),
+ MAX(yEnd, modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -3745,14 +3745,14 @@ Tk_PhotoPutZoomedBlock(
}
}
- if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY)
- && (x < masterPtr->ditherX))) {
+ if ((y < modelPtr->ditherY) || ((y == modelPtr->ditherY)
+ && (x < modelPtr->ditherX))) {
/*
* The dithering isn't correct past the start of this block.
*/
- masterPtr->ditherX = x;
- masterPtr->ditherY = y;
+ modelPtr->ditherX = x;
+ modelPtr->ditherY = y;
}
/*
@@ -3770,7 +3770,7 @@ Tk_PhotoPutZoomedBlock(
alphaOffset -= sourceBlock.offset[0];
}
if ((greenOffset != 0) || (blueOffset != 0)) {
- masterPtr->flags |= COLOR_IMAGE;
+ modelPtr->flags |= COLOR_IMAGE;
}
/*
@@ -3799,7 +3799,7 @@ Tk_PhotoPutZoomedBlock(
* Copy the data into our local 32-bit/pixel array.
*/
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
srcOrigPtr = sourceBlock.pixelPtr + sourceBlock.offset[0];
if (subsampleX < 0) {
srcOrigPtr += (sourceBlock.width - 1) * sourceBlock.pixelSize;
@@ -3808,7 +3808,7 @@ Tk_PhotoPutZoomedBlock(
srcOrigPtr += (sourceBlock.height - 1) * sourceBlock.pitch;
}
- pitch = masterPtr->width * 4;
+ pitch = modelPtr->width * 4;
for (hLeft = height; hLeft > 0; ) {
hCopy = MIN(hLeft, blockHt);
hLeft -= hCopy;
@@ -3895,22 +3895,22 @@ Tk_PhotoPutZoomedBlock(
rect.width = width;
rect.height = 1;
TkUnionRectWithRegion(&rect, workRgn, workRgn);
- TkSubtractRegion(masterPtr->validRegion, workRgn,
- masterPtr->validRegion);
+ TkSubtractRegion(modelPtr->validRegion, workRgn,
+ modelPtr->validRegion);
TkDestroyRegion(workRgn);
}
- TkpBuildRegionFromAlphaData(masterPtr->validRegion,
+ TkpBuildRegionFromAlphaData(modelPtr->validRegion,
(unsigned)x, (unsigned)y, (unsigned)width, (unsigned)height,
- &masterPtr->pix32[(y * masterPtr->width + x) * 4 + 3], 4,
- (unsigned) masterPtr->width * 4);
+ &modelPtr->pix32[(y * modelPtr->width + x) * 4 + 3], 4,
+ (unsigned) modelPtr->width * 4);
} else {
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
- TkUnionRectWithRegion(&rect, masterPtr->validRegion,
- masterPtr->validRegion);
+ TkUnionRectWithRegion(&rect, modelPtr->validRegion,
+ modelPtr->validRegion);
}
/*
@@ -3923,38 +3923,38 @@ Tk_PhotoPutZoomedBlock(
* 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)) {
+ if (!(modelPtr->flags & COMPLEX_ALPHA)) {
unsigned char newAlpha;
- destLinePtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4;
+ destLinePtr = modelPtr->pix32 + (y * modelPtr->width + x) * 4;
newAlpha = destLinePtr[3];
if (newAlpha && newAlpha != 255) {
- masterPtr->flags |= COMPLEX_ALPHA;
+ modelPtr->flags |= COMPLEX_ALPHA;
}
}
- } else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) {
+ } else if ((alphaOffset != 0) || (modelPtr->flags & COMPLEX_ALPHA)) {
/*
* Check for partial transparency if alpha pixels are specified, or
* rescan if we already knew such pixels existed. To restrict this
* Toggle to only checking the changed pixels requires knowing where
* the alpha pixels are.
*/
- ToggleComplexAlphaIfNeeded(masterPtr);
+ ToggleComplexAlphaIfNeeded(modelPtr);
}
/*
* Update each instance.
*/
- Tk_DitherPhoto((Tk_PhotoHandle) masterPtr, x, y, width, height);
+ Tk_DitherPhoto((Tk_PhotoHandle) modelPtr, x, y, width, height);
/*
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, x, y, width, height, masterPtr->width,
- masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, x, y, width, height, modelPtr->width,
+ modelPtr->height);
if (memToFree) ckfree(memToFree);
@@ -3972,14 +3972,14 @@ Tk_PhotoPutZoomedBlock(
* Tk_DitherPhoto --
*
* This function is called to update an area of each instance's pixmap by
- * dithering the corresponding area of the image master.
+ * dithering the corresponding area of the image model.
*
* 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
+ * *modelPtr indicating which area of the image is correctly dithered
* get updated.
*
*----------------------------------------------------------------------
@@ -3987,20 +3987,20 @@ Tk_PhotoPutZoomedBlock(
void
Tk_DitherPhoto(
- Tk_PhotoHandle photo, /* Image master whose instances are to be
+ Tk_PhotoHandle photo, /* Image model 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;
+ PhotoModel *modelPtr = (PhotoModel *) photo;
PhotoInstance *instancePtr;
if ((width <= 0) || (height <= 0)) {
return;
}
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgDitherInstance(instancePtr, x, y, width, height);
}
@@ -4010,23 +4010,23 @@ Tk_DitherPhoto(
* will extend the correctly dithered region.
*/
- if (((y < masterPtr->ditherY)
- || ((y == masterPtr->ditherY) && (x <= masterPtr->ditherX)))
- && ((y + height) > (masterPtr->ditherY))) {
+ if (((y < modelPtr->ditherY)
+ || ((y == modelPtr->ditherY) && (x <= modelPtr->ditherX)))
+ && ((y + height) > (modelPtr->ditherY))) {
/*
* This block starts inside (or immediately after) the correctly
* dithered region, so the first scan line at least will be right.
- * Furthermore this block extends into scanline masterPtr->ditherY.
+ * Furthermore this block extends into scanline modelPtr->ditherY.
*/
- if ((x == 0) && (width == masterPtr->width)) {
+ if ((x == 0) && (width == modelPtr->width)) {
/*
* We are doing the full width, therefore the dithering will be
* correct to the end.
*/
- masterPtr->ditherX = 0;
- masterPtr->ditherY = y + height;
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY = y + height;
} else {
/*
* We are doing partial scanlines, therefore the
@@ -4034,11 +4034,11 @@ Tk_DitherPhoto(
* line.
*/
- if (x <= masterPtr->ditherX) {
- masterPtr->ditherX = x + width;
- if (masterPtr->ditherX >= masterPtr->width) {
- masterPtr->ditherX = 0;
- masterPtr->ditherY++;
+ if (x <= modelPtr->ditherX) {
+ modelPtr->ditherX = x + width;
+ if (modelPtr->ditherX >= modelPtr->width) {
+ modelPtr->ditherX = 0;
+ modelPtr->ditherY++;
}
}
}
@@ -4066,29 +4066,29 @@ void
Tk_PhotoBlank(
Tk_PhotoHandle handle) /* Handle for the image to be blanked. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
PhotoInstance *instancePtr;
- masterPtr->ditherX = masterPtr->ditherY = 0;
- masterPtr->flags = 0;
+ modelPtr->ditherX = modelPtr->ditherY = 0;
+ modelPtr->flags = 0;
/*
* The image has valid data nowhere.
*/
- if (masterPtr->validRegion != NULL) {
- TkDestroyRegion(masterPtr->validRegion);
+ if (modelPtr->validRegion != NULL) {
+ TkDestroyRegion(modelPtr->validRegion);
}
- masterPtr->validRegion = TkCreateRegion();
+ modelPtr->validRegion = TkCreateRegion();
/*
* Clear out the 32-bit pixel storage array. Clear out the dithering error
* arrays for each instance.
*/
- memset(masterPtr->pix32, 0,
- ((size_t)masterPtr->width * masterPtr->height * 4));
- for (instancePtr = masterPtr->instancePtr; instancePtr != NULL;
+ memset(modelPtr->pix32, 0,
+ ((size_t)modelPtr->width * modelPtr->height * 4));
+ for (instancePtr = modelPtr->instancePtr; instancePtr != NULL;
instancePtr = instancePtr->nextPtr) {
TkImgResetDither(instancePtr);
}
@@ -4097,8 +4097,8 @@ Tk_PhotoBlank(
* Tell the core image code that this image has changed.
*/
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, masterPtr->width,
- masterPtr->height, masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, modelPtr->width,
+ modelPtr->height, modelPtr->width, modelPtr->height);
}
/*
@@ -4128,17 +4128,17 @@ Tk_PhotoExpand(
Tk_PhotoHandle handle, /* Handle for the image to be expanded. */
int width, int height) /* Desired minimum dimensions of the image. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
- if (width <= masterPtr->width) {
- width = masterPtr->width;
+ if (width <= modelPtr->width) {
+ width = modelPtr->width;
}
- if (height <= masterPtr->height) {
- height = masterPtr->height;
+ if (height <= modelPtr->height) {
+ height = modelPtr->height;
}
- if ((width != masterPtr->width) || (height != masterPtr->height)) {
- if (ImgPhotoSetSize(masterPtr, MAX(width, masterPtr->width),
- MAX(height, masterPtr->height)) == TCL_ERROR) {
+ if ((width != modelPtr->width) || (height != modelPtr->height)) {
+ if (ImgPhotoSetSize(modelPtr, MAX(width, modelPtr->width),
+ MAX(height, modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -4146,8 +4146,8 @@ Tk_PhotoExpand(
}
return TCL_ERROR;
}
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0, masterPtr->width,
- masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0, modelPtr->width,
+ modelPtr->height);
}
return TCL_OK;
}
@@ -4176,10 +4176,10 @@ Tk_PhotoGetSize(
/* The dimensions of the image are returned
* here. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
- *widthPtr = masterPtr->width;
- *heightPtr = masterPtr->height;
+ *widthPtr = modelPtr->width;
+ *heightPtr = modelPtr->height;
}
/*
@@ -4208,12 +4208,12 @@ Tk_PhotoSetSize(
* set. */
int width, int height) /* New dimensions for the image. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
- masterPtr->userWidth = width;
- masterPtr->userHeight = height;
- if (ImgPhotoSetSize(masterPtr, ((width > 0) ? width: masterPtr->width),
- ((height > 0) ? height: masterPtr->height)) == TCL_ERROR) {
+ modelPtr->userWidth = width;
+ modelPtr->userHeight = height;
+ if (ImgPhotoSetSize(modelPtr, ((width > 0) ? width: modelPtr->width),
+ ((height > 0) ? height: modelPtr->height)) == TCL_ERROR) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1));
@@ -4221,8 +4221,8 @@ Tk_PhotoSetSize(
}
return TCL_ERROR;
}
- Tk_ImageChanged(masterPtr->tkMaster, 0, 0, 0, 0,
- masterPtr->width, masterPtr->height);
+ Tk_ImageChanged(modelPtr->tkModel, 0, 0, 0, 0,
+ modelPtr->width, modelPtr->height);
return TCL_OK;
}
@@ -4251,9 +4251,9 @@ TkPhotoGetValidRegion(
Tk_PhotoHandle handle) /* Handle for the image whose valid region is
* to obtained. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
- return masterPtr->validRegion;
+ return modelPtr->validRegion;
}
/*
@@ -4279,7 +4279,7 @@ TkPhotoGetValidRegion(
static char *
ImgGetPhoto(
- PhotoMaster *masterPtr, /* Handle for the photo image from which image
+ PhotoModel *modelPtr, /* Handle for the photo image from which image
* data is desired. */
Tk_PhotoImageBlock *blockPtr,
/* Information about the address and layout of
@@ -4289,13 +4289,13 @@ ImgGetPhoto(
unsigned char *pixelPtr;
int x, y, greenOffset, blueOffset, alphaOffset;
- Tk_PhotoGetImage((Tk_PhotoHandle) masterPtr, blockPtr);
+ Tk_PhotoGetImage((Tk_PhotoHandle) modelPtr, blockPtr);
blockPtr->pixelPtr += optPtr->fromY * blockPtr->pitch
+ optPtr->fromX * blockPtr->pixelSize;
blockPtr->width = optPtr->fromX2 - optPtr->fromX;
blockPtr->height = optPtr->fromY2 - optPtr->fromY;
- if (!(masterPtr->flags & COLOR_IMAGE) &&
+ if (!(modelPtr->flags & COLOR_IMAGE) &&
(!(optPtr->options & OPT_BACKGROUND)
|| ((optPtr->background->red == optPtr->background->green)
&& (optPtr->background->red == optPtr->background->blue)))) {
@@ -4323,7 +4323,7 @@ ImgGetPhoto(
blueOffset = blockPtr->offset[2] - blockPtr->offset[0];
if (((optPtr->options & OPT_BACKGROUND) && alphaOffset) ||
((optPtr->options & OPT_GRAYSCALE) && (greenOffset||blueOffset))) {
- int newPixelSize,x,y;
+ int newPixelSize;
unsigned char *srcPtr, *destPtr;
char *data;
@@ -4476,12 +4476,12 @@ Tk_PhotoGetImage(
/* Information about the address and layout of
* the image data is returned here. */
{
- PhotoMaster *masterPtr = (PhotoMaster *) handle;
+ PhotoModel *modelPtr = (PhotoModel *) handle;
- blockPtr->pixelPtr = masterPtr->pix32;
- blockPtr->width = masterPtr->width;
- blockPtr->height = masterPtr->height;
- blockPtr->pitch = masterPtr->width * 4;
+ blockPtr->pixelPtr = modelPtr->pix32;
+ blockPtr->width = modelPtr->width;
+ blockPtr->height = modelPtr->height;
+ blockPtr->pitch = modelPtr->width * 4;
blockPtr->pixelSize = 4;
blockPtr->offset[0] = 0;
blockPtr->offset[1] = 1;
@@ -4530,7 +4530,7 @@ ImgPhotoPostscript(
*
* Tk_PhotoPutBlock_NoComposite, Tk_PhotoPutZoomedBlock_NoComposite --
*
- * These backward-compatability functions just exist to fill slots in stubs
+ * These backward-compatibility 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
@@ -4571,7 +4571,7 @@ Tk_PhotoPutZoomedBlock_NoComposite(
* Tk_PhotoExpand_Panic, Tk_PhotoPutBlock_Panic,
* Tk_PhotoPutZoomedBlock_Panic, Tk_PhotoSetSize_Panic
*
- * Backward compatability functions for preserving the old behaviour (i.e.
+ * Backward compatibility 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
diff --git a/generic/tkImgPhoto.h b/generic/tkImgPhoto.h
index 2554cf8..7ac738f 100644
--- a/generic/tkImgPhoto.h
+++ b/generic/tkImgPhoto.h
@@ -3,10 +3,10 @@
*
* Declarations for images of type "photo" for Tk.
*
- * Copyright (c) 1994 The Australian National University.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 2002-2008 Donal K. Fellows
- * Copyright (c) 2003 ActiveState Corporation.
+ * Copyright © 1994 The Australian National University.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2002-2008 Donal K. Fellows
+ * Copyright © 2003 ActiveState Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -27,10 +27,11 @@
* Forward declarations of the structures we define.
*/
+#define PhotoMaster PhotoModel
typedef struct ColorTableId ColorTableId;
typedef struct ColorTable ColorTable;
typedef struct PhotoInstance PhotoInstance;
-typedef struct PhotoMaster PhotoMaster;
+typedef struct PhotoModel PhotoModel;
/*
* A signed 8-bit integral type. If chars are unsigned and the compiler isn't
@@ -49,13 +50,6 @@ typedef struct PhotoMaster PhotoMaster;
#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.
- */
-
-typedef unsigned int pixel;
-
-/*
* The maximum number of pixels to transmit to the server in a single
* XPutImage call.
*/
@@ -109,10 +103,10 @@ struct ColorTable {
XVisualInfo visualInfo; /* Information about the visual for windows
* using this color table. */
- pixel redValues[256]; /* Maps 8-bit values of red intensity to a
+ unsigned 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 greenValues[256]; /* Ditto for green intensity. */
+ unsigned blueValues[256]; /* Ditto for blue intensity. */
unsigned long *pixelMap; /* Actual pixel values allocated. */
unsigned char colorQuant[3][256];
@@ -144,11 +138,11 @@ struct ColorTable {
#define MAP_COLORS 8
/*
- * Definition of the data associated with each photo image master.
+ * Definition of the data associated with each photo image model.
*/
-struct PhotoMaster {
- Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means the
+struct PhotoModel {
+ Tk_ImageModel tkModel; /* Tk's token for image model. NULL means the
* image is being deleted. */
Tcl_Interp *interp; /* Interpreter associated with the application
* using this image. */
@@ -173,11 +167,11 @@ struct PhotoMaster {
TkRegion validRegion; /* Tk region indicating which parts of the
* image have valid image data. */
PhotoInstance *instancePtr; /* First in the list of instances associated
- * with this master. */
+ * with this model. */
};
/*
- * Bit definitions for the flags field of a PhotoMaster.
+ * Bit definitions for the flags field of a PhotoModel.
* COLOR_IMAGE: 1 means that the image has different color
* components.
* IMAGE_CHANGED: 1 means that the instances of this image need
@@ -204,12 +198,12 @@ struct PhotoMaster {
*/
struct PhotoInstance {
- PhotoMaster *masterPtr; /* Pointer to master for image. */
+ PhotoModel *modelPtr; /* Pointer to model for image. */
Display *display; /* Display for windows using this instance. */
Colormap colormap; /* The image may only be used in windows with
* this particular colormap. */
PhotoInstance *nextPtr; /* Pointer to the next instance in the list of
- * instances associated with this master. */
+ * instances associated with this model. */
#if TCL_MAJOR_VERSION > 8
size_t refCount; /* Number of instances using this structure. */
#else
@@ -218,7 +212,7 @@ struct PhotoInstance {
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. */
+ * specified for the model. */
ColorTable *colorTablePtr; /* Pointer to information about colors
* allocated for image display in windows like
* this one. */
diff --git a/generic/tkImgSVGnano.c b/generic/tkImgSVGnano.c
index 7575f86..c9437ab 100644
--- a/generic/tkImgSVGnano.c
+++ b/generic/tkImgSVGnano.c
@@ -3,16 +3,16 @@
*
* A photo file handler for SVG files.
*
- * Copyright (c) 2013-14 Mikko Mononen memon@inside.org
- * Copyright (c) 2018 Christian Gollwitzer auriocus@gmx.de
- * Copyright (c) 2018 Rene Zaumseil r.zaumseil@freenet.de
+ * Copyright © 2013-14 Mikko Mononen memon@inside.org
+ * Copyright © 2018 Christian Gollwitzer auriocus@gmx.de
+ * Copyright © 2018 Christian Werner https://www.androwish.org/
+ * Copyright © 2018 Rene Zaumseil r.zaumseil@freenet.de
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* This handler is build using the original nanosvg library files from
- * https://github.com/memononen/nanosvg and the tcl extension files from
- * https://github.com/auriocus/tksvg
+ * https://github.com/memononen/nanosvg
*
*/
@@ -52,6 +52,8 @@ typedef struct {
RastOpts ropts;
} NSVGcache;
+static const void * MemMem(const void *haystack, size_t haysize,
+ const void *needle, size_t needlen);
static int FileMatchSVG(Tcl_Channel chan, const char *fileName,
Tcl_Obj *format, int *widthPtr, int *heightPtr,
Tcl_Interp *interp);
@@ -101,6 +103,46 @@ Tk_PhotoImageFormat tkImgFmtSVGnano = {
/*
*----------------------------------------------------------------------
*
+ * MemMem --
+ *
+ * Like strstr() but operating on memory buffers with sizes.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static const void *
+MemMem(const void *haystack, size_t haylen,
+ const void *needle, size_t needlen)
+{
+ const void *hayend, *second, *p;
+ unsigned char first;
+
+ if ((needlen <= 0) || (haylen < needlen)) {
+ return NULL;
+ }
+ hayend = (const void *) ((char *) haystack + haylen - needlen);
+ first = ((char *) needle)[0];
+ second = (const void *) ((char *) needle + 1);
+ needlen -= 1;
+ while (haystack < hayend) {
+ p = memchr(haystack, first, (char *) hayend - (char *) haystack);
+ if (p == NULL) {
+ break;
+ }
+ if (needlen == 0) {
+ return p;
+ }
+ haystack = (const void *) ((char *) p + 1);
+ if (memcmp(second, haystack, needlen) == 0) {
+ return p;
+ }
+ }
+ return NULL;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* FileMatchSVG --
*
* This function is invoked by the photo image type to see if a file
@@ -132,12 +174,24 @@ FileMatchSVG(
(void)fileName;
CleanCache(interp);
- if (Tcl_ReadChars(chan, dataObj, -1, 0) == TCL_IO_FAILURE) {
+ if (Tcl_ReadChars(chan, dataObj, 4096, 0) == TCL_IO_FAILURE) {
+ /* in case of an error reading the file */
+ Tcl_DecrRefCount(dataObj);
+ return 0;
+ }
+ data = Tcl_GetStringFromObj(dataObj, &length);
+ /* should have a '<svg' and a '>' in the first 4k */
+ if ((memchr(data, '>', length) == NULL) ||
+ (MemMem(data, length, "<svg", 4) == NULL)) {
+ Tcl_DecrRefCount(dataObj);
+ return 0;
+ }
+ if (!Tcl_Eof(chan) && (Tcl_ReadChars(chan, dataObj, -1, 1) == TCL_IO_FAILURE)) {
/* in case of an error reading the file */
Tcl_DecrRefCount(dataObj);
return 0;
}
- data = TkGetStringFromObj(dataObj, &length);
+ data = Tcl_GetStringFromObj(dataObj, &length);
nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts);
Tcl_DecrRefCount(dataObj);
if (nsvgImage != NULL) {
@@ -200,7 +254,7 @@ FileReadSVG(
Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "READ_ERROR", NULL);
return TCL_ERROR;
}
- data = TkGetStringFromObj(dataObj, &length);
+ data = Tcl_GetStringFromObj(dataObj, &length);
nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj,
&ropts);
Tcl_DecrRefCount(dataObj);
@@ -237,13 +291,19 @@ StringMatchSVG(
int *widthPtr, int *heightPtr,
Tcl_Interp *interp)
{
- TkSizeT length;
+ TkSizeT length, testLength;
const char *data;
RastOpts ropts;
NSVGimage *nsvgImage;
CleanCache(interp);
- data = TkGetStringFromObj(dataObj, &length);
+ data = Tcl_GetStringFromObj(dataObj, &length);
+ /* should have a '<svg' and a '>' in the first 4k */
+ testLength = (length > 4096) ? 4096 : length;
+ if ((memchr(data, '>', testLength) == NULL) ||
+ (MemMem(data, testLength, "<svg", 4) == NULL)) {
+ return 0;
+ }
nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts);
if (nsvgImage != NULL) {
GetScaleFromParameters(nsvgImage, &ropts, widthPtr, heightPtr);
@@ -293,7 +353,7 @@ StringReadSVG(
NSVGimage *nsvgImage = GetCachedSVG(interp, dataObj, formatObj, &ropts);
if (nsvgImage == NULL) {
- data = TkGetStringFromObj(dataObj, &length);
+ data = Tcl_GetStringFromObj(dataObj, &length);
nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj,
&ropts);
}
@@ -336,7 +396,7 @@ ParseSVGWithOptions(
static const char *const fmtOptions[] = {
"-dpi", "-scale", "-scaletoheight", "-scaletowidth", NULL
};
- enum fmtOptions {
+ enum fmtOptionsEnum {
OPT_DPI, OPT_SCALE, OPT_SCALE_TO_HEIGHT, OPT_SCALE_TO_WIDTH
};
@@ -394,7 +454,7 @@ ParseSVGWithOptions(
/*
* check that only one scale option is given
*/
- switch ((enum fmtOptions) optIndex) {
+ switch ((enum fmtOptionsEnum)optIndex) {
case OPT_SCALE:
case OPT_SCALE_TO_HEIGHT:
case OPT_SCALE_TO_WIDTH:
@@ -414,7 +474,7 @@ ParseSVGWithOptions(
/*
* Decode parameters
*/
- switch ((enum fmtOptions) optIndex) {
+ switch ((enum fmtOptionsEnum) optIndex) {
case OPT_DPI:
if (Tcl_GetDoubleFromObj(interp, objv[0], &dpi) == TCL_ERROR) {
goto error;
@@ -531,7 +591,16 @@ RasterizeSVG(
NULL);
goto cleanAST;
}
- imgData = (unsigned char *)attemptckalloc(w * h *4);
+
+ /* Tk Ticket [822330269b] Check potential int overflow in following ckalloc */
+ unsigned long long wh = (unsigned long long)w * (unsigned long long)h;
+ if ( wh > INT_MAX / 4) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("image size overflow", -1));
+ Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "IMAGE_SIZE_OVERFLOW", NULL);
+ goto cleanRAST;
+ }
+
+ imgData = (unsigned char *)attemptckalloc(wh * 4);
if (imgData == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot alloc image buffer", -1));
Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "OUT_OF_MEMORY", NULL);
@@ -694,7 +763,7 @@ CacheSVG(
if (cachePtr != NULL) {
cachePtr->dataOrChan = dataOrChan;
if (formatObj != NULL) {
- data = TkGetStringFromObj(formatObj, &length);
+ data = Tcl_GetStringFromObj(formatObj, &length);
Tcl_DStringAppend(&cachePtr->formatString, data, length);
}
cachePtr->nsvgImage = nsvgImage;
@@ -735,7 +804,7 @@ GetCachedSVG(
if ((cachePtr != NULL) && (cachePtr->nsvgImage != NULL) &&
(cachePtr->dataOrChan == dataOrChan)) {
if (formatObj != NULL) {
- data = TkGetStringFromObj(formatObj, &length);
+ data = Tcl_GetStringFromObj(formatObj, &length);
if (strcmp(data, Tcl_DStringValue(&cachePtr->formatString)) == 0) {
nsvgImage = cachePtr->nsvgImage;
*ropts = cachePtr->ropts;
diff --git a/generic/tkImgUtil.c b/generic/tkImgUtil.c
index 6a43fbe..e1b9c38 100644
--- a/generic/tkImgUtil.c
+++ b/generic/tkImgUtil.c
@@ -3,7 +3,7 @@
*
* This file contains image related utility functions.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 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.
diff --git a/generic/tkInt.decls b/generic/tkInt.decls
index df1e9b2..3f91d5e 100644
--- a/generic/tkInt.decls
+++ b/generic/tkInt.decls
@@ -4,8 +4,8 @@
# 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>
+# Copyright © 1998-1999 Scriptics Corporation.
+# Copyright © 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.
@@ -635,20 +635,20 @@ declare 184 {
double y, double angle)
}
-# Debugging / testing functions for photo images
-declare 185 {
- int TkDebugPhotoStringMatchDef(Tcl_Interp *inter, Tcl_Obj *data,
- Tcl_Obj *formatString, int *widthPtr, int *heightPtr)
-}
-
# Support for aqua's inability to draw outside [NSView drawRect:]
-declare 186 aqua {
+declare 185 macosx {
void TkpRedrawWidget(Tk_Window tkwin)
}
-declare 187 aqua {
+declare 186 macosx {
int TkpWillDrawWidget(Tk_Window tkwin)
}
+# Debugging / testing functions for photo images
+declare 187 {
+ int TkDebugPhotoStringMatchDef(Tcl_Interp *inter, Tcl_Obj *data,
+ Tcl_Obj *formatString, int *widthPtr, int *heightPtr)
+}
+
##############################################################################
@@ -918,9 +918,10 @@ declare 9 aqua {
declare 10 aqua {
int TkMacOSXDispatchMenuEvent(int menuID, int index)
}
-declare 11 aqua {
- void TkMacOSXInstallCursor(int resizeOverride)
-}
+# Now a static function
+# declare 11 aqua {
+# void TkMacOSXInstallCursor(int resizeOverride)
+# }
declare 12 aqua {
void TkMacOSXHandleTearoffMenu(void)
}
@@ -962,9 +963,10 @@ declare 24 aqua {
declare 25 aqua {
void TkMacOSXMenuClick(void)
}
-declare 26 aqua {
- void TkMacOSXRegisterOffScreenWindow(Window window, void *portPtr)
-}
+# The corresponding Unregister was not a stub, and this should be static.
+#declare 26 aqua {
+# void TkMacOSXRegisterOffScreenWindow(Window window, void *portPtr)
+#}
declare 27 aqua {
int TkMacOSXResizable(TkWindow *winPtr)
}
@@ -983,9 +985,10 @@ declare 31 aqua {
declare 32 aqua {
void TkMacOSXUpdateClipRgn(TkWindow *winPtr)
}
-declare 33 aqua {
- void TkMacOSXUnregisterMacWindow(void *portPtr)
-}
+# This was not implemented. Perhaps meant to be OffScreen ?
+#declare 33 aqua {
+# void TkMacOSXUnregisterMacWindow(void *portPtr)
+#}
declare 34 aqua {
int TkMacOSXUseMenuID(short macID)
}
@@ -1027,7 +1030,7 @@ declare 47 aqua {
Tk_Window TkpGetCapture(void)
}
declare 49 aqua {
- Tk_Window TkGetTransientMaster(TkWindow *winPtr)
+ Tk_Window TkMacOSXGetContainer(TkWindow *winPtr)
}
declare 50 aqua {
int TkGenerateButtonEvent(int x, int y, Window window, unsigned int state)
@@ -1931,6 +1934,10 @@ declare 104 macosx {
declare 105 macosx {
XHostAddress *XListHosts(Display *d, int *i, Bool *b)
}
+declare 106 macosx {
+ int XSetClipRectangles(Display *display, GC gc, int clip_x_origin,
+ int clip_y_origin, XRectangle rectangles[], int n, int ordering)
+}
declare 107 macosx {
int XFlush(Display *display)
}
diff --git a/generic/tkInt.h b/generic/tkInt.h
index c9bfe3d..fc9dc06 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1998 by Scriptics Corporation.
+ * Copyright (c) 1998 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -88,6 +88,16 @@
# define Tcl_UtfToChar16DString Tcl_UtfToUniCharDString
#endif
+#if defined(__GNUC__) && (__GNUC__ > 2)
+# define TKFLEXARRAY 0
+#else
+# define TKFLEXARRAY 1
+#endif
+
+#if !defined(Tcl_GetParent) && (TCL_MAJOR_VERSION < 9) && (TCL_MINOR_VERSION < 7)
+# define Tcl_GetParent Tcl_GetMaster
+#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
@@ -122,6 +132,12 @@
# define TCL_Z_MODIFIER ""
# endif
#endif /* !TCL_Z_MODIFIER */
+#undef TCL_LL_MODIFIER
+#if defined(_WIN32) && (!defined(__USE_MINGW_ANSI_STDIO) || !__USE_MINGW_ANSI_STDIO)
+# define TCL_LL_MODIFIER "I64"
+#else
+# define TCL_LL_MODIFIER "ll"
+#endif
/*
* Opaque type declarations:
@@ -359,12 +375,12 @@ 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. */
+ /* Hash table that maps from a container's
+ * Tk_Window token to a list of windows managed
+ * by that container. */
int geomInit;
-#define TkGetGeomMaster(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \
+#define TkGetContainer(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \
((TkWindow *)tkwin)->maintainerPtr : ((TkWindow *)tkwin)->parentPtr)
/*
@@ -442,9 +458,9 @@ typedef struct TkDisplay {
*/
int placeInit; /* 0 means tables below need initializing. */
- Tcl_HashTable masterTable; /* Maps from Tk_Window toke to the Master
+ Tcl_HashTable containerTable; /* Maps from Tk_Window token to the Container
* structure for the window, if it exists. */
- Tcl_HashTable slaveTable; /* Maps from Tk_Window toke to the Slave
+ Tcl_HashTable contentTable; /* Maps from Tk_Window token to the Content
* structure for the window, if it exists. */
/*
@@ -576,14 +592,11 @@ typedef struct TkDisplay {
* Whether to use input methods for this display
* TK_DISPLAY_WM_TRACING: (default off)
* Whether we should do wm tracing on this display.
- * TK_DISPLAY_IN_WARP: (default off)
- * Indicates that we are in a pointer warp
*/
#define TK_DISPLAY_COLLAPSE_MOTION_EVENTS (1 << 0)
#define TK_DISPLAY_USE_IM (1 << 1)
#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
@@ -679,7 +692,7 @@ typedef struct TkMainInfo {
/* 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
+ Tcl_HashTable imageTable; /* Maps from image names to Tk_ImageModel
* structures. Managed by tkImage.c. */
int strictMotif; /* This is linked to the tk_strictMotif global
* variable. */
@@ -726,7 +739,7 @@ typedef struct TkWindow {
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
+ Window window; /* X's id for window. None 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
@@ -874,9 +887,9 @@ typedef struct TkWindow {
#endif /* TK_USE_INPUT_METHODS */
char *geomMgrName; /* Records the name of the geometry manager. */
struct TkWindow *maintainerPtr;
- /* The geometry master for this window. The
- * value is NULL if the window has no master or
- * if its master is its parent. */
+ /* The geometry container for this window. The
+ * value is NULL if the window has no container or
+ * if its container is its parent. */
#if !defined(TK_USE_INPUT_METHODS) && (TCL_MAJOR_VERSION < 9)
XIC inputContext; /* XIM input context. */
int ximGeneration; /* Used to invalidate XIC */
@@ -894,7 +907,7 @@ typedef struct {
char trans_chars[XMaxTransChars];
/* translated characters */
unsigned char nbytes;
-#elif !defined(MAC_OSC_TK)
+#elif !defined(MAC_OSX_TK)
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
@@ -1004,6 +1017,11 @@ typedef struct TkpClipMask {
#define ALT_MASK (AnyModifier<<2)
#define EXTENDED_MASK (AnyModifier<<3)
+/*
+ * Buttons 8 and 9 are the Xbuttons (left and right side-buttons). On Windows/Mac, those
+ * are known as Buttons 4 and 5. At script level, they also get the numbers 4 and 5.
+ */
+
#ifndef Button8
# define Button8 8
#endif
@@ -1034,8 +1052,6 @@ typedef struct TkpClipMask {
|Button6Mask|Button7Mask|Button8Mask|Button9Mask)
-MODULE_SCOPE unsigned long TkGetButtonMask(unsigned int);
-
/*
* Object types not declared in tkObj.c need to be mentioned here so they can
* be properly registered with Tcl:
@@ -1267,13 +1283,10 @@ MODULE_SCOPE int Tk_WinfoObjCmd(ClientData clientData,
MODULE_SCOPE int Tk_WmObjCmd(ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[]);
-MODULE_SCOPE int Tk_GetDoublePixelsFromObj(Tcl_Interp *interp,
- Tk_Window tkwin, Tcl_Obj *objPtr,
- double *doublePtr);
-MODULE_SCOPE int TkSetGeometryMaster(Tcl_Interp *interp,
- Tk_Window tkwin, const char *master);
-MODULE_SCOPE void TkFreeGeometryMaster(Tk_Window tkwin,
- const char *master);
+MODULE_SCOPE int TkSetGeometryContainer(Tcl_Interp *interp,
+ Tk_Window tkwin, const char *name);
+MODULE_SCOPE void TkFreeGeometryContainer(Tk_Window tkwin,
+ const char *name);
MODULE_SCOPE void TkEventInit(void);
MODULE_SCOPE void TkRegisterObjTypes(void);
@@ -1315,11 +1328,14 @@ MODULE_SCOPE int TkParsePadAmount(Tcl_Interp *interp,
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 void TkpDrawAngledCharsInContext(Display * display,
+ Drawable drawable, GC gc, Tk_Font tkfont,
+ const char *source, int numBytes, int rangeStart,
+ int rangeLength, double x, double y, double angle);
MODULE_SCOPE int TkpMeasureCharsInContext(Tk_Font tkfont,
const char *source, int numBytes, int rangeStart,
int rangeLength, int maxLength, int flags,
@@ -1333,7 +1349,6 @@ MODULE_SCOPE void TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont,
MODULE_SCOPE void TkpDrawFrameEx(Tk_Window tkwin, Drawable drawable,
Tk_3DBorder border, int highlightWidth,
int borderWidth, int relief);
-MODULE_SCOPE Tcl_Obj * TkNewWindowObj(Tk_Window tkwin);
MODULE_SCOPE void TkpShowBusyWindow(TkBusy busy);
MODULE_SCOPE void TkpHideBusyWindow(TkBusy busy);
MODULE_SCOPE void TkpMakeTransparentWindowExist(Tk_Window tkwin,
@@ -1343,8 +1358,6 @@ MODULE_SCOPE void TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef,
TkBusy busy);
MODULE_SCOPE int TkBackgroundEvalObjv(Tcl_Interp *interp,
int objc, Tcl_Obj *const *objv, int flags);
-MODULE_SCOPE void TkSendVirtualEvent(Tk_Window tgtWin,
- const char *eventName, Tcl_Obj *detail);
MODULE_SCOPE Tcl_Command TkMakeEnsemble(Tcl_Interp *interp,
const char *nsname, const char *name,
ClientData clientData, const TkEnsemble *map);
@@ -1354,8 +1367,8 @@ MODULE_SCOPE int TkInitFontchooser(Tcl_Interp *interp,
ClientData clientData);
MODULE_SCOPE void TkInitEmbeddedConfigurationInformation(
Tcl_Interp *interp);
+MODULE_SCOPE void TkDoWarpWrtWin(TkDisplay *dispPtr);
MODULE_SCOPE void TkpWarpPointer(TkDisplay *dispPtr);
-MODULE_SCOPE void TkpCancelWarp(TkDisplay *dispPtr);
MODULE_SCOPE int TkListCreateFrame(ClientData clientData,
Tcl_Interp *interp, Tcl_Obj *listObj,
int toplevel, Tcl_Obj *nameObj);
@@ -1364,6 +1377,7 @@ MODULE_SCOPE void TkRotatePoint(double originX, double originY,
double *yPtr);
MODULE_SCOPE int TkGetIntForIndex(Tcl_Obj *, TkSizeT, int lastOK, TkSizeT*);
+#define TkNewIndexObj(value) Tcl_NewWideIntObj((Tcl_WideInt)(value + 1) - 1)
#ifdef _WIN32
#define TkParseColor XParseColor
@@ -1412,17 +1426,6 @@ MODULE_SCOPE void TkUnixSetXftClipRegion(Region clipRegion);
MODULE_SCOPE const char *TkUtfPrev(const char *, const char *);
#endif
-#if TCL_MAJOR_VERSION > 8
-#define TkGetStringFromObj(objPtr, lenPtr) \
- (((objPtr)->bytes ? 0 : Tcl_GetString(objPtr)), \
- *(lenPtr) = (objPtr)->length, (objPtr)->bytes)
-MODULE_SCOPE unsigned char *TkGetByteArrayFromObj(Tcl_Obj *objPtr,
- size_t *lengthPtr);
-#else
-#define TkGetStringFromObj Tcl_GetStringFromObj
-#define TkGetByteArrayFromObj Tcl_GetByteArrayFromObj
-#endif
-
/*
* Unsupported commands.
*/
diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h
index 886964d..2e96807 100644
--- a/generic/tkIntDecls.h
+++ b/generic/tkIntDecls.h
@@ -6,7 +6,7 @@
* interfaces are not guaranteed to remain the same between
* versions. Use at your own risk.
*
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright (c) 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -558,18 +558,18 @@ EXTERN void TkDrawAngledChars(Display *display,
Drawable drawable, GC gc, Tk_Font tkfont,
const char *source, int numBytes, double x,
double y, double angle);
+#ifdef MAC_OSX_TCL /* MACOSX */
/* 185 */
+EXTERN void TkpRedrawWidget(Tk_Window tkwin);
+#endif /* MACOSX */
+#ifdef MAC_OSX_TCL /* MACOSX */
+/* 186 */
+EXTERN int TkpWillDrawWidget(Tk_Window tkwin);
+#endif /* MACOSX */
+/* 187 */
EXTERN int TkDebugPhotoStringMatchDef(Tcl_Interp *inter,
Tcl_Obj *data, Tcl_Obj *formatString,
int *widthPtr, int *heightPtr);
-#ifdef MAC_OSX_TK /* AQUA */
-/* 186 */
-EXTERN void TkpRedrawWidget(Tk_Window tkwin);
-#endif /* AQUA */
-#ifdef MAC_OSX_TK /* AQUA */
-/* 187 */
-EXTERN int TkpWillDrawWidget(Tk_Window tkwin);
-#endif /* AQUA */
typedef struct TkIntStubs {
int magic;
@@ -787,27 +787,25 @@ typedef struct TkIntStubs {
void (*tkUnderlineAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int underline); /* 182 */
int (*tkIntersectAngledTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height, double angle); /* 183 */
void (*tkDrawAngledChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle); /* 184 */
- int (*tkDebugPhotoStringMatchDef) (Tcl_Interp *inter, Tcl_Obj *data, Tcl_Obj *formatString, int *widthPtr, int *heightPtr); /* 185 */
-#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved186)(void);
-#endif /* X11 */
+#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
+ void (*reserved185)(void);
+#endif /* UNIX */
#if defined(_WIN32) /* WIN */
- void (*reserved186)(void);
+ void (*reserved185)(void);
#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved186)(void); /* Dummy entry for stubs table backwards compatibility */
- void (*tkpRedrawWidget) (Tk_Window tkwin); /* 186 */
-#endif /* AQUA */
-#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */
- void (*reserved187)(void);
-#endif /* X11 */
+#ifdef MAC_OSX_TCL /* MACOSX */
+ void (*tkpRedrawWidget) (Tk_Window tkwin); /* 185 */
+#endif /* MACOSX */
+#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
+ void (*reserved186)(void);
+#endif /* UNIX */
#if defined(_WIN32) /* WIN */
- void (*reserved187)(void);
+ void (*reserved186)(void);
#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- void (*reserved187)(void); /* Dummy entry for stubs table backwards compatibility */
- int (*tkpWillDrawWidget) (Tk_Window tkwin); /* 187 */
-#endif /* AQUA */
+#ifdef MAC_OSX_TCL /* MACOSX */
+ int (*tkpWillDrawWidget) (Tk_Window tkwin); /* 186 */
+#endif /* MACOSX */
+ int (*tkDebugPhotoStringMatchDef) (Tcl_Interp *inter, Tcl_Obj *data, Tcl_Obj *formatString, int *widthPtr, int *heightPtr); /* 187 */
} TkIntStubs;
extern const TkIntStubs *tkIntStubsPtr;
@@ -1180,16 +1178,16 @@ extern const TkIntStubs *tkIntStubsPtr;
(tkIntStubsPtr->tkIntersectAngledTextLayout) /* 183 */
#define TkDrawAngledChars \
(tkIntStubsPtr->tkDrawAngledChars) /* 184 */
-#define TkDebugPhotoStringMatchDef \
- (tkIntStubsPtr->tkDebugPhotoStringMatchDef) /* 185 */
-#ifdef MAC_OSX_TK /* AQUA */
+#ifdef MAC_OSX_TCL /* MACOSX */
#define TkpRedrawWidget \
- (tkIntStubsPtr->tkpRedrawWidget) /* 186 */
-#endif /* AQUA */
-#ifdef MAC_OSX_TK /* AQUA */
+ (tkIntStubsPtr->tkpRedrawWidget) /* 185 */
+#endif /* MACOSX */
+#ifdef MAC_OSX_TCL /* MACOSX */
#define TkpWillDrawWidget \
- (tkIntStubsPtr->tkpWillDrawWidget) /* 187 */
-#endif /* AQUA */
+ (tkIntStubsPtr->tkpWillDrawWidget) /* 186 */
+#endif /* MACOSX */
+#define TkDebugPhotoStringMatchDef \
+ (tkIntStubsPtr->tkDebugPhotoStringMatchDef) /* 187 */
#endif /* defined(USE_TK_STUBS) */
@@ -1207,4 +1205,11 @@ extern const TkIntStubs *tkIntStubsPtr;
#undef TkSendCleanup_
#undef TkpTestsendCmd_
+#if !defined(MAC_OSX_TK)
+# undef TkpWillDrawWidget
+# undef TkpRedrawWidget
+# define TkpWillDrawWidget(w) 0
+# define TkpRedrawWidget(w)
+#endif
+
#endif /* _TKINTDECLS */
diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h
index aecc222..0b770a1 100644
--- a/generic/tkIntPlatDecls.h
+++ b/generic/tkIntPlatDecls.h
@@ -6,7 +6,7 @@
* interfaces are not guaranteed to remain the same between
* versions. Use at your own risk.
*
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright (c) 1998-1999 Scriptics Corporation.
* All rights reserved.
*/
@@ -170,8 +170,7 @@ EXTERN unsigned int TkMacOSXButtonKeyState(void);
EXTERN void TkMacOSXClearMenubarActive(void);
/* 10 */
EXTERN int TkMacOSXDispatchMenuEvent(int menuID, int index);
-/* 11 */
-EXTERN void TkMacOSXInstallCursor(int resizeOverride);
+/* Slot 11 is reserved */
/* 12 */
EXTERN void TkMacOSXHandleTearoffMenu(void);
/* Slot 13 is reserved */
@@ -199,9 +198,7 @@ EXTERN void TkMacOSXMakeRealWindowExist(TkWindow *winPtr);
EXTERN void * TkMacOSXMakeStippleMap(Drawable d1, Drawable d2);
/* 25 */
EXTERN void TkMacOSXMenuClick(void);
-/* 26 */
-EXTERN void TkMacOSXRegisterOffScreenWindow(Window window,
- void *portPtr);
+/* Slot 26 is reserved */
/* 27 */
EXTERN int TkMacOSXResizable(TkWindow *winPtr);
/* 28 */
@@ -214,8 +211,7 @@ EXTERN void TkMacOSXSetUpClippingRgn(Drawable drawable);
EXTERN void TkMacOSXSetUpGraphicsPort(GC gc, void *destPort);
/* 32 */
EXTERN void TkMacOSXUpdateClipRgn(TkWindow *winPtr);
-/* 33 */
-EXTERN void TkMacOSXUnregisterMacWindow(void *portPtr);
+/* Slot 33 is reserved */
/* 34 */
EXTERN int TkMacOSXUseMenuID(short macID);
/* 35 */
@@ -248,7 +244,7 @@ EXTERN int TkpIsWindowFloating(void *window);
EXTERN Tk_Window TkpGetCapture(void);
/* Slot 48 is reserved */
/* 49 */
-EXTERN Tk_Window TkGetTransientMaster(TkWindow *winPtr);
+EXTERN Tk_Window TkMacOSXGetContainer(TkWindow *winPtr);
/* 50 */
EXTERN int TkGenerateButtonEvent(int x, int y, Window window,
unsigned int state);
@@ -405,7 +401,7 @@ typedef struct TkIntPlatStubs {
unsigned int (*tkMacOSXButtonKeyState) (void); /* 8 */
void (*tkMacOSXClearMenubarActive) (void); /* 9 */
int (*tkMacOSXDispatchMenuEvent) (int menuID, int index); /* 10 */
- void (*tkMacOSXInstallCursor) (int resizeOverride); /* 11 */
+ void (*reserved11)(void);
void (*tkMacOSXHandleTearoffMenu) (void); /* 12 */
void (*reserved13)(void);
int (*tkMacOSXDoHLEvent) (void *theEvent); /* 14 */
@@ -420,14 +416,14 @@ typedef struct TkIntPlatStubs {
void (*tkMacOSXMakeRealWindowExist) (TkWindow *winPtr); /* 23 */
void * (*tkMacOSXMakeStippleMap) (Drawable d1, Drawable d2); /* 24 */
void (*tkMacOSXMenuClick) (void); /* 25 */
- void (*tkMacOSXRegisterOffScreenWindow) (Window window, void *portPtr); /* 26 */
+ void (*reserved26)(void);
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, void *destPort); /* 31 */
void (*tkMacOSXUpdateClipRgn) (TkWindow *winPtr); /* 32 */
- void (*tkMacOSXUnregisterMacWindow) (void *portPtr); /* 33 */
+ void (*reserved33)(void);
int (*tkMacOSXUseMenuID) (short macID); /* 34 */
Region (*tkMacOSXVisableClipRgn) (TkWindow *winPtr); /* 35 */
void (*tkMacOSXWinBounds) (TkWindow *winPtr, void *geometry); /* 36 */
@@ -443,7 +439,7 @@ typedef struct TkIntPlatStubs {
int (*tkpIsWindowFloating) (void *window); /* 46 */
Tk_Window (*tkpGetCapture) (void); /* 47 */
void (*reserved48)(void);
- Tk_Window (*tkGetTransientMaster) (TkWindow *winPtr); /* 49 */
+ Tk_Window (*tkMacOSXGetContainer) (TkWindow *winPtr); /* 49 */
int (*tkGenerateButtonEvent) (int x, int y, Window window, unsigned int state); /* 50 */
void (*tkGenWMDestroyEvent) (Tk_Window tkwin); /* 51 */
void (*tkMacOSXSetDrawingEnabled) (TkWindow *winPtr, int flag); /* 52 */
@@ -631,8 +627,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
(tkIntPlatStubsPtr->tkMacOSXClearMenubarActive) /* 9 */
#define TkMacOSXDispatchMenuEvent \
(tkIntPlatStubsPtr->tkMacOSXDispatchMenuEvent) /* 10 */
-#define TkMacOSXInstallCursor \
- (tkIntPlatStubsPtr->tkMacOSXInstallCursor) /* 11 */
+/* Slot 11 is reserved */
#define TkMacOSXHandleTearoffMenu \
(tkIntPlatStubsPtr->tkMacOSXHandleTearoffMenu) /* 12 */
/* Slot 13 is reserved */
@@ -657,8 +652,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
(tkIntPlatStubsPtr->tkMacOSXMakeStippleMap) /* 24 */
#define TkMacOSXMenuClick \
(tkIntPlatStubsPtr->tkMacOSXMenuClick) /* 25 */
-#define TkMacOSXRegisterOffScreenWindow \
- (tkIntPlatStubsPtr->tkMacOSXRegisterOffScreenWindow) /* 26 */
+/* Slot 26 is reserved */
#define TkMacOSXResizable \
(tkIntPlatStubsPtr->tkMacOSXResizable) /* 27 */
#define TkMacOSXSetHelpMenuItemCount \
@@ -671,8 +665,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
(tkIntPlatStubsPtr->tkMacOSXSetUpGraphicsPort) /* 31 */
#define TkMacOSXUpdateClipRgn \
(tkIntPlatStubsPtr->tkMacOSXUpdateClipRgn) /* 32 */
-#define TkMacOSXUnregisterMacWindow \
- (tkIntPlatStubsPtr->tkMacOSXUnregisterMacWindow) /* 33 */
+/* Slot 33 is reserved */
#define TkMacOSXUseMenuID \
(tkIntPlatStubsPtr->tkMacOSXUseMenuID) /* 34 */
#define TkMacOSXVisableClipRgn \
@@ -701,8 +694,8 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
#define TkpGetCapture \
(tkIntPlatStubsPtr->tkpGetCapture) /* 47 */
/* Slot 48 is reserved */
-#define TkGetTransientMaster \
- (tkIntPlatStubsPtr->tkGetTransientMaster) /* 49 */
+#define TkMacOSXGetContainer \
+ (tkIntPlatStubsPtr->tkMacOSXGetContainer) /* 49 */
#define TkGenerateButtonEvent \
(tkIntPlatStubsPtr->tkGenerateButtonEvent) /* 50 */
#define TkGenWMDestroyEvent \
@@ -798,6 +791,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
#undef TkSendCleanup_
#undef TkpTestsendCmd_
#undef TkGenerateActivateEvents_
+#undef TkMacOSXSetUpClippingRgn
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h
index 774075d..7e86d52 100644
--- a/generic/tkIntXlibDecls.h
+++ b/generic/tkIntXlibDecls.h
@@ -6,7 +6,7 @@
* interfaces are not guaranteed to remain the same between
* versions. Use at your own risk.
*
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright (c) 1998-1999 Scriptics Corporation.
* All rights reserved.
*/
@@ -38,6 +38,10 @@
# endif
#endif
+#if defined(MAC_OSX_TK) && !defined(MAC_OSX_TCL)
+# define MAC_OSX_TCL 1
+#endif
+
typedef int (*XAfterFunction) ( /* WARNING, this type not in Xlib spec */
Display* /* display */
);
@@ -765,7 +769,10 @@ EXTERN Status XIconifyWindow(Display *d, Window w, int i);
EXTERN Status XWithdrawWindow(Display *d, Window w, int i);
/* 105 */
EXTERN XHostAddress * XListHosts(Display *d, int *i, Bool *b);
-/* Slot 106 is reserved */
+/* 106 */
+EXTERN int XSetClipRectangles(Display *display, GC gc,
+ int clip_x_origin, int clip_y_origin,
+ XRectangle rectangles[], int n, int ordering);
/* 107 */
EXTERN int XFlush(Display *display);
/* 108 */
@@ -1162,7 +1169,7 @@ typedef struct TkIntXlibStubs {
Status (*xIconifyWindow) (Display *d, Window w, int i); /* 103 */
Status (*xWithdrawWindow) (Display *d, Window w, int i); /* 104 */
XHostAddress * (*xListHosts) (Display *d, int *i, Bool *b); /* 105 */
- void (*reserved106)(void);
+ int (*xSetClipRectangles) (Display *display, GC gc, int clip_x_origin, int clip_y_origin, XRectangle rectangles[], int n, int ordering); /* 106 */
int (*xFlush) (Display *display); /* 107 */
int (*xGrabServer) (Display *display); /* 108 */
int (*xUngrabServer) (Display *display); /* 109 */
@@ -1748,7 +1755,8 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr;
(tkIntXlibStubsPtr->xWithdrawWindow) /* 104 */
#define XListHosts \
(tkIntXlibStubsPtr->xListHosts) /* 105 */
-/* Slot 106 is reserved */
+#define XSetClipRectangles \
+ (tkIntXlibStubsPtr->xSetClipRectangles) /* 106 */
#define XFlush \
(tkIntXlibStubsPtr->xFlush) /* 107 */
#define XGrabServer \
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index e738155..8de96b6 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -579,7 +579,7 @@ Tk_ListboxObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(listPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(listPtr->tkwin));
return TCL_OK;
}
@@ -842,7 +842,7 @@ ListboxWidgetObjCmd(
if (result != TCL_OK) {
break;
}
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
result = TCL_OK;
break;
@@ -906,7 +906,7 @@ ListboxWidgetObjCmd(
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv,
- "index ?-option? ?value? ?-option value ...?");
+ "index ?-option value ...?");
result = TCL_ERROR;
break;
}
@@ -1116,7 +1116,7 @@ ListboxBboxSubCmd(
return result;
}
- stringRep = TkGetStringFromObj(el, &stringLen);
+ stringRep = Tcl_GetStringFromObj(el, &stringLen);
Tk_GetFontMetrics(listPtr->tkfont, &fm);
pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, stringLen);
@@ -2079,7 +2079,7 @@ DisplayListbox(
*/
Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &curElement);
- stringRep = TkGetStringFromObj(curElement, &stringLen);
+ stringRep = Tcl_GetStringFromObj(curElement, &stringLen);
textWidth = Tk_TextWidth(listPtr->tkfont, stringRep, stringLen);
Tk_GetFontMetrics(listPtr->tkfont, &fm);
@@ -2263,7 +2263,7 @@ ListboxComputeGeometry(
if (result != TCL_OK) {
continue;
}
- text = TkGetStringFromObj(element, &textLength);
+ text = Tcl_GetStringFromObj(element, &textLength);
Tk_GetFontMetrics(listPtr->tkfont, &fm);
pixelWidth = Tk_TextWidth(listPtr->tkfont, text, textLength);
if (pixelWidth > listPtr->maxWidth) {
@@ -2341,7 +2341,7 @@ ListboxInsertSubCmd(
* if so, update our notion of "widest."
*/
- stringRep = TkGetStringFromObj(objv[i], &length);
+ stringRep = Tcl_GetStringFromObj(objv[i], &length);
pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, length);
if (pixelWidth > listPtr->maxWidth) {
listPtr->maxWidth = pixelWidth;
@@ -2500,7 +2500,7 @@ ListboxDeleteSubCmd(
if (widthChanged == 0) {
Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &element);
- stringRep = TkGetStringFromObj(element, &length);
+ stringRep = Tcl_GetStringFromObj(element, &length);
pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, length);
if (pixelWidth == listPtr->maxWidth) {
widthChanged = 1;
@@ -2742,7 +2742,7 @@ GetListboxIndex(
result = TkGetIntForIndex(indexObj, listPtr->nElements - 1, lastOK, &idx);
if (result == TCL_OK) {
- if (idx + 1 > (TkSizeT)listPtr->nElements + 1) {
+ if ((idx != TCL_INDEX_NONE) && (idx > (TkSizeT)listPtr->nElements)) {
idx = listPtr->nElements;
}
*indexPtr = (int)idx;
@@ -3148,7 +3148,7 @@ ListboxFetchSelection(
}
Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i,
&curElement);
- stringRep = TkGetStringFromObj(curElement, &stringLen);
+ stringRep = Tcl_GetStringFromObj(curElement, &stringLen);
Tcl_DStringAppend(&selection, stringRep, stringLen);
needNewline = 1;
}
@@ -3229,7 +3229,7 @@ static void
GenerateListboxSelectEvent(
Listbox *listPtr) /* Information about widget. */
{
- TkSendVirtualEvent(listPtr->tkwin, "ListboxSelect", NULL);
+ Tk_SendVirtualEvent(listPtr->tkwin, "ListboxSelect", NULL);
}
/*
diff --git a/generic/tkMacWinMenu.c b/generic/tkMacWinMenu.c
index 40a5ea8..eb8eb2f 100644
--- a/generic/tkMacWinMenu.c
+++ b/generic/tkMacWinMenu.c
@@ -4,7 +4,7 @@
* This module implements the common elements of the Mac and Windows
* specific features of menus. This file is not used for UNIX.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright © 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.
diff --git a/generic/tkMain.c b/generic/tkMain.c
index b2fa845..49fa3f6 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -403,19 +403,24 @@ Tk_MainEx(
static void
StdinProc(
ClientData clientData, /* The state of interactive cmd line */
- int mask) /* Not used. */
+ TCL_UNUSED(int))
{
char *cmd;
int code;
- size_t count;
+ TkSizeT count;
InteractiveState *isPtr = (InteractiveState *)clientData;
Tcl_Channel chan = isPtr->input;
Tcl_Interp *interp = isPtr->interp;
- (void)mask;
+ Tcl_DString savedEncoding;
- count = (size_t)Tcl_Gets(chan, &isPtr->line);
+ Tcl_DStringInit(&savedEncoding);
+ Tcl_GetChannelOption(NULL, chan, "-encoding", &savedEncoding);
+ Tcl_SetChannelOption(NULL, chan, "-encoding", "utf-8");
+ count = Tcl_Gets(chan, &isPtr->line);
+ Tcl_SetChannelOption(NULL, chan, "-encoding", Tcl_DStringValue(&savedEncoding));
+ Tcl_DStringFree(&savedEncoding);
- if (count == (size_t)-1 && !isPtr->gotPartial) {
+ if ((count == TCL_IO_FAILURE) && !isPtr->gotPartial) {
if (isPtr->tty) {
Tcl_Exit(0);
} else {
diff --git a/generic/tkMenu.c b/generic/tkMenu.c
index 776c7e8..a7e6363 100644
--- a/generic/tkMenu.c
+++ b/generic/tkMenu.c
@@ -6,8 +6,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -39,12 +39,12 @@
* right; they have a Tk window and pathname associated with them; they have a
* TkMenu structure and array of entries. However, they are linked with the
* original menu that they were cloned from. They reflect the attributes of the
- * original, or "master", menu. So if an item is added to a menu, and that
+ * original, or "main", 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
+ * when the main menu is destroyed, all clones are also destroyed. This
* allows the developer to just deal with one set of menus when creating and
* destroying.
*
@@ -461,7 +461,7 @@ Tk_MenuObjCmd(
MenuCmdDeletedProc);
menuPtr->active = TCL_INDEX_NONE;
menuPtr->cursorPtr = NULL;
- menuPtr->masterMenuPtr = menuPtr;
+ menuPtr->mainMenuPtr = menuPtr;
menuPtr->menuType = UNKNOWN_TYPE;
TkMenuInitializeDrawingFields(menuPtr);
@@ -518,7 +518,7 @@ Tk_MenuObjCmd(
nextCascadePtr = cascadeListPtr->nextCascadePtr;
/*
- * If we have a new master menu, and an existing cloned menu
+ * If we have a new main 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
@@ -526,9 +526,9 @@ Tk_MenuObjCmd(
* creating exists.
*/
- if ((menuPtr->masterMenuPtr != menuPtr)
- || ((menuPtr->masterMenuPtr == menuPtr)
- && ((cascadeListPtr->menuPtr->masterMenuPtr
+ if ((menuPtr->mainMenuPtr != menuPtr)
+ || ((menuPtr->mainMenuPtr == menuPtr)
+ && ((cascadeListPtr->menuPtr->mainMenuPtr
== cascadeListPtr->menuPtr)))) {
newObjv[0] = Tcl_NewStringObj("-menu", -1);
newObjv[1] = Tcl_NewStringObj(Tk_PathName(menuPtr->tkwin),-1);
@@ -593,7 +593,7 @@ Tk_MenuObjCmd(
}
}
- Tcl_SetObjResult(interp, TkNewWindowObj(menuPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(menuPtr->tkwin));
return TCL_OK;
}
@@ -845,9 +845,8 @@ MenuWidgetObjCmd(
}
if (index == TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_NewStringObj("none", -1));
- } else {
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
- }
+ } else
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
break;
}
case MENU_INSERT:
@@ -1108,8 +1107,8 @@ DestroyMenuInstance(
TkMenu *menuInstancePtr;
TkMenuEntry *cascadePtr, *nextCascadePtr;
Tcl_Obj *newObjv[2];
- TkMenu *parentMasterMenuPtr;
- TkMenuEntry *parentMasterEntryPtr;
+ TkMenu *parentMainMenuPtr;
+ TkMenuEntry *parentMainEntryPtr;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -1118,11 +1117,11 @@ DestroyMenuInstance(
* 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
+ * to reset -menu field of all entries that are not main menus back to
+ * this entry name if this is a main menu pointed to by another main
* 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
+ * pointing entry must be set back to this menu's main menu name so that
* later if another menu is created the cascade hierarchy can be
* maintained.
*/
@@ -1140,14 +1139,14 @@ DestroyMenuInstance(
for (; cascadePtr != NULL; cascadePtr = nextCascadePtr) {
nextCascadePtr = cascadePtr->nextCascadePtr;
- if (menuPtr->masterMenuPtr != menuPtr) {
+ if (menuPtr->mainMenuPtr != menuPtr) {
Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", -1);
- parentMasterMenuPtr = cascadePtr->menuPtr->masterMenuPtr;
- parentMasterEntryPtr =
- parentMasterMenuPtr->entries[cascadePtr->index];
+ parentMainMenuPtr = cascadePtr->menuPtr->mainMenuPtr;
+ parentMainEntryPtr =
+ parentMainMenuPtr->entries[cascadePtr->index];
newObjv[0] = menuNamePtr;
- newObjv[1] = parentMasterEntryPtr->namePtr;
+ newObjv[1] = parentMainEntryPtr->namePtr;
/*
* It is possible that the menu info is out of sync, and these
@@ -1166,8 +1165,8 @@ DestroyMenuInstance(
}
}
- if (menuPtr->masterMenuPtr != menuPtr) {
- for (menuInstancePtr = menuPtr->masterMenuPtr;
+ if (menuPtr->mainMenuPtr != menuPtr) {
+ for (menuInstancePtr = menuPtr->mainMenuPtr;
menuInstancePtr != NULL;
menuInstancePtr = menuInstancePtr->nextInstancePtr) {
if (menuInstancePtr->nextInstancePtr == menuPtr) {
@@ -1177,7 +1176,7 @@ DestroyMenuInstance(
}
}
} else if (menuPtr->nextInstancePtr != NULL) {
- Tcl_Panic("Attempting to delete master menu when there are still clones");
+ Tcl_Panic("Attempting to delete main menu when there are still clones");
}
/*
@@ -1217,8 +1216,8 @@ DestroyMenuInstance(
*
* 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
+ * using it anymore). If called on a main instance, destroys all of the
+ * instances. If called on a non-main instance, just destroys
* that instance.
*
* Results:
@@ -1264,7 +1263,7 @@ TkDestroyMenu(
topLevelListPtr = nextTopLevelPtr;
}
}
- if (menuPtr->masterMenuPtr == menuPtr) {
+ if (menuPtr->mainMenuPtr == menuPtr) {
while (menuPtr->nextInstancePtr != NULL) {
menuInstancePtr = menuPtr->nextInstancePtr;
menuPtr->nextInstancePtr = menuInstancePtr->nextInstancePtr;
@@ -1412,7 +1411,7 @@ DestroyMenuEntry(
*/
if (mePtr->type == CASCADE_ENTRY) {
- if (menuPtr->masterMenuPtr != menuPtr) {
+ if (menuPtr->mainMenuPtr != menuPtr) {
TkMenu *destroyThis = NULL;
TkMenuReferences *menuRefPtr = mePtr->childMenuRefPtr;
@@ -1432,7 +1431,7 @@ DestroyMenuEntry(
*/
if ((destroyThis != NULL)
- && (destroyThis->masterMenuPtr == destroyThis)) {
+ && (destroyThis->mainMenuPtr == destroyThis)) {
destroyThis = NULL;
}
}
@@ -1538,14 +1537,14 @@ ConfigureMenu(
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
+ for (menuListPtr = menuPtr->mainMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
menuListPtr->errorStructPtr = (Tk_SavedOptions *)ckalloc(sizeof(Tk_SavedOptions));
result = Tk_SetOptions(interp, menuListPtr,
tsdPtr->menuOptionTable, objc, objv,
menuListPtr->tkwin, menuListPtr->errorStructPtr, NULL);
if (result != TCL_OK) {
- for (cleanupPtr = menuPtr->masterMenuPtr;
+ for (cleanupPtr = menuPtr->mainMenuPtr;
cleanupPtr != menuListPtr;
cleanupPtr = cleanupPtr->nextInstancePtr) {
Tk_RestoreSavedOptions(cleanupPtr->errorStructPtr);
@@ -1579,7 +1578,7 @@ ConfigureMenu(
* menuTypeName field to tell that this is a menu bar.
*/
- if (menuListPtr->menuType == MASTER_MENU) {
+ if (menuListPtr->menuType == MAIN_MENU) {
int typeFlag = TK_MAKE_MENU_POPUP;
Tk_Window tkwin = menuPtr->tkwin;
@@ -1614,7 +1613,7 @@ ConfigureMenu(
if ((menuListPtr->numEntries == 0)
|| (menuListPtr->entries[0]->type != TEAROFF_ENTRY)) {
if (MenuNewEntry(menuListPtr, 0, TEAROFF_ENTRY) == NULL) {
- for (cleanupPtr = menuPtr->masterMenuPtr;
+ for (cleanupPtr = menuPtr->mainMenuPtr;
cleanupPtr != menuListPtr;
cleanupPtr = cleanupPtr->nextInstancePtr) {
Tk_RestoreSavedOptions(cleanupPtr->errorStructPtr);
@@ -1631,7 +1630,6 @@ ConfigureMenu(
}
} else if ((menuListPtr->numEntries > 0)
&& (menuListPtr->entries[0]->type == TEAROFF_ENTRY)) {
- int i;
Tcl_EventuallyFree(menuListPtr->entries[0], (Tcl_FreeProc *) DestroyMenuEntry);
@@ -1664,7 +1662,7 @@ ConfigureMenu(
TkEventuallyRecomputeMenu(menuListPtr);
}
- for (cleanupPtr = menuPtr->masterMenuPtr; cleanupPtr != NULL;
+ for (cleanupPtr = menuPtr->mainMenuPtr; cleanupPtr != NULL;
cleanupPtr = cleanupPtr->nextInstancePtr) {
Tk_FreeSavedOptions(cleanupPtr->errorStructPtr);
ckfree(cleanupPtr->errorStructPtr);
@@ -1712,12 +1710,12 @@ PostProcessEntry(
if (mePtr->labelPtr == NULL) {
mePtr->labelLength = 0;
} else {
- (void)TkGetStringFromObj(mePtr->labelPtr, &mePtr->labelLength);
+ (void)Tcl_GetStringFromObj(mePtr->labelPtr, &mePtr->labelLength);
}
if (mePtr->accelPtr == NULL) {
mePtr->accelLength = 0;
} else {
- (void)TkGetStringFromObj(mePtr->accelPtr, &mePtr->accelLength);
+ (void)Tcl_GetStringFromObj(mePtr->accelPtr, &mePtr->accelLength);
}
/*
@@ -1826,7 +1824,6 @@ PostProcessEntry(
if ((mePtr->type == CHECK_BUTTON_ENTRY)
|| (mePtr->type == RADIO_BUTTON_ENTRY)) {
Tcl_Obj *valuePtr;
- const char *name;
if (mePtr->namePtr == NULL) {
if (mePtr->labelPtr == NULL) {
@@ -1990,14 +1987,14 @@ ConfigureMenuCloneEntries(
/*
* 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
+ * comment at the top of this file. Basically, if a menu is the main
* 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];
+ mePtr = menuPtr->mainMenuPtr->entries[index];
if (mePtr->type == CASCADE_ENTRY) {
oldCascadePtr = mePtr->namePtr;
if (oldCascadePtr != NULL) {
@@ -2042,7 +2039,7 @@ ConfigureMenuCloneEntries(
}
}
- for (menuListPtr = menuPtr->masterMenuPtr->nextInstancePtr;
+ for (menuListPtr = menuPtr->mainMenuPtr->nextInstancePtr;
menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
@@ -2129,7 +2126,8 @@ GetMenuIndex(
const char *string;
if (TkGetIntForIndex(objPtr, menuPtr->numEntries - 1, lastOK, indexPtr) == TCL_OK) {
- if (*indexPtr != TCL_INDEX_NONE) {
+ /* TCL_INDEX_NONE is only accepted if it does not result from a negative number */
+ if (*indexPtr != TCL_INDEX_NONE || Tcl_GetString(objPtr)[0] != '-') {
if (*indexPtr >= menuPtr->numEntries) {
*indexPtr = menuPtr->numEntries - ((lastOK) ? 0 : 1);
}
@@ -2361,7 +2359,7 @@ MenuAddOrInsert(
}
if (index == TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad index \"%s\"", Tcl_GetString(indexPtr)));
+ "bad menu entry index \"%s\"", Tcl_GetString(indexPtr)));
Tcl_SetErrorCode(interp, "TK", "MENU", "INDEX", NULL);
return TCL_ERROR;
}
@@ -2382,7 +2380,7 @@ MenuAddOrInsert(
* Now we have to add an entry for every instance related to this menu.
*/
- for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
+ for (menuListPtr = menuPtr->mainMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
mePtr = MenuNewEntry(menuListPtr, index, type);
@@ -2393,7 +2391,7 @@ MenuAddOrInsert(
TkMenu *errorMenuPtr;
TkSizeT i;
- for (errorMenuPtr = menuPtr->masterMenuPtr;
+ for (errorMenuPtr = menuPtr->mainMenuPtr;
errorMenuPtr != NULL;
errorMenuPtr = errorMenuPtr->nextInstancePtr) {
Tcl_EventuallyFree(errorMenuPtr->entries[index],
@@ -2417,7 +2415,7 @@ MenuAddOrInsert(
* 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
+ * cloned for every clone the main menu has. This is special case #2
* in the comment at the top of this file.
*/
@@ -2426,7 +2424,7 @@ MenuAddOrInsert(
&& (mePtr->childMenuRefPtr != NULL)
&& (mePtr->childMenuRefPtr->menuPtr != NULL)) {
TkMenu *cascadeMenuPtr =
- mePtr->childMenuRefPtr->menuPtr->masterMenuPtr;
+ mePtr->childMenuRefPtr->menuPtr->mainMenuPtr;
Tcl_Obj *newCascadePtr, *newObjv[2];
Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", -1);
Tcl_Obj *windowNamePtr =
@@ -2700,7 +2698,7 @@ CloneMenu(
Tcl_Obj *menuDupCommandArray[4];
if (newMenuTypePtr == NULL) {
- menuType = MASTER_MENU;
+ menuType = MAIN_MENU;
} else {
if (Tcl_GetIndexFromObjStruct(menuPtr->interp, newMenuTypePtr,
menuTypeStrings, sizeof(char *), "menu type", 0, &menuType) != TCL_OK) {
@@ -2735,7 +2733,7 @@ CloneMenu(
&& (menuPtr->numEntries == menuRefPtr->menuPtr->numEntries)) {
TkMenu *newMenuPtr = menuRefPtr->menuPtr;
Tcl_Obj *newObjv[3];
- int i, numElements;
+ int numElements;
/*
* Now put this newly created menu into the parent menu's instance
@@ -2744,18 +2742,18 @@ CloneMenu(
if (menuPtr->nextInstancePtr == NULL) {
menuPtr->nextInstancePtr = newMenuPtr;
- newMenuPtr->masterMenuPtr = menuPtr->masterMenuPtr;
+ newMenuPtr->mainMenuPtr = menuPtr->mainMenuPtr;
} else {
- TkMenu *masterMenuPtr;
+ TkMenu *mainMenuPtr;
- masterMenuPtr = menuPtr->masterMenuPtr;
- newMenuPtr->nextInstancePtr = masterMenuPtr->nextInstancePtr;
- masterMenuPtr->nextInstancePtr = newMenuPtr;
- newMenuPtr->masterMenuPtr = masterMenuPtr;
+ mainMenuPtr = menuPtr->mainMenuPtr;
+ newMenuPtr->nextInstancePtr = mainMenuPtr->nextInstancePtr;
+ mainMenuPtr->nextInstancePtr = newMenuPtr;
+ newMenuPtr->mainMenuPtr = mainMenuPtr;
}
/*
- * Add the master menu's window to the bind tags for this window after
+ * Add the main 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.
@@ -2781,7 +2779,7 @@ CloneMenu(
if (strcmp(windowName, Tk_PathName(newMenuPtr->tkwin))
== 0) {
Tcl_Obj *newElementPtr = Tcl_NewStringObj(
- Tk_PathName(newMenuPtr->masterMenuPtr->tkwin), -1);
+ Tk_PathName(newMenuPtr->mainMenuPtr->tkwin), -1);
/*
* The newElementPtr will have its refCount incremented
@@ -3181,7 +3179,7 @@ TkSetWindowMenuBar(
menuPtr = menuRefPtr->menuPtr;
- for (instancePtr = menuPtr->masterMenuPtr;
+ for (instancePtr = menuPtr->mainMenuPtr;
instancePtr != NULL;
instancePtr = instancePtr->nextInstancePtr) {
if (instancePtr->menuType == MENUBAR
@@ -3529,7 +3527,7 @@ DeleteMenuCloneEntries(
int numDeleted, i, j;
numDeleted = last + 1 - first;
- for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL;
+ for (menuListPtr = menuPtr->mainMenuPtr; menuListPtr != NULL;
menuListPtr = menuListPtr->nextInstancePtr) {
for (i = last; i >= first; i--) {
Tcl_EventuallyFree(menuListPtr->entries[i], (Tcl_FreeProc *) DestroyMenuEntry);
diff --git a/generic/tkMenu.h b/generic/tkMenu.h
index ecb6fac..16ea507 100644
--- a/generic/tkMenu.h
+++ b/generic/tkMenu.h
@@ -4,7 +4,7 @@
* Declarations shared among all of the files that implement menu
* widgets.
*
- * Copyright (c) 1996-1998 by Sun Microsystems, Inc.
+ * Copyright © 1996-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.
@@ -185,7 +185,7 @@ typedef struct TkMenuEntry {
* the menu. */
/*
- * Bookeeping for master menus and cascade menus.
+ * Bookeeping for main menus and cascade menus.
*/
struct TkMenuReferences *childMenuRefPtr;
@@ -266,7 +266,7 @@ typedef struct TkMenu {
TkSizeT numEntries; /* Number of elements in entries. */
TkSizeT active; /* Index of active entry. TCL_INDEX_NONE means
* nothing active. */
- int menuType; /* MASTER_MENU, TEAROFF_MENU, or MENUBAR. See
+ int menuType; /* MAIN_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
@@ -351,10 +351,10 @@ typedef struct TkMenu {
struct TkMenu *nextInstancePtr;
/* The next instance of this menu in the
* chain. */
- struct TkMenu *masterMenuPtr;
+ struct TkMenu *mainMenuPtr;
/* A pointer to the original menu for this
* clone chain. Points back to this structure
- * if this menu is a master menu. */
+ * if this menu is a main menu. */
void *reserved1; /* not used any more. */
Tk_Window parentTopLevelPtr;/* If this menu is a menubar, this is the
* toplevel that owns the menu. Only
@@ -434,7 +434,7 @@ typedef struct TkMenuReferences {
* 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
+ * cleaning this main 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
@@ -452,16 +452,16 @@ typedef struct TkMenuReferences {
#define MENU_PLATFORM_FLAG3 (1 << 28)
/*
- * Each menu created by the user is a MASTER_MENU. When a menu is torn off, a
+ * Each menu created by the user is a MAIN_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
+ * configuration information. If the main 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 MAIN_MENU 0
#define TEAROFF_MENU 1
#define MENUBAR 2
diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c
index 2512f7c..fd059bf 100644
--- a/generic/tkMenuDraw.c
+++ b/generic/tkMenuDraw.c
@@ -4,7 +4,7 @@
* This module implements the platform-independent drawing and geometry
* calculations of menu widgets.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright © 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.
diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c
index 4b7a492..dbf6208 100644
--- a/generic/tkMenubutton.c
+++ b/generic/tkMenubutton.c
@@ -4,8 +4,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -13,7 +13,6 @@
#include "tkInt.h"
#include "tkMenubutton.h"
-#include "default.h"
/*
* The structure below defines menubutton class behavior by means of
@@ -319,7 +318,7 @@ Tk_MenubuttonObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(mbPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(mbPtr->tkwin));
return TCL_OK;
}
diff --git a/generic/tkMenubutton.h b/generic/tkMenubutton.h
index 1dbacb3..1dc0f75 100644
--- a/generic/tkMenubutton.h
+++ b/generic/tkMenubutton.h
@@ -4,7 +4,7 @@
* Declarations of types and functions used to implement the menubutton
* widget.
*
- * Copyright (c) 1996-1997 by Sun Microsystems, Inc.
+ * Copyright © 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.
diff --git a/generic/tkMessage.c b/generic/tkMessage.c
index f7d1a33..c0b9963 100644
--- a/generic/tkMessage.c
+++ b/generic/tkMessage.c
@@ -5,9 +5,9 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 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.
@@ -278,7 +278,7 @@ Tk_MessageObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(msgPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(msgPtr->tkwin));
return TCL_OK;
}
diff --git a/generic/tkObj.c b/generic/tkObj.c
index 63c6db7..b848822 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -3,7 +3,7 @@
*
* This file contains functions that implement the common Tk object types
*
- * Copyright (c) 1997 Sun Microsystems, Inc.
+ * Copyright © 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.
@@ -99,6 +99,9 @@ static int SetPixelFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static int SetWindowFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
#if TCL_MAJOR_VERSION < 9
+#ifdef __cplusplus
+extern "C" {
+#endif
#if defined(USE_TCL_STUBS)
/* Little hack to eliminate the need for "tclInt.h" here:
Just copy a small portion of TclIntStubs, just
@@ -109,7 +112,7 @@ typedef struct TclIntStubs {
void (*dummy[34]) (void); /* dummy entries 0-33, not used */
int (*tclGetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr); /* 34 */
} TclIntStubs;
-extern const struct TclIntStubs *tclIntStubsPtr;
+extern const TclIntStubs *tclIntStubsPtr;
# undef Tcl_GetIntForIndex
# define Tcl_GetIntForIndex(interp, obj, max, ptr) ((tclIntStubsPtr->tclGetIntForIndex == NULL)? \
@@ -117,7 +120,10 @@ extern const struct TclIntStubs *tclIntStubsPtr;
tclIntStubsPtr->tclGetIntForIndex((interp), (obj), (max), (ptr)))
#elif TCL_MINOR_VERSION < 7
extern int TclGetIntForIndex(Tcl_Interp*, Tcl_Obj *, int, int*);
-# define Tcl_GetIntForIndex TclGetIntForIndex
+# define Tcl_GetIntForIndex(interp, obj, max, ptr) TclGetIntForIndex(interp, obj, max, ptr)
+#endif
+#ifdef __cplusplus
+}
#endif
#endif
@@ -965,12 +971,11 @@ TkGetWindowFromObj(
static int
SetWindowFromAny(
- Tcl_Interp *dummy, /* Used for error reporting if not NULL. */
+ TCL_UNUSED(Tcl_Interp *),
Tcl_Obj *objPtr) /* The object to convert. */
{
const Tcl_ObjType *typePtr;
WindowRep *winPtr;
- (void)dummy;
/*
* Free the old internalRep before setting the new one.
@@ -1057,7 +1062,7 @@ FreeWindowInternalRep(
/*
*----------------------------------------------------------------------
*
- * TkNewWindowObj --
+ * Tk_NewWindowObj --
*
* This function allocates a new Tcl_Obj that refers to a particular to a
* particular Tk window.
@@ -1072,7 +1077,7 @@ FreeWindowInternalRep(
*/
Tcl_Obj *
-TkNewWindowObj(
+Tk_NewWindowObj(
Tk_Window tkwin)
{
Tcl_Obj *objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index 7400b32..63b65d6 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -775,28 +775,28 @@ FormatConfigValue(
result = "";
switch (specPtr->type) {
case TK_CONFIG_BOOLEAN:
- if (*((int *) ptr) == 0) {
+ if (*((int *)ptr) == 0) {
result = "0";
} else {
result = "1";
}
break;
case TK_CONFIG_INT:
- sprintf(buffer, "%d", *((int *) ptr));
+ sprintf(buffer, "%d", *((int *)ptr));
result = buffer;
break;
case TK_CONFIG_DOUBLE:
- Tcl_PrintDouble(interp, *((double *) ptr), buffer);
+ Tcl_PrintDouble(interp, *((double *)ptr), buffer);
result = buffer;
break;
case TK_CONFIG_STRING:
- result = (*(char **) ptr);
+ result = (*(char **)ptr);
if (result == NULL) {
result = "";
}
break;
case TK_CONFIG_UID: {
- Tk_Uid uid = *((Tk_Uid *) ptr);
+ Tk_Uid uid = *((Tk_Uid *)ptr);
if (uid != NULL) {
result = uid;
@@ -804,7 +804,7 @@ FormatConfigValue(
break;
}
case TK_CONFIG_COLOR: {
- XColor *colorPtr = *((XColor **) ptr);
+ XColor *colorPtr = *((XColor **)ptr);
if (colorPtr != NULL) {
result = Tk_NameOfColor(colorPtr);
@@ -812,7 +812,7 @@ FormatConfigValue(
break;
}
case TK_CONFIG_FONT: {
- Tk_Font tkfont = *((Tk_Font *) ptr);
+ Tk_Font tkfont = *((Tk_Font *)ptr);
if (tkfont != NULL) {
result = Tk_NameOfFont(tkfont);
@@ -820,7 +820,7 @@ FormatConfigValue(
break;
}
case TK_CONFIG_BITMAP: {
- Pixmap pixmap = *((Pixmap *) ptr);
+ Pixmap pixmap = *((Pixmap *)ptr);
if (pixmap != None) {
result = Tk_NameOfBitmap(Tk_Display(tkwin), pixmap);
@@ -828,7 +828,7 @@ FormatConfigValue(
break;
}
case TK_CONFIG_BORDER: {
- Tk_3DBorder border = *((Tk_3DBorder *) ptr);
+ Tk_3DBorder border = *((Tk_3DBorder *)ptr);
if (border != NULL) {
result = Tk_NameOf3DBorder(border);
@@ -836,11 +836,11 @@ FormatConfigValue(
break;
}
case TK_CONFIG_RELIEF:
- result = Tk_NameOfRelief(*((int *) ptr));
+ result = Tk_NameOfRelief(*((int *)ptr));
break;
case TK_CONFIG_CURSOR:
case TK_CONFIG_ACTIVE_CURSOR: {
- Tk_Cursor cursor = *((Tk_Cursor *) ptr);
+ Tk_Cursor cursor = *((Tk_Cursor *)ptr);
if (cursor != NULL) {
result = Tk_NameOfCursor(Tk_Display(tkwin), cursor);
@@ -848,29 +848,27 @@ FormatConfigValue(
break;
}
case TK_CONFIG_JUSTIFY:
- result = Tk_NameOfJustify(*((Tk_Justify *) ptr));
+ result = Tk_NameOfJustify(*((Tk_Justify *)ptr));
break;
case TK_CONFIG_ANCHOR:
- result = Tk_NameOfAnchor(*((Tk_Anchor *) ptr));
+ result = Tk_NameOfAnchor(*((Tk_Anchor *)ptr));
break;
case TK_CONFIG_CAP_STYLE:
- result = Tk_NameOfCapStyle(*((int *) ptr));
+ result = Tk_NameOfCapStyle(*((int *)ptr));
break;
case TK_CONFIG_JOIN_STYLE:
- result = Tk_NameOfJoinStyle(*((int *) ptr));
+ result = Tk_NameOfJoinStyle(*((int *)ptr));
break;
case TK_CONFIG_PIXELS:
- sprintf(buffer, "%d", *((int *) ptr));
+ sprintf(buffer, "%d", *((int *)ptr));
result = buffer;
break;
case TK_CONFIG_MM:
- Tcl_PrintDouble(interp, *((double *) ptr), buffer);
+ Tcl_PrintDouble(interp, *((double *)ptr), buffer);
result = buffer;
break;
case TK_CONFIG_WINDOW: {
- Tk_Window tkwin;
-
- tkwin = *((Tk_Window *) ptr);
+ tkwin = *((Tk_Window *)ptr);
if (tkwin != NULL) {
result = Tk_PathName(tkwin);
}
@@ -1108,7 +1106,7 @@ GetCachedSpecs(
/*
* Now allocate our working copy's space and copy over the contents
- * from the master copy.
+ * from the origin.
*/
cachedSpecs = (Tk_ConfigSpec *)ckalloc(entrySpace);
@@ -1161,12 +1159,11 @@ GetCachedSpecs(
static void
DeleteSpecCacheTable(
ClientData clientData,
- Tcl_Interp *dummy)
+ TCL_UNUSED(Tcl_Interp *))
{
Tcl_HashTable *tablePtr = (Tcl_HashTable *)clientData;
Tcl_HashEntry *entryPtr;
Tcl_HashSearch search;
- (void)dummy;
for (entryPtr = Tcl_FirstHashEntry(tablePtr,&search); entryPtr != NULL;
entryPtr = Tcl_NextHashEntry(&search)) {
diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c
index 0702347..b64b6cc 100644
--- a/generic/tkOldTest.c
+++ b/generic/tkOldTest.c
@@ -6,9 +6,9 @@
* 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.
+ * Copyright © 1993-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 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
@@ -26,17 +26,17 @@
#if !defined(TK_NO_DEPRECATED) && (TCL_MAJOR_VERSION < 9)
/*
- * The following data structure represents the master for a test image:
+ * The following data structure represents the model for a test image:
*/
-typedef struct TImageMaster {
- Tk_ImageMaster master; /* Tk's token for image master. */
+typedef struct TImageModel {
+ Tk_ImageModel model; /* Tk's token for image model. */
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;
+} TImageModel;
/*
* The following data structure represents a particular use of a particular
@@ -44,7 +44,7 @@ typedef struct TImageMaster {
*/
typedef struct TImageInstance {
- TImageMaster *masterPtr; /* Pointer to master for image. */
+ TImageModel *modelPtr; /* Pointer to model for image. */
XColor *fg; /* Foreground color for drawing in image. */
GC gc; /* Graphics context for drawing in image. */
} TImageInstance;
@@ -55,7 +55,7 @@ typedef struct TImageInstance {
static int ImageCreate(Tcl_Interp *interp,
char *name, int argc, char **argv,
- Tk_ImageType *typePtr, Tk_ImageMaster master,
+ Tk_ImageType *typePtr, Tk_ImageModel model,
ClientData *clientDataPtr);
static ClientData ImageGet(Tk_Window tkwin, ClientData clientData);
static void ImageDisplay(ClientData clientData,
@@ -146,12 +146,12 @@ ImageCreate(
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
+ Tk_ImageModel model, /* 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;
+ TImageModel *timPtr;
const char *varName;
int i;
(void)typePtr;
@@ -171,8 +171,8 @@ ImageCreate(
varName = argv[i+1];
}
- timPtr = (TImageMaster *)ckalloc(sizeof(TImageMaster));
- timPtr->master = master;
+ timPtr = (TImageModel *)ckalloc(sizeof(TImageModel));
+ timPtr->model = model;
timPtr->interp = interp;
timPtr->width = 30;
timPtr->height = 15;
@@ -182,7 +182,7 @@ ImageCreate(
strcpy(timPtr->varName, varName);
Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL);
*clientDataPtr = timPtr;
- Tk_ImageChanged(master, 0, 0, 30, 15, 30, 15);
+ Tk_ImageChanged(model, 0, 0, 30, 15, 30, 15);
return TCL_OK;
}
@@ -210,7 +210,7 @@ ImageObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- TImageMaster *timPtr = (TImageMaster *)clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
int x, y, width, height;
if (objc < 2) {
@@ -231,7 +231,7 @@ ImageObjCmd(
|| (Tcl_GetIntFromObj(interp, objv[7], &timPtr->height) != TCL_OK)) {
return TCL_ERROR;
}
- Tk_ImageChanged(timPtr->master, x, y, width, height, timPtr->width,
+ Tk_ImageChanged(timPtr->model, x, y, width, height, timPtr->width,
timPtr->height);
} else {
Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]),
@@ -263,9 +263,9 @@ static ClientData
ImageGet(
Tk_Window tkwin, /* Token for window in which image will be
* used. */
- ClientData clientData) /* Pointer to TImageMaster for image. */
+ ClientData clientData) /* Pointer to TImageModel for image. */
{
- TImageMaster *timPtr = (TImageMaster *)clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
TImageInstance *instPtr;
char buffer[100];
XGCValues gcValues;
@@ -275,7 +275,7 @@ ImageGet(
TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
instPtr = (TImageInstance *)ckalloc(sizeof(TImageInstance));
- instPtr->masterPtr = timPtr;
+ instPtr->modelPtr = timPtr;
instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000");
gcValues.foreground = instPtr->fg->pixel;
instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues);
@@ -316,15 +316,15 @@ ImageDisplay(
char buffer[200 + TCL_INTEGER_SPACE * 6];
sprintf(buffer, "%s display %d %d %d %d %d %d",
- instPtr->masterPtr->imageName, imageX, imageY, width, height,
+ instPtr->modelPtr->imageName, imageX, imageY, width, height,
drawableX, drawableY);
- Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL,
+ Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL,
buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
- if (width > (instPtr->masterPtr->width - imageX)) {
- width = instPtr->masterPtr->width - imageX;
+ if (width > (instPtr->modelPtr->width - imageX)) {
+ width = instPtr->modelPtr->width - imageX;
}
- if (height > (instPtr->masterPtr->height - imageY)) {
- height = instPtr->masterPtr->height - imageY;
+ if (height > (instPtr->modelPtr->height - imageY)) {
+ height = instPtr->modelPtr->height - imageY;
}
XDrawRectangle(display, drawable, instPtr->gc, drawableX, drawableY,
(unsigned) (width-1), (unsigned) (height-1));
@@ -360,8 +360,8 @@ ImageFree(
TImageInstance *instPtr = (TImageInstance *)clientData;
char buffer[200];
- sprintf(buffer, "%s free", instPtr->masterPtr->imageName);
- Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL,
+ sprintf(buffer, "%s free", instPtr->modelPtr->imageName);
+ Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL,
buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
Tk_FreeColor(instPtr->fg);
Tk_FreeGC(display, instPtr->gc);
@@ -387,11 +387,11 @@ ImageFree(
static void
ImageDelete(
- ClientData clientData) /* Pointer to TImageMaster for image. When
+ ClientData clientData) /* Pointer to TImageModel for image. When
* this function is called, no more instances
* exist. */
{
- TImageMaster *timPtr = (TImageMaster *)clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
char buffer[100];
sprintf(buffer, "%s delete", timPtr->imageName);
diff --git a/generic/tkOption.c b/generic/tkOption.c
index 54ddb34..4668f28 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -521,7 +521,7 @@ Tk_GetOption(
if (masqName != NULL) {
char *masqClass;
Tk_Uid nodeId, winClassId, winNameId;
- size_t classNameLength;
+ TkSizeT classNameLength;
Element *nodePtr, *leafPtr;
static const int searchOrder[] = {
EXACT_NODE_NAME, WILDCARD_NODE_NAME, EXACT_NODE_CLASS,
@@ -534,7 +534,7 @@ Tk_GetOption(
* Extract the masquerade class name from the name field.
*/
- classNameLength = (unsigned) (masqName - name);
+ classNameLength = masqName - name;
masqClass = (char *)ckalloc(classNameLength + 1);
strncpy(masqClass, name, classNameLength);
masqClass[classNameLength] = '\0';
@@ -1085,7 +1085,7 @@ ReadOptionFile(
const char *realName;
Tcl_Obj *buffer;
int result;
- size_t bufferSize;
+ TkSizeT bufferSize;
Tcl_Channel chan;
Tcl_DString newName;
@@ -1116,7 +1116,7 @@ ReadOptionFile(
Tcl_IncrRefCount(buffer);
Tcl_SetChannelOption(NULL, chan, "-encoding", "utf-8");
bufferSize = Tcl_ReadChars(chan, buffer, -1, 0);
- if (bufferSize == (size_t)-1) {
+ if (bufferSize == TCL_IO_FAILURE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"error reading file \"%s\": %s",
fileName, Tcl_PosixError(interp)));
@@ -1420,11 +1420,10 @@ ExtendStacks(
static void
OptionThreadExitProc(
- ClientData dummy) /* not used */
+ TCL_UNUSED(void *))
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)dummy;
if (tsdPtr->initialized) {
int i;
diff --git a/generic/tkPack.c b/generic/tkPack.c
index 796530a..ac5d73f 100644
--- a/generic/tkPack.c
+++ b/generic/tkPack.c
@@ -4,8 +4,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -20,7 +20,7 @@ static const char *const sideNames[] = {
/*
* For each window that the packer cares about (either because the window is
- * managed by the packer or because the window has slaves that are managed by
+ * managed by the packer or because the window has content that are managed by
* the packer), there is a structure of the following type:
*/
@@ -29,15 +29,15 @@ typedef struct Packer {
* 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
+ struct Packer *containerPtr; /* Container 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
+ struct Packer *nextPtr; /* Next window packed within same container. 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
+ struct Packer *contentPtr; /* First in list of content packed inside this
+ * window (NULL means no packed content). */
+ Side side; /* Side of container against which this window is
* packed. */
Tk_Anchor anchor; /* If frame allocated for window is larger
* than window needs, this indicates how where
@@ -55,13 +55,13 @@ typedef struct Packer {
* each side). */
int doubleBw; /* Twice the window's last known border width.
* If this changes, the window must be
- * repacked within its master. */
+ * repacked within its container. */
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. */
+ * its content is deleted. */
int flags; /* Miscellaneous flags; see below for
* definitions. */
} Packer;
@@ -70,7 +70,7 @@ typedef struct 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
+ * been made to repack all the content of this
* window.
* FILLX: 1 means if frame allocated for window is wider
* than window needs, expand window to fill
@@ -78,17 +78,17 @@ typedef struct Packer {
* than needed.
* FILLY: Same as FILLX, except for height.
* EXPAND: 1 means this window's frame will absorb any
- * extra space in the master window.
+ * extra space in the container 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
+ * size. 0 means if this window is a container then
* Tk will set its requested size to fit the
- * needs of its slaves.
- * ALLOCED_MASTER 1 means that Pack has allocated itself as
- * geometry master for this window.
+ * needs of its content.
+ * ALLOCED_CONTAINER 1 means that Pack has allocated itself as
+ * geometry container for this window.
*/
#define REQUESTED_REPACK 1
@@ -97,20 +97,20 @@ typedef struct Packer {
#define EXPAND 8
#define OLD_STYLE 16
#define DONT_PROPAGATE 32
-#define ALLOCED_MASTER 64
+#define ALLOCED_CONTAINER 64
/*
* The following structure is the official type record for the packer:
*/
static void PackReqProc(ClientData clientData, Tk_Window tkwin);
-static void PackLostSlaveProc(ClientData clientData,
+static void PackLostContentProc(ClientData clientData,
Tk_Window tkwin);
static const Tk_GeomMgr packerType = {
"pack", /* name */
PackReqProc, /* requestProc */
- PackLostSlaveProc, /* lostSlaveProc */
+ PackLostContentProc, /* lostContentProc */
};
/*
@@ -118,19 +118,19 @@ static const Tk_GeomMgr packerType = {
*/
static void ArrangePacking(ClientData clientData);
-static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin,
+static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin,
int objc, Tcl_Obj *const objv[]);
static void DestroyPacker(void *memPtr);
static Packer * GetPacker(Tk_Window tkwin);
#ifndef TK_NO_DEPRECATED
static int PackAfter(Tcl_Interp *interp, Packer *prevPtr,
- Packer *masterPtr, int objc,Tcl_Obj *const objv[]);
+ Packer *containerPtr, int objc,Tcl_Obj *const objv[]);
#endif /* !TK_NO_DEPRECATED */
static void PackStructureProc(ClientData clientData,
XEvent *eventPtr);
static void Unlink(Packer *packPtr);
-static int XExpansion(Packer *slavePtr, int cavityWidth);
-static int YExpansion(Packer *slavePtr, int cavityHeight);
+static int XExpansion(Packer *contentPtr, int cavityWidth);
+static int YExpansion(Packer *contentPtr, int cavityHeight);
/*
*------------------------------------------------------------------------
@@ -202,19 +202,21 @@ Tk_PackObjCmd(
#ifndef TK_NO_DEPRECATED
"after", "append", "before", "unpack",
#endif /* !TK_NO_DEPRECATED */
- "configure", "forget", "info", "propagate", "slaves", NULL };
+ "configure", "content", "forget", "info", "propagate", "slaves", NULL };
+ static const char *const optionStringsNoDep[] = {
+ "configure", "content", "forget", "info", "propagate", NULL };
enum options {
#ifndef TK_NO_DEPRECATED
PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK,
#endif /* !TK_NO_DEPRECATED */
- PACK_CONFIGURE, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES };
+ PACK_CONFIGURE, PACK_CONTENT, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES };
int index;
if (objc >= 2) {
const char *string = Tcl_GetString(objv[1]);
if (string[0] == '.') {
- return ConfigureSlaves(interp, tkwin, objc-1, objv+1);
+ return ConfigureContent(interp, tkwin, objc-1, objv+1);
}
}
if (objc < 3) {
@@ -222,19 +224,16 @@ Tk_PackObjCmd(
return TCL_ERROR;
}
- if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
+ if (Tcl_GetIndexFromObjStruct(NULL, objv[1], optionStrings,
sizeof(char *), "option", 0, &index) != TCL_OK) {
-#ifndef TK_NO_DEPRECATED
/*
* Call it again without the deprecated ones to get a proper error
* message. This works well since there can't be any ambiguity between
* deprecated and new options.
*/
- Tcl_ResetResult(interp);
- Tcl_GetIndexFromObjStruct(interp, objv[1], &optionStrings[4],
+ Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep,
sizeof(char *), "option", 0, &index);
-#endif /* TK_NO_DEPRECATED */
return TCL_ERROR;
}
@@ -249,33 +248,33 @@ Tk_PackObjCmd(
return TCL_ERROR;
}
prevPtr = GetPacker(tkwin2);
- if (prevPtr->masterPtr == NULL) {
+ if (prevPtr->containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"window \"%s\" isn't packed", argv2));
Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL);
return TCL_ERROR;
}
- return PackAfter(interp, prevPtr, prevPtr->masterPtr, objc-3, objv+3);
+ return PackAfter(interp, prevPtr, prevPtr->containerPtr, objc-3, objv+3);
}
case PACK_APPEND: {
- Packer *masterPtr;
+ Packer *containerPtr;
Packer *prevPtr;
Tk_Window tkwin2;
if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetPacker(tkwin2);
- prevPtr = masterPtr->slavePtr;
+ containerPtr = GetPacker(tkwin2);
+ prevPtr = containerPtr->contentPtr;
if (prevPtr != NULL) {
while (prevPtr->nextPtr != NULL) {
prevPtr = prevPtr->nextPtr;
}
}
- return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3);
+ return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3);
}
case PACK_BEFORE: {
- Packer *packPtr, *masterPtr;
+ Packer *packPtr, *containerPtr;
Packer *prevPtr;
Tk_Window tkwin2;
@@ -283,14 +282,14 @@ Tk_PackObjCmd(
return TCL_ERROR;
}
packPtr = GetPacker(tkwin2);
- if (packPtr->masterPtr == NULL) {
+ if (packPtr->containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"window \"%s\" isn't packed", argv2));
Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL);
return TCL_ERROR;
}
- masterPtr = packPtr->masterPtr;
- prevPtr = masterPtr->slavePtr;
+ containerPtr = packPtr->containerPtr;
+ prevPtr = containerPtr->contentPtr;
if (prevPtr == packPtr) {
prevPtr = NULL;
} else {
@@ -303,7 +302,7 @@ Tk_PackObjCmd(
}
}
}
- return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3);
+ return PackAfter(interp, prevPtr, containerPtr, objc-3, objv+3);
}
#endif /* !TK_NO_DEPRECATED */
case PACK_CONFIGURE:
@@ -313,43 +312,43 @@ Tk_PackObjCmd(
Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL);
return TCL_ERROR;
}
- return ConfigureSlaves(interp, tkwin, objc-2, objv+2);
+ return ConfigureContent(interp, tkwin, objc-2, objv+2);
case PACK_FORGET: {
- Tk_Window slave;
- Packer *slavePtr;
+ Tk_Window content;
+ Packer *contentPtr;
int i;
for (i = 2; i < objc; i++) {
- if (TkGetWindowFromObj(interp, tkwin, objv[i], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[i], &content) != TCL_OK) {
continue;
}
- slavePtr = GetPacker(slave);
- if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) {
- Tk_ManageGeometry(slave, NULL, NULL);
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin,
- slavePtr->masterPtr->tkwin);
+ contentPtr = GetPacker(content);
+ if ((contentPtr != NULL) && (contentPtr->containerPtr != NULL)) {
+ Tk_ManageGeometry(content, NULL, NULL);
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin,
+ contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Unlink(contentPtr);
+ Tk_UnmapWindow(contentPtr->tkwin);
}
}
break;
}
case PACK_INFO: {
- Packer *slavePtr;
- Tk_Window slave;
+ Packer *contentPtr;
+ Tk_Window content;
Tcl_Obj *infoObj;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &content) != TCL_OK) {
return TCL_ERROR;
}
- slavePtr = GetPacker(slave);
- if (slavePtr->masterPtr == NULL) {
+ contentPtr = GetPacker(content);
+ if (contentPtr->containerPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"window \"%s\" isn't packed", argv2));
Tcl_SetErrorCode(interp, "TK", "PACK", "NOT_PACKED", NULL);
@@ -358,12 +357,12 @@ Tk_PackObjCmd(
infoObj = Tcl_NewObj();
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1),
- TkNewWindowObj(slavePtr->masterPtr->tkwin));
+ Tk_NewWindowObj(contentPtr->containerPtr->tkwin));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-anchor", -1),
- Tcl_NewStringObj(Tk_NameOfAnchor(slavePtr->anchor), -1));
+ Tcl_NewStringObj(Tk_NameOfAnchor(contentPtr->anchor), -1));
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-expand", -1),
- Tcl_NewBooleanObj(slavePtr->flags & EXPAND));
- switch (slavePtr->flags & (FILLX|FILLY)) {
+ Tcl_NewBooleanObj(contentPtr->flags & EXPAND));
+ switch (contentPtr->flags & (FILLX|FILLY)) {
case 0:
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", -1),
Tcl_NewStringObj("none", -1));
@@ -381,31 +380,31 @@ Tk_PackObjCmd(
Tcl_NewStringObj("both", -1));
break;
}
- TkAppendPadAmount(infoObj, "-ipadx", slavePtr->iPadX/2, slavePtr->iPadX);
- TkAppendPadAmount(infoObj, "-ipady", slavePtr->iPadY/2, slavePtr->iPadY);
- TkAppendPadAmount(infoObj, "-padx", slavePtr->padLeft,slavePtr->padX);
- TkAppendPadAmount(infoObj, "-pady", slavePtr->padTop, slavePtr->padY);
+ TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX);
+ TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY);
+ TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft,contentPtr->padX);
+ TkAppendPadAmount(infoObj, "-pady", contentPtr->padTop, contentPtr->padY);
Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-side", -1),
- Tcl_NewStringObj(sideNames[slavePtr->side], -1));
+ Tcl_NewStringObj(sideNames[contentPtr->side], -1));
Tcl_SetObjResult(interp, infoObj);
break;
}
case PACK_PROPAGATE: {
- Tk_Window master;
- Packer *masterPtr;
+ Tk_Window container;
+ Packer *containerPtr;
int propagate;
if (objc > 4) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetPacker(master);
+ containerPtr = GetPacker(container);
if (objc == 3) {
Tcl_SetObjResult(interp,
- Tcl_NewBooleanObj(!(masterPtr->flags & DONT_PROPAGATE)));
+ Tcl_NewBooleanObj(!(containerPtr->flags & DONT_PROPAGATE)));
return TCL_OK;
}
if (Tcl_GetBooleanFromObj(interp, objv[3], &propagate) != TCL_OK) {
@@ -413,56 +412,57 @@ Tk_PackObjCmd(
}
if (propagate) {
/*
- * If we have slaves, we need to register as geometry master.
+ * If we have content windows, we need to register as geometry container.
*/
- if (masterPtr->slavePtr != NULL) {
- if (TkSetGeometryMaster(interp, master, "pack") != TCL_OK) {
+ if (containerPtr->contentPtr != NULL) {
+ if (TkSetGeometryContainer(interp, container, "pack") != TCL_OK) {
return TCL_ERROR;
}
- masterPtr->flags |= ALLOCED_MASTER;
+ containerPtr->flags |= ALLOCED_CONTAINER;
}
- masterPtr->flags &= ~DONT_PROPAGATE;
+ containerPtr->flags &= ~DONT_PROPAGATE;
/*
- * Repack the master to allow new geometry information to
- * propagate upwards to the master's master.
+ * Repack the container to allow new geometry information to
+ * propagate upwards to the container's container.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_REPACK)) {
- masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_REPACK)) {
+ containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, containerPtr);
}
} else {
- if (masterPtr->flags & ALLOCED_MASTER) {
- TkFreeGeometryMaster(master, "pack");
- masterPtr->flags &= ~ALLOCED_MASTER;
+ if (containerPtr->flags & ALLOCED_CONTAINER) {
+ TkFreeGeometryContainer(container, "pack");
+ containerPtr->flags &= ~ALLOCED_CONTAINER;
}
- masterPtr->flags |= DONT_PROPAGATE;
+ containerPtr->flags |= DONT_PROPAGATE;
}
break;
}
- case PACK_SLAVES: {
- Tk_Window master;
- Packer *masterPtr, *slavePtr;
+ case PACK_SLAVES:
+ case PACK_CONTENT: {
+ Tk_Window container;
+ Packer *containerPtr, *contentPtr;
Tcl_Obj *resultObj;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- if (TkGetWindowFromObj(interp, tkwin, objv[2], &master) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[2], &container) != TCL_OK) {
return TCL_ERROR;
}
resultObj = Tcl_NewObj();
- masterPtr = GetPacker(master);
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
+ containerPtr = GetPacker(container);
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj(slavePtr->tkwin));
+ Tk_NewWindowObj(contentPtr->tkwin));
}
Tcl_SetObjResult(interp, resultObj);
break;
@@ -480,11 +480,11 @@ Tk_PackObjCmd(
return TCL_ERROR;
}
packPtr = GetPacker(tkwin2);
- if ((packPtr != NULL) && (packPtr->masterPtr != NULL)) {
+ if ((packPtr != NULL) && (packPtr->containerPtr != NULL)) {
Tk_ManageGeometry(tkwin2, NULL, NULL);
- if (packPtr->masterPtr->tkwin != Tk_Parent(packPtr->tkwin)) {
+ if (packPtr->containerPtr->tkwin != Tk_Parent(packPtr->tkwin)) {
Tk_UnmaintainGeometry(packPtr->tkwin,
- packPtr->masterPtr->tkwin);
+ packPtr->containerPtr->tkwin);
}
Unlink(packPtr);
Tk_UnmapWindow(packPtr->tkwin);
@@ -519,13 +519,12 @@ static void
PackReqProc(
ClientData clientData, /* Packer's information about window that got
* new preferred geometry. */
- Tk_Window tkwin) /* Other Tk-related information about the
+ TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the
* window. */
{
Packer *packPtr = (Packer *)clientData;
- (void)tkwin;
- packPtr = packPtr->masterPtr;
+ packPtr = packPtr->containerPtr;
if (!(packPtr->flags & REQUESTED_REPACK)) {
packPtr->flags |= REQUESTED_REPACK;
Tcl_DoWhenIdle(ArrangePacking, packPtr);
@@ -535,34 +534,33 @@ PackReqProc(
/*
*------------------------------------------------------------------------
*
- * PackLostSlaveProc --
+ * PackLostContentProc --
*
* This function is invoked by Tk whenever some other geometry claims
- * control over a slave that used to be managed by us.
+ * control over a content window that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all packer-related information about the slave.
+ * Forgets all packer-related information about the content.
*
*------------------------------------------------------------------------
*/
static void
-PackLostSlaveProc(
- ClientData clientData, /* Packer structure for slave window that was
+PackLostContentProc(
+ void *clientData, /* Packer structure for content window that was
* stolen away. */
- Tk_Window tkwin) /* Tk's handle for the slave window. */
+ TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */
{
- Packer *slavePtr = (Packer *)clientData;
- (void)tkwin;
+ Packer *contentPtr = (Packer *)clientData;
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Unlink(contentPtr);
+ Tk_UnmapWindow(contentPtr->tkwin);
}
/*
@@ -579,22 +577,22 @@ PackLostSlaveProc(
* None.
*
* Side effects:
- * The packed slaves of masterPtr may get resized or moved.
+ * The packed content of containerPtr may get resized or moved.
*
*------------------------------------------------------------------------
*/
static void
ArrangePacking(
- ClientData clientData) /* Structure describing master whose slaves
+ ClientData clientData) /* Structure describing container whose content
* are to be re-layed out. */
{
- Packer *masterPtr = (Packer *)clientData;
- Packer *slavePtr;
+ Packer *containerPtr = (Packer *)clientData;
+ Packer *contentPtr;
int cavityX, cavityY, cavityWidth, cavityHeight;
/* These variables keep track of the
* as-yet-unallocated space remaining in the
- * middle of the master window. */
+ * middle of the container window. */
int frameX, frameY, frameWidth, frameHeight;
/* These variables keep track of the frame
* allocated to the current window. */
@@ -607,15 +605,15 @@ ArrangePacking(
int borderLeft, borderRight;
int maxWidth, maxHeight, tmp;
- masterPtr->flags &= ~REQUESTED_REPACK;
+ containerPtr->flags &= ~REQUESTED_REPACK;
/*
- * If the master has no slaves anymore, then leave the master's size as-is.
- * Otherwise there is no way to "relinquish" control over the master
+ * If the container has no content anymore, then leave the container's size as-is.
+ * Otherwise there is no way to "relinquish" control over the container
* so another geometry manager can take over.
*/
- if (masterPtr->slavePtr == NULL) {
+ if (containerPtr->contentPtr == NULL) {
return;
}
@@ -625,52 +623,52 @@ ArrangePacking(
* necessary.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- masterPtr->abortPtr = &abort;
+ containerPtr->abortPtr = &abort;
abort = 0;
- Tcl_Preserve(masterPtr);
+ Tcl_Preserve(containerPtr);
/*
- * Pass #1: scan all the slaves to figure out the total amount of space
+ * Pass #1: scan all the content 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.
+ * content 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.
+ * content 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
+ * maxWidth - Gradually builds up the width needed by the container to
+ * just barely satisfy all the content's needs. For each
+ * content, the code computes the width needed for all the
+ * content so far and updates maxWidth if the new value is
* greater.
* maxHeight - Same as maxWidth, except keeps height info.
*/
- width = maxWidth = Tk_InternalBorderLeft(masterPtr->tkwin) +
- Tk_InternalBorderRight(masterPtr->tkwin);
- height = maxHeight = Tk_InternalBorderTop(masterPtr->tkwin) +
- Tk_InternalBorderBottom(masterPtr->tkwin);
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) {
- tmp = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padX + slavePtr->iPadX + width;
+ width = maxWidth = Tk_InternalBorderLeft(containerPtr->tkwin) +
+ Tk_InternalBorderRight(containerPtr->tkwin);
+ height = maxHeight = Tk_InternalBorderTop(containerPtr->tkwin) +
+ Tk_InternalBorderBottom(containerPtr->tkwin);
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) {
+ tmp = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padX + contentPtr->iPadX + width;
if (tmp > maxWidth) {
maxWidth = tmp;
}
- height += Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padY + slavePtr->iPadY;
+ height += Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padY + contentPtr->iPadY;
} else {
- tmp = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padY + slavePtr->iPadY + height;
+ tmp = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padY + contentPtr->iPadY + height;
if (tmp > maxHeight) {
maxHeight = tmp;
}
- width += Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padX + slavePtr->iPadX;
+ width += Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padX + contentPtr->iPadX;
}
}
if (width > maxWidth) {
@@ -680,31 +678,31 @@ ArrangePacking(
maxHeight = height;
}
- if (maxWidth < Tk_MinReqWidth(masterPtr->tkwin)) {
- maxWidth = Tk_MinReqWidth(masterPtr->tkwin);
+ if (maxWidth < Tk_MinReqWidth(containerPtr->tkwin)) {
+ maxWidth = Tk_MinReqWidth(containerPtr->tkwin);
}
- if (maxHeight < Tk_MinReqHeight(masterPtr->tkwin)) {
- maxHeight = Tk_MinReqHeight(masterPtr->tkwin);
+ if (maxHeight < Tk_MinReqHeight(containerPtr->tkwin)) {
+ maxHeight = Tk_MinReqHeight(containerPtr->tkwin);
}
/*
- * If the total amount of space needed in the master window has changed,
+ * If the total amount of space needed in the container 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.
+ * container has had a chance to resize us.
*/
- if (((maxWidth != Tk_ReqWidth(masterPtr->tkwin))
- || (maxHeight != Tk_ReqHeight(masterPtr->tkwin)))
- && !(masterPtr->flags & DONT_PROPAGATE)) {
- Tk_GeometryRequest(masterPtr->tkwin, maxWidth, maxHeight);
- masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, masterPtr);
+ if (((maxWidth != Tk_ReqWidth(containerPtr->tkwin))
+ || (maxHeight != Tk_ReqHeight(containerPtr->tkwin)))
+ && !(containerPtr->flags & DONT_PROPAGATE)) {
+ Tk_GeometryRequest(containerPtr->tkwin, maxWidth, maxHeight);
+ containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, containerPtr);
goto done;
}
/*
- * Pass #2: scan the slaves a second time assigning new sizes. The
+ * Pass #2: scan the content 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
@@ -712,22 +710,22 @@ ArrangePacking(
* somewhere inside the frame, depending on anchor.
*/
- cavityX = x = Tk_InternalBorderLeft(masterPtr->tkwin);
- cavityY = y = Tk_InternalBorderTop(masterPtr->tkwin);
- cavityWidth = Tk_Width(masterPtr->tkwin) -
- Tk_InternalBorderLeft(masterPtr->tkwin) -
- Tk_InternalBorderRight(masterPtr->tkwin);
- cavityHeight = Tk_Height(masterPtr->tkwin) -
- Tk_InternalBorderTop(masterPtr->tkwin) -
- Tk_InternalBorderBottom(masterPtr->tkwin);
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) {
+ cavityX = x = Tk_InternalBorderLeft(containerPtr->tkwin);
+ cavityY = y = Tk_InternalBorderTop(containerPtr->tkwin);
+ cavityWidth = Tk_Width(containerPtr->tkwin) -
+ Tk_InternalBorderLeft(containerPtr->tkwin) -
+ Tk_InternalBorderRight(containerPtr->tkwin);
+ cavityHeight = Tk_Height(containerPtr->tkwin) -
+ Tk_InternalBorderTop(containerPtr->tkwin) -
+ Tk_InternalBorderBottom(containerPtr->tkwin);
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) {
frameWidth = cavityWidth;
- frameHeight = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padY + slavePtr->iPadY;
- if (slavePtr->flags & EXPAND) {
- frameHeight += YExpansion(slavePtr, cavityHeight);
+ frameHeight = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padY + contentPtr->iPadY;
+ if (contentPtr->flags & EXPAND) {
+ frameHeight += YExpansion(contentPtr, cavityHeight);
}
cavityHeight -= frameHeight;
if (cavityHeight < 0) {
@@ -735,7 +733,7 @@ ArrangePacking(
cavityHeight = 0;
}
frameX = cavityX;
- if (slavePtr->side == TOP) {
+ if (contentPtr->side == TOP) {
frameY = cavityY;
cavityY += frameHeight;
} else {
@@ -743,10 +741,10 @@ ArrangePacking(
}
} else {
frameHeight = cavityHeight;
- frameWidth = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padX + slavePtr->iPadX;
- if (slavePtr->flags & EXPAND) {
- frameWidth += XExpansion(slavePtr, cavityWidth);
+ frameWidth = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padX + contentPtr->iPadX;
+ if (contentPtr->flags & EXPAND) {
+ frameWidth += XExpansion(contentPtr, cavityWidth);
}
cavityWidth -= frameWidth;
if (cavityWidth < 0) {
@@ -754,7 +752,7 @@ ArrangePacking(
cavityWidth = 0;
}
frameY = cavityY;
- if (slavePtr->side == LEFT) {
+ if (contentPtr->side == LEFT) {
frameX = cavityX;
cavityX += frameWidth;
} else {
@@ -771,31 +769,31 @@ ArrangePacking(
* completely ignored except when computing frame size).
*/
- if (slavePtr->flags & OLD_STYLE) {
+ if (contentPtr->flags & OLD_STYLE) {
borderX = borderY = 0;
borderTop = borderBtm = 0;
borderLeft = borderRight = 0;
} else {
- borderX = slavePtr->padX;
- borderY = slavePtr->padY;
- borderLeft = slavePtr->padLeft;
+ borderX = contentPtr->padX;
+ borderY = contentPtr->padY;
+ borderLeft = contentPtr->padLeft;
borderRight = borderX - borderLeft;
- borderTop = slavePtr->padTop;
+ borderTop = contentPtr->padTop;
borderBtm = borderY - borderTop;
}
- width = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->iPadX;
- if ((slavePtr->flags & FILLX)
+ width = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->iPadX;
+ if ((contentPtr->flags & FILLX)
|| (width > (frameWidth - borderX))) {
width = frameWidth - borderX;
}
- height = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->iPadY;
- if ((slavePtr->flags & FILLY)
+ height = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->iPadY;
+ if ((contentPtr->flags & FILLY)
|| (height > (frameHeight - borderY))) {
height = frameHeight - borderY;
}
- switch (slavePtr->anchor) {
+ switch (contentPtr->anchor) {
case TK_ANCHOR_N:
x = frameX + (borderLeft + frameWidth - width - borderRight)/2;
y = frameY + borderTop;
@@ -835,44 +833,44 @@ ArrangePacking(
default:
Tcl_Panic("bad frame factor in ArrangePacking");
}
- width -= slavePtr->doubleBw;
- height -= slavePtr->doubleBw;
+ width -= contentPtr->doubleBw;
+ height -= contentPtr->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
+ * state of the content. If the content is a child of the container, then do
* this here. Otherwise let Tk_MaintainGeometry do the work.
*/
- if (masterPtr->tkwin == Tk_Parent(slavePtr->tkwin)) {
+ if (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) {
if ((width <= 0) || (height <= 0)) {
- Tk_UnmapWindow(slavePtr->tkwin);
+ Tk_UnmapWindow(contentPtr->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 ((x != Tk_X(contentPtr->tkwin))
+ || (y != Tk_Y(contentPtr->tkwin))
+ || (width != Tk_Width(contentPtr->tkwin))
+ || (height != Tk_Height(contentPtr->tkwin))) {
+ Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height);
}
if (abort) {
goto done;
}
/*
- * Don't map the slave if the master isn't mapped: wait until
- * the master gets mapped later.
+ * Don't map the content if the container isn't mapped: wait until
+ * the container gets mapped later.
*/
- if (Tk_IsMapped(masterPtr->tkwin)) {
- Tk_MapWindow(slavePtr->tkwin);
+ if (Tk_IsMapped(containerPtr->tkwin)) {
+ Tk_MapWindow(contentPtr->tkwin);
}
}
} else {
if ((width <= 0) || (height <= 0)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin);
+ Tk_UnmapWindow(contentPtr->tkwin);
} else {
- Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin,
+ Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin,
x, y, width, height);
}
}
@@ -889,8 +887,8 @@ ArrangePacking(
}
done:
- masterPtr->abortPtr = NULL;
- Tcl_Release(masterPtr);
+ containerPtr->abortPtr = NULL;
+ Tcl_Release(containerPtr);
}
/*
@@ -898,7 +896,7 @@ ArrangePacking(
*
* XExpansion --
*
- * Given a list of packed slaves, the first of which is packed on the
+ * Given a list of packed content, the first of which is packed on the
* left or right and is expandable, compute how much to expand the child.
*
* Results:
@@ -913,9 +911,9 @@ ArrangePacking(
static int
XExpansion(
- Packer *slavePtr, /* First in list of remaining slaves. */
+ Packer *contentPtr, /* First in list of remaining content. */
int cavityWidth) /* Horizontal space left for all remaining
- * slaves. */
+ * content. */
{
int numExpand, minExpand, curExpand;
int childWidth;
@@ -933,10 +931,10 @@ XExpansion(
minExpand = cavityWidth;
numExpand = 0;
- for ( ; slavePtr != NULL; slavePtr = slavePtr->nextPtr) {
- childWidth = Tk_ReqWidth(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padX + slavePtr->iPadX;
- if ((slavePtr->side == TOP) || (slavePtr->side == BOTTOM)) {
+ for ( ; contentPtr != NULL; contentPtr = contentPtr->nextPtr) {
+ childWidth = Tk_ReqWidth(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padX + contentPtr->iPadX;
+ if ((contentPtr->side == TOP) || (contentPtr->side == BOTTOM)) {
if (numExpand) {
curExpand = (cavityWidth - childWidth)/numExpand;
if (curExpand < minExpand) {
@@ -945,7 +943,7 @@ XExpansion(
}
} else {
cavityWidth -= childWidth;
- if (slavePtr->flags & EXPAND) {
+ if (contentPtr->flags & EXPAND) {
numExpand++;
}
}
@@ -964,7 +962,7 @@ XExpansion(
*
* YExpansion --
*
- * Given a list of packed slaves, the first of which is packed on the top
+ * Given a list of packed content, the first of which is packed on the top
* or bottom and is expandable, compute how much to expand the child.
*
* Results:
@@ -979,9 +977,9 @@ XExpansion(
static int
YExpansion(
- Packer *slavePtr, /* First in list of remaining slaves. */
+ Packer *contentPtr, /* First in list of remaining content. */
int cavityHeight) /* Vertical space left for all remaining
- * slaves. */
+ * content. */
{
int numExpand, minExpand, curExpand;
int childHeight;
@@ -992,10 +990,10 @@ YExpansion(
minExpand = cavityHeight;
numExpand = 0;
- for ( ; slavePtr != NULL; slavePtr = slavePtr->nextPtr) {
- childHeight = Tk_ReqHeight(slavePtr->tkwin) + slavePtr->doubleBw
- + slavePtr->padY + slavePtr->iPadY;
- if ((slavePtr->side == LEFT) || (slavePtr->side == RIGHT)) {
+ for ( ; contentPtr != NULL; contentPtr = contentPtr->nextPtr) {
+ childHeight = Tk_ReqHeight(contentPtr->tkwin) + contentPtr->doubleBw
+ + contentPtr->padY + contentPtr->iPadY;
+ if ((contentPtr->side == LEFT) || (contentPtr->side == RIGHT)) {
if (numExpand) {
curExpand = (cavityHeight - childHeight)/numExpand;
if (curExpand < minExpand) {
@@ -1004,7 +1002,7 @@ YExpansion(
}
} else {
cavityHeight -= childHeight;
- if (slavePtr->flags & EXPAND) {
+ if (contentPtr->flags & EXPAND) {
numExpand++;
}
}
@@ -1064,9 +1062,9 @@ GetPacker(
}
packPtr = (Packer *)ckalloc(sizeof(Packer));
packPtr->tkwin = tkwin;
- packPtr->masterPtr = NULL;
+ packPtr->containerPtr = NULL;
packPtr->nextPtr = NULL;
- packPtr->slavePtr = NULL;
+ packPtr->contentPtr = NULL;
packPtr->side = TOP;
packPtr->anchor = TK_ANCHOR_CENTER;
packPtr->padX = packPtr->padY = 0;
@@ -1087,7 +1085,7 @@ GetPacker(
* PackAfter --
*
* This function does most of the real work of adding one or more windows
- * into the packing order for its master.
+ * into the packing order for its container.
*
* Results:
* A standard Tcl return value.
@@ -1105,8 +1103,8 @@ 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. */
+ * containerPtr. */
+ Packer *containerPtr, /* Container 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
@@ -1138,21 +1136,21 @@ PackAfter(
* its parent.
*/
- if (TkGetWindowFromObj(interp, masterPtr->tkwin, objv[0], &tkwin)
+ if (TkGetWindowFromObj(interp, containerPtr->tkwin, objv[0], &tkwin)
!= TCL_OK) {
return TCL_ERROR;
}
parent = Tk_Parent(tkwin);
- for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
+ for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == parent) {
break;
}
if (((Tk_FakeWin *) (ancestor))->flags & TK_TOP_HIERARCHY) {
badWindow:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't pack %s inside %s", Tcl_GetString(objv[0]),
- Tk_PathName(masterPtr->tkwin)));
+ "can't pack \"%s\" inside \"%s\"", Tcl_GetString(objv[0]),
+ Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
return TCL_ERROR;
}
@@ -1160,7 +1158,7 @@ PackAfter(
if (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY) {
goto badWindow;
}
- if (tkwin == masterPtr->tkwin) {
+ if (tkwin == containerPtr->tkwin) {
goto badWindow;
}
packPtr = GetPacker(tkwin);
@@ -1183,7 +1181,7 @@ PackAfter(
for (index = 0 ; index < optionCount; index++) {
Tcl_Obj *curOptPtr = options[index];
TkSizeT length;
- const char *curOpt = TkGetStringFromObj(curOptPtr, &length);
+ const char *curOpt = Tcl_GetStringFromObj(curOptPtr, &length);
c = curOpt[0];
@@ -1270,53 +1268,53 @@ PackAfter(
* Unpack this window if it's currently packed.
*/
- if (packPtr->masterPtr != NULL) {
- if ((packPtr->masterPtr != masterPtr) &&
- (packPtr->masterPtr->tkwin
+ if (packPtr->containerPtr != NULL) {
+ if ((packPtr->containerPtr != containerPtr) &&
+ (packPtr->containerPtr->tkwin
!= Tk_Parent(packPtr->tkwin))) {
Tk_UnmaintainGeometry(packPtr->tkwin,
- packPtr->masterPtr->tkwin);
+ packPtr->containerPtr->tkwin);
}
Unlink(packPtr);
}
/*
- * Add the window in the correct place in its master's packing
+ * Add the window in the correct place in its container's packing
* order, then make sure that the window is managed by us.
*/
- packPtr->masterPtr = masterPtr;
+ packPtr->containerPtr = containerPtr;
if (prevPtr == NULL) {
- packPtr->nextPtr = masterPtr->slavePtr;
- masterPtr->slavePtr = packPtr;
+ packPtr->nextPtr = containerPtr->contentPtr;
+ containerPtr->contentPtr = packPtr;
} else {
packPtr->nextPtr = prevPtr->nextPtr;
prevPtr->nextPtr = packPtr;
}
Tk_ManageGeometry(tkwin, &packerType, packPtr);
- if (!(masterPtr->flags & DONT_PROPAGATE)) {
- if (TkSetGeometryMaster(interp, masterPtr->tkwin, "pack")
+ if (!(containerPtr->flags & DONT_PROPAGATE)) {
+ if (TkSetGeometryContainer(interp, containerPtr->tkwin, "pack")
!= TCL_OK) {
Tk_ManageGeometry(tkwin, NULL, NULL);
Unlink(packPtr);
return TCL_ERROR;
}
- masterPtr->flags |= ALLOCED_MASTER;
+ containerPtr->flags |= ALLOCED_CONTAINER;
}
}
}
/*
- * Arrange for the master to be re-packed at the first idle moment.
+ * Arrange for the container to be re-packed at the first idle moment.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_REPACK)) {
- masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_REPACK)) {
+ containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, containerPtr);
}
return TCL_OK;
}
@@ -1327,13 +1325,13 @@ PackAfter(
*
* Unlink --
*
- * Remove a packer from its master's list of slaves.
+ * Remove a packer from its container's list of content.
*
* Results:
* None.
*
* Side effects:
- * The master will be scheduled for repacking.
+ * The container will be scheduled for repacking.
*
*----------------------------------------------------------------------
*/
@@ -1342,16 +1340,16 @@ static void
Unlink(
Packer *packPtr) /* Window to unlink. */
{
- Packer *masterPtr, *packPtr2;
+ Packer *containerPtr, *packPtr2;
- masterPtr = packPtr->masterPtr;
- if (masterPtr == NULL) {
+ containerPtr = packPtr->containerPtr;
+ if (containerPtr == NULL) {
return;
}
- if (masterPtr->slavePtr == packPtr) {
- masterPtr->slavePtr = packPtr->nextPtr;
+ if (containerPtr->contentPtr == packPtr) {
+ containerPtr->contentPtr = packPtr->nextPtr;
} else {
- for (packPtr2 = masterPtr->slavePtr; ; packPtr2 = packPtr2->nextPtr) {
+ for (packPtr2 = containerPtr->contentPtr; ; packPtr2 = packPtr2->nextPtr) {
if (packPtr2 == NULL) {
Tcl_Panic("Unlink couldn't find previous window");
}
@@ -1361,28 +1359,28 @@ Unlink(
}
}
}
- if (!(masterPtr->flags & REQUESTED_REPACK)) {
- masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_REPACK)) {
+ containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, containerPtr);
}
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- packPtr->masterPtr = NULL;
+ packPtr->containerPtr = NULL;
/*
- * If we have emptied this master from slaves it means we are no longer
+ * If we have emptied this container from content it means we are no longer
* handling it and should mark it as free.
*
- * Send the event "NoManagedChild" to the master to inform it about there
+ * Send the event "NoManagedChild" to the container to inform it about there
* being no managed children inside it.
*/
- if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) {
- TkFreeGeometryMaster(masterPtr->tkwin, "pack");
- masterPtr->flags &= ~ALLOCED_MASTER;
- TkSendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL);
+ if ((containerPtr->contentPtr == NULL) && (containerPtr->flags & ALLOCED_CONTAINER)) {
+ TkFreeGeometryContainer(containerPtr->tkwin, "pack");
+ containerPtr->flags &= ~ALLOCED_CONTAINER;
+ Tk_SendVirtualEvent(containerPtr->tkwin, "NoManagedChild", NULL);
}
}
@@ -1428,7 +1426,7 @@ DestroyPacker(
*
* 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 content, if any.
*
*----------------------------------------------------------------------
*/
@@ -1442,33 +1440,33 @@ PackStructureProc(
Packer *packPtr = (Packer *)clientData;
if (eventPtr->type == ConfigureNotify) {
- if ((packPtr->slavePtr != NULL)
+ if ((packPtr->contentPtr != NULL)
&& !(packPtr->flags & REQUESTED_REPACK)) {
packPtr->flags |= REQUESTED_REPACK;
Tcl_DoWhenIdle(ArrangePacking, packPtr);
}
- if ((packPtr->masterPtr != NULL)
+ if ((packPtr->containerPtr != NULL)
&& (packPtr->doubleBw != 2*Tk_Changes(packPtr->tkwin)->border_width)) {
- if (!(packPtr->masterPtr->flags & REQUESTED_REPACK)) {
+ if (!(packPtr->containerPtr->flags & REQUESTED_REPACK)) {
packPtr->doubleBw = 2*Tk_Changes(packPtr->tkwin)->border_width;
- packPtr->masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, packPtr->masterPtr);
+ packPtr->containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, packPtr->containerPtr);
}
}
} else if (eventPtr->type == DestroyNotify) {
- Packer *slavePtr, *nextPtr;
+ Packer *contentPtr, *nextPtr;
- if (packPtr->masterPtr != NULL) {
+ if (packPtr->containerPtr != NULL) {
Unlink(packPtr);
}
- for (slavePtr = packPtr->slavePtr; slavePtr != NULL;
- slavePtr = nextPtr) {
- Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL);
- Tk_UnmapWindow(slavePtr->tkwin);
- slavePtr->masterPtr = NULL;
- nextPtr = slavePtr->nextPtr;
- slavePtr->nextPtr = NULL;
+ for (contentPtr = packPtr->contentPtr; contentPtr != NULL;
+ contentPtr = nextPtr) {
+ Tk_ManageGeometry(contentPtr->tkwin, NULL, NULL);
+ Tk_UnmapWindow(contentPtr->tkwin);
+ contentPtr->containerPtr = NULL;
+ nextPtr = contentPtr->nextPtr;
+ contentPtr->nextPtr = NULL;
}
if (packPtr->tkwin != NULL) {
@@ -1484,11 +1482,11 @@ PackStructureProc(
Tcl_EventuallyFree(packPtr, (Tcl_FreeProc *) 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 container gets mapped, must redo the geometry computation so
+ * that all of its content get remapped.
*/
- if ((packPtr->slavePtr != NULL)
+ if ((packPtr->contentPtr != NULL)
&& !(packPtr->flags & REQUESTED_REPACK)) {
packPtr->flags |= REQUESTED_REPACK;
Tcl_DoWhenIdle(ArrangePacking, packPtr);
@@ -1497,11 +1495,11 @@ PackStructureProc(
Packer *packPtr2;
/*
- * Unmap all of the slaves when the master gets unmapped, so that they
+ * Unmap all of the content when the container gets unmapped, so that they
* don't bother to keep redisplaying themselves.
*/
- for (packPtr2 = packPtr->slavePtr; packPtr2 != NULL;
+ for (packPtr2 = packPtr->contentPtr; packPtr2 != NULL;
packPtr2 = packPtr2->nextPtr) {
Tk_UnmapWindow(packPtr2->tkwin);
}
@@ -1511,36 +1509,36 @@ PackStructureProc(
/*
*----------------------------------------------------------------------
*
- * ConfigureSlaves --
+ * ConfigureContent --
*
* 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.
+ * of content and configuration options, it arranges for the packer to
+ * manage the content 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.
*
* Side effects:
- * Slave windows get taken over by the packer.
+ * Content windows get taken over by the packer.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureSlaves(
+ConfigureContent(
Tcl_Interp *interp, /* Interpreter for error reporting. */
Tk_Window tkwin, /* Any window in application containing
- * slaves. Used to look up slave names. */
+ * content. Used to look up content 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;
- TkWindow *master;
+ Packer *containerPtr, *contentPtr, *prevPtr, *otherPtr;
+ Tk_Window other, content, parent, ancestor;
+ TkWindow *container;
int i, j, numWindows, tmp, positionGiven;
const char *string;
static const char *const optionStrings[] = {
@@ -1563,45 +1561,45 @@ ConfigureSlaves(
}
/*
- * 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
+ * Iterate over all of the content windows, parsing the configuration
+ * options for each content. It's a bit wasteful to re-parse the options for
+ * each content, but things get too messy if we try to parse the arguments
+ * just once at the beginning. For example, if a content 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;
+ containerPtr = NULL;
prevPtr = NULL;
positionGiven = 0;
for (j = 0; j < numWindows; j++) {
- if (TkGetWindowFromObj(interp, tkwin, objv[j], &slave) != TCL_OK) {
+ if (TkGetWindowFromObj(interp, tkwin, objv[j], &content) != TCL_OK) {
return TCL_ERROR;
}
- if (Tk_TopWinHierarchy(slave)) {
+ if (Tk_TopWinHierarchy(content)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"can't pack \"%s\": it's a top-level window",
Tcl_GetString(objv[j])));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL);
return TCL_ERROR;
}
- slavePtr = GetPacker(slave);
- slavePtr->flags &= ~OLD_STYLE;
+ contentPtr = GetPacker(content);
+ contentPtr->flags &= ~OLD_STYLE;
/*
- * If the slave isn't currently packed, reset all of its configuration
+ * If the content 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) {
- slavePtr->side = TOP;
- slavePtr->anchor = TK_ANCHOR_CENTER;
- slavePtr->padX = slavePtr->padY = 0;
- slavePtr->padLeft = slavePtr->padTop = 0;
- slavePtr->iPadX = slavePtr->iPadY = 0;
- slavePtr->flags &= ~(FILLX|FILLY|EXPAND);
+ if (contentPtr->containerPtr == NULL) {
+ contentPtr->side = TOP;
+ contentPtr->anchor = TK_ANCHOR_CENTER;
+ contentPtr->padX = contentPtr->padY = 0;
+ contentPtr->padLeft = contentPtr->padTop = 0;
+ contentPtr->iPadX = contentPtr->iPadY = 0;
+ contentPtr->flags &= ~(FILLX|FILLY|EXPAND);
}
for (i = numWindows; i < objc; i+=2) {
@@ -1625,7 +1623,7 @@ ConfigureSlaves(
return TCL_ERROR;
}
prevPtr = GetPacker(other);
- if (prevPtr->masterPtr == NULL) {
+ if (prevPtr->containerPtr == NULL) {
notPacked:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"window \"%s\" isn't packed",
@@ -1634,12 +1632,12 @@ ConfigureSlaves(
NULL);
return TCL_ERROR;
}
- masterPtr = prevPtr->masterPtr;
+ containerPtr = prevPtr->containerPtr;
positionGiven = 1;
}
break;
case CONF_ANCHOR:
- if (Tk_GetAnchorFromObj(interp, objv[i+1], &slavePtr->anchor)
+ if (Tk_GetAnchorFromObj(interp, objv[i+1], &contentPtr->anchor)
!= TCL_OK) {
return TCL_ERROR;
}
@@ -1651,11 +1649,11 @@ ConfigureSlaves(
return TCL_ERROR;
}
otherPtr = GetPacker(other);
- if (otherPtr->masterPtr == NULL) {
+ if (otherPtr->containerPtr == NULL) {
goto notPacked;
}
- masterPtr = otherPtr->masterPtr;
- prevPtr = masterPtr->slavePtr;
+ containerPtr = otherPtr->containerPtr;
+ prevPtr = containerPtr->contentPtr;
if (prevPtr == otherPtr) {
prevPtr = NULL;
} else {
@@ -1670,21 +1668,21 @@ ConfigureSlaves(
if (Tcl_GetBooleanFromObj(interp, objv[i+1], &tmp) != TCL_OK) {
return TCL_ERROR;
}
- slavePtr->flags &= ~EXPAND;
+ contentPtr->flags &= ~EXPAND;
if (tmp) {
- slavePtr->flags |= EXPAND;
+ contentPtr->flags |= EXPAND;
}
break;
case CONF_FILL:
string = Tcl_GetString(objv[i+1]);
if (strcmp(string, "none") == 0) {
- slavePtr->flags &= ~(FILLX|FILLY);
+ contentPtr->flags &= ~(FILLX|FILLY);
} else if (strcmp(string, "x") == 0) {
- slavePtr->flags = (slavePtr->flags & ~FILLY) | FILLX;
+ contentPtr->flags = (contentPtr->flags & ~FILLY) | FILLX;
} else if (strcmp(string, "y") == 0) {
- slavePtr->flags = (slavePtr->flags & ~FILLX) | FILLY;
+ contentPtr->flags = (contentPtr->flags & ~FILLX) | FILLY;
} else if (strcmp(string, "both") == 0) {
- slavePtr->flags |= FILLX|FILLY;
+ contentPtr->flags |= FILLX|FILLY;
} else {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad fill style \"%s\": must be "
@@ -1699,8 +1697,8 @@ ConfigureSlaves(
!= TCL_OK) {
return TCL_ERROR;
}
- masterPtr = GetPacker(other);
- prevPtr = masterPtr->slavePtr;
+ containerPtr = GetPacker(other);
+ prevPtr = containerPtr->contentPtr;
if (prevPtr != NULL) {
while (prevPtr->nextPtr != NULL) {
prevPtr = prevPtr->nextPtr;
@@ -1710,7 +1708,7 @@ ConfigureSlaves(
}
break;
case CONF_IPADX:
- if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp)
+ if ((Tk_GetPixelsFromObj(interp, content, objv[i+1], &tmp)
!= TCL_OK) || (tmp < 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad ipadx value \"%s\": must be positive screen"
@@ -1718,10 +1716,10 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL);
return TCL_ERROR;
}
- slavePtr->iPadX = tmp * 2;
+ contentPtr->iPadX = tmp * 2;
break;
case CONF_IPADY:
- if ((Tk_GetPixelsFromObj(interp, slave, objv[i+1], &tmp)
+ if ((Tk_GetPixelsFromObj(interp, content, objv[i+1], &tmp)
!= TCL_OK) || (tmp < 0)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"bad ipady value \"%s\": must be positive screen"
@@ -1729,17 +1727,17 @@ ConfigureSlaves(
Tcl_SetErrorCode(interp, "TK", "VALUE", "INT_PAD", NULL);
return TCL_ERROR;
}
- slavePtr->iPadY = tmp * 2;
+ contentPtr->iPadY = tmp * 2;
break;
case CONF_PADX:
- if (TkParsePadAmount(interp, slave, objv[i+1],
- &slavePtr->padLeft, &slavePtr->padX) != TCL_OK) {
+ if (TkParsePadAmount(interp, content, objv[i+1],
+ &contentPtr->padLeft, &contentPtr->padX) != TCL_OK) {
return TCL_ERROR;
}
break;
case CONF_PADY:
- if (TkParsePadAmount(interp, slave, objv[i+1],
- &slavePtr->padTop, &slavePtr->padY) != TCL_OK) {
+ if (TkParsePadAmount(interp, content, objv[i+1],
+ &contentPtr->padTop, &contentPtr->padY) != TCL_OK) {
return TCL_ERROR;
}
break;
@@ -1748,42 +1746,42 @@ ConfigureSlaves(
sizeof(char *), "side", TCL_EXACT, &side) != TCL_OK) {
return TCL_ERROR;
}
- slavePtr->side = (Side) side;
+ contentPtr->side = (Side) side;
break;
}
}
/*
- * If no position in a packing list was specified and the slave is
+ * If no position in a packing list was specified and the content is
* already packed, then leave it in its current location in its
* current packing list.
*/
- if (!positionGiven && (slavePtr->masterPtr != NULL)) {
- masterPtr = slavePtr->masterPtr;
+ if (!positionGiven && (contentPtr->containerPtr != NULL)) {
+ containerPtr = contentPtr->containerPtr;
goto scheduleLayout;
}
/*
- * If the slave is going to be put back after itself or the same -in
+ * If the content 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;
+ if (prevPtr == contentPtr) {
+ containerPtr = contentPtr->containerPtr;
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
+ * specified, arrange for the content to go at the end of the order for
* its parent.
*/
if (!positionGiven) {
- masterPtr = GetPacker(Tk_Parent(slave));
- prevPtr = masterPtr->slavePtr;
+ containerPtr = GetPacker(Tk_Parent(content));
+ prevPtr = containerPtr->contentPtr;
if (prevPtr != NULL) {
while (prevPtr->nextPtr != NULL) {
prevPtr = prevPtr->nextPtr;
@@ -1792,27 +1790,27 @@ ConfigureSlaves(
}
/*
- * 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
+ * Make sure that the content's parent is either the container or an
+ * ancestor of the container, and that the container and content aren't the
* same.
*/
- parent = Tk_Parent(slave);
- for (ancestor = masterPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
+ parent = Tk_Parent(content);
+ for (ancestor = containerPtr->tkwin; ; ancestor = Tk_Parent(ancestor)) {
if (ancestor == parent) {
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't pack %s inside %s", Tcl_GetString(objv[j]),
- Tk_PathName(masterPtr->tkwin)));
+ "can't pack \"%s\" inside \"%s\"", Tcl_GetString(objv[j]),
+ Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
return TCL_ERROR;
}
}
- if (slave == masterPtr->tkwin) {
+ if (content == containerPtr->tkwin) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't pack %s inside itself", Tcl_GetString(objv[j])));
+ "can't pack \"%s\" inside itself", Tcl_GetString(objv[j])));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL);
return TCL_ERROR;
}
@@ -1821,67 +1819,67 @@ ConfigureSlaves(
* Check for management loops.
*/
- for (master = (TkWindow *)masterPtr->tkwin; master != NULL;
- master = (TkWindow *)TkGetGeomMaster(master)) {
- if (master == (TkWindow *)slave) {
+ for (container = (TkWindow *)containerPtr->tkwin; container != NULL;
+ container = (TkWindow *)TkGetContainer(container)) {
+ if (container == (TkWindow *)content) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't put %s inside %s, would cause management loop",
- Tcl_GetString(objv[j]), Tk_PathName(masterPtr->tkwin)));
+ "can't put \"%s\" inside \"%s\": would cause management loop",
+ Tcl_GetString(objv[j]), Tk_PathName(containerPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
return TCL_ERROR;
}
}
- if (masterPtr->tkwin != Tk_Parent(slave)) {
- ((TkWindow *)slave)->maintainerPtr = (TkWindow *)masterPtr->tkwin;
+ if (containerPtr->tkwin != Tk_Parent(content)) {
+ ((TkWindow *)content)->maintainerPtr = (TkWindow *)containerPtr->tkwin;
}
/*
- * Unpack the slave if it's currently packed, then position it after
+ * Unpack the content if it's currently packed, then position it after
* prevPtr.
*/
- if (slavePtr->masterPtr != NULL) {
- if ((slavePtr->masterPtr != masterPtr) &&
- (slavePtr->masterPtr->tkwin
- != Tk_Parent(slavePtr->tkwin))) {
- Tk_UnmaintainGeometry(slavePtr->tkwin,
- slavePtr->masterPtr->tkwin);
+ if (contentPtr->containerPtr != NULL) {
+ if ((contentPtr->containerPtr != containerPtr) &&
+ (contentPtr->containerPtr->tkwin
+ != Tk_Parent(contentPtr->tkwin))) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin,
+ contentPtr->containerPtr->tkwin);
}
- Unlink(slavePtr);
+ Unlink(contentPtr);
}
- slavePtr->masterPtr = masterPtr;
+ contentPtr->containerPtr = containerPtr;
if (prevPtr == NULL) {
- slavePtr->nextPtr = masterPtr->slavePtr;
- masterPtr->slavePtr = slavePtr;
+ contentPtr->nextPtr = containerPtr->contentPtr;
+ containerPtr->contentPtr = contentPtr;
} else {
- slavePtr->nextPtr = prevPtr->nextPtr;
- prevPtr->nextPtr = slavePtr;
+ contentPtr->nextPtr = prevPtr->nextPtr;
+ prevPtr->nextPtr = contentPtr;
}
- Tk_ManageGeometry(slave, &packerType, slavePtr);
- prevPtr = slavePtr;
+ Tk_ManageGeometry(content, &packerType, contentPtr);
+ prevPtr = contentPtr;
- if (!(masterPtr->flags & DONT_PROPAGATE)) {
- if (TkSetGeometryMaster(interp, masterPtr->tkwin, "pack")
+ if (!(containerPtr->flags & DONT_PROPAGATE)) {
+ if (TkSetGeometryContainer(interp, containerPtr->tkwin, "pack")
!= TCL_OK) {
- Tk_ManageGeometry(slave, NULL, NULL);
- Unlink(slavePtr);
+ Tk_ManageGeometry(content, NULL, NULL);
+ Unlink(contentPtr);
return TCL_ERROR;
}
- masterPtr->flags |= ALLOCED_MASTER;
+ containerPtr->flags |= ALLOCED_CONTAINER;
}
/*
- * Arrange for the master to be re-packed at the first idle moment.
+ * Arrange for the container to be re-packed at the first idle moment.
*/
scheduleLayout:
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- if (!(masterPtr->flags & REQUESTED_REPACK)) {
- masterPtr->flags |= REQUESTED_REPACK;
- Tcl_DoWhenIdle(ArrangePacking, masterPtr);
+ if (!(containerPtr->flags & REQUESTED_REPACK)) {
+ containerPtr->flags |= REQUESTED_REPACK;
+ Tcl_DoWhenIdle(ArrangePacking, containerPtr);
}
}
return TCL_OK;
diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c
index f25726e..60d4fc0 100644
--- a/generic/tkPanedWindow.c
+++ b/generic/tkPanedWindow.c
@@ -6,8 +6,8 @@
* 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.
+ * Copyright © 1997 Sun Microsystems, Inc.
+ * Copyright © 2000 Ajuba Solutions.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -70,7 +70,7 @@ enum stretch {
typedef struct {
Tk_OptionTable pwOptions; /* Token for paned window option table. */
- Tk_OptionTable slaveOpts; /* Token for slave cget option table. */
+ Tk_OptionTable paneOpts; /* Token for pane cget option table. */
} OptionTables;
/*
@@ -78,35 +78,35 @@ typedef struct {
* managed by a paned window widget.
*/
-typedef struct Slave {
+typedef struct Pane {
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
+ int padx; /* Additional padding requested for pane, in
* the x dimension. */
- int pady; /* Additional padding requested for slave, in
+ int pady; /* Additional padding requested for pane, in
* the y dimension. */
Tcl_Obj *widthPtr, *heightPtr;
- /* Tcl_Obj rep's of slave width/height, to
+ /* Tcl_Obj rep's of pane width/height, to
* allow for null values. */
- int width; /* Slave width. */
- int height; /* Slave height. */
+ int width; /* Pane width. */
+ int height; /* Pane height. */
int sticky; /* Sticky string. */
int x, y; /* Coordinates of the widget. */
int paneWidth, paneHeight; /* Pane dimensions (may be different from
- * slave width/height). */
+ * pane 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 */
+ enum stretch stretch; /* Controls how pane grows/shrinks */
int hide; /* Controls visibility of pane */
- struct PanedWindow *masterPtr;
+ struct PanedWindow *containerPtr;
/* Paned window managing the window. */
Tk_Window after; /* Placeholder for parsing options. */
Tk_Window before; /* Placeholder for parsing options. */
-} Slave;
+} Pane;
/*
* A data structure of the following type is kept for each paned window widget
@@ -121,7 +121,7 @@ typedef struct PanedWindow {
Tcl_Command widgetCmd; /* Token for square's widget command. */
Tk_OptionTable optionTable; /* Token representing the configuration
* specifications. */
- Tk_OptionTable slaveOpts; /* Token for slave cget table. */
+ Tk_OptionTable paneOpts; /* Token for pane cget table. */
Tk_3DBorder background; /* Background color. */
int borderWidth; /* Value of -borderwidth option. */
int relief; /* 3D border effect (TK_RELIEF_RAISED, etc) */
@@ -151,9 +151,9 @@ typedef struct PanedWindow {
Tcl_Obj *proxyBorderWidthPtr; /* Tcl_Obj rep for proxyBorderWidth */
int proxyBorderWidth; /* Borderwidth used to draw proxy. */
int proxyRelief; /* Relief used to draw proxy, if TK_RELIEF_NULL then use relief. */
- Slave **slaves; /* Pointer to array of Slaves. */
- int numSlaves; /* Number of slaves. */
- int sizeofSlaves; /* Number of elements in the slaves array. */
+ Pane **panes; /* Pointer to array of Panes. */
+ int numPanes; /* Number of panes. */
+ int sizeofPanes; /* Number of elements in the panes array. */
int flags; /* Flags for widget; see below. */
} PanedWindow;
@@ -200,16 +200,16 @@ 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,
+static void PanedWindowLostPaneProc(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 Unlink(Pane *panePtr);
+static Pane * GetPane(PanedWindow *pwPtr, Tk_Window tkwin);
static void GetFirstLastVisiblePane(PanedWindow *pwPtr,
int *firstPtr, int *lastPtr);
-static void SlaveStructureProc(ClientData clientData,
+static void PaneStructureProc(ClientData clientData,
XEvent *eventPtr);
static int PanedWindowSashCommand(PanedWindow *pwPtr,
Tcl_Interp *interp, int objc,
@@ -218,7 +218,7 @@ static int PanedWindowProxyCommand(PanedWindow *pwPtr,
Tcl_Interp *interp, int objc,
Tcl_Obj * const objv[]);
static void ComputeGeometry(PanedWindow *pwPtr);
-static int ConfigureSlaves(PanedWindow *pwPtr,
+static int ConfigurePanes(PanedWindow *pwPtr,
Tcl_Interp *interp, int objc,
Tcl_Obj * const objv[]);
static void DestroyOptionTables(ClientData clientData,
@@ -233,7 +233,7 @@ 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);
+ int *paneWidthPtr, int *paneHeightPtr);
static void MoveSash(PanedWindow *pwPtr, int sash, int diff);
static int ObjectIsEmpty(Tcl_Obj *objPtr);
static void * ComputeSlotAddress(void *recordPtr, TkSizeT offset);
@@ -241,16 +241,16 @@ 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
+ * Sashes are between panes only, so there is one less sash than panes
*/
#define ValidSashIndex(pwPtr, sash) \
- (((sash) >= 0) && ((sash) < ((pwPtr)->numSlaves-1)))
+ (((sash) >= 0) && ((sash) < ((pwPtr)->numPanes-1)))
static const Tk_GeomMgr panedWindowMgrType = {
"panedwindow", /* name */
PanedWindowReqProc, /* requestProc */
- PanedWindowLostSlaveProc, /* lostSlaveProc */
+ PanedWindowLostPaneProc, /* lostPaneProc */
};
/*
@@ -261,7 +261,7 @@ static const Tk_GeomMgr panedWindowMgrType = {
/*
* The following structure contains pointers to functions used for processing
- * the custom "-sticky" option for slave windows.
+ * the custom "-sticky" option for panes.
*/
static const Tk_ObjCustomOption stickyOption = {
@@ -334,33 +334,33 @@ static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
-static const Tk_OptionSpec slaveOptionSpecs[] = {
+static const Tk_OptionSpec paneOptionSpecs[] = {
{TK_OPTION_WINDOW, "-after", NULL, NULL,
- DEF_PANEDWINDOW_PANE_AFTER, TCL_INDEX_NONE, offsetof(Slave, after),
+ DEF_PANEDWINDOW_PANE_AFTER, TCL_INDEX_NONE, offsetof(Pane, after),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_WINDOW, "-before", NULL, NULL,
- DEF_PANEDWINDOW_PANE_BEFORE, TCL_INDEX_NONE, offsetof(Slave, before),
+ DEF_PANEDWINDOW_PANE_BEFORE, TCL_INDEX_NONE, offsetof(Pane, before),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_PIXELS, "-height", NULL, NULL,
- DEF_PANEDWINDOW_PANE_HEIGHT, offsetof(Slave, heightPtr),
- offsetof(Slave, height), TK_OPTION_NULL_OK, 0, 0},
+ DEF_PANEDWINDOW_PANE_HEIGHT, offsetof(Pane, heightPtr),
+ offsetof(Pane, height), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_BOOLEAN, "-hide", "hide", "Hide",
- DEF_PANEDWINDOW_PANE_HIDE, TCL_INDEX_NONE, offsetof(Slave, hide), 0,0,GEOMETRY},
+ DEF_PANEDWINDOW_PANE_HIDE, TCL_INDEX_NONE, offsetof(Pane, hide), 0,0,GEOMETRY},
{TK_OPTION_PIXELS, "-minsize", NULL, NULL,
- DEF_PANEDWINDOW_PANE_MINSIZE, TCL_INDEX_NONE, offsetof(Slave, minSize), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_MINSIZE, TCL_INDEX_NONE, offsetof(Pane, minSize), 0, 0, 0},
{TK_OPTION_PIXELS, "-padx", NULL, NULL,
- DEF_PANEDWINDOW_PANE_PADX, TCL_INDEX_NONE, offsetof(Slave, padx), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_PADX, TCL_INDEX_NONE, offsetof(Pane, padx), 0, 0, 0},
{TK_OPTION_PIXELS, "-pady", NULL, NULL,
- DEF_PANEDWINDOW_PANE_PADY, TCL_INDEX_NONE, offsetof(Slave, pady), 0, 0, 0},
+ DEF_PANEDWINDOW_PANE_PADY, TCL_INDEX_NONE, offsetof(Pane, pady), 0, 0, 0},
{TK_OPTION_CUSTOM, "-sticky", NULL, NULL,
- DEF_PANEDWINDOW_PANE_STICKY, TCL_INDEX_NONE, offsetof(Slave, sticky), 0,
+ DEF_PANEDWINDOW_PANE_STICKY, TCL_INDEX_NONE, offsetof(Pane, sticky), 0,
&stickyOption, 0},
{TK_OPTION_STRING_TABLE, "-stretch", "stretch", "Stretch",
- DEF_PANEDWINDOW_PANE_STRETCH, TCL_INDEX_NONE, offsetof(Slave, stretch), 0,
+ DEF_PANEDWINDOW_PANE_STRETCH, TCL_INDEX_NONE, offsetof(Pane, stretch), 0,
(ClientData) stretchStrings, 0},
{TK_OPTION_PIXELS, "-width", NULL, NULL,
- DEF_PANEDWINDOW_PANE_WIDTH, offsetof(Slave, widthPtr),
- offsetof(Slave, width), TK_OPTION_NULL_OK, 0, 0},
+ DEF_PANEDWINDOW_PANE_WIDTH, offsetof(Pane, widthPtr),
+ offsetof(Pane, width), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0}
};
@@ -383,7 +383,7 @@ static const Tk_OptionSpec slaveOptionSpecs[] = {
int
Tk_PanedWindowObjCmd(
- ClientData dummy, /* NULL. */
+ TCL_UNUSED(ClientData), /* NULL. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj * const objv[]) /* Argument objects. */
@@ -392,7 +392,6 @@ Tk_PanedWindowObjCmd(
Tk_Window tkwin, parent;
OptionTables *pwOpts;
XSetWindowAttributes atts;
- (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
@@ -429,7 +428,7 @@ Tk_PanedWindowObjCmd(
*/
pwOpts->pwOptions = Tk_CreateOptionTable(interp, optionSpecs);
- pwOpts->slaveOpts = Tk_CreateOptionTable(interp, slaveOptionSpecs);
+ pwOpts->paneOpts = Tk_CreateOptionTable(interp, paneOptionSpecs);
}
Tk_SetClass(tkwin, "Panedwindow");
@@ -447,7 +446,7 @@ Tk_PanedWindowObjCmd(
Tk_PathName(pwPtr->tkwin), PanedWindowWidgetObjCmd, pwPtr,
PanedWindowCmdDeletedProc);
pwPtr->optionTable = pwOpts->pwOptions;
- pwPtr->slaveOpts = pwOpts->slaveOpts;
+ pwPtr->paneOpts = pwOpts->paneOpts;
pwPtr->relief = TK_RELIEF_RAISED;
pwPtr->gc = NULL;
pwPtr->cursor = NULL;
@@ -472,7 +471,7 @@ Tk_PanedWindowObjCmd(
/*
* 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.
+ * panes in the panedwindow.
*/
parent = Tk_Parent(pwPtr->tkwin);
@@ -507,7 +506,7 @@ Tk_PanedWindowObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(pwPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(pwPtr->tkwin));
return TCL_OK;
}
@@ -549,10 +548,10 @@ PanedWindowWidgetObjCmd(
Tcl_Obj *resultObj;
int index, count, i, x, y;
Tk_Window tkwin;
- Slave *slavePtr;
+ Pane *panePtr;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
@@ -570,7 +569,7 @@ PanedWindowWidgetObjCmd(
result = TCL_ERROR;
break;
}
- result = ConfigureSlaves(pwPtr, interp, objc, objv);
+ result = ConfigurePanes(pwPtr, interp, objc, objv);
break;
case PW_CGET:
@@ -605,7 +604,6 @@ PanedWindowWidgetObjCmd(
break;
case PW_FORGET: {
- int i;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "widget ?widget ...?");
@@ -617,21 +615,21 @@ PanedWindowWidgetObjCmd(
* 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]),
+ Tk_Window pane = Tk_NameToWindow(interp, Tcl_GetString(objv[i]),
pwPtr->tkwin);
- if (slave == NULL) {
+ if (pane == NULL) {
continue;
}
- slavePtr = GetPane(pwPtr, slave);
- if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) {
+ panePtr = GetPane(pwPtr, pane);
+ if ((panePtr != NULL) && (panePtr->containerPtr != NULL)) {
count++;
- Tk_ManageGeometry(slave, NULL, NULL);
- Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
- Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask,
- SlaveStructureProc, slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
- Unlink(slavePtr);
+ Tk_ManageGeometry(pane, NULL, NULL);
+ Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin);
+ Tk_DeleteEventHandler(panePtr->tkwin, StructureNotifyMask,
+ PaneStructureProc, panePtr);
+ Tk_UnmapWindow(panePtr->tkwin);
+ Unlink(panePtr);
}
if (count != 0) {
ComputeGeometry(pwPtr);
@@ -667,15 +665,15 @@ PanedWindowWidgetObjCmd(
break;
}
resultObj = NULL;
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i]->tkwin == tkwin) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (pwPtr->panes[i]->tkwin == tkwin) {
resultObj = Tk_GetOptionValue(interp,
- pwPtr->slaves[i], pwPtr->slaveOpts,
+ pwPtr->panes[i], pwPtr->paneOpts,
objv[3], tkwin);
}
}
if (resultObj == NULL) {
- if (i == pwPtr->numSlaves) {
+ if (i == pwPtr->numPanes) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"not managed by this window", -1));
Tcl_SetErrorCode(interp, "TK", "PANEDWINDOW", "UNMANAGED",
@@ -690,7 +688,7 @@ PanedWindowWidgetObjCmd(
case PW_PANECONFIGURE:
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv,
- "pane ?option? ?value option value ...?");
+ "pane ?-option value ...?");
result = TCL_ERROR;
break;
}
@@ -707,10 +705,10 @@ PanedWindowWidgetObjCmd(
result = TCL_ERROR;
break;
}
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i]->tkwin == tkwin) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (pwPtr->panes[i]->tkwin == tkwin) {
resultObj = Tk_GetOptionInfo(interp,
- pwPtr->slaves[i], pwPtr->slaveOpts,
+ pwPtr->panes[i], pwPtr->paneOpts,
(objc == 4) ? objv[3] : NULL,
pwPtr->tkwin);
if (resultObj == NULL) {
@@ -722,15 +720,15 @@ PanedWindowWidgetObjCmd(
}
}
} else {
- result = ConfigureSlaves(pwPtr, interp, objc, objv);
+ result = ConfigurePanes(pwPtr, interp, objc, objv);
}
break;
case PW_PANES:
resultObj = Tcl_NewObj();
- for (i = 0; i < pwPtr->numSlaves; i++) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
Tcl_ListObjAppendElement(NULL, resultObj,
- TkNewWindowObj(pwPtr->slaves[i]->tkwin));
+ Tk_NewWindowObj(pwPtr->panes[i]->tkwin));
}
Tcl_SetObjResult(interp, resultObj);
break;
@@ -750,37 +748,37 @@ PanedWindowWidgetObjCmd(
/*
*----------------------------------------------------------------------
*
- * ConfigureSlaves --
+ * ConfigurePanes --
*
- * Add or alter the configuration options of a slave in a paned window.
+ * Add or alter the configuration options of a pane 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 pane to the paned window, may alter the
+ * geometry management options of a pane.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureSlaves(
+ConfigurePanes(
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 i, firstOptionArg, j, found, doubleBw, index, numNewPanes, haveLoc;
int insertIndex;
Tk_Window tkwin = NULL, ancestor, parent;
- Slave *slavePtr, **inserts, **newSlaves;
- Slave options;
+ Pane *panePtr, **inserts, **newPanes;
+ Pane options;
const 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
+ * the panes. Also validate that the window names given are legitimate
* (ie, they are real windows, they are not the panedwindow itself, etc.).
*/
@@ -818,8 +816,8 @@ ConfigureSlaves(
return TCL_ERROR;
} else {
/*
- * Make sure the panedwindow is the parent of the slave,
- * or a descendant of the slave's parent.
+ * Make sure the panedwindow is the parent of the pane,
+ * or a descendant of the pane's parent.
*/
parent = Tk_Parent(tkwin);
@@ -848,8 +846,8 @@ ConfigureSlaves(
* extra testing in the for loop below.
*/
- memset((void *)&options, 0, sizeof(Slave));
- if (Tk_SetOptions(interp, &options, pwPtr->slaveOpts,
+ memset((void *)&options, 0, sizeof(Pane));
+ if (Tk_SetOptions(interp, &options, pwPtr->paneOpts,
objc - firstOptionArg, objv + firstOptionArg,
pwPtr->tkwin, NULL, NULL) != TCL_OK) {
return TCL_ERROR;
@@ -866,8 +864,8 @@ ConfigureSlaves(
if (options.after != NULL) {
tkwin = options.after;
haveLoc = 1;
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (options.after == pwPtr->slaves[i]->tkwin) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (options.after == pwPtr->panes[i]->tkwin) {
index = i + 1;
break;
}
@@ -875,8 +873,8 @@ ConfigureSlaves(
} else if (options.before != NULL) {
tkwin = options.before;
haveLoc = 1;
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (options.before == pwPtr->slaves[i]->tkwin) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (options.before == pwPtr->panes[i]->tkwin) {
index = i;
break;
}
@@ -893,28 +891,28 @@ ConfigureSlaves(
"window \"%s\" is not managed by %s",
Tk_PathName(tkwin), Tk_PathName(pwPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "PANEDWINDOW", "UNMANAGED", NULL);
- Tk_FreeConfigOptions((char *) &options, pwPtr->slaveOpts,
+ Tk_FreeConfigOptions((char *) &options, pwPtr->paneOpts,
pwPtr->tkwin);
return TCL_ERROR;
}
/*
- * Allocate an array to hold, in order, the pointers to the slave
+ * Allocate an array to hold, in order, the pointers to the pane
* 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));
+ inserts = (Pane **)ckalloc(sizeof(Pane *) * (firstOptionArg - 2));
insertIndex = 0;
/*
- * Populate the inserts array, creating new slave structures as necessary,
+ * Populate the inserts array, creating new pane 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 panes array as empty (for
+ * pre-existing pane structures).
*/
- for (i = 0, numNewSlaves = 0; i < firstOptionArg - 2; i++) {
+ for (i = 0, numNewPanes = 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.
@@ -924,24 +922,24 @@ ConfigureSlaves(
pwPtr->tkwin);
found = 0;
- for (j = 0; j < pwPtr->numSlaves; j++) {
- if (pwPtr->slaves[j] != NULL && pwPtr->slaves[j]->tkwin == tkwin) {
- Tk_SetOptions(interp, pwPtr->slaves[j],
- pwPtr->slaveOpts, objc - firstOptionArg,
+ for (j = 0; j < pwPtr->numPanes; j++) {
+ if (pwPtr->panes[j] != NULL && pwPtr->panes[j]->tkwin == tkwin) {
+ Tk_SetOptions(interp, pwPtr->panes[j],
+ pwPtr->paneOpts, objc - firstOptionArg,
objv + firstOptionArg, pwPtr->tkwin, NULL, NULL);
- if (pwPtr->slaves[j]->minSize < 0) {
- pwPtr->slaves[j]->minSize = 0;
+ if (pwPtr->panes[j]->minSize < 0) {
+ pwPtr->panes[j]->minSize = 0;
}
found = 1;
/*
- * If the slave is supposed to move, add it to the inserts
+ * If the pane is supposed to move, add it to the inserts
* array now; otherwise, leave it where it is.
*/
if (index != -1) {
- inserts[insertIndex++] = pwPtr->slaves[j];
- pwPtr->slaves[j] = NULL;
+ inserts[insertIndex++] = pwPtr->panes[j];
+ pwPtr->panes[j] = NULL;
}
break;
}
@@ -952,7 +950,7 @@ ConfigureSlaves(
}
/*
- * Make sure this slave wasn't already put into the inserts array,
+ * Make sure this pane wasn't already put into the inserts array,
* i.e., when the user specifies the same window multiple times in a
* single add commaned.
*/
@@ -967,104 +965,104 @@ ConfigureSlaves(
}
/*
- * Create a new slave structure and initialize it. All slaves start
+ * Create a new pane structure and initialize it. All panes start
* out with their "natural" dimensions.
*/
- slavePtr = (Slave *)ckalloc(sizeof(Slave));
- memset(slavePtr, 0, sizeof(Slave));
- Tk_InitOptions(interp, slavePtr, pwPtr->slaveOpts,
+ panePtr = (Pane *)ckalloc(sizeof(Pane));
+ memset(panePtr, 0, sizeof(Pane));
+ Tk_InitOptions(interp, panePtr, pwPtr->paneOpts,
pwPtr->tkwin);
- Tk_SetOptions(interp, slavePtr, pwPtr->slaveOpts,
+ Tk_SetOptions(interp, panePtr, pwPtr->paneOpts,
objc - firstOptionArg, objv + firstOptionArg,
pwPtr->tkwin, NULL, NULL);
- slavePtr->tkwin = tkwin;
- slavePtr->masterPtr = pwPtr;
- doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
- if (slavePtr->width > 0) {
- slavePtr->paneWidth = slavePtr->width;
+ panePtr->tkwin = tkwin;
+ panePtr->containerPtr = pwPtr;
+ doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
+ if (panePtr->width > 0) {
+ panePtr->paneWidth = panePtr->width;
} else {
- slavePtr->paneWidth = Tk_ReqWidth(tkwin) + doubleBw;
+ panePtr->paneWidth = Tk_ReqWidth(tkwin) + doubleBw;
}
- if (slavePtr->height > 0) {
- slavePtr->paneHeight = slavePtr->height;
+ if (panePtr->height > 0) {
+ panePtr->paneHeight = panePtr->height;
} else {
- slavePtr->paneHeight = Tk_ReqHeight(tkwin) + doubleBw;
+ panePtr->paneHeight = Tk_ReqHeight(tkwin) + doubleBw;
}
- if (slavePtr->minSize < 0) {
- slavePtr->minSize = 0;
+ if (panePtr->minSize < 0) {
+ panePtr->minSize = 0;
}
/*
- * Set up the geometry management callbacks for this slave.
+ * Set up the geometry management callbacks for this pane.
*/
- Tk_CreateEventHandler(slavePtr->tkwin, StructureNotifyMask,
- SlaveStructureProc, slavePtr);
- Tk_ManageGeometry(slavePtr->tkwin, &panedWindowMgrType, slavePtr);
- inserts[insertIndex++] = slavePtr;
- numNewSlaves++;
+ Tk_CreateEventHandler(panePtr->tkwin, StructureNotifyMask,
+ PaneStructureProc, panePtr);
+ Tk_ManageGeometry(panePtr->tkwin, &panedWindowMgrType, panePtr);
+ inserts[insertIndex++] = panePtr;
+ numNewPanes++;
}
/*
- * Allocate the new slaves array, then copy the slaves into it, in order.
+ * Allocate the new panes array, then copy the panes into it, in order.
*/
- i = sizeof(Slave *) * (pwPtr->numSlaves + numNewSlaves);
- newSlaves = (Slave **)ckalloc(i);
- memset(newSlaves, 0, i);
+ i = sizeof(Pane *) * (pwPtr->numPanes + numNewPanes);
+ newPanes = (Pane **)ckalloc(i);
+ memset(newPanes, 0, i);
if (index == -1) {
/*
- * If none of the existing slaves have to be moved, just copy the old
+ * If none of the existing panes have to be moved, just copy the old
* and append the new.
*/
- memcpy((void *)&(newSlaves[0]), pwPtr->slaves,
- sizeof(Slave *) * pwPtr->numSlaves);
- memcpy((void *)&(newSlaves[pwPtr->numSlaves]), inserts,
- sizeof(Slave *) * numNewSlaves);
+ memcpy((void *)&(newPanes[0]), pwPtr->panes,
+ sizeof(Pane *) * pwPtr->numPanes);
+ memcpy((void *)&(newPanes[pwPtr->numPanes]), inserts,
+ sizeof(Pane *) * numNewPanes);
} else {
/*
- * If some of the existing slaves were moved, the old slaves array
+ * If some of the existing panes were moved, the old panes 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 panes
* 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
+ * panes, copy the inserts array over, then finish off the old panes
* array.
*/
for (i = 0, j = 0; i < index; i++) {
- if (pwPtr->slaves[i] != NULL) {
- newSlaves[j] = pwPtr->slaves[i];
+ if (pwPtr->panes[i] != NULL) {
+ newPanes[j] = pwPtr->panes[i];
j++;
}
}
- memcpy((void *)&(newSlaves[j]), inserts, sizeof(Slave *)*insertIndex);
+ memcpy((void *)&(newPanes[j]), inserts, sizeof(Pane *)*insertIndex);
j += firstOptionArg - 2;
- for (i = index; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i] != NULL) {
- newSlaves[j] = pwPtr->slaves[i];
+ for (i = index; i < pwPtr->numPanes; i++) {
+ if (pwPtr->panes[i] != NULL) {
+ newPanes[j] = pwPtr->panes[i];
j++;
}
}
}
/*
- * Make the new slaves array the paned window's slave array, and clean up.
+ * Make the new panes array the paned window's pane array, and clean up.
*/
- ckfree(pwPtr->slaves);
+ ckfree(pwPtr->panes);
ckfree(inserts);
- pwPtr->slaves = newSlaves;
+ pwPtr->panes = newPanes;
/*
- * Set the paned window's slave count to the new value.
+ * Set the paned window's pane count to the new value.
*/
- pwPtr->numSlaves += numNewSlaves;
+ pwPtr->numPanes += numNewPanes;
- Tk_FreeConfigOptions((char *) &options, pwPtr->slaveOpts, pwPtr->tkwin);
+ Tk_FreeConfigOptions((char *) &options, pwPtr->paneOpts, pwPtr->tkwin);
ComputeGeometry(pwPtr);
return TCL_OK;
@@ -1102,7 +1100,7 @@ PanedWindowSashCommand(
};
int index, sash, x, y, diff;
Tcl_Obj *coords[2];
- Slave *slavePtr;
+ Pane *panePtr;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?");
@@ -1131,10 +1129,10 @@ PanedWindowSashCommand(
Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", NULL);
return TCL_ERROR;
}
- slavePtr = pwPtr->slaves[sash];
+ panePtr = pwPtr->panes[sash];
- coords[0] = Tcl_NewWideIntObj(slavePtr->sashx);
- coords[1] = Tcl_NewWideIntObj(slavePtr->sashy);
+ coords[0] = Tcl_NewWideIntObj(panePtr->sashx);
+ coords[1] = Tcl_NewWideIntObj(panePtr->sashy);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords));
break;
@@ -1164,11 +1162,11 @@ PanedWindowSashCommand(
return TCL_ERROR;
}
- pwPtr->slaves[sash]->markx = x;
- pwPtr->slaves[sash]->marky = y;
+ pwPtr->panes[sash]->markx = x;
+ pwPtr->panes[sash]->marky = y;
} else {
- coords[0] = Tcl_NewWideIntObj(pwPtr->slaves[sash]->markx);
- coords[1] = Tcl_NewWideIntObj(pwPtr->slaves[sash]->marky);
+ coords[0] = Tcl_NewWideIntObj(pwPtr->panes[sash]->markx);
+ coords[1] = Tcl_NewWideIntObj(pwPtr->panes[sash]->marky);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords));
}
break;
@@ -1199,18 +1197,18 @@ PanedWindowSashCommand(
return TCL_ERROR;
}
- slavePtr = pwPtr->slaves[sash];
+ panePtr = pwPtr->panes[sash];
if (pwPtr->orient == ORIENT_HORIZONTAL) {
if (index == SASH_PLACE) {
- diff = x - pwPtr->slaves[sash]->sashx;
+ diff = x - pwPtr->panes[sash]->sashx;
} else {
- diff = x - pwPtr->slaves[sash]->markx;
+ diff = x - pwPtr->panes[sash]->markx;
}
} else {
if (index == SASH_PLACE) {
- diff = y - pwPtr->slaves[sash]->sashy;
+ diff = y - pwPtr->panes[sash]->sashy;
} else {
- diff = y - pwPtr->slaves[sash]->marky;
+ diff = y - pwPtr->panes[sash]->marky;
}
}
@@ -1370,15 +1368,15 @@ PanedWindowEventProc(
} else if (eventPtr->type == DestroyNotify) {
DestroyPanedWindow(pwPtr);
} else if (eventPtr->type == UnmapNotify) {
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (!pwPtr->slaves[i]->hide) {
- Tk_UnmapWindow(pwPtr->slaves[i]->tkwin);
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (!pwPtr->panes[i]->hide) {
+ Tk_UnmapWindow(pwPtr->panes[i]->tkwin);
}
}
} else if (eventPtr->type == MapNotify) {
- for (i = 0; i < pwPtr->numSlaves; i++) {
- if (!pwPtr->slaves[i]->hide) {
- Tk_MapWindow(pwPtr->slaves[i]->tkwin);
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (!pwPtr->panes[i]->hide) {
+ Tk_MapWindow(pwPtr->panes[i]->tkwin);
}
}
}
@@ -1444,7 +1442,7 @@ DisplayPanedWindow(
ClientData clientData) /* Information about window. */
{
PanedWindow *pwPtr = (PanedWindow *)clientData;
- Slave *slavePtr;
+ Pane *panePtr;
Pixmap pixmap;
Tk_Window tkwin = pwPtr->tkwin;
int i, sashWidth, sashHeight;
@@ -1497,19 +1495,19 @@ DisplayPanedWindow(
*/
GetFirstLastVisiblePane(pwPtr, &first, &last);
- for (i = 0; i < pwPtr->numSlaves - 1; i++) {
- slavePtr = pwPtr->slaves[i];
- if (slavePtr->hide || i == last) {
+ for (i = 0; i < pwPtr->numPanes - 1; i++) {
+ panePtr = pwPtr->panes[i];
+ if (panePtr->hide || i == last) {
continue;
}
if (sashWidth > 0 && sashHeight > 0) {
Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background,
- slavePtr->sashx, slavePtr->sashy, sashWidth, sashHeight,
+ panePtr->sashx, panePtr->sashy, sashWidth, sashHeight,
1, pwPtr->sashRelief);
}
if (pwPtr->showHandle) {
Tk_Fill3DRectangle(tkwin, pixmap, pwPtr->background,
- slavePtr->handlex, slavePtr->handley,
+ panePtr->handlex, panePtr->handley,
pwPtr->handleSize, pwPtr->handleSize, 1,
TK_RELIEF_RAISED);
}
@@ -1570,23 +1568,23 @@ DestroyPanedWindow(
}
/*
- * Clean up the slave list; foreach slave:
- * o Cancel the slave's structure notification callback
- * o Cancel geometry management for the slave.
- * o Free memory for the slave
+ * Clean up the pane list; foreach pane:
+ * o Cancel the pane's structure notification callback
+ * o Cancel geometry management for the pane.
+ * o Free memory for the pane
*/
- for (i = 0; i < pwPtr->numSlaves; i++) {
- Tk_DeleteEventHandler(pwPtr->slaves[i]->tkwin, StructureNotifyMask,
- SlaveStructureProc, pwPtr->slaves[i]);
- Tk_ManageGeometry(pwPtr->slaves[i]->tkwin, NULL, NULL);
- Tk_FreeConfigOptions((char *) pwPtr->slaves[i], pwPtr->slaveOpts,
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ Tk_DeleteEventHandler(pwPtr->panes[i]->tkwin, StructureNotifyMask,
+ PaneStructureProc, pwPtr->panes[i]);
+ Tk_ManageGeometry(pwPtr->panes[i]->tkwin, NULL, NULL);
+ Tk_FreeConfigOptions((char *) pwPtr->panes[i], pwPtr->paneOpts,
pwPtr->tkwin);
- ckfree(pwPtr->slaves[i]);
- pwPtr->slaves[i] = NULL;
+ ckfree(pwPtr->panes[i]);
+ pwPtr->panes[i] = NULL;
}
- if (pwPtr->slaves) {
- ckfree(pwPtr->slaves);
+ if (pwPtr->panes) {
+ ckfree(pwPtr->panes);
}
/*
@@ -1628,12 +1626,11 @@ static void
PanedWindowReqProc(
ClientData clientData, /* Paned window's information about window
* that got new preferred geometry. */
- Tk_Window tkwin) /* Other Tk-related information about the
+ TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the
* window. */
{
- Slave *slavePtr = (Slave *)clientData;
- PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr;
- (void)tkwin;
+ Pane *panePtr = (Pane *)clientData;
+ PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr;
if (Tk_IsMapped(pwPtr->tkwin)) {
if (!(pwPtr->flags & RESIZE_PENDING)) {
@@ -1641,13 +1638,13 @@ PanedWindowReqProc(
Tcl_DoWhenIdle(ArrangePanes, pwPtr);
}
} else {
- int doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
+ int doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
- if (slavePtr->width <= 0) {
- slavePtr->paneWidth = Tk_ReqWidth(slavePtr->tkwin) + doubleBw;
+ if (panePtr->width <= 0) {
+ panePtr->paneWidth = Tk_ReqWidth(panePtr->tkwin) + doubleBw;
}
- if (slavePtr->height <= 0) {
- slavePtr->paneHeight = Tk_ReqHeight(slavePtr->tkwin) + doubleBw;
+ if (panePtr->height <= 0) {
+ panePtr->paneHeight = Tk_ReqHeight(panePtr->tkwin) + doubleBw;
}
ComputeGeometry(pwPtr);
}
@@ -1656,40 +1653,39 @@ PanedWindowReqProc(
/*
*--------------------------------------------------------------
*
- * PanedWindowLostSlaveProc --
+ * PanedWindowLostPaneProc --
*
* This function is invoked by Tk whenever some other geometry claims
- * control over a slave that used to be managed by us.
+ * control over a pane that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all information about the slave. Causes geometry to be
+ * Forgets all information about the pane. Causes geometry to be
* recomputed for the panedwindow.
*
*--------------------------------------------------------------
*/
static void
-PanedWindowLostSlaveProc(
- ClientData clientData, /* Grid structure for slave window that was
+PanedWindowLostPaneProc(
+ ClientData clientData, /* Grid structure for the pane that was
* stolen away. */
- Tk_Window tkwin) /* Tk's handle for the slave window. */
+ TCL_UNUSED(Tk_Window)) /* Tk's handle for the pane. */
{
- Slave *slavePtr = (Slave *)clientData;
- PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr;
- (void)tkwin;
-
- if (pwPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
- }
- Unlink(slavePtr);
- Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask,
- SlaveStructureProc, slavePtr);
- Tk_UnmapWindow(slavePtr->tkwin);
- slavePtr->tkwin = NULL;
- ckfree(slavePtr);
+ Pane *panePtr = (Pane *)clientData;
+ PanedWindow *pwPtr = (PanedWindow *) panePtr->containerPtr;
+
+ if (pwPtr->tkwin != Tk_Parent(panePtr->tkwin)) {
+ Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin);
+ }
+ Unlink(panePtr);
+ Tk_DeleteEventHandler(panePtr->tkwin, StructureNotifyMask,
+ PaneStructureProc, panePtr);
+ Tk_UnmapWindow(panePtr->tkwin);
+ panePtr->tkwin = NULL;
+ ckfree(panePtr);
ComputeGeometry(pwPtr);
}
@@ -1707,19 +1703,19 @@ PanedWindowLostSlaveProc(
* None.
*
* Side effects:
- * The slaves of masterPtr may get resized or moved.
+ * The panes of containerPtr may get resized or moved.
*
*--------------------------------------------------------------
*/
static void
ArrangePanes(
- ClientData clientData) /* Structure describing parent whose slaves
+ ClientData clientData) /* Structure describing parent whose panes
* are to be re-layed out. */
{
PanedWindow *pwPtr = (PanedWindow *)clientData;
- Slave *slavePtr;
- int i, slaveWidth, slaveHeight, slaveX, slaveY;
+ Pane *panePtr;
+ int i, newPaneWidth, newPaneHeight, paneX, paneY;
int paneWidth, paneHeight, paneSize, paneMinSize;
int doubleBw;
int x, y;
@@ -1734,13 +1730,13 @@ ArrangePanes(
pwPtr->flags &= ~(REQUESTED_RELAYOUT|RESIZE_PENDING);
/*
- * If the parent has no slaves anymore, then don't do anything at all:
+ * If the parent has no panes 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) {
+ if (pwPtr->numPanes == 0) {
return;
}
@@ -1779,37 +1775,37 @@ ArrangePanes(
+ pwPtr->sashPad;
}
- for (i = sashCount = 0; i < pwPtr->numSlaves; i++) {
- slavePtr = pwPtr->slaves[i];
+ for (i = sashCount = 0; i < pwPtr->numPanes; i++) {
+ panePtr = pwPtr->panes[i];
- if (slavePtr->hide) {
+ if (panePtr->hide) {
continue;
}
/*
- * Compute the total size needed by all the slaves and the left-over,
+ * Compute the total size needed by all the panes and the left-over,
* or shortage of space available.
*/
if (horizontal) {
- if (slavePtr->width > 0) {
- paneSize = slavePtr->width;
+ if (panePtr->width > 0) {
+ paneSize = panePtr->width;
} else {
- paneSize = slavePtr->paneWidth;
+ paneSize = panePtr->paneWidth;
}
- stretchReserve -= paneSize + (2 * slavePtr->padx);
+ stretchReserve -= paneSize + (2 * panePtr->padx);
} else {
- if (slavePtr->height > 0) {
- paneSize = slavePtr->height;
+ if (panePtr->height > 0) {
+ paneSize = panePtr->height;
} else {
- paneSize = slavePtr->paneHeight;
+ paneSize = panePtr->paneHeight;
}
- stretchReserve -= paneSize + (2 * slavePtr->pady);
+ stretchReserve -= paneSize + (2 * panePtr->pady);
}
- if (IsStretchable(slavePtr->stretch,i,first,last)
+ if (IsStretchable(panePtr->stretch,i,first,last)
&& Tk_IsMapped(pwPtr->tkwin)) {
paneDynSize += paneSize;
- paneDynMinSize += slavePtr->minSize;
+ paneDynMinSize += panePtr->minSize;
}
if (i != last) {
stretchReserve -= sashWidth;
@@ -1821,53 +1817,53 @@ ArrangePanes(
* Second pass; adjust/arrange panes.
*/
- for (i = 0; i < pwPtr->numSlaves; i++) {
- slavePtr = pwPtr->slaves[i];
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ panePtr = pwPtr->panes[i];
- if (slavePtr->hide) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
+ if (panePtr->hide) {
+ Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin);
+ Tk_UnmapWindow(panePtr->tkwin);
continue;
}
/*
- * Compute the size of this slave. The algorithm (assuming a
+ * Compute the size of this pane. 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.
+ * this pane, 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.
*/
- doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
- slaveWidth = (slavePtr->width > 0 ? slavePtr->width :
- Tk_ReqWidth(slavePtr->tkwin) + doubleBw);
- slaveHeight = (slavePtr->height > 0 ? slavePtr->height :
- Tk_ReqHeight(slavePtr->tkwin) + doubleBw);
- paneMinSize = slavePtr->minSize;
+ doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
+ newPaneWidth = (panePtr->width > 0 ? panePtr->width :
+ Tk_ReqWidth(panePtr->tkwin) + doubleBw);
+ newPaneHeight = (panePtr->height > 0 ? panePtr->height :
+ Tk_ReqHeight(panePtr->tkwin) + doubleBw);
+ paneMinSize = panePtr->minSize;
/*
* Calculate pane width and height.
*/
if (horizontal) {
- if (slavePtr->width > 0) {
- paneSize = slavePtr->width;
+ if (panePtr->width > 0) {
+ paneSize = panePtr->width;
} else {
- paneSize = slavePtr->paneWidth;
+ paneSize = panePtr->paneWidth;
}
pwSize = pwWidth;
} else {
- if (slavePtr->height > 0) {
- paneSize = slavePtr->height;
+ if (panePtr->height > 0) {
+ paneSize = panePtr->height;
} else {
- paneSize = slavePtr->paneHeight;
+ paneSize = panePtr->paneHeight;
}
pwSize = pwHeight;
}
- if (IsStretchable(slavePtr->stretch, i, first, last)) {
+ if (IsStretchable(panePtr->stretch, i, first, last)) {
double frac;
if (paneDynSize > 0) {
@@ -1877,7 +1873,7 @@ ArrangePanes(
}
paneDynSize -= paneSize;
- paneDynMinSize -= slavePtr->minSize;
+ paneDynMinSize -= panePtr->minSize;
stretchAmount = (int) (frac * stretchReserve);
if (paneSize + stretchAmount >= paneMinSize) {
stretchReserve -= stretchAmount;
@@ -1902,9 +1898,9 @@ ArrangePanes(
}
if (horizontal) {
paneWidth = paneSize;
- paneHeight = pwHeight - (2 * slavePtr->pady);
+ paneHeight = pwHeight - (2 * panePtr->pady);
} else {
- paneWidth = pwWidth - (2 * slavePtr->padx);
+ paneWidth = pwWidth - (2 * panePtr->padx);
paneHeight = paneSize;
}
@@ -1932,15 +1928,15 @@ ArrangePanes(
paneHeight = pwHeight - syReserve - y + internalBW;
}
- if (slaveWidth > paneWidth) {
- slaveWidth = paneWidth;
+ if (newPaneWidth > paneWidth) {
+ newPaneWidth = paneWidth;
}
- if (slaveHeight > paneHeight) {
- slaveHeight = paneHeight;
+ if (newPaneHeight > paneHeight) {
+ newPaneHeight = paneHeight;
}
- slavePtr->x = x;
- slavePtr->y = y;
+ panePtr->x = x;
+ panePtr->y = y;
/*
* Compute the location of the sash at the right or bottom of the
@@ -1948,51 +1944,51 @@ ArrangePanes(
*/
if (horizontal) {
- x += paneWidth + (2 * slavePtr->padx);
+ x += paneWidth + (2 * panePtr->padx);
if (x < internalBW) {
x = internalBW;
}
- slavePtr->sashx = x + sashOffset;
- slavePtr->sashy = y;
- slavePtr->handlex = x + handleOffset;
- slavePtr->handley = y + pwPtr->handlePad;
+ panePtr->sashx = x + sashOffset;
+ panePtr->sashy = y;
+ panePtr->handlex = x + handleOffset;
+ panePtr->handley = y + pwPtr->handlePad;
x += sashWidth;
} else {
- y += paneHeight + (2 * slavePtr->pady);
+ y += paneHeight + (2 * panePtr->pady);
if (y < internalBW) {
y = internalBW;
}
- slavePtr->sashx = x;
- slavePtr->sashy = y + sashOffset;
- slavePtr->handlex = x + pwPtr->handlePad;
- slavePtr->handley = y + handleOffset;
+ panePtr->sashx = x;
+ panePtr->sashy = y + sashOffset;
+ panePtr->handlex = x + pwPtr->handlePad;
+ panePtr->handley = y + handleOffset;
y += sashWidth;
}
/*
- * Compute the actual dimensions of the slave in the pane.
+ * Compute the actual dimensions of the pane in the pane.
*/
- slaveX = slavePtr->x;
- slaveY = slavePtr->y;
- AdjustForSticky(slavePtr->sticky, paneWidth, paneHeight,
- &slaveX, &slaveY, &slaveWidth, &slaveHeight);
+ paneX = panePtr->x;
+ paneY = panePtr->y;
+ AdjustForSticky(panePtr->sticky, paneWidth, paneHeight,
+ &paneX, &paneY, &newPaneWidth, &newPaneHeight);
- slaveX += slavePtr->padx;
- slaveY += slavePtr->pady;
+ paneX += panePtr->padx;
+ paneY += panePtr->pady;
/*
* Now put the window in the proper spot.
*/
- if (slaveWidth <= 0 || slaveHeight <= 0 ||
- (horizontal ? slaveX - internalBW > pwWidth :
- slaveY - internalBW > pwHeight)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
+ if (newPaneWidth <= 0 || newPaneHeight <= 0 ||
+ (horizontal ? paneX - internalBW > pwWidth :
+ paneY - internalBW > pwHeight)) {
+ Tk_UnmaintainGeometry(panePtr->tkwin, pwPtr->tkwin);
+ Tk_UnmapWindow(panePtr->tkwin);
} else {
- Tk_MaintainGeometry(slavePtr->tkwin, pwPtr->tkwin,
- slaveX, slaveY, slaveWidth, slaveHeight);
+ Tk_MaintainGeometry(panePtr->tkwin, pwPtr->tkwin,
+ paneX, paneY, newPaneWidth, newPaneHeight);
}
sashCount--;
}
@@ -2004,7 +2000,7 @@ ArrangePanes(
*
* Unlink --
*
- * Remove a slave from a paned window.
+ * Remove a pane from a paned window.
*
* Results:
* None.
@@ -2017,57 +2013,57 @@ ArrangePanes(
static void
Unlink(
- Slave *slavePtr) /* Window to unlink. */
+ Pane *panePtr) /* Window to unlink. */
{
- PanedWindow *masterPtr;
+ PanedWindow *containerPtr;
int i, j;
- masterPtr = slavePtr->masterPtr;
- if (masterPtr == NULL) {
+ containerPtr = panePtr->containerPtr;
+ if (containerPtr == NULL) {
return;
}
/*
- * Find the specified slave in the panedwindow's list of slaves, then
+ * Find the specified pane in the panedwindow's list of panes, then
* remove it from that list.
*/
- for (i = 0; i < masterPtr->numSlaves; i++) {
- if (masterPtr->slaves[i] == slavePtr) {
- for (j = i; j < masterPtr->numSlaves - 1; j++) {
- masterPtr->slaves[j] = masterPtr->slaves[j + 1];
+ for (i = 0; i < containerPtr->numPanes; i++) {
+ if (containerPtr->panes[i] == panePtr) {
+ for (j = i; j < containerPtr->numPanes - 1; j++) {
+ containerPtr->panes[j] = containerPtr->panes[j + 1];
}
break;
}
}
/*
- * Clean out any -after or -before references to this slave
+ * Clean out any -after or -before references to this pane
*/
- for (i = 0; i < masterPtr->numSlaves; i++) {
- if (masterPtr->slaves[i]->before == slavePtr->tkwin) {
- masterPtr->slaves[i]->before = NULL;
+ for (i = 0; i < containerPtr->numPanes; i++) {
+ if (containerPtr->panes[i]->before == panePtr->tkwin) {
+ containerPtr->panes[i]->before = NULL;
}
- if (masterPtr->slaves[i]->after == slavePtr->tkwin) {
- masterPtr->slaves[i]->after = NULL;
+ if (containerPtr->panes[i]->after == panePtr->tkwin) {
+ containerPtr->panes[i]->after = NULL;
}
}
- masterPtr->flags |= REQUESTED_RELAYOUT;
- if (!(masterPtr->flags & REDRAW_PENDING)) {
- masterPtr->flags |= REDRAW_PENDING;
- Tcl_DoWhenIdle(DisplayPanedWindow, masterPtr);
+ containerPtr->flags |= REQUESTED_RELAYOUT;
+ if (!(containerPtr->flags & REDRAW_PENDING)) {
+ containerPtr->flags |= REDRAW_PENDING;
+ Tcl_DoWhenIdle(DisplayPanedWindow, containerPtr);
}
/*
- * Set the slave's masterPtr to NULL, so that we can tell that the slave
+ * Set the pane's containerPtr to NULL, so that we can tell that the pane
* is no longer attached to any panedwindow.
*/
- slavePtr->masterPtr = NULL;
+ panePtr->containerPtr = NULL;
- masterPtr->numSlaves--;
+ containerPtr->numPanes--;
}
/*
@@ -2079,7 +2075,7 @@ Unlink(
* token in a given paned window.
*
* Results:
- * Pointer to the slave structure, or NULL if the window is not managed
+ * Pointer to the pane structure, or NULL if the window is not managed
* by this paned window.
*
* Side effects:
@@ -2088,16 +2084,16 @@ Unlink(
*----------------------------------------------------------------------
*/
-static Slave *
+static Pane *
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];
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ if (pwPtr->panes[i]->tkwin == tkwin) {
+ return pwPtr->panes[i];
}
}
return NULL;
@@ -2128,8 +2124,8 @@ GetFirstLastVisiblePane(
{
int i;
- for (i = 0, *lastPtr = 0, *firstPtr = -1; i < pwPtr->numSlaves; i++) {
- if (pwPtr->slaves[i]->hide == 0) {
+ for (i = 0, *lastPtr = 0, *firstPtr = -1; i < pwPtr->numPanes; i++) {
+ if (pwPtr->panes[i]->hide == 0) {
if (*firstPtr < 0) {
*firstPtr = i;
}
@@ -2141,7 +2137,7 @@ GetFirstLastVisiblePane(
/*
*--------------------------------------------------------------
*
- * SlaveStructureProc --
+ * PaneStructureProc --
*
* This function is invoked whenever StructureNotify events occur for a
* window that's managed by a paned window. This function's only purpose
@@ -2151,25 +2147,25 @@ GetFirstLastVisiblePane(
* None.
*
* Side effects:
- * The paned window slave structure associated with the window
- * is freed, and the slave is disassociated from the paned
+ * The paned window pane structure associated with the window
+ * is freed, and the pane is disassociated from the paned
* window which managed it.
*
*--------------------------------------------------------------
*/
static void
-SlaveStructureProc(
+PaneStructureProc(
ClientData clientData, /* Pointer to record describing window item. */
XEvent *eventPtr) /* Describes what just happened. */
{
- Slave *slavePtr = (Slave *)clientData;
- PanedWindow *pwPtr = slavePtr->masterPtr;
+ Pane *panePtr = (Pane *)clientData;
+ PanedWindow *pwPtr = panePtr->containerPtr;
if (eventPtr->type == DestroyNotify) {
- Unlink(slavePtr);
- slavePtr->tkwin = NULL;
- ckfree(slavePtr);
+ Unlink(panePtr);
+ panePtr->tkwin = NULL;
+ ckfree(panePtr);
ComputeGeometry(pwPtr);
}
}
@@ -2180,7 +2176,7 @@ SlaveStructureProc(
* ComputeGeometry --
*
* Compute geometry for the paned window, including coordinates of all
- * slave windows and each sash.
+ * panes and each sash.
*
* Results:
* None.
@@ -2198,7 +2194,7 @@ ComputeGeometry(
int i, x, y, doubleBw, internalBw;
int sashWidth, sashOffset, handleOffset;
int reqWidth, reqHeight, dim;
- Slave *slavePtr;
+ Pane *panePtr;
const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL);
pwPtr->flags |= REQUESTED_RELAYOUT;
@@ -2224,20 +2220,20 @@ ComputeGeometry(
+ pwPtr->sashPad;
}
- for (i = 0; i < pwPtr->numSlaves; i++) {
- slavePtr = pwPtr->slaves[i];
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ panePtr = pwPtr->panes[i];
- if (slavePtr->hide) {
+ if (panePtr->hide) {
continue;
}
/*
- * First set the coordinates for the top left corner of the slave's
+ * First set the coordinates for the top left corner of the pane's
* parcel.
*/
- slavePtr->x = x;
- slavePtr->y = y;
+ panePtr->x = x;
+ panePtr->y = y;
/*
* Make sure the pane's paned dimension is at least minsize. This
@@ -2246,12 +2242,12 @@ ComputeGeometry(
*/
if (horizontal) {
- if (slavePtr->paneWidth < slavePtr->minSize) {
- slavePtr->paneWidth = slavePtr->minSize;
+ if (panePtr->paneWidth < panePtr->minSize) {
+ panePtr->paneWidth = panePtr->minSize;
}
} else {
- if (slavePtr->paneHeight < slavePtr->minSize) {
- slavePtr->paneHeight = slavePtr->minSize;
+ if (panePtr->paneHeight < panePtr->minSize) {
+ panePtr->paneHeight = panePtr->minSize;
}
}
@@ -2261,55 +2257,55 @@ ComputeGeometry(
*/
if (horizontal) {
- x += slavePtr->paneWidth + (2 * slavePtr->padx);
- slavePtr->sashx = x + sashOffset;
- slavePtr->sashy = y;
- slavePtr->handlex = x + handleOffset;
- slavePtr->handley = y + pwPtr->handlePad;
+ x += panePtr->paneWidth + (2 * panePtr->padx);
+ panePtr->sashx = x + sashOffset;
+ panePtr->sashy = y;
+ panePtr->handlex = x + handleOffset;
+ panePtr->handley = y + pwPtr->handlePad;
x += sashWidth;
} else {
- y += slavePtr->paneHeight + (2 * slavePtr->pady);
- slavePtr->sashx = x;
- slavePtr->sashy = y + sashOffset;
- slavePtr->handlex = x + pwPtr->handlePad;
- slavePtr->handley = y + handleOffset;
+ y += panePtr->paneHeight + (2 * panePtr->pady);
+ panePtr->sashx = x;
+ panePtr->sashy = y + sashOffset;
+ panePtr->handlex = x + pwPtr->handlePad;
+ panePtr->handley = y + handleOffset;
y += sashWidth;
}
/*
- * Find the maximum height/width of the slaves, for computing the
+ * Find the maximum height/width of the panes, for computing the
* requested height/width of the paned window.
*/
if (horizontal) {
/*
- * If the slave has an explicit height set, use that; otherwise,
- * use the slave's requested height.
+ * If the pane has an explicit height set, use that; otherwise,
+ * use the pane's requested height.
*/
- if (slavePtr->height > 0) {
- dim = slavePtr->height;
+ if (panePtr->height > 0) {
+ dim = panePtr->height;
} else {
- doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
- dim = Tk_ReqHeight(slavePtr->tkwin) + doubleBw;
+ doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
+ dim = Tk_ReqHeight(panePtr->tkwin) + doubleBw;
}
- dim += 2 * slavePtr->pady;
+ dim += 2 * panePtr->pady;
if (dim > reqHeight) {
reqHeight = dim;
}
} else {
/*
- * If the slave has an explicit width set use that; otherwise, use
- * the slave's requested width.
+ * If the pane has an explicit width set use that; otherwise, use
+ * the pane's requested width.
*/
- if (slavePtr->width > 0) {
- dim = slavePtr->width;
+ if (panePtr->width > 0) {
+ dim = panePtr->width;
} else {
- doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width;
- dim = Tk_ReqWidth(slavePtr->tkwin) + doubleBw;
+ doubleBw = 2 * Tk_Changes(panePtr->tkwin)->border_width;
+ dim = Tk_ReqWidth(panePtr->tkwin) + doubleBw;
}
- dim += 2 * slavePtr->padx;
+ dim += 2 * panePtr->padx;
if (dim > reqWidth) {
reqWidth = dim;
}
@@ -2327,7 +2323,7 @@ ComputeGeometry(
* 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
+ * panes, 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;
@@ -2373,10 +2369,8 @@ ComputeGeometry(
static void
DestroyOptionTables(
ClientData clientData, /* Pointer to the OptionTables struct */
- Tcl_Interp *dummy) /* Pointer to the calling interp */
+ TCL_UNUSED(Tcl_Interp *)) /* Pointer to the calling interp */
{
- (void)dummy;
-
ckfree(clientData);
}
@@ -2399,8 +2393,8 @@ DestroyOptionTables(
static Tcl_Obj *
GetSticky(
- ClientData dummy,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *recordPtr, /* Pointer to widget record. */
TkSizeT internalOffset) /* Offset within *recordPtr containing the
* sticky value. */
@@ -2408,8 +2402,6 @@ GetSticky(
int sticky = *(int *)(recordPtr + internalOffset);
char buffer[5];
char *p = &buffer[0];
- (void)dummy;
- (void)tkwin;
if (sticky & STICK_NORTH) {
*p++ = 'n';
@@ -2449,9 +2441,9 @@ GetSticky(
static int
SetSticky(
- ClientData dummy,
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interp; may be used for errors. */
- Tk_Window tkwin, /* Window for which option is being set. */
+ TCL_UNUSED(Tk_Window), /* 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). */
@@ -2465,8 +2457,6 @@ SetSticky(
char c;
void *internalPtr;
const char *string;
- (void)dummy;
- (void)tkwin;
internalPtr = ComputeSlotAddress(recordPtr, internalOffset);
@@ -2531,14 +2521,11 @@ SetSticky(
static void
RestoreSticky(
- ClientData dummy,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *internalPtr, /* Pointer to storage for value. */
char *oldInternalPtr) /* Pointer to old value. */
{
- (void)dummy;
- (void)tkwin;
-
*(int *)internalPtr = *(int *)oldInternalPtr;
}
@@ -2548,11 +2535,11 @@ RestoreSticky(
* 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.
+ * of that pane, and the dimensions of a pane, compute the x,y coords
+ * and actual dimensions of the pane based on the pane's sticky value.
*
* Results:
- * No direct return; sets the x, y, slaveWidth and slaveHeight to correct
+ * No direct return; sets the x, y, paneWidth and paneHeight to correct
* values.
*
* Side effects:
@@ -2569,26 +2556,26 @@ AdjustForSticky(
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. */
+ * actual x, y coords of pane. */
+ int *paneWidthPtr, /* Pane width. */
+ int *paneHeightPtr) /* Pane height. */
{
- int diffx = 0; /* Cavity width - slave width. */
- int diffy = 0; /* Cavity hight - slave height. */
+ int diffx = 0; /* Cavity width - pane width. */
+ int diffy = 0; /* Cavity hight - pane height. */
- if (cavityWidth > *slaveWidthPtr) {
- diffx = cavityWidth - *slaveWidthPtr;
+ if (cavityWidth > *paneWidthPtr) {
+ diffx = cavityWidth - *paneWidthPtr;
}
- if (cavityHeight > *slaveHeightPtr) {
- diffy = cavityHeight - *slaveHeightPtr;
+ if (cavityHeight > *paneHeightPtr) {
+ diffy = cavityHeight - *paneHeightPtr;
}
if ((sticky & STICK_EAST) && (sticky & STICK_WEST)) {
- *slaveWidthPtr += diffx;
+ *paneWidthPtr += diffx;
}
if ((sticky & STICK_NORTH) && (sticky & STICK_SOUTH)) {
- *slaveHeightPtr += diffy;
+ *paneHeightPtr += diffy;
}
if (!(sticky & STICK_WEST)) {
*xPtr += (sticky & STICK_EAST) ? diffx : diffx/2;
@@ -2621,8 +2608,8 @@ MoveSash(
int diff)
{
int i;
- int expandPane, reduceFirst, reduceLast, reduceIncr, slaveSize, sashOffset;
- Slave *slavePtr;
+ int expandPane, reduceFirst, reduceLast, reduceIncr, paneSize, sashOffset;
+ Pane *panePtr;
int stretchReserve = 0;
int nextSash = sash + 1;
const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL);
@@ -2631,7 +2618,7 @@ MoveSash(
return;
/*
- * Update the slave sizes with their real sizes.
+ * Update the pane sizes with their real sizes.
*/
if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) {
@@ -2640,17 +2627,17 @@ MoveSash(
} else {
sashOffset = pwPtr->sashPad;
}
- for (i = 0; i < pwPtr->numSlaves; i++) {
- slavePtr = pwPtr->slaves[i];
- if (slavePtr->hide) {
+ for (i = 0; i < pwPtr->numPanes; i++) {
+ panePtr = pwPtr->panes[i];
+ if (panePtr->hide) {
continue;
}
if (horizontal) {
- slavePtr->paneWidth = slavePtr->width = slavePtr->sashx
- - sashOffset - slavePtr->x - (2 * slavePtr->padx);
+ panePtr->paneWidth = panePtr->width = panePtr->sashx
+ - sashOffset - panePtr->x - (2 * panePtr->padx);
} else {
- slavePtr->paneHeight = slavePtr->height = slavePtr->sashy
- - sashOffset - slavePtr->y - (2 * slavePtr->pady);
+ panePtr->paneHeight = panePtr->height = panePtr->sashy
+ - sashOffset - panePtr->y - (2 * panePtr->pady);
}
}
@@ -2660,7 +2647,7 @@ MoveSash(
* pane to either side of the sash.
*/
- while (nextSash < pwPtr->numSlaves-1 && pwPtr->slaves[nextSash]->hide) {
+ while (nextSash < pwPtr->numPanes-1 && pwPtr->panes[nextSash]->hide) {
nextSash++;
}
@@ -2671,7 +2658,7 @@ MoveSash(
if (diff > 0) {
expandPane = sash;
reduceFirst = nextSash;
- reduceLast = pwPtr->numSlaves;
+ reduceLast = pwPtr->numPanes;
reduceIncr = 1;
} else {
diff = abs(diff);
@@ -2687,14 +2674,14 @@ MoveSash(
*/
for (i = reduceFirst; i != reduceLast; i += reduceIncr) {
- slavePtr = pwPtr->slaves[i];
- if (slavePtr->hide) {
+ panePtr = pwPtr->panes[i];
+ if (panePtr->hide) {
continue;
}
if (horizontal) {
- stretchReserve += slavePtr->width - slavePtr->minSize;
+ stretchReserve += panePtr->width - panePtr->minSize;
} else {
- stretchReserve += slavePtr->height - slavePtr->minSize;
+ stretchReserve += panePtr->height - panePtr->minSize;
}
}
if (stretchReserve <= 0) {
@@ -2708,11 +2695,11 @@ MoveSash(
* Expand pane by diff amount.
*/
- slavePtr = pwPtr->slaves[expandPane];
+ panePtr = pwPtr->panes[expandPane];
if (horizontal) {
- slavePtr->paneWidth = slavePtr->width += diff;
+ panePtr->paneWidth = panePtr->width += diff;
} else {
- slavePtr->paneHeight = slavePtr->height += diff;
+ panePtr->paneHeight = panePtr->height += diff;
}
/*
@@ -2720,26 +2707,26 @@ MoveSash(
*/
for (i = reduceFirst; i != reduceLast; i += reduceIncr) {
- slavePtr = pwPtr->slaves[i];
- if (slavePtr->hide) {
+ panePtr = pwPtr->panes[i];
+ if (panePtr->hide) {
continue;
}
if (horizontal) {
- slaveSize = slavePtr->width;
+ paneSize = panePtr->width;
} else {
- slaveSize = slavePtr->height;
+ paneSize = panePtr->height;
}
- if (diff > (slaveSize - slavePtr->minSize)) {
- diff -= slaveSize - slavePtr->minSize;
- slaveSize = slavePtr->minSize;
+ if (diff > (paneSize - panePtr->minSize)) {
+ diff -= paneSize - panePtr->minSize;
+ paneSize = panePtr->minSize;
} else {
- slaveSize -= diff;
+ paneSize -= diff;
i = reduceLast - reduceIncr;
}
if (horizontal) {
- slavePtr->paneWidth = slavePtr->width = slaveSize;
+ panePtr->paneWidth = panePtr->width = paneSize;
} else {
- slavePtr->paneHeight = slavePtr->height = slaveSize;
+ panePtr->paneHeight = panePtr->height = paneSize;
}
}
}
@@ -2962,9 +2949,9 @@ PanedWindowProxyCommand(
/*
* 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
+ * panes, 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
+ * the highest pane, but it's much easier to just force it all the
* way to the top of the stacking order.
*/
@@ -3114,12 +3101,12 @@ PanedWindowIdentifyCoords(
GetFirstLastVisiblePane(pwPtr, &first, &last);
isHandle = 0;
found = -1;
- for (i = 0; i < pwPtr->numSlaves - 1; i++) {
- if (pwPtr->slaves[i]->hide || i == last) {
+ for (i = 0; i < pwPtr->numPanes - 1; i++) {
+ if (pwPtr->panes[i]->hide || i == last) {
continue;
}
- thisx = pwPtr->slaves[i]->sashx;
- thisy = pwPtr->slaves[i]->sashy;
+ thisx = pwPtr->panes[i]->sashx;
+ thisy = pwPtr->panes[i]->sashy;
if (((thisx - lpad) <= x && x <= (thisx + rpad + sashWidth)) &&
((thisy - tpad) <= y && y <= (thisy + bpad + sashHeight))) {
@@ -3130,8 +3117,8 @@ PanedWindowIdentifyCoords(
*/
if (pwPtr->showHandle) {
- thisx = pwPtr->slaves[i]->handlex;
- thisy = pwPtr->slaves[i]->handley;
+ thisx = pwPtr->panes[i]->handlex;
+ thisy = pwPtr->panes[i]->handley;
if (pwPtr->orient == ORIENT_HORIZONTAL) {
if (thisy <= y && y <= (thisy + pwPtr->handleSize)) {
isHandle = 1;
diff --git a/generic/tkPkgConfig.c b/generic/tkPkgConfig.c
index a3666d4..d9e5981 100644
--- a/generic/tkPkgConfig.c
+++ b/generic/tkPkgConfig.c
@@ -4,8 +4,8 @@
* This file contains the configuration information to embed into the tcl
* binary library.
*
- * Copyright (c) 2002 Andreas Kupries <andreas_kupries@users.sourceforge.net>
- * Copyright (c) 2017 Stuart Cassoff <stwo@users.sourceforge.net>
+ * Copyright © 2002 Andreas Kupries <andreas_kupries@users.sourceforge.net>
+ * Copyright © 2017 Stuart Cassoff <stwo@users.sourceforge.net>
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -40,7 +40,7 @@
#ifndef TCL_CFGVAL_ENCODING
-#define TCL_CFGVAL_ENCODING "ascii"
+#define TCL_CFGVAL_ENCODING "utf-8"
#endif
/*
@@ -84,7 +84,7 @@
# define CFG_PROFILED "0"
#endif
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32)
# define CFG_FONTSYSTEM "gdi"
#elif defined(MAC_OSX_TK)
# define CFG_FONTSYSTEM "cocoa"
@@ -100,6 +100,9 @@ static const Tcl_Config cfg[] = {
{"profiled", CFG_PROFILED},
{"64bit", CFG_64},
{"optimized", CFG_OPTIMIZED},
+#ifdef TK_NO_DEPRECATED
+ {"nodeprecated", "1"},
+#endif
{"mem_debug", CFG_MEMDEBUG},
{"fontsystem", CFG_FONTSYSTEM},
diff --git a/generic/tkPlace.c b/generic/tkPlace.c
index 2b5ab2d..8e26c71 100644
--- a/generic/tkPlace.c
+++ b/generic/tkPlace.c
@@ -4,8 +4,8 @@
* 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.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -17,10 +17,10 @@
* Border modes for relative placement:
*
* BM_INSIDE: relative distances computed using area inside all
- * borders of master window.
+ * borders of container 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
+ * includes all borders of container.
+ * BM_IGNORE: border issues are ignored: place relative to container's
* actual window size.
*/
@@ -35,16 +35,16 @@ typedef enum {BM_INSIDE, BM_OUTSIDE, BM_IGNORE} BorderMode;
* structure of the following type:
*/
-typedef struct Slave {
+typedef struct Content {
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
+ struct Container *containerPtr; /* 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
+ * NULL means the container was deleted or never
* assigned. */
- struct Slave *nextPtr; /* Next in list of windows placed relative to
- * same master (NULL for end of list). */
+ struct Content *nextPtr; /* Next in list of windows placed relative to
+ * same container (NULL for end of list). */
Tk_OptionTable optionTable; /* Table that defines configuration options
* available for this command. */
/*
@@ -57,22 +57,22 @@ typedef struct Slave {
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. */
+ * container. */
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. */
double relWidth, relHeight; /* Dimensions for tkwin relative to size of
- * master. */
+ * container. */
Tcl_Obj *relWidthPtr;
Tcl_Obj *relHeightPtr;
Tk_Anchor anchor; /* Which point on tkwin is placed at the given
* position. */
- BorderMode borderMode; /* How to treat borders of master window. */
+ BorderMode borderMode; /* How to treat borders of container window. */
int flags; /* Various flags; see below for bit
* definitions. */
-} Slave;
+} Content;
/*
* Type masks for options:
@@ -82,34 +82,34 @@ typedef struct Slave {
static const Tk_OptionSpec optionSpecs[] = {
{TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", TCL_INDEX_NONE,
- offsetof(Slave, anchor), 0, 0, 0},
+ offsetof(Content, anchor), 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", TCL_INDEX_NONE,
- offsetof(Slave, borderMode), 0, borderModeStrings, 0},
- {TK_OPTION_PIXELS, "-height", NULL, NULL, "", offsetof(Slave, heightPtr),
- offsetof(Slave, height), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_WINDOW, "-in", NULL, NULL, "", TCL_INDEX_NONE, offsetof(Slave, inTkwin),
+ offsetof(Content, borderMode), 0, borderModeStrings, 0},
+ {TK_OPTION_PIXELS, "-height", NULL, NULL, "", offsetof(Content, heightPtr),
+ offsetof(Content, height), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_WINDOW, "-in", NULL, NULL, "", TCL_INDEX_NONE, offsetof(Content, inTkwin),
0, 0, IN_MASK},
{TK_OPTION_DOUBLE, "-relheight", NULL, NULL, "",
- offsetof(Slave, relHeightPtr), offsetof(Slave, relHeight),
+ offsetof(Content, relHeightPtr), offsetof(Content, relHeight),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_DOUBLE, "-relwidth", NULL, NULL, "",
- offsetof(Slave, relWidthPtr), offsetof(Slave, relWidth),
+ offsetof(Content, relWidthPtr), offsetof(Content, relWidth),
TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_DOUBLE, "-relx", NULL, NULL, "0", TCL_INDEX_NONE,
- offsetof(Slave, relX), 0, 0, 0},
+ offsetof(Content, relX), 0, 0, 0},
{TK_OPTION_DOUBLE, "-rely", NULL, NULL, "0", TCL_INDEX_NONE,
- offsetof(Slave, relY), 0, 0, 0},
- {TK_OPTION_PIXELS, "-width", NULL, NULL, "", offsetof(Slave, widthPtr),
- offsetof(Slave, width), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", offsetof(Slave, xPtr),
- offsetof(Slave, x), TK_OPTION_NULL_OK, 0, 0},
- {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", offsetof(Slave, yPtr),
- offsetof(Slave, y), TK_OPTION_NULL_OK, 0, 0},
+ offsetof(Content, relY), 0, 0, 0},
+ {TK_OPTION_PIXELS, "-width", NULL, NULL, "", offsetof(Content, widthPtr),
+ offsetof(Content, width), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", offsetof(Content, xPtr),
+ offsetof(Content, x), TK_OPTION_NULL_OK, 0, 0},
+ {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", offsetof(Content, yPtr),
+ offsetof(Content, y), TK_OPTION_NULL_OK, 0, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0, 0, 0}
};
/*
- * Flag definitions for Slave structures:
+ * Flag definitions for Content structures:
*
* CHILD_WIDTH - 1 means -width was specified;
* CHILD_REL_WIDTH - 1 means -relwidth was specified.
@@ -123,25 +123,25 @@ static const Tk_OptionSpec optionSpecs[] = {
#define CHILD_REL_HEIGHT 8
/*
- * For each master window that has a slave managed by the placer there is a
+ * For each container window that has a content 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. */
+typedef struct Container {
+ Tk_Window tkwin; /* Tk's token for container window. */
+ struct Content *contentPtr; /* First in linked list of content windowslaced
+ * relative to this container. */
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
* abort that nested call. This happens, for
- * example, if tkwin or any of its slaves
+ * example, if tkwin or any of its content
* is deleted. */
int flags; /* See below for bit definitions. */
-} Master;
+} Container;
/*
- * Flag definitions for masters:
+ * Flag definitions for containers:
*
* PARENT_RECONFIG_PENDING - 1 means that a call to RecomputePlacement is
* already pending via a Do_When_Idle handler.
@@ -155,34 +155,34 @@ typedef struct Master {
static void PlaceRequestProc(ClientData clientData,
Tk_Window tkwin);
-static void PlaceLostSlaveProc(ClientData clientData,
+static void PlaceLostContentProc(ClientData clientData,
Tk_Window tkwin);
static const Tk_GeomMgr placerType = {
"place", /* name */
PlaceRequestProc, /* requestProc */
- PlaceLostSlaveProc, /* lostSlaveProc */
+ PlaceLostContentProc, /* lostContentProc */
};
/*
* Forward declarations for functions defined later in this file:
*/
-static void SlaveStructureProc(ClientData clientData,
+static void ContentStructureProc(ClientData clientData,
XEvent *eventPtr);
-static int ConfigureSlave(Tcl_Interp *interp, Tk_Window tkwin,
+static int ConfigureContent(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,
+static Content * CreateContent(Tk_Window tkwin, Tk_OptionTable table);
+static void FreeContent(Content *contentPtr);
+static Content * FindContent(Tk_Window tkwin);
+static Container * CreateContainer(Tk_Window tkwin);
+static Container * FindContainer(Tk_Window tkwin);
+static void PlaceStructureProc(ClientData clientData,
XEvent *eventPtr);
static void RecomputePlacement(ClientData clientData);
-static void UnlinkSlave(Slave *slavePtr);
+static void UnlinkContent(Content *contentPtr);
/*
*--------------------------------------------------------------
@@ -210,13 +210,16 @@ Tk_PlaceObjCmd(
{
Tk_Window main_win = (Tk_Window)clientData;
Tk_Window tkwin;
- Slave *slavePtr;
+ Content *contentPtr;
TkDisplay *dispPtr;
Tk_OptionTable optionTable;
static const char *const optionStrings[] = {
- "configure", "forget", "info", "slaves", NULL
+ "configure", "content", "forget", "info", "slaves", NULL
};
- enum options { PLACE_CONFIGURE, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES };
+ static const char *const optionStringsNoDep[] = {
+ "configure", "content", "forget", "info", NULL
+ };
+ enum options { PLACE_CONFIGURE, PLACE_CONTENT, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES };
int index;
if (objc < 3) {
@@ -247,12 +250,12 @@ Tk_PlaceObjCmd(
dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (!dispPtr->placeInit) {
- Tcl_InitHashTable(&dispPtr->masterTable, TCL_ONE_WORD_KEYS);
- Tcl_InitHashTable(&dispPtr->slaveTable, TCL_ONE_WORD_KEYS);
+ Tcl_InitHashTable(&dispPtr->containerTable, TCL_ONE_WORD_KEYS);
+ Tcl_InitHashTable(&dispPtr->contentTable, TCL_ONE_WORD_KEYS);
dispPtr->placeInit = 1;
}
- return ConfigureSlave(interp, tkwin, optionTable, objc-2, objv+2);
+ return ConfigureContent(interp, tkwin, optionTable, objc-2, objv+2);
}
/*
@@ -271,13 +274,21 @@ Tk_PlaceObjCmd(
dispPtr = ((TkWindow *) tkwin)->dispPtr;
if (!dispPtr->placeInit) {
- Tcl_InitHashTable(&dispPtr->masterTable, TCL_ONE_WORD_KEYS);
- Tcl_InitHashTable(&dispPtr->slaveTable, TCL_ONE_WORD_KEYS);
+ Tcl_InitHashTable(&dispPtr->containerTable, TCL_ONE_WORD_KEYS);
+ Tcl_InitHashTable(&dispPtr->contentTable, TCL_ONE_WORD_KEYS);
dispPtr->placeInit = 1;
}
if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
sizeof(char *), "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
+ * deprecated and new options.
+ */
+
+ Tcl_GetIndexFromObjStruct(interp, objv[1], optionStringsNoDep,
+ sizeof(char *), "option", 0, &index);
return TCL_ERROR;
}
@@ -286,11 +297,11 @@ Tk_PlaceObjCmd(
if (objc == 3 || objc == 4) {
Tcl_Obj *objPtr;
- slavePtr = FindSlave(tkwin);
- if (slavePtr == NULL) {
+ contentPtr = FindContent(tkwin);
+ if (contentPtr == NULL) {
return TCL_OK;
}
- objPtr = Tk_GetOptionInfo(interp, slavePtr, optionTable,
+ objPtr = Tk_GetOptionInfo(interp, contentPtr, optionTable,
(objc == 4) ? objv[3] : NULL, tkwin);
if (objPtr == NULL) {
return TCL_ERROR;
@@ -298,29 +309,29 @@ Tk_PlaceObjCmd(
Tcl_SetObjResult(interp, objPtr);
return TCL_OK;
}
- return ConfigureSlave(interp, tkwin, optionTable, objc-3, objv+3);
+ return ConfigureContent(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) {
+ contentPtr = FindContent(tkwin);
+ if (contentPtr == NULL) {
return TCL_OK;
}
- if ((slavePtr->masterPtr != NULL) &&
- (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if ((contentPtr->containerPtr != NULL) &&
+ (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin))) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
- UnlinkSlave(slavePtr);
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
+ UnlinkContent(contentPtr);
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->contentTable,
tkwin));
- Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
- slavePtr);
+ Tk_DeleteEventHandler(tkwin, StructureNotifyMask, ContentStructureProc,
+ contentPtr);
Tk_ManageGeometry(tkwin, NULL, NULL);
Tk_UnmapWindow(tkwin);
- FreeSlave(slavePtr);
+ FreeContent(contentPtr);
break;
case PLACE_INFO:
@@ -330,21 +341,22 @@ Tk_PlaceObjCmd(
}
return PlaceInfoCommand(interp, tkwin);
- case PLACE_SLAVES: {
- Master *masterPtr;
+ case PLACE_SLAVES:
+ case PLACE_CONTENT: {
+ Container *containerPtr;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "pathName");
return TCL_ERROR;
}
- masterPtr = FindMaster(tkwin);
- if (masterPtr != NULL) {
+ containerPtr = FindContainer(tkwin);
+ if (containerPtr != NULL) {
Tcl_Obj *listPtr = Tcl_NewObj();
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
Tcl_ListObjAppendElement(NULL, listPtr,
- TkNewWindowObj(slavePtr->tkwin));
+ Tk_NewWindowObj(contentPtr->tkwin));
}
Tcl_SetObjResult(interp, listPtr);
}
@@ -358,59 +370,59 @@ Tk_PlaceObjCmd(
/*
*----------------------------------------------------------------------
*
- * CreateSlave --
+ * CreateContent --
*
- * Given a Tk_Window token, find the Slave structure corresponding to
+ * Given a Tk_Window token, find the Content structure corresponding to
* that token, creating a new one if necessary.
*
* Results:
- * Pointer to the Slave structure.
+ * Pointer to the Content structure.
*
* Side effects:
- * A new Slave structure may be created.
+ * A new Content structure may be created.
*
*----------------------------------------------------------------------
*/
-static Slave *
-CreateSlave(
- Tk_Window tkwin, /* Token for desired slave. */
+static Content *
+CreateContent(
+ Tk_Window tkwin, /* Token for desired content. */
Tk_OptionTable table)
{
Tcl_HashEntry *hPtr;
- Slave *slavePtr;
+ Content *contentPtr;
int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_CreateHashEntry(&dispPtr->slaveTable, (char *) tkwin, &isNew);
+ hPtr = Tcl_CreateHashEntry(&dispPtr->contentTable, (char *) tkwin, &isNew);
if (!isNew) {
- return (Slave *)Tcl_GetHashValue(hPtr);
+ return (Content *)Tcl_GetHashValue(hPtr);
}
/*
- * No preexisting slave structure for that window, so make a new one and
+ * No preexisting content 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 = NULL;
- slavePtr->anchor = TK_ANCHOR_NW;
- slavePtr->borderMode = BM_INSIDE;
- slavePtr->optionTable = table;
- Tcl_SetHashValue(hPtr, slavePtr);
- Tk_CreateEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
- slavePtr);
- return slavePtr;
+ contentPtr = (Content *)ckalloc(sizeof(Content));
+ memset(contentPtr, 0, sizeof(Content));
+ contentPtr->tkwin = tkwin;
+ contentPtr->inTkwin = NULL;
+ contentPtr->anchor = TK_ANCHOR_NW;
+ contentPtr->borderMode = BM_INSIDE;
+ contentPtr->optionTable = table;
+ Tcl_SetHashValue(hPtr, contentPtr);
+ Tk_CreateEventHandler(tkwin, StructureNotifyMask, ContentStructureProc,
+ contentPtr);
+ return contentPtr;
}
/*
*----------------------------------------------------------------------
*
- * FreeSlave --
+ * FreeContent --
*
- * Frees the resources held by a Slave structure.
+ * Frees the resources held by a Content structure.
*
* Results:
* None
@@ -422,25 +434,25 @@ CreateSlave(
*/
static void
-FreeSlave(
- Slave *slavePtr)
+FreeContent(
+ Content *contentPtr)
{
- Tk_FreeConfigOptions((char *) slavePtr, slavePtr->optionTable,
- slavePtr->tkwin);
- ckfree(slavePtr);
+ Tk_FreeConfigOptions((char *) contentPtr, contentPtr->optionTable,
+ contentPtr->tkwin);
+ ckfree(contentPtr);
}
/*
*----------------------------------------------------------------------
*
- * FindSlave --
+ * FindContent --
*
- * Given a Tk_Window token, find the Slave structure corresponding to
+ * Given a Tk_Window token, find the Content 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.
+ * Pointer to Content structure; NULL if none exists.
*
* Side effects:
* None.
@@ -448,121 +460,121 @@ FreeSlave(
*----------------------------------------------------------------------
*/
-static Slave *
-FindSlave(
- Tk_Window tkwin) /* Token for desired slave. */
+static Content *
+FindContent(
+ Tk_Window tkwin) /* Token for desired content. */
{
Tcl_HashEntry *hPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_FindHashEntry(&dispPtr->slaveTable, tkwin);
+ hPtr = Tcl_FindHashEntry(&dispPtr->contentTable, tkwin);
if (hPtr == NULL) {
return NULL;
}
- return (Slave *)Tcl_GetHashValue(hPtr);
+ return (Content *)Tcl_GetHashValue(hPtr);
}
/*
*----------------------------------------------------------------------
*
- * UnlinkSlave --
+ * UnlinkContent --
*
- * This function removes a slave window from the chain of slaves in its
- * master.
+ * This function removes a content window from the chain of content windows in its
+ * container.
*
* Results:
* None.
*
* Side effects:
- * The slave list of slavePtr's master changes.
+ * The content list of contentPtr's container changes.
*
*----------------------------------------------------------------------
*/
static void
-UnlinkSlave(
- Slave *slavePtr) /* Slave structure to be unlinked. */
+UnlinkContent(
+ Content *contentPtr) /* Content structure to be unlinked. */
{
- Master *masterPtr;
- Slave *prevPtr;
+ Container *containerPtr;
+ Content *prevPtr;
- masterPtr = slavePtr->masterPtr;
- if (masterPtr == NULL) {
+ containerPtr = contentPtr->containerPtr;
+ if (containerPtr == NULL) {
return;
}
- if (masterPtr->slavePtr == slavePtr) {
- masterPtr->slavePtr = slavePtr->nextPtr;
+ if (containerPtr->contentPtr == contentPtr) {
+ containerPtr->contentPtr = contentPtr->nextPtr;
} else {
- for (prevPtr = masterPtr->slavePtr; ; prevPtr = prevPtr->nextPtr) {
+ for (prevPtr = containerPtr->contentPtr; ; prevPtr = prevPtr->nextPtr) {
if (prevPtr == NULL) {
- Tcl_Panic("UnlinkSlave couldn't find slave to unlink");
+ Tcl_Panic("UnlinkContent couldn't find content to unlink");
}
- if (prevPtr->nextPtr == slavePtr) {
- prevPtr->nextPtr = slavePtr->nextPtr;
+ if (prevPtr->nextPtr == contentPtr) {
+ prevPtr->nextPtr = contentPtr->nextPtr;
break;
}
}
}
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- slavePtr->masterPtr = NULL;
+ contentPtr->containerPtr = NULL;
}
/*
*----------------------------------------------------------------------
*
- * CreateMaster --
+ * CreateContainer --
*
- * Given a Tk_Window token, find the Master structure corresponding to
+ * Given a Tk_Window token, find the Container structure corresponding to
* that token, creating a new one if necessary.
*
* Results:
- * Pointer to the Master structure.
+ * Pointer to the Container structure.
*
* Side effects:
- * A new Master structure may be created.
+ * A new Container structure may be created.
*
*----------------------------------------------------------------------
*/
-static Master *
-CreateMaster(
- Tk_Window tkwin) /* Token for desired master. */
+static Container *
+CreateContainer(
+ Tk_Window tkwin) /* Token for desired container. */
{
Tcl_HashEntry *hPtr;
- Master *masterPtr;
+ Container *containerPtr;
int isNew;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *) tkwin, &isNew);
+ hPtr = Tcl_CreateHashEntry(&dispPtr->containerTable, (char *)tkwin, &isNew);
if (isNew) {
- masterPtr = (Master *)ckalloc(sizeof(Master));
- masterPtr->tkwin = tkwin;
- masterPtr->slavePtr = NULL;
- masterPtr->abortPtr = NULL;
- masterPtr->flags = 0;
- Tcl_SetHashValue(hPtr, masterPtr);
- Tk_CreateEventHandler(masterPtr->tkwin, StructureNotifyMask,
- MasterStructureProc, masterPtr);
+ containerPtr = (Container *)ckalloc(sizeof(Container));
+ containerPtr->tkwin = tkwin;
+ containerPtr->contentPtr = NULL;
+ containerPtr->abortPtr = NULL;
+ containerPtr->flags = 0;
+ Tcl_SetHashValue(hPtr, containerPtr);
+ Tk_CreateEventHandler(containerPtr->tkwin, StructureNotifyMask,
+ PlaceStructureProc, containerPtr);
} else {
- masterPtr = (Master *)Tcl_GetHashValue(hPtr);
+ containerPtr = (Container *)Tcl_GetHashValue(hPtr);
}
- return masterPtr;
+ return containerPtr;
}
/*
*----------------------------------------------------------------------
*
- * FindMaster --
+ * FindContainer --
*
- * Given a Tk_Window token, find the Master structure corresponding to
+ * Given a Tk_Window token, find the Container 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
+ * Pointer to the Container structure; NULL if one does not exist for the
* given Tk_Window token.
*
* Side effects:
@@ -571,24 +583,24 @@ CreateMaster(
*----------------------------------------------------------------------
*/
-static Master *
-FindMaster(
- Tk_Window tkwin) /* Token for desired master. */
+static Container *
+FindContainer(
+ Tk_Window tkwin) /* Token for desired container. */
{
Tcl_HashEntry *hPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
- hPtr = Tcl_FindHashEntry(&dispPtr->masterTable, tkwin);
+ hPtr = Tcl_FindHashEntry(&dispPtr->containerTable, tkwin);
if (hPtr == NULL) {
return NULL;
}
- return (Master *)Tcl_GetHashValue(hPtr);
+ return (Container *)Tcl_GetHashValue(hPtr);
}
/*
*----------------------------------------------------------------------
*
- * ConfigureSlave --
+ * ConfigureContent --
*
* This function is called to process an argv/argc list to reconfigure
* the placement of a window.
@@ -598,26 +610,26 @@ FindMaster(
* the interp's result.
*
* Side effects:
- * Information in slavePtr may change, and slavePtr's master is scheduled
+ * Information in contentPtr may change, and contentPtr's container is scheduled
* for reconfiguration.
*
*----------------------------------------------------------------------
*/
static int
-ConfigureSlave(
+ConfigureContent(
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. */
{
- Master *masterPtr;
+ Container *containerPtr;
Tk_SavedOptions savedOptions;
int mask;
- Slave *slavePtr;
- Tk_Window masterWin = NULL;
- TkWindow *master;
+ Content *contentPtr;
+ Tk_Window containerWin = NULL;
+ TkWindow *container;
if (Tk_TopWinHierarchy(tkwin)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -627,71 +639,71 @@ ConfigureSlave(
return TCL_ERROR;
}
- slavePtr = CreateSlave(tkwin, table);
+ contentPtr = CreateContent(tkwin, table);
- if (Tk_SetOptions(interp, slavePtr, table, objc, objv,
- slavePtr->tkwin, &savedOptions, &mask) != TCL_OK) {
+ if (Tk_SetOptions(interp, contentPtr, table, objc, objv,
+ contentPtr->tkwin, &savedOptions, &mask) != TCL_OK) {
goto error;
}
/*
- * Set slave flags. First clear the field, then add bits as needed.
+ * Set content flags. First clear the field, then add bits as needed.
*/
- slavePtr->flags = 0;
- if (slavePtr->heightPtr) {
- slavePtr->flags |= CHILD_HEIGHT;
+ contentPtr->flags = 0;
+ if (contentPtr->heightPtr) {
+ contentPtr->flags |= CHILD_HEIGHT;
}
- if (slavePtr->relHeightPtr) {
- slavePtr->flags |= CHILD_REL_HEIGHT;
+ if (contentPtr->relHeightPtr) {
+ contentPtr->flags |= CHILD_REL_HEIGHT;
}
- if (slavePtr->relWidthPtr) {
- slavePtr->flags |= CHILD_REL_WIDTH;
+ if (contentPtr->relWidthPtr) {
+ contentPtr->flags |= CHILD_REL_WIDTH;
}
- if (slavePtr->widthPtr) {
- slavePtr->flags |= CHILD_WIDTH;
+ if (contentPtr->widthPtr) {
+ contentPtr->flags |= CHILD_WIDTH;
}
- if (!(mask & IN_MASK) && (slavePtr->masterPtr != NULL)) {
+ if (!(mask & IN_MASK) && (contentPtr->containerPtr != NULL)) {
/*
- * If no -in option was passed and the slave is already placed then
+ * If no -in option was passed and the content is already placed then
* just recompute the placement.
*/
- masterPtr = slavePtr->masterPtr;
+ containerPtr = contentPtr->containerPtr;
goto scheduleLayout;
} else if (mask & IN_MASK) {
/* -in changed */
- Tk_Window tkwin;
+ Tk_Window win;
Tk_Window ancestor;
- tkwin = slavePtr->inTkwin;
+ win = contentPtr->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
+ * Make sure that the new container is either the logical parent of the
+ * content window or a descendant of that window, and that the container and content
* aren't the same.
*/
- for (ancestor = tkwin; ; ancestor = Tk_Parent(ancestor)) {
- if (ancestor == Tk_Parent(slavePtr->tkwin)) {
+ for (ancestor = win; ; ancestor = Tk_Parent(ancestor)) {
+ if (ancestor == Tk_Parent(contentPtr->tkwin)) {
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't place %s relative to %s",
- Tk_PathName(slavePtr->tkwin), Tk_PathName(tkwin)));
+ "can't place \"%s\" relative to \"%s\"",
+ Tk_PathName(contentPtr->tkwin), Tk_PathName(win)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL);
goto error;
}
}
- if (slavePtr->tkwin == tkwin) {
+ if (contentPtr->tkwin == win) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't place %s relative to itself",
- Tk_PathName(slavePtr->tkwin)));
+ "can't place \"%s\" relative to itself",
+ Tk_PathName(contentPtr->tkwin)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
goto error;
}
@@ -700,66 +712,66 @@ ConfigureSlave(
* Check for management loops.
*/
- for (master = (TkWindow *)tkwin; master != NULL;
- master = (TkWindow *)TkGetGeomMaster(master)) {
- if (master == (TkWindow *)slavePtr->tkwin) {
+ for (container = (TkWindow *)win; container != NULL;
+ container = (TkWindow *)TkGetContainer(container)) {
+ if (container == (TkWindow *)contentPtr->tkwin) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "can't put %s inside %s, would cause management loop",
- Tk_PathName(slavePtr->tkwin), Tk_PathName(tkwin)));
+ "can't put \"%s\" inside \"%s\": would cause management loop",
+ Tk_PathName(contentPtr->tkwin), Tk_PathName(win)));
Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL);
goto error;
}
}
- if (tkwin != Tk_Parent(slavePtr->tkwin)) {
- ((TkWindow *)slavePtr->tkwin)->maintainerPtr = (TkWindow *)tkwin;
+ if (win != Tk_Parent(contentPtr->tkwin)) {
+ ((TkWindow *)contentPtr->tkwin)->maintainerPtr = (TkWindow *)win;
}
- if ((slavePtr->masterPtr != NULL)
- && (slavePtr->masterPtr->tkwin == tkwin)) {
+ if ((contentPtr->containerPtr != NULL)
+ && (contentPtr->containerPtr->tkwin == win)) {
/*
- * Re-using same old master. Nothing to do.
+ * Re-using same old container. Nothing to do.
*/
- masterPtr = slavePtr->masterPtr;
+ containerPtr = contentPtr->containerPtr;
goto scheduleLayout;
}
- if ((slavePtr->masterPtr != NULL) &&
- (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if ((contentPtr->containerPtr != NULL) &&
+ (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin))) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
- UnlinkSlave(slavePtr);
- masterWin = tkwin;
+ UnlinkContent(contentPtr);
+ containerWin = win;
}
/*
- * If there's no master specified for this slave, use its Tk_Parent.
+ * If there's no container specified for this content, use its Tk_Parent.
*/
- if (masterWin == NULL) {
- masterWin = Tk_Parent(slavePtr->tkwin);
- slavePtr->inTkwin = masterWin;
+ if (containerWin == NULL) {
+ containerWin = Tk_Parent(contentPtr->tkwin);
+ contentPtr->inTkwin = containerWin;
}
/*
- * Manage the slave window in this master.
+ * Manage the content window in this container.
*/
- masterPtr = CreateMaster(masterWin);
- slavePtr->masterPtr = masterPtr;
- slavePtr->nextPtr = masterPtr->slavePtr;
- masterPtr->slavePtr = slavePtr;
- Tk_ManageGeometry(slavePtr->tkwin, &placerType, slavePtr);
+ containerPtr = CreateContainer(containerWin);
+ contentPtr->containerPtr = containerPtr;
+ contentPtr->nextPtr = containerPtr->contentPtr;
+ containerPtr->contentPtr = contentPtr;
+ Tk_ManageGeometry(contentPtr->tkwin, &placerType, contentPtr);
/*
- * Arrange for the master to be re-arranged at the first idle moment.
+ * Arrange for the container to be re-arranged at the first idle moment.
*/
scheduleLayout:
Tk_FreeSavedOptions(&savedOptions);
- if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
- masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
+ if (!(containerPtr->flags & PARENT_RECONFIG_PENDING)) {
+ containerPtr->flags |= PARENT_RECONFIG_PENDING;
+ Tcl_DoWhenIdle(RecomputePlacement, containerPtr);
}
return TCL_OK;
@@ -795,49 +807,49 @@ PlaceInfoCommand(
Tcl_Interp *interp, /* Interp into which to place result. */
Tk_Window tkwin) /* Token for the window to get info on. */
{
- Slave *slavePtr;
+ Content *contentPtr;
Tcl_Obj *infoObj;
- slavePtr = FindSlave(tkwin);
- if (slavePtr == NULL) {
+ contentPtr = FindContent(tkwin);
+ if (contentPtr == NULL) {
return TCL_OK;
}
infoObj = Tcl_NewObj();
- if (slavePtr->masterPtr != NULL) {
+ if (contentPtr->containerPtr != NULL) {
Tcl_AppendToObj(infoObj, "-in", -1);
Tcl_ListObjAppendElement(NULL, infoObj,
- TkNewWindowObj(slavePtr->masterPtr->tkwin));
+ Tk_NewWindowObj(contentPtr->containerPtr->tkwin));
Tcl_AppendToObj(infoObj, " ", -1);
}
Tcl_AppendPrintfToObj(infoObj,
"-x %d -relx %.4g -y %d -rely %.4g",
- slavePtr->x, slavePtr->relX, slavePtr->y, slavePtr->relY);
- if (slavePtr->flags & CHILD_WIDTH) {
- Tcl_AppendPrintfToObj(infoObj, " -width %d", slavePtr->width);
+ contentPtr->x, contentPtr->relX, contentPtr->y, contentPtr->relY);
+ if (contentPtr->flags & CHILD_WIDTH) {
+ Tcl_AppendPrintfToObj(infoObj, " -width %d", contentPtr->width);
} else {
Tcl_AppendToObj(infoObj, " -width {}", -1);
}
- if (slavePtr->flags & CHILD_REL_WIDTH) {
+ if (contentPtr->flags & CHILD_REL_WIDTH) {
Tcl_AppendPrintfToObj(infoObj,
- " -relwidth %.4g", slavePtr->relWidth);
+ " -relwidth %.4g", contentPtr->relWidth);
} else {
Tcl_AppendToObj(infoObj, " -relwidth {}", -1);
}
- if (slavePtr->flags & CHILD_HEIGHT) {
- Tcl_AppendPrintfToObj(infoObj, " -height %d", slavePtr->height);
+ if (contentPtr->flags & CHILD_HEIGHT) {
+ Tcl_AppendPrintfToObj(infoObj, " -height %d", contentPtr->height);
} else {
Tcl_AppendToObj(infoObj, " -height {}", -1);
}
- if (slavePtr->flags & CHILD_REL_HEIGHT) {
+ if (contentPtr->flags & CHILD_REL_HEIGHT) {
Tcl_AppendPrintfToObj(infoObj,
- " -relheight %.4g", slavePtr->relHeight);
+ " -relheight %.4g", contentPtr->relHeight);
} else {
Tcl_AppendToObj(infoObj, " -relheight {}", -1);
}
Tcl_AppendPrintfToObj(infoObj, " -anchor %s -bordermode %s",
- Tk_NameOfAnchor(slavePtr->anchor),
- borderModeStrings[slavePtr->borderMode]);
+ Tk_NameOfAnchor(contentPtr->anchor),
+ borderModeStrings[contentPtr->borderMode]);
Tcl_SetObjResult(interp, infoObj);
return TCL_OK;
}
@@ -848,7 +860,7 @@ PlaceInfoCommand(
* RecomputePlacement --
*
* This function is called as a when-idle handler. It recomputes the
- * geometries of all the slaves of a given master.
+ * geometries of all the content of a given container.
*
* Results:
* None.
@@ -861,17 +873,17 @@ PlaceInfoCommand(
static void
RecomputePlacement(
- ClientData clientData) /* Pointer to Master record. */
+ ClientData clientData) /* Pointer to Container record. */
{
- Master *masterPtr = (Master *)clientData;
- Slave *slavePtr;
+ Container *containerPtr = (Container *)clientData;
+ Content *contentPtr;
int x, y, width, height, tmp;
- int masterWidth, masterHeight, masterX, masterY;
+ int containerWidth, containerHeight, containerX, containerY;
double x1, y1, x2, y2;
int abort; /* May get set to non-zero to abort this
* placement operation. */
- masterPtr->flags &= ~PARENT_RECONFIG_PENDING;
+ containerPtr->flags &= ~PARENT_RECONFIG_PENDING;
/*
* Abort any nested call to RecomputePlacement for this window, since
@@ -879,57 +891,57 @@ RecomputePlacement(
* aborted if necessary.
*/
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- masterPtr->abortPtr = &abort;
+ containerPtr->abortPtr = &abort;
abort = 0;
- Tcl_Preserve(masterPtr);
+ Tcl_Preserve(containerPtr);
/*
- * 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
+ * Iterate over all the content windows for the container. Each content's geometry can
+ * be computed independently of the other content. 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) {
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL && !abort;
+ contentPtr = contentPtr->nextPtr) {
/*
- * Step 1: compute size and borderwidth of master, taking into account
+ * Step 1: compute size and borderwidth of container, taking into account
* desired border mode.
*/
- masterX = masterY = 0;
- masterWidth = Tk_Width(masterPtr->tkwin);
- masterHeight = Tk_Height(masterPtr->tkwin);
- if (slavePtr->borderMode == BM_INSIDE) {
- masterX = Tk_InternalBorderLeft(masterPtr->tkwin);
- masterY = Tk_InternalBorderTop(masterPtr->tkwin);
- 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;
+ containerX = containerY = 0;
+ containerWidth = Tk_Width(containerPtr->tkwin);
+ containerHeight = Tk_Height(containerPtr->tkwin);
+ if (contentPtr->borderMode == BM_INSIDE) {
+ containerX = Tk_InternalBorderLeft(containerPtr->tkwin);
+ containerY = Tk_InternalBorderTop(containerPtr->tkwin);
+ containerWidth -= containerX + Tk_InternalBorderRight(containerPtr->tkwin);
+ containerHeight -= containerY +
+ Tk_InternalBorderBottom(containerPtr->tkwin);
+ } else if (contentPtr->borderMode == BM_OUTSIDE) {
+ containerX = containerY = -Tk_Changes(containerPtr->tkwin)->border_width;
+ containerWidth -= 2 * containerX;
+ containerHeight -= 2 * containerY;
}
/*
- * Step 2: compute size of slave (outside dimensions including border)
- * and location of anchor point within master.
+ * Step 2: compute size of content (outside dimensions including border)
+ * and location of anchor point within container.
*/
- x1 = slavePtr->x + masterX + (slavePtr->relX*masterWidth);
+ x1 = contentPtr->x + containerX + (contentPtr->relX*containerWidth);
x = (int) (x1 + ((x1 > 0) ? 0.5 : -0.5));
- y1 = slavePtr->y + masterY + (slavePtr->relY*masterHeight);
+ y1 = contentPtr->y + containerY + (contentPtr->relY*containerHeight);
y = (int) (y1 + ((y1 > 0) ? 0.5 : -0.5));
- if (slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) {
+ if (contentPtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) {
width = 0;
- if (slavePtr->flags & CHILD_WIDTH) {
- width += slavePtr->width;
+ if (contentPtr->flags & CHILD_WIDTH) {
+ width += contentPtr->width;
}
- if (slavePtr->flags & CHILD_REL_WIDTH) {
+ if (contentPtr->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
@@ -938,40 +950,40 @@ RecomputePlacement(
* errors in relX and relWidth accumulate.
*/
- x2 = x1 + (slavePtr->relWidth*masterWidth);
+ x2 = x1 + (contentPtr->relWidth*containerWidth);
tmp = (int) (x2 + ((x2 > 0) ? 0.5 : -0.5));
width += tmp - x;
}
} else {
- width = Tk_ReqWidth(slavePtr->tkwin)
- + 2*Tk_Changes(slavePtr->tkwin)->border_width;
+ width = Tk_ReqWidth(contentPtr->tkwin)
+ + 2*Tk_Changes(contentPtr->tkwin)->border_width;
}
- if (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT)) {
+ if (contentPtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT)) {
height = 0;
- if (slavePtr->flags & CHILD_HEIGHT) {
- height += slavePtr->height;
+ if (contentPtr->flags & CHILD_HEIGHT) {
+ height += contentPtr->height;
}
- if (slavePtr->flags & CHILD_REL_HEIGHT) {
+ if (contentPtr->flags & CHILD_REL_HEIGHT) {
/*
* See note above for rounding errors in width computation.
*/
- y2 = y1 + (slavePtr->relHeight*masterHeight);
+ y2 = y1 + (contentPtr->relHeight*containerHeight);
tmp = (int) (y2 + ((y2 > 0) ? 0.5 : -0.5));
height += tmp - y;
}
} else {
- height = Tk_ReqHeight(slavePtr->tkwin)
- + 2*Tk_Changes(slavePtr->tkwin)->border_width;
+ height = Tk_ReqHeight(contentPtr->tkwin)
+ + 2*Tk_Changes(contentPtr->tkwin)->border_width;
}
/*
* 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.
+ * point on the content appears at that position. Also adjust for the
+ * border mode and container's border.
*/
- switch (slavePtr->anchor) {
+ switch (contentPtr->anchor) {
case TK_ANCHOR_N:
x -= width/2;
break;
@@ -1010,8 +1022,8 @@ RecomputePlacement(
* height aren't zero.
*/
- width -= 2*Tk_Changes(slavePtr->tkwin)->border_width;
- height -= 2*Tk_Changes(slavePtr->tkwin)->border_width;
+ width -= 2*Tk_Changes(contentPtr->tkwin)->border_width;
+ height -= 2*Tk_Changes(contentPtr->tkwin)->border_width;
if (width <= 0) {
width = 1;
}
@@ -1020,121 +1032,121 @@ RecomputePlacement(
}
/*
- * 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
+ * Step 5: reconfigure the window and map it if needed. If the content
+ * is a child of the container, we do this ourselves. If the content isn't
+ * a child of the container, 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)) {
- 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 (containerPtr->tkwin == Tk_Parent(contentPtr->tkwin)) {
+ if ((x != Tk_X(contentPtr->tkwin))
+ || (y != Tk_Y(contentPtr->tkwin))
+ || (width != Tk_Width(contentPtr->tkwin))
+ || (height != Tk_Height(contentPtr->tkwin))) {
+ Tk_MoveResizeWindow(contentPtr->tkwin, x, y, width, height);
}
if (abort) {
break;
}
/*
- * 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 content unless the container is mapped: the content will
+ * get mapped later, when the container is mapped.
*/
- if (Tk_IsMapped(masterPtr->tkwin)) {
- Tk_MapWindow(slavePtr->tkwin);
+ if (Tk_IsMapped(containerPtr->tkwin)) {
+ Tk_MapWindow(contentPtr->tkwin);
}
} else {
if ((width <= 0) || (height <= 0)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, masterPtr->tkwin);
- Tk_UnmapWindow(slavePtr->tkwin);
+ Tk_UnmaintainGeometry(contentPtr->tkwin, containerPtr->tkwin);
+ Tk_UnmapWindow(contentPtr->tkwin);
} else {
- Tk_MaintainGeometry(slavePtr->tkwin, masterPtr->tkwin,
+ Tk_MaintainGeometry(contentPtr->tkwin, containerPtr->tkwin,
x, y, width, height);
}
}
}
- masterPtr->abortPtr = NULL;
- Tcl_Release(masterPtr);
+ containerPtr->abortPtr = NULL;
+ Tcl_Release(containerPtr);
}
/*
*----------------------------------------------------------------------
*
- * MasterStructureProc --
+ * PlaceStructureProc --
*
* This function is invoked by the Tk event handler when StructureNotify
- * events occur for a master window.
+ * events occur for a container window.
*
* Results:
* None.
*
* Side effects:
* Structures get cleaned up if the window was deleted. If the window was
- * resized then slave geometries get recomputed.
+ * resized then content geometries get recomputed.
*
*----------------------------------------------------------------------
*/
static void
-MasterStructureProc(
- ClientData clientData, /* Pointer to Master structure for window
+PlaceStructureProc(
+ ClientData clientData, /* Pointer to Container structure for window
* referred to by eventPtr. */
XEvent *eventPtr) /* Describes what just happened. */
{
- Master *masterPtr = (Master *)clientData;
- Slave *slavePtr, *nextPtr;
- TkDisplay *dispPtr = ((TkWindow *) masterPtr->tkwin)->dispPtr;
+ Container *containerPtr = (Container *)clientData;
+ Content *contentPtr, *nextPtr;
+ TkDisplay *dispPtr = ((TkWindow *) containerPtr->tkwin)->dispPtr;
switch (eventPtr->type) {
case ConfigureNotify:
- if ((masterPtr->slavePtr != NULL)
- && !(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
- masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
+ if ((containerPtr->contentPtr != NULL)
+ && !(containerPtr->flags & PARENT_RECONFIG_PENDING)) {
+ containerPtr->flags |= PARENT_RECONFIG_PENDING;
+ Tcl_DoWhenIdle(RecomputePlacement, containerPtr);
}
return;
case DestroyNotify:
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = nextPtr) {
- slavePtr->masterPtr = NULL;
- nextPtr = slavePtr->nextPtr;
- slavePtr->nextPtr = NULL;
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = nextPtr) {
+ contentPtr->containerPtr = NULL;
+ nextPtr = contentPtr->nextPtr;
+ contentPtr->nextPtr = NULL;
}
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->masterTable,
- masterPtr->tkwin));
- if (masterPtr->flags & PARENT_RECONFIG_PENDING) {
- Tcl_CancelIdleCall(RecomputePlacement, masterPtr);
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->containerTable,
+ containerPtr->tkwin));
+ if (containerPtr->flags & PARENT_RECONFIG_PENDING) {
+ Tcl_CancelIdleCall(RecomputePlacement, containerPtr);
}
- masterPtr->tkwin = NULL;
- if (masterPtr->abortPtr != NULL) {
- *masterPtr->abortPtr = 1;
+ containerPtr->tkwin = NULL;
+ if (containerPtr->abortPtr != NULL) {
+ *containerPtr->abortPtr = 1;
}
- Tcl_EventuallyFree(masterPtr, TCL_DYNAMIC);
+ Tcl_EventuallyFree(containerPtr, TCL_DYNAMIC);
return;
case MapNotify:
/*
- * When a master gets mapped, must redo the geometry computation so
- * that all of its slaves get remapped.
+ * When a container gets mapped, must redo the geometry computation so
+ * that all of its content get remapped.
*/
- if ((masterPtr->slavePtr != NULL)
- && !(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
- masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
+ if ((containerPtr->contentPtr != NULL)
+ && !(containerPtr->flags & PARENT_RECONFIG_PENDING)) {
+ containerPtr->flags |= PARENT_RECONFIG_PENDING;
+ Tcl_DoWhenIdle(RecomputePlacement, containerPtr);
}
return;
case UnmapNotify:
/*
- * Unmap all of the slaves when the master gets unmapped, so that they
+ * Unmap all of the content when the container gets unmapped, so that they
* don't keep redisplaying themselves.
*/
- for (slavePtr = masterPtr->slavePtr; slavePtr != NULL;
- slavePtr = slavePtr->nextPtr) {
- Tk_UnmapWindow(slavePtr->tkwin);
+ for (contentPtr = containerPtr->contentPtr; contentPtr != NULL;
+ contentPtr = contentPtr->nextPtr) {
+ Tk_UnmapWindow(contentPtr->tkwin);
}
return;
}
@@ -1143,10 +1155,10 @@ MasterStructureProc(
/*
*----------------------------------------------------------------------
*
- * SlaveStructureProc --
+ * ContentStructureProc --
*
* This function is invoked by the Tk event handler when StructureNotify
- * events occur for a slave window.
+ * events occur for a content window.
*
* Results:
* None.
@@ -1158,21 +1170,21 @@ MasterStructureProc(
*/
static void
-SlaveStructureProc(
- ClientData clientData, /* Pointer to Slave structure for window
+ContentStructureProc(
+ ClientData clientData, /* Pointer to Content structure for window
* referred to by eventPtr. */
XEvent *eventPtr) /* Describes what just happened. */
{
- Slave *slavePtr = (Slave *)clientData;
- TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr;
+ Content *contentPtr = (Content *)clientData;
+ TkDisplay *dispPtr = ((TkWindow *) contentPtr->tkwin)->dispPtr;
if (eventPtr->type == DestroyNotify) {
- if (slavePtr->masterPtr != NULL) {
- UnlinkSlave(slavePtr);
+ if (contentPtr->containerPtr != NULL) {
+ UnlinkContent(contentPtr);
}
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
- slavePtr->tkwin));
- FreeSlave(slavePtr);
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->contentTable,
+ contentPtr->tkwin));
+ FreeContent(contentPtr);
}
}
@@ -1181,7 +1193,7 @@ SlaveStructureProc(
*
* PlaceRequestProc --
*
- * This function is invoked by Tk whenever a slave managed by us changes
+ * This function is invoked by Tk whenever a content managed by us changes
* its requested geometry.
*
* Results:
@@ -1196,69 +1208,68 @@ SlaveStructureProc(
static void
PlaceRequestProc(
- ClientData clientData, /* Pointer to our record for slave. */
- Tk_Window tkwin) /* Window that changed its desired size. */
+ ClientData clientData, /* Pointer to our record for content. */
+ TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */
{
- Slave *slavePtr = (Slave *)clientData;
- Master *masterPtr;
- (void)tkwin;
+ Content *contentPtr = (Content *)clientData;
+ Container *containerPtr;
- if ((slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH))
- && (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) {
+ if ((contentPtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH))
+ && (contentPtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) {
/*
* Send a ConfigureNotify to indicate that the size change
* request was rejected.
*/
- TkDoConfigureNotify((TkWindow *)(slavePtr->tkwin));
+ TkDoConfigureNotify((TkWindow *)(contentPtr->tkwin));
return;
}
- masterPtr = slavePtr->masterPtr;
- if (masterPtr == NULL) {
+ containerPtr = contentPtr->containerPtr;
+ if (containerPtr == NULL) {
return;
}
- if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) {
- masterPtr->flags |= PARENT_RECONFIG_PENDING;
- Tcl_DoWhenIdle(RecomputePlacement, masterPtr);
+ if (!(containerPtr->flags & PARENT_RECONFIG_PENDING)) {
+ containerPtr->flags |= PARENT_RECONFIG_PENDING;
+ Tcl_DoWhenIdle(RecomputePlacement, containerPtr);
}
}
/*
*--------------------------------------------------------------
*
- * PlaceLostSlaveProc --
+ * PlaceLostContentProc --
*
* This function is invoked by Tk whenever some other geometry claims
- * control over a slave that used to be managed by us.
+ * control over a content window that used to be managed by us.
*
* Results:
* None.
*
* Side effects:
- * Forgets all placer-related information about the slave.
+ * Forgets all placer-related information about the content window.
*
*--------------------------------------------------------------
*/
static void
-PlaceLostSlaveProc(
- ClientData clientData, /* Slave structure for slave window that was
+PlaceLostContentProc(
+ ClientData clientData, /* Content structure for content window that was
* stolen away. */
- Tk_Window tkwin) /* Tk's handle for the slave window. */
+ Tk_Window tkwin) /* Tk's handle for the content window. */
{
- Slave *slavePtr = (Slave *)clientData;
- TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr;
+ Content *contentPtr = (Content *)clientData;
+ TkDisplay *dispPtr = ((TkWindow *) contentPtr->tkwin)->dispPtr;
- if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) {
- Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin);
+ if (contentPtr->containerPtr->tkwin != Tk_Parent(contentPtr->tkwin)) {
+ Tk_UnmaintainGeometry(contentPtr->tkwin, contentPtr->containerPtr->tkwin);
}
Tk_UnmapWindow(tkwin);
- UnlinkSlave(slavePtr);
- Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable,
+ UnlinkContent(contentPtr);
+ Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->contentTable,
tkwin));
- Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc,
- slavePtr);
- FreeSlave(slavePtr);
+ Tk_DeleteEventHandler(tkwin, StructureNotifyMask, ContentStructureProc,
+ contentPtr);
+ FreeContent(contentPtr);
}
/*
diff --git a/generic/tkPlatDecls.h b/generic/tkPlatDecls.h
index db9141c..422407f 100644
--- a/generic/tkPlatDecls.h
+++ b/generic/tkPlatDecls.h
@@ -3,7 +3,7 @@
*
* Declarations of functions in the platform-specific public Tcl API.
*
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright (c) 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -54,28 +54,18 @@ EXTERN int Tk_TranslateWinEvent(HWND hwnd, UINT message,
LRESULT *result);
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
-/* 0 */
-EXTERN void Tk_MacOSXSetEmbedHandler(
- Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr,
- Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr,
- Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr,
- Tk_MacOSXEmbedGetClipProc *getClipProc,
- Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc);
-/* 1 */
-EXTERN void Tk_MacOSXTurnOffMenus(void);
-/* 2 */
-EXTERN void Tk_MacOSXTkOwnsCursor(int tkOwnsIt);
-/* 3 */
-EXTERN void TkMacOSXInitMenus(Tcl_Interp *interp);
+/* Slot 0 is reserved */
+/* Slot 1 is reserved */
+/* Slot 2 is reserved */
+/* Slot 3 is reserved */
/* 4 */
EXTERN void TkMacOSXInitAppleEvents(Tcl_Interp *interp);
/* 5 */
-EXTERN void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y,
+EXTERN void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y,
int width, int height, int flags);
/* 6 */
EXTERN void TkMacOSXInvalClipRgns(Tk_Window tkwin);
-/* 7 */
-EXTERN void * TkMacOSXGetDrawablePort(Drawable drawable);
+/* Slot 7 is reserved */
/* 8 */
EXTERN void * TkMacOSXGetRootControl(Drawable drawable);
/* 9 */
@@ -83,22 +73,15 @@ EXTERN void Tk_MacOSXSetupTkNotifier(void);
/* 10 */
EXTERN int Tk_MacOSXIsAppInFront(void);
/* 11 */
-EXTERN void Tk_MacOSXSetEmbedHandler_(
- Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr,
- Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr,
- Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr,
- Tk_MacOSXEmbedGetClipProc *getClipProc,
- Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc);
+EXTERN Tk_Window Tk_MacOSXGetTkWindow(void *w);
/* 12 */
-EXTERN void Tk_MacOSXTurnOffMenus_(void);
+EXTERN void * Tk_MacOSXGetCGContextForDrawable(Drawable drawable);
/* 13 */
-EXTERN void Tk_MacOSXTkOwnsCursor_(int tkOwnsIt);
-/* 14 */
-EXTERN void TkMacOSXInitMenus_(Tcl_Interp *interp);
-/* 15 */
-EXTERN void TkMacOSXInitAppleEvents_(Tcl_Interp *interp);
+EXTERN void * Tk_MacOSXGetNSWindowForDrawable(Drawable drawable);
+/* Slot 14 is reserved */
+/* Slot 15 is reserved */
/* 16 */
-EXTERN void TkGenWMConfigureEvent_(Tk_Window tkwin, int x, int y,
+EXTERN void TkGenWMConfigureEvent(Tk_Window tkwin, int x, int y,
int width, int height, int flags);
#endif /* AQUA */
@@ -115,23 +98,23 @@ typedef struct TkPlatStubs {
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 (*reserved0)(void);
+ void (*reserved1)(void);
+ void (*reserved2)(void);
+ void (*reserved3)(void);
void (*tkMacOSXInitAppleEvents) (Tcl_Interp *interp); /* 4 */
- void (*tkGenWMConfigureEvent) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 5 */
+ void (*tkGenWMConfigureEvent_) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 5 */
void (*tkMacOSXInvalClipRgns) (Tk_Window tkwin); /* 6 */
- void * (*tkMacOSXGetDrawablePort) (Drawable drawable); /* 7 */
+ void (*reserved7)(void);
void * (*tkMacOSXGetRootControl) (Drawable drawable); /* 8 */
void (*tk_MacOSXSetupTkNotifier) (void); /* 9 */
int (*tk_MacOSXIsAppInFront) (void); /* 10 */
- void (*tk_MacOSXSetEmbedHandler_) (Tk_MacOSXEmbedRegisterWinProc *registerWinProcPtr, Tk_MacOSXEmbedGetGrafPortProc *getPortProcPtr, Tk_MacOSXEmbedMakeContainerExistProc *containerExistProcPtr, Tk_MacOSXEmbedGetClipProc *getClipProc, Tk_MacOSXEmbedGetOffsetInParentProc *getOffsetProc); /* 11 */
- void (*tk_MacOSXTurnOffMenus_) (void); /* 12 */
- void (*tk_MacOSXTkOwnsCursor_) (int tkOwnsIt); /* 13 */
- void (*tkMacOSXInitMenus_) (Tcl_Interp *interp); /* 14 */
- void (*tkMacOSXInitAppleEvents_) (Tcl_Interp *interp); /* 15 */
- void (*tkGenWMConfigureEvent_) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 16 */
+ Tk_Window (*tk_MacOSXGetTkWindow) (void *w); /* 11 */
+ void * (*tk_MacOSXGetCGContextForDrawable) (Drawable drawable); /* 12 */
+ void * (*tk_MacOSXGetNSWindowForDrawable) (Drawable drawable); /* 13 */
+ void (*reserved14)(void);
+ void (*reserved15)(void);
+ void (*tkGenWMConfigureEvent) (Tk_Window tkwin, int x, int y, int width, int height, int flags); /* 16 */
#endif /* AQUA */
} TkPlatStubs;
@@ -162,53 +145,39 @@ extern const TkPlatStubs *tkPlatStubsPtr;
(tkPlatStubsPtr->tk_TranslateWinEvent) /* 5 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
-#define Tk_MacOSXSetEmbedHandler \
- (tkPlatStubsPtr->tk_MacOSXSetEmbedHandler) /* 0 */
-#define Tk_MacOSXTurnOffMenus \
- (tkPlatStubsPtr->tk_MacOSXTurnOffMenus) /* 1 */
-#define Tk_MacOSXTkOwnsCursor \
- (tkPlatStubsPtr->tk_MacOSXTkOwnsCursor) /* 2 */
-#define TkMacOSXInitMenus \
- (tkPlatStubsPtr->tkMacOSXInitMenus) /* 3 */
+/* Slot 0 is reserved */
+/* Slot 1 is reserved */
+/* Slot 2 is reserved */
+/* Slot 3 is reserved */
#define TkMacOSXInitAppleEvents \
(tkPlatStubsPtr->tkMacOSXInitAppleEvents) /* 4 */
-#define TkGenWMConfigureEvent \
- (tkPlatStubsPtr->tkGenWMConfigureEvent) /* 5 */
+#define TkGenWMConfigureEvent_ \
+ (tkPlatStubsPtr->tkGenWMConfigureEvent_) /* 5 */
#define TkMacOSXInvalClipRgns \
(tkPlatStubsPtr->tkMacOSXInvalClipRgns) /* 6 */
-#define TkMacOSXGetDrawablePort \
- (tkPlatStubsPtr->tkMacOSXGetDrawablePort) /* 7 */
+/* Slot 7 is reserved */
#define TkMacOSXGetRootControl \
(tkPlatStubsPtr->tkMacOSXGetRootControl) /* 8 */
#define Tk_MacOSXSetupTkNotifier \
(tkPlatStubsPtr->tk_MacOSXSetupTkNotifier) /* 9 */
#define Tk_MacOSXIsAppInFront \
(tkPlatStubsPtr->tk_MacOSXIsAppInFront) /* 10 */
-#define Tk_MacOSXSetEmbedHandler_ \
- (tkPlatStubsPtr->tk_MacOSXSetEmbedHandler_) /* 11 */
-#define Tk_MacOSXTurnOffMenus_ \
- (tkPlatStubsPtr->tk_MacOSXTurnOffMenus_) /* 12 */
-#define Tk_MacOSXTkOwnsCursor_ \
- (tkPlatStubsPtr->tk_MacOSXTkOwnsCursor_) /* 13 */
-#define TkMacOSXInitMenus_ \
- (tkPlatStubsPtr->tkMacOSXInitMenus_) /* 14 */
-#define TkMacOSXInitAppleEvents_ \
- (tkPlatStubsPtr->tkMacOSXInitAppleEvents_) /* 15 */
-#define TkGenWMConfigureEvent_ \
- (tkPlatStubsPtr->tkGenWMConfigureEvent_) /* 16 */
+#define Tk_MacOSXGetTkWindow \
+ (tkPlatStubsPtr->tk_MacOSXGetTkWindow) /* 11 */
+#define Tk_MacOSXGetCGContextForDrawable \
+ (tkPlatStubsPtr->tk_MacOSXGetCGContextForDrawable) /* 12 */
+#define Tk_MacOSXGetNSWindowForDrawable \
+ (tkPlatStubsPtr->tk_MacOSXGetNSWindowForDrawable) /* 13 */
+/* Slot 14 is reserved */
+/* Slot 15 is reserved */
+#define TkGenWMConfigureEvent \
+ (tkPlatStubsPtr->tkGenWMConfigureEvent) /* 16 */
#endif /* AQUA */
#endif /* defined(USE_TK_STUBS) */
/* !END!: Do not edit above this line. */
-#undef Tk_MacOSXSetEmbedHandler_
-#undef Tk_MacOSXTurnOffMenus_
-#undef Tk_MacOSXTkOwnsCursor_
-#undef TkMacOSXInitMenus_
-#undef TkMacOSXInitAppleEvents_
-#undef TkGenWMConfigureEvent_
-
#ifdef __cplusplus
}
#endif
@@ -216,4 +185,7 @@ extern const TkPlatStubs *tkPlatStubsPtr;
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
+#undef TkGenWMConfigureEvent_
+#define Tk_MacOSXGetNSViewForDrawable TkMacOSXGetRootControl
+
#endif /* _TKPLATDECLS */
diff --git a/generic/tkPointer.c b/generic/tkPointer.c
index ece6281..607939d 100644
--- a/generic/tkPointer.c
+++ b/generic/tkPointer.c
@@ -6,7 +6,7 @@
* to generate appropriate enter/leave events, and to update the global
* grab window information.
*
- * Copyright (c) 1996 by Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -25,7 +25,7 @@
typedef struct {
TkWindow *grabWinPtr; /* Window that defines the top of the grab
* tree in a global grab. */
- int lastState; /* Last known state flags. */
+ unsigned 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
@@ -224,8 +224,9 @@ Tk_UpdatePointer(
TkWindow *targetWinPtr;
XPoint pos;
XEvent event;
- int changes = (state ^ tsdPtr->lastState) & ALL_BUTTONS;
- int type, b, mask;
+ unsigned changes = (state ^ tsdPtr->lastState) & ALL_BUTTONS;
+ int type, b;
+ unsigned mask;
pos.x = x;
pos.y = y;
@@ -254,7 +255,7 @@ Tk_UpdatePointer(
*/
for (b = Button1; b <= Button9; b++) {
- mask = TkGetButtonMask(b);
+ mask = Tk_GetButtonMask(b);
if (changes & mask) {
if (state & mask) {
type = ButtonPress;
diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c
index 76bf03b..bf83453 100644
--- a/generic/tkRectOval.c
+++ b/generic/tkRectOval.c
@@ -3,8 +3,8 @@
*
* 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.
+ * Copyright © 1991-1994 The Regents of the University of California.
+ * Copyright © 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.
diff --git a/generic/tkScale.c b/generic/tkScale.c
index affea94..c67e35c 100644
--- a/generic/tkScale.c
+++ b/generic/tkScale.c
@@ -9,9 +9,9 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -357,7 +357,7 @@ Tk_ScaleObjCmd(
scalePtr->flags &= ~INVOKE_COMMAND;
- Tcl_SetObjResult(interp, TkNewWindowObj(scalePtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(scalePtr->tkwin));
return TCL_OK;
}
@@ -659,13 +659,11 @@ ConfigureScale(
}
}
- /*
- * Several options need special processing, such as parsing the
- * orientation and creating GCs.
- */
+ /*
+ * The fromValue shall not be rounded to the resolution, but the
+ * toValue and tickInterval do.
+ */
- scalePtr->fromValue = TkRoundValueToResolution(scalePtr,
- scalePtr->fromValue);
scalePtr->toValue = TkRoundValueToResolution(scalePtr, scalePtr->toValue);
scalePtr->tickInterval = TkRoundIntervalToResolution(scalePtr,
scalePtr->tickInterval);
diff --git a/generic/tkScale.h b/generic/tkScale.h
index 4e4a3e7..6320e3e 100644
--- a/generic/tkScale.h
+++ b/generic/tkScale.h
@@ -4,8 +4,8 @@
* 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.
+ * Copyright © 1996 Sun Microsystems, Inc.
+ * Copyright © 1999-2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c
index 600c7d7..0b09b84 100644
--- a/generic/tkScrollbar.c
+++ b/generic/tkScrollbar.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -196,7 +196,7 @@ Tk_ScrollbarObjCmd(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(scrollPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(scrollPtr->tkwin));
return TCL_OK;
}
@@ -226,8 +226,8 @@ ScrollbarWidgetObjCmd(
Tcl_Obj *const objv[]) /* Argument strings. */
{
TkScrollbar *scrollPtr = (TkScrollbar *)clientData;
- int result = TCL_OK, cmdIndex;
- TkSizeT length;
+ int result = TCL_OK, cmdIndex, length;
+ TkSizeT len;
static const char *const commandNames[] = {
"activate", "cget", "configure", "delta", "fraction",
"get", "identify", "set", NULL
@@ -271,13 +271,13 @@ ScrollbarWidgetObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "activate element");
goto error;
}
- c = TkGetStringFromObj(objv[2], &length)[0];
+ c = Tcl_GetStringFromObj(objv[2], &len)[0];
oldActiveField = scrollPtr->activeField;
if ((c == 'a') && (strcmp(Tcl_GetString(objv[2]), "arrow1") == 0)) {
scrollPtr->activeField = TOP_ARROW;
} else if ((c == 'a') && (strcmp(Tcl_GetString(objv[2]), "arrow2") == 0)) {
scrollPtr->activeField = BOTTOM_ARROW;
- } else if ((c == 's') && (strncmp(Tcl_GetString(objv[2]), "slider", length) == 0)) {
+ } else if ((c == 's') && (strncmp(Tcl_GetString(objv[2]), "slider", len) == 0)) {
scrollPtr->activeField = SLIDER;
} else {
scrollPtr->activeField = OUTSIDE;
@@ -310,7 +310,7 @@ ScrollbarWidgetObjCmd(
break;
}
case COMMAND_DELTA: {
- int xDelta, yDelta, pixels, length;
+ int xDelta, yDelta, pixels;
double fraction;
if (objc != 4) {
@@ -339,7 +339,7 @@ ScrollbarWidgetObjCmd(
break;
}
case COMMAND_FRACTION: {
- int x, y, pos, length;
+ int x, y, pos;
double fraction;
if (objc != 4) {
diff --git a/generic/tkScrollbar.h b/generic/tkScrollbar.h
index f7c39c8..2108a00 100644
--- a/generic/tkScrollbar.h
+++ b/generic/tkScrollbar.h
@@ -4,7 +4,7 @@
* Declarations of types and functions used to implement the scrollbar
* widget.
*
- * Copyright (c) 1996 by Sun Microsystems, Inc.
+ * Copyright © 1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index 58c54f5..449dc1d 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -4,8 +4,8 @@
* 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.
+ * Copyright © 1990-1993 The Regents of the University of California.
+ * Copyright © 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.
@@ -28,7 +28,7 @@ typedef struct {
* chunk. */
char buffer[4]; /* A buffer to hold part of a UTF character
* that is split across chunks. */
- char command[1]; /* Command to invoke. Actual space is
+ char command[TKFLEXARRAY]; /* Command to invoke. Actual space is
* allocated as large as necessary. This must
* be the last entry in the structure. */
} CommandInfo;
@@ -900,7 +900,7 @@ Tk_SelectionObjCmd(
} else {
format = XA_STRING;
}
- string = TkGetStringFromObj(objs[1], &cmdLength);
+ string = Tcl_GetStringFromObj(objs[1], &cmdLength);
if (cmdLength == 0) {
Tk_DeleteSelHandler(tkwin, selection, target);
} else {
@@ -992,7 +992,7 @@ Tk_SelectionObjCmd(
if ((infoPtr != NULL)
&& (infoPtr->owner != winPtr->dispPtr->clipWindow)) {
- Tcl_SetObjResult(interp, TkNewWindowObj(infoPtr->owner));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(infoPtr->owner));
}
return TCL_OK;
}
@@ -1289,12 +1289,10 @@ static int
SelGetProc(
ClientData clientData, /* Dynamic string holding partially assembled
* selection. */
- Tcl_Interp *dummy, /* Interpreter used for error reporting (not
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter used for error reporting (not
* used). */
const char *portion) /* New information to be appended. */
{
- (void)dummy;
-
Tcl_DStringAppend((Tcl_DString *)clientData, portion, -1);
return TCL_OK;
}
diff --git a/generic/tkSelect.h b/generic/tkSelect.h
index c2d153b..ceff8cb 100644
--- a/generic/tkSelect.h
+++ b/generic/tkSelect.h
@@ -4,7 +4,7 @@
* Declarations of types shared among the files that implement selection
* support.
*
- * Copyright (c) 1995 Sun Microsystems, Inc.
+ * Copyright © 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.
diff --git a/generic/tkSquare.c b/generic/tkSquare.c
index 2b2d3c5..c78edc7 100644
--- a/generic/tkSquare.c
+++ b/generic/tkSquare.c
@@ -7,7 +7,7 @@
* build a widget; it isn't included in the normal wish, but it is
* included in "tktest".
*
- * Copyright (c) 1997 Sun Microsystems, Inc.
+ * Copyright © 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.
@@ -234,7 +234,7 @@ SquareWidgetObjCmd(
int index;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c
index 66834e6..ac3e95a 100644
--- a/generic/tkStubInit.c
+++ b/generic/tkStubInit.c
@@ -3,7 +3,7 @@
*
* This file contains the initializers for the Tk stub vectors.
*
- * Copyright (c) 1998-1999 by Scriptics Corporation.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -24,6 +24,7 @@
#if defined(MAC_OSX_TK)
/* we could have used _TKMACINT */
#include "tkMacOSXInt.h"
+#include "tkMacOSXPrivate.h"
#endif
/* TODO: These ought to come in some other way */
@@ -43,6 +44,7 @@ MODULE_SCOPE const TkStubs tkStubs;
#undef TkWinGetPlatformId
#undef TkPutImage
#undef XPutImage
+#define TkMacOSXSetUpClippingRgn (void (*)(Drawable))(void *)doNothing
#if defined(_WIN32) && !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
# define Tk_TranslateWinEvent TkTranslateWinEvent
@@ -57,6 +59,12 @@ static int TkWinGetPlatformId(void) {
# define TkWinGetPlatformId 0
#endif
+static int
+doNothing(void)
+{
+ /* dummy implementation, no need to do anything */
+ return 0;
+}
#if defined(TK_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8
#define Tk_MainEx 0
@@ -72,11 +80,6 @@ static int TkWinGetPlatformId(void) {
#define Tk_PhotoSetSize_Panic 0
#define Tk_CreateOldPhotoImageFormat 0
#else
-static void
-doNothing(void)
-{
- /* dummy implementation, no need to do anything */
-}
#define Tk_FreeXId ((void (*)(Display *, XID))(void *)doNothing)
#define Tk_FreeStyleFromObj ((void (*)(Tcl_Obj *))(void *)doNothing)
#define Tk_GetStyleFromObj getStyleFromObj
@@ -94,13 +97,9 @@ static Tk_Style Tk_GetStyleFromObj(Tcl_Obj *obj)
#define TkWmCleanup_ TkWmCleanup
#define TkSendCleanup_ TkSendCleanup
#define TkpTestsendCmd_ TkpTestsendCmd
-#define Tk_MacOSXSetEmbedHandler_ Tk_MacOSXSetEmbedHandler
-#define Tk_MacOSXTurnOffMenus_ Tk_MacOSXTurnOffMenus
-#define Tk_MacOSXTkOwnsCursor_ Tk_MacOSXTkOwnsCursor
-#define TkMacOSXInitMenus_ TkMacOSXInitMenus
-#define TkMacOSXInitAppleEvents_ TkMacOSXInitAppleEvents
#define TkGenWMConfigureEvent_ TkGenWMConfigureEvent
#define TkGenerateActivateEvents_ TkGenerateActivateEvents
+#define TkMacOSXDrawable Tk_MacOSXGetNSWindowForDrawable
#define Tk_CanvasTagsParseProc \
(int (*) (void *, Tcl_Interp *,Tk_Window, const char *, char *, \
int offset))(void *)TkCanvasTagsParseProc
@@ -108,6 +107,13 @@ static Tk_Style Tk_GetStyleFromObj(Tcl_Obj *obj)
(const char *(*) (void *,Tk_Window, char *, int, \
Tcl_FreeProc **))(void *)TkCanvasTagsPrintProc
+#if !defined(MAC_OSX_TK) && defined(MAC_OSX_TCL)
+# undef TkpWillDrawWidget
+# undef TkpRedrawWidget
+# define TkpWillDrawWidget ((int (*)(Tk_Window))(void *)doNothing)
+# define TkpRedrawWidget ((void (*)(Tk_Window))(void *)doNothing)
+#endif
+
#ifdef _WIN32
int
@@ -495,27 +501,25 @@ static const TkIntStubs tkIntStubs = {
TkUnderlineAngledTextLayout, /* 182 */
TkIntersectAngledTextLayout, /* 183 */
TkDrawAngledChars, /* 184 */
- TkDebugPhotoStringMatchDef, /* 185 */
-#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 186 */
-#endif /* X11 */
+#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
+ 0, /* 185 */
+#endif /* UNIX */
#if defined(_WIN32) /* WIN */
- 0, /* 186 */
+ 0, /* 185 */
#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 186 */ /* Dummy entry for stubs table backwards compatibility */
- TkpRedrawWidget, /* 186 */
-#endif /* AQUA */
-#if !(defined(_WIN32) || defined(MAC_OSX_TK)) /* X11 */
- 0, /* 187 */
-#endif /* X11 */
+#ifdef MAC_OSX_TCL /* MACOSX */
+ TkpRedrawWidget, /* 185 */
+#endif /* MACOSX */
+#if !defined(_WIN32) && !defined(MAC_OSX_TCL) /* UNIX */
+ 0, /* 186 */
+#endif /* UNIX */
#if defined(_WIN32) /* WIN */
- 0, /* 187 */
+ 0, /* 186 */
#endif /* WIN */
-#ifdef MAC_OSX_TK /* AQUA */
- 0, /* 187 */ /* Dummy entry for stubs table backwards compatibility */
- TkpWillDrawWidget, /* 187 */
-#endif /* AQUA */
+#ifdef MAC_OSX_TCL /* MACOSX */
+ TkpWillDrawWidget, /* 186 */
+#endif /* MACOSX */
+ TkDebugPhotoStringMatchDef, /* 187 */
};
static const TkIntPlatStubs tkIntPlatStubs = {
@@ -583,7 +587,7 @@ static const TkIntPlatStubs tkIntPlatStubs = {
TkMacOSXButtonKeyState, /* 8 */
TkMacOSXClearMenubarActive, /* 9 */
TkMacOSXDispatchMenuEvent, /* 10 */
- TkMacOSXInstallCursor, /* 11 */
+ 0, /* 11 */
TkMacOSXHandleTearoffMenu, /* 12 */
0, /* 13 */
TkMacOSXDoHLEvent, /* 14 */
@@ -598,14 +602,14 @@ static const TkIntPlatStubs tkIntPlatStubs = {
TkMacOSXMakeRealWindowExist, /* 23 */
TkMacOSXMakeStippleMap, /* 24 */
TkMacOSXMenuClick, /* 25 */
- TkMacOSXRegisterOffScreenWindow, /* 26 */
+ 0, /* 26 */
TkMacOSXResizable, /* 27 */
TkMacOSXSetHelpMenuItemCount, /* 28 */
TkMacOSXSetScrollbarGrow, /* 29 */
TkMacOSXSetUpClippingRgn, /* 30 */
TkMacOSXSetUpGraphicsPort, /* 31 */
TkMacOSXUpdateClipRgn, /* 32 */
- TkMacOSXUnregisterMacWindow, /* 33 */
+ 0, /* 33 */
TkMacOSXUseMenuID, /* 34 */
TkMacOSXVisableClipRgn, /* 35 */
TkMacOSXWinBounds, /* 36 */
@@ -621,7 +625,7 @@ static const TkIntPlatStubs tkIntPlatStubs = {
TkpIsWindowFloating, /* 46 */
TkpGetCapture, /* 47 */
0, /* 48 */
- TkGetTransientMaster, /* 49 */
+ TkMacOSXGetContainer, /* 49 */
TkGenerateButtonEvent, /* 50 */
TkGenWMDestroyEvent, /* 51 */
TkMacOSXSetDrawingEnabled, /* 52 */
@@ -950,7 +954,7 @@ static const TkIntXlibStubs tkIntXlibStubs = {
XIconifyWindow, /* 103 */
XWithdrawWindow, /* 104 */
XListHosts, /* 105 */
- 0, /* 106 */
+ XSetClipRectangles, /* 106 */
XFlush, /* 107 */
XGrabServer, /* 108 */
XUngrabServer, /* 109 */
@@ -1018,23 +1022,23 @@ static const TkPlatStubs tkPlatStubs = {
Tk_TranslateWinEvent, /* 5 */
#endif /* WIN */
#ifdef MAC_OSX_TK /* AQUA */
- Tk_MacOSXSetEmbedHandler, /* 0 */
- Tk_MacOSXTurnOffMenus, /* 1 */
- Tk_MacOSXTkOwnsCursor, /* 2 */
- TkMacOSXInitMenus, /* 3 */
+ 0, /* 0 */
+ 0, /* 1 */
+ 0, /* 2 */
+ 0, /* 3 */
TkMacOSXInitAppleEvents, /* 4 */
- TkGenWMConfigureEvent, /* 5 */
+ TkGenWMConfigureEvent_, /* 5 */
TkMacOSXInvalClipRgns, /* 6 */
- TkMacOSXGetDrawablePort, /* 7 */
+ 0, /* 7 */
TkMacOSXGetRootControl, /* 8 */
Tk_MacOSXSetupTkNotifier, /* 9 */
Tk_MacOSXIsAppInFront, /* 10 */
- Tk_MacOSXSetEmbedHandler_, /* 11 */
- Tk_MacOSXTurnOffMenus_, /* 12 */
- Tk_MacOSXTkOwnsCursor_, /* 13 */
- TkMacOSXInitMenus_, /* 14 */
- TkMacOSXInitAppleEvents_, /* 15 */
- TkGenWMConfigureEvent_, /* 16 */
+ Tk_MacOSXGetTkWindow, /* 11 */
+ Tk_MacOSXGetCGContextForDrawable, /* 12 */
+ Tk_MacOSXGetNSWindowForDrawable, /* 13 */
+ 0, /* 14 */
+ 0, /* 15 */
+ TkGenWMConfigureEvent, /* 16 */
#endif /* AQUA */
};
@@ -1146,7 +1150,7 @@ const TkStubs tkStubs = {
Tk_GetFontMetrics, /* 95 */
Tk_GetGC, /* 96 */
Tk_GetImage, /* 97 */
- Tk_GetImageMasterData, /* 98 */
+ Tk_GetImageModelData, /* 98 */
Tk_GetItemTypes, /* 99 */
Tk_GetJoinStyle, /* 100 */
Tk_GetJustify, /* 101 */
@@ -1322,7 +1326,13 @@ const TkStubs tkStubs = {
Tk_Interp, /* 271 */
Tk_CreateOldImageType, /* 272 */
Tk_CreateOldPhotoImageFormat, /* 273 */
- Tk_CreatePhotoImageFormatVersion3 /* 274 */
+ Tk_AlwaysShowSelection, /* 274 */
+ Tk_GetButtonMask, /* 275 */
+ Tk_GetDoublePixelsFromObj, /* 276 */
+ Tk_NewWindowObj, /* 277 */
+ Tk_SendVirtualEvent, /* 278 */
+ Tk_FontGetDescription, /* 279 */
+ Tk_CreatePhotoImageFormatVersion3 /* 280 */
};
/* !END!: Do not edit above this line. */
diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c
index aed0b80..8b669db 100644
--- a/generic/tkStubLib.c
+++ b/generic/tkStubLib.c
@@ -4,8 +4,8 @@
* Stub object that will be statically linked into extensions that want
* to access Tk.
*
- * Copyright (c) 1998-1999 by Scriptics Corporation.
- * Copyright (c) 1998 Paul Duffin.
+ * Copyright © 1998-1999 Scriptics Corporation.
+ * Copyright © 1998 Paul Duffin.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -75,15 +75,19 @@ Tk_InitStubs(
const char *version,
int exact)
{
- const char *packageName = "Tk";
+ const char *packageName = "tk";
const char *errMsg = NULL;
void *clientData = NULL;
const char *actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp,
packageName, version, 0, &clientData);
- const TkStubs *stubsPtr = (const TkStubs *)clientData;
if (actualVersion == NULL) {
- return NULL;
+ packageName = "Tk";
+ actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp,
+ packageName, version, 0, &clientData);
+ if (actualVersion == NULL) {
+ return NULL;
+ }
}
if (exact) {
@@ -113,15 +117,15 @@ Tk_InitStubs(
}
}
}
- if (stubsPtr == NULL) {
+ if (clientData == NULL) {
errMsg = "missing stub table pointer";
} else {
- tkStubsPtr = stubsPtr;
- if (stubsPtr->hooks) {
- tkPlatStubsPtr = stubsPtr->hooks->tkPlatStubs;
- tkIntStubsPtr = stubsPtr->hooks->tkIntStubs;
- tkIntPlatStubsPtr = stubsPtr->hooks->tkIntPlatStubs;
- tkIntXlibStubsPtr = stubsPtr->hooks->tkIntXlibStubs;
+ tkStubsPtr = (const TkStubs *)clientData;
+ if (tkStubsPtr->hooks) {
+ tkPlatStubsPtr = tkStubsPtr->hooks->tkPlatStubs;
+ tkIntStubsPtr = tkStubsPtr->hooks->tkIntStubs;
+ tkIntPlatStubsPtr = tkStubsPtr->hooks->tkIntPlatStubs;
+ tkIntXlibStubsPtr = tkStubsPtr->hooks->tkIntXlibStubs;
} else {
tkPlatStubsPtr = NULL;
tkIntStubsPtr = NULL;
diff --git a/generic/tkStyle.c b/generic/tkStyle.c
index 9ec08ca..418f74f 100644
--- a/generic/tkStyle.c
+++ b/generic/tkStyle.c
@@ -3,8 +3,8 @@
*
* This file implements the widget styles and themes support.
*
- * Copyright (c) 1990-1993 The Regents of the University of California.
- * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1990-1993 The Regents of the University of California.
+ * Copyright © 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.
@@ -178,11 +178,10 @@ static const Tcl_ObjType styleObjType = {
void
TkStylePkgInit(
- TkMainInfo *mainPtr) /* The application being created. */
+ TCL_UNUSED(TkMainInfo *)) /* The application being created. */
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- (void)mainPtr;
if (tsdPtr->nbInit != 0) {
return;
@@ -234,7 +233,7 @@ TkStylePkgInit(
void
TkStylePkgFree(
- TkMainInfo *mainPtr) /* The application being deleted. */
+ TCL_UNUSED(TkMainInfo *)) /* The application being deleted. */
{
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -242,7 +241,6 @@ TkStylePkgFree(
Tcl_HashEntry *entryPtr;
StyleEngine *enginePtr;
int i;
- (void)mainPtr;
tsdPtr->nbInit--;
if (tsdPtr->nbInit != 0) {
@@ -523,10 +521,8 @@ InitElement(
static void
FreeElement(
- Element *elementPtr) /* The element to free. */
+ TCL_UNUSED(Element *)) /* The element to free. */
{
- (void)elementPtr;
-
/* Nothing to do. */
}
@@ -1380,9 +1376,8 @@ Tk_GetStyle(
void
Tk_FreeStyle(
- Tk_Style style)
+ TCL_UNUSED(Tk_Style))
{
- (void)style;
}
/*
diff --git a/generic/tkTest.c b/generic/tkTest.c
index ae67f11..f89a946 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -6,9 +6,9 @@
* 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.
+ * Copyright © 1993-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 1998-1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -31,9 +31,9 @@
#if defined(MAC_OSX_TK)
#include "tkMacOSXInt.h"
#include "tkScrollbar.h"
-#define LOG_DISPLAY TkTestLogDisplay()
+#define LOG_DISPLAY(drawable) TkTestLogDisplay(drawable)
#else
-#define LOG_DISPLAY 1
+#define LOG_DISPLAY(drawable) 1
#endif
#ifdef __UNIX__
@@ -57,17 +57,17 @@ EXTERN int Tktest_Init(Tcl_Interp *interp);
#endif
/*
- * The following data structure represents the master for a test image:
+ * The following data structure represents the model for a test image:
*/
-typedef struct TImageMaster {
- Tk_ImageMaster master; /* Tk's token for image master. */
+typedef struct TImageModel {
+ Tk_ImageModel model; /* Tk's token for image model. */
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;
+} TImageModel;
/*
* The following data structure represents a particular use of a particular
@@ -75,9 +75,11 @@ typedef struct TImageMaster {
*/
typedef struct TImageInstance {
- TImageMaster *masterPtr; /* Pointer to master for image. */
+ TImageModel *modelPtr; /* Pointer to model for image. */
XColor *fg; /* Foreground color for drawing in image. */
GC gc; /* Graphics context for drawing in image. */
+ Bool displayFailed; /* macOS display attempted out of drawRect. */
+ char buffer[200 + TCL_INTEGER_SPACE * 6]; /* message to log on display. */
} TImageInstance;
/*
@@ -86,7 +88,7 @@ typedef struct TImageInstance {
static int ImageCreate(Tcl_Interp *interp,
const char *name, int argc, Tcl_Obj *const objv[],
- const Tk_ImageType *typePtr, Tk_ImageMaster master,
+ const Tk_ImageType *typePtr, Tk_ImageModel model,
ClientData *clientDataPtr);
static ClientData ImageGet(Tk_Window tkwin, ClientData clientData);
static void ImageDisplay(ClientData clientData,
@@ -245,7 +247,7 @@ Tktest_Init(
* Create additional commands for testing Tk.
*/
- if (Tcl_PkgProvideEx(interp, "Tktest", TK_PATCH_LEVEL, NULL) == TCL_ERROR) {
+ if (Tcl_PkgProvideEx(interp, "tk::test", TK_PATCH_LEVEL, NULL) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -332,13 +334,11 @@ Tktest_Init(
static int
TestbitmapObjCmd(
- ClientData clientData, /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- (void)clientData;
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "bitmap");
return TCL_ERROR;
@@ -367,13 +367,11 @@ TestbitmapObjCmd(
static int
TestborderObjCmd(
- ClientData clientData, /* Main window for application. */
+ TCL_UNUSED(ClientData), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- (void)clientData;
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "border");
return TCL_ERROR;
@@ -402,13 +400,11 @@ TestborderObjCmd(
static int
TestcolorObjCmd(
- ClientData clientData, /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- (void)clientData;
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "color");
return TCL_ERROR;
@@ -437,13 +433,11 @@ TestcolorObjCmd(
static int
TestcursorObjCmd(
- ClientData clientData, /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- (void)clientData;
-
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "cursor");
return TCL_ERROR;
@@ -473,16 +467,12 @@ TestcursorObjCmd(
static int
TestdeleteappsObjCmd(
- ClientData clientData, /* Main window for application. */
- Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
- Tcl_Obj *const objv[]) /* Argument strings. */
+ TCL_UNUSED(void *), /* Main window for application. */
+ TCL_UNUSED(Tcl_Interp *), /* Current interpreter. */
+ TCL_UNUSED(int), /* Number of arguments. */
+ TCL_UNUSED(Tcl_Obj *const *)) /* Argument strings. */
{
NewApp *nextPtr;
- (void)clientData;
- (void)interp;
- (void)objc;
- (void)objv;
while (newAppPtr != NULL) {
nextPtr = newAppPtr->nextPtr;
@@ -548,7 +538,7 @@ TestobjconfigObjCmd(
* "chain2" subcommand:
*/
- typedef struct ExtensionWidgetRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *base1ObjPtr;
Tcl_Obj *base2ObjPtr;
@@ -576,7 +566,7 @@ TestobjconfigObjCmd(
switch (index) {
case ALL_TYPES: {
- typedef struct TypesRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *booleanPtr;
Tcl_Obj *integerPtr;
@@ -649,7 +639,6 @@ TestobjconfigObjCmd(
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tk_OptionTable optionTable;
- Tk_Window tkwin;
optionTable = Tk_CreateOptionTable(interp, typesSpecs);
tables[index] = optionTable;
@@ -705,7 +694,6 @@ TestobjconfigObjCmd(
case CHAIN1: {
ExtensionWidgetRecord *recordPtr;
- Tk_Window tkwin;
Tk_OptionTable optionTable;
tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData,
@@ -758,7 +746,6 @@ TestobjconfigObjCmd(
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, TCL_INDEX_NONE, 0,
(ClientData) baseSpecs, 0}
};
- Tk_Window tkwin;
Tk_OptionTable optionTable;
tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData,
@@ -797,7 +784,7 @@ TestobjconfigObjCmd(
}
case CONFIG_ERROR: {
- typedef struct ErrorWidgetRecord {
+ typedef struct {
Tcl_Obj *intPtr;
} ErrorWidgetRecord;
ErrorWidgetRecord widgetRecord;
@@ -851,7 +838,7 @@ TestobjconfigObjCmd(
* objects.
*/
- typedef struct InternalRecord {
+ typedef struct {
TrivialCommandHeader header;
int boolean;
int integer;
@@ -927,7 +914,6 @@ TestobjconfigObjCmd(
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
Tk_OptionTable optionTable;
- Tk_Window tkwin;
optionTable = Tk_CreateOptionTable(interp, internalSpecs);
tables[index] = optionTable;
@@ -983,7 +969,7 @@ TestobjconfigObjCmd(
}
case NEW: {
- typedef struct FiveRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *one;
Tcl_Obj *two;
@@ -1042,7 +1028,7 @@ TestobjconfigObjCmd(
break;
}
case NOT_ENOUGH_PARAMS: {
- typedef struct NotEnoughRecord {
+ typedef struct {
Tcl_Obj *fooObjPtr;
} NotEnoughRecord;
NotEnoughRecord record;
@@ -1072,17 +1058,17 @@ TestobjconfigObjCmd(
}
case TWO_WINDOWS: {
- typedef struct SlaveRecord {
+ typedef struct {
TrivialCommandHeader header;
Tcl_Obj *windowPtr;
- } SlaveRecord;
- SlaveRecord *recordPtr;
- static const Tk_OptionSpec slaveSpecs[] = {
+ } ContentRecord;
+ ContentRecord *recordPtr;
+ static const Tk_OptionSpec contentSpecs[] = {
{TK_OPTION_WINDOW, "-window", "window", "Window", ".bar",
- offsetof(SlaveRecord, windowPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, NULL, 0},
+ offsetof(ContentRecord, windowPtr), TCL_INDEX_NONE, TK_CONFIG_NULL_OK, NULL, 0},
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0}
};
- Tk_Window tkwin = Tk_CreateWindowFromPath(interp,
+ tkwin = Tk_CreateWindowFromPath(interp,
(Tk_Window)clientData, Tcl_GetString(objv[2]), NULL);
if (tkwin == NULL) {
@@ -1090,10 +1076,10 @@ TestobjconfigObjCmd(
}
Tk_SetClass(tkwin, "Test");
- recordPtr = (SlaveRecord *)ckalloc(sizeof(SlaveRecord));
+ recordPtr = (ContentRecord *)ckalloc(sizeof(ContentRecord));
recordPtr->header.interp = interp;
recordPtr->header.optionTable = Tk_CreateOptionTable(interp,
- slaveSpecs);
+ contentSpecs);
tables[index] = recordPtr->header.optionTable;
recordPtr->header.tkwin = tkwin;
recordPtr->windowPtr = NULL;
@@ -1164,7 +1150,7 @@ TrivialConfigObjCmd(
Tk_SavedOptions saved;
if (objc < 2) {
- Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?");
+ Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
@@ -1392,16 +1378,15 @@ ImageCreate(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[], /* Argument strings for options (doesn't
* include image name or type). */
- const Tk_ImageType *typePtr, /* Pointer to our type record (not used). */
- Tk_ImageMaster master, /* Token for image, to be used by us in later
+ TCL_UNUSED(const Tk_ImageType *), /* Pointer to our type record (not used). */
+ Tk_ImageModel model, /* 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;
+ TImageModel *timPtr;
const char *varName;
int i;
- (void)typePtr;
varName = "log";
for (i = 0; i < objc; i += 2) {
@@ -1418,8 +1403,8 @@ ImageCreate(
varName = Tcl_GetString(objv[i+1]);
}
- timPtr = (TImageMaster *)ckalloc(sizeof(TImageMaster));
- timPtr->master = master;
+ timPtr = (TImageModel *)ckalloc(sizeof(TImageModel));
+ timPtr->model = model;
timPtr->interp = interp;
timPtr->width = 30;
timPtr->height = 15;
@@ -1429,7 +1414,7 @@ ImageCreate(
strcpy(timPtr->varName, varName);
Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL);
*clientDataPtr = timPtr;
- Tk_ImageChanged(master, 0, 0, 30, 15, 30, 15);
+ Tk_ImageChanged(model, 0, 0, 30, 15, 30, 15);
return TCL_OK;
}
@@ -1457,7 +1442,7 @@ ImageObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- TImageMaster *timPtr = (TImageMaster *)clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
int x, y, width, height;
if (objc < 2) {
@@ -1478,7 +1463,7 @@ ImageObjCmd(
|| (Tcl_GetIntFromObj(interp, objv[7], &timPtr->height) != TCL_OK)) {
return TCL_ERROR;
}
- Tk_ImageChanged(timPtr->master, x, y, width, height, timPtr->width,
+ Tk_ImageChanged(timPtr->model, x, y, width, height, timPtr->width,
timPtr->height);
} else {
Tcl_AppendResult(interp, "bad option \"", Tcl_GetString(objv[1]),
@@ -1510,9 +1495,9 @@ static ClientData
ImageGet(
Tk_Window tkwin, /* Token for window in which image will be
* used. */
- ClientData clientData) /* Pointer to TImageMaster for image. */
+ ClientData clientData) /* Pointer to TImageModel for image. */
{
- TImageMaster *timPtr = (TImageMaster *)clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
TImageInstance *instPtr;
char buffer[100];
XGCValues gcValues;
@@ -1522,10 +1507,11 @@ ImageGet(
TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
instPtr = (TImageInstance *)ckalloc(sizeof(TImageInstance));
- instPtr->masterPtr = timPtr;
+ instPtr->modelPtr = timPtr;
instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000");
gcValues.foreground = instPtr->fg->pixel;
instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues);
+ instPtr->displayFailed = False;
return instPtr;
}
@@ -1560,47 +1546,56 @@ ImageDisplay(
* imageX and imageY. */
{
TImageInstance *instPtr = (TImageInstance *)clientData;
- char buffer[200 + TCL_INTEGER_SPACE * 6];
/*
* The purpose of the test image type is to track the calls to an image
- * display proc and record the parameters passed in each call. On macOS
- * a display proc must be run inside of the drawRect method of an NSView
- * in order for the graphics operations to have any effect. To deal with
+ * display proc and record the parameters passed in each call. On macOS a
+ * display proc must be run inside of the drawRect method of an NSView in
+ * order for the graphics operations to have any effect. To deal with
* this, whenever a display proc is called outside of any drawRect method
- * it schedules a redraw of the NSView by calling [view setNeedsDisplay:YES].
- * This will trigger a later call to the view's drawRect method which will
- * run the display proc a second time.
- *
- * This complicates testing, since it can result in more calls to the display
- * proc than are expected by the test. It can also result in an inconsistent
- * number of calls unless the test waits until the call to drawRect actually
- * occurs before validating its results.
+ * it schedules a redraw of the NSView.
*
- * In an attempt to work around this, this display proc only logs those
- * calls which occur within a drawRect method. This means that tests must
- * be written so as to ensure that the drawRect method is run before
- * results are validated. In practice it usually suffices to run update
- * idletasks (to run the display proc the first time) followed by update
- * (to run the display proc in drawRect).
- *
- * This also has the consequence that the image changed command will log
- * different results on Aqua than on other systems, because when the image
- * is redisplayed in the drawRect method the entire image will be drawn,
- * not just the changed portion. Tests must account for this.
+ * In an attempt to work around this, each image instance maintains it own
+ * copy of the log message which gets written on the first call to the
+ * display proc. This usually means that the message created on macOS is
+ * the same as that created on other platforms. However it is possible
+ * for the messages to differ for other reasons, namely differences in
+ * how damage regions are computed.
*/
- if (LOG_DISPLAY) {
- sprintf(buffer, "%s display %d %d %d %d",
- instPtr->masterPtr->imageName, imageX, imageY, width, height);
- Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName,
- NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ if (LOG_DISPLAY(drawable)) {
+ if (instPtr->displayFailed == False) {
+
+ /*
+ * Drawing is possible on the first call to DisplayImage.
+ * Log the message.
+ */
+
+ sprintf(instPtr->buffer, "%s display %d %d %d %d",
+ instPtr->modelPtr->imageName, imageX, imageY, width, height);
+ }
+ Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName,
+ NULL, instPtr->buffer,
+ TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ instPtr->displayFailed = False;
+ } else {
+
+ /*
+ * Drawing is not possible on the first call to DisplayImage.
+ * Save the message, but do not log it until the actual display.
+ */
+
+ if (instPtr->displayFailed == False) {
+ sprintf(instPtr->buffer, "%s display %d %d %d %d",
+ instPtr->modelPtr->imageName, imageX, imageY, width, height);
+ }
+ instPtr->displayFailed = True;
}
- if (width > (instPtr->masterPtr->width - imageX)) {
- width = instPtr->masterPtr->width - imageX;
+ if (width > (instPtr->modelPtr->width - imageX)) {
+ width = instPtr->modelPtr->width - imageX;
}
- if (height > (instPtr->masterPtr->height - imageY)) {
- height = instPtr->masterPtr->height - imageY;
+ if (height > (instPtr->modelPtr->height - imageY)) {
+ height = instPtr->modelPtr->height - imageY;
}
XDrawRectangle(display, drawable, instPtr->gc, drawableX, drawableY,
@@ -1637,8 +1632,8 @@ ImageFree(
TImageInstance *instPtr = (TImageInstance *)clientData;
char buffer[200];
- sprintf(buffer, "%s free", instPtr->masterPtr->imageName);
- Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL,
+ sprintf(buffer, "%s free", instPtr->modelPtr->imageName);
+ Tcl_SetVar2(instPtr->modelPtr->interp, instPtr->modelPtr->varName, NULL,
buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
Tk_FreeColor(instPtr->fg);
Tk_FreeGC(display, instPtr->gc);
@@ -1664,11 +1659,11 @@ ImageFree(
static void
ImageDelete(
- ClientData clientData) /* Pointer to TImageMaster for image. When
+ ClientData clientData) /* Pointer to TImageModel for image. When
* this function is called, no more instances
* exist. */
{
- TImageMaster *timPtr = (TImageMaster *)clientData;
+ TImageModel *timPtr = (TImageModel *)clientData;
char buffer[100];
sprintf(buffer, "%s delete", timPtr->imageName);
@@ -1808,14 +1803,13 @@ TestmenubarObjCmd(
#if defined(_WIN32)
static int
TestmetricsObjCmd(
- ClientData dummy, /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
char buf[TCL_INTEGER_SPACE];
int val;
- (void)dummy;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
@@ -1939,11 +1933,7 @@ TestprintfObjCmd(
{
char buffer[256];
Tcl_WideInt wideInt;
-#ifdef _WIN32
- __int64 longLongInt;
-#else
long long longLongInt;
-#endif
(void)dummy;
if (objc != 2) {
@@ -1962,7 +1952,7 @@ TestprintfObjCmd(
*/
sprintf(buffer, "%s%s%s%s%s%s%s%s%" TCL_LL_MODIFIER "d %"
TCL_LL_MODIFIER "u", "", "", "", "", "", "", "", "",
- (Tcl_WideInt)longLongInt, (Tcl_WideUInt)longLongInt);
+ longLongInt, (unsigned long long)longLongInt);
Tcl_AppendResult(interp, buffer, NULL);
return TCL_OK;
}
@@ -2045,9 +2035,9 @@ TestwrapperObjCmd(
static int
CustomOptionSet(
- ClientData dummy,
+ TCL_UNUSED(void *),
Tcl_Interp *interp,
- Tk_Window tkwin,
+ TCL_UNUSED(Tk_Window),
Tcl_Obj **value,
char *recordPtr,
TkSizeT internalOffset,
@@ -2056,8 +2046,6 @@ CustomOptionSet(
{
int objEmpty;
char *newStr, *string, *internalPtr;
- (void)dummy;
- (void)tkwin;
objEmpty = 0;
@@ -2108,14 +2096,11 @@ CustomOptionSet(
static Tcl_Obj *
CustomOptionGet(
- ClientData dummy,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *recordPtr,
TkSizeT internalOffset)
{
- (void)dummy;
- (void)tkwin;
-
return (Tcl_NewStringObj(*(char **)(recordPtr + internalOffset), -1));
}
diff --git a/generic/tkText.c b/generic/tkText.c
index 119f229..09a110d 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -6,9 +6,9 @@
* 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.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 1994-1996 Sun Microsystems, Inc.
+ * Copyright © 1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -298,10 +298,10 @@ typedef struct SearchSpec {
int all; /* Whether all or the first match should be
* reported. */
int startLine; /* First line to examine. */
- TkSizeT startOffset1; /* Index in first line to start at. */
+ TkSizeT startOffset; /* Index in first line to start at. */
int stopLine; /* Last line to examine, or -1 when we search
* all available text. */
- TkSizeT stopOffset1; /* Index to stop at, provided stopLine is not
+ TkSizeT stopOffset; /* Index to stop at, provided stopLine is not
* -1. */
int numLines; /* Total lines which are available. */
int backwards; /* Searching forwards or backwards. */
@@ -670,7 +670,7 @@ CreateWidget(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, TkNewWindowObj(textPtr->tkwin));
+ Tcl_SetObjResult(interp, Tk_NewWindowObj(textPtr->tkwin));
return TCL_OK;
}
@@ -701,7 +701,7 @@ TextWidgetObjCmd(
{
TkText *textPtr = (TkText *)clientData;
int result = TCL_OK;
- int index;
+ int idx;
static const char *const optionStrings[] = {
"bbox", "cget", "compare", "configure", "count", "debug", "delete",
@@ -724,12 +724,12 @@ TextWidgetObjCmd(
}
if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings,
- sizeof(char *), "option", 0, &index) != TCL_OK) {
+ sizeof(char *), "option", 0, &idx) != TCL_OK) {
return TCL_ERROR;
}
textPtr->refCount++;
- switch ((enum options) index) {
+ switch ((enum options) idx) {
case TEXT_BBOX: {
int x, y, width, height;
const TkTextIndex *indexPtr;
@@ -865,7 +865,7 @@ TextWidgetObjCmd(
for (i = 2; i < objc-2; i++) {
int value;
TkSizeT length;
- const char *option = TkGetStringFromObj(objv[i], &length);
+ const char *option = Tcl_GetStringFromObj(objv[i], &length);
char c;
if (length < 2 || option[0] != '-') {
@@ -1051,7 +1051,7 @@ TextWidgetObjCmd(
badOption:
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "bad option \"%s\" must be -chars, -displaychars, "
+ "bad option \"%s\": must be -chars, -displaychars, "
"-displayindices, -displaylines, -indices, -lines, -update, "
"-xpixels, or -ypixels", Tcl_GetString(objv[i])));
Tcl_SetErrorCode(interp, "TK", "TEXT", "INDEX_OPTION", NULL);
@@ -1161,7 +1161,7 @@ TextWidgetObjCmd(
* first to maintain index consistency.
*/
- qsort(indices, objc / 2,
+ qsort(indices, (size_t) objc / 2,
2 * sizeof(TkTextIndex), TextIndexSortProc);
lastStart = NULL;
@@ -1275,12 +1275,12 @@ TextWidgetObjCmd(
i = 2;
if (objc > 3) {
- name = TkGetStringFromObj(objv[i], &length);
+ name = Tcl_GetStringFromObj(objv[i], &length);
if (length > 1 && name[0] == '-') {
if (strncmp("-displaychars", name, length) == 0) {
i++;
visible = 1;
- name = TkGetStringFromObj(objv[i], &length);
+ name = Tcl_GetStringFromObj(objv[i], &length);
}
if ((i < objc-1) && (length == 2) && !strcmp("--", name)) {
i++;
@@ -1753,7 +1753,7 @@ TextPeerCmd(
while (tPtr != NULL) {
if (tPtr != textPtr) {
Tcl_ListObjAppendElement(NULL, peersObj,
- TkNewWindowObj(tPtr->tkwin));
+ Tk_NewWindowObj(tPtr->tkwin));
}
tPtr = tPtr->next;
}
@@ -2636,7 +2636,7 @@ InsertChars(
int *lineAndByteIndex;
int resetViewCount;
int pixels[2*PIXEL_CLIENTS];
- const char *string = TkGetStringFromObj(stringPtr, &length);
+ const char *string = Tcl_GetStringFromObj(stringPtr, &length);
if (sharedTextPtr == NULL) {
sharedTextPtr = textPtr->sharedTextPtr;
@@ -3173,7 +3173,7 @@ DeleteIndexRange(
line2 = TkBTreeLinesTo(textPtr, index2.linePtr);
if (line2 == TkBTreeNumLines(sharedTextPtr->tree, textPtr)) {
TkTextTag **arrayPtr;
- int arraySize, i;
+ int arraySize;
TkTextIndex oldIndex2;
oldIndex2 = index2;
@@ -3557,7 +3557,7 @@ TkTextLostSelection(
{
TkText *textPtr = (TkText *)clientData;
- if (TkpAlwaysShowSelection(textPtr->tkwin)) {
+ if (Tk_AlwaysShowSelection(textPtr->tkwin)) {
TkTextIndex start, end;
if ((!textPtr->exportSelection) || Tcl_IsSafe(textPtr->interp)) {
@@ -3615,7 +3615,7 @@ TkTextSelectionEvent(
* event generate $textWidget <<Selection>>
*/
- TkSendVirtualEvent(textPtr->tkwin, "Selection", NULL);
+ Tk_SendVirtualEvent(textPtr->tkwin, "Selection", NULL);
}
/*
@@ -4288,7 +4288,7 @@ TextSearchFoundMatch(
*/
if (searchSpecPtr->backwards ^
- (matchOffset + 1 >= searchSpecPtr->stopOffset1 + 1)) {
+ (matchOffset + 1 >= searchSpecPtr->stopOffset + 1)) {
return 0;
}
}
@@ -4313,7 +4313,7 @@ TextSearchFoundMatch(
if (searchSpecPtr->strictLimits && lineNum == searchSpecPtr->stopLine) {
if (searchSpecPtr->backwards ^
- ((matchOffset + numChars + 1) > searchSpecPtr->stopOffset1 + 1)) {
+ ((matchOffset + numChars + 1) > searchSpecPtr->stopOffset + 1)) {
return 0;
}
}
@@ -4539,8 +4539,8 @@ TkTextGetTabs(
* Parse the elements of the list one at a time to fill in the array.
*/
- tabArrayPtr = (TkTextTabArray *)ckalloc(sizeof(TkTextTabArray)
- + (count - 1) * sizeof(TkTextTab));
+ tabArrayPtr = (TkTextTabArray *)ckalloc(offsetof(TkTextTabArray, tabs)
+ + count * sizeof(TkTextTab));
tabArrayPtr->numTabs = 0;
prevStop = 0.0;
lastStop = 0.0;
@@ -4759,7 +4759,7 @@ TextDumpCmd(
if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) {
return TCL_ERROR;
}
- str = TkGetStringFromObj(objv[arg], &length);
+ str = Tcl_GetStringFromObj(objv[arg], &length);
if (strncmp(str, "end", length) == 0) {
atEnd = 1;
}
@@ -5060,11 +5060,10 @@ DumpSegment(
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. */
+ TCL_UNUSED(int)) /* Look for TK_DUMP_INDEX bit. */
{
char buffer[TK_POS_CHARS];
Tcl_Obj *values[3], *tuple;
- (void)what;
TkTextPrintIndex(textPtr, index, buffer);
values[0] = Tcl_NewStringObj(key, -1);
@@ -5490,7 +5489,7 @@ GenerateModifiedEvent(
for (textPtr = textPtr->sharedTextPtr->peers; textPtr != NULL;
textPtr = textPtr->next) {
Tk_MakeWindowExist(textPtr->tkwin);
- TkSendVirtualEvent(textPtr->tkwin, "Modified", NULL);
+ Tk_SendVirtualEvent(textPtr->tkwin, "Modified", NULL);
}
}
@@ -5520,7 +5519,7 @@ GenerateUndoStackEvent(
for (textPtr = textPtr->sharedTextPtr->peers; textPtr != NULL;
textPtr = textPtr->next) {
Tk_MakeWindowExist(textPtr->tkwin);
- TkSendVirtualEvent(textPtr->tkwin, "UndoStack", NULL);
+ Tk_SendVirtualEvent(textPtr->tkwin, "UndoStack", NULL);
}
}
@@ -5664,7 +5663,7 @@ SearchPerform(
if (searchSpecPtr->lineIndexProc(interp, fromPtr, searchSpecPtr,
&searchSpecPtr->startLine,
- &searchSpecPtr->startOffset1) != TCL_OK) {
+ &searchSpecPtr->startOffset) != TCL_OK) {
return TCL_ERROR;
}
@@ -5695,7 +5694,7 @@ SearchPerform(
if (searchSpecPtr->lineIndexProc(interp, toPtr, searchSpecPtr,
&searchSpecPtr->stopLine,
- &searchSpecPtr->stopOffset1) != TCL_OK) {
+ &searchSpecPtr->stopOffset) != TCL_OK) {
return TCL_ERROR;
}
} else {
@@ -5829,7 +5828,7 @@ SearchCore(
* it has dual purpose.
*/
- pattern = TkGetStringFromObj(patObj, &matchLength);
+ pattern = Tcl_GetStringFromObj(patObj, &matchLength);
nl = strchr(pattern, '\n');
/*
@@ -5894,7 +5893,7 @@ SearchCore(
}
if (lineNum == searchSpecPtr->stopLine && searchSpecPtr->backwards) {
- firstOffset = searchSpecPtr->stopOffset1;
+ firstOffset = searchSpecPtr->stopOffset;
} else {
firstOffset = 0;
}
@@ -5928,8 +5927,8 @@ SearchCore(
* Only use the last part of the line.
*/
- if (searchSpecPtr->startOffset1 + 1 > (TkSizeT)firstOffset + 1) {
- firstOffset = searchSpecPtr->startOffset1;
+ if (searchSpecPtr->startOffset + 1 > (TkSizeT)firstOffset + 1) {
+ firstOffset = searchSpecPtr->startOffset;
}
if ((firstOffset >= lastOffset)
&& ((lastOffset != 0) || searchSpecPtr->exact)) {
@@ -5940,8 +5939,8 @@ SearchCore(
* Use only the first part of the line.
*/
- if (searchSpecPtr->startOffset1 + 1 < (TkSizeT)lastOffset + 1) {
- lastOffset = searchSpecPtr->startOffset1;
+ if (searchSpecPtr->startOffset + 1 < (TkSizeT)lastOffset + 1) {
+ lastOffset = searchSpecPtr->startOffset;
}
}
}
@@ -6777,15 +6776,13 @@ SearchCore(
static Tcl_Obj *
GetLineStartEnd(
- ClientData dummy,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *recordPtr, /* Pointer to widget record. */
TkSizeT internalOffset) /* Offset within *recordPtr containing the
* line value. */
{
TkTextLine *linePtr = *(TkTextLine **)(recordPtr + internalOffset);
- (void)dummy;
- (void)tkwin;
if (linePtr == NULL) {
return Tcl_NewObj();
@@ -6814,9 +6811,9 @@ GetLineStartEnd(
static int
SetLineStartEnd(
- ClientData dummy,
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interp; may be used for errors. */
- Tk_Window tkwin, /* Window for which option is being set. */
+ TCL_UNUSED(Tk_Window), /* 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). */
@@ -6829,8 +6826,6 @@ SetLineStartEnd(
TkTextLine *linePtr = NULL;
char *internalPtr;
TkText *textPtr = (TkText *) recordPtr;
- (void)dummy;
- (void)tkwin;
if (internalOffset != TCL_INDEX_NONE) {
internalPtr = (char *)recordPtr + internalOffset;
@@ -6875,14 +6870,11 @@ SetLineStartEnd(
static void
RestoreLineStartEnd(
- ClientData dummy,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *internalPtr, /* Pointer to storage for value. */
char *oldInternalPtr) /* Pointer to old value. */
{
- (void)dummy;
- (void)tkwin;
-
*(TkTextLine **)internalPtr = *(TkTextLine **)oldInternalPtr;
}
@@ -6937,7 +6929,7 @@ ObjectIsEmpty(
int
TkpTesttextCmd(
- ClientData dummy, /* Main window for application. */
+ TCL_UNUSED(void *), /* Main window for application. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
@@ -6948,7 +6940,6 @@ TkpTesttextCmd(
TkTextIndex index;
char buf[64];
Tcl_CmdInfo info;
- (void)dummy;
if (objc < 3) {
return TCL_ERROR;
diff --git a/generic/tkText.h b/generic/tkText.h
index 75cab59..e9e6303 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -168,7 +168,7 @@ typedef struct TkTextSegment {
TkSizeT size; /* Size of this segment (# of bytes of index
* space it occupies). */
union {
- char chars[2]; /* Characters that make up character info.
+ char chars[TKFLEXARRAY]; /* Characters that make up character info.
* Actual length varies to hold as many
* characters as needed.*/
TkTextToggle toggle; /* Information about tag toggle. */
@@ -489,7 +489,7 @@ typedef struct TkTextTabArray {
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
+ TkTextTab tabs[TKFLEXARRAY];/* Array of tabs. The actual size will be
* numTabs. THIS FIELD MUST BE THE LAST IN THE
* STRUCTURE. */
} TkTextTabArray;
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c
index b95bd9b..f242328 100644
--- a/generic/tkTextBTree.c
+++ b/generic/tkTextBTree.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -4169,7 +4169,7 @@ Rebalance(
Node *otherPtr;
Node *halfwayNodePtr = NULL; /* Initialization needed only */
TkTextLine *halfwayLinePtr = NULL; /* to prevent cc warnings. */
- int totalChildren, firstChildren, i;
+ int totalChildren, firstChildren;
/*
* Too few children for this node. If this is the root then, it's
@@ -4230,8 +4230,6 @@ Rebalance(
otherPtr->children.linePtr = NULL;
}
if (nodePtr->level == 0) {
- TkTextLine *linePtr;
-
for (linePtr = nodePtr->children.linePtr, i = 1;
linePtr->nextPtr != NULL;
linePtr = linePtr->nextPtr, i++) {
@@ -4246,8 +4244,6 @@ Rebalance(
i++;
}
} else {
- Node *childPtr;
-
for (childPtr = nodePtr->children.nodePtr, i = 1;
childPtr->nextPtr != NULL;
childPtr = childPtr->nextPtr, i++) {
@@ -4592,10 +4588,9 @@ static TkTextSegment *
CharCleanupProc(
TkTextSegment *segPtr, /* Pointer to first of two adjacent segments
* to join. */
- TkTextLine *linePtr) /* Line containing segments (not used). */
+ TCL_UNUSED(TkTextLine *)) /* Line containing segments (not used). */
{
TkTextSegment *segPtr2, *newPtr;
- (void)linePtr;
segPtr2 = segPtr->nextPtr;
if ((segPtr2 == NULL) || (segPtr2->typePtr != &tkTextCharType)) {
@@ -4632,14 +4627,11 @@ CharCleanupProc(
static int
CharDeleteProc(
TkTextSegment *segPtr, /* Segment to delete. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
- (void)linePtr;
- (void)treeGone;
-
ckfree(segPtr);
return 0;
}
@@ -4664,10 +4656,8 @@ CharDeleteProc(
static void
CharCheckProc(
TkTextSegment *segPtr, /* Segment to check. */
- TkTextLine *linePtr) /* Line containing segment. */
+ TCL_UNUSED(TkTextLine *)) /* Line containing segment. */
{
- (void)linePtr;
-
/*
* 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.
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 3aa83ee..d14a25d 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -6,8 +6,8 @@
* 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.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -440,12 +440,12 @@ typedef struct TextDInfo {
* points to one of the following structures:
*/
-#if !TK_LAYOUT_WITH_BASE_CHUNKS
+#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS)
typedef struct CharInfo {
int numBytes; /* Number of bytes to display. */
- char chars[1]; /* UTF characters to display. Actual size will
- * be numBytes, not 1. THIS MUST BE THE LAST
+ char chars[TKFLEXARRAY]; /* UTF characters to display.
+ * Allocated as large as necessary. THIS MUST BE THE LAST
* FIELD IN THE STRUCTURE. */
} CharInfo;
@@ -552,7 +552,7 @@ static void CharDisplayProc(TkText *textPtr,
static int CharMeasureProc(TkTextDispChunk *chunkPtr, int x);
static void CharUndisplayProc(TkText *textPtr,
TkTextDispChunk *chunkPtr);
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
static void FinalizeBaseChunk(TkTextDispChunk *additionalChunkPtr);
static void FreeBaseChunk(TkTextDispChunk *baseChunkPtr);
static int IsSameFGStyle(TextStyle *style1, TextStyle *style2);
@@ -1367,7 +1367,7 @@ LayoutDLine(
* 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.
+ * If current chunk is elided and last chunk was too, coalesce.
*
* 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
@@ -1508,7 +1508,7 @@ LayoutDLine(
}
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
if (baseCharChunkPtr != NULL) {
int expectedX =
((BaseCharInfo *) baseCharChunkPtr->clientData)->width
@@ -1650,7 +1650,7 @@ LayoutDLine(
chunkPtr = NULL;
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
FinalizeBaseChunk(NULL);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
if (noCharsYet) {
@@ -1709,7 +1709,7 @@ LayoutDLine(
segPtr->typePtr->layoutProc(textPtr, &breakIndex, segPtr,
byteOffset, maxX, breakByteOffset, 0, wrapMode,
breakChunkPtr);
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
FinalizeBaseChunk(NULL);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
}
@@ -3164,8 +3164,8 @@ GenerateWidgetViewSyncEvent(
} else {
textPtr->dInfoPtr->flags |= OUT_OF_SYNC;
}
- TkSendVirtualEvent(textPtr->tkwin, "WidgetViewSync",
- Tcl_NewBooleanObj(NewSyncState));
+ Tk_SendVirtualEvent(textPtr->tkwin, "WidgetViewSync",
+ Tcl_NewBooleanObj(NewSyncState));
}
}
@@ -5276,7 +5276,7 @@ TkTextRelayoutWindow(
/*
* Invalidate cached scrollbar positions, so that scrollbars sliders will
- * be udpated.
+ * be updated.
*/
dInfoPtr->xScrollFirst = dInfoPtr->xScrollLast = -1;
@@ -6182,7 +6182,7 @@ TkTextYviewCmd(
pickPlace = 0;
if (Tcl_GetString(objv[2])[0] == '-') {
const char *switchStr =
- TkGetStringFromObj(objv[2], &switchLength);
+ Tcl_GetStringFromObj(objv[2], &switchLength);
if ((switchLength >= 2) && (strncmp(switchStr, "-pickplace",
(unsigned) switchLength) == 0)) {
@@ -7542,14 +7542,14 @@ TkTextDLineInfo(
static void
ElideBboxProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
- int index, /* Index of desired character within the
+ TCL_UNUSED(int), /* 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
+ TCL_UNUSED(int), /* Height of line, in pixels. */
+ TCL_UNUSED(int), /* 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
@@ -7559,10 +7559,6 @@ ElideBboxProc(
int *heightPtr) /* Gets filled in with height of character, in
* pixels. */
{
- (void)textPtr;
- (void)index;
- (void)lineHeight;
- (void)baseline;
*xPtr = chunkPtr->x;
*yPtr = y;
@@ -7575,13 +7571,10 @@ ElideBboxProc(
static int
ElideMeasureProc(
- TkTextDispChunk *chunkPtr, /* Chunk containing desired coord. */
- int x) /* X-coordinate, in same coordinate system as
+ TCL_UNUSED(TkTextDispChunk *), /* Chunk containing desired coord. */
+ TCL_UNUSED(int)) /* X-coordinate, in same coordinate system as
* chunkPtr->x. */
{
- (void)chunkPtr;
- (void)x;
-
return 0 /*chunkPtr->numBytes - 1*/;
}
@@ -7608,8 +7601,8 @@ ElideMeasureProc(
int
TkTextCharLayoutProc(
- TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Index of first character to lay out
+ TCL_UNUSED(TkText *), /* Text widget being layed out. */
+ TCL_UNUSED(TkTextIndex *), /* Index of first character to lay out
* (corresponds to segPtr and offset). */
TkTextSegment *segPtr, /* Segment being layed out. */
TkSizeT byteOffset, /* Byte offset within segment of first
@@ -7635,14 +7628,12 @@ TkTextCharLayoutProc(
char *p;
TkTextSegment *nextPtr;
Tk_FontMetrics fm;
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
const char *line;
int lineOffset;
BaseCharInfo *bciPtr;
Tcl_DString *baseString;
#endif
- (void)textPtr;
- (void)indexPtr;
/*
* Figure out how many characters will fit in the space we've got. Include
@@ -7662,7 +7653,7 @@ TkTextCharLayoutProc(
p = segPtr->body.chars + byteOffset;
tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
if (baseCharChunkPtr == NULL) {
baseCharChunkPtr = chunkPtr;
bciPtr = ckalloc(sizeof(BaseCharInfo));
@@ -7699,7 +7690,7 @@ TkTextCharLayoutProc(
int ch;
int chLen = TkUtfToUniChar(p, &ch);
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
bytesThatFit = CharChunkMeasureChars(chunkPtr, line,
lineOffset+chLen, lineOffset, -1, chunkPtr->x, -1, 0,
&nextX);
@@ -7743,7 +7734,7 @@ TkTextCharLayoutProc(
bytesThatFit++;
}
if (bytesThatFit == 0) {
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
chunkPtr->clientData = NULL;
if (chunkPtr == baseCharChunkPtr) {
baseCharChunkPtr = NULL;
@@ -7776,7 +7767,7 @@ TkTextCharLayoutProc(
chunkPtr->width = nextX - chunkPtr->x;
chunkPtr->breakIndex = -1;
-#if !TK_LAYOUT_WITH_BASE_CHUNKS
+#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS)
ciPtr = (CharInfo *)ckalloc(offsetof(CharInfo, chars) + 1 + bytesThatFit);
chunkPtr->clientData = ciPtr;
memcpy(ciPtr->chars, p, bytesThatFit);
@@ -7787,7 +7778,7 @@ TkTextCharLayoutProc(
ciPtr->numBytes--;
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
/*
* Final update for the current base chunk data.
*/
@@ -7892,7 +7883,7 @@ CharChunkMeasureChars(
Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
-#if !TK_LAYOUT_WITH_BASE_CHUNKS
+#if !defined(TK_LAYOUT_WITH_BASE_CHUNKS)
if (chars == NULL) {
chars = ciPtr->chars;
charsLen = ciPtr->numBytes;
@@ -7965,18 +7956,18 @@ CharChunkMeasureChars(
static void
CharDisplayProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
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. */
+ TCL_UNUSED(int), /* 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
+ TCL_UNUSED(int)) /* Y-coordinate in text window that
* corresponds to y. */
{
CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
@@ -7984,12 +7975,9 @@ CharDisplayProc(
TextStyle *stylePtr;
StyleValues *sValuePtr;
int numBytes, offsetBytes, offsetX;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
BaseCharInfo *bciPtr;
#endif /* TK_DRAW_IN_CONTEXT */
- (void)textPtr;
- (void)height;
- (void)screenY;
if ((x + chunkPtr->width) <= 0) {
/*
@@ -7999,12 +7987,12 @@ CharDisplayProc(
return;
}
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
bciPtr = ciPtr->baseChunkPtr->clientData;
numBytes = Tcl_DStringLength(&bciPtr->baseChars);
string = Tcl_DStringValue(&bciPtr->baseChars);
-#elif TK_LAYOUT_WITH_BASE_CHUNKS
+#elif defined(TK_LAYOUT_WITH_BASE_CHUNKS)
if (ciPtr->baseChunkPtr != chunkPtr) {
/*
* Without context drawing only base chunks display their foreground.
@@ -8045,7 +8033,7 @@ CharDisplayProc(
if (!sValuePtr->elide && (numBytes > offsetBytes)
&& (stylePtr->fgGC != NULL)) {
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
int start = ciPtr->baseOffset + offsetBytes;
int len = ciPtr->numBytes - offsetBytes;
int xDisplacement = x - chunkPtr->x;
@@ -8130,14 +8118,13 @@ CharDisplayProc(
static void
CharUndisplayProc(
- TkText *textPtr, /* Overall information about text widget. */
+ TCL_UNUSED(TkText *), /* Overall information about text widget. */
TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
{
CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
- (void)textPtr;
if (ciPtr) {
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
if (chunkPtr == ciPtr->baseChunkPtr) {
/*
* Basechunks are undisplayed first, when DLines are freed or
@@ -8220,13 +8207,13 @@ CharMeasureProc(
static void
CharBboxProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
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. */
+ TCL_UNUSED(int), /* 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
@@ -8239,8 +8226,6 @@ CharBboxProc(
{
CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
int maxX;
- (void)textPtr;
- (void)lineHeight;
maxX = chunkPtr->width + chunkPtr->x;
CharChunkMeasureChars(chunkPtr, NULL, 0, 0, byteIndex,
@@ -8721,7 +8706,7 @@ MeasureChars(
if ((maxX >= 0) && (curX >= maxX)) {
break;
}
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
start += TkpMeasureCharsInContext(tkfont, source, maxBytes,
start - source, special - start,
maxX >= 0 ? maxX - curX : -1, flags, &width);
@@ -8802,6 +8787,7 @@ TextGetScrollInfoObj(
VIEW_SCROLL_PAGES, VIEW_SCROLL_PIXELS, VIEW_SCROLL_UNITS
};
int index;
+ double d;
if (Tcl_GetIndexFromObjStruct(interp, objv[2], subcommands,
sizeof(char *), "option", 0, &index) != TCL_OK) {
@@ -8829,20 +8815,31 @@ TextGetScrollInfoObj(
}
switch ((enum viewUnits) index) {
case VIEW_SCROLL_PAGES:
- if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
+ if (Tcl_GetDoubleFromObj(interp, objv[3], &d) != TCL_OK) {
return TKTEXT_SCROLL_ERROR;
}
+ *intPtr = (d > 0) ? ceil(d) : floor(d);
+ if (dblPtr) {
+ *dblPtr = d;
+ }
return TKTEXT_SCROLL_PAGES;
case VIEW_SCROLL_PIXELS:
if (Tk_GetPixelsFromObj(interp, textPtr->tkwin, objv[3],
intPtr) != TCL_OK) {
return TKTEXT_SCROLL_ERROR;
}
+ if (dblPtr) {
+ *dblPtr = (double)*intPtr;
+ }
return TKTEXT_SCROLL_PIXELS;
case VIEW_SCROLL_UNITS:
- if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
+ if (Tcl_GetDoubleFromObj(interp, objv[3], &d) != TCL_OK) {
return TKTEXT_SCROLL_ERROR;
}
+ *intPtr = (d > 0) ? ceil(d) : floor(d);
+ if (dblPtr) {
+ *dblPtr = d;
+ }
return TKTEXT_SCROLL_UNITS;
}
}
@@ -8850,7 +8847,7 @@ TextGetScrollInfoObj(
return TKTEXT_SCROLL_ERROR;
}
-#if TK_LAYOUT_WITH_BASE_CHUNKS
+#ifdef TK_LAYOUT_WITH_BASE_CHUNKS
/*
*----------------------------------------------------------------------
*
@@ -8881,7 +8878,7 @@ FinalizeBaseChunk(
const char *baseChars;
TkTextDispChunk *chunkPtr;
CharInfo *ciPtr;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
int widthAdjust = 0;
int newwidth;
#endif /* TK_DRAW_IN_CONTEXT */
@@ -8895,7 +8892,7 @@ FinalizeBaseChunk(
for (chunkPtr = baseCharChunkPtr; chunkPtr != NULL;
chunkPtr = chunkPtr->nextPtr) {
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
chunkPtr->x += widthAdjust;
#endif /* TK_DRAW_IN_CONTEXT */
@@ -8908,7 +8905,7 @@ FinalizeBaseChunk(
}
ciPtr->chars = baseChars + ciPtr->baseOffset;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
newwidth = 0;
CharChunkMeasureChars(chunkPtr, NULL, 0, 0, -1, 0, -1, 0, &newwidth);
if (newwidth < chunkPtr->width) {
@@ -8922,7 +8919,7 @@ FinalizeBaseChunk(
ciPtr = addChunkPtr->clientData;
ciPtr->chars = baseChars + ciPtr->baseOffset;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
addChunkPtr->x += widthAdjust;
CharChunkMeasureChars(addChunkPtr, NULL, 0, 0, -1, 0, -1, 0,
&addChunkPtr->width);
@@ -9020,7 +9017,7 @@ IsSameFGStyle(
return 1;
}
-#if !TK_DRAW_IN_CONTEXT
+#if !defined(TK_DRAW_IN_CONTEXT)
if (
#ifdef MAC_OSX_TK
!TkMacOSXCompareColors(style1->fgGC->foreground,
@@ -9036,7 +9033,7 @@ IsSameFGStyle(
sv1 = style1->sValuePtr;
sv2 = style2->sValuePtr;
-#if TK_DRAW_IN_CONTEXT
+#ifdef TK_DRAW_IN_CONTEXT
return sv1->tkfont == sv2->tkfont && sv1->offset == sv2->offset;
#else
return sv1->tkfont == sv2->tkfont
diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c
index 9370b92..aeb5681 100644
--- a/generic/tkTextImage.c
+++ b/generic/tkTextImage.c
@@ -4,7 +4,7 @@
* 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.
+ * Copyright © 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.
@@ -290,8 +290,12 @@ TkTextImageCmd(
(const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr),
-1));
}
- Tcl_SetObjResult(interp, resultObj);
- return TCL_OK;
+ if (resultObj == NULL) {
+ return TCL_ERROR;
+ } else {
+ Tcl_SetObjResult(interp, resultObj);
+ return TCL_OK;
+ }
}
default:
Tcl_Panic("unexpected switch fallthrough");
@@ -447,14 +451,12 @@ EmbImageConfigure(
static int
EmbImageDeleteProc(
TkTextSegment *eiPtr, /* Segment being deleted. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
Tcl_HashEntry *hPtr;
- (void)linePtr;
- (void)treeGone;
if (eiPtr->body.ei.image != NULL) {
hPtr = Tcl_FindHashEntry(&eiPtr->body.ei.sharedTextPtr->imageTable,
@@ -531,17 +533,17 @@ EmbImageCleanupProc(
static int
EmbImageLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *eiPtr, /* Segment corresponding to indexPtr. */
TkSizeT offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- TkSizeT maxChars, /* Chunk must not include more than this many
+ TCL_UNUSED(TkSizeT), /* 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:
+ TCL_UNUSED(TkWrapMode), /* Wrap mode to use for line:
* TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
* TEXT_WRAPMODE_WORD. */
TkTextDispChunk *chunkPtr)
@@ -550,9 +552,6 @@ EmbImageLayoutProc(
* set by the caller. */
{
int width, height;
- (void)indexPtr;
- (void)maxChars;
- (void)wrapMode;
if (offset != 0) {
Tcl_Panic("Non-zero offset in EmbImageLayoutProc");
@@ -622,10 +621,8 @@ EmbImageLayoutProc(
static void
EmbImageCheckProc(
TkTextSegment *eiPtr, /* Segment to check. */
- TkTextLine *linePtr) /* Line containing segment. */
+ TCL_UNUSED(TkTextLine *)) /* Line containing segment. */
{
- (void)linePtr;
-
if (eiPtr->nextPtr == NULL) {
Tcl_Panic("EmbImageCheckProc: embedded image is last segment in line");
}
@@ -665,16 +662,14 @@ EmbImageDisplayProc(
* (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. */
+ TCL_UNUSED(Display *), /* Display to use for drawing. */
Drawable dst, /* Pixmap or window in which to draw */
- int screenY) /* Y-coordinate in text window that
+ TCL_UNUSED(int)) /* Y-coordinate in text window that
* corresponds to y. */
{
TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData;
int lineX, imageX, imageY, width, height;
Tk_Image image;
- (void)display;
- (void)screenY;
image = eiPtr->body.ei.image;
if (image == NULL) {
@@ -720,9 +715,9 @@ EmbImageDisplayProc(
static void
EmbImageBboxProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
- int index, /* Index of desired character within the
+ TCL_UNUSED(int), /* Index of desired character within the
* chunk. */
int y, /* Topmost pixel in area allocated for this
* line. */
@@ -738,8 +733,6 @@ EmbImageBboxProc(
{
TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData;
Tk_Image image;
- (void)textPtr;
- (void)index;
image = eiPtr->body.ei.image;
if (image != NULL) {
@@ -830,21 +823,18 @@ TkTextImageIndex(
static void
EmbImageProc(
ClientData clientData, /* Pointer to widget record. */
- int x, int y, /* Upper left pixel (within image) that must
+ TCL_UNUSED(int), /* Upper left pixel (within image) that must
* be redisplayed. */
- int width, int height, /* Dimensions of area to redisplay (may be
+ TCL_UNUSED(int),
+ TCL_UNUSED(int), /* Dimensions of area to redisplay (may be
* <= 0). */
- int imgWidth, int imgHeight)/* New dimensions of image. */
+ TCL_UNUSED(int),
+ TCL_UNUSED(int),/* New dimensions of image. */
+ TCL_UNUSED(int))
{
TkTextSegment *eiPtr = (TkTextSegment *)clientData;
TkTextIndex index;
- (void)x;
- (void)y;
- (void)width;
- (void)height;
- (void)imgWidth;
- (void)imgHeight;
index.tree = eiPtr->body.ei.sharedTextPtr->tree;
index.linePtr = eiPtr->body.ei.linePtr;
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index 87816f4..eea8f50 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -4,8 +4,8 @@
* 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.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -62,7 +62,7 @@ static void UpdateStringOfTextIndex(Tcl_Obj *objPtr);
#define GET_INDEXEPOCH(objPtr) \
(PTR2INT((objPtr)->internalRep.twoPtrValue.ptr2))
#define SET_TEXTINDEX(objPtr, indexPtr) \
- ((objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (indexPtr))
+ ((objPtr)->internalRep.twoPtrValue.ptr1 = (void *)(indexPtr))
#define SET_INDEXEPOCH(objPtr, epoch) \
((objPtr)->internalRep.twoPtrValue.ptr2 = (void *) (size_t) (epoch))
diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c
index fe5a892..5d4b5d5 100644
--- a/generic/tkTextMark.c
+++ b/generic/tkTextMark.c
@@ -4,8 +4,8 @@
* 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.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -133,7 +133,7 @@ TkTextMarkCmd(
Tcl_WrongNumArgs(interp, 3, objv, "markName ?gravity?");
return TCL_ERROR;
}
- str = TkGetStringFromObj(objv[3], &length);
+ str = Tcl_GetStringFromObj(objv[3], &length);
if (length == 6 && !strcmp(str, "insert")) {
markPtr = textPtr->insertMarkPtr;
} else if (length == 7 && !strcmp(str, "current")) {
@@ -160,7 +160,7 @@ TkTextMarkCmd(
Tcl_SetObjResult(interp, Tcl_NewStringObj(typeStr, -1));
return TCL_OK;
}
- str = TkGetStringFromObj(objv[4],&length);
+ str = Tcl_GetStringFromObj(objv[4],&length);
c = str[0];
if ((c == 'l') && (strncmp(str, "left", length) == 0)) {
newTypePtr = &tkTextLeftMarkType;
@@ -501,16 +501,12 @@ TkTextMarkNameToIndex(
static int
MarkDeleteProc(
- TkTextSegment *segPtr, /* Segment being deleted. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextSegment *), /* Segment being deleted. */
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
- (void)segPtr;
- (void)linePtr;
- (void)treeGone;
-
return 1;
}
@@ -562,29 +558,22 @@ MarkCleanupProc(
static int
MarkLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *segPtr, /* Segment corresponding to indexPtr. */
- TkSizeT offset, /* Offset within segPtr corresponding to
+ TCL_UNUSED(TkSizeT), /* Offset within segPtr corresponding to
* indexPtr (always 0). */
- int maxX, /* Chunk must not occupy pixels at this
+ TCL_UNUSED(int), /* Chunk must not occupy pixels at this
* position or higher. */
- TkSizeT maxChars, /* Chunk must not include more than this many
+ TCL_UNUSED(TkSizeT), /* Chunk must not include more than this many
* characters. */
- int noCharsYet, /* Non-zero means no characters have been
+ TCL_UNUSED(int), /* Non-zero means no characters have been
* assigned to this line yet. */
- TkWrapMode wrapMode, /* Not used. */
+ TCL_UNUSED(TkWrapMode), /* Not used. */
TkTextDispChunk *chunkPtr)
/* Structure to fill in with information about
* this chunk. The x field has already been
* set by the caller. */
{
- (void)indexPtr;
- (void)offset;
- (void)maxX;
- (void)maxChars;
- (void)noCharsYet;
- (void)wrapMode;
-
if (segPtr != textPtr->insertMarkPtr) {
return -1;
}
@@ -628,15 +617,15 @@ MarkLayoutProc(
void
TkTextInsertDisplayProc(
TkText *textPtr, /* The current text widget. */
- TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
+ TCL_UNUSED(TkTextDispChunk *), /* 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. */
+ TCL_UNUSED(int), /* Offset of baseline from y. */
+ TCL_UNUSED(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. */
@@ -650,9 +639,6 @@ TkTextInsertDisplayProc(
int halfWidth = textPtr->insertWidth/2;
int rightSideWidth;
int ix = 0, iy = 0, iw = 0, ih = 0, charWidth = 0;
- (void)chunkPtr;
- (void)baseline;
- (void)display;
if (textPtr->insertCursorType) {
TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index);
@@ -735,12 +721,9 @@ TkTextInsertDisplayProc(
static void
InsertUndisplayProc(
- TkText *textPtr, /* Overall information about text widget. */
- TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
+ TCL_UNUSED(TkText *), /* Overall information about text widget. */
+ TCL_UNUSED(TkTextDispChunk *)) /* Chunk that is about to be freed. */
{
- (void)textPtr;
- (void)chunkPtr;
-
return;
}
diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c
index 0846e1e..1ffa602 100644
--- a/generic/tkTextTag.c
+++ b/generic/tkTextTag.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -357,7 +357,7 @@ TkTextTagCmd(
if (objc < 4) {
Tcl_WrongNumArgs(interp, 3, objv,
- "tagName ?-option? ?value? ?-option value ...?");
+ "tagName ?-option value ...?");
return TCL_ERROR;
}
tagPtr = TkTextCreateTag(textPtr, Tcl_GetString(objv[3]), &newTag);
@@ -1111,7 +1111,7 @@ FindTag(
TkSizeT len;
const char *str;
- str = TkGetStringFromObj(tagName, &len);
+ str = Tcl_GetStringFromObj(tagName, &len);
if (len == 3 && !strcmp(str, "sel")) {
return textPtr->selTagPtr;
}
@@ -1440,7 +1440,7 @@ ChangeTagPriority(
void
TkTextBindProc(
- ClientData clientData, /* Pointer to canvas structure. */
+ ClientData clientData, /* Pointer to text widget structure. */
XEvent *eventPtr) /* Pointer to X event that just happened. */
{
TkText *textPtr = (TkText *)clientData;
@@ -1459,7 +1459,7 @@ TkTextBindProc(
} else if (eventPtr->type == ButtonRelease) {
unsigned long mask;
- mask = TkGetButtonMask(eventPtr->xbutton.button);
+ mask = Tk_GetButtonMask(eventPtr->xbutton.button);
if ((eventPtr->xbutton.state & ALL_BUTTONS) == mask) {
textPtr->flags &= ~BUTTON_DOWN;
repick = 1;
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index 5b33a84..adf1ad5 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -22,13 +22,13 @@
static void EmbWinRequestProc(ClientData clientData,
Tk_Window tkwin);
-static void EmbWinLostSlaveProc(ClientData clientData,
+static void EmbWinLostContentProc(ClientData clientData,
Tk_Window tkwin);
static const Tk_GeomMgr textGeomType = {
"text", /* name */
EmbWinRequestProc, /* requestProc */
- EmbWinLostSlaveProc, /* lostSlaveProc */
+ EmbWinLostContentProc, /* lostContentProc */
};
/*
@@ -160,7 +160,6 @@ TkTextWindowCmd(
switch ((enum windOptions) optionIndex) {
case WIND_CGET: {
TkTextIndex index;
- TkTextSegment *ewPtr;
Tcl_Obj *objPtr;
TkTextEmbWindowClient *client;
@@ -201,7 +200,6 @@ TkTextWindowCmd(
}
case WIND_CONFIGURE: {
TkTextIndex index;
- TkTextSegment *ewPtr;
if (objc < 4) {
Tcl_WrongNumArgs(interp, 3, objv, "index ?-option value ...?");
@@ -443,7 +441,7 @@ EmbWinConfigure(
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
- badMaster:
+ badContainer:
Tcl_SetObjResult(textPtr->interp, Tcl_ObjPrintf(
"can't embed %s in %s",
Tk_PathName(ewPtr->body.ew.tkwin),
@@ -459,7 +457,7 @@ EmbWinConfigure(
}
if (Tk_TopWinHierarchy(ewPtr->body.ew.tkwin)
|| (ewPtr->body.ew.tkwin == textPtr->tkwin)) {
- goto badMaster;
+ goto badContainer;
}
if (client == NULL) {
@@ -576,12 +574,11 @@ EmbWinStructureProc(
static void
EmbWinRequestProc(
ClientData clientData, /* Pointer to record for window item. */
- Tk_Window tkwin) /* Window that changed its desired size. */
+ TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */
{
TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData;
TkTextSegment *ewPtr = client->parent;
TkTextIndex index;
- (void)tkwin;
index.tree = ewPtr->body.ew.sharedTextPtr->tree;
index.linePtr = ewPtr->body.ew.linePtr;
@@ -594,9 +591,9 @@ EmbWinRequestProc(
/*
*--------------------------------------------------------------
*
- * EmbWinLostSlaveProc --
+ * EmbWinLostContentProc --
*
- * This function is invoked by the Tk geometry manager when a slave
+ * This function is invoked by the Tk geometry manager when a content
* window managed by a text widget is claimed away by another geometry
* manager.
*
@@ -611,7 +608,7 @@ EmbWinRequestProc(
*/
static void
-EmbWinLostSlaveProc(
+EmbWinLostContentProc(
ClientData clientData, /* Pointer to record describing window item. */
Tk_Window tkwin) /* Window that was claimed away by another
* geometry manager. */
@@ -739,15 +736,13 @@ TkTextWinFreeClient(
static int
EmbWinDeleteProc(
TkTextSegment *ewPtr, /* Segment being deleted. */
- TkTextLine *linePtr, /* Line containing segment. */
- int treeGone) /* Non-zero means the entire tree is being
+ TCL_UNUSED(TkTextLine *), /* Line containing segment. */
+ TCL_UNUSED(int)) /* Non-zero means the entire tree is being
* deleted, so everything must get cleaned
* up. */
{
TkTextEmbWindowClient *client;
client = ewPtr->body.ew.clients;
- (void)linePtr;
- (void)treeGone;
while (client != NULL) {
TkTextEmbWindowClient *next = client->next;
@@ -820,17 +815,17 @@ EmbWinCleanupProc(
static int
EmbWinLayoutProc(
TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Identifies first character in chunk. */
+ TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */
TkTextSegment *ewPtr, /* Segment corresponding to indexPtr. */
TkSizeT offset, /* Offset within segPtr corresponding to
* indexPtr (always 0). */
int maxX, /* Chunk must not occupy pixels at this
* position or higher. */
- TkSizeT maxChars, /* Chunk must not include more than this many
+ TCL_UNUSED(TkSizeT), /* 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:
+ TCL_UNUSED(TkWrapMode), /* Wrap mode to use for line:
* TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
* TEXT_WRAPMODE_WORD. */
TkTextDispChunk *chunkPtr)
@@ -840,9 +835,6 @@ EmbWinLayoutProc(
{
int width, height;
TkTextEmbWindowClient *client;
- (void)indexPtr;
- (void)maxChars;
- (void)wrapMode;
if (offset != 0) {
Tcl_Panic("Non-zero offset in EmbWinLayoutProc");
@@ -939,12 +931,12 @@ EmbWinLayoutProc(
break;
}
if (Tk_TopWinHierarchy(ancestor)) {
- goto badMaster;
+ goto badContainer;
}
}
if (Tk_TopWinHierarchy(ewPtr->body.ew.tkwin)
|| (textPtr->tkwin == ewPtr->body.ew.tkwin)) {
- badMaster:
+ badContainer:
Tcl_SetObjResult(textPtr->interp, Tcl_ObjPrintf(
"can't embed %s relative to %s",
Tk_PathName(ewPtr->body.ew.tkwin),
@@ -1055,10 +1047,8 @@ EmbWinLayoutProc(
static void
EmbWinCheckProc(
TkTextSegment *ewPtr, /* Segment to check. */
- TkTextLine *linePtr) /* Line containing segment. */
+ TCL_UNUSED(TkTextLine *)) /* Line containing segment. */
{
- (void)linePtr;
-
if (ewPtr->nextPtr == NULL) {
Tcl_Panic("EmbWinCheckProc: embedded window is last segment in line");
}
@@ -1092,13 +1082,13 @@ TkTextEmbWinDisplayProc(
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:
+ TCL_UNUSED(int), /* 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
+ TCL_UNUSED(Display *), /* Display to use for drawing (unused). */
+ TCL_UNUSED(Drawable), /* Pixmap or window in which to draw
* (unused). */
int screenY) /* Y-coordinate in text window that
* corresponds to y. */
@@ -1107,9 +1097,6 @@ TkTextEmbWinDisplayProc(
Tk_Window tkwin;
TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData;
TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
- (void)y;
- (void)display;
- (void)dst;
if (client == NULL) {
return;
@@ -1236,7 +1223,7 @@ static void
EmbWinBboxProc(
TkText *textPtr, /* Information about text widget. */
TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
- int index, /* Index of desired character within the
+ TCL_UNUSED(int), /* Index of desired character within the
* chunk. */
int y, /* Topmost pixel in area allocated for this
* line. */
@@ -1253,7 +1240,6 @@ EmbWinBboxProc(
Tk_Window tkwin;
TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData;
TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr);
- (void)index;
if (client == NULL) {
tkwin = NULL;
diff --git a/generic/tkTrig.c b/generic/tkTrig.c
index c0691a5..c3549a3 100644
--- a/generic/tkTrig.c
+++ b/generic/tkTrig.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1992-1994 The Regents of the University of California.
+ * Copyright © 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.
diff --git a/generic/tkUndo.c b/generic/tkUndo.c
index 7494332..97ac25b 100644
--- a/generic/tkUndo.c
+++ b/generic/tkUndo.c
@@ -3,8 +3,8 @@
*
* This module provides the implementation of an undo stack.
*
- * Copyright (c) 2002 by Ludwig Callewaert.
- * Copyright (c) 2003-2004 by Vincent Darley.
+ * Copyright © 2002 Ludwig Callewaert.
+ * Copyright © 2003-2004 Vincent Darley.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/generic/tkUndo.h b/generic/tkUndo.h
index 490ede9..c5cc37e 100644
--- a/generic/tkUndo.h
+++ b/generic/tkUndo.h
@@ -3,7 +3,7 @@
*
* Declarations shared among the files that implement an undo stack.
*
- * Copyright (c) 2002 Ludwig Callewaert.
+ * Copyright © 2002 Ludwig Callewaert.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index f7b839a..1e9c334 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -4,8 +4,8 @@
* 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.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 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.
@@ -664,6 +664,7 @@ Tk_GetScrollInfo(
return TK_SCROLL_MOVETO;
} else if ((c == 's')
&& (strncmp(argv[2], "scroll", length) == 0)) {
+ double d;
if (argc != 5) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"wrong # args: should be \"%s %s %s\"",
@@ -671,9 +672,10 @@ Tk_GetScrollInfo(
Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", NULL);
return TK_SCROLL_ERROR;
}
- if (Tcl_GetInt(interp, argv[3], intPtr) != TCL_OK) {
+ if (Tcl_GetDouble(interp, argv[3], &d) != TCL_OK) {
return TK_SCROLL_ERROR;
}
+ *intPtr = (d > 0) ? ceil(d) : floor(d);
length = strlen(argv[4]);
c = argv[4][0];
if ((c == 'p') && (strncmp(argv[4], "pages", length) == 0)) {
@@ -729,7 +731,7 @@ Tk_GetScrollInfoObj(
* scroll, if any. */
{
TkSizeT length;
- const char *arg = TkGetStringFromObj(objv[2], &length);
+ const char *arg = Tcl_GetStringFromObj(objv[2], &length);
#define ArgPfxEq(str) \
((arg[0] == str[0]) && !strncmp(arg, str, length))
@@ -744,15 +746,20 @@ Tk_GetScrollInfoObj(
}
return TK_SCROLL_MOVETO;
} else if (ArgPfxEq("scroll")) {
+ double d;
if (objc != 5) {
Tcl_WrongNumArgs(interp, 2, objv, "scroll number pages|units");
return TK_SCROLL_ERROR;
}
- if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) {
+ if (Tcl_GetDoubleFromObj(interp, objv[3], &d) != TCL_OK) {
return TK_SCROLL_ERROR;
}
+ *intPtr = (d >= 0) ? ceil(d) : floor(d);
+ if (dblPtr) {
+ *dblPtr = d;
+ }
- arg = TkGetStringFromObj(objv[4], &length);
+ arg = Tcl_GetStringFromObj(objv[4], &length);
if (ArgPfxEq("pages")) {
return TK_SCROLL_PAGES;
} else if (ArgPfxEq("units")) {
@@ -1130,7 +1137,7 @@ TkMakeEnsemble(
dictObj = Tcl_NewObj();
for (i = 0; map[i].name != NULL ; ++i) {
- Tcl_Obj *nameObj, *fqdnObj;
+ Tcl_Obj *fqdnObj;
nameObj = Tcl_NewStringObj(map[i].name, -1);
fqdnObj = Tcl_NewStringObj(Tcl_DStringValue(&ds),
@@ -1157,7 +1164,7 @@ TkMakeEnsemble(
/*
*----------------------------------------------------------------------
*
- * TkSendVirtualEvent --
+ * Tk_SendVirtualEvent --
*
* Send a virtual event notification to the specified target window.
* Equivalent to:
@@ -1170,7 +1177,7 @@ TkMakeEnsemble(
*/
void
-TkSendVirtualEvent(
+Tk_SendVirtualEvent(
Tk_Window target,
const char *eventName,
Tcl_Obj *detail)
@@ -1305,19 +1312,6 @@ TkUtfPrev(
}
#endif
-
-#if TCL_MAJOR_VERSION > 8
-unsigned char *
-TkGetByteArrayFromObj(
- Tcl_Obj *objPtr,
- size_t *lengthPtr
-) {
- unsigned char *result = Tcl_GetByteArrayFromObj(objPtr, NULL);
- *lengthPtr = *(size_t *) objPtr->internalRep.twoPtrValue.ptr1;
- return result;
-}
-#endif /* TCL_MAJOR_VERSION > 8 */
-
/*
* Local Variables:
* mode: c
diff --git a/generic/tkVisual.c b/generic/tkVisual.c
index 04afcbc..09d1fa1 100644
--- a/generic/tkVisual.c
+++ b/generic/tkVisual.c
@@ -5,8 +5,8 @@
* 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.
+ * Copyright © 1994 The Regents of the University of California.
+ * Copyright © 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.
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 900a267..c675304 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -5,15 +5,15 @@
* 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.
+ * Copyright © 1989-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
#include "tkInt.h"
-
+#include "tkPort.h"
#ifdef _WIN32
#include "tkWinInt.h"
#elif !defined(MAC_OSX_TK)
@@ -239,8 +239,6 @@ TkCloseDisplay(
{
TkClipCleanup(dispPtr);
- TkpCancelWarp(dispPtr);
-
if (dispPtr->name != NULL) {
ckfree(dispPtr->name);
}
@@ -1644,7 +1642,7 @@ Tk_MapWindow(
event.xmap.event = winPtr->window;
event.xmap.window = winPtr->window;
event.xmap.override_redirect = winPtr->atts.override_redirect;
- Tk_HandleEvent(&event);
+ TkpHandleMapOrUnmap((Tk_Window)winPtr, &event);
}
/*
@@ -1806,7 +1804,7 @@ Tk_UnmapWindow(
event.xunmap.event = winPtr->window;
event.xunmap.window = winPtr->window;
event.xunmap.from_configure = False;
- Tk_HandleEvent(&event);
+ TkpHandleMapOrUnmap((Tk_Window)winPtr, &event);
}
}
@@ -2694,7 +2692,7 @@ Tk_GetNumMainWindows(void)
/*
*----------------------------------------------------------------------
*
- * TkpAlwaysShowSelection --
+ * Tk_AlwaysShowSelection --
*
* Indicates whether text/entry widgets should always display
* their selection, regardless of window focus.
@@ -2712,7 +2710,7 @@ Tk_GetNumMainWindows(void)
*/
int
-TkpAlwaysShowSelection(
+Tk_AlwaysShowSelection(
Tk_Window tkwin) /* Window whose application is to be
* checked. */
{
@@ -2961,7 +2959,7 @@ Tk_SafeInit(
* Current risks:
*
* - No CPU time limit, no memory allocation limits, no color limits.
- * CPU time limits can be imposed by an unsafe master interpreter.
+ * CPU time limits can be imposed by an unsafe parent interpreter.
*
* The actual code called is the same as Tk_Init but Tcl_IsSafe() is
* checked at several places to differentiate the two initialisations.
@@ -3081,24 +3079,24 @@ Initialize(
if (Tcl_IsSafe(interp)) {
/*
* Get the clearance to start Tk and the "argv" parameters from the
- * master.
+ * parent.
*/
/*
- * Step 1 : find the master and construct the interp name (could be a
+ * Step 1 : find the parent 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;
+ Tcl_Interp *parent = interp;
- while (Tcl_IsSafe(master)) {
- master = Tcl_GetMaster(master);
- if (master == NULL) {
+ while (Tcl_IsSafe(parent)) {
+ parent = Tcl_GetParent(parent);
+ if (parent == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
- "no controlling master interpreter", -1));
- Tcl_SetErrorCode(interp, "TK", "SAFE", "NO_MASTER", NULL);
+ "no controlling parent interpreter", -1));
+ Tcl_SetErrorCode(interp, "TK", "SAFE", "NO_PARENT", NULL);
return TCL_ERROR;
}
}
@@ -3107,35 +3105,35 @@ Initialize(
* Construct the name (rewalk...)
*/
- code = Tcl_GetInterpPath(master, interp);
+ code = Tcl_GetInterpPath(parent, interp);
if (code != TCL_OK) {
Tcl_Panic("Tcl_GetInterpPath broken!");
}
/*
- * Build the command to eval in trusted master.
+ * Build the command to eval in trusted parent.
*/
cmd = Tcl_NewListObj(2, NULL);
Tcl_ListObjAppendElement(NULL, cmd,
Tcl_NewStringObj("::safe::TkInit", -1));
- Tcl_ListObjAppendElement(NULL, cmd, Tcl_GetObjResult(master));
+ Tcl_ListObjAppendElement(NULL, cmd, Tcl_GetObjResult(parent));
/*
- * Step 2 : Eval in the master. The argument is the *reversed* interp
- * path of the slave.
+ * Step 2 : Eval in the parent. The argument is the *reversed* interp
+ * path of the child.
*/
Tcl_IncrRefCount(cmd);
- code = Tcl_EvalObjEx(master, cmd, 0);
+ code = Tcl_EvalObjEx(parent, cmd, 0);
Tcl_DecrRefCount(cmd);
- Tcl_TransferResult(master, code, interp);
+ Tcl_TransferResult(parent, code, interp);
if (code != TCL_OK) {
return code;
}
/*
- * Use the master's result as argv. Note: We don't use the Obj
+ * Use the parent's result as argv. Note: We don't use the Obj
* interfaces to avoid dealing with cross interp refcounting and
* changing the code below.
*/
@@ -3203,7 +3201,7 @@ Initialize(
{
TkSizeT numBytes;
- const char *bytes = TkGetStringFromObj(nameObj, &numBytes);
+ const char *bytes = Tcl_GetStringFromObj(nameObj, &numBytes);
classObj = Tcl_NewStringObj(bytes, numBytes);
@@ -3285,10 +3283,14 @@ Initialize(
}
/*
- * Provide Tk and its stub table.
+ * Provide "tk" and its stub table.
*/
- code = Tcl_PkgProvideEx(interp, "Tk", TK_PATCH_LEVEL,
+#ifndef TK_NO_DEPRECATED
+ Tcl_PkgProvideEx(interp, "Tk", TK_PATCH_LEVEL,
+ (ClientData) &tkStubs);
+#endif
+ code = Tcl_PkgProvideEx(interp, "tk", TK_PATCH_LEVEL,
(ClientData) &tkStubs);
if (code != TCL_OK) {
goto done;
@@ -3383,7 +3385,7 @@ Tk_PkgInitStubsCheck(
const char * version,
int exact)
{
- const char *actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, 0, NULL);
+ const char *actualVersion = Tcl_PkgRequireEx(interp, "tk", version, 0, NULL);
if (exact && actualVersion) {
const char *p = version;
@@ -3395,11 +3397,11 @@ Tk_PkgInitStubsCheck(
if (count == 1) {
if (0 != strncmp(version, actualVersion, strlen(version))) {
/* Construct error message */
- Tcl_PkgPresentEx(interp, "Tk", version, 1, NULL);
+ Tcl_PkgPresentEx(interp, "tk", version, 1, NULL);
return NULL;
}
} else {
- return Tcl_PkgPresentEx(interp, "Tk", version, 1, NULL);
+ return Tcl_PkgPresentEx(interp, "tk", version, 1, NULL);
}
}
return actualVersion;
diff --git a/generic/ttk/ttkBlink.c b/generic/ttk/ttkBlink.c
index dcd342c..fc48af9 100644
--- a/generic/ttk/ttkBlink.c
+++ b/generic/ttk/ttkBlink.c
@@ -59,7 +59,7 @@ static CursorManager *GetCursorManager(Tcl_Interp *interp)
cm->owner = 0;
cm->onTime = DEF_CURSOR_ON_TIME;
cm->offTime = DEF_CURSOR_OFF_TIME;
- Tcl_SetAssocData(interp,cm_key,CursorManagerDeleteProc,(ClientData)cm);
+ Tcl_SetAssocData(interp, cm_key, CursorManagerDeleteProc, cm);
}
return cm;
}
diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c
index 9712c66..5c5e353 100644
--- a/generic/ttk/ttkButton.c
+++ b/generic/ttk/ttkButton.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Joe English
+ * Copyright © 2003, Joe English
*
* label, button, checkbutton, radiobutton, and menubutton widgets.
*/
@@ -85,7 +85,7 @@ static const Tk_OptionSpec BaseOptionSpecs[] =
*/
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
NULL, offsetof(Base,base.compoundObj), TCL_INDEX_NONE,
- TK_OPTION_NULL_OK,(void *)ttkCompoundStrings,
+ TK_OPTION_NULL_OK, (void *)ttkCompoundStrings,
GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-padding", "padding", "Pad",
NULL, offsetof(Base,base.paddingObj), TCL_INDEX_NONE,
@@ -273,11 +273,12 @@ static const Tk_OptionSpec LabelOptionSpecs[] =
};
static const Ttk_Ensemble LabelCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
- { "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
@@ -378,12 +379,13 @@ ButtonInvokeCommand(
}
static const Ttk_Ensemble ButtonCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
- { "invoke", ButtonInvokeCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
+ { "invoke", ButtonInvokeCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
- { "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
@@ -585,12 +587,13 @@ CheckbuttonInvokeCommand(
}
static const Ttk_Ensemble CheckbuttonCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
- { "invoke", CheckbuttonInvokeCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
+ { "invoke", CheckbuttonInvokeCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
- { "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
/* MISSING: select, deselect, toggle */
{ 0,0,0 }
};
@@ -761,12 +764,13 @@ RadiobuttonInvokeCommand(
}
static const Ttk_Ensemble RadiobuttonCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
- { "invoke", RadiobuttonInvokeCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
+ { "invoke", RadiobuttonInvokeCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
- { "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
/* MISSING: select, deselect */
{ 0,0,0 }
};
@@ -823,7 +827,7 @@ static const Tk_OptionSpec MenubuttonOptionSpecs[] =
"", offsetof(Menubutton, menubutton.menuObj), TCL_INDEX_NONE, 0,0,0},
{TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction",
"below", offsetof(Menubutton, menubutton.directionObj), TCL_INDEX_NONE,
- 0,(ClientData)directionStrings,GEOMETRY_CHANGED},
+ 0, (void *)directionStrings, GEOMETRY_CHANGED},
WIDGET_TAKEFOCUS_TRUE,
WIDGET_INHERIT_OPTIONS(BaseOptionSpecs)
@@ -835,6 +839,7 @@ static const Ttk_Ensemble MenubuttonCommands[] = {
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
@@ -858,7 +863,7 @@ 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_GROUP("Menubutton.padding", TTK_FILL_X,
TTK_NODE("Menubutton.label", TTK_PACK_LEFT))))
TTK_END_LAYOUT
diff --git a/generic/ttk/ttkCache.c b/generic/ttk/ttkCache.c
index 9059c55..412a1a1 100644
--- a/generic/ttk/ttkCache.c
+++ b/generic/ttk/ttkCache.c
@@ -1,7 +1,7 @@
/*
* Theme engine resource cache.
*
- * Copyright (c) 2004, Joe English
+ * Copyright © 2004, Joe English
*
* The problem:
*
diff --git a/generic/ttk/ttkClamTheme.c b/generic/ttk/ttkClamTheme.c
index dae54e4..60e9df3 100644
--- a/generic/ttk/ttkClamTheme.c
+++ b/generic/ttk/ttkClamTheme.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004 Joe English
+ * Copyright © 2004 Joe English
*
* "clam" theme; inspired by the XFCE family of Gnome themes.
*/
@@ -955,7 +955,7 @@ 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.field", TTK_FILL_BOTH,
TTK_GROUP("Combobox.padding", TTK_FILL_BOTH,
TTK_NODE("Combobox.textarea", TTK_FILL_BOTH))))
diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c
index ec35480..c3aaee8 100644
--- a/generic/ttk/ttkClassicTheme.c
+++ b/generic/ttk/ttkClassicTheme.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Joe English
+ * Copyright © 2004, Joe English
*
* "classic" theme; implements the classic Motif-like Tk look.
*
@@ -453,7 +453,7 @@ 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_GROUP("Menubutton.padding", TTK_FILL_X,
TTK_NODE("Menubutton.label", 0)))))
/* "classic" entry, includes highlight border */
diff --git a/generic/ttk/ttkDecls.h b/generic/ttk/ttkDecls.h
index 5f76634..2b074ac 100644
--- a/generic/ttk/ttkDecls.h
+++ b/generic/ttk/ttkDecls.h
@@ -13,7 +13,11 @@ extern const char *TtkInitializeStubs(
interp, TTK_VERSION, TTK_STUBS_EPOCH, TTK_STUBS_REVISION)
#else
-#define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "Ttk", TTK_VERSION, 0, NULL)
+#if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9
+# define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "Ttk", TTK_VERSION, 0, NULL)
+#else
+# define Ttk_InitStubs(interp) Tcl_PkgRequireEx(interp, "ttk", TTK_VERSION, 0, NULL)
+#endif
#endif
diff --git a/generic/ttk/ttkDefaultTheme.c b/generic/ttk/ttkDefaultTheme.c
index a614894..1acdcbc 100644
--- a/generic/ttk/ttkDefaultTheme.c
+++ b/generic/ttk/ttkDefaultTheme.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Joe English
+ * Copyright © 2003 Joe English
*
* Tk alternate theme, intended to match the MSUE and Gtk's (old) default theme
*/
diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c
index a1cac4d..e2626e5 100644
--- a/generic/ttk/ttkElements.c
+++ b/generic/ttk/ttkElements.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Joe English
+ * Copyright © 2003 Joe English
*
* Default implementation for themed elements.
*
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index cbc3b3f..cc6c6af 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -1,11 +1,11 @@
/*
* 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
+ * Copyright © 1990-1994 The Regents of the University of California.
+ * Copyright © 1994-1997 Sun Microsystems, Inc.
+ * Copyright © 2000 Ajuba Solutions.
+ * Copyright © 2002 ActiveState Corporation.
+ * Copyright © 2004 Joe English
*/
#include "tkInt.h"
@@ -181,7 +181,7 @@ static const Tk_OptionSpec EntryOptionSpecs[] = {
TK_OPTION_NULL_OK,0,TEXTVAR_CHANGED},
{TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate",
"none", TCL_INDEX_NONE, offsetof(Entry, entry.validate),
- 0, (ClientData) validateStrings, 0},
+ 0, (void *) validateStrings, 0},
{TK_OPTION_STRING, "-validatecommand", "validateCommand", "ValidateCommand",
NULL, TCL_INDEX_NONE, offsetof(Entry, entry.validateCmd),
TK_OPTION_NULL_OK, 0, 0},
@@ -325,7 +325,7 @@ static void EntryUpdateTextLayout(Entry *entryPtr)
0/*wraplength*/, entryPtr->entry.justify, TK_IGNORE_NEWLINES,
&entryPtr->entry.layoutWidth, &entryPtr->entry.layoutHeight);
} else {
- text = TkGetStringFromObj(entryPtr->entry.placeholderObj, &length);
+ text = Tcl_GetStringFromObj(entryPtr->entry.placeholderObj, &length);
entryPtr->entry.textLayout = Tk_ComputeTextLayout(
Tk_GetFontFromObj(entryPtr->core.tkwin, entryPtr->entry.fontObj),
text, length,
@@ -403,7 +403,7 @@ static void EntryOwnSelection(Entry *entryPtr)
&& (!Tcl_IsSafe(entryPtr->core.interp))
&& !(entryPtr->core.flags & GOT_SELECTION)) {
Tk_OwnSelection(entryPtr->core.tkwin, XA_PRIMARY, EntryLostSelection,
- (ClientData) entryPtr);
+ entryPtr);
entryPtr->core.flags |= GOT_SELECTION;
}
}
@@ -600,9 +600,9 @@ EntryValidateChange(
VMODE vmode = entryPtr->entry.validate;
int code, change_ok;
- if ( (entryPtr->entry.validateCmd == NULL)
+ if ((entryPtr->entry.validateCmd == NULL)
|| (entryPtr->core.flags & VALIDATING)
- || !EntryNeedsValidation(vmode, reason) )
+ || !EntryNeedsValidation(vmode, reason))
{
return TCL_OK;
}
@@ -958,7 +958,7 @@ EntryInitialize(Tcl_Interp *dummy, void *recordPtr)
Tk_CreateEventHandler(
entryPtr->core.tkwin, EntryEventMask, EntryEventProc, entryPtr);
Tk_CreateSelHandler(entryPtr->core.tkwin, XA_PRIMARY, XA_STRING,
- EntryFetchSelection, (ClientData) entryPtr, XA_STRING);
+ EntryFetchSelection, entryPtr, XA_STRING);
TtkBlinkCursor(&entryPtr->core);
entryPtr->entry.string = (char *)ckalloc(1);
@@ -1312,21 +1312,32 @@ static void EntryDisplay(void *clientData, Drawable d)
}
/* Use placeholder text width */
leftIndex = 0;
- (void)TkGetStringFromObj(entryPtr->entry.placeholderObj, &rightIndex);
+ (void)Tcl_GetStringFromObj(entryPtr->entry.placeholderObj, &rightIndex);
} else {
foregroundObj = es.foregroundObj;
}
gc = EntryGetGC(entryPtr, foregroundObj, clipRegion);
- Tk_DrawTextLayout(
- Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
- entryPtr->entry.layoutX, entryPtr->entry.layoutY,
- leftIndex, rightIndex);
- XSetClipMask(Tk_Display(tkwin), gc, None);
- Tk_FreeGC(Tk_Display(tkwin), gc);
-
- /* Overwrite the selected portion (if any) in the -selectforeground color:
- */
if (showSelection) {
+
+ /* Draw the selected and unselected portions separately.
+ */
+ if (leftIndex < selFirst) {
+ Tk_DrawTextLayout(
+ Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
+ entryPtr->entry.layoutX, entryPtr->entry.layoutY,
+ leftIndex, selFirst);
+ }
+ if (selLast < rightIndex) {
+ Tk_DrawTextLayout(
+ Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
+ entryPtr->entry.layoutX, entryPtr->entry.layoutY,
+ selLast, rightIndex);
+ }
+ XSetClipMask(Tk_Display(tkwin), gc, None);
+ Tk_FreeGC(Tk_Display(tkwin), gc);
+
+ /* Draw the selected portion in the -selectforeground color:
+ */
gc = EntryGetGC(entryPtr, es.selForegroundObj, clipRegion);
Tk_DrawTextLayout(
Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
@@ -1334,6 +1345,16 @@ static void EntryDisplay(void *clientData, Drawable d)
selFirst, selLast);
XSetClipMask(Tk_Display(tkwin), gc, None);
Tk_FreeGC(Tk_Display(tkwin), gc);
+ } else {
+
+ /* Draw the entire visible text
+ */
+ Tk_DrawTextLayout(
+ Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout,
+ entryPtr->entry.layoutX, entryPtr->entry.layoutY,
+ leftIndex, rightIndex);
+ XSetClipMask(Tk_Display(tkwin), gc, None);
+ Tk_FreeGC(Tk_Display(tkwin), gc);
}
/* Drop the region. Note that we have to manually remove the reference to
@@ -1372,14 +1393,14 @@ EntryIndex(
const char *string;
if (TCL_OK == TkGetIntForIndex(indexObj, entryPtr->entry.numChars - 1, 1, &idx)) {
- if (idx + 1 > entryPtr->entry.numChars + 1) {
+ if ((idx != TCL_INDEX_NONE) && (idx > entryPtr->entry.numChars)) {
idx = entryPtr->entry.numChars;
}
*indexPtr = idx;
return TCL_OK;
}
- string = TkGetStringFromObj(indexObj, &length);
+ string = Tcl_GetStringFromObj(indexObj, &length);
if (strncmp(string, "insert", length) == 0) {
*indexPtr = entryPtr->entry.insertPos;
@@ -1556,7 +1577,7 @@ EntryIndexCommand(
if (EntryIndex(interp, entryPtr, objv[2], &index) != TCL_OK) {
return TCL_ERROR;
}
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
return TCL_OK;
}
@@ -1629,7 +1650,7 @@ static int EntrySelectionRangeCommand(
Tcl_WrongNumArgs(interp, 3, objv, "start end");
return TCL_ERROR;
}
- if ( EntryIndex(interp, entryPtr, objv[3], &start) != TCL_OK
+ if (EntryIndex(interp, entryPtr, objv[3], &start) != TCL_OK
|| EntryIndex(interp, entryPtr, objv[4], &end) != TCL_OK) {
return TCL_ERROR;
}
@@ -1690,7 +1711,7 @@ static int EntryValidateCommand(
if (code == TCL_ERROR)
return code;
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(code == TCL_OK));
+ Tcl_SetObjResult(interp, Tcl_NewBooleanObj(code == TCL_OK));
return TCL_OK;
}
@@ -1724,6 +1745,7 @@ static const Ttk_Ensemble EntryCommands[] = {
{ "instate", TtkWidgetInstateCommand,0 },
{ "selection", 0,EntrySelectionCommands },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ "validate", EntryValidateCommand,0 },
{ "xview", EntryXViewCommand,0 },
{ 0,0,0 }
@@ -1828,7 +1850,7 @@ static int ComboboxCurrentCommand(
if (objc == 2) {
/* Check if currentIndex still valid:
*/
- if ( currentIndex == TCL_INDEX_NONE
+ if (currentIndex == TCL_INDEX_NONE
|| currentIndex >= (TkSizeT)nValues
|| strcmp(currentValue,Tcl_GetString(values[currentIndex]))
)
@@ -1846,7 +1868,7 @@ static int ComboboxCurrentCommand(
}
}
cbPtr->combobox.currentIndex = currentIndex;
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj((int)currentIndex));
+ Tcl_SetObjResult(interp, TkNewIndexObj(currentIndex));
return TCL_OK;
} else if (objc == 3) {
TkSizeT idx;
@@ -1892,8 +1914,9 @@ static const Ttk_Ensemble ComboboxCommands[] = {
{ "insert", EntryInsertCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "selection", 0,EntrySelectionCommands },
- { "state", TtkWidgetStateCommand,0 },
{ "set", EntrySetCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ "validate", EntryValidateCommand,0 },
{ "xview", EntryXViewCommand,0 },
{ 0,0,0 }
@@ -2004,8 +2027,9 @@ static const Ttk_Ensemble SpinboxCommands[] = {
{ "insert", EntryInsertCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "selection", 0,EntrySelectionCommands },
- { "state", TtkWidgetStateCommand,0 },
{ "set", EntrySetCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ "validate", EntryValidateCommand,0 },
{ "xview", EntryXViewCommand,0 },
{ 0,0,0 }
@@ -2088,7 +2112,7 @@ 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_GROUP("Combobox.padding", TTK_FILL_BOTH,
TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))
TTK_END_LAYOUT
diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c
index 7c43bce..59a576e 100644
--- a/generic/ttk/ttkFrame.c
+++ b/generic/ttk/ttkFrame.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Joe English
+ * Copyright © 2004 Joe English
*
* ttk::frame and ttk::labelframe widgets.
*/
@@ -48,11 +48,12 @@ static const Tk_OptionSpec FrameOptionSpecs[] = {
};
static const Ttk_Ensemble FrameCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
- { "identify", TtkWidgetIdentifyCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
@@ -88,12 +89,12 @@ static Ttk_Padding FrameMargins(Frame *framePtr)
* 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)
+static int FrameSize(
+ void *recordPtr,
+ TCL_UNUSED(int *),
+ TCL_UNUSED(int *))
{
Frame *framePtr = (Frame *)recordPtr;
- (void)widthPtr;
- (void)heightPtr;
-
Ttk_SetMargins(framePtr->core.tkwin, FrameMargins(framePtr));
return 0;
}
@@ -340,15 +341,16 @@ LabelframeLabelSize(Labelframe *lframePtr, int *widthPtr, int *heightPtr)
* 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)
+static int LabelframeSize(
+ void *recordPtr,
+ TCL_UNUSED(int *),
+ TCL_UNUSED(int *))
{
Labelframe *lframePtr = (Labelframe *)recordPtr;
WidgetCore *corePtr = &lframePtr->core;
Ttk_Padding margins;
LabelframeStyle style;
int labelWidth, labelHeight;
- (void)widthPtr;
- (void)heightPtr;
LabelframeStyleOptions(lframePtr, &style);
@@ -460,7 +462,7 @@ static void LabelframeDoLayout(void *recordPtr)
Ttk_PlaceLayout(
lframePtr->label.labelLayout, corePtr->state, labelParcel);
}
- /* labelWidget placed in LabelframePlaceSlaves GM hook */
+ /* labelWidget placed in LabelframePlaceContent GM hook */
lframePtr->label.labelParcel = labelParcel;
}
@@ -476,29 +478,28 @@ static void LabelframeDisplay(void *recordPtr, Drawable d)
/* +++ Labelframe geometry manager hooks.
*/
-/* LabelframePlaceSlaves --
+/* LabelframePlaceContent --
* Sets the position and size of the labelwidget.
*/
-static void LabelframePlaceSlaves(void *recordPtr)
+static void LabelframePlaceContent(void *recordPtr)
{
Labelframe *lframe = (Labelframe *)recordPtr;
- if (Ttk_NumberSlaves(lframe->label.mgr) == 1) {
+ if (Ttk_NumberContent(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);
+ /* ASSERT: content #0 is lframe->label.labelWidget */
+ Ttk_PlaceContent(lframe->label.mgr, 0, b.x,b.y,b.width,b.height);
}
}
-static int LabelRequest(void *managerData, TkSizeT index, int width, int height)
+static int LabelRequest(
+ TCL_UNUSED(void *),
+ TCL_UNUSED(TkSizeT),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int))
{
- (void)managerData;
- (void)index;
- (void)width;
- (void)height;
-
return 1;
}
@@ -507,20 +508,21 @@ static int LabelRequest(void *managerData, TkSizeT index, int width, int height)
*
* <<NOTE-LABELREMOVED>>:
* This routine is also called when the widget voluntarily forgets
- * the slave in LabelframeConfigure.
+ * the window in LabelframeConfigure.
*/
-static void LabelRemoved(void *managerData, TkSizeT slaveIndex)
+static void LabelRemoved(
+ void *managerData,
+ TCL_UNUSED(TkSizeT))
{
Labelframe *lframe = (Labelframe *)managerData;
- (void)slaveIndex;
lframe->label.labelWidget = 0;
}
static Ttk_ManagerSpec LabelframeManagerSpec = {
- { "labelframe", Ttk_GeometryRequestProc, Ttk_LostSlaveProc },
+ { "labelframe", Ttk_GeometryRequestProc, Ttk_LostContentProc },
LabelframeSize,
- LabelframePlaceSlaves,
+ LabelframePlaceContent,
LabelRequest,
LabelRemoved
};
@@ -528,10 +530,11 @@ static Ttk_ManagerSpec LabelframeManagerSpec = {
/* LabelframeInitialize --
* Initialization hook.
*/
-static void LabelframeInitialize(Tcl_Interp *dummy, void *recordPtr)
+static void LabelframeInitialize(
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr)
{
Labelframe *lframe = (Labelframe *)recordPtr;
- (void)dummy;
lframe->label.mgr = Ttk_CreateManager(
&LabelframeManagerSpec, lframe, lframe->core.tkwin);
@@ -603,15 +606,15 @@ static int LabelframeConfigure(Tcl_Interp *interp,void *recordPtr,int mask)
/* Update -labelwidget changes, if any:
*/
if (mask & LABELWIDGET_CHANGED) {
- if (Ttk_NumberSlaves(lframePtr->label.mgr) == 1) {
- Ttk_ForgetSlave(lframePtr->label.mgr, 0);
+ if (Ttk_NumberContent(lframePtr->label.mgr) == 1) {
+ Ttk_ForgetContent(lframePtr->label.mgr, 0);
/* Restore labelWidget field (see <<NOTE-LABELREMOVED>>)
*/
lframePtr->label.labelWidget = labelWidget;
}
if (labelWidget) {
- Ttk_InsertSlave(lframePtr->label.mgr, 0, labelWidget, NULL);
+ Ttk_InsertContent(lframePtr->label.mgr, 0, labelWidget, NULL);
RaiseLabelWidget(lframePtr);
}
}
diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c
index e6ad27d..6609651 100644
--- a/generic/ttk/ttkImage.c
+++ b/generic/ttk/ttkImage.c
@@ -1,8 +1,8 @@
/*
* Image specifications and image element factory.
*
- * Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net>
- * Copyright (C) 2004 Joe English
+ * Copyright © 2004 Pat Thoyts <patthoyts@users.sf.net>
+ * Copyright © 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
@@ -263,7 +263,7 @@ typedef struct { /* ClientData for image elements */
Ttk_Padding border; /* Fixed border region */
Ttk_Padding padding; /* Internal padding */
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
Ttk_ResourceCache cache; /* Resource cache for images */
Ttk_StateMap imageMap; /* State-based lookup table for images */
#endif
@@ -273,7 +273,7 @@ static void FreeImageData(void *clientData)
{
ImageData *imageData = (ImageData *)clientData;
if (imageData->imageSpec) { TtkFreeImageSpec(imageData->imageSpec); }
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
if (imageData->imageMap) { Tcl_DecrRefCount(imageData->imageMap); }
#endif
ckfree(clientData);
@@ -311,7 +311,7 @@ static void ImageElementDraw(
Ttk_Box src, dst;
(void)elementRecord;
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
if (imageData->imageMap) {
Tcl_Obj *imageObj = Ttk_StateMapLookup(NULL,imageData->imageMap,state);
if (imageObj) {
@@ -383,7 +383,7 @@ Ttk_CreateImageElement(
imageData->minWidth = imageData->minHeight = -1;
imageData->sticky = TTK_FILL_BOTH;
imageData->border = imageData->padding = Ttk_UniformPadding(0);
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
imageData->cache = Ttk_GetResourceCache(interp);
imageData->imageMap = 0;
#endif
@@ -398,7 +398,7 @@ Ttk_CreateImageElement(
goto error;
}
-#if TILE_07_COMPAT
+#ifdef TILE_07_COMPAT
if (!strcmp("-map", Tcl_GetString(objv[i]))) {
imageData->imageMap = objv[i+1];
Tcl_IncrRefCount(imageData->imageMap);
diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c
index f14a2db..2672a0b 100644
--- a/generic/ttk/ttkInit.c
+++ b/generic/ttk/ttkInit.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Joe English
+ * Copyright © 2003 Joe English
*
* Ttk package: initialization routine and miscellaneous utilities.
*/
@@ -124,28 +124,6 @@ void TtkCheckStateOption(WidgetCore *corePtr, Tcl_Obj *objPtr)
# 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 virt;} 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.virt.name = Tk_GetUid(eventName);
-
- Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL);
-}
-
/* TtkEnumerateOptions, TtkGetOptionValue --
* Common factors for data accessor commands.
*/
@@ -293,7 +271,10 @@ Ttk_Init(Tcl_Interp *interp)
Ttk_PlatformInit(interp);
+#ifndef TK_NO_DEPRECATED
Tcl_PkgProvideEx(interp, "Ttk", TTK_PATCH_LEVEL, (void *)&ttkStubs);
+#endif
+ Tcl_PkgProvideEx(interp, "ttk", TTK_PATCH_LEVEL, (void *)&ttkStubs);
return TCL_OK;
}
diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c
index a4dbf96..6d254e8 100644
--- a/generic/ttk/ttkLabel.c
+++ b/generic/ttk/ttkLabel.c
@@ -569,13 +569,15 @@ static void LabelCleanup(LabelElement *c)
}
static void LabelElementSize(
- void *dummy, void *elementRecord, Tk_Window tkwin,
- int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+ TCL_UNUSED(void *),
+ void *elementRecord,
+ Tk_Window tkwin,
+ int *widthPtr,
+ int *heightPtr,
+ TCL_UNUSED(Ttk_Padding *))
{
LabelElement *label = (LabelElement *)elementRecord;
int textReqWidth = 0;
- (void)dummy;
- (void)paddingPtr;
LabelSetup(label, tkwin, 0);
@@ -628,12 +630,15 @@ static void DrawCompound(
}
static void LabelElementDraw(
- void *dummy, void *elementRecord, Tk_Window tkwin,
- Drawable d, Ttk_Box b, Ttk_State state)
+ TCL_UNUSED(void *),
+ void *elementRecord,
+ Tk_Window tkwin,
+ Drawable d,
+ Ttk_Box b,
+ Ttk_State state)
{
LabelElement *l = (LabelElement *)elementRecord;
Tk_Anchor anchor = TK_ANCHOR_CENTER;
- (void)dummy;
LabelSetup(l, tkwin, state);
diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c
index 5e8c69c..b91c24d 100644
--- a/generic/ttk/ttkLayout.c
+++ b/generic/ttk/ttkLayout.c
@@ -3,7 +3,7 @@
*
* Generic layout processing.
*
- * Copyright (c) 2003 Joe English. Freely redistributable.
+ * Copyright © 2003 Joe English. Freely redistributable.
*/
#include "tkInt.h"
@@ -36,10 +36,10 @@ 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);
+ result[0] = Tcl_NewWideIntObj(box.x);
+ result[1] = Tcl_NewWideIntObj(box.y);
+ result[2] = Tcl_NewWideIntObj(box.width);
+ result[3] = Tcl_NewWideIntObj(box.height);
return Tcl_NewListObj(4, result);
}
@@ -809,7 +809,7 @@ Tcl_Obj *Ttk_UnparseLayoutTemplate(Ttk_TemplateNode *node)
APPENDSTR("-sticky");
APPENDOBJ(Ttk_NewStickyObj(flags & _TTK_MASK_STICK));
- /* @@@ Check again: are these necessary? */
+ /* @@@ Check again: are these necessary? Can't see any effect! */
if (flags & TTK_BORDER) { APPENDSTR("-border"); APPENDSTR("1"); }
if (flags & TTK_UNIT) { APPENDSTR("-unit"); APPENDSTR("1"); }
diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c
index 2795570..0d41d21 100644
--- a/generic/ttk/ttkManager.c
+++ b/generic/ttk/ttkManager.c
@@ -10,59 +10,59 @@
/*------------------------------------------------------------------------
* +++ 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
+ * When a content window requests a new size or some other parameter changes,
+ * the manager recomputes the required size for the container 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
+ * If all goes well, the container's manager will process the request
+ * (and so on up the chain to the toplevel window), and the container
* window will eventually receive a <Configure> event. At this point
- * it recomputes the size and position of all slaves and places them.
+ * it recomputes the size and position of all content windows and places them.
*
- * If all does not go well, however, the master's request may be ignored
+ * If all does not go well, however, the container'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>>.
+ * +++ Content window removal <<NOTE-LOSTCONTENT>>.
*
- * There are three conditions under which a slave is removed:
+ * There are three conditions under which a content window is removed:
*
* (1) Another GM claims control
* (2) Manager voluntarily relinquishes control
- * (3) Slave is destroyed
+ * (3) Content window 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).
+ * In case (1), Tk calls the manager's lostContentProc.
+ * Case (2) is performed by calling Tk_ManageGeometry(window,NULL,0);
+ * in this case Tk does _not_ call the lostContentProc (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.
+ * register an event handler on the content window to track <Destroy> events.
*/
/* ++ Data structures.
*/
typedef struct
{
- Tk_Window slaveWindow;
+ Tk_Window window;
Ttk_Manager *manager;
- void *slaveData;
+ void *data;
unsigned flags;
-} Ttk_Slave;
+} Ttk_Content;
-/* slave->flags bits:
+/* content->flags bits:
*/
-#define SLAVE_MAPPED 0x1 /* slave to be mapped when master is */
+#define CONTENT_MAPPED 0x1 /* content windows to be mapped when container is */
struct TtkManager_
{
Ttk_ManagerSpec *managerSpec;
void *managerData;
- Tk_Window masterWindow;
+ Tk_Window window;
unsigned flags;
- TkSizeT nSlaves;
- Ttk_Slave **slaves;
+ TkSizeT nContent;
+ Ttk_Content **content;
};
/* manager->flags bits:
@@ -87,7 +87,7 @@ static void ScheduleUpdate(Ttk_Manager *mgr, unsigned flags)
}
/* ++ RecomputeSize --
- * Recomputes the required size of the master window,
+ * Recomputes the required size of the container window,
* makes geometry request.
*/
static void RecomputeSize(Ttk_Manager *mgr)
@@ -95,18 +95,18 @@ 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);
+ Tk_GeometryRequest(mgr->window, width, height);
ScheduleUpdate(mgr, MGR_RELAYOUT_REQUIRED);
}
mgr->flags &= ~MGR_RESIZE_REQUIRED;
}
/* ++ RecomputeLayout --
- * Recompute geometry of all slaves.
+ * Recompute geometry of all content windows.
*/
static void RecomputeLayout(Ttk_Manager *mgr)
{
- mgr->managerSpec->PlaceSlaves(mgr->managerData);
+ mgr->managerSpec->PlaceContent(mgr->managerData);
mgr->flags &= ~MGR_RELAYOUT_REQUIRED;
}
@@ -135,8 +135,8 @@ static void ManagerIdleProc(ClientData clientData)
*/
/* ++ ManagerEventHandler --
- * Recompute slave layout when master widget is resized.
- * Keep the slave's map state in sync with the master's.
+ * Recompute content layout when container widget is resized.
+ * Keep the content's map state in sync with the container's.
*/
static const int ManagerEventMask = StructureNotifyMask;
static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr)
@@ -150,56 +150,55 @@ static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr)
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);
+ for (i = 0; i < mgr->nContent; ++i) {
+ Ttk_Content *content = mgr->content[i];
+ if (content->flags & CONTENT_MAPPED) {
+ Tk_MapWindow(content->window);
}
}
break;
case UnmapNotify:
- for (i = 0; i < mgr->nSlaves; ++i) {
- Ttk_Slave *slave = mgr->slaves[i];
- Tk_UnmapWindow(slave->slaveWindow);
+ for (i = 0; i < mgr->nContent; ++i) {
+ Ttk_Content *content = mgr->content[i];
+ Tk_UnmapWindow(content->window);
}
break;
}
}
-/* ++ SlaveEventHandler --
- * Notifies manager when a slave is destroyed
- * (see <<NOTE-LOSTSLAVE>>).
+/* ++ ContentLostEventHandler --
+ * Notifies manager when a content window is destroyed
+ * (see <<NOTE-LOSTCONTENT>>).
*/
-static const unsigned SlaveEventMask = StructureNotifyMask;
-static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr)
+static void ContentLostEventHandler(void *clientData, XEvent *eventPtr)
{
- Ttk_Slave *slave = (Ttk_Slave *)clientData;
+ Ttk_Content *content = (Ttk_Content *)clientData;
if (eventPtr->type == DestroyNotify) {
- slave->manager->managerSpec->tkGeomMgr.lostSlaveProc(
- slave->manager, slave->slaveWindow);
+ content->manager->managerSpec->tkGeomMgr.lostContentProc(
+ content->manager, content->window);
}
}
/*------------------------------------------------------------------------
- * +++ Slave initialization and cleanup.
+ * +++ Content initialization and cleanup.
*/
-static Ttk_Slave *NewSlave(
- Ttk_Manager *mgr, Tk_Window slaveWindow, void *slaveData)
+static Ttk_Content *NewContent(
+ Ttk_Manager *mgr, Tk_Window window, void *data)
{
- Ttk_Slave *slave = (Ttk_Slave *)ckalloc(sizeof(*slave));
+ Ttk_Content *content = (Ttk_Content *)ckalloc(sizeof(Ttk_Content));
- slave->slaveWindow = slaveWindow;
- slave->manager = mgr;
- slave->flags = 0;
- slave->slaveData = slaveData;
+ content->window = window;
+ content->manager = mgr;
+ content->flags = 0;
+ content->data = data;
- return slave;
+ return content;
}
-static void DeleteSlave(Ttk_Slave *slave)
+static void DeleteContent(Ttk_Content *content)
{
- ckfree(slave);
+ ckfree(content);
}
/*------------------------------------------------------------------------
@@ -207,19 +206,19 @@ static void DeleteSlave(Ttk_Slave *slave)
*/
Ttk_Manager *Ttk_CreateManager(
- Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window masterWindow)
+ Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window window)
{
Ttk_Manager *mgr = (Ttk_Manager *)ckalloc(sizeof(*mgr));
mgr->managerSpec = managerSpec;
mgr->managerData = managerData;
- mgr->masterWindow = masterWindow;
- mgr->nSlaves = 0;
- mgr->slaves = NULL;
+ mgr->window = window;
+ mgr->nContent = 0;
+ mgr->content = NULL;
mgr->flags = 0;
Tk_CreateEventHandler(
- mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr);
+ mgr->window, ManagerEventMask, ManagerEventHandler, mgr);
return mgr;
}
@@ -227,13 +226,13 @@ Ttk_Manager *Ttk_CreateManager(
void Ttk_DeleteManager(Ttk_Manager *mgr)
{
Tk_DeleteEventHandler(
- mgr->masterWindow, ManagerEventMask, ManagerEventHandler, mgr);
+ mgr->window, ManagerEventMask, ManagerEventHandler, mgr);
- while (mgr->nSlaves > 0) {
- Ttk_ForgetSlave(mgr, mgr->nSlaves - 1);
+ while (mgr->nContent > 0) {
+ Ttk_ForgetContent(mgr, mgr->nContent - 1);
}
- if (mgr->slaves) {
- ckfree(mgr->slaves);
+ if (mgr->content) {
+ ckfree(mgr->content);
}
Tcl_CancelIdleCall(ManagerIdleProc, mgr);
@@ -242,67 +241,67 @@ void Ttk_DeleteManager(Ttk_Manager *mgr)
}
/*------------------------------------------------------------------------
- * +++ Slave management.
+ * +++ Content window management.
*/
-/* ++ InsertSlave --
- * Adds slave to the list of managed windows.
+/* ++ InsertContent --
+ * Adds content to the list of managed windows.
*/
-static void InsertSlave(Ttk_Manager *mgr, Ttk_Slave *slave, TkSizeT index)
+static void InsertContent(Ttk_Manager *mgr, Ttk_Content *content, TkSizeT index)
{
- TkSizeT endIndex = mgr->nSlaves++;
- mgr->slaves = (Ttk_Slave **)ckrealloc(mgr->slaves, mgr->nSlaves * sizeof(Ttk_Slave *));
+ TkSizeT endIndex = mgr->nContent++;
+ mgr->content = (Ttk_Content **)ckrealloc(mgr->content, mgr->nContent * sizeof(Ttk_Content *));
while (endIndex > index) {
- mgr->slaves[endIndex] = mgr->slaves[endIndex - 1];
+ mgr->content[endIndex] = mgr->content[endIndex - 1];
--endIndex;
}
- mgr->slaves[index] = slave;
+ mgr->content[index] = content;
- Tk_ManageGeometry(slave->slaveWindow,
- &mgr->managerSpec->tkGeomMgr, (ClientData)mgr);
+ Tk_ManageGeometry(content->window,
+ &mgr->managerSpec->tkGeomMgr, mgr);
- Tk_CreateEventHandler(slave->slaveWindow,
- SlaveEventMask, SlaveEventHandler, (ClientData)slave);
+ Tk_CreateEventHandler(content->window,
+ StructureNotifyMask, ContentLostEventHandler, content);
ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
}
-/* RemoveSlave --
- * Unmanage and delete the slave.
+/* RemoveContent --
+ * Unmanage and delete the content window.
*
* 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.
+ * routine is called from the content window's DestroyNotify event handler.
*/
-static void RemoveSlave(Ttk_Manager *mgr, TkSizeT index)
+static void RemoveContent(Ttk_Manager *mgr, TkSizeT index)
{
- Ttk_Slave *slave = mgr->slaves[index];
+ Ttk_Content *content = mgr->content[index];
TkSizeT i;
/* Notify manager:
*/
- mgr->managerSpec->SlaveRemoved(mgr->managerData, index);
+ mgr->managerSpec->ContentRemoved(mgr->managerData, index);
/* Remove from array:
*/
- --mgr->nSlaves;
- for (i = index ; i < mgr->nSlaves; ++i) {
- mgr->slaves[i] = mgr->slaves[i+1];
+ --mgr->nContent;
+ for (i = index ; i < mgr->nContent; ++i) {
+ mgr->content[i] = mgr->content[i+1];
}
/* Clean up:
*/
Tk_DeleteEventHandler(
- slave->slaveWindow, SlaveEventMask, SlaveEventHandler, slave);
+ content->window, StructureNotifyMask, ContentLostEventHandler, content);
/* Note [1] */
- Tk_UnmaintainGeometry(slave->slaveWindow, mgr->masterWindow);
- Tk_UnmapWindow(slave->slaveWindow);
+ Tk_UnmaintainGeometry(content->window, mgr->window);
+ Tk_UnmapWindow(content->window);
- DeleteSlave(slave);
+ DeleteContent(content);
ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
}
@@ -311,83 +310,83 @@ static void RemoveSlave(Ttk_Manager *mgr, TkSizeT index)
* +++ Tk_GeomMgr hooks.
*/
-void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window slaveWindow)
+void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window window)
{
Ttk_Manager *mgr = (Ttk_Manager *)clientData;
- int slaveIndex = Ttk_SlaveIndex(mgr, slaveWindow);
- int reqWidth = Tk_ReqWidth(slaveWindow);
- int reqHeight= Tk_ReqHeight(slaveWindow);
+ TkSizeT index = Ttk_ContentIndex(mgr, window);
+ int reqWidth = Tk_ReqWidth(window);
+ int reqHeight= Tk_ReqHeight(window);
- if (mgr->managerSpec->SlaveRequest(
- mgr->managerData, slaveIndex, reqWidth, reqHeight))
+ if (mgr->managerSpec->ContentRequest(
+ mgr->managerData, index, reqWidth, reqHeight))
{
ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED);
}
}
-void Ttk_LostSlaveProc(ClientData clientData, Tk_Window slaveWindow)
+void Ttk_LostContentProc(ClientData clientData, Tk_Window window)
{
Ttk_Manager *mgr = (Ttk_Manager *)clientData;
- int index = Ttk_SlaveIndex(mgr, slaveWindow);
+ TkSizeT index = Ttk_ContentIndex(mgr, window);
/* ASSERT: index >= 0 */
- RemoveSlave(mgr, index);
+ RemoveContent(mgr, index);
}
/*------------------------------------------------------------------------
* +++ Public API.
*/
-/* ++ Ttk_InsertSlave --
- * Add a new slave window at the specified index.
+/* ++ Ttk_InsertContent --
+ * Add a new content window at the specified index.
*/
-void Ttk_InsertSlave(
- Ttk_Manager *mgr, TkSizeT index, Tk_Window tkwin, void *slaveData)
+void Ttk_InsertContent(
+ Ttk_Manager *mgr, TkSizeT index, Tk_Window tkwin, void *data)
{
- Ttk_Slave *slave = NewSlave(mgr, tkwin, slaveData);
- InsertSlave(mgr, slave, index);
+ Ttk_Content *content = NewContent(mgr, tkwin, data);
+ InsertContent(mgr, content, index);
}
-/* ++ Ttk_ForgetSlave --
- * Unmanage the specified slave.
+/* ++ Ttk_ForgetContent --
+ * Unmanage the specified content window.
*/
-void Ttk_ForgetSlave(Ttk_Manager *mgr, TkSizeT slaveIndex)
+void Ttk_ForgetContent(Ttk_Manager *mgr, TkSizeT index)
{
- Tk_Window slaveWindow = mgr->slaves[slaveIndex]->slaveWindow;
- RemoveSlave(mgr, slaveIndex);
- Tk_ManageGeometry(slaveWindow, NULL, 0);
+ Tk_Window window = mgr->content[index]->window;
+ RemoveContent(mgr, index);
+ Tk_ManageGeometry(window, NULL, 0);
}
-/* ++ Ttk_PlaceSlave --
- * Set the position and size of the specified slave window.
+/* ++ Ttk_PlaceContent --
+ * Set the position and size of the specified content window.
*
* NOTES:
* Contrary to documentation, Tk_MaintainGeometry doesn't always
- * map the slave.
+ * map the content window.
*/
-void Ttk_PlaceSlave(
- Ttk_Manager *mgr, TkSizeT slaveIndex, int x, int y, int width, int height)
+void Ttk_PlaceContent(
+ Ttk_Manager *mgr, TkSizeT index, 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_Content *content = mgr->content[index];
+ Tk_MaintainGeometry(content->window,mgr->window,x,y,width,height);
+ content->flags |= CONTENT_MAPPED;
+ if (Tk_IsMapped(mgr->window)) {
+ Tk_MapWindow(content->window);
}
}
-/* ++ Ttk_UnmapSlave --
- * Unmap the specified slave, but leave it managed.
+/* ++ Ttk_UnmapContent --
+ * Unmap the specified content window, but leave it managed.
*/
-void Ttk_UnmapSlave(Ttk_Manager *mgr, TkSizeT slaveIndex)
+void Ttk_UnmapContent(Ttk_Manager *mgr, TkSizeT index)
{
- Ttk_Slave *slave = mgr->slaves[slaveIndex];
- Tk_UnmaintainGeometry(slave->slaveWindow, mgr->masterWindow);
- slave->flags &= ~SLAVE_MAPPED;
+ Ttk_Content *content = mgr->content[index];
+ Tk_UnmaintainGeometry(content->window, mgr->window);
+ content->flags &= ~CONTENT_MAPPED;
/* Contrary to documentation, Tk_UnmaintainGeometry doesn't always
- * unmap the slave:
+ * unmap the content window:
*/
- Tk_UnmapWindow(slave->slaveWindow);
+ Tk_UnmapWindow(content->window);
}
/* LayoutChanged, SizeChanged --
@@ -405,130 +404,128 @@ void Ttk_ManagerSizeChanged(Ttk_Manager *mgr)
/* +++ Accessors.
*/
-TkSizeT Ttk_NumberSlaves(Ttk_Manager *mgr)
+TkSizeT Ttk_NumberContent(Ttk_Manager *mgr)
{
- return mgr->nSlaves;
+ return mgr->nContent;
}
-void *Ttk_SlaveData(Ttk_Manager *mgr, TkSizeT slaveIndex)
+void *Ttk_ContentData(Ttk_Manager *mgr, TkSizeT index)
{
- return mgr->slaves[slaveIndex]->slaveData;
+ return mgr->content[index]->data;
}
-Tk_Window Ttk_SlaveWindow(Ttk_Manager *mgr, TkSizeT slaveIndex)
+Tk_Window Ttk_ContentWindow(Ttk_Manager *mgr, TkSizeT index)
{
- return mgr->slaves[slaveIndex]->slaveWindow;
+ return mgr->content[index]->window;
}
/*------------------------------------------------------------------------
* +++ Utility routines.
*/
-/* ++ Ttk_SlaveIndex --
- * Returns the index of specified slave window, -1 if not found.
+/* ++ Ttk_ContentIndex --
+ * Returns the index of specified content window, -1 if not found.
*/
-TkSizeT Ttk_SlaveIndex(Ttk_Manager *mgr, Tk_Window slaveWindow)
+TkSizeT Ttk_ContentIndex(Ttk_Manager *mgr, Tk_Window window)
{
TkSizeT index;
- for (index = 0; index < mgr->nSlaves; ++index)
- if (mgr->slaves[index]->slaveWindow == slaveWindow)
+ for (index = 0; index < mgr->nContent; ++index)
+ if (mgr->content[index]->window == window)
return index;
return TCL_INDEX_NONE;
}
-/* ++ Ttk_GetSlaveIndexFromObj(interp, mgr, objPtr, indexPtr) --
- * Return the index of the slave specified by objPtr.
- * Slaves may be specified as an integer index or
+/* ++ Ttk_GetContentIndexFromObj(interp, mgr, objPtr, indexPtr) --
+ * Return the index of the content window specified by objPtr.
+ * Content windows 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(
+int Ttk_GetContentIndexFromObj(
Tcl_Interp *interp, Ttk_Manager *mgr, Tcl_Obj *objPtr, TkSizeT *indexPtr)
{
const char *string = Tcl_GetString(objPtr);
- TkSizeT slaveIndex = 0;
- TkSizeT idx;
+ TkSizeT index = 0;
Tk_Window tkwin;
/* Try interpreting as an integer first:
*/
- if (TkGetIntForIndex(objPtr, mgr->nSlaves - 1, 1, &idx) == TCL_OK) {
- slaveIndex = idx;
- if ((size_t)slaveIndex > (size_t)mgr->nSlaves) {
+ if (TkGetIntForIndex(objPtr, mgr->nContent - 1, 1, &index) == TCL_OK) {
+ if (index + 1 > mgr->nContent + 1) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Slave index %d out of bounds", (int)slaveIndex));
- Tcl_SetErrorCode(interp, "TTK", "SLAVE", "INDEX", NULL);
+ "Managed window index %d out of bounds", (int)index));
+ Tcl_SetErrorCode(interp, "TTK", "MANAGED", "INDEX", NULL);
return TCL_ERROR;
}
- *indexPtr = slaveIndex;
+ *indexPtr = index;
return TCL_OK;
}
- /* Try interpreting as a slave window name;
+ /* Try interpreting as a window name;
*/
if ((*string == '.') &&
- (tkwin = Tk_NameToWindow(interp, string, mgr->masterWindow))) {
- slaveIndex = Ttk_SlaveIndex(mgr, tkwin);
- if (slaveIndex == TCL_INDEX_NONE) {
+ (tkwin = Tk_NameToWindow(interp, string, mgr->window))) {
+ index = Ttk_ContentIndex(mgr, tkwin);
+ if (index == TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"%s is not managed by %s", string,
- Tk_PathName(mgr->masterWindow)));
- Tcl_SetErrorCode(interp, "TTK", "SLAVE", "MANAGER", NULL);
+ Tk_PathName(mgr->window)));
+ Tcl_SetErrorCode(interp, "TTK", "MANAGED", "MANAGER", NULL);
return TCL_ERROR;
}
- *indexPtr = slaveIndex;
+ *indexPtr = index;
return TCL_OK;
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Invalid slave specification %s", string));
- Tcl_SetErrorCode(interp, "TTK", "SLAVE", "SPEC", NULL);
+ "Invalid managed window specification %s", string));
+ Tcl_SetErrorCode(interp, "TTK", "MANAGED", "SPEC", NULL);
return TCL_ERROR;
}
-/* ++ Ttk_ReorderSlave(mgr, fromIndex, toIndex) --
- * Change slave order.
+/* ++ Ttk_ReorderContent(mgr, fromIndex, toIndex) --
+ * Change content window order.
*/
-void Ttk_ReorderSlave(Ttk_Manager *mgr, TkSizeT fromIndex, TkSizeT toIndex)
+void Ttk_ReorderContent(Ttk_Manager *mgr, TkSizeT fromIndex, TkSizeT toIndex)
{
- Ttk_Slave *moved = mgr->slaves[fromIndex];
+ Ttk_Content *moved = mgr->content[fromIndex];
/* Shuffle down: */
while (fromIndex > toIndex) {
- mgr->slaves[fromIndex] = mgr->slaves[fromIndex - 1];
+ mgr->content[fromIndex] = mgr->content[fromIndex - 1];
--fromIndex;
}
/* Or, shuffle up: */
while (fromIndex < toIndex) {
- mgr->slaves[fromIndex] = mgr->slaves[fromIndex + 1];
+ mgr->content[fromIndex] = mgr->content[fromIndex + 1];
++fromIndex;
}
/* ASSERT: fromIndex == toIndex */
- mgr->slaves[fromIndex] = moved;
+ mgr->content[fromIndex] = moved;
- /* Schedule a relayout. In general, rearranging slaves
+ /* Schedule a relayout. In general, rearranging content
* 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:
+/* ++ Ttk_Maintainable(interp, window, container) --
+ * Utility routine. Verifies that 'container' may be used to maintain
+ * the geometry of 'window' 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'
+ * + 'container' is either 'window's parent -OR-
+ * + 'container is a descendant of 'window's parent.
+ * + 'window' is not a toplevel window
+ * + 'window' belongs to the same toplevel as 'container'
*
* Returns: 1 if OK; otherwise 0, leaving an error message in 'interp'.
*/
-int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window master)
+int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window window, Tk_Window container)
{
- Tk_Window ancestor = master, parent = Tk_Parent(slave);
+ Tk_Window ancestor = container, parent = Tk_Parent(window);
- if (Tk_IsTopLevel(slave) || slave == master) {
+ if (Tk_IsTopLevel(window) || window == container) {
goto badWindow;
}
@@ -542,8 +539,8 @@ int Ttk_Maintainable(Tcl_Interp *interp, Tk_Window slave, Tk_Window master)
return 1;
badWindow:
- Tcl_SetObjResult(interp, Tcl_ObjPrintf("can't add %s as slave of %s",
- Tk_PathName(slave), Tk_PathName(master)));
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf("can't add %s as content of %s",
+ Tk_PathName(window), Tk_PathName(container)));
Tcl_SetErrorCode(interp, "TTK", "GEOMETRY", "MAINTAINABLE", NULL);
return 0;
}
diff --git a/generic/ttk/ttkManager.h b/generic/ttk/ttkManager.h
index 838e261..cf07dfc 100644
--- a/generic/ttk/ttkManager.h
+++ b/generic/ttk/ttkManager.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Joe English. Freely redistributable.
+ * Copyright © 2005 Joe English. Freely redistributable.
*
* Geometry manager utilities.
*/
@@ -14,54 +14,60 @@ typedef struct TtkManager_ Ttk_Manager;
/*
* Geometry manager specification record:
*
- * RequestedSize computes the requested size of the master window.
+ * RequestedSize computes the requested size of the container window.
*
- * PlaceSlaves sets the position and size of all managed slaves
- * by calling Ttk_PlaceSlave().
+ * PlaceContent sets the position and size of all managed content windows
+ * by calling Ttk_PlaceContent().
*
- * SlaveRemoved() is called immediately before a slave is removed.
- * NB: the associated slave window may have been destroyed when this
+ * ContentRemoved() is called immediately before a content window is removed.
+ * NB: the associated content window may have been destroyed when this
* routine is called.
*
- * SlaveRequest() is called when a slave requests a size change.
+ * ContentRequest() is called when a content window 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, TkSizeT slaveIndex, int w, int h);
- void (*SlaveRemoved)(void *managerData, TkSizeT slaveIndex);
+ void (*PlaceContent)(void *managerData);
+ int (*ContentRequest)(void *managerData, TkSizeT index, int w, int h);
+ void (*ContentRemoved)(void *managerData, TkSizeT index);
} 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);
+#define Ttk_LostSlaveProc Ttk_LostContentProc
+MODULE_SCOPE void Ttk_GeometryRequestProc(ClientData, Tk_Window window);
+MODULE_SCOPE void Ttk_LostContentProc(ClientData, Tk_Window window);
/*
* Public API:
*/
MODULE_SCOPE Ttk_Manager *Ttk_CreateManager(
- Ttk_ManagerSpec *, void *managerData, Tk_Window masterWindow);
+ Ttk_ManagerSpec *, void *managerData, Tk_Window window);
MODULE_SCOPE void Ttk_DeleteManager(Ttk_Manager *);
-MODULE_SCOPE void Ttk_InsertSlave(
- Ttk_Manager *, TkSizeT position, Tk_Window, void *slaveData);
+#define Ttk_InsertSlave Ttk_InsertContent
+MODULE_SCOPE void Ttk_InsertContent(
+ Ttk_Manager *, TkSizeT position, Tk_Window, void *clientData);
-MODULE_SCOPE void Ttk_ForgetSlave(Ttk_Manager *, TkSizeT slaveIndex);
+#define Ttk_ForgetSlave Ttk_ForgetContent
+MODULE_SCOPE void Ttk_ForgetContent(Ttk_Manager *, TkSizeT index);
-MODULE_SCOPE void Ttk_ReorderSlave(Ttk_Manager *, TkSizeT fromIndex, TkSizeT toIndex);
- /* Rearrange slave positions */
+#define Ttk_ReorderSlave Ttk_ReorderContent
+MODULE_SCOPE void Ttk_ReorderContent(Ttk_Manager *, TkSizeT fromIndex, TkSizeT toIndex);
+ /* Rearrange content window positions */
-MODULE_SCOPE void Ttk_PlaceSlave(
- Ttk_Manager *, TkSizeT slaveIndex, int x, int y, int width, int height);
- /* Position and map the slave */
+#define Ttk_PlaceSlave Ttk_PlaceContent
+MODULE_SCOPE void Ttk_PlaceContent(
+ Ttk_Manager *, TkSizeT index, int x, int y, int width, int height);
+ /* Position and map the content window */
-MODULE_SCOPE void Ttk_UnmapSlave(Ttk_Manager *, TkSizeT slaveIndex);
- /* Unmap the slave */
+#define Ttk_UnmapSlave Ttk_UnmapContent
+MODULE_SCOPE void Ttk_UnmapContent(Ttk_Manager *, TkSizeT index);
+ /* Unmap the content window */
MODULE_SCOPE void Ttk_ManagerSizeChanged(Ttk_Manager *);
MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *);
@@ -69,24 +75,29 @@ MODULE_SCOPE void Ttk_ManagerLayoutChanged(Ttk_Manager *);
/* Utilities:
*/
-MODULE_SCOPE TkSizeT Ttk_SlaveIndex(Ttk_Manager *, Tk_Window);
- /* Returns: index in slave array of specified window, -1 if not found */
+#define Ttk_SlaveIndex Ttk_ContentIndex
+MODULE_SCOPE TkSizeT Ttk_ContentIndex(Ttk_Manager *, Tk_Window);
+ /* Returns: index in content array of specified window, TCL_INDEX_NONE if not found */
-MODULE_SCOPE int Ttk_GetSlaveIndexFromObj(
+#define Ttk_GetSlaveIndexFromObj Ttk_GetContentIndexFromObj
+MODULE_SCOPE int Ttk_GetContentIndexFromObj(
Tcl_Interp *, Ttk_Manager *, Tcl_Obj *, TkSizeT *indexPtr);
/* Accessor functions:
*/
-MODULE_SCOPE TkSizeT Ttk_NumberSlaves(Ttk_Manager *);
- /* Returns: number of managed slaves */
+#define Ttk_NumberSlaves Ttk_NumberContent
+MODULE_SCOPE TkSizeT Ttk_NumberContent(Ttk_Manager *);
+ /* Returns: number of managed content windows */
-MODULE_SCOPE void *Ttk_SlaveData(Ttk_Manager *, TkSizeT slaveIndex);
- /* Returns: client data associated with slave */
+#define Ttk_SlaveData Ttk_ContentData
+MODULE_SCOPE void *Ttk_ContentData(Ttk_Manager *, TkSizeT index);
+ /* Returns: client data associated with content window */
-MODULE_SCOPE Tk_Window Ttk_SlaveWindow(Ttk_Manager *, TkSizeT slaveIndex);
- /* Returns: slave window */
+#define Ttk_SlaveWindow Ttk_ContentWindow
+MODULE_SCOPE Tk_Window Ttk_ContentWindow(Ttk_Manager *, TkSizeT index);
+ /* Returns: content 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 */
+MODULE_SCOPE int Ttk_Maintainable(Tcl_Interp *, Tk_Window content, Tk_Window container);
+ /* Returns: 1 if container can manage content; 0 otherwise leaving error msg */
#endif /* _TTKMANAGER */
diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c
index 7ad46a4..5664be5 100644
--- a/generic/ttk/ttkNotebook.c
+++ b/generic/ttk/ttkNotebook.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Joe English
+ * Copyright © 2004 Joe English
*/
#include "tkInt.h"
@@ -53,31 +53,31 @@ typedef struct
* relevant to the tab.
*
* PaneOptionSpecs includes additional options for child window placement
- * and is used to configure the slave.
+ * and is used to configure the pane.
*/
static const Tk_OptionSpec TabOptionSpecs[] =
{
{TK_OPTION_STRING_TABLE, "-state", "", "",
"normal", TCL_INDEX_NONE, offsetof(Tab,state),
- 0,(ClientData)TabStateStrings,0 },
+ 0, (void *)TabStateStrings, 0 },
{TK_OPTION_STRING, "-text", "text", "Text", "",
- offsetof(Tab,textObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED },
+ offsetof(Tab,textObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/,
- offsetof(Tab,imageObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
+ offsetof(Tab,imageObj), TCL_INDEX_NONE, TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED },
{TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound",
NULL, offsetof(Tab,compoundObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,(void *)ttkCompoundStrings,GEOMETRY_CHANGED },
{TK_OPTION_INT, "-underline", "underline", "Underline", "-1",
- offsetof(Tab,underlineObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED },
+ offsetof(Tab,underlineObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED },
{TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0 }
};
static const Tk_OptionSpec PaneOptionSpecs[] =
{
{TK_OPTION_STRING, "-padding", "padding", "Padding", "0",
- offsetof(Tab,paddingObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED },
+ offsetof(Tab,paddingObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-sticky", "sticky", "Sticky", "nsew",
- offsetof(Tab,stickyObj), TCL_INDEX_NONE, 0,0,GEOMETRY_CHANGED },
+ offsetof(Tab,stickyObj), TCL_INDEX_NONE, 0, 0, GEOMETRY_CHANGED },
WIDGET_INHERIT_OPTIONS(TabOptionSpecs)
};
@@ -98,7 +98,7 @@ typedef struct
TkSizeT activeIndex; /* index of currently active tab */
Ttk_Layout tabLayout; /* Sublayout for tabs */
- Ttk_Box clientArea; /* Where to pack slave widgets */
+ Ttk_Box clientArea; /* Where to pack content windows */
} NotebookPart;
typedef struct
@@ -187,13 +187,13 @@ static void NotebookStyleOptions(Notebook *nb, NotebookStyle *nbstyle)
* +++ Tab management.
*/
-static Tab *CreateTab(Tcl_Interp *interp, Notebook *nb, Tk_Window slaveWindow)
+static Tab *CreateTab(Tcl_Interp *interp, Notebook *nb, Tk_Window window)
{
Tk_OptionTable optionTable = nb->notebook.paneOptionTable;
Tab *record = (Tab *)ckalloc(sizeof(Tab));
memset(record, 0, sizeof(Tab));
- if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) {
+ if (Tk_InitOptions(interp, record, optionTable, window) != TCL_OK) {
ckfree(record);
return NULL;
}
@@ -209,7 +209,7 @@ static void DestroyTab(Notebook *nb, Tab *tab)
}
static int ConfigureTab(
- Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window slaveWindow,
+ Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window window,
int objc, Tcl_Obj *const objv[])
{
Ttk_Sticky sticky = tab->sticky;
@@ -218,7 +218,7 @@ static int ConfigureTab(
int mask = 0;
if (Tk_SetOptions(interp, tab, nb->notebook.paneOptionTable,
- objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK)
+ objc, objv, window, &savedOptions, &mask) != TCL_OK)
{
return TCL_ERROR;
}
@@ -230,7 +230,7 @@ static int ConfigureTab(
{
goto error;
}
- if (Ttk_GetPaddingFromObj(interp, slaveWindow, tab->paddingObj, &padding)
+ if (Ttk_GetPaddingFromObj(interp, window, tab->paddingObj, &padding)
!= TCL_OK)
{
goto error;
@@ -257,8 +257,8 @@ error:
static TkSizeT IdentifyTab(Notebook *nb, int x, int y)
{
TkSizeT index;
- for (index = 0; index < Ttk_NumberSlaves(nb->notebook.mgr); ++index) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr,index);
+ for (index = 0; index < Ttk_NumberContent(nb->notebook.mgr); ++index) {
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr,index);
if ( tab->state != TAB_STATE_HIDDEN
&& Ttk_BoxContains(tab->parcel, x,y))
{
@@ -290,7 +290,7 @@ static void ActivateTab(Notebook *nb, TkSizeT index)
static Ttk_State TabState(Notebook *nb, TkSizeT index)
{
Ttk_State state = nb->core.state;
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index);
+ Tab *itab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
TkSizeT i = 0;
if (index == nb->notebook.currentIndex) {
@@ -302,8 +302,8 @@ static Ttk_State TabState(Notebook *nb, TkSizeT index)
if (index == nb->notebook.activeIndex) {
state |= TTK_STATE_ACTIVE;
}
- for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i);
+ for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) {
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
if (tab->state == TAB_STATE_HIDDEN) {
continue;
}
@@ -312,8 +312,8 @@ static Ttk_State TabState(Notebook *nb, TkSizeT index)
}
break;
}
- for (i = Ttk_NumberSlaves(nb->notebook.mgr) - 1; i != TCL_INDEX_NONE; --i) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i);
+ for (i = Ttk_NumberContent(nb->notebook.mgr) - 1; i != TCL_INDEX_NONE; --i) {
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
if (tab->state == TAB_STATE_HIDDEN) {
continue;
}
@@ -322,7 +322,7 @@ static Ttk_State TabState(Notebook *nb, TkSizeT index)
}
break;
}
- if (tab->state == TAB_STATE_DISABLED) {
+ if (itab->state == TAB_STATE_DISABLED) {
state |= TTK_STATE_DISABLED;
}
@@ -353,8 +353,8 @@ static void TabrowSize(
int tabrowWidth = 0, tabrowHeight = 0;
TkSizeT i;
- for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i);
+ for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) {
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
Ttk_State tabState = TabState(nb,i);
Ttk_RebindSublayout(tabLayout, tab);
@@ -378,7 +378,7 @@ static void TabrowSize(
*
* 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,
+ * Client area size determined by max size of content windows,
* overridden by -width and/or -height if nonzero.
*/
@@ -395,18 +395,18 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr)
NotebookStyleOptions(nb, &nbstyle);
- /* Compute max requested size of all slaves:
+ /* Compute max requested size of all content windows:
*/
- for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) {
- Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, i);
- Tab *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);
+ for (i = 0; i < Ttk_NumberContent(nb->notebook.mgr); ++i) {
+ Tk_Window window = Ttk_ContentWindow(nb->notebook.mgr, i);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
+ int width
+ = Tk_ReqWidth(window) + Ttk_PaddingWidth(tab->padding);
+ int height
+ = Tk_ReqHeight(window) + Ttk_PaddingHeight(tab->padding);
- clientWidth = MAX(clientWidth, slaveWidth);
- clientHeight = MAX(clientHeight, slaveHeight);
+ clientWidth = MAX(clientWidth, width);
+ clientHeight = MAX(clientHeight, height);
}
/* Client width/height overridable by widget options:
@@ -461,7 +461,7 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr)
static void SqueezeTabs(
Notebook *nb, int needed, int available)
{
- int nTabs = Ttk_NumberSlaves(nb->notebook.mgr);
+ int nTabs = Ttk_NumberContent(nb->notebook.mgr);
if (nTabs > 0) {
int difference = available - needed;
@@ -470,7 +470,7 @@ static void SqueezeTabs(
int i;
for (i = 0; i < nTabs; ++i) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr,i);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr,i);
double ad = slack + tab->width * delta;
tab->width += (int)ad;
slack = ad - (int)ad;
@@ -485,11 +485,11 @@ 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 nTabs = Ttk_NumberContent(nb->notebook.mgr);
int i;
for (i = 0; i < nTabs; ++i) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, i);
Ttk_State tabState = TabState(nb, i);
if (tab->state != TAB_STATE_HIDDEN) {
@@ -513,7 +513,7 @@ static void PlaceTabs(
* Computes notebook layout and places tabs.
*
* Side effects:
- * Sets clientArea, used to place slave panes.
+ * Sets clientArea, used to place panes.
*/
static void NotebookDoLayout(void *recordPtr)
{
@@ -567,32 +567,32 @@ static void NotebookDoLayout(void *recordPtr)
}
/*
- * NotebookPlaceSlave --
+ * NotebookPlaceContent --
* Set the position and size of a child widget
- * based on the current client area and slave options:
+ * based on the current client area and content window options:
*/
-static void NotebookPlaceSlave(Notebook *nb, TkSizeT slaveIndex)
+static void NotebookPlaceContent(Notebook *nb, TkSizeT index)
{
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, slaveIndex);
- Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, slaveIndex);
- Ttk_Box slaveBox =
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
+ Tk_Window window = Ttk_ContentWindow(nb->notebook.mgr, index);
+ Ttk_Box box =
Ttk_StickBox(Ttk_PadBox(nb->notebook.clientArea, tab->padding),
- Tk_ReqWidth(slaveWindow), Tk_ReqHeight(slaveWindow),tab->sticky);
+ Tk_ReqWidth(window), Tk_ReqHeight(window),tab->sticky);
- Ttk_PlaceSlave(nb->notebook.mgr, slaveIndex,
- slaveBox.x, slaveBox.y, slaveBox.width, slaveBox.height);
+ Ttk_PlaceContent(nb->notebook.mgr, index,
+ box.x, box.y, box.width, box.height);
}
-/* NotebookPlaceSlaves --
+/* NotebookPlaceContents --
* Geometry manager hook.
*/
-static void NotebookPlaceSlaves(void *recordPtr)
+static void NotebookPlaceContents(void *recordPtr)
{
Notebook *nb = (Notebook *)recordPtr;
TkSizeT currentIndex = nb->notebook.currentIndex;
if (currentIndex != TCL_INDEX_NONE) {
NotebookDoLayout(nb);
- NotebookPlaceSlave(nb, currentIndex);
+ NotebookPlaceContent(nb, currentIndex);
}
}
@@ -602,7 +602,7 @@ static void NotebookPlaceSlaves(void *recordPtr)
*/
static void SelectTab(Notebook *nb, TkSizeT index)
{
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
TkSizeT currentIndex = nb->notebook.currentIndex;
if (index == currentIndex) {
@@ -620,18 +620,18 @@ static void SelectTab(Notebook *nb, TkSizeT index)
}
if (currentIndex != TCL_INDEX_NONE) {
- Ttk_UnmapSlave(nb->notebook.mgr, currentIndex);
+ Ttk_UnmapContent(nb->notebook.mgr, currentIndex);
}
- /* Must be set before calling NotebookPlaceSlave(), otherwise it may
- * happen that NotebookPlaceSlaves(), triggered by an interveaning
+ /* Must be set before calling NotebookPlaceContent(), otherwise it may
+ * happen that NotebookPlaceContents(), triggered by an interveaning
* geometry request, will swap to old index. */
nb->notebook.currentIndex = index;
- NotebookPlaceSlave(nb, index);
+ NotebookPlaceContent(nb, index);
TtkRedisplayWidget(&nb->core);
- TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged");
+ Tk_SendVirtualEvent(nb->core.tkwin, "NotebookTabChanged", NULL);
}
/* NextTab --
@@ -641,13 +641,13 @@ static void SelectTab(Notebook *nb, TkSizeT index)
*/
static int NextTab(Notebook *nb, int index)
{
- TkSizeT nTabs = Ttk_NumberSlaves(nb->notebook.mgr);
+ TkSizeT nTabs = Ttk_NumberContent(nb->notebook.mgr);
TkSizeT nextIndex;
/* Scan forward for following usable tab:
*/
for (nextIndex = index + 1; nextIndex + 1 < nTabs + 1; ++nextIndex) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, nextIndex);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex);
if (tab->state == TAB_STATE_NORMAL) {
return nextIndex;
}
@@ -656,7 +656,7 @@ static int NextTab(Notebook *nb, int index)
/* Not found -- scan backwards.
*/
for (nextIndex = index - 1; nextIndex != TCL_INDEX_NONE; --nextIndex) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, nextIndex);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, nextIndex);
if (tab->state == TAB_STATE_NORMAL) {
return nextIndex;
}
@@ -680,10 +680,10 @@ static void SelectNearestTab(Notebook *nb)
TkSizeT nextIndex = NextTab(nb, currentIndex);
if (currentIndex != TCL_INDEX_NONE) {
- Ttk_UnmapSlave(nb->notebook.mgr, currentIndex);
+ Ttk_UnmapContent(nb->notebook.mgr, currentIndex);
}
if (currentIndex != nextIndex) {
- TtkSendVirtualEvent(nb->core.tkwin, "NotebookTabChanged");
+ Tk_SendVirtualEvent(nb->core.tkwin, "NotebookTabChanged", NULL);
}
nb->notebook.currentIndex = nextIndex;
@@ -691,14 +691,14 @@ static void SelectNearestTab(Notebook *nb)
TtkRedisplayWidget(&nb->core);
}
-/* TabRemoved -- GM SlaveRemoved hook.
+/* TabRemoved -- GM TabRemoved hook.
* Select the next tab if the current one is being removed.
- * Adjust currentIndex to account for removed slave.
+ * Adjust currentIndex to account for removed content window.
*/
static void TabRemoved(void *managerData, TkSizeT index)
{
Notebook *nb = (Notebook *)managerData;
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
if (index == nb->notebook.currentIndex) {
SelectNearestTab(nb);
@@ -713,13 +713,12 @@ static void TabRemoved(void *managerData, TkSizeT index)
TtkRedisplayWidget(&nb->core);
}
-static int TabRequest(void *managerData, TkSizeT index, int width, int height)
+static int TabRequest(
+ TCL_UNUSED(void *),
+ TCL_UNUSED(TkSizeT),
+ TCL_UNUSED(int),
+ TCL_UNUSED(int))
{
- (void)managerData;
- (void)index;
- (void)width;
- (void)height;
-
return 1;
}
@@ -728,17 +727,17 @@ static int TabRequest(void *managerData, TkSizeT index, int width, int height)
*/
static int AddTab(
Tcl_Interp *interp, Notebook *nb,
- TkSizeT destIndex, Tk_Window slaveWindow,
+ TkSizeT destIndex, Tk_Window window,
int objc, Tcl_Obj *const objv[])
{
Tab *tab;
- if (!Ttk_Maintainable(interp, slaveWindow, nb->core.tkwin)) {
+ if (!Ttk_Maintainable(interp, window, nb->core.tkwin)) {
return TCL_ERROR;
}
#if 0 /* can't happen */
- if (Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow) != TCL_INDEX_NONE) {
+ if (Ttk_ContentIndex(nb->notebook.mgr, window) != TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s already added",
- Tk_PathName(slaveWindow)));
+ Tk_PathName(window)));
Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "PRESENT", NULL);
return TCL_ERROR;
}
@@ -746,16 +745,16 @@ static int AddTab(
/* Create and insert tab.
*/
- tab = CreateTab(interp, nb, slaveWindow);
+ tab = CreateTab(interp, nb, window);
if (!tab) {
return TCL_ERROR;
}
- if (ConfigureTab(interp, nb, tab, slaveWindow, objc, objv) != TCL_OK) {
+ if (ConfigureTab(interp, nb, tab, window, objc, objv) != TCL_OK) {
DestroyTab(nb, tab);
return TCL_ERROR;
}
- Ttk_InsertSlave(nb->notebook.mgr, destIndex, slaveWindow, tab);
+ Ttk_InsertContent(nb->notebook.mgr, destIndex, window, tab);
/* Adjust indices and/or autoselect first tab:
*/
@@ -769,9 +768,9 @@ static int AddTab(
}
static Ttk_ManagerSpec NotebookManagerSpec = {
- { "notebook", Ttk_GeometryRequestProc, Ttk_LostSlaveProc },
+ { "notebook", Ttk_GeometryRequestProc, Ttk_LostContentProc },
NotebookSize,
- NotebookPlaceSlaves,
+ NotebookPlaceContents,
TabRequest,
TabRemoved
};
@@ -814,7 +813,7 @@ static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr)
* + positional specifications @x,y,
* + "current",
* + numeric indices [0..nTabs],
- * + slave window names
+ * + content window names
*
* Stores index of specified tab in *index_rtn, -1 if not found.
*
@@ -845,21 +844,21 @@ static int FindTabIndex(
return TCL_OK;
}
- /* ... or integer index or slave window name:
+ /* ... or integer index or content window name:
*/
- if (Ttk_GetSlaveIndexFromObj(
+ if (Ttk_GetContentIndexFromObj(
interp, nb->notebook.mgr, objPtr, index_rtn) == TCL_OK)
{
return TCL_OK;
}
- if (*index_rtn == Ttk_NumberSlaves(nb->notebook.mgr)) {
+ if (*index_rtn == Ttk_NumberContent(nb->notebook.mgr)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Invalid slave specification %s", string));
- Tcl_SetErrorCode(interp, "TTK", "SLAVE", "SPEC", NULL);
+ "Invalid tab specification %s", string));
+ Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "SPEC", NULL);
return TCL_ERROR;
}
- /* Nothing matched; Ttk_GetSlaveIndexFromObj will have left error message.
+ /* Nothing matched; Ttk_GetContentIndexFromObj will have left error message.
*/
return TCL_ERROR;
}
@@ -873,10 +872,10 @@ static int GetTabIndex(
Tcl_Interp *interp, Notebook *nb, Tcl_Obj *objPtr, TkSizeT *index_rtn)
{
int status = FindTabIndex(interp, nb, objPtr, index_rtn);
- if (status == TCL_OK && *index_rtn + 1 >= Ttk_NumberSlaves(nb->notebook.mgr) + 1) {
+ if (status == TCL_OK && *index_rtn + 1 >= Ttk_NumberContent(nb->notebook.mgr) + 1) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "Slave index %s out of bounds", Tcl_GetString(objPtr)));
- Tcl_SetErrorCode(interp, "TTK", "SLAVE", "INDEX", NULL);
+ "tab index %s out of bounds", Tcl_GetString(objPtr)));
+ Tcl_SetErrorCode(interp, "TTK", "NOTEBOOK", "INDEX", NULL);
return TCL_ERROR;
}
@@ -899,9 +898,8 @@ static int NotebookAddCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Notebook *nb = (Notebook *)recordPtr;
- int index = Ttk_NumberSlaves(nb->notebook.mgr);
- Tk_Window slaveWindow;
- int slaveIndex;
+ Tk_Window window;
+ int index;
Tab *tab;
if (objc <= 2 || objc % 2 != 1) {
@@ -909,21 +907,21 @@ static int NotebookAddCommand(
return TCL_ERROR;
}
- slaveWindow = Tk_NameToWindow(interp,Tcl_GetString(objv[2]),nb->core.tkwin);
- if (!slaveWindow) {
+ window = Tk_NameToWindow(interp,Tcl_GetString(objv[2]),nb->core.tkwin);
+ if (!window) {
return TCL_ERROR;
}
- slaveIndex = Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow);
+ index = Ttk_ContentIndex(nb->notebook.mgr, window);
- if (slaveIndex < 0) { /* New tab */
- return AddTab(interp, nb, index, slaveWindow, objc-3,objv+3);
+ if (index < 0) { /* New tab */
+ return AddTab(interp, nb, Ttk_NumberContent(nb->notebook.mgr), window, objc-3,objv+3);
}
- tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, slaveIndex);
+ tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
if (tab->state == TAB_STATE_HIDDEN) {
tab->state = TAB_STATE_NORMAL;
}
- if (ConfigureTab(interp, nb, tab, slaveWindow, objc-3,objv+3) != TCL_OK) {
+ if (ConfigureTab(interp, nb, tab, window, objc-3,objv+3) != TCL_OK) {
return TCL_ERROR;
}
@@ -940,55 +938,55 @@ static int NotebookInsertCommand(
{
Notebook *nb = (Notebook *)recordPtr;
TkSizeT current = nb->notebook.currentIndex;
- TkSizeT nSlaves = Ttk_NumberSlaves(nb->notebook.mgr);
+ TkSizeT nContent = Ttk_NumberContent(nb->notebook.mgr);
TkSizeT srcIndex, destIndex;
if (objc < 4) {
- Tcl_WrongNumArgs(interp, 2,objv, "index slave ?-option value ...?");
+ Tcl_WrongNumArgs(interp, 2,objv, "index window ?-option value ...?");
return TCL_ERROR;
}
- if (TCL_OK != Ttk_GetSlaveIndexFromObj(
+ if (TCL_OK != Ttk_GetContentIndexFromObj(
interp, nb->notebook.mgr, objv[2], &destIndex)) {
return TCL_ERROR;
}
if (Tcl_GetString(objv[3])[0] == '.') {
- /* Window name -- could be new or existing slave.
+ /* Window name -- could be new or existing content window.
*/
- Tk_Window slaveWindow =
+ Tk_Window window =
Tk_NameToWindow(interp,Tcl_GetString(objv[3]),nb->core.tkwin);
- if (!slaveWindow) {
+ if (!window) {
return TCL_ERROR;
}
- srcIndex = Ttk_SlaveIndex(nb->notebook.mgr, slaveWindow);
- if (srcIndex == TCL_INDEX_NONE) { /* New slave */
- return AddTab(interp, nb, destIndex, slaveWindow, objc-4,objv+4);
+ srcIndex = Ttk_ContentIndex(nb->notebook.mgr, window);
+ if (srcIndex == TCL_INDEX_NONE) { /* New content window */
+ return AddTab(interp, nb, destIndex, window, objc-4,objv+4);
}
- } else if (Ttk_GetSlaveIndexFromObj(
+ } else if (Ttk_GetContentIndexFromObj(
interp, nb->notebook.mgr, objv[3], &srcIndex) != TCL_OK)
{
return TCL_ERROR;
- } else if (srcIndex + 1 >= Ttk_NumberSlaves(nb->notebook.mgr) + 1) {
- srcIndex = Ttk_NumberSlaves(nb->notebook.mgr) - 1;
+ } else if (srcIndex + 1 >= Ttk_NumberContent(nb->notebook.mgr) + 1) {
+ srcIndex = Ttk_NumberContent(nb->notebook.mgr) - 1;
}
- /* Move existing slave:
+ /* Move existing content window:
*/
if (ConfigureTab(interp, nb,
- (Tab *)Ttk_SlaveData(nb->notebook.mgr, srcIndex),
- Ttk_SlaveWindow(nb->notebook.mgr, srcIndex),
+ (Tab *)Ttk_ContentData(nb->notebook.mgr, srcIndex),
+ Ttk_ContentWindow(nb->notebook.mgr, srcIndex),
objc-4,objv+4) != TCL_OK)
{
return TCL_ERROR;
}
- if (destIndex + 1 >= nSlaves + 1) {
- destIndex = nSlaves - 1;
+ if (destIndex + 1 >= nContent + 1) {
+ destIndex = nContent - 1;
}
- Ttk_ReorderSlave(nb->notebook.mgr, srcIndex, destIndex);
+ Ttk_ReorderContent(nb->notebook.mgr, srcIndex, destIndex);
/* Adjust internal indexes:
*/
@@ -1024,7 +1022,7 @@ static int NotebookForgetCommand(
return TCL_ERROR;
}
- Ttk_ForgetSlave(nb->notebook.mgr, index);
+ Ttk_ForgetContent(nb->notebook.mgr, index);
TtkRedisplayWidget(&nb->core);
return TCL_OK;
@@ -1049,7 +1047,7 @@ static int NotebookHideCommand(
return TCL_ERROR;
}
- tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index);
+ tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
tab->state = TAB_STATE_HIDDEN;
if (index == nb->notebook.currentIndex) {
SelectNearestTab(nb);
@@ -1079,7 +1077,7 @@ static int NotebookIdentifyCommand(
return TCL_ERROR;
}
- if ( Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK
+ if (Tcl_GetIntFromObj(interp, objv[objc-2], &x) != TCL_OK
|| Tcl_GetIntFromObj(interp, objv[objc-1], &y) != TCL_OK
|| (objc == 5 && Tcl_GetIndexFromObjStruct(interp, objv[2], whatTable,
sizeof(char *), "option", 0, &what) != TCL_OK)
@@ -1089,7 +1087,7 @@ static int NotebookIdentifyCommand(
tabIndex = IdentifyTab(nb, x, y);
if (tabIndex != TCL_INDEX_NONE) {
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, tabIndex);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, tabIndex);
Ttk_State state = TabState(nb, tabIndex);
Ttk_Layout tabLayout = nb->notebook.tabLayout;
@@ -1108,9 +1106,8 @@ static int NotebookIdentifyCommand(
}
break;
case IDENTIFY_TAB:
- if (tabIndex != TCL_INDEX_NONE) {
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(tabIndex));
- }
+ if (tabIndex != TCL_INDEX_NONE)
+ Tcl_SetObjResult(interp, TkNewIndexObj(tabIndex));
break;
}
return TCL_OK;
@@ -1134,8 +1131,9 @@ static int NotebookIndexCommand(
}
status = FindTabIndex(interp, nb, objv[2], &index);
- if (status == TCL_OK && index != TCL_INDEX_NONE) {
- Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index));
+ if (status == TCL_OK) {
+ if (index != TCL_INDEX_NONE)
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
}
return status;
@@ -1152,7 +1150,7 @@ static int NotebookSelectCommand(
if (objc == 2) {
if (nb->notebook.currentIndex != TCL_INDEX_NONE) {
- Tk_Window pane = Ttk_SlaveWindow(
+ Tk_Window pane = Ttk_ContentWindow(
nb->notebook.mgr, nb->notebook.currentIndex);
Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(pane), -1));
}
@@ -1186,8 +1184,8 @@ static int NotebookTabsCommand(
}
result = Tcl_NewListObj(0, NULL);
- for (i = 0; i < Ttk_NumberSlaves(mgr); ++i) {
- const char *pathName = Tk_PathName(Ttk_SlaveWindow(mgr,i));
+ for (i = 0; i < Ttk_NumberContent(mgr); ++i) {
+ const char *pathName = Tk_PathName(Ttk_ContentWindow(mgr,i));
Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(pathName,-1));
}
@@ -1203,7 +1201,7 @@ static int NotebookTabCommand(
Notebook *nb = (Notebook *)recordPtr;
Ttk_Manager *mgr = nb->notebook.mgr;
TkSizeT index;
- Tk_Window slaveWindow;
+ Tk_Window window;
Tab *tab;
if (objc < 3) {
@@ -1215,18 +1213,18 @@ static int NotebookTabCommand(
return TCL_ERROR;
}
- tab = (Tab *)Ttk_SlaveData(mgr, index);
- slaveWindow = Ttk_SlaveWindow(mgr, index);
+ tab = (Tab *)Ttk_ContentData(mgr, index);
+ window = Ttk_ContentWindow(mgr, index);
if (objc == 3) {
return TtkEnumerateOptions(interp, tab,
- PaneOptionSpecs, nb->notebook.paneOptionTable, slaveWindow);
+ PaneOptionSpecs, nb->notebook.paneOptionTable, window);
} else if (objc == 4) {
return TtkGetOptionValue(interp, tab, objv[3],
- nb->notebook.paneOptionTable, slaveWindow);
+ nb->notebook.paneOptionTable, window);
} /* else */
- if (ConfigureTab(interp, nb, tab, slaveWindow, objc-3,objv+3) != TCL_OK) {
+ if (ConfigureTab(interp, nb, tab, window, objc-3,objv+3) != TCL_OK) {
return TCL_ERROR;
}
@@ -1244,8 +1242,8 @@ static int NotebookTabCommand(
*/
static const Ttk_Ensemble NotebookCommands[] = {
{ "add", NotebookAddCommand,0 },
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "forget", NotebookForgetCommand,0 },
{ "hide", NotebookHideCommand,0 },
{ "identify", NotebookIdentifyCommand,0 },
@@ -1254,6 +1252,7 @@ static const Ttk_Ensemble NotebookCommands[] = {
{ "instate", TtkWidgetInstateCommand,0 },
{ "select", NotebookSelectCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ "tab", NotebookTabCommand,0 },
{ "tabs", NotebookTabsCommand,0 },
{ 0,0,0 }
@@ -1346,7 +1345,7 @@ static Ttk_Layout NotebookGetLayout(
static void DisplayTab(Notebook *nb, int index, Drawable d)
{
Ttk_Layout tabLayout = nb->notebook.tabLayout;
- Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index);
+ Tab *tab = (Tab *)Ttk_ContentData(nb->notebook.mgr, index);
Ttk_State state = TabState(nb, index);
if (tab->state != TAB_STATE_HIDDEN) {
@@ -1359,7 +1358,7 @@ static void DisplayTab(Notebook *nb, int index, Drawable d)
static void NotebookDisplay(void *clientData, Drawable d)
{
Notebook *nb = (Notebook *)clientData;
- TkSizeT nSlaves = Ttk_NumberSlaves(nb->notebook.mgr);
+ TkSizeT nContent = Ttk_NumberContent(nb->notebook.mgr);
TkSizeT index;
/* Draw notebook background (base layout):
@@ -1369,7 +1368,7 @@ static void NotebookDisplay(void *clientData, Drawable 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) {
+ for (index = 0; index < nContent; ++index) {
if (index != nb->notebook.currentIndex) {
DisplayTab(nb, index, d);
}
diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c
index f44c569..c072f97 100644
--- a/generic/ttk/ttkPanedwindow.c
+++ b/generic/ttk/ttkPanedwindow.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Joe English. Freely redistributable.
+ * Copyright © 2005 Joe English. Freely redistributable.
*
* ttk::panedwindow widget implementation.
*
@@ -28,7 +28,7 @@
* 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.
+ * The request size is initially set to the content 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.
*
@@ -77,20 +77,20 @@ typedef struct {
static const Tk_OptionSpec PanedOptionSpecs[] = {
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical",
offsetof(Paned,paned.orientObj), offsetof(Paned,paned.orient),
- 0,(ClientData)ttkOrientStrings,READONLY_OPTION|STYLE_CHANGED },
+ 0, (void *)ttkOrientStrings, READONLY_OPTION|STYLE_CHANGED },
{TK_OPTION_INT, "-width", "width", "Width", "0",
- TCL_INDEX_NONE, offsetof(Paned,paned.width),
- 0,0,GEOMETRY_CHANGED },
+ TCL_INDEX_NONE, offsetof(Paned, paned.width),
+ 0, 0, GEOMETRY_CHANGED },
{TK_OPTION_INT, "-height", "height", "Height", "0",
- TCL_INDEX_NONE, offsetof(Paned,paned.height),
- 0,0,GEOMETRY_CHANGED },
+ TCL_INDEX_NONE, offsetof(Paned, paned.height),
+ 0, 0, GEOMETRY_CHANGED },
WIDGET_TAKEFOCUS_FALSE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
};
/*------------------------------------------------------------------------
- * +++ Slave pane record.
+ * +++ Pane record.
*/
typedef struct {
int reqSize; /* Pane request size */
@@ -107,21 +107,21 @@ static const Tk_OptionSpec PaneOptionSpecs[] = {
/* CreatePane --
* Create a new pane record.
*/
-static Pane *CreatePane(Tcl_Interp *interp, Paned *pw, Tk_Window slaveWindow)
+static Pane *CreatePane(Tcl_Interp *interp, Paned *pw, Tk_Window window)
{
Tk_OptionTable optionTable = pw->paned.paneOptionTable;
void *record = ckalloc(sizeof(Pane));
Pane *pane = (Pane *)record;
memset(record, 0, sizeof(Pane));
- if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) {
+ if (Tk_InitOptions(interp, record, optionTable, window) != TCL_OK) {
ckfree(record);
return NULL;
}
pane->reqSize
= pw->paned.orient == TTK_ORIENT_HORIZONTAL
- ? Tk_ReqWidth(slaveWindow) : Tk_ReqHeight(slaveWindow);
+ ? Tk_ReqWidth(window) : Tk_ReqHeight(window);
return pane;
}
@@ -140,7 +140,7 @@ static void DestroyPane(Paned *pw, Pane *pane)
* Set pane options.
*/
static int ConfigurePane(
- Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window slaveWindow,
+ Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window window,
int objc, Tcl_Obj *const objv[])
{
Ttk_Manager *mgr = pw->paned.mgr;
@@ -148,7 +148,7 @@ static int ConfigurePane(
int mask = 0;
if (Tk_SetOptions(interp, pane, pw->paned.paneOptionTable,
- objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK)
+ objc, objv, window, &savedOptions, &mask) != TCL_OK)
{
return TCL_ERROR;
}
@@ -188,14 +188,14 @@ error:
static int ShoveUp(Paned *pw, int i, int pos)
{
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, i);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, i);
int sashThickness = pw->paned.sashThickness;
if (i == 0) {
if (pos < 0)
pos = 0;
} else {
- Pane *prevPane = (Pane *)Ttk_SlaveData(pw->paned.mgr, i-1);
+ Pane *prevPane = (Pane *)Ttk_ContentData(pw->paned.mgr, i-1);
if (pos < prevPane->sashPos + sashThickness)
pos = ShoveUp(pw, i-1, pos - sashThickness) + sashThickness;
}
@@ -208,13 +208,13 @@ static int ShoveUp(Paned *pw, int i, int pos)
*/
static int ShoveDown(Paned *pw, TkSizeT i, int pos)
{
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr,i);
+ Pane *pane = (Pane *)Ttk_ContentData(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 */
+ if (i == Ttk_NumberContent(pw->paned.mgr) - 1) {
+ pos = pane->sashPos; /* Sentinel value == container window size */
} else {
- Pane *nextPane = (Pane *)Ttk_SlaveData(pw->paned.mgr,i+1);
+ Pane *nextPane = (Pane *)Ttk_ContentData(pw->paned.mgr,i+1);
if (pos + sashThickness > nextPane->sashPos)
pos = ShoveDown(pw, i+1, pos + sashThickness) - sashThickness;
}
@@ -230,7 +230,7 @@ static int ShoveDown(Paned *pw, TkSizeT i, int pos)
static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr)
{
Paned *pw = (Paned *)recordPtr;
- int nPanes = Ttk_NumberSlaves(pw->paned.mgr);
+ int nPanes = Ttk_NumberContent(pw->paned.mgr);
int nSashes = nPanes - 1;
int sashThickness = pw->paned.sashThickness;
int width = 0, height = 0;
@@ -238,21 +238,21 @@ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr)
if (pw->paned.orient == TTK_ORIENT_HORIZONTAL) {
for (index = 0; index < nPanes; ++index) {
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
- Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
+ Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index);
- if (height < Tk_ReqHeight(slaveWindow))
- height = Tk_ReqHeight(slaveWindow);
+ if (height < Tk_ReqHeight(window))
+ height = Tk_ReqHeight(window);
width += pane->reqSize;
}
width += nSashes * sashThickness;
} else {
for (index = 0; index < nPanes; ++index) {
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
- Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
+ Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index);
- if (width < Tk_ReqWidth(slaveWindow))
- width = Tk_ReqWidth(slaveWindow);
+ if (width < Tk_ReqWidth(window))
+ width = Tk_ReqWidth(window);
height += pane->reqSize;
}
height += nSashes * sashThickness;
@@ -277,8 +277,8 @@ static void AdjustPanes(Paned *pw)
int pos = 0;
TkSizeT index;
- for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) {
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
+ for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) {
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
int size = pane->sashPos - pos;
pane->reqSize = size >= 0 ? size : 0;
pos = pane->sashPos + sashThickness;
@@ -304,7 +304,7 @@ static void AdjustPanes(Paned *pw)
static void PlaceSashes(Paned *pw, int width, int height)
{
Ttk_Manager *mgr = pw->paned.mgr;
- int nPanes = Ttk_NumberSlaves(mgr);
+ int nPanes = Ttk_NumberContent(mgr);
int sashThickness = pw->paned.sashThickness;
int available = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? width : height;
int reqSize = 0, totalWeight = 0;
@@ -316,7 +316,7 @@ static void PlaceSashes(Paned *pw, int width, int height)
/* Compute total required size and total available weight:
*/
for (i = 0; i < nPanes; ++i) {
- Pane *pane = (Pane *)Ttk_SlaveData(mgr, i);
+ Pane *pane = (Pane *)Ttk_ContentData(mgr, i);
reqSize += pane->reqSize;
totalWeight += pane->weight * (pane->reqSize != 0);
}
@@ -340,7 +340,7 @@ static void PlaceSashes(Paned *pw, int width, int height)
*/
pos = 0;
for (i = 0; i < nPanes; ++i) {
- Pane *pane = (Pane *)Ttk_SlaveData(mgr, i);
+ Pane *pane = (Pane *)Ttk_ContentData(mgr, i);
int weight = pane->weight * (pane->reqSize != 0);
int size = pane->reqSize + delta * weight;
@@ -364,7 +364,7 @@ static void PlaceSashes(Paned *pw, int width, int height)
}
/* PlacePanes --
- * Places slave panes based on sash positions.
+ * Places panes based on sash positions.
*/
static void PlacePanes(Paned *pw)
{
@@ -374,18 +374,18 @@ static void PlacePanes(Paned *pw)
int pos = 0;
TkSizeT index;
- for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) {
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
+ for (index = 0; index < Ttk_NumberContent(pw->paned.mgr); ++index) {
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
int size = pane->sashPos - pos;
if (size > 0) {
if (horizontal) {
- Ttk_PlaceSlave(pw->paned.mgr, index, pos, 0, size, height);
+ Ttk_PlaceContent(pw->paned.mgr, index, pos, 0, size, height);
} else {
- Ttk_PlaceSlave(pw->paned.mgr, index, 0, pos, width, size);
+ Ttk_PlaceContent(pw->paned.mgr, index, 0, pos, width, size);
}
} else {
- Ttk_UnmapSlave(pw->paned.mgr, index);
+ Ttk_UnmapContent(pw->paned.mgr, index);
}
pos = pane->sashPos + sashThickness;
@@ -396,7 +396,7 @@ static void PlacePanes(Paned *pw)
* +++ Manager specification.
*/
-static void PanedPlaceSlaves(void *managerData)
+static void PanedPlaceContent(void *managerData)
{
Paned *pw = (Paned *)managerData;
PlaceSashes(pw, Tk_Width(pw->core.tkwin), Tk_Height(pw->core.tkwin));
@@ -406,62 +406,62 @@ static void PanedPlaceSlaves(void *managerData)
static void PaneRemoved(void *managerData, TkSizeT index)
{
Paned *pw = (Paned *)managerData;
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
DestroyPane(pw, pane);
}
static int AddPane(
Tcl_Interp *interp, Paned *pw,
- int destIndex, Tk_Window slaveWindow,
+ int destIndex, Tk_Window window,
int objc, Tcl_Obj *const objv[])
{
Pane *pane;
- if (!Ttk_Maintainable(interp, slaveWindow, pw->core.tkwin)) {
+ if (!Ttk_Maintainable(interp, window, pw->core.tkwin)) {
return TCL_ERROR;
}
- if (Ttk_SlaveIndex(pw->paned.mgr, slaveWindow) != TCL_INDEX_NONE) {
+ if (Ttk_ContentIndex(pw->paned.mgr, window) != TCL_INDEX_NONE) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "%s already added", Tk_PathName(slaveWindow)));
+ "%s already added", Tk_PathName(window)));
Tcl_SetErrorCode(interp, "TTK", "PANE", "PRESENT", NULL);
return TCL_ERROR;
}
- pane = CreatePane(interp, pw, slaveWindow);
+ pane = CreatePane(interp, pw, window);
if (!pane) {
return TCL_ERROR;
}
- if (ConfigurePane(interp, pw, pane, slaveWindow, objc, objv) != TCL_OK) {
+ if (ConfigurePane(interp, pw, pane, window, objc, objv) != TCL_OK) {
DestroyPane(pw, pane);
return TCL_ERROR;
}
- Ttk_InsertSlave(pw->paned.mgr, destIndex, slaveWindow, pane);
+ Ttk_InsertContent(pw->paned.mgr, destIndex, window, pane);
return TCL_OK;
}
/* PaneRequest --
- * Only update pane request size if slave is currently unmapped.
- * Geometry requests from mapped slaves are not directly honored
+ * Only update pane request size if pane is currently unmapped.
+ * Geometry requests from mapped panes 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, TkSizeT index, int width, int height)
{
Paned *pw = (Paned *)managerData;
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
- Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
+ Tk_Window window = Ttk_ContentWindow(pw->paned.mgr, index);
int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL;
- if (!Tk_IsMapped(slaveWindow)) {
+ if (!Tk_IsMapped(window)) {
pane->reqSize = horizontal ? width : height;
}
return 1;
}
static Ttk_ManagerSpec PanedManagerSpec = {
- { "panedwindow", Ttk_GeometryRequestProc, Ttk_LostSlaveProc },
+ { "panedwindow", Ttk_GeometryRequestProc, Ttk_LostContentProc },
PanedSize,
- PanedPlaceSlaves,
+ PanedPlaceContent,
PaneRequest,
PaneRemoved
};
@@ -486,7 +486,7 @@ static void PanedEventProc(ClientData clientData, XEvent *eventPtr)
if ( eventPtr->type == LeaveNotify
&& eventPtr->xcrossing.detail == NotifyInferior)
{
- TtkSendVirtualEvent(corePtr->tkwin, "EnteredChild");
+ Tk_SendVirtualEvent(corePtr->tkwin, "EnteredChild", NULL);
}
}
@@ -519,10 +519,12 @@ static void PanedCleanup(void *recordPtr)
/* Post-configuration hook.
*/
-static int PanedPostConfigure(Tcl_Interp *dummy, void *clientData, int mask)
+static int PanedPostConfigure(
+ TCL_UNUSED(Tcl_Interp *),
+ void *clientData,
+ int mask)
{
Paned *pw = (Paned *)clientData;
- (void)dummy;
if (mask & GEOMETRY_CHANGED) {
/* User has changed -width or -height.
@@ -581,7 +583,7 @@ static Ttk_Layout PanedGetLayout(
*/
static Ttk_Layout SashLayout(Paned *pw, int index)
{
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
int thickness = pw->paned.sashThickness,
height = Tk_Height(pw->core.tkwin),
width = Tk_Width(pw->core.tkwin),
@@ -604,10 +606,10 @@ static void DrawSash(Paned *pw, int index, Drawable d)
static void PanedDisplay(void *recordPtr, Drawable d)
{
Paned *pw = (Paned *)recordPtr;
- TkSizeT i, nSlaves = Ttk_NumberSlaves(pw->paned.mgr);
+ TkSizeT i, nContent = Ttk_NumberContent(pw->paned.mgr);
TtkWidgetDisplay(recordPtr, d);
- for (i = 1; i < nSlaves; ++i) {
+ for (i = 1; i < nContent; ++i) {
DrawSash(pw, i - 1, d);
}
}
@@ -622,65 +624,65 @@ static int PanedAddCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Paned *pw = (Paned *)recordPtr;
- Tk_Window slaveWindow;
+ Tk_Window window;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv, "window");
return TCL_ERROR;
}
- slaveWindow = Tk_NameToWindow(
+ window = Tk_NameToWindow(
interp, Tcl_GetString(objv[2]), pw->core.tkwin);
- if (!slaveWindow) {
+ if (!window) {
return TCL_ERROR;
}
- return AddPane(interp, pw, Ttk_NumberSlaves(pw->paned.mgr), slaveWindow,
+ return AddPane(interp, pw, Ttk_NumberContent(pw->paned.mgr), window,
objc - 3, objv + 3);
}
-/* $pw insert $index $slave ?-option value ...?
- * Insert new slave, or move existing one.
+/* $pw insert $index $window ?-option value ...?
+ * Insert new content window, or move existing one.
*/
static int PanedInsertCommand(
void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
Paned *pw = (Paned *)recordPtr;
- TkSizeT nSlaves = Ttk_NumberSlaves(pw->paned.mgr);
+ TkSizeT nContent = Ttk_NumberContent(pw->paned.mgr);
TkSizeT srcIndex, destIndex;
- Tk_Window slaveWindow;
+ Tk_Window window;
if (objc < 4) {
- Tcl_WrongNumArgs(interp, 2,objv, "index slave ?-option value ...?");
+ Tcl_WrongNumArgs(interp, 2,objv, "index window ?-option value ...?");
return TCL_ERROR;
}
- slaveWindow = Tk_NameToWindow(
+ window = Tk_NameToWindow(
interp, Tcl_GetString(objv[3]), pw->core.tkwin);
- if (!slaveWindow) {
+ if (!window) {
return TCL_ERROR;
}
- if (TCL_OK != Ttk_GetSlaveIndexFromObj(
+ if (TCL_OK != Ttk_GetContentIndexFromObj(
interp,pw->paned.mgr, objv[2], &destIndex))
{
return TCL_ERROR;
}
- srcIndex = Ttk_SlaveIndex(pw->paned.mgr, slaveWindow);
- if (srcIndex == TCL_INDEX_NONE) { /* New slave: */
- return AddPane(interp, pw, destIndex, slaveWindow, objc-4, objv+4);
- } /* else -- move existing slave: */
+ srcIndex = Ttk_ContentIndex(pw->paned.mgr, window);
+ if (srcIndex == TCL_INDEX_NONE) { /* New content: */
+ return AddPane(interp, pw, destIndex, window, objc-4, objv+4);
+ } /* else -- move existing content: */
- if (destIndex + 1 >= nSlaves + 1)
- destIndex = nSlaves - 1;
- Ttk_ReorderSlave(pw->paned.mgr, srcIndex, destIndex);
+ if (destIndex + 1 >= nContent + 1)
+ destIndex = nContent - 1;
+ Ttk_ReorderContent(pw->paned.mgr, srcIndex, destIndex);
return objc == 4 ? TCL_OK :
ConfigurePane(interp, pw,
- (Pane *)Ttk_SlaveData(pw->paned.mgr, destIndex),
- Ttk_SlaveWindow(pw->paned.mgr, destIndex),
+ (Pane *)Ttk_ContentData(pw->paned.mgr, destIndex),
+ Ttk_ContentWindow(pw->paned.mgr, destIndex),
objc-4, objv+4);
}
@@ -697,14 +699,14 @@ static int PanedForgetCommand(
return TCL_ERROR;
}
- if (TCL_OK != Ttk_GetSlaveIndexFromObj(
+ if (TCL_OK != Ttk_GetContentIndexFromObj(
interp, pw->paned.mgr, objv[2], &paneIndex))
{
return TCL_ERROR;
- } else if (paneIndex + 1 >= Ttk_NumberSlaves(pw->paned.mgr) + 1) {
- paneIndex = Ttk_NumberSlaves(pw->paned.mgr) - 1;
+ } else if (paneIndex + 1 >= Ttk_NumberContent(pw->paned.mgr) + 1) {
+ paneIndex = Ttk_NumberContent(pw->paned.mgr) - 1;
}
- Ttk_ForgetSlave(pw->paned.mgr, paneIndex);
+ Ttk_ForgetContent(pw->paned.mgr, paneIndex);
return TCL_OK;
}
@@ -720,7 +722,7 @@ static int PanedIdentifyCommand(
int what = IDENTIFY_SASH;
Paned *pw = (Paned *)recordPtr;
int sashThickness = pw->paned.sashThickness;
- int nSashes = Ttk_NumberSlaves(pw->paned.mgr) - 1;
+ int nSashes = Ttk_NumberContent(pw->paned.mgr) - 1;
int x, y, pos;
int index;
@@ -739,7 +741,7 @@ static int PanedIdentifyCommand(
pos = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? x : y;
for (index = 0; index < nSashes; ++index) {
- Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index);
+ Pane *pane = (Pane *)Ttk_ContentData(pw->paned.mgr, index);
if (pane->sashPos <= pos && pos <= pane->sashPos + sashThickness) {
/* Found it. */
switch (what) {
@@ -771,7 +773,7 @@ static int PanedPaneCommand(
{
Paned *pw = (Paned *)recordPtr;
TkSizeT paneIndex;
- Tk_Window slaveWindow;
+ Tk_Window window;
Pane *pane;
if (objc < 3) {
@@ -779,26 +781,26 @@ static int PanedPaneCommand(
return TCL_ERROR;
}
- if (TCL_OK != Ttk_GetSlaveIndexFromObj(
+ if (TCL_OK != Ttk_GetContentIndexFromObj(
interp,pw->paned.mgr, objv[2], &paneIndex))
{
return TCL_ERROR;
- } else if (paneIndex + 1 >= Ttk_NumberSlaves(pw->paned.mgr) + 1) {
- paneIndex = Ttk_NumberSlaves(pw->paned.mgr) - 1;
+ } else if (paneIndex + 1 >= Ttk_NumberContent(pw->paned.mgr) + 1) {
+ paneIndex = Ttk_NumberContent(pw->paned.mgr) - 1;
}
- pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, paneIndex);
- slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, paneIndex);
+ pane = (Pane *)Ttk_ContentData(pw->paned.mgr, paneIndex);
+ window = Ttk_ContentWindow(pw->paned.mgr, paneIndex);
switch (objc) {
case 3:
return TtkEnumerateOptions(interp, pane, PaneOptionSpecs,
- pw->paned.paneOptionTable, slaveWindow);
+ pw->paned.paneOptionTable, window);
case 4:
return TtkGetOptionValue(interp, pane, objv[3],
- pw->paned.paneOptionTable, slaveWindow);
+ pw->paned.paneOptionTable, window);
default:
- return ConfigurePane(interp, pw, pane, slaveWindow, objc-3,objv+3);
+ return ConfigurePane(interp, pw, pane, window, objc-3,objv+3);
}
}
@@ -819,8 +821,8 @@ static int PanedPanesCommand(
}
panes = Tcl_NewListObj(0, NULL);
- for (i = 0; i < Ttk_NumberSlaves(mgr); ++i) {
- const char *pathName = Tk_PathName(Ttk_SlaveWindow(mgr,i));
+ for (i = 0; i < Ttk_NumberContent(mgr); ++i) {
+ const char *pathName = Tk_PathName(Ttk_ContentWindow(mgr,i));
Tcl_ListObjAppendElement(interp, panes, Tcl_NewStringObj(pathName,-1));
}
Tcl_SetObjResult(interp, panes);
@@ -846,14 +848,14 @@ static int PanedSashposCommand(
if (Tcl_GetIntFromObj(interp, objv[2], &sashIndex) != TCL_OK) {
return TCL_ERROR;
}
- if (sashIndex < 0 || (TkSizeT)sashIndex + 1 >= Ttk_NumberSlaves(pw->paned.mgr)) {
+ if (sashIndex < 0 || (TkSizeT)sashIndex + 1 >= Ttk_NumberContent(pw->paned.mgr)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"sash index %d out of range", sashIndex));
Tcl_SetErrorCode(interp, "TTK", "PANE", "SASH_INDEX", NULL);
return TCL_ERROR;
}
- pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, sashIndex);
+ pane = (Pane *)Ttk_ContentData(pw->paned.mgr, sashIndex);
if (objc == 3) {
Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pane->sashPos));
@@ -880,8 +882,8 @@ static int PanedSashposCommand(
static const Ttk_Ensemble PanedCommands[] = {
{ "add", PanedAddCommand,0 },
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "forget", PanedForgetCommand,0 },
{ "identify", PanedIdentifyCommand,0 },
{ "insert", PanedInsertCommand,0 },
@@ -890,6 +892,7 @@ static const Ttk_Ensemble PanedCommands[] = {
{ "panes", PanedPanesCommand,0 },
{ "sashpos", PanedSashposCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
@@ -930,14 +933,15 @@ static const Ttk_ElementOptionSpec SashElementOptions[] = {
};
static void SashElementSize(
- void *dummy, void *elementRecord, Tk_Window tkwin,
- int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+ TCL_UNUSED(void *),
+ void *elementRecord,
+ TCL_UNUSED(Tk_Window),
+ int *widthPtr,
+ int *heightPtr,
+ TCL_UNUSED(Ttk_Padding *))
{
SashElement *sash = (SashElement *)elementRecord;
int thickness = DEFAULT_SASH_THICKNESS;
- (void)dummy;
- (void)tkwin;
- (void)paddingPtr;
Tcl_GetIntFromObj(NULL, sash->thicknessObj, &thickness);
*widthPtr = *heightPtr = thickness;
diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c
index 6e5875e..608b226 100644
--- a/generic/ttk/ttkProgress.c
+++ b/generic/ttk/ttkProgress.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) Joe English, Pat Thoyts, Michael Kirkham
+ * Copyright © Joe English, Pat Thoyts, Michael Kirkham
*
* ttk::progressbar widget.
*/
@@ -71,10 +71,10 @@ static const Tk_OptionSpec ProgressbarOptionSpecs[] =
{TK_OPTION_STRING_TABLE, "-mode", "mode", "ProgressMode", "determinate",
offsetof(Progressbar,progress.modeObj),
offsetof(Progressbar,progress.mode),
- 0, (ClientData)ProgressbarModeStrings, 0 },
+ 0, (void *)ProgressbarModeStrings, 0 },
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient",
"horizontal", offsetof(Progressbar,progress.orientObj), TCL_INDEX_NONE,
- 0, (ClientData)ttkOrientStrings, STYLE_CHANGED },
+ 0, (void *)ttkOrientStrings, STYLE_CHANGED },
{TK_OPTION_INT, "-phase", "phase", "Phase",
"0", offsetof(Progressbar,progress.phaseObj), TCL_INDEX_NONE,
0, 0, 0 },
@@ -125,7 +125,6 @@ static void AnimateProgressProc(ClientData clientData)
Progressbar *pb = (Progressbar *)clientData;
pb->progress.timer = 0;
-
if (AnimationEnabled(pb)) {
int phase = 0;
Tcl_GetIntFromObj(NULL, pb->progress.phaseObj, &phase);
@@ -133,19 +132,21 @@ static void AnimateProgressProc(ClientData clientData)
/*
* Update -phase:
*/
+
++phase;
- if (pb->progress.maxPhase)
- phase %= pb->progress.maxPhase;
+ if (phase > pb->progress.maxPhase) {
+ phase = 0;
+ }
Tcl_DecrRefCount(pb->progress.phaseObj);
- pb->progress.phaseObj = Tcl_NewIntObj(phase);
+ pb->progress.phaseObj = Tcl_NewWideIntObj(phase);
Tcl_IncrRefCount(pb->progress.phaseObj);
/*
* Reschedule:
*/
+
pb->progress.timer = Tcl_CreateTimerHandler(
pb->progress.period, AnimateProgressProc, clientData);
-
TtkRedisplayWidget(&pb->core);
}
}
@@ -208,10 +209,11 @@ static void VariableChanged(void *recordPtr, const char *value)
* +++ Widget class methods:
*/
-static void ProgressbarInitialize(Tcl_Interp *dummy, void *recordPtr)
+static void ProgressbarInitialize(
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr)
{
Progressbar *pb = (Progressbar *)recordPtr;
- (void)dummy;
pb->progress.variableTrace = 0;
pb->progress.timer = 0;
@@ -259,12 +261,12 @@ static int ProgressbarConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
* Post-configuration hook:
*/
static int ProgressbarPostConfigure(
- Tcl_Interp *dummy, void *recordPtr, int mask)
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr,
+ TCL_UNUSED(int))
{
Progressbar *pb = (Progressbar *)recordPtr;
int status = TCL_OK;
- (void)dummy;
- (void)mask;
if (pb->progress.variableTrace) {
status = Ttk_FireTrace(pb->progress.variableTrace);
@@ -497,32 +499,35 @@ static int ProgressbarStartStopCommand(
}
static int ProgressbarStartCommand(
- void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
{
- (void)recordPtr;
-
return ProgressbarStartStopCommand(
- interp, "::ttk::progressbar::start", objc, objv);
+ interp, "::ttk::progressbar::start", objc, objv);
}
static int ProgressbarStopCommand(
- void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
{
- (void)recordPtr;
-
return ProgressbarStartStopCommand(
- interp, "::ttk::progressbar::stop", objc, objv);
+ interp, "::ttk::progressbar::stop", objc, objv);
}
static const Ttk_Ensemble ProgressbarCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "start", ProgressbarStartCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
{ "step", ProgressbarStepCommand,0 },
{ "stop", ProgressbarStopCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c
index a6bde9a..7e8fdc9 100644
--- a/generic/ttk/ttkScale.c
+++ b/generic/ttk/ttkScale.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
+ * Copyright © 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
*
* ttk::scale widget.
*/
@@ -57,11 +57,11 @@ static const Tk_OptionSpec ScaleOptionSpecs[] =
TK_OPTION_NULL_OK,0,0},
{TK_OPTION_STRING, "-variable", "variable", "Variable", "",
offsetof(Scale,scale.variableObj), TCL_INDEX_NONE,
- 0,0,0},
+ 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal",
offsetof(Scale,scale.orientObj),
offsetof(Scale,scale.orient), 0,
- (ClientData)ttkOrientStrings, STYLE_CHANGED },
+ (void *)ttkOrientStrings, STYLE_CHANGED },
{TK_OPTION_DOUBLE, "-from", "from", "From", "0",
offsetof(Scale,scale.fromObj), TCL_INDEX_NONE, 0, 0, 0},
@@ -75,7 +75,7 @@ static const Tk_OptionSpec ScaleOptionSpecs[] =
{TK_OPTION_STRING, "-state", "state", "State",
"normal", offsetof(Scale,scale.stateObj), TCL_INDEX_NONE,
- 0,0,STATE_CHANGED},
+ 0, 0, STATE_CHANGED},
WIDGET_TAKEFOCUS_TRUE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
@@ -110,10 +110,11 @@ static void ScaleVariableChanged(void *recordPtr, const char *value)
/* ScaleInitialize --
* Scale widget initialization hook.
*/
-static void ScaleInitialize(Tcl_Interp *dummy, void *recordPtr)
+static void ScaleInitialize(
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr)
{
Scale *scalePtr = (Scale *)recordPtr;
- (void)dummy;
TtkTrackElementState(&scalePtr->core);
}
@@ -163,12 +164,12 @@ static int ScaleConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
* Post-configuration hook.
*/
static int ScalePostConfigure(
- Tcl_Interp *dummy, void *recordPtr, int mask)
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr,
+ TCL_UNUSED(int))
{
Scale *scale = (Scale *)recordPtr;
int status = TCL_OK;
- (void)dummy;
- (void)mask;
if (scale->scale.variableTrace) {
status = Ttk_FireTrace(scale->scale.variableTrace);
@@ -376,8 +377,8 @@ ScaleCoordsCommand(
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);
+ point[0] = Tcl_NewWideIntObj(pt.x);
+ point[1] = Tcl_NewWideIntObj(pt.y);
Tcl_SetObjResult(interp, Tcl_NewListObj(2, point));
}
return r;
@@ -481,14 +482,15 @@ ValueToPoint(Scale *scalePtr, double value)
}
static const Ttk_Ensemble ScaleCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
- { "state", TtkWidgetStateCommand,0 },
- { "instate", TtkWidgetInstateCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
+ { "coords", ScaleCoordsCommand,0 },
+ { "get", ScaleGetCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
{ "set", ScaleSetCommand,0 },
- { "get", ScaleGetCommand,0 },
- { "coords", ScaleCoordsCommand,0 },
+ { "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c
index b031dc6..69370c9 100644
--- a/generic/ttk/ttkScroll.c
+++ b/generic/ttk/ttkScroll.c
@@ -130,12 +130,12 @@ static void UpdateScrollbarBG(ClientData clientData)
int code;
h->flags &= ~SCROLL_UPDATE_PENDING;
- Tcl_Preserve((ClientData) interp);
+ Tcl_Preserve(interp);
code = UpdateScrollbar(interp, h);
if (code == TCL_ERROR && !Tcl_InterpDeleted(interp)) {
Tcl_BackgroundException(interp, code);
}
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
}
/* TtkScrolled --
@@ -167,7 +167,7 @@ void TtkScrolled(ScrollHandle h, int first, int last, int total)
s->total = total;
if (!(h->flags & SCROLL_UPDATE_PENDING)) {
- Tcl_DoWhenIdle(UpdateScrollbarBG, (ClientData)h);
+ Tcl_DoWhenIdle(UpdateScrollbarBG, h);
h->flags |= SCROLL_UPDATE_PENDING;
}
}
@@ -274,7 +274,7 @@ void TtkScrollTo(ScrollHandle h, int newFirst, int updateScrollInfo)
void TtkFreeScrollHandle(ScrollHandle h)
{
if (h->flags & SCROLL_UPDATE_PENDING) {
- Tcl_CancelIdleCall(UpdateScrollbarBG, (ClientData)h);
+ Tcl_CancelIdleCall(UpdateScrollbarBG, h);
}
ckfree(h);
}
diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c
index 1b915cc..a3f1594 100644
--- a/generic/ttk/ttkScrollbar.c
+++ b/generic/ttk/ttkScrollbar.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Joe English
+ * Copyright © 2003 Joe English
*
* ttk::scrollbar widget.
*/
@@ -34,12 +34,12 @@ typedef struct
static const Tk_OptionSpec ScrollbarOptionSpecs[] =
{
{TK_OPTION_STRING, "-command", "command", "Command", "",
- offsetof(Scrollbar,scrollbar.commandObj), TCL_INDEX_NONE, 0,0,0},
+ offsetof(Scrollbar, scrollbar.commandObj), TCL_INDEX_NONE, 0, 0, 0},
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical",
- offsetof(Scrollbar,scrollbar.orientObj),
- offsetof(Scrollbar,scrollbar.orient),
- 0,(ClientData)ttkOrientStrings,STYLE_CHANGED },
+ offsetof(Scrollbar, scrollbar.orientObj),
+ offsetof(Scrollbar, scrollbar.orient),
+ 0, (void *)ttkOrientStrings, STYLE_CHANGED },
WIDGET_TAKEFOCUS_FALSE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
@@ -50,10 +50,11 @@ static const Tk_OptionSpec ScrollbarOptionSpecs[] =
*/
static void
-ScrollbarInitialize(Tcl_Interp *dummy, void *recordPtr)
+ScrollbarInitialize(
+ TCL_UNUSED(Tcl_Interp *),
+ void *recordPtr)
{
Scrollbar *sb = (Scrollbar *)recordPtr;
- (void)dummy;
sb->scrollbar.first = 0.0;
sb->scrollbar.last = 1.0;
@@ -281,8 +282,8 @@ ScrollbarFractionCommand(
}
static const Ttk_Ensemble ScrollbarCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "delta", ScrollbarDeltaCommand,0 },
{ "fraction", ScrollbarFractionCommand,0 },
{ "get", ScrollbarGetCommand,0 },
@@ -290,6 +291,7 @@ static const Ttk_Ensemble ScrollbarCommands[] = {
{ "instate", TtkWidgetInstateCommand,0 },
{ "set", ScrollbarSetCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
@@ -316,16 +318,14 @@ 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_NODE("Vertical.Scrollbar.thumb", 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_NODE("Horizontal.Scrollbar.thumb", TTK_FILL_BOTH))
TTK_END_LAYOUT
/*------------------------------------------------------------------------
diff --git a/generic/ttk/ttkSeparator.c b/generic/ttk/ttkSeparator.c
index 00605dc..9b712fd 100644
--- a/generic/ttk/ttkSeparator.c
+++ b/generic/ttk/ttkSeparator.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Joe English
+ * Copyright © 2004 Joe English
*
* ttk::separator and ttk::sizegrip widgets.
*/
@@ -26,7 +26,7 @@ static const Tk_OptionSpec SeparatorOptionSpecs[] = {
{TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal",
offsetof(Separator,separator.orientObj),
offsetof(Separator,separator.orient),
- 0,(ClientData)ttkOrientStrings,STYLE_CHANGED },
+ 0, (void *)ttkOrientStrings, STYLE_CHANGED },
WIDGET_TAKEFOCUS_FALSE,
WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs)
@@ -48,11 +48,12 @@ static Ttk_Layout SeparatorGetLayout(
* Widget commands:
*/
static const Ttk_Ensemble SeparatorCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
@@ -89,11 +90,12 @@ static const Tk_OptionSpec SizegripOptionSpecs[] = {
};
static const Ttk_Ensemble SizegripCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
diff --git a/generic/ttk/ttkSquare.c b/generic/ttk/ttkSquare.c
index 422afc3..9250b4b 100644
--- a/generic/ttk/ttkSquare.c
+++ b/generic/ttk/ttkSquare.c
@@ -1,4 +1,4 @@
-/* square.c - Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
+/* square.c - Copyright © 2004 Pat Thoyts <patthoyts@users.sourceforge.net>
*
* Minimal sample ttk widget.
*/
@@ -129,11 +129,12 @@ SquareDoLayout(void *clientData)
*/
static const Ttk_Ensemble SquareCommands[] = {
- { "configure", TtkWidgetConfigureCommand,0 },
{ "cget", TtkWidgetCgetCommand,0 },
+ { "configure", TtkWidgetConfigureCommand,0 },
{ "identify", TtkWidgetIdentifyCommand,0 },
{ "instate", TtkWidgetInstateCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ 0,0,0 }
};
@@ -198,12 +199,15 @@ static const Ttk_ElementOptionSpec SquareElementOptions[] =
*/
static void SquareElementSize(
- void *dummy, void *elementRecord, Tk_Window tkwin,
- int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
+ TCL_UNUSED(void *),
+ void *elementRecord,
+ Tk_Window tkwin,
+ int *widthPtr,
+ int *heightPtr,
+ Ttk_Padding *paddingPtr)
{
SquareElement *square = (SquareElement *)elementRecord;
int borderWidth = 0;
- (void)dummy;
Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth);
*paddingPtr = Ttk_UniformPadding((short)borderWidth);
@@ -216,14 +220,16 @@ static void SquareElementSize(
*/
static void SquareElementDraw(
- void *dummy, void *elementRecord, Tk_Window tkwin,
- Drawable d, Ttk_Box b, unsigned int state)
+ TCL_UNUSED(void *),
+ void *elementRecord,
+ Tk_Window tkwin,
+ Drawable d,
+ Ttk_Box b,
+ TCL_UNUSED(unsigned int))
{
SquareElement *square = (SquareElement *)elementRecord;
Tk_3DBorder foreground = NULL;
int borderWidth = 1, relief = TK_RELIEF_FLAT;
- (void)dummy;
- (void)state;
foreground = Tk_Get3DBorderFromObj(tkwin, square->foregroundObj);
Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth);
diff --git a/generic/ttk/ttkState.c b/generic/ttk/ttkState.c
index a704fa4..3da9531 100644
--- a/generic/ttk/ttkState.c
+++ b/generic/ttk/ttkState.c
@@ -1,7 +1,7 @@
/*
* Tk widget state utilities.
*
- * Copyright (c) 2003 Joe English. Freely redistributable.
+ * Copyright © 2003 Joe English. Freely redistributable.
*
*/
diff --git a/generic/ttk/ttkStubInit.c b/generic/ttk/ttkStubInit.c
index 31cdaa8..dc11b4c 100644
--- a/generic/ttk/ttkStubInit.c
+++ b/generic/ttk/ttkStubInit.c
@@ -3,7 +3,7 @@
* It is compiled and linked in with the ttk package proper.
*/
-#include "tk.h"
+#include "tkInt.h"
#include "ttkTheme.h"
MODULE_SCOPE const TtkStubs ttkStubs;
diff --git a/generic/ttk/ttkStubLib.c b/generic/ttk/ttkStubLib.c
index 5675416..a3b3376 100644
--- a/generic/ttk/ttkStubLib.c
+++ b/generic/ttk/ttkStubLib.c
@@ -6,7 +6,7 @@
#undef USE_TCL_STUBS
#define USE_TCL_STUBS
-#include "tk.h"
+#include "tkInt.h"
#define USE_TTK_STUBS 1
#include "ttkTheme.h"
@@ -34,17 +34,23 @@ TtkInitializeStubs(
Tcl_Interp *interp, const char *version, int epoch, int revision)
{
int exact = 0;
- const char *packageName = "Ttk";
+ const char *packageName = "ttk";
const char *errMsg = NULL;
void *pkgClientData = NULL;
const char *actualVersion = Tcl_PkgRequireEx(
interp, packageName, version, exact, &pkgClientData);
- const TtkStubs *stubsPtr = (const TtkStubs *)pkgClientData;
+ const TtkStubs *stubsPtr;
if (!actualVersion) {
- return NULL;
+ packageName = "Ttk";
+ actualVersion = Tcl_PkgRequireEx(
+ interp, packageName, version, exact, &pkgClientData);
+ if (!actualVersion) {
+ return NULL;
+ }
}
+ stubsPtr = (const TtkStubs *)pkgClientData;
if (!stubsPtr) {
errMsg = "missing stub table pointer";
goto error;
diff --git a/generic/ttk/ttkTagSet.c b/generic/ttk/ttkTagSet.c
index e99c76f..c1ec4c2 100644
--- a/generic/ttk/ttkTagSet.c
+++ b/generic/ttk/ttkTagSet.c
@@ -1,7 +1,7 @@
/*
* Tag tables. 3/4-baked, work in progress.
*
- * Copyright (C) 2005, Joe English. Freely redistributable.
+ * Copyright © 2005, Joe English. Freely redistributable.
*/
#include "tkInt.h"
diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c
index a8745d7..a4ad79b 100644
--- a/generic/ttk/ttkTheme.c
+++ b/generic/ttk/ttkTheme.c
@@ -3,8 +3,8 @@
*
* This file implements the widget styles and themes support.
*
- * Copyright (c) 2002 Frederic Bonnet
- * Copyright (c) 2003 Joe English
+ * Copyright © 2002 Frederic Bonnet
+ * Copyright © 2003 Joe English
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -95,7 +95,7 @@ Tcl_Obj *Ttk_StyleMap(Ttk_Style style, const char *optionName, Ttk_State state)
/*
* Ttk_StyleDefault --
- * Look up default resource setting the in the specified style.
+ * Look up default resource setting in the specified style.
*/
Tcl_Obj *Ttk_StyleDefault(Ttk_Style style, const char *optionName)
{
@@ -291,13 +291,12 @@ static void FreeElementClass(Ttk_ElementClass *elementClass)
* +++ Themes.
*/
-static int ThemeEnabled(Ttk_Theme theme, void *dummy)
+static int ThemeEnabled(
+ TCL_UNUSED(Ttk_Theme),
+ TCL_UNUSED(void *))
{
- (void)theme;
- (void)dummy;
-
/* Default ThemeEnabledProc -- always return true */
- return 1;
+ return 1;
}
typedef struct Ttk_Theme_
@@ -390,7 +389,7 @@ typedef struct CleanupStruct {
} Cleanup;
/*------------------------------------------------------------------------
- * +++ Master style package data structure.
+ * +++ Style package data structure.
*/
typedef struct
{
@@ -404,18 +403,19 @@ typedef struct
int themeChangePending; /* scheduled ThemeChangedProc call? */
} StylePackageData;
-static void ThemeChangedProc(ClientData); /* Forward */
+static void ThemeChangedProc(void *); /* Forward */
/* Ttk_StylePkgFree --
* Cleanup procedure for StylePackageData.
*/
-static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *dummy)
+static void Ttk_StylePkgFree(
+ ClientData clientData,
+ TCL_UNUSED(Tcl_Interp *))
{
StylePackageData *pkgPtr = (StylePackageData *)clientData;
Tcl_HashSearch search;
Tcl_HashEntry *entryPtr;
Cleanup *cleanup;
- (void)dummy;
/*
* Cancel any pending ThemeChanged calls:
@@ -517,9 +517,6 @@ static void ThemeChangedProc(ClientData clientData)
Tcl_BackgroundException(pkgPtr->interp, code);
}
pkgPtr->themeChangePending = 0;
-#ifdef MAC_OSX_TK
- XSync(NULL, False);
-#endif
}
/*
@@ -593,7 +590,7 @@ void Ttk_SetThemeEnabledProc(
static Ttk_Theme LookupTheme(
Tcl_Interp *interp, /* where to leave error messages */
- StylePackageData *pkgPtr, /* style package master record */
+ StylePackageData *pkgPtr, /* style package record */
const char *name) /* theme name */
{
Tcl_HashEntry *entryPtr;
@@ -830,13 +827,12 @@ int Ttk_RegisterElementFactory(
* (style element create $name) "from" $theme ?$element?
*/
static int Ttk_CloneElement(
- Tcl_Interp *interp, void *dummy,
+ Tcl_Interp *interp, TCL_UNUSED(void *),
Ttk_Theme theme, const char *elementName,
int objc, Tcl_Obj *const objv[])
{
Ttk_Theme fromTheme;
Ttk_ElementClass *fromElement;
- (void)dummy;
if (objc <= 0 || objc > 2) {
Tcl_WrongNumArgs(interp, 0, objv, "theme ?element?");
@@ -1182,7 +1178,7 @@ static Tcl_Obj* HashTableToDict(Tcl_HashTable *ht)
*/
static int
StyleMapCmd(
- ClientData clientData, /* Master StylePackageData pointer */
+ ClientData clientData, /* StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
@@ -1266,10 +1262,10 @@ usage:
styleName = Tcl_GetString(objv[2]);
stylePtr = Ttk_GetStyle(theme, styleName);
- if (objc == 3) { /* style default $styleName */
+ if (objc == 3) { /* style configure $styleName */
Tcl_SetObjResult(interp, HashTableToDict(&stylePtr->defaultsTable));
return TCL_OK;
- } else if (objc == 4) { /* style default $styleName -option */
+ } else if (objc == 4) { /* style configure $styleName -option */
const char *optionName = Tcl_GetString(objv[3]);
Tcl_HashEntry *entryPtr =
Tcl_FindHashEntry(&stylePtr->defaultsTable, optionName);
@@ -1319,9 +1315,7 @@ static int StyleLookupCmd(
}
style = Ttk_GetStyle(theme, Tcl_GetString(objv[2]));
- if (!style) {
- return TCL_ERROR;
- }
+
optionName = Tcl_GetString(objv[3]);
if (objc >= 5) {
@@ -1446,11 +1440,12 @@ static int StyleThemeCreateCmd(
* Return list of registered themes.
*/
static int StyleThemeNamesCmd(
- ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+ ClientData clientData,
+ Tcl_Interp *interp,
+ TCL_UNUSED(int),
+ TCL_UNUSED(Tcl_Obj *const *))
{
StylePackageData *pkgPtr = (StylePackageData *)clientData;
- (void)objc;
- (void)objv;
return TtkEnumerateHashTable(interp, &pkgPtr->themeTable);
}
@@ -1462,7 +1457,7 @@ static int StyleThemeNamesCmd(
*/
static int
StyleThemeSettingsCmd(
- ClientData clientData, /* Master StylePackageData pointer */
+ ClientData clientData, /* StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
@@ -1615,12 +1610,37 @@ static int StyleLayoutCmd(
return TCL_OK;
}
+/* + style theme styles ?$theme? --
+ * Return list of styles available in $theme.
+ * Use the current theme if $theme is omitted.
+ */
+static int StyleThemeStylesCmd(
+ TCL_UNUSED(ClientData), Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ Ttk_Theme themePtr;
+
+ if (objc < 3 || objc > 4) {
+ Tcl_WrongNumArgs(interp, 3, objv, "?theme?");
+ return TCL_ERROR;
+ }
+
+ if (objc == 3) {
+ themePtr = Ttk_GetCurrentTheme(interp);
+ } else {
+ themePtr = Ttk_GetTheme(interp, Tcl_GetString(objv[3]));
+ }
+ if (!themePtr)
+ return TCL_ERROR;
+
+ return TtkEnumerateHashTable(interp, &themePtr->styleTable);
+}
+
/* + style theme use $theme --
* Sets the current theme to $theme
*/
static int
StyleThemeUseCmd(
- ClientData clientData, /* Master StylePackageData pointer */
+ ClientData clientData, /* StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
@@ -1654,6 +1674,7 @@ static const Ttk_Ensemble StyleThemeEnsemble[] = {
{ "create", StyleThemeCreateCmd, 0 },
{ "names", StyleThemeNamesCmd, 0 },
{ "settings", StyleThemeSettingsCmd, 0 },
+ { "styles", StyleThemeStylesCmd, 0 },
{ "use", StyleThemeUseCmd, 0 },
{ NULL, 0, 0 }
};
@@ -1677,7 +1698,7 @@ static const Ttk_Ensemble StyleEnsemble[] = {
static int
StyleObjCmd(
- ClientData clientData, /* Master StylePackageData pointer */
+ ClientData clientData, /* StylePackageData pointer */
Tcl_Interp *interp, /* Current interpreter */
int objc, /* Number of arguments */
Tcl_Obj *const objv[]) /* Argument objects */
diff --git a/generic/ttk/ttkTrace.c b/generic/ttk/ttkTrace.c
index 7e02b58..1019ffa 100644
--- a/generic/ttk/ttkTrace.c
+++ b/generic/ttk/ttkTrace.c
@@ -26,15 +26,13 @@ static char *
VarTraceProc(
ClientData clientData, /* Widget record pointer */
Tcl_Interp *interp, /* Interpreter containing variable. */
- const char *name1, /* (unused) */
- const char *name2, /* (unused) */
+ TCL_UNUSED(const char *), /* name1 */
+ TCL_UNUSED(const char *), /* name2 */
int flags) /* Information about what happened. */
{
Ttk_TraceHandle *tracePtr = (Ttk_TraceHandle *)clientData;
const char *name, *value;
Tcl_Obj *valuePtr;
- (void)name1;
- (void)name2;
if (Tcl_InterpDeleted(interp)) {
return NULL;
@@ -53,7 +51,7 @@ VarTraceProc(
*/
if (tracePtr->interp == NULL) {
Tcl_DecrRefCount(tracePtr->varnameObj);
- ckfree((ClientData)tracePtr);
+ ckfree(tracePtr);
return NULL;
}
Tcl_TraceVar2(interp, name, NULL,
@@ -98,7 +96,7 @@ Ttk_TraceHandle *Ttk_TraceVariable(
status = Tcl_TraceVar2(interp, Tcl_GetString(varnameObj),
NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- VarTraceProc, (ClientData)h);
+ VarTraceProc, h);
if (status != TCL_OK) {
Tcl_DecrRefCount(h->varnameObj);
@@ -139,7 +137,7 @@ void Ttk_UntraceVariable(Ttk_TraceHandle *h)
*/
while ((cd = Tcl_VarTraceInfo(h->interp, Tcl_GetString(h->varnameObj),
TCL_GLOBAL_ONLY, VarTraceProc, cd)) != NULL) {
- if (cd == (ClientData) h) {
+ if (cd == h) {
break;
}
}
@@ -154,7 +152,7 @@ void Ttk_UntraceVariable(Ttk_TraceHandle *h)
}
Tcl_UntraceVar2(h->interp, Tcl_GetString(h->varnameObj),
NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
- VarTraceProc, (ClientData)h);
+ VarTraceProc, h);
Tcl_DecrRefCount(h->varnameObj);
ckfree(h);
}
diff --git a/generic/ttk/ttkTrack.c b/generic/ttk/ttkTrack.c
index b9aa776..43a7644 100644
--- a/generic/ttk/ttkTrack.c
+++ b/generic/ttk/ttkTrack.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Joe English
+ * Copyright © 2004, Joe English
*
* TtkTrackElementState() -- helper routine for widgets
* like scrollbars in which individual elements may
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index b484d1c..4e212d8 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, Joe English
+ * Copyright © 2004, Joe English
*
* ttk::treeview widget implementation.
*/
@@ -441,21 +441,21 @@ static const char *const SelectModeStrings[] = { "none", "browse", "extended", N
static const Tk_OptionSpec TreeviewOptionSpecs[] = {
{TK_OPTION_STRING, "-columns", "columns", "Columns",
"", offsetof(Treeview,tree.columnsObj), TCL_INDEX_NONE,
- 0,0,COLUMNS_CHANGED | GEOMETRY_CHANGED /*| READONLY_OPTION*/ },
+ 0, 0,COLUMNS_CHANGED | GEOMETRY_CHANGED /*| READONLY_OPTION*/ },
{TK_OPTION_STRING, "-displaycolumns","displayColumns","DisplayColumns",
"#all", offsetof(Treeview,tree.displayColumnsObj), TCL_INDEX_NONE,
- 0,0,DCOLUMNS_CHANGED | GEOMETRY_CHANGED },
+ 0, 0,DCOLUMNS_CHANGED | GEOMETRY_CHANGED },
{TK_OPTION_STRING, "-show", "show", "Show",
DEFAULT_SHOW, offsetof(Treeview,tree.showObj), TCL_INDEX_NONE,
- 0,0,SHOW_CHANGED | GEOMETRY_CHANGED },
+ 0, 0,SHOW_CHANGED | GEOMETRY_CHANGED },
{TK_OPTION_STRING_TABLE, "-selectmode", "selectMode", "SelectMode",
"extended", offsetof(Treeview,tree.selectModeObj), TCL_INDEX_NONE,
- 0,(ClientData)SelectModeStrings,0 },
+ 0, (void *)SelectModeStrings, 0 },
{TK_OPTION_PIXELS, "-height", "height", "Height",
DEF_TREE_ROWS, offsetof(Treeview,tree.heightObj), TCL_INDEX_NONE,
- 0,0,GEOMETRY_CHANGED},
+ 0, 0,GEOMETRY_CHANGED},
{TK_OPTION_STRING, "-padding", "padding", "Pad",
NULL, offsetof(Treeview,tree.paddingObj), TCL_INDEX_NONE,
TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED },
@@ -792,9 +792,8 @@ 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))
- {
+ if ((newSlack < 0 && 0 <= tv->tree.slack)
+ || (newSlack > 0 && 0 >= tv->tree.slack)) {
tv->tree.slack = 0;
return newSlack;
} else {
@@ -1101,10 +1100,9 @@ TreeviewConfigure(Tcl_Interp *interp, void *recordPtr, int mask)
TtkScrollbarUpdateRequired(tv->tree.xscrollHandle);
TtkScrollbarUpdateRequired(tv->tree.yscrollHandle);
}
- if ( (mask & SHOW_CHANGED)
- && GetEnumSetFromObj(
- interp,tv->tree.showObj,showStrings,&showFlags) != TCL_OK)
- {
+ if ((mask & SHOW_CHANGED)
+ && GetEnumSetFromObj(
+ interp,tv->tree.showObj,showStrings,&showFlags) != TCL_OK) {
return TCL_ERROR;
}
@@ -1780,7 +1778,7 @@ static void DrawItem(
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>> */
+ displayItem.anchorObj = tv->tree.column0.anchorObj;
DisplayLayout(tv->tree.itemLayout, &displayItem, state, parcel, d);
x += colwidth;
}
@@ -2109,7 +2107,7 @@ static int TreeviewIndexCommand(
{
Treeview *tv = (Treeview *)recordPtr;
TreeItem *item;
- int index = 0;
+ TkSizeT index = 0;
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "item");
@@ -2125,7 +2123,7 @@ static int TreeviewIndexCommand(
item = item->prev;
}
- Tcl_SetObjResult(interp, Tcl_NewIntObj(index));
+ Tcl_SetObjResult(interp, TkNewIndexObj(index));
return TCL_OK;
}
@@ -2201,9 +2199,8 @@ static int TreeviewHorribleIdentify(
/* ASSERT: objc == 4 */
- if ( Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK
- || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK
- ) {
+ if (Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK
+ || Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK) {
return TCL_ERROR;
}
@@ -2377,7 +2374,7 @@ static int TreeviewItemCommand(
TreeItem *item;
if (objc < 3) {
- Tcl_WrongNumArgs(interp, 2, objv, "item ?option ?value??...");
+ Tcl_WrongNumArgs(interp, 2, objv, "item ?-option ?value??...");
return TCL_ERROR;
}
if (!(item = FindItem(interp, tv, objv[2]))) {
@@ -2730,7 +2727,7 @@ static int TreeviewDeleteCommand(
ckfree(items);
if (selItemDeleted) {
- TtkSendVirtualEvent(tv->core.tkwin, "TreeviewSelect");
+ Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL);
}
TtkRedisplayWidget(&tv->core);
return TCL_OK;
@@ -2750,9 +2747,8 @@ static int TreeviewMoveCommand(
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)
- {
+ if ((item = FindItem(interp, tv, objv[2])) == 0
+ || (parent = FindItem(interp, tv, objv[3])) == 0) {
return TCL_ERROR;
}
@@ -2879,9 +2875,8 @@ static int TreeviewDragCommand(
return TCL_ERROR;
}
- if ( (column = FindColumn(interp, tv, objv[2])) == 0
- || Tcl_GetIntFromObj(interp, objv[3], &newx) != TCL_OK)
- {
+ if ((column = FindColumn(interp, tv, objv[2])) == 0
+ || Tcl_GetIntFromObj(interp, objv[3], &newx) != TCL_OK) {
return TCL_ERROR;
}
@@ -3011,7 +3006,7 @@ static int TreeviewSelectionCommand(
}
ckfree(items);
- TtkSendVirtualEvent(tv->core.tkwin, "TreeviewSelect");
+ Tk_SendVirtualEvent(tv->core.tkwin, "TreeviewSelect", NULL);
TtkRedisplayWidget(&tv->core);
return TCL_OK;
@@ -3300,8 +3295,8 @@ static const Ttk_Ensemble TreeviewCommands[] = {
{ "heading", TreeviewHeadingCommand,0 },
{ "identify", TreeviewIdentifyCommand,0 },
{ "index", TreeviewIndexCommand,0 },
- { "instate", TtkWidgetInstateCommand,0 },
{ "insert", TreeviewInsertCommand,0 },
+ { "instate", TtkWidgetInstateCommand,0 },
{ "item", TreeviewItemCommand,0 },
{ "move", TreeviewMoveCommand,0 },
{ "next", TreeviewNextCommand,0 },
@@ -3311,6 +3306,7 @@ static const Ttk_Ensemble TreeviewCommands[] = {
{ "selection" , TreeviewSelectionCommand,0 },
{ "set", TreeviewSetCommand,0 },
{ "state", TtkWidgetStateCommand,0 },
+ { "style", TtkWidgetStyleCommand,0 },
{ "tag", 0,TreeviewTagCommands },
{ "xview", TreeviewXViewCommand,0 },
{ "yview", TreeviewYViewCommand,0 },
@@ -3351,8 +3347,7 @@ 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_NODE("Treeitem.text", TTK_FILL_BOTH)))
TTK_LAYOUT("Cell",
TTK_GROUP("Treedata.padding", TTK_FILL_BOTH,
diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c
index df6e6be..083a242 100644
--- a/generic/ttk/ttkWidget.c
+++ b/generic/ttk/ttkWidget.c
@@ -1,11 +1,11 @@
/*
- * Copyright (c) 2003, Joe English
+ * Copyright © 2003, Joe English
*
* Core widget utilities.
*/
#include "tkInt.h"
-#include "ttkTheme.h"
+#include "ttkThemeInt.h"
#include "ttkWidget.h"
#ifdef MAC_OSX_TK
@@ -213,7 +213,7 @@ DestroyWidget(WidgetCore *corePtr)
corePtr->widgetSpec->cleanupProc(corePtr);
Tk_FreeConfigOptions(
- (ClientData)corePtr, corePtr->optionTable, corePtr->tkwin);
+ corePtr, corePtr->optionTable, corePtr->tkwin);
if (corePtr->layout) {
Ttk_FreeLayout(corePtr->layout);
@@ -797,4 +797,24 @@ int TtkWidgetIdentifyCommand(
return TCL_OK;
}
+/* $w style
+ * Return the style currently applied to the widget.
+ */
+
+int TtkWidgetStyleCommand(
+ void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
+{
+ WidgetCore *corePtr = (WidgetCore *)recordPtr;
+
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 2, objv, "");
+ return TCL_ERROR;
+ }
+
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ Ttk_StyleName(Ttk_LayoutStyle(corePtr->layout)), -1));
+
+ return TCL_OK;
+}
+
/*EOF*/
diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h
index 6837d89..9321cb0 100644
--- a/generic/ttk/ttkWidget.h
+++ b/generic/ttk/ttkWidget.h
@@ -89,15 +89,17 @@ MODULE_SCOPE int TtkCoreConfigure(Tcl_Interp*, void *, int mask);
/* Common widget commands:
*/
+MODULE_SCOPE int TtkWidgetCgetCommand(
+ void *,Tcl_Interp *, int, Tcl_Obj*const[]);
MODULE_SCOPE int TtkWidgetConfigureCommand(
void *,Tcl_Interp *, int, Tcl_Obj*const[]);
-MODULE_SCOPE int TtkWidgetCgetCommand(
+MODULE_SCOPE int TtkWidgetIdentifyCommand(
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(
+MODULE_SCOPE int TtkWidgetStyleCommand(
void *,Tcl_Interp *, int, Tcl_Obj*const[]);
/* Widget constructor:
@@ -165,11 +167,6 @@ 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(