summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvText.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tkCanvText.c')
-rw-r--r--generic/tkCanvText.c67
1 files changed, 32 insertions, 35 deletions
diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c
index fa419c3..2d462ee 100644
--- a/generic/tkCanvText.c
+++ b/generic/tkCanvText.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: tkCanvText.c,v 1.8 1999/12/21 23:55:10 hobbs Exp $
+ * RCS: @(#) $Id: tkCanvText.c,v 1.9 2001/07/03 06:03:44 hobbs Exp $
*/
#include <stdio.h>
@@ -141,10 +141,10 @@ static void ComputeTextBbox _ANSI_ARGS_((Tk_Canvas canvas,
TextItem *textPtr));
static int ConfigureText _ANSI_ARGS_((Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr, int argc,
- Tcl_Obj *CONST argv[], int flags));
+ Tcl_Obj *CONST objv[], int flags));
static int CreateText _ANSI_ARGS_((Tcl_Interp *interp,
Tk_Canvas canvas, struct Tk_Item *itemPtr,
- int argc, Tcl_Obj *CONST argv[]));
+ int argc, Tcl_Obj *CONST objv[]));
static void DeleteText _ANSI_ARGS_((Tk_Canvas canvas,
Tk_Item *itemPtr, Display *display));
static void DisplayCanvText _ANSI_ARGS_((Tk_Canvas canvas,
@@ -163,7 +163,7 @@ static void SetTextCursor _ANSI_ARGS_((Tk_Canvas canvas,
Tk_Item *itemPtr, int index));
static int TextCoords _ANSI_ARGS_((Tcl_Interp *interp,
Tk_Canvas canvas, Tk_Item *itemPtr,
- int argc, Tcl_Obj *CONST argv[]));
+ int argc, Tcl_Obj *CONST objv[]));
static void TextDeleteChars _ANSI_ARGS_((Tk_Canvas canvas,
Tk_Item *itemPtr, int first, int last));
static void TextInsert _ANSI_ARGS_((Tk_Canvas canvas,
@@ -226,30 +226,27 @@ Tk_ItemType tkTextType = {
*/
static int
-CreateText(interp, canvas, itemPtr, argc, argv)
+CreateText(interp, canvas, itemPtr, objc, objv)
Tcl_Interp *interp; /* Interpreter for error reporting. */
Tk_Canvas canvas; /* Canvas to hold new item. */
Tk_Item *itemPtr; /* Record to hold new item; header has been
* initialized by caller. */
- int argc; /* Number of arguments in argv. */
- Tcl_Obj *CONST argv[]; /* Arguments describing rectangle. */
+ int objc; /* Number of arguments in objv. */
+ Tcl_Obj *CONST objv[]; /* Arguments describing rectangle. */
{
TextItem *textPtr = (TextItem *) itemPtr;
- int i;
+ int i = 2;
- if (argc==1) {
+ if (objc == 1) {
i = 1;
- } else {
- char *arg = Tcl_GetStringFromObj(argv[1], NULL);
- if ((argc>1) && (arg[0] == '-')
- && (arg[1] >= 'a') && (arg[1] <= 'z')) {
+ } else if (objc > 1) {
+ char *arg = Tcl_GetString(objv[1]);
+ if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) {
i = 1;
- } else {
- i = 2;
}
}
- if (argc < i) {
+ if (objc < i) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
Tk_PathName(Tk_CanvasTkwin(canvas)), " create ",
itemPtr->typePtr->name, " x y ?options?\"", (char *) NULL);
@@ -293,10 +290,10 @@ CreateText(interp, canvas, itemPtr, argc, argv)
* Process the arguments to fill in the item record.
*/
- if ((TextCoords(interp, canvas, itemPtr, i, argv) != TCL_OK)) {
+ if ((TextCoords(interp, canvas, itemPtr, i, objv) != TCL_OK)) {
goto error;
}
- if (ConfigureText(interp, canvas, itemPtr, argc-i, argv+i, 0) == TCL_OK) {
+ if (ConfigureText(interp, canvas, itemPtr, objc-i, objv+i, 0) == TCL_OK) {
return TCL_OK;
}
@@ -324,38 +321,38 @@ CreateText(interp, canvas, itemPtr, argc, argv)
*/
static int
-TextCoords(interp, canvas, itemPtr, argc, argv)
+TextCoords(interp, canvas, itemPtr, objc, objv)
Tcl_Interp *interp; /* Used for error reporting. */
Tk_Canvas canvas; /* Canvas containing item. */
Tk_Item *itemPtr; /* Item whose coordinates are to be read or
* modified. */
- int argc; /* Number of coordinates supplied in argv. */
- Tcl_Obj *CONST argv[]; /* Array of coordinates: x1, y1, x2, y2, ... */
+ int objc; /* Number of coordinates supplied in objv. */
+ Tcl_Obj *CONST objv[]; /* Array of coordinates: x1, y1, x2, y2, ... */
{
TextItem *textPtr = (TextItem *) itemPtr;
- if (argc == 0) {
+ if (objc == 0) {
Tcl_Obj *obj = Tcl_NewObj();
Tcl_Obj *subobj = Tcl_NewDoubleObj(textPtr->x);
Tcl_ListObjAppendElement(interp, obj, subobj);
subobj = Tcl_NewDoubleObj(textPtr->y);
Tcl_ListObjAppendElement(interp, obj, subobj);
Tcl_SetObjResult(interp, obj);
- } else if (argc < 3) {
- if (argc==1) {
- if (Tcl_ListObjGetElements(interp, argv[0], &argc,
- (Tcl_Obj ***) &argv) != TCL_OK) {
+ } else if (objc < 3) {
+ if (objc==1) {
+ if (Tcl_ListObjGetElements(interp, objv[0], &objc,
+ (Tcl_Obj ***) &objv) != TCL_OK) {
return TCL_ERROR;
- } else if (argc != 2) {
+ } else if (objc != 2) {
char buf[64 + TCL_INTEGER_SPACE];
- sprintf(buf, "wrong # coordinates: expected 2, got %d", argc);
+ sprintf(buf, "wrong # coordinates: expected 2, got %d", objc);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
}
}
- if ((Tk_CanvasGetCoordFromObj(interp, canvas, argv[0], &textPtr->x) != TCL_OK)
- || (Tk_CanvasGetCoordFromObj(interp, canvas, argv[1],
+ if ((Tk_CanvasGetCoordFromObj(interp, canvas, objv[0], &textPtr->x) != TCL_OK)
+ || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[1],
&textPtr->y) != TCL_OK)) {
return TCL_ERROR;
}
@@ -363,7 +360,7 @@ TextCoords(interp, canvas, itemPtr, argc, argv)
} else {
char buf[64 + TCL_INTEGER_SPACE];
- sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", argc);
+ sprintf(buf, "wrong # coordinates: expected 0 or 2, got %d", objc);
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_ERROR;
}
@@ -390,12 +387,12 @@ TextCoords(interp, canvas, itemPtr, argc, argv)
*/
static int
-ConfigureText(interp, canvas, itemPtr, argc, argv, flags)
+ConfigureText(interp, canvas, itemPtr, objc, objv, flags)
Tcl_Interp *interp; /* Interpreter for error reporting. */
Tk_Canvas canvas; /* Canvas containing itemPtr. */
Tk_Item *itemPtr; /* Rectangle item to reconfigure. */
- int argc; /* Number of elements in argv. */
- Tcl_Obj *CONST argv[]; /* 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. */
{
TextItem *textPtr = (TextItem *) itemPtr;
@@ -410,7 +407,7 @@ ConfigureText(interp, canvas, itemPtr, argc, argv, flags)
Tk_State state;
tkwin = Tk_CanvasTkwin(canvas);
- if (Tk_ConfigureWidget(interp, tkwin, configSpecs, argc, (char **) argv,
+ if (Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, (char **) objv,
(char *) textPtr, flags|TK_CONFIG_OBJS) != TCL_OK) {
return TCL_ERROR;
}