summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-03-11 09:43:19 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-03-11 09:43:19 (GMT)
commit34d6610e816c6d60f58dc99c2f1554d0410f28bf (patch)
treea6308a0dd54c3a26ee2fe51ee430fa98e9e84a71
parent3259fbc2451dd52b8aec46351254cf38818b3b83 (diff)
downloadtk-34d6610e816c6d60f58dc99c2f1554d0410f28bf.zip
tk-34d6610e816c6d60f58dc99c2f1554d0410f28bf.tar.gz
tk-34d6610e816c6d60f58dc99c2f1554d0410f28bf.tar.bz2
Removed lame reliance on the leading letters of the names of segment types when
dumping a text widget. Entailed expanding the scope of the declarations of the types of embedded images and windows.
-rw-r--r--ChangeLog3
-rw-r--r--generic/tkText.c10
-rw-r--r--generic/tkText.h4
-rw-r--r--generic/tkTextImage.c4
-rw-r--r--generic/tkTextWind.c4
5 files changed, 16 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 9991e29..8c32167 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,9 @@
there can be unnamed marks present during a dump. Ignore them as they
will just be for the peers' insert and current marks, which aren't
very important.
+ (DumpLine): Removed lame reliance on the leading letters of the names
+ of segment types. Entailed expanding the scope of the declarations of
+ the types of embedded images and windows.
2010-03-08 Don Porter <dgp@users.sourceforge.net>
diff --git a/generic/tkText.c b/generic/tkText.c
index 49cfae0..3010d6e 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkText.c,v 1.98 2010/03/11 09:24:07 dkf Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.99 2010/03/11 09:43:19 dkf Exp $
*/
#include "default.h"
@@ -4708,7 +4708,9 @@ DumpLine(
segPtr->body.chars + first, command, &index, what);
}
} else if ((offset >= startByte)) {
- if ((what & TK_DUMP_MARK) && (segPtr->typePtr->name[0] == 'm')) {
+ if ((what & TK_DUMP_MARK)
+ && (segPtr->typePtr == &tkTextLeftMarkType
+ || segPtr->typePtr == &tkTextRightMarkType)) {
const char *name;
TkTextMark *markPtr = (TkTextMark *) &segPtr->body;
@@ -4744,7 +4746,7 @@ DumpLine(
segPtr->body.toggle.tagPtr->name, command, &index,
what);
} else if ((what & TK_DUMP_IMG) &&
- (segPtr->typePtr->name[0] == 'i')) {
+ (segPtr->typePtr == &tkTextEmbImageType)) {
TkTextEmbImage *eiPtr = (TkTextEmbImage *)&segPtr->body;
const char *name = (eiPtr->name == NULL) ? "" : eiPtr->name;
@@ -4753,7 +4755,7 @@ DumpLine(
lineChanged = DumpSegment(textPtr, interp, "image", name,
command, &index, what);
} else if ((what & TK_DUMP_WIN) &&
- (segPtr->typePtr->name[0] == 'w')) {
+ (segPtr->typePtr == &tkTextEmbWindowType)) {
TkTextEmbWindow *ewPtr = (TkTextEmbWindow *)&segPtr->body;
const char *pathname;
diff --git a/generic/tkText.h b/generic/tkText.h
index 6957120..a819752 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkText.h,v 1.37 2009/10/22 21:36:24 dkf Exp $
+ * RCS: @(#) $Id: tkText.h,v 1.38 2010/03/11 09:43:19 dkf Exp $
*/
#ifndef _TKTEXT
@@ -964,6 +964,8 @@ MODULE_SCOPE const Tk_SegType tkTextLeftMarkType;
MODULE_SCOPE const Tk_SegType tkTextRightMarkType;
MODULE_SCOPE const Tk_SegType tkTextToggleOnType;
MODULE_SCOPE const Tk_SegType tkTextToggleOffType;
+MODULE_SCOPE const Tk_SegType tkTextEmbWindowType;
+MODULE_SCOPE const Tk_SegType tkTextEmbImageType;
/*
* Convenience macros for use by B-tree clients which want to access pixel
diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c
index c394196..7f1ce25 100644
--- a/generic/tkTextImage.c
+++ b/generic/tkTextImage.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTextImage.c,v 1.28 2010/01/18 20:43:38 nijtmans Exp $
+ * RCS: @(#) $Id: tkTextImage.c,v 1.29 2010/03/11 09:43:19 dkf Exp $
*/
#include "tkPort.h"
@@ -56,7 +56,7 @@ static void EmbImageProc(ClientData clientData, int x, int y,
* The following structure declares the "embedded image" segment type.
*/
-static const Tk_SegType tkTextEmbImageType = {
+const Tk_SegType tkTextEmbImageType = {
"image", /* name */
0, /* leftGravity */
NULL, /* splitProc */
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c
index fa42b05..8c032c6 100644
--- a/generic/tkTextWind.c
+++ b/generic/tkTextWind.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTextWind.c,v 1.29 2010/02/21 12:14:16 dkf Exp $
+ * RCS: @(#) $Id: tkTextWind.c,v 1.30 2010/03/11 09:43:19 dkf Exp $
*/
#include "tkPort.h"
@@ -72,7 +72,7 @@ static TkTextEmbWindowClient *EmbWinGetClient(const TkText *textPtr,
* The following structure declares the "embedded window" segment type.
*/
-static const Tk_SegType tkTextEmbWindowType = {
+const Tk_SegType tkTextEmbWindowType = {
"window", /* name */
0, /* leftGravity */
NULL, /* splitProc */