diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/Tabular.c | 31 | ||||
-rw-r--r-- | generic/Triangles.c | 23 |
2 files changed, 25 insertions, 29 deletions
diff --git a/generic/Tabular.c b/generic/Tabular.c index eed5c41..fa04be7 100644 --- a/generic/Tabular.c +++ b/generic/Tabular.c @@ -64,6 +64,9 @@ typedef struct _TabularItemStruct { static ZnAttrConfig tabular_attrs[] = { { ZN_CONFIG_ANCHOR, "-anchor", NULL, Tk_Offset(TabularItemStruct, anchor), 0, ZN_COORDS_FLAG, False }, + { ZN_CONFIG_BOOL, "-composealpha", NULL, + Tk_Offset(TabularItemStruct, header.flags), COMPOSE_ALPHA_BIT, + ZN_DRAW_FLAG, False }, { ZN_CONFIG_BOOL, "-composerotation", NULL, Tk_Offset(TabularItemStruct, header.flags), COMPOSE_ROTATION_BIT, ZN_COORDS_FLAG, False }, @@ -88,7 +91,7 @@ static ZnAttrConfig tabular_attrs[] = { { ZN_CONFIG_BOOL, "-sensitive", NULL, Tk_Offset(TabularItemStruct, header.flags), SENSITIVE_BIT, ZN_REPICK_FLAG, False }, - { ZN_CONFIG_TAGS, "-tags", NULL, + { ZN_CONFIG_TAG_LIST, "-tags", NULL, Tk_Offset(TabularItemStruct, header.tags), 0, 0, False }, { ZN_CONFIG_BOOL, "-visible", NULL, Tk_Offset(TabularItemStruct, header.flags), VISIBLE_BIT, @@ -118,6 +121,7 @@ Init(Item item, SET(item->flags, VISIBLE_BIT); SET(item->flags, SENSITIVE_BIT); + SET(item->flags, COMPOSE_ALPHA_BIT); SET(item->flags, COMPOSE_SCALE_BIT); SET(item->flags, COMPOSE_ROTATION_BIT); @@ -159,7 +163,10 @@ Init(Item item, static void Clone(Item item) { - FIELD.CloneFields(&((TabularItem) item)->field_set); + FieldSet fs = &((TabularItem) item)->field_set; + + FIELD.CloneFields(fs); + fs->item = item; } @@ -253,7 +260,7 @@ ComputeCoordinates(Item item, ZnDim width, height; ResetBBox(&item->item_bounding_box); - if (field_set->label_format) { + if (field_set->label_format && field_set->num_fields) { FIELD.GetLabelBBox(field_set, &width, &height); /* @@ -299,12 +306,9 @@ ComputeCoordinates(Item item, */ static int ToArea(Item item, - ZnBBox *area, - Tk_Uid tag_uid, - int enclosed, - ZnBool report) + ZnToArea ta) { - return FIELD.FieldsToArea(&((TabularItem) item)->field_set, area); + return FIELD.FieldsToArea(&((TabularItem) item)->field_set, ta->area); } @@ -370,23 +374,19 @@ IsSensitive(Item item, */ static double Pick(Item item, - ZnPoint *p, - Item start_item, - int aperture, - Item *a_item, - int *part) + ZnPick ps) { int best_part; double dist; - dist = FIELD.FieldsPick(&((TabularItem) item)->field_set, p, &best_part); + dist = FIELD.FieldsPick(&((TabularItem) item)->field_set, ps->point, &best_part); /*printf("tabular %d reporting part %d, distance %lf\n", item->id, best_part, dist);*/ if (dist <= 0.0) { dist = 0.0; } - *part = best_part; + ps->a_part = best_part; return dist; } @@ -667,7 +667,6 @@ Selection(Item item, */ static ItemClassStruct TABULAR_ITEM_CLASS = { sizeof(TabularItemStruct), - True, /* has_fields */ 0, /* num_parts */ True, /* has_anchors */ "tabular", diff --git a/generic/Triangles.c b/generic/Triangles.c index 70287f3..796333c 100644 --- a/generic/Triangles.c +++ b/generic/Triangles.c @@ -70,8 +70,11 @@ typedef struct _TrianglesItemStruct { static ZnAttrConfig tr_attrs[] = { - { ZN_CONFIG_GRADIENTS, "-colors", NULL, + { ZN_CONFIG_GRADIENT_LIST, "-colors", NULL, Tk_Offset(TrianglesItemStruct, colors), 0, ZN_DRAW_FLAG, False }, + { ZN_CONFIG_BOOL, "-composealpha", NULL, + Tk_Offset(TrianglesItemStruct, header.flags), COMPOSE_ALPHA_BIT, + ZN_DRAW_FLAG, False }, { ZN_CONFIG_BOOL, "-composerotation", NULL, Tk_Offset(TrianglesItemStruct, header.flags), COMPOSE_ROTATION_BIT, ZN_COORDS_FLAG, False }, @@ -86,7 +89,7 @@ static ZnAttrConfig tr_attrs[] = { { ZN_CONFIG_BOOL, "-sensitive", NULL, Tk_Offset(TrianglesItemStruct, header.flags), SENSITIVE_BIT, ZN_REPICK_FLAG, False }, - { ZN_CONFIG_TAGS, "-tags", NULL, + { ZN_CONFIG_TAG_LIST, "-tags", NULL, Tk_Offset(TrianglesItemStruct, header.tags), 0, 0, False }, { ZN_CONFIG_BOOL, "-visible", NULL, Tk_Offset(TrianglesItemStruct, header.flags), VISIBLE_BIT, @@ -120,6 +123,7 @@ Init(Item item, /* Init attributes */ SET(item->flags, VISIBLE_BIT); SET(item->flags, SENSITIVE_BIT); + SET(item->flags, COMPOSE_ALPHA_BIT); SET(item->flags, COMPOSE_ROTATION_BIT); SET(item->flags, COMPOSE_SCALE_BIT); item->priority = DEFAULT_TRIANGLES_PRIORITY; @@ -339,14 +343,12 @@ ComputeCoordinates(Item item, */ static int ToArea(Item item, - ZnBBox *area, - Tk_Uid tag_uid, - int enclosed, - ZnBool report) + ZnToArea ta) { TrianglesItem tr = (TrianglesItem) item; ZnPoint *points; int i, num_points, result=-1, result2; + ZnBBox *area = ta->area; if (tr->dev_points.num_strips == 0) { return -1; @@ -537,15 +539,11 @@ IsSensitive(Item item, */ static double Pick(Item item, - ZnPoint *p, - Item start_item, - int aperture, - Item *a_item, - int *part) + ZnPick ps) { TrianglesItem tr = (TrianglesItem) item; double dist=1.0e40, new_dist; - ZnPoint *points; + ZnPoint *points, *p = ps->point; int i, num_points; if (tr->dev_points.num_strips == 0) { @@ -864,7 +862,6 @@ PickVertex(Item item, */ static ItemClassStruct TRIANGLES_ITEM_CLASS = { sizeof(TrianglesItemStruct), - False, /* has_fields */ 0, /* num_parts */ False, /* has_anchors */ "triangles", |