aboutsummaryrefslogtreecommitdiff
path: root/generic/Tabular.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/Tabular.c')
-rw-r--r--generic/Tabular.c232
1 files changed, 116 insertions, 116 deletions
diff --git a/generic/Tabular.c b/generic/Tabular.c
index d6f1cd6..bbd9cd1 100644
--- a/generic/Tabular.c
+++ b/generic/Tabular.c
@@ -1,8 +1,8 @@
/*
* Tabular.c -- Implementation of Tabular item.
*
- * Authors : Patrick Lecoanet.
- * Creation date :
+ * Authors : Patrick Lecoanet.
+ * Creation date :
*
* $Id$
*/
@@ -49,19 +49,19 @@ static const char compile_id[]="$Compile: " __FILE__ " " __DATE__ " " __TIME__ "
**********************************************************************************
*/
typedef struct _TabularItemStruct {
- ZnItemStruct header;
+ ZnItemStruct header;
/* Public data */
- ZnPoint pos;
- Tk_Anchor anchor;
- Tk_Anchor connection_anchor;
+ ZnPoint pos;
+ Tk_Anchor anchor;
+ Tk_Anchor connection_anchor;
/* Private data */
- ZnFieldSetStruct field_set;
+ ZnFieldSetStruct field_set;
} TabularItemStruct, *TabularItem;
-static ZnAttrConfig tabular_attrs[] = {
+static ZnAttrConfig tabular_attrs[] = {
{ ZN_CONFIG_ANCHOR, "-anchor", NULL,
Tk_Offset(TabularItemStruct, anchor), 0, ZN_COORDS_FLAG, False },
{ ZN_CONFIG_BOOL, "-composealpha", NULL,
@@ -109,14 +109,14 @@ static ZnAttrConfig tabular_attrs[] = {
**********************************************************************************
*/
static int
-Init(ZnItem item,
- int *argc,
- Tcl_Obj *CONST *args[])
+Init(ZnItem item,
+ int *argc,
+ Tcl_Obj *CONST *args[])
{
- ZnWInfo *wi = item->wi;
- TabularItem tab = (TabularItem) item;
- ZnFieldSet field_set = &tab->field_set;
- int num_fields;
+ ZnWInfo *wi = item->wi;
+ TabularItem tab = (TabularItem) item;
+ ZnFieldSet field_set = &tab->field_set;
+ int num_fields;
item->priority = 1;
@@ -162,9 +162,9 @@ Init(ZnItem item,
**********************************************************************************
*/
static void
-Clone(ZnItem item)
+Clone(ZnItem item)
{
- ZnFieldSet fs = &((TabularItem) item)->field_set;
+ ZnFieldSet fs = &((TabularItem) item)->field_set;
ZnFIELD.CloneFields(fs);
fs->item = item;
@@ -179,7 +179,7 @@ Clone(ZnItem item)
**********************************************************************************
*/
static void
-Destroy(ZnItem item)
+Destroy(ZnItem item)
{
ZnFIELD.FreeFields(&((TabularItem) item)->field_set);
}
@@ -193,16 +193,16 @@ Destroy(ZnItem item)
**********************************************************************************
*/
static int
-Configure(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[],
- int *flags)
+Configure(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[],
+ int *flags)
{
- ZnItem old_connected;
+ ZnItem old_connected;
old_connected = item->connected_item;
if (ZnConfigureAttributes(item->wi, item, item, tabular_attrs,
- argc, argv, flags) == TCL_ERROR) {
+ argc, argv, flags) == TCL_ERROR) {
return TCL_ERROR;
}
if (ISSET(*flags, ZN_ITEM_FLAG)) {
@@ -211,8 +211,8 @@ Configure(ZnItem item,
* to the old one.
*/
if ((item->connected_item == ZN_NO_ITEM) ||
- (ISSET(item->connected_item->class->flags, ZN_CLASS_HAS_ANCHORS) &&
- (item->parent == item->connected_item->parent))) {
+ (ISSET(item->connected_item->class->flags, ZN_CLASS_HAS_ANCHORS) &&
+ (item->parent == item->connected_item->parent))) {
ZnITEM.UpdateItemDependency(item, old_connected);
}
else {
@@ -232,9 +232,9 @@ Configure(ZnItem item,
**********************************************************************************
*/
static int
-Query(ZnItem item,
- int argc,
- Tcl_Obj *CONST argv[])
+Query(ZnItem item,
+ int argc,
+ Tcl_Obj *CONST argv[])
{
if (ZnQueryAttribute(item->wi->interp, item, tabular_attrs, argv[0]) == TCL_ERROR) {
return TCL_ERROR;
@@ -252,13 +252,13 @@ Query(ZnItem item,
**********************************************************************************
*/
static void
-ComputeCoordinates(ZnItem item,
- ZnBool force)
+ComputeCoordinates(ZnItem item,
+ ZnBool force)
{
- TabularItem tab = (TabularItem) item;
- ZnWInfo *wi = item->wi;
- ZnFieldSet field_set = &tab->field_set;
- ZnDim width, height;
+ TabularItem tab = (TabularItem) item;
+ ZnWInfo *wi = item->wi;
+ ZnFieldSet field_set = &tab->field_set;
+ ZnDim width, height;
ZnResetBBox(&item->item_bounding_box);
if (field_set->label_format && field_set->num_fields) {
@@ -270,18 +270,18 @@ ComputeCoordinates(ZnItem item,
*/
if (item->connected_item != ZN_NO_ITEM) {
item->connected_item->class->GetAnchor(item->connected_item,
- tab->connection_anchor,
- &field_set->label_pos);
+ tab->connection_anchor,
+ &field_set->label_pos);
}
else {
ZnPoint pos;
pos.x = pos.y = 0;
ZnTransformPoint(wi->current_transfo, &pos,
- &field_set->label_pos);
+ &field_set->label_pos);
}
ZnAnchor2Origin(&field_set->label_pos, width, height, tab->anchor,
- &field_set->label_pos);
+ &field_set->label_pos);
/*
* Setup the item bounding box.
@@ -311,14 +311,14 @@ ComputeCoordinates(ZnItem item,
**********************************************************************************
*
* ToArea --
- * Tell if the object is entirely outside (-1),
- * entirely inside (1) or in between (0).
+ * Tell if the object is entirely outside (-1),
+ * entirely inside (1) or in between (0).
*
**********************************************************************************
*/
static int
-ToArea(ZnItem item,
- ZnToArea ta)
+ToArea(ZnItem item,
+ ZnToArea ta)
{
return ZnFIELD.FieldsToArea(&((TabularItem) item)->field_set, ta->area);
}
@@ -332,7 +332,7 @@ ToArea(ZnItem item,
**********************************************************************************
*/
static void
-Draw(ZnItem item)
+Draw(ZnItem item)
{
ZnFIELD.DrawFields(&((TabularItem) item)->field_set);
}
@@ -346,7 +346,7 @@ Draw(ZnItem item)
**********************************************************************************
*/
static void
-Render(ZnItem item)
+Render(ZnItem item)
{
ZnFIELD.RenderFields(&((TabularItem) item)->field_set);
}
@@ -360,8 +360,8 @@ Render(ZnItem item)
**********************************************************************************
*/
static ZnBool
-IsSensitive(ZnItem item,
- int item_part)
+IsSensitive(ZnItem item,
+ int item_part)
{
if (ISCLEAR(item->flags, ZN_SENSITIVE_BIT) ||
!item->parent->class->IsSensitive(item->parent, ZN_NO_PART)) {
@@ -380,13 +380,13 @@ IsSensitive(ZnItem item,
**********************************************************************************
*
* Pick --
- * We tell what our label tells.
+ * We tell what our label tells.
*
**********************************************************************************
*/
static double
-Pick(ZnItem item,
- ZnPick ps)
+Pick(ZnItem item,
+ ZnPick ps)
{
int best_part;
double dist;
@@ -411,8 +411,8 @@ Pick(ZnItem item,
**********************************************************************************
*/
static void
-PostScript(ZnItem item,
- ZnBool prepass)
+PostScript(ZnItem item,
+ ZnBool prepass)
{
}
@@ -425,7 +425,7 @@ PostScript(ZnItem item,
**********************************************************************************
*/
static ZnFieldSet
-GetFieldSet(ZnItem item)
+GetFieldSet(ZnItem item)
{
return &((TabularItem) item)->field_set;
}
@@ -439,12 +439,12 @@ GetFieldSet(ZnItem item)
**********************************************************************************
*/
static void
-GetAnchor(ZnItem item,
- Tk_Anchor anchor,
- ZnPoint *p)
+GetAnchor(ZnItem item,
+ Tk_Anchor anchor,
+ ZnPoint *p)
{
- ZnFieldSet field_set = &((TabularItem) item)->field_set;
- ZnDim width, height;
+ ZnFieldSet field_set = &((TabularItem) item)->field_set;
+ ZnDim width, height;
if (field_set->label_format) {
ZnFIELD.GetLabelBBox(field_set, &width, &height);
@@ -460,18 +460,18 @@ GetAnchor(ZnItem item,
**********************************************************************************
*
* GetClipVertices --
- * Get the clipping shape.
- * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
+ * Get the clipping shape.
+ * Never ever call ZnTriFree on the tristrip returned by GetClipVertices.
*
**********************************************************************************
*/
static ZnBool
-GetClipVertices(ZnItem item,
- ZnTriStrip *tristrip)
+GetClipVertices(ZnItem item,
+ ZnTriStrip *tristrip)
{
- ZnFieldSet field_set = &((TabularItem) item)->field_set;
- ZnDim width, height;
- ZnPoint *points;
+ ZnFieldSet field_set = &((TabularItem) item)->field_set;
+ ZnDim width, height;
+ ZnPoint *points;
if (field_set->label_format) {
ZnFIELD.GetLabelBBox(field_set, &width, &height);
@@ -491,32 +491,32 @@ GetClipVertices(ZnItem item,
**********************************************************************************
*
* Coords --
- * Return or edit the item origin. This doesn't take care of
- * the possible attachment. The change will be effective at the
- * end of the attachment.
+ * Return or edit the item origin. This doesn't take care of
+ * the possible attachment. The change will be effective at the
+ * end of the attachment.
*
**********************************************************************************
*/
static int
-Coords(ZnItem item,
- int contour,
- int index,
- int cmd,
- ZnPoint **pts,
- char **controls,
- unsigned int *num_pts)
+Coords(ZnItem item,
+ int contour,
+ int index,
+ int cmd,
+ ZnPoint **pts,
+ char **controls,
+ unsigned int *num_pts)
{
- TabularItem tabular = (TabularItem) item;
+ TabularItem tabular = (TabularItem) item;
if ((cmd == ZN_COORDS_ADD) || (cmd == ZN_COORDS_ADD_LAST) || (cmd == ZN_COORDS_REMOVE)) {
Tcl_AppendResult(item->wi->interp,
- " tabulars can't add or remove vertices", NULL);
+ " tabulars can't add or remove vertices", NULL);
return TCL_ERROR;
}
else if ((cmd == ZN_COORDS_REPLACE) || (cmd == ZN_COORDS_REPLACE_ALL)) {
if (*num_pts == 0) {
Tcl_AppendResult(item->wi->interp,
- " coords command need 1 point on tabulars", NULL);
+ " coords command need 1 point on tabulars", NULL);
return TCL_ERROR;
}
tabular->pos = (*pts)[0];
@@ -534,17 +534,17 @@ Coords(ZnItem item,
**********************************************************************************
*
* Part --
- * Convert a private part from/to symbolic representation.
+ * Convert a private part from/to symbolic representation.
*
**********************************************************************************
*/
static int
-Part(ZnItem item,
- Tcl_Obj **part_spec,
- int *part)
+Part(ZnItem item,
+ Tcl_Obj **part_spec,
+ int *part)
{
- char *part_str;
- char *end;
+ char *part_str;
+ char *end;
if (*part_spec) {
part_str = Tcl_GetString(*part_spec);
@@ -554,14 +554,14 @@ Part(ZnItem item,
else if (isdigit(part_str[0])) {
*part = strtol(part_str, &end, 0);
if ((*end != 0) || (*part < 0) ||
- ((unsigned int) *part >= ((TabularItem) item)->field_set.num_fields)) {
- goto part_error;
+ ((unsigned int) *part >= ((TabularItem) item)->field_set.num_fields)) {
+ goto part_error;
}
}
else {
part_error:
Tcl_AppendResult(item->wi->interp, " invalid item part specification", NULL);
- return TCL_ERROR;
+ return TCL_ERROR;
}
}
else {
@@ -580,19 +580,19 @@ Part(ZnItem item,
**********************************************************************************
*
* Index --
- * Parse a text index and return its value and aa
- * error status (standard Tcl result).
+ * Parse a text index and return its value and aa
+ * error status (standard Tcl result).
*
**********************************************************************************
*/
static int
-Index(ZnItem item,
- int field,
- Tcl_Obj *index_spec,
- int *index)
+Index(ZnItem item,
+ int field,
+ Tcl_Obj *index_spec,
+ int *index)
{
return ZnFIELD.FieldIndex(&((TabularItem) item)->field_set, field,
- index_spec, index);
+ index_spec, index);
}
@@ -604,13 +604,13 @@ Index(ZnItem item,
**********************************************************************************
*/
static void
-InsertChars(ZnItem item,
- int field,
- int *index,
- char *chars)
+InsertChars(ZnItem item,
+ int field,
+ int *index,
+ char *chars)
{
if (ZnFIELD.FieldInsertChars(&((TabularItem) item)->field_set,
- field, index, chars)) {
+ field, index, chars)) {
ZnITEM.Invalidate(item, ZN_COORDS_FLAG);
}
}
@@ -624,13 +624,13 @@ InsertChars(ZnItem item,
**********************************************************************************
*/
static void
-DeleteChars(ZnItem item,
- int field,
- int *first,
- int *last)
+DeleteChars(ZnItem item,
+ int field,
+ int *first,
+ int *last)
{
if (ZnFIELD.FieldDeleteChars(&((TabularItem) item)->field_set,
- field, first, last)) {
+ field, first, last)) {
ZnITEM.Invalidate(item, ZN_COORDS_FLAG);
}
}
@@ -644,9 +644,9 @@ DeleteChars(ZnItem item,
**********************************************************************************
*/
static void
-TabularCursor(ZnItem item,
- int field,
- int index)
+TabularCursor(ZnItem item,
+ int field,
+ int index)
{
ZnFIELD.FieldCursor(&((TabularItem) item)->field_set, field, index);
}
@@ -660,14 +660,14 @@ TabularCursor(ZnItem item,
**********************************************************************************
*/
static int
-Selection(ZnItem item,
- int field,
- int offset,
- char *chars,
- int max_chars)
+Selection(ZnItem item,
+ int field,
+ int offset,
+ char *chars,
+ int max_chars)
{
return ZnFIELD.FieldSelection(&((TabularItem) item)->field_set, field,
- offset, chars, max_chars);
+ offset, chars, max_chars);
}
@@ -693,7 +693,7 @@ static ZnItemClassStruct TABULAR_ITEM_CLASS = {
GetFieldSet,
GetAnchor,
GetClipVertices,
- NULL, /* GetContours */
+ NULL, /* GetContours */
Coords,
InsertChars,
DeleteChars,
@@ -701,14 +701,14 @@ static ZnItemClassStruct TABULAR_ITEM_CLASS = {
Index,
Part,
Selection,
- NULL, /* Contour */
+ NULL, /* Contour */
ComputeCoordinates,
ToArea,
Draw,
Render,
IsSensitive,
Pick,
- NULL, /* PickVertex */
+ NULL, /* PickVertex */
PostScript
};