summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2007-05-29 11:36:42 (GMT)
committerdgp <dgp@users.sourceforge.net>2007-05-29 11:36:42 (GMT)
commita52d2d0ebc3cae69f9803646a3ed9a72032ddf5c (patch)
tree42888f32242aaf56abb081d1bbae3f73053d8215
parent095cd3280ca77a1c44f4ee014fdce3f751c26817 (diff)
downloadtk-a52d2d0ebc3cae69f9803646a3ed9a72032ddf5c.zip
tk-a52d2d0ebc3cae69f9803646a3ed9a72032ddf5c.tar.gz
tk-a52d2d0ebc3cae69f9803646a3ed9a72032ddf5c.tar.bz2
merge updates from HEAD
-rw-r--r--ChangeLog6
-rw-r--r--library/demos/widget5
-rw-r--r--macosx/Wish.xcodeproj/default.pbxuser4
-rw-r--r--macosx/Wish.xcodeproj/project.pbxproj18
-rw-r--r--macosx/tkMacOSXFont.c104
5 files changed, 61 insertions, 76 deletions
diff --git a/ChangeLog b/ChangeLog
index 32210a9..be0ea5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-05-28 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
+
+ * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Fix short
+ measures with flags=TK_WHOLE_WORDS|TK_AT_LEAST_ONE [Bug 1716141].
+ Make some casts unnecessary by changing variable types.
+
2007-05-25 Joe English <jenglish@users.sourceforge.net>
* library/ttk/ttk.tcl: Omit ttk::dialog and dependencies.
diff --git a/library/demos/widget b/library/demos/widget
index c4e9fd6..02b4b0b 100644
--- a/library/demos/widget
+++ b/library/demos/widget
@@ -11,7 +11,7 @@ exec wish "$0" "$@"
# ".tcl" files is this directory, which are sourced by this script
# as needed.
#
-# RCS: @(#) $Id: widget,v 1.29 2007/05/04 21:29:22 patthoyts Exp $
+# RCS: @(#) $Id: widget,v 1.29.2.1 2007/05/29 11:36:43 dgp Exp $
package require Tcl 8.5
package require Tk 8.5
@@ -34,7 +34,8 @@ if {[tk windowingsystem] eq "x11"} {
if {[lsearch -exact [font names] defaultFont] == -1} {
# TIP #145 defines some standard named fonts
- if {[lsearch -exact [font names] TkDefaultFont] != -1} {
+ if {[lsearch -exact [font names] TkDefaultFont] != -1 &&
+ [lsearch -exact [font names] TkFixedFont] != -1} {
# FIX ME: the following tecnique of cloning the font to copy it works
# fine but means that if the system font is changed by
# Tk cannot update the copied font. font alias might be
diff --git a/macosx/Wish.xcodeproj/default.pbxuser b/macosx/Wish.xcodeproj/default.pbxuser
index 8c7c7b7..f8ee8dd 100644
--- a/macosx/Wish.xcodeproj/default.pbxuser
+++ b/macosx/Wish.xcodeproj/default.pbxuser
@@ -34,16 +34,14 @@
NO,
NO,
NO,
- NO,
);
argumentStrings = (
"${SRCROOT}/../../tk/library/demos/widget",
- "${SRCROOT}/../../tk/library/demos/ttk_demo.tcl",
"${SRCROOT}/../../tk/tests/all.tcl",
"-geometry +0+0",
"-singleproc 1",
"-verbose \"bet\"",
- "-skip 'unixfont-5.11 window-2.9'",
+ "-skip window-2.9",
);
autoAttachOnCrash = 1;
configStateDict = {
diff --git a/macosx/Wish.xcodeproj/project.pbxproj b/macosx/Wish.xcodeproj/project.pbxproj
index cc874bc..d314f6f 100644
--- a/macosx/Wish.xcodeproj/project.pbxproj
+++ b/macosx/Wish.xcodeproj/project.pbxproj
@@ -968,11 +968,8 @@
F968883C0AF787B3000797B5 /* combobox.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = combobox.tcl; sourceTree = "<group>"; };
F968883D0AF787B3000797B5 /* cursors.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = cursors.tcl; sourceTree = "<group>"; };
F968883E0AF787B3000797B5 /* defaults.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = defaults.tcl; sourceTree = "<group>"; };
- F968883F0AF787B3000797B5 /* dialog.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = dialog.tcl; sourceTree = "<group>"; };
F96888400AF787B3000797B5 /* entry.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = entry.tcl; sourceTree = "<group>"; };
F96888410AF787B3000797B5 /* fonts.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fonts.tcl; sourceTree = "<group>"; };
- F96888420AF787B3000797B5 /* icons.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = icons.tcl; sourceTree = "<group>"; };
- F96888430AF787B3000797B5 /* keynav.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = keynav.tcl; sourceTree = "<group>"; };
F96888440AF787B3000797B5 /* menubutton.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = menubutton.tcl; sourceTree = "<group>"; };
F96888450AF787B3000797B5 /* notebook.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = notebook.tcl; sourceTree = "<group>"; };
F96888460AF787B3000797B5 /* panedwindow.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.tcl; sourceTree = "<group>"; };
@@ -991,7 +988,6 @@
F96888580AF7880C000797B5 /* image.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = image.test; sourceTree = "<group>"; };
F96888590AF7880C000797B5 /* labelframe.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = labelframe.test; sourceTree = "<group>"; };
F968885A0AF7880C000797B5 /* layout.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = layout.test; sourceTree = "<group>"; };
- F968885B0AF7880C000797B5 /* misc.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = misc.test; sourceTree = "<group>"; };
F968885C0AF7880C000797B5 /* notebook.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = notebook.test; sourceTree = "<group>"; };
F968885D0AF7880C000797B5 /* panedwindow.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = panedwindow.test; sourceTree = "<group>"; };
F968885E0AF7880C000797B5 /* progressbar.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = progressbar.test; sourceTree = "<group>"; };
@@ -1000,13 +996,9 @@
F96888610AF7880C000797B5 /* treeview.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = treeview.test; sourceTree = "<group>"; };
F96888620AF7880C000797B5 /* ttk.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttk.test; sourceTree = "<group>"; };
F96888630AF7880C000797B5 /* validate.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = validate.test; sourceTree = "<group>"; };
- F96888660AF788A6000797B5 /* ttk_demo.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttk_demo.tcl; sourceTree = "<group>"; };
- F96888670AF788A6000797B5 /* ttk_iconlib.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttk_iconlib.tcl; sourceTree = "<group>"; };
- F96888680AF788A6000797B5 /* ttk_repeater.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = ttk_repeater.tcl; sourceTree = "<group>"; };
F968886B0AF788F6000797B5 /* ttk_button.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_button.n; sourceTree = "<group>"; };
F968886C0AF788F6000797B5 /* ttk_checkbutton.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_checkbutton.n; sourceTree = "<group>"; };
F968886D0AF788F6000797B5 /* ttk_combobox.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_combobox.n; sourceTree = "<group>"; };
- F968886E0AF788F6000797B5 /* ttk_dialog.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_dialog.n; sourceTree = "<group>"; };
F968886F0AF788F6000797B5 /* ttk_entry.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_entry.n; sourceTree = "<group>"; };
F96888700AF788F6000797B5 /* ttk_frame.n */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_frame.n; sourceTree = "<group>"; };
F96888710AF788F6000797B5 /* ttk_Geometry.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 4; path = ttk_Geometry.3; sourceTree = "<group>"; };
@@ -1787,7 +1779,7 @@
F966C06F08F281DC005CB29B /* Frameworks */,
1AB674ADFE9D54B511CA2CBB /* Products */,
);
- comments = "Copyright (c) 2004-2007 Daniel A. Steffen <das@users.sourceforge.net>\n\nSee the file \"license.terms\" for information on usage and redistribution of\nthis file, and for a DISCLAIMER OF ALL WARRANTIES.\n\nRCS: @(#) $Id: project.pbxproj,v 1.21 2007/05/16 21:21:35 das Exp $\n";
+ comments = "Copyright (c) 2004-2007 Daniel A. Steffen <das@users.sourceforge.net>\n\nSee the file \"license.terms\" for information on usage and redistribution of\nthis file, and for a DISCLAIMER OF ALL WARRANTIES.\n\nRCS: @(#) $Id: project.pbxproj,v 1.21.2.1 2007/05/29 11:36:45 dgp Exp $\n";
name = Wish;
path = .;
sourceTree = SOURCE_ROOT;
@@ -1970,7 +1962,6 @@
F968886B0AF788F6000797B5 /* ttk_button.n */,
F968886C0AF788F6000797B5 /* ttk_checkbutton.n */,
F968886D0AF788F6000797B5 /* ttk_combobox.n */,
- F968886E0AF788F6000797B5 /* ttk_dialog.n */,
F968886F0AF788F6000797B5 /* ttk_entry.n */,
F96888700AF788F6000797B5 /* ttk_frame.n */,
F96888710AF788F6000797B5 /* ttk_Geometry.3 */,
@@ -2206,9 +2197,6 @@
F966BB5B08F27A3A005CB29B /* tcolor */,
F966BB5C08F27A3A005CB29B /* text.tcl */,
F966BB5D08F27A3A005CB29B /* timer */,
- F96888660AF788A6000797B5 /* ttk_demo.tcl */,
- F96888670AF788A6000797B5 /* ttk_iconlib.tcl */,
- F96888680AF788A6000797B5 /* ttk_repeater.tcl */,
F966BB5E08F27A3A005CB29B /* twind.tcl */,
F966BB5F08F27A3A005CB29B /* unicodeout.tcl */,
F966BB6008F27A3A005CB29B /* vscale.tcl */,
@@ -2594,11 +2582,8 @@
F968883C0AF787B3000797B5 /* combobox.tcl */,
F968883D0AF787B3000797B5 /* cursors.tcl */,
F968883E0AF787B3000797B5 /* defaults.tcl */,
- F968883F0AF787B3000797B5 /* dialog.tcl */,
F96888400AF787B3000797B5 /* entry.tcl */,
F96888410AF787B3000797B5 /* fonts.tcl */,
- F96888420AF787B3000797B5 /* icons.tcl */,
- F96888430AF787B3000797B5 /* keynav.tcl */,
F96888440AF787B3000797B5 /* menubutton.tcl */,
F96888450AF787B3000797B5 /* notebook.tcl */,
F96888460AF787B3000797B5 /* panedwindow.tcl */,
@@ -2624,7 +2609,6 @@
F96888580AF7880C000797B5 /* image.test */,
F96888590AF7880C000797B5 /* labelframe.test */,
F968885A0AF7880C000797B5 /* layout.test */,
- F968885B0AF7880C000797B5 /* misc.test */,
F968885C0AF7880C000797B5 /* notebook.test */,
F968885D0AF7880C000797B5 /* panedwindow.test */,
F968885E0AF7880C000797B5 /* progressbar.test */,
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index 1a4a399..f84b7e5 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -35,7 +35,7 @@
* that such fonts can not be used for controls, because controls
* definitely require a family id (this assertion needs testing).
*
- * RCS: @(#) $Id: tkMacOSXFont.c,v 1.24 2007/04/23 21:24:33 das Exp $
+ * RCS: @(#) $Id: tkMacOSXFont.c,v 1.24.2.1 2007/05/29 11:36:43 dgp Exp $
*/
#include "tkMacOSXInt.h"
@@ -704,7 +704,8 @@ TkpMeasureCharsInContext(
const MacFont *fontPtr = (const MacFont *) tkfont;
int curX = -1, curByte = 0;
UniChar *uchars;
- int ulen, urstart, urlen, urend;
+ int ulen;
+ UniCharArrayOffset urstart, urlen, urend;
Tcl_DString ucharBuffer;
/*
@@ -792,53 +793,47 @@ TkpMeasureCharsInContext(
* also something we like to decide for ourself.
*/
- while ((offset > (UniCharArrayOffset)urstart) &&
+ while ((offset > urstart) &&
(uchars[offset-1] == ' ')) {
offset--;
}
-
- /*
- * Fix up left-overs for the TK_WHOLE_WORDS case.
- */
-
- if (flags & TK_WHOLE_WORDS) {
- if (flags & TK_AT_LEAST_ONE) {
- /*
- * If we are the the start of the range, we need to look
- * forward. If we are not at the end of a word, we must
- * be in the middle of the first word, so we also look
- * forward.
- */
-
- if ((offset == (UniCharArrayOffset)urstart) ||
- (uchars[offset] != ' ')) {
- while ((offset < (UniCharArrayOffset)urend)
- && (uchars[offset] != ' ')) {
- offset++;
- }
- }
- } else {
- /*
- * If we are not at the end of a word, we need to look
- * backward.
- */
-
- if ((offset != (UniCharArrayOffset)urend) &&
- (uchars[offset] != ' ')) {
- while ((offset > (UniCharArrayOffset)urstart)
- && (uchars[offset-1] != ' ')) {
- offset--;
- }
- while ((offset > (UniCharArrayOffset)urstart)
- && (uchars[offset-1] == ' ')) {
- offset--;
- }
- }
- }
- }
- }
-
- if (offset > (UniCharArrayOffset)urend) {
+ }
+
+ /*
+ * Fix up left-overs for the TK_WHOLE_WORDS case.
+ */
+
+ if (flags & TK_WHOLE_WORDS) {
+ if (flags & TK_AT_LEAST_ONE) {
+ /*
+ * If we are the the start of the range, we need to look
+ * forward. If we are not at the end of a word, we must be in
+ * the middle of the first word, so we also look forward.
+ */
+
+ if ((offset == urstart) || (uchars[offset] != ' ')) {
+ while ((offset < urend) && (uchars[offset] != ' ')) {
+ offset++;
+ }
+ }
+ } else {
+ /*
+ * If we are not at the end of a word, we need to look
+ * backward.
+ */
+
+ if ((offset != urend) && (uchars[offset] != ' ')) {
+ while ((offset > urstart) && (uchars[offset-1] != ' ')) {
+ offset--;
+ }
+ while ((offset > urstart) && (uchars[offset-1] == ' ')) {
+ offset--;
+ }
+ }
+ }
+ }
+
+ if (offset > urend) {
offset = urend;
}
@@ -850,13 +845,13 @@ TkpMeasureCharsInContext(
if ((err != kATSULineBreakInWord)
&& !(flags & TK_WHOLE_WORDS)
- && (offset <= (UniCharArrayOffset)urend)) {
+ && (offset <= urend)) {
UniCharArrayOffset lastOffset = offset;
UniCharArrayOffset nextoffset;
int lastX = -1;
int wantonemorechar = -1; /* undecided */
- while (offset <= (UniCharArrayOffset)urend) {
+ while (offset <= urend) {
if (flags & TK_ISOLATE_END) {
LayoutSetString(fontPtr, NULL, uchars, offset);
}
@@ -876,7 +871,7 @@ TkpMeasureCharsInContext(
if (wantonemorechar == -1) {
wantonemorechar = ((flags & TK_AT_LEAST_ONE) &&
- (lastOffset == (UniCharArrayOffset)urstart)) ||
+ (lastOffset == urstart)) ||
((flags & TK_PARTIAL_OK) &&
(lastX != maxLength));
if (!wantonemorechar) {
@@ -907,7 +902,7 @@ TkpMeasureCharsInContext(
* into account.
*/
- if (offset >= (UniCharArrayOffset)urend) {
+ if (offset >= urend) {
break;
}
nextoffset = 0;
@@ -952,13 +947,14 @@ TkpMeasureCharsInContext(
Tcl_DStringFree(&ucharBuffer);
#ifdef TK_MAC_DEBUG_FONTS
- TkMacOSXDbgMsg("measure: '%.*s', maxpix=%d, -> width=%d, bytes=%d, "
- "flags=%s%s%s%s", rangeLength, source+rangeStart, maxLength, curX,
- curByte,
+ TkMacOSXDbgMsg("measure: '%.*s', maxLength=%d, flags=%s%s%s%s "
+ "-> width=%d, bytes=%d",
+ rangeLength, source+rangeStart, maxLength,
flags & TK_PARTIAL_OK ? "partialOk " : "",
flags & TK_WHOLE_WORDS ? "wholeWords " : "",
flags & TK_AT_LEAST_ONE ? "atLeastOne " : "",
- flags & TK_ISOLATE_END ? "isolateEnd " : "");
+ flags & TK_ISOLATE_END ? "isolateEnd " : "",
+ curX, curByte);
#endif
*lengthPtr = curX;