summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvLine.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkCanvLine.c')
-rw-r--r--generic/tkCanvLine.c452
1 files changed, 229 insertions, 223 deletions
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index d2954f2..34cdfae 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -10,10 +10,9 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCanvLine.c,v 1.22.2.1 2010/08/11 09:39:08 dkf Exp $
+ * RCS: @(#) $Id: tkCanvLine.c,v 1.34 2010/11/19 14:48:00 nijtmans Exp $
*/
-#include <stdio.h>
#include "tkInt.h"
#include "tkCanvas.h"
@@ -25,7 +24,7 @@ typedef enum {
ARROWS_NONE, ARROWS_FIRST, ARROWS_LAST, ARROWS_BOTH
} Arrows;
-typedef struct LineItem {
+typedef struct LineItem {
Tk_Item header; /* Generic stuff that's the same for all
* types. MUST BE FIRST IN STRUCTURE. */
Tk_Outline outline; /* Outline structure */
@@ -61,7 +60,7 @@ typedef struct LineItem {
* point in line (PTS_IN_ARROW points, first
* of which is tip). Malloc'ed. NULL means no
* arrowhead at last point. */
- Tk_SmoothMethod *smooth; /* Non-zero means draw line smoothed (i.e.
+ const Tk_SmoothMethod *smooth; /* Non-zero means draw line smoothed (i.e.
* with Bezier splines). */
int splineSteps; /* Number of steps in each spline segment. */
} LineItem;
@@ -82,11 +81,11 @@ static int ArrowheadPostscript(Tcl_Interp *interp,
static void ComputeLineBbox(Tk_Canvas canvas, LineItem *linePtr);
static int ConfigureLine(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int objc,
- Tcl_Obj *CONST objv[], int flags);
+ Tcl_Obj *const objv[], int flags);
static int ConfigureArrows(Tk_Canvas canvas, LineItem *linePtr);
static int CreateLine(Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void DeleteLine(Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display);
static void DisplayLine(Tk_Canvas canvas,
@@ -97,7 +96,7 @@ static int GetLineIndex(Tcl_Interp *interp,
Tcl_Obj *obj, int *indexPtr);
static int LineCoords(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
- int objc, Tcl_Obj *CONST objv[]);
+ int objc, Tcl_Obj *const objv[]);
static void LineDeleteCoords(Tk_Canvas canvas,
Tk_Item *itemPtr, int first, int last);
static void LineInsert(Tk_Canvas canvas,
@@ -110,14 +109,14 @@ static int LineToPostscript(Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int prepass);
static int ArrowParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
- CONST char *value, char *recordPtr, int offset);
-static char * ArrowPrintProc(ClientData clientData,
+ const char *value, char *recordPtr, int offset);
+static const char * ArrowPrintProc(ClientData clientData,
Tk_Window tkwin, char *recordPtr, int offset,
Tcl_FreeProc **freeProcPtr);
static int ParseArrowShape(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
- CONST char *value, char *recordPtr, int offset);
-static char * PrintArrowShape(ClientData clientData,
+ const char *value, char *recordPtr, int offset);
+static const char * PrintArrowShape(ClientData clientData,
Tk_Window tkwin, char *recordPtr, int offset,
Tcl_FreeProc **freeProcPtr);
static void ScaleLine(Tk_Canvas canvas,
@@ -125,84 +124,77 @@ static void ScaleLine(Tk_Canvas canvas,
double scaleX, double scaleY);
static void TranslateLine(Tk_Canvas canvas,
Tk_Item *itemPtr, double deltaX, double deltaY);
-
+
/*
* Information used for parsing configuration specs. If you change any of the
* default strings, be sure to change the corresponding default values in
* CreateLine.
*/
-static Tk_CustomOption arrowShapeOption = {
- (Tk_OptionParseProc *) ParseArrowShape,
- PrintArrowShape, (ClientData) NULL
+static const Tk_CustomOption arrowShapeOption = {
+ ParseArrowShape, PrintArrowShape, NULL
};
-static Tk_CustomOption arrowOption = {
- (Tk_OptionParseProc *) ArrowParseProc,
- ArrowPrintProc, (ClientData) NULL
+static const Tk_CustomOption arrowOption = {
+ ArrowParseProc, ArrowPrintProc, NULL
};
-static Tk_CustomOption smoothOption = {
- (Tk_OptionParseProc *) TkSmoothParseProc,
- TkSmoothPrintProc, (ClientData) NULL
+static const Tk_CustomOption smoothOption = {
+ TkSmoothParseProc, TkSmoothPrintProc, NULL
};
-static Tk_CustomOption stateOption = {
- (Tk_OptionParseProc *) TkStateParseProc,
- TkStatePrintProc, (ClientData) 2
+static const Tk_CustomOption stateOption = {
+ TkStateParseProc, TkStatePrintProc, INT2PTR(2)
};
-static Tk_CustomOption tagsOption = {
- (Tk_OptionParseProc *) Tk_CanvasTagsParseProc,
- Tk_CanvasTagsPrintProc, (ClientData) NULL
+static const Tk_CustomOption tagsOption = {
+ Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL
};
-static Tk_CustomOption dashOption = {
- (Tk_OptionParseProc *) TkCanvasDashParseProc,
- TkCanvasDashPrintProc, (ClientData) NULL
+static const Tk_CustomOption dashOption = {
+ TkCanvasDashParseProc, TkCanvasDashPrintProc, NULL
};
-static Tk_CustomOption offsetOption = {
- (Tk_OptionParseProc *) TkOffsetParseProc,
- TkOffsetPrintProc,
- (ClientData) (TK_OFFSET_RELATIVE|TK_OFFSET_INDEX)
+static const Tk_CustomOption offsetOption = {
+ TkOffsetParseProc, TkOffsetPrintProc,
+ INT2PTR(TK_OFFSET_RELATIVE|TK_OFFSET_INDEX)
};
-static Tk_CustomOption pixelOption = {
- (Tk_OptionParseProc *) TkPixelParseProc,
- TkPixelPrintProc, (ClientData) NULL
+static const Tk_CustomOption pixelOption = {
+ TkPixelParseProc, TkPixelPrintProc, NULL
};
-static Tk_ConfigSpec configSpecs[] = {
+static const Tk_ConfigSpec configSpecs[] = {
{TK_CONFIG_CUSTOM, "-activedash", NULL, NULL,
NULL, Tk_Offset(LineItem, outline.activeDash),
TK_CONFIG_NULL_OK, &dashOption},
{TK_CONFIG_COLOR, "-activefill", NULL, NULL,
- NULL, Tk_Offset(LineItem, outline.activeColor), TK_CONFIG_NULL_OK},
+ NULL, Tk_Offset(LineItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-activestipple", NULL, NULL,
- NULL, Tk_Offset(LineItem, outline.activeStipple), TK_CONFIG_NULL_OK},
+ NULL, Tk_Offset(LineItem, outline.activeStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL,
"0.0", Tk_Offset(LineItem, outline.activeWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
{TK_CONFIG_CUSTOM, "-arrow", NULL, NULL,
- "none", Tk_Offset(LineItem, arrow), TK_CONFIG_DONT_SET_DEFAULT, &arrowOption},
+ "none", Tk_Offset(LineItem, arrow),
+ TK_CONFIG_DONT_SET_DEFAULT, &arrowOption},
{TK_CONFIG_CUSTOM, "-arrowshape", NULL, NULL,
"8 10 3", Tk_Offset(LineItem, arrowShapeA),
TK_CONFIG_DONT_SET_DEFAULT, &arrowShapeOption},
{TK_CONFIG_CAP_STYLE, "-capstyle", NULL, NULL,
- "butt", Tk_Offset(LineItem, capStyle), TK_CONFIG_DONT_SET_DEFAULT},
+ "butt", Tk_Offset(LineItem, capStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_COLOR, "-fill", NULL, NULL,
- "black", Tk_Offset(LineItem, outline.color), TK_CONFIG_NULL_OK},
+ "black", Tk_Offset(LineItem, outline.color), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-dash", NULL, NULL,
NULL, Tk_Offset(LineItem, outline.dash),
TK_CONFIG_NULL_OK, &dashOption},
{TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL,
- "0", Tk_Offset(LineItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT},
+ "0", Tk_Offset(LineItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL,
NULL, Tk_Offset(LineItem, outline.disabledDash),
TK_CONFIG_NULL_OK, &dashOption},
{TK_CONFIG_COLOR, "-disabledfill", NULL, NULL,
- NULL, Tk_Offset(LineItem, outline.disabledColor), TK_CONFIG_NULL_OK},
+ NULL, Tk_Offset(LineItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL,
- NULL, Tk_Offset(LineItem, outline.disabledStipple), TK_CONFIG_NULL_OK},
+ NULL, Tk_Offset(LineItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL,
"0.0", Tk_Offset(LineItem, outline.disabledWidth),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
{TK_CONFIG_JOIN_STYLE, "-joinstyle", NULL, NULL,
- "round", Tk_Offset(LineItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT},
+ "round", Tk_Offset(LineItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-offset", NULL, NULL,
"0,0", Tk_Offset(LineItem, outline.tsoffset),
TK_CONFIG_DONT_SET_DEFAULT, &offsetOption},
@@ -210,17 +202,17 @@ static Tk_ConfigSpec configSpecs[] = {
"0", Tk_Offset(LineItem, smooth),
TK_CONFIG_DONT_SET_DEFAULT, &smoothOption},
{TK_CONFIG_INT, "-splinesteps", NULL, NULL,
- "12", Tk_Offset(LineItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT},
+ "12", Tk_Offset(LineItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT, NULL},
{TK_CONFIG_CUSTOM, "-state", NULL, NULL,
NULL, Tk_Offset(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption},
{TK_CONFIG_BITMAP, "-stipple", NULL, NULL,
- NULL, Tk_Offset(LineItem, outline.stipple), TK_CONFIG_NULL_OK},
+ NULL, Tk_Offset(LineItem, outline.stipple), TK_CONFIG_NULL_OK, NULL},
{TK_CONFIG_CUSTOM, "-tags", NULL, NULL,
NULL, 0, TK_CONFIG_NULL_OK, &tagsOption},
{TK_CONFIG_CUSTOM, "-width", NULL, NULL,
"1.0", Tk_Offset(LineItem, outline.width),
TK_CONFIG_DONT_SET_DEFAULT, &pixelOption},
- {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0}
+ {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL}
};
/*
@@ -237,18 +229,19 @@ Tk_ItemType tkLineType = {
LineCoords, /* coordProc */
DeleteLine, /* deleteProc */
DisplayLine, /* displayProc */
- TK_CONFIG_OBJS, /* flags */
+ TK_CONFIG_OBJS | TK_MOVABLE_POINTS, /* flags */
LineToPoint, /* pointProc */
LineToArea, /* areaProc */
LineToPostscript, /* postscriptProc */
ScaleLine, /* scaleProc */
TranslateLine, /* translateProc */
- (Tk_ItemIndexProc *) GetLineIndex, /* indexProc */
+ GetLineIndex, /* indexProc */
NULL, /* icursorProc */
NULL, /* selectionProc */
- (Tk_ItemInsertProc *) LineInsert, /* insertProc */
+ LineInsert, /* insertProc */
LineDeleteCoords, /* dTextProc */
NULL, /* nextPtr */
+ NULL, 0, NULL, NULL
};
/*
@@ -285,13 +278,13 @@ CreateLine(
Tk_Item *itemPtr, /* Record to hold new item; header has been
* initialized by caller. */
int objc, /* Number of arguments in objv. */
- Tcl_Obj *CONST objv[]) /* Arguments describing line. */
+ Tcl_Obj *const objv[]) /* Arguments describing line. */
{
LineItem *linePtr = (LineItem *) itemPtr;
int i;
if (objc == 0) {
- Tcl_Panic("canvas did not pass any coords\n");
+ Tcl_Panic("canvas did not pass any coords");
}
/*
@@ -299,7 +292,7 @@ CreateLine(
* proper cleanup after errors during the the remainder of this function.
*/
- Tk_CreateOutline(&(linePtr->outline));
+ Tk_CreateOutline(&linePtr->outline);
linePtr->canvas = canvas;
linePtr->numPoints = 0;
linePtr->coordPtr = NULL;
@@ -322,7 +315,7 @@ CreateLine(
*/
for (i = 1; i < objc; i++) {
- char *arg = Tcl_GetString(objv[i]);
+ const char *arg = Tcl_GetString(objv[i]);
if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) {
break;
@@ -364,7 +357,7 @@ LineCoords(
Tk_Item *itemPtr, /* Item whose coordinates are to be read or
* modified. */
int objc, /* Number of coordinates supplied in objv. */
- Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
+ Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */
{
LineItem *linePtr = (LineItem *) itemPtr;
int i, numPoints;
@@ -416,7 +409,7 @@ LineCoords(
numPoints = objc/2;
if (linePtr->numPoints != numPoints) {
coordPtr = (double *)
- ckalloc((unsigned) (sizeof(double) * objc));
+ ckalloc(sizeof(double) * (unsigned) objc);
if (linePtr->coordPtr != NULL) {
ckfree((char *) linePtr->coordPtr);
}
@@ -424,12 +417,12 @@ LineCoords(
linePtr->numPoints = numPoints;
}
coordPtr = linePtr->coordPtr;
- for (i = 0; i <objc; i++) {
+ for (i = 0; i < objc ; i++) {
if (Tk_CanvasGetCoordFromObj(interp, canvas, objv[i],
coordPtr++) != TCL_OK) {
- return TCL_ERROR;
- }
- }
+ return TCL_ERROR;
+ }
+ }
/*
* Update arrowheads by throwing away any existing arrow-head
@@ -476,8 +469,8 @@ ConfigureLine(
Tcl_Interp *interp, /* Used for error reporting. */
Tk_Canvas canvas, /* Canvas containing itemPtr. */
Tk_Item *itemPtr, /* Line item to reconfigure. */
- int objc, /* Number of elements in objv. */
- Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */
+ int objc, /* Number of elements in objv. */
+ Tcl_Obj *const objv[], /* Arguments describing things to configure. */
int flags) /* Flags to pass to Tk_ConfigureWidget. */
{
LineItem *linePtr = (LineItem *) itemPtr;
@@ -489,7 +482,7 @@ ConfigureLine(
tkwin = Tk_CanvasTkwin(canvas);
if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc,
- (CONST char **) objv, (char *) linePtr, flags|TK_CONFIG_OBJS)) {
+ (const char **) objv, (char *) linePtr, flags|TK_CONFIG_OBJS)) {
return TCL_ERROR;
}
@@ -500,8 +493,8 @@ ConfigureLine(
state = itemPtr->state;
- if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ if (state == TK_STATE_NULL) {
+ state = Canvas(canvas)->canvas_state;
}
if (linePtr->outline.activeWidth > linePtr->outline.width ||
@@ -512,8 +505,7 @@ ConfigureLine(
} else {
itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT;
}
- mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr,
- &(linePtr->outline));
+ mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr, &linePtr->outline);
if (mask) {
if (linePtr->arrow == ARROWS_NONE) {
gcValues.cap_style = linePtr->capStyle;
@@ -524,9 +516,10 @@ ConfigureLine(
newGC = Tk_GetGC(tkwin, mask, &gcValues);
#ifdef MAC_OSX_TK
/*
- * Mac OS X CG drawing needs access to linewidth even for
- * arrow fills (as linewidth controls antialiasing).
+ * Mac OS X CG drawing needs access to linewidth even for arrow fills
+ * (as linewidth controls antialiasing).
*/
+
mask |= GCLineWidth;
#else
gcValues.line_width = 0;
@@ -554,7 +547,7 @@ ConfigureLine(
linePtr->splineSteps = 100;
}
- if ((!linePtr->numPoints) || (state==TK_STATE_HIDDEN)) {
+ if ((!linePtr->numPoints) || (state == TK_STATE_HIDDEN)) {
ComputeLineBbox(canvas, linePtr);
return TCL_OK;
}
@@ -619,7 +612,7 @@ DeleteLine(
{
LineItem *linePtr = (LineItem *) itemPtr;
- Tk_DeleteOutline(display, &(linePtr->outline));
+ Tk_DeleteOutline(display, &linePtr->outline);
if (linePtr->coordPtr != NULL) {
ckfree((char *) linePtr->coordPtr);
}
@@ -662,11 +655,11 @@ ComputeLineBbox(
Tk_State state = linePtr->header.state;
Tk_TSOffset *tsoffset;
- if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ if (state == TK_STATE_NULL) {
+ state = Canvas(canvas)->canvas_state;
}
- if (!(linePtr->numPoints) || (state==TK_STATE_HIDDEN)) {
+ if (!(linePtr->numPoints) || (state == TK_STATE_HIDDEN)) {
linePtr->header.x1 = -1;
linePtr->header.x2 = -1;
linePtr->header.y1 = -1;
@@ -675,18 +668,18 @@ ComputeLineBbox(
}
width = linePtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)linePtr) {
- if (linePtr->outline.activeWidth>width) {
+ if (Canvas(canvas)->currentItemPtr == (Tk_Item *)linePtr) {
+ if (linePtr->outline.activeWidth > width) {
width = linePtr->outline.activeWidth;
}
- } else if (state==TK_STATE_DISABLED) {
- if (linePtr->outline.disabledWidth>0) {
+ } else if (state == TK_STATE_DISABLED) {
+ if (linePtr->outline.disabledWidth > 0) {
width = linePtr->outline.disabledWidth;
}
}
coordPtr = linePtr->coordPtr;
- linePtr->header.x1 = linePtr->header.x2 = (int) *coordPtr;
+ linePtr->header.x1 = linePtr->header.x2 = (int) coordPtr[0];
linePtr->header.y1 = linePtr->header.y2 = (int) coordPtr[1];
/*
@@ -694,8 +687,8 @@ ComputeLineBbox(
* all directions by the line's width to take care of butting or rounded
* corners and projecting or rounded caps. This expansion is an
* overestimate (worst-case is square root of two over two) but it's
- * simple. eDon't do anything special for curves. This causes an
- * additional overestimate in the bounding box, but is faster.
+ * simple. Don't do anything special for curves. This causes an additional
+ * overestimate in the bounding box, but is faster.
*/
for (i = 1, coordPtr = linePtr->coordPtr+2; i < linePtr->numPoints;
@@ -717,16 +710,20 @@ ComputeLineBbox(
tsoffset = &linePtr->outline.tsoffset;
if (tsoffset->flags & TK_OFFSET_INDEX) {
- double *coordPtr = linePtr->coordPtr + (tsoffset->flags & ~TK_OFFSET_INDEX);
+ double *coordPtr = linePtr->coordPtr
+ + (tsoffset->flags & ~TK_OFFSET_INDEX);
+
if (tsoffset->flags <= 0) {
coordPtr = linePtr->coordPtr;
- if ((linePtr->arrow == ARROWS_FIRST) || (linePtr->arrow == ARROWS_BOTH)) {
+ if ((linePtr->arrow == ARROWS_FIRST)
+ || (linePtr->arrow == ARROWS_BOTH)) {
coordPtr = linePtr->firstArrowPtr;
}
}
if (tsoffset->flags > (linePtr->numPoints * 2)) {
coordPtr = linePtr->coordPtr + (linePtr->numPoints * 2);
- if ((linePtr->arrow == ARROWS_LAST) || (linePtr->arrow == ARROWS_BOTH)) {
+ if ((linePtr->arrow == ARROWS_LAST)
+ || (linePtr->arrow == ARROWS_BOTH)) {
coordPtr = linePtr->lastArrowPtr;
}
}
@@ -755,7 +752,7 @@ ComputeLineBbox(
linePtr->header.y1 -= intWidth;
linePtr->header.y2 += intWidth;
- if (linePtr->numPoints==1) {
+ if (linePtr->numPoints == 1) {
linePtr->header.x1 -= 1;
linePtr->header.x2 += 1;
linePtr->header.y1 -= 1;
@@ -848,19 +845,19 @@ DisplayLine(
int numPoints;
Tk_State state = itemPtr->state;
- if ((!linePtr->numPoints)||(linePtr->outline.gc==None)) {
+ if ((!linePtr->numPoints) || (linePtr->outline.gc == None)) {
return;
}
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
linewidth = linePtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (linePtr->outline.activeWidth != linewidth) {
linewidth = linePtr->outline.activeWidth;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (linePtr->outline.disabledWidth != linewidth) {
linewidth = linePtr->outline.disabledWidth;
}
@@ -882,14 +879,15 @@ DisplayLine(
if (numPoints <= MAX_STATIC_POINTS) {
pointPtr = staticPoints;
} else {
- pointPtr = (XPoint *)ckalloc((unsigned)(numPoints * 3*sizeof(XPoint)));
+ pointPtr = (XPoint *)
+ ckalloc((unsigned) numPoints * 3 * sizeof(XPoint));
}
if ((linePtr->smooth) && (linePtr->numPoints > 2)) {
numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
linePtr->numPoints, linePtr->splineSteps, pointPtr, NULL);
} else {
- numPoints = TkCanvTranslatePath((TkCanvas*)canvas, numPoints,
+ numPoints = TkCanvTranslatePath((TkCanvas *) canvas, numPoints,
linePtr->coordPtr, 0, pointPtr);
}
@@ -900,20 +898,22 @@ DisplayLine(
* read-only.
*/
- if (Tk_ChangeOutlineGC(canvas, itemPtr, &(linePtr->outline))) {
- Tk_CanvasSetOffset(canvas, linePtr->arrowGC, &linePtr->outline.tsoffset);
+ if (Tk_ChangeOutlineGC(canvas, itemPtr, &linePtr->outline)) {
+ Tk_CanvasSetOffset(canvas, linePtr->arrowGC,
+ &linePtr->outline.tsoffset);
}
- if (numPoints>1) {
+ if (numPoints > 1) {
XDrawLines(display, drawable, linePtr->outline.gc, pointPtr, numPoints,
- CoordModeOrigin);
+ CoordModeOrigin);
} else {
int intwidth = (int) (linewidth + 0.5);
- if (intwidth<1) {
- intwidth=1;
+
+ if (intwidth < 1) {
+ intwidth = 1;
}
XFillArc(display, drawable, linePtr->outline.gc,
pointPtr->x - intwidth/2, pointPtr->y - intwidth/2,
- (unsigned int)intwidth+1, (unsigned int)intwidth+1, 0, 64*360);
+ (unsigned) intwidth+1, (unsigned) intwidth+1, 0, 64*360);
}
if (pointPtr != staticPoints) {
ckfree((char *) pointPtr);
@@ -931,7 +931,7 @@ DisplayLine(
TkFillPolygon(canvas, linePtr->lastArrowPtr, PTS_IN_ARROW,
display, drawable, linePtr->arrowGC, NULL);
}
- if (Tk_ResetOutlineGC(canvas, itemPtr, &(linePtr->outline))) {
+ if (Tk_ResetOutlineGC(canvas, itemPtr, &linePtr->outline)) {
XSetTSOrigin(display, linePtr->arrowGC, 0, 0);
}
}
@@ -967,7 +967,7 @@ LineInsert(
Tcl_Obj **objv;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
if (!obj || (Tcl_ListObjGetElements(NULL, obj, &objc, &objv) != TCL_OK)
@@ -997,7 +997,7 @@ LineInsert(
for (i=0; i<objc; i++) {
if (Tcl_GetDoubleFromObj(NULL, objv[i],
&newCoordPtr[i + beforeThis]) != TCL_OK) {
- Tcl_ResetResult(((TkCanvas *)canvas)->interp);
+ Tcl_ResetResult(Canvas(canvas)->interp);
ckfree((char *) newCoordPtr);
return;
}
@@ -1007,12 +1007,13 @@ LineInsert(
newCoordPtr[i+objc] = linePtr->coordPtr[i];
}
if (linePtr->coordPtr) {
- ckfree((char *)linePtr->coordPtr);
+ ckfree((char *) linePtr->coordPtr);
}
linePtr->coordPtr = newCoordPtr;
- linePtr->numPoints = (length + objc)/2;
+ length += objc ;
+ linePtr->numPoints = length / 2;
- if ((length>3) && (state != TK_STATE_HIDDEN)) {
+ if ((length > 3) && (state != TK_STATE_HIDDEN)) {
/*
* This is some optimizing code that will result that only the part of
* the polygon that changed (and the objects that are overlapping with
@@ -1024,19 +1025,25 @@ LineInsert(
itemPtr->redraw_flags |= TK_ITEM_DONT_REDRAW;
- if (beforeThis>0) {beforeThis -= 2; objc+=2; }
- if ((beforeThis+objc)<length) objc+=2;
+ if (beforeThis > 0) {
+ beforeThis -= 2;
+ objc += 2;
+ }
+ if (beforeThis+objc < length) {
+ objc += 2;
+ }
if (linePtr->smooth) {
- if(beforeThis>0) {
- beforeThis-=2; objc+=2;
+ if (beforeThis > 0) {
+ beforeThis -= 2;
+ objc += 2;
}
- if((beforeThis+objc+2)<length) {
- objc+=2;
+ if (beforeThis+objc+2 < length) {
+ objc += 2;
}
}
itemPtr->x1 = itemPtr->x2 = (int) linePtr->coordPtr[beforeThis];
itemPtr->y1 = itemPtr->y2 = (int) linePtr->coordPtr[beforeThis+1];
- if ((linePtr->firstArrowPtr != NULL) && (beforeThis<1)) {
+ if ((linePtr->firstArrowPtr != NULL) && (beforeThis < 1)) {
/*
* Include old first arrow.
*/
@@ -1046,7 +1053,7 @@ LineInsert(
TkIncludePoint(itemPtr, coordPtr);
}
}
- if ((linePtr->lastArrowPtr != NULL) && ((beforeThis+objc)>=length)) {
+ if ((linePtr->lastArrowPtr != NULL) && (beforeThis+objc >= length)) {
/*
* Include old last arrow.
*/
@@ -1056,10 +1063,10 @@ LineInsert(
TkIncludePoint(itemPtr, coordPtr);
}
}
- coordPtr = linePtr->coordPtr+beforeThis+2;
+ coordPtr = linePtr->coordPtr + beforeThis + 2;
for (i=2; i<objc; i+=2) {
TkIncludePoint(itemPtr, coordPtr);
- coordPtr+=2;
+ coordPtr += 2;
}
}
if (linePtr->firstArrowPtr != NULL) {
@@ -1078,7 +1085,7 @@ LineInsert(
double width;
int intWidth;
- if ((linePtr->firstArrowPtr != NULL) && (beforeThis>2)) {
+ if ((linePtr->firstArrowPtr != NULL) && (beforeThis > 2)) {
/*
* Include new first arrow.
*/
@@ -1099,12 +1106,12 @@ LineInsert(
}
}
width = linePtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
- if (linePtr->outline.activeWidth>width) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
+ if (linePtr->outline.activeWidth > width) {
width = linePtr->outline.activeWidth;
}
- } else if (state==TK_STATE_DISABLED) {
- if (linePtr->outline.disabledWidth>0) {
+ } else if (state == TK_STATE_DISABLED) {
+ if (linePtr->outline.disabledWidth > 0) {
width = linePtr->outline.disabledWidth;
}
}
@@ -1112,8 +1119,10 @@ LineInsert(
if (intWidth < 1) {
intWidth = 1;
}
- itemPtr->x1 -= intWidth; itemPtr->y1 -= intWidth;
- itemPtr->x2 += intWidth; itemPtr->y2 += intWidth;
+ itemPtr->x1 -= intWidth;
+ itemPtr->y1 -= intWidth;
+ itemPtr->x2 += intWidth;
+ itemPtr->y2 += intWidth;
Tk_CanvasEventuallyRedraw(canvas, itemPtr->x1, itemPtr->y1,
itemPtr->x2, itemPtr->y2);
}
@@ -1152,7 +1161,7 @@ LineDeleteCoords(
Tk_State state = itemPtr->state;
if (state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ state = Canvas(canvas)->canvas_state;
}
first &= -2;
@@ -1192,7 +1201,7 @@ LineDeleteCoords(
}
}
- if (!(first1 < 2) && (last1 >= length-2)) {
+ if ((first1 >= 2) || (last1 < length-2)) {
/*
* This is some optimizing code that will result that only the part of
* the line that changed (and the objects that are overlapping with
@@ -1273,11 +1282,11 @@ LineDeleteCoords(
}
}
width = linePtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
if (linePtr->outline.activeWidth > width) {
width = linePtr->outline.activeWidth;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (linePtr->outline.disabledWidth > 0) {
width = linePtr->outline.disabledWidth;
}
@@ -1341,17 +1350,17 @@ LineToPoint(
* which to do the check.
*/
- if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ if (state == TK_STATE_NULL) {
+ state = Canvas(canvas)->canvas_state;
}
width = linePtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
- if (linePtr->outline.activeWidth>width) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
+ if (linePtr->outline.activeWidth > width) {
width = linePtr->outline.activeWidth;
}
- } else if (state==TK_STATE_DISABLED) {
- if (linePtr->outline.disabledWidth>0) {
+ } else if (state == TK_STATE_DISABLED) {
+ if (linePtr->outline.disabledWidth > 0) {
width = linePtr->outline.disabledWidth;
}
}
@@ -1362,8 +1371,8 @@ LineToPoint(
if (numPoints <= MAX_STATIC_POINTS) {
linePoints = staticSpace;
} else {
- linePoints = (double *) ckalloc((unsigned)
- (2*numPoints*sizeof(double)));
+ linePoints = (double *)
+ ckalloc((unsigned) (2*numPoints*sizeof(double)));
}
numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
linePtr->numPoints, linePtr->splineSteps, NULL, linePoints);
@@ -1376,12 +1385,14 @@ LineToPoint(
width = 1.0;
}
- if (!numPoints || itemPtr->state==TK_STATE_HIDDEN) {
+ if (!numPoints || itemPtr->state == TK_STATE_HIDDEN) {
return bestDist;
} else if (numPoints == 1) {
bestDist = hypot(linePoints[0]-pointPtr[0], linePoints[1]-pointPtr[1])
- width/2.0;
- if (bestDist < 0) bestDist = 0;
+ if (bestDist < 0) {
+ bestDist = 0;
+ }
return bestDist;
}
@@ -1557,23 +1568,23 @@ LineToArea(
double radius, width;
Tk_State state = itemPtr->state;
- if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ if (state == TK_STATE_NULL) {
+ state = Canvas(canvas)->canvas_state;
}
width = linePtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
- if (linePtr->outline.activeWidth>width) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
+ if (linePtr->outline.activeWidth > width) {
width = linePtr->outline.activeWidth;
}
- } else if (state==TK_STATE_DISABLED) {
- if (linePtr->outline.disabledWidth>0) {
+ } else if (state == TK_STATE_DISABLED) {
+ if (linePtr->outline.disabledWidth > 0) {
width = linePtr->outline.disabledWidth;
}
}
radius = (width+1.0)/2.0;
- if ((state==TK_STATE_HIDDEN) || !linePtr->numPoints) {
+ if ((state == TK_STATE_HIDDEN) || !linePtr->numPoints) {
return -1;
} else if (linePtr->numPoints == 1) {
double oval[4];
@@ -1596,8 +1607,8 @@ LineToArea(
if (numPoints <= MAX_STATIC_POINTS) {
linePoints = staticSpace;
} else {
- linePoints = (double *) ckalloc((unsigned)
- (2*numPoints*sizeof(double)));
+ linePoints = (double *)
+ ckalloc((unsigned) (2*numPoints*sizeof(double)));
}
numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
linePtr->numPoints, linePtr->splineSteps, NULL, linePoints);
@@ -1610,13 +1621,12 @@ LineToArea(
* Check the segments of the line.
*/
- if (width < 1.0) {
+ if (width < 1.0) {
width = 1.0;
}
- result = TkThickPolyLineToArea(linePoints, numPoints,
- width, linePtr->capStyle, linePtr->joinStyle,
- rectPtr);
+ result = TkThickPolyLineToArea(linePoints, numPoints, width,
+ linePtr->capStyle, linePtr->joinStyle, rectPtr);
if (result == 0) {
goto done;
}
@@ -1743,7 +1753,7 @@ GetLineIndex(
{
LineItem *linePtr = (LineItem *) itemPtr;
int length;
- char *string = Tcl_GetStringFromObj(obj, &length);
+ const char *string = Tcl_GetStringFromObj(obj, &length);
if (string[0] == 'e') {
if (strncmp(string, "end", (unsigned) length) == 0) {
@@ -1755,14 +1765,15 @@ GetLineIndex(
*/
badIndex:
- Tcl_SetResult(interp, NULL, TCL_STATIC);
+ Tcl_ResetResult(interp);
Tcl_AppendResult(interp, "bad index \"", string, "\"", NULL);
return TCL_ERROR;
}
} else if (string[0] == '@') {
int i;
- double x ,y, bestDist, dist, *coordPtr;
- char *end, *p;
+ double x, y, bestDist, dist, *coordPtr;
+ char *end;
+ const char *p;
p = string+1;
x = strtod(p, &end);
@@ -1777,9 +1788,9 @@ GetLineIndex(
bestDist = 1.0e36;
coordPtr = linePtr->coordPtr;
*indexPtr = 0;
- for(i=0; i<linePtr->numPoints; i++) {
+ for (i=0; i<linePtr->numPoints; i++) {
dist = hypot(coordPtr[0] - x, coordPtr[1] - y);
- if (dist<bestDist) {
+ if (dist < bestDist) {
bestDist = dist;
*indexPtr = 2*i;
}
@@ -1789,7 +1800,7 @@ GetLineIndex(
if (Tcl_GetIntFromObj(interp, obj, indexPtr) != TCL_OK) {
goto badIndex;
}
- *indexPtr &= -2; /* if index is odd, make it even */
+ *indexPtr &= -2; /* If index is odd, make it even. */
if (*indexPtr < 0){
*indexPtr = 0;
} else if (*indexPtr > (2*linePtr->numPoints)) {
@@ -1874,7 +1885,7 @@ ParseArrowShape(
ClientData clientData, /* Not used. */
Tcl_Interp *interp, /* Used for error reporting. */
Tk_Window tkwin, /* Not used. */
- CONST char *value, /* Textual specification of arrow shape. */
+ const char *value, /* Textual specification of arrow shape. */
char *recordPtr, /* Pointer to item record in which to store
* arrow information. */
int offset) /* Offset of shape information in widget
@@ -1883,7 +1894,7 @@ ParseArrowShape(
LineItem *linePtr = (LineItem *) recordPtr;
double a, b, c;
int argc;
- CONST char **argv = NULL;
+ const char **argv = NULL;
if (offset != Tk_Offset(LineItem, arrowShapeA)) {
Tcl_Panic("ParseArrowShape received bogus offset");
@@ -1934,7 +1945,7 @@ ParseArrowShape(
*/
/* ARGSUSED */
-static char *
+static const char *
PrintArrowShape(
ClientData clientData, /* Not used. */
Tk_Window tkwin, /* Window associated with linePtr's widget. */
@@ -1945,16 +1956,14 @@ PrintArrowShape(
* string here. */
{
LineItem *linePtr = (LineItem *) recordPtr;
- char *buffer;
+ char *buffer = ckalloc(120);
- buffer = (char *) ckalloc(120);
sprintf(buffer, "%.5g %.5g %.5g", linePtr->arrowShapeA,
linePtr->arrowShapeB, linePtr->arrowShapeC);
*freeProcPtr = TCL_DYNAMIC;
return buffer;
}
-
/*
*--------------------------------------------------------------
*
@@ -1978,7 +1987,7 @@ ArrowParseProc(
ClientData clientData, /* some flags.*/
Tcl_Interp *interp, /* Used for reporting errors. */
Tk_Window tkwin, /* Window containing canvas widget. */
- CONST char *value, /* Value of option. */
+ const char *value, /* Value of option. */
char *widgRec, /* Pointer to record for item. */
int offset) /* Offset into item. */
{
@@ -1987,7 +1996,7 @@ ArrowParseProc(
register Arrows *arrowPtr = (Arrows *) (widgRec + offset);
- if(value == NULL || *value == 0) {
+ if (value == NULL || *value == 0) {
*arrowPtr = ARROWS_NONE;
return TCL_OK;
}
@@ -2039,7 +2048,7 @@ ArrowParseProc(
*--------------------------------------------------------------
*/
-static char *
+static const char *
ArrowPrintProc(
ClientData clientData, /* Ignored. */
Tk_Window tkwin, /* Window containing canvas widget. */
@@ -2103,21 +2112,21 @@ ConfigureArrows(
double width;
Tk_State state = linePtr->header.state;
- if (linePtr->numPoints <2) {
+ if (linePtr->numPoints < 2) {
return TCL_OK;
}
- if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ if (state == TK_STATE_NULL) {
+ state = Canvas(canvas)->canvas_state;
}
width = linePtr->outline.width;
- if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)linePtr) {
- if (linePtr->outline.activeWidth>width) {
+ if (Canvas(canvas)->currentItemPtr == (Tk_Item *)linePtr) {
+ if (linePtr->outline.activeWidth > width) {
width = linePtr->outline.activeWidth;
}
- } else if (state==TK_STATE_DISABLED) {
- if (linePtr->outline.disabledWidth>0) {
+ } else if (state == TK_STATE_DISABLED) {
+ if (linePtr->outline.disabledWidth > 0) {
width = linePtr->outline.disabledWidth;
}
}
@@ -2144,8 +2153,8 @@ ConfigureArrows(
if (linePtr->arrow != ARROWS_LAST) {
poly = linePtr->firstArrowPtr;
if (poly == NULL) {
- poly = (double *) ckalloc((unsigned)
- (2*PTS_IN_ARROW*sizeof(double)));
+ poly = (double *)
+ ckalloc((unsigned) (2*PTS_IN_ARROW*sizeof(double)));
poly[0] = poly[10] = linePtr->coordPtr[0];
poly[1] = poly[11] = linePtr->coordPtr[1];
linePtr->firstArrowPtr = poly;
@@ -2253,51 +2262,51 @@ LineToPostscript(
{
LineItem *linePtr = (LineItem *) itemPtr;
char buffer[64 + TCL_INTEGER_SPACE];
- char *style;
+ const char *style;
double width;
XColor *color;
Pixmap stipple;
Tk_State state = itemPtr->state;
- if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ if (state == TK_STATE_NULL) {
+ state = Canvas(canvas)->canvas_state;
}
width = linePtr->outline.width;
color = linePtr->outline.color;
stipple = linePtr->outline.stipple;
- if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
- if (linePtr->outline.activeWidth>width) {
+ if (Canvas(canvas)->currentItemPtr == itemPtr) {
+ if (linePtr->outline.activeWidth > width) {
width = linePtr->outline.activeWidth;
}
- if (linePtr->outline.activeColor!=NULL) {
+ if (linePtr->outline.activeColor != NULL) {
color = linePtr->outline.activeColor;
}
- if (linePtr->outline.activeStipple!=None) {
+ if (linePtr->outline.activeStipple != None) {
stipple = linePtr->outline.activeStipple;
}
- } else if (state==TK_STATE_DISABLED) {
- if (linePtr->outline.disabledWidth>0) {
+ } else if (state == TK_STATE_DISABLED) {
+ if (linePtr->outline.disabledWidth > 0) {
width = linePtr->outline.disabledWidth;
}
- if (linePtr->outline.disabledColor!=NULL) {
+ if (linePtr->outline.disabledColor != NULL) {
color = linePtr->outline.disabledColor;
}
- if (linePtr->outline.disabledStipple!=None) {
+ if (linePtr->outline.disabledStipple != None) {
stipple = linePtr->outline.disabledStipple;
}
}
- if (color == NULL || linePtr->numPoints<1 || linePtr->coordPtr==NULL) {
+ if (color == NULL || linePtr->numPoints < 1 || linePtr->coordPtr == NULL){
return TCL_OK;
}
- if (linePtr->numPoints==1) {
+ if (linePtr->numPoints == 1) {
sprintf(buffer, "%.15g %.15g translate %.15g %.15g",
linePtr->coordPtr[0], Tk_CanvasPsY(canvas, linePtr->coordPtr[1]),
width/2.0, width/2.0);
- Tcl_AppendResult(interp, "matrix currentmatrix\n",buffer,
+ Tcl_AppendResult(interp, "matrix currentmatrix\n", buffer,
" scale 1 0 moveto 0 0 1 0 360 arc\nsetmatrix\n", NULL);
if (Tk_CanvasPsColor(interp, canvas, color) != TCL_OK) {
return TCL_ERROR;
@@ -2319,37 +2328,34 @@ LineToPostscript(
if ((!linePtr->smooth) || (linePtr->numPoints < 3)) {
Tk_CanvasPsPath(interp, canvas, linePtr->coordPtr, linePtr->numPoints);
+ } else if ((stipple == None) && linePtr->smooth->postscriptProc) {
+ linePtr->smooth->postscriptProc(interp, canvas, linePtr->coordPtr,
+ linePtr->numPoints, linePtr->splineSteps);
} else {
- if ((stipple == None) && linePtr->smooth->postscriptProc) {
- linePtr->smooth->postscriptProc(interp, canvas,
- linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps);
- } else {
- /*
- * Special hack: Postscript printers don't appear to be able to
- * turn a path drawn with "curveto"s into a clipping path without
- * exceeding resource limits, so TkMakeBezierPostscript won't work
- * for stippled curves. Instead, generate all of the intermediate
- * points here and output them into the Postscript file with
- * "lineto"s instead.
- */
+ /*
+ * Special hack: Postscript printers don't appear to be able to turn a
+ * path drawn with "curveto"s into a clipping path without exceeding
+ * resource limits, so TkMakeBezierPostscript won't work for stippled
+ * curves. Instead, generate all of the intermediate points here and
+ * output them into the Postscript file with "lineto"s instead.
+ */
- double staticPoints[2*MAX_STATIC_POINTS];
- double *pointPtr;
- int numPoints;
+ double staticPoints[2*MAX_STATIC_POINTS];
+ double *pointPtr;
+ int numPoints;
- numPoints = linePtr->smooth->coordProc(canvas, NULL,
- linePtr->numPoints, linePtr->splineSteps, NULL, NULL);
- pointPtr = staticPoints;
- if (numPoints > MAX_STATIC_POINTS) {
- pointPtr = (double *) ckalloc((unsigned)
- (numPoints * 2 * sizeof(double)));
- }
- numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
- linePtr->numPoints, linePtr->splineSteps, NULL, pointPtr);
- Tk_CanvasPsPath(interp, canvas, pointPtr, numPoints);
- if (pointPtr != staticPoints) {
- ckfree((char *) pointPtr);
- }
+ numPoints = linePtr->smooth->coordProc(canvas, NULL,
+ linePtr->numPoints, linePtr->splineSteps, NULL, NULL);
+ pointPtr = staticPoints;
+ if (numPoints > MAX_STATIC_POINTS) {
+ pointPtr = (double *)
+ ckalloc((unsigned) (numPoints * 2 * sizeof(double)));
+ }
+ numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr,
+ linePtr->numPoints, linePtr->splineSteps, NULL, pointPtr);
+ Tk_CanvasPsPath(interp, canvas, pointPtr, numPoints);
+ if (pointPtr != staticPoints) {
+ ckfree((char *) pointPtr);
}
}
@@ -2372,7 +2378,7 @@ LineToPostscript(
}
Tcl_AppendResult(interp, style, NULL);
- if (Tk_CanvasPsOutline(canvas, itemPtr, &(linePtr->outline)) != TCL_OK) {
+ if (Tk_CanvasPsOutline(canvas, itemPtr, &linePtr->outline) != TCL_OK) {
return TCL_ERROR;
}
@@ -2433,16 +2439,16 @@ ArrowheadPostscript(
Pixmap stipple;
Tk_State state = linePtr->header.state;
- if(state == TK_STATE_NULL) {
- state = ((TkCanvas *)canvas)->canvas_state;
+ if (state == TK_STATE_NULL) {
+ state = Canvas(canvas)->canvas_state;
}
stipple = linePtr->outline.stipple;
- if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)linePtr) {
+ if (Canvas(canvas)->currentItemPtr == (Tk_Item *) linePtr) {
if (linePtr->outline.activeStipple!=None) {
stipple = linePtr->outline.activeStipple;
}
- } else if (state==TK_STATE_DISABLED) {
+ } else if (state == TK_STATE_DISABLED) {
if (linePtr->outline.activeStipple!=None) {
stipple = linePtr->outline.disabledStipple;
}