summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvas.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-11-08 11:18:16 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-11-08 11:18:16 (GMT)
commit978f720f41aa619ab7d3cfb0032cf17fc7e7745c (patch)
tree7f7e5653a7f0e65de7af7a9863fba0183efd2030 /generic/tkCanvas.c
parent9bda6a9690126bd05e958983768caf99b11becb3 (diff)
parentc9675946c53609725192da5ca22fbad562382ad4 (diff)
downloadtk-978f720f41aa619ab7d3cfb0032cf17fc7e7745c.zip
tk-978f720f41aa619ab7d3cfb0032cf17fc7e7745c.tar.gz
tk-978f720f41aa619ab7d3cfb0032cf17fc7e7745c.tar.bz2
Rebase to trunk.
Diffstat (limited to 'generic/tkCanvas.c')
-rw-r--r--generic/tkCanvas.c124
1 files changed, 12 insertions, 112 deletions
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 2d90e36..06b7be1 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -260,9 +260,6 @@ static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr,
static int FindArea(Tcl_Interp *interp, TkCanvas *canvasPtr,
Tcl_Obj *const *objv, Tk_Uid uid, int enclosed);
static double GridAlign(double coord, double spacing);
-#if !defined(TK_NO_DEPRECATED) && (TK_MAJOR_VERSION < 9)
-static const char** TkGetStringsFromObjs(Tcl_Size objc, Tcl_Obj *const *objv);
-#endif
static void InitCanvas(void);
static void PickCurrentItem(TkCanvas *canvasPtr, XEvent *eventPtr);
static Tcl_Obj * ScrollFractions(int screen1,
@@ -328,7 +325,7 @@ static inline int
AlwaysRedraw(
Tk_Item *itemPtr)
{
- return itemPtr->typePtr->alwaysRedraw & 1;
+ return itemPtr->typePtr->flags & TK_ALWAYS_REDRAW;
}
static inline int
@@ -339,25 +336,9 @@ ItemConfigure(
Tcl_Obj *const objv[])
{
Tcl_Interp *interp = canvasPtr->interp;
- int result;
- if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
- result = itemPtr->typePtr->configProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, objc, objv, TK_CONFIG_ARGV_ONLY);
- } else {
-#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8)
- Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory");
-#else
- const char **args = TkGetStringsFromObjs(objc, objv);
-
- result = itemPtr->typePtr->configProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, objc, (Tcl_Obj **) args, TK_CONFIG_ARGV_ONLY);
- if (args != NULL) {
- ckfree(args);
- }
-#endif
- }
- return result;
+ return itemPtr->typePtr->configProc(interp, (Tk_Canvas) canvasPtr,
+ itemPtr, objc, objv, TK_CONFIG_ARGV_ONLY);
}
static inline int
@@ -394,21 +375,9 @@ ItemCoords(
if (itemPtr->typePtr->coordProc == NULL) {
result = TCL_OK;
- } else if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
- result = itemPtr->typePtr->coordProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, objc, objv);
} else {
-#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8)
- Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory");
-#else
- const char **args = TkGetStringsFromObjs(objc, objv);
-
result = itemPtr->typePtr->coordProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, objc, (Tcl_Obj **) args);
- if (args != NULL) {
- ckfree(args);
- }
-#endif
+ itemPtr, objc, objv);
}
return result;
}
@@ -422,25 +391,9 @@ ItemCreate(
Tcl_Obj *const objv[])
{
Tcl_Interp *interp = canvasPtr->interp;
- int result;
- if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
- result = itemPtr->typePtr->createProc(interp, (Tk_Canvas) canvasPtr,
+ return itemPtr->typePtr->createProc(interp, (Tk_Canvas) canvasPtr,
itemPtr, objc-3, objv+3);
- } else {
-#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8)
- Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory");
-#else
- const char **args = TkGetStringsFromObjs(objc-3, objv+3);
-
- result = itemPtr->typePtr->createProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, objc-3, (Tcl_Obj **) args);
- if (args != NULL) {
- ckfree(args);
- }
-#endif
- }
- return result;
}
static inline void
@@ -494,17 +447,9 @@ ItemIndex(
if (itemPtr->typePtr->indexProc == NULL) {
return TCL_OK;
- } else if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
- return itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, objPtr, indexPtr);
- } else {
-#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8)
- Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory");
-#else
- return itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
- itemPtr, (Tcl_Obj *) Tcl_GetString(objPtr), indexPtr);
-#endif
}
+ return itemPtr->typePtr->indexProc(interp, (Tk_Canvas) canvasPtr,
+ itemPtr, objPtr, indexPtr);
}
static inline void
@@ -514,17 +459,8 @@ ItemInsert(
int beforeThis,
Tcl_Obj *toInsert)
{
- if (itemPtr->typePtr->alwaysRedraw & TK_CONFIG_OBJS) {
- itemPtr->typePtr->insertProc((Tk_Canvas) canvasPtr, itemPtr,
- beforeThis, toInsert);
- } else {
-#if defined(TK_NO_DEPRECATED) || (TK_MAJOR_VERSION > 8)
- Tcl_Panic("Flag TK_CONFIG_OBJS is mandatory");
-#else
- itemPtr->typePtr->insertProc((Tk_Canvas) canvasPtr, itemPtr,
- beforeThis, (Tcl_Obj *) Tcl_GetString(toInsert));
-#endif
- }
+ itemPtr->typePtr->insertProc((Tk_Canvas) canvasPtr, itemPtr,
+ beforeThis, toInsert);
}
static inline int
@@ -1230,7 +1166,7 @@ CanvasWidgetCmd(
*/
if (itemPtr == NULL ||
- !(itemPtr->typePtr->alwaysRedraw & TK_MOVABLE_POINTS)) {
+ !(itemPtr->typePtr->flags & TK_MOVABLE_POINTS)) {
continue;
}
@@ -2324,8 +2260,8 @@ ConfigureCanvas(
Tk_State old_canvas_state=canvasPtr->canvas_state;
if (Tk_ConfigureWidget(interp, canvasPtr->tkwin, configSpecs,
- objc, (const char **) objv, (char *) canvasPtr,
- flags|TK_CONFIG_OBJS) != TCL_OK) {
+ objc, objv, canvasPtr,
+ flags) != TCL_OK) {
return TCL_ERROR;
}
@@ -6090,43 +6026,7 @@ CanvasSetOrigin(
canvasPtr->xOrigin + Tk_Width(canvasPtr->tkwin),
canvasPtr->yOrigin + Tk_Height(canvasPtr->tkwin));
}
-
-/*
- *----------------------------------------------------------------------
- *
- * TkGetStringsFromObjs --
- *
- * Results:
- * Converts object list into string list.
- *
- * Side effects:
- * Memory is allocated for the objv array, which must be freed using
- * ckfree() when no longer needed.
- *
- *----------------------------------------------------------------------
- */
-
-#if !defined(TK_NO_DEPRECATED) && (TK_MAJOR_VERSION < 9)
-static const char **
-TkGetStringsFromObjs(
- Tcl_Size objc,
- Tcl_Obj *const objv[])
-{
- Tcl_Size i;
- const char **argv;
- if (objc <= 0) {
- return NULL;
- }
- argv = (const char **)ckalloc((objc+1) * sizeof(char *));
- for (i = 0; i < objc; i++) {
- argv[i] = Tcl_GetString(objv[i]);
- }
- argv[objc] = 0;
- return argv;
-}
-#endif
-
/*
*--------------------------------------------------------------
*