diff options
Diffstat (limited to 'generic/Tabular.c')
-rw-r--r-- | generic/Tabular.c | 126 |
1 files changed, 108 insertions, 18 deletions
diff --git a/generic/Tabular.c b/generic/Tabular.c index c24244c..009576f 100644 --- a/generic/Tabular.c +++ b/generic/Tabular.c @@ -136,7 +136,7 @@ Init(Item item, &field_set->num_fields) != ZN_ERROR)) { *args += 1; *argc -= 1; - ITEM_P.InitFields(field_set); + FIELD.InitFields(field_set); } else { Tcl_AppendResult(wi->interp, " number of fields expected", NULL); @@ -159,7 +159,7 @@ Init(Item item, static void Clone(Item item) { - ITEM_P.CloneFields(&((TabularItem) item)->field_set); + FIELD.CloneFields(&((TabularItem) item)->field_set); } @@ -173,7 +173,7 @@ Clone(Item item) static void Destroy(Item item) { - ITEM_P.FreeFields(&((TabularItem) item)->field_set); + FIELD.FreeFields(&((TabularItem) item)->field_set); } @@ -193,7 +193,8 @@ Configure(Item item, Item old_connected; old_connected = item->connected_item; - if (ITEM_P.ConfigureAttributes((char *) item, -1, argc, argv, flags) == ZN_ERROR) { + if (ZnConfigureAttributes(item->wi, item, tabular_attrs, + argc, argv, flags) == ZN_ERROR) { return ZN_ERROR; } if (ISSET(*flags, ZN_ITEM_FLAG)) { @@ -227,7 +228,7 @@ Query(Item item, int argc, Tcl_Obj *CONST argv[]) { - if (ITEM_P.QueryAttribute((char *) item, -1, argv[0]) == ZN_ERROR) { + if (ZnQueryAttribute(item->wi, item, tabular_attrs, argv[0]) == ZN_ERROR) { return ZN_ERROR; } @@ -253,7 +254,7 @@ ComputeCoordinates(Item item, ResetBBox(&item->item_bounding_box); if (field_set->label_format) { - ITEM_P.GetLabelBBox(field_set, &width, &height); + FIELD.GetLabelBBox(field_set, &width, &height); /* * The connected item support anchors, this is checked by @@ -303,7 +304,7 @@ ToArea(Item item, int enclosed, ZnBool report) { - return ITEM_P.FieldsToArea(&((TabularItem) item)->field_set, area); + return FIELD.FieldsToArea(&((TabularItem) item)->field_set, area); } @@ -317,7 +318,7 @@ ToArea(Item item, static void Draw(Item item) { - ITEM_P.DrawFields(&((TabularItem) item)->field_set); + FIELD.DrawFields(&((TabularItem) item)->field_set, item); } @@ -331,7 +332,7 @@ Draw(Item item) static void Render(Item item) { - ITEM_P.RenderFields(&((TabularItem) item)->field_set); + FIELD.RenderFields(&((TabularItem) item)->field_set, item); } @@ -354,7 +355,7 @@ IsSensitive(Item item, return ISSET(item->flags, SENSITIVE_BIT); } else { - return ITEM_P.IsFieldSensitive(&((TabularItem) item)->field_set, item_part); + return FIELD.IsFieldSensitive(&((TabularItem) item)->field_set, item_part); } } @@ -378,7 +379,7 @@ Pick(Item item, int best_part; double dist; - dist = ITEM_P.FieldsPick(&((TabularItem) item)->field_set, p, &best_part); + dist = FIELD.FieldsPick(&((TabularItem) item)->field_set, p, &best_part); /*printf("tabular %d reporting part %d, distance %lf\n", item->id, best_part, dist);*/ if (dist <= 0.0) { @@ -434,7 +435,7 @@ GetAnchor(Item item, ZnDim width, height; if (field_set->label_format) { - ITEM_P.GetLabelBBox(field_set, &width, &height); + FIELD.GetLabelBBox(field_set, &width, &height); Origin2Anchor(&field_set->label_pos, width, height, anchor, p); } else { @@ -461,7 +462,7 @@ GetClipVertices(Item item, ZnPoint *points; if (field_set->label_format) { - ITEM_P.GetLabelBBox(field_set, &width, &height); + FIELD.GetLabelBBox(field_set, &width, &height); ZnListAssertSize(item->wi->work_pts, 2); points = (ZnPoint *) ZnListArray(item->wi->work_pts); TRI_STRIP1(tristrip, points, 2); @@ -565,6 +566,95 @@ Part(Item item, /* ********************************************************************************** * + * Index -- + * Parse a text index and return its value and aa + * error status (standard Tcl result). + * + ********************************************************************************** + */ +static int +Index(Item item, + int field, + Tcl_Obj *index_spec, + int *index) +{ + return FIELD.FieldIndex(&((TabularItem) item)->field_set, field, + item, index_spec, index); +} + + +/* + ********************************************************************************** + * + * InsertChars -- + * + ********************************************************************************** + */ +static void +InsertChars(Item item, + int field, + int *index, + char *chars) +{ + FIELD.FieldInsertChars(&((TabularItem) item)->field_set, field, index, chars); +} + + +/* + ********************************************************************************** + * + * DeleteChars -- + * + ********************************************************************************** + */ +static void +DeleteChars(Item item, + int field, + int *first, + int *last) +{ + FIELD.FieldDeleteChars(&((TabularItem) item)->field_set, field, first, last); +} + + +/* + ********************************************************************************** + * + * Cursor -- + * + ********************************************************************************** + */ +static void +TabularCursor(Item item, + int field, + int index) +{ + FIELD.FieldCursor(&((TabularItem) item)->field_set, field, index); +} + + +/* + ********************************************************************************** + * + * Selection -- + * + ********************************************************************************** + */ +static int +Selection(Item item, + int field, + int offset, + char *chars, + int max_chars) +{ + return FIELD.FieldSelection(&((TabularItem) item)->field_set, field, + offset, chars, max_chars); +} + + +/* + ********************************************************************************** + * * Exported functions structs -- * ********************************************************************************** @@ -586,12 +676,12 @@ static ItemClassStruct TABULAR_ITEM_CLASS = { GetClipVertices, NULL, /* GetContours */ Coords, - NULL, /* InsertChars */ - NULL, /* DeleteChars */ - NULL, /* Cursor */ - NULL, /* Index */ + InsertChars, + DeleteChars, + TabularCursor, + Index, Part, - NULL, /* Selection */ + Selection, NULL, /* Contour */ ComputeCoordinates, ToArea, |