summaryrefslogtreecommitdiff
path: root/src/Tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Tree.c')
-rw-r--r--src/Tree.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/src/Tree.c b/src/Tree.c
index e6db6c6..3918a43 100644
--- a/src/Tree.c
+++ b/src/Tree.c
@@ -29,7 +29,7 @@ in this Software without prior written authorization from the X Consortium.
* purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation.
- *
+ *
* Prentice Hall and the authors disclaim all warranties with regard
* to this software, including all implied warranties of merchantability and
* fitness. In no event shall Prentice Hall or the authors be liable
@@ -37,12 +37,12 @@ in this Software without prior written authorization from the X Consortium.
* resulting from loss of use, data or profits, whether in an action of
* contract, negligence or other tortious action, arising out of or in
* connection with the use or performance of this software.
- *
+ *
* Authors: Jim Fulton, MIT X Consortium,
* based on a version by Douglas Young, Prentice Hall
- *
+ *
* This widget is based on the Tree widget described on pages 397-419 of
- * Douglas Young's book "The X Window System, Programming and Applications
+ * Douglas Young's book "The X Window System, Programming and Applications
* with Xt OSF/Motif Edition." The layout code has been rewritten to use
* additional blank space to make the structure of the graph easier to see
* as well as to support vertical trees.
@@ -118,31 +118,31 @@ TreeClassRec treeClassRec = {
sizeof(TreeRec), /* widget_size */
ClassInitialize, /* class_init */
NULL, /* class_part_init */
- FALSE, /* class_inited */
+ FALSE, /* class_inited */
Initialize, /* initialize */
- NULL, /* initialize_hook */
+ NULL, /* initialize_hook */
XtInheritRealize, /* realize */
NULL, /* actions */
- 0, /* num_actions */
+ 0, /* num_actions */
resources, /* resources */
XtNumber(resources), /* num_resources */
NULLQUARK, /* xrm_class */
- TRUE, /* compress_motion */
- TRUE, /* compress_exposure */
- TRUE, /* compress_enterleave*/
+ TRUE, /* compress_motion */
+ TRUE, /* compress_exposure */
+ TRUE, /* compress_enterleave*/
TRUE, /* visible_interest */
Destroy, /* destroy */
NULL, /* resize */
Redisplay, /* expose */
SetValues, /* set_values */
- NULL, /* set_values_hook */
+ NULL, /* set_values_hook */
XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
+ NULL, /* get_values_hook */
NULL, /* accept_focus */
- XtVersion, /* version */
+ XtVersion, /* version */
NULL, /* callback_private */
NULL, /* tm_table */
- QueryGeometry, /* query_geometry */
+ QueryGeometry, /* query_geometry */
NULL, /* display_accelerator*/
NULL, /* extension */
},
@@ -150,11 +150,11 @@ TreeClassRec treeClassRec = {
/* composite_class fields */
GeometryManager, /* geometry_manager */
ChangeManaged, /* change_managed */
- XtInheritInsertChild, /* insert_child */
- XtInheritDeleteChild, /* delete_child */
+ XtInheritInsertChild, /* insert_child */
+ XtInheritDeleteChild, /* delete_child */
NULL, /* extension */
},
- {
+ {
/* constraint_class fields */
treeConstraintResources, /* subresources */
XtNumber(treeConstraintResources), /* subresource_count */
@@ -166,7 +166,7 @@ TreeClassRec treeClassRec = {
},
{
/* Tree class fields */
- 0, /* ignore */
+ 0, /* ignore */
}
};
@@ -228,28 +228,28 @@ static void insert_node (parent, node)
TreeConstraints pc;
TreeConstraints nc = TREE_CONSTRAINT(node);
int nindex;
-
+
nc->tree.parent = parent;
if (parent == NULL) return;
/*
- * If there isn't more room in the children array,
+ * If there isn't more room in the children array,
* allocate additional space.
- */
+ */
pc = TREE_CONSTRAINT(parent);
nindex = pc->tree.n_children;
-
+
if (pc->tree.n_children == pc->tree.max_children) {
pc->tree.max_children += (pc->tree.max_children / 2) + 2;
- pc->tree.children = (WidgetList) XtRealloc ((char *)pc->tree.children,
+ pc->tree.children = (WidgetList) XtRealloc ((char *)pc->tree.children,
(unsigned int)
((pc->tree.max_children) *
sizeof(Widget)));
- }
+ }
/*
- * Add the sub_node in the next available slot and
+ * Add the sub_node in the next available slot and
* increment the counter.
*/
pc->tree.children[nindex] = node;
@@ -265,8 +265,8 @@ static void delete_node (parent, node)
/*
* Make sure the parent exists.
*/
- if (!parent) return;
-
+ if (!parent) return;
+
pc = TREE_CONSTRAINT(parent);
/*
@@ -279,14 +279,14 @@ static void delete_node (parent, node)
/*
* Decrement the number of children
- */
+ */
pc->tree.n_children--;
/*
* Fill in the gap left by the sub_node.
* Zero the last slot for good luck.
*/
- for (i = pos; i < pc->tree.n_children; i++)
+ for (i = pos; i < pc->tree.n_children; i++)
pc->tree.children[i] = pc->tree.children[i+1];
pc->tree.children[pc->tree.n_children]=0;
@@ -330,7 +330,7 @@ static void Initialize (grequest, gnew, args, num_args)
Arg arglist[2];
/*
- * Make sure the widget's width and height are
+ * Make sure the widget's width and height are
* greater than zero.
*/
if (request->core.width <= 0) new->core.width = 5;
@@ -368,14 +368,14 @@ static void Initialize (grequest, gnew, args, num_args)
*/
new->tree.largest = NULL;
new->tree.n_largest = 0;
- initialize_dimensions (&new->tree.largest, &new->tree.n_largest,
+ initialize_dimensions (&new->tree.largest, &new->tree.n_largest,
TREE_INITIAL_DEPTH);
/*
* make sure that our gravity is one of the acceptable values
*/
check_gravity (new, WestGravity);
-}
+}
/* ARGSUSED */
@@ -393,21 +393,21 @@ static void ConstraintInitialize (request, new, args, num_args)
tc->tree.n_children = 0;
tc->tree.max_children = 0;
tc->tree.children = (Widget *) NULL;
- tc->tree.x = tc->tree.y = 0;
+ tc->tree.x = tc->tree.y = 0;
tc->tree.bbsubwidth = 0;
tc->tree.bbsubheight = 0;
/*
- * If this widget has a super-node, add it to that
- * widget' sub-nodes list. Otherwise make it a sub-node of
+ * If this widget has a super-node, add it to that
+ * widget' sub-nodes list. Otherwise make it a sub-node of
* the tree_root widget.
*/
if (tc->tree.parent)
insert_node (tc->tree.parent, new);
else if (tw->tree.tree_root)
insert_node (tw->tree.tree_root, new);
-}
+}
/* ARGSUSED */
@@ -428,7 +428,7 @@ static Boolean SetValues (gcurrent, grequest, gnew, args, num_args)
new->tree.line_width != current->tree.line_width) {
XtReleaseGC (gnew, new->tree.gc);
new->tree.gc = get_tree_gc (new);
- redraw = TRUE;
+ redraw = TRUE;
}
/*
@@ -480,7 +480,7 @@ static Boolean ConstraintSetValues (current, request, new, args, num_args)
insert_node(newc->tree.parent, new);
/*
- * If the Tree widget has been realized,
+ * If the Tree widget has been realized,
* compute new layout.
*/
if (XtIsRealized((Widget)tw))
@@ -490,18 +490,18 @@ static Boolean ConstraintSetValues (current, request, new, args, num_args)
}
-static void ConstraintDestroy (w)
+static void ConstraintDestroy (w)
Widget w;
-{
+{
TreeConstraints tc = TREE_CONSTRAINT(w);
TreeWidget tw = (TreeWidget) XtParent(w);
int i;
- /*
+ /*
* Remove the widget from its parent's sub-nodes list and
* make all this widget's sub-nodes sub-nodes of the parent.
*/
-
+
if (tw->tree.tree_root == w) {
if (tc->tree.n_children > 0)
tw->tree.tree_root = tc->tree.children[0];
@@ -728,8 +728,8 @@ static void compute_bounding_box_subtree (tree, w, depth)
if (tc->tree.n_children == 0) return;
/*
- * Figure the size of the opposite dimension (vertical if tree is
- * horizontal, else vice versa). The other dimension will be set
+ * Figure the size of the opposite dimension (vertical if tree is
+ * horizontal, else vice versa). The other dimension will be set
* in the second pass once we know the maximum dimensions.
*/
newwidth = 0;
@@ -737,7 +737,7 @@ static void compute_bounding_box_subtree (tree, w, depth)
for (i = 0; i < tc->tree.n_children; i++) {
Widget child = tc->tree.children[i];
TreeConstraints cc = TREE_CONSTRAINT(child);
-
+
compute_bounding_box_subtree (tree, child, depth + 1);
if (horiz) {
@@ -775,7 +775,7 @@ static void set_positions (tw, w, level)
int level;
{
int i;
-
+
if (w) {
TreeConstraints tc = TREE_CONSTRAINT(w);
@@ -900,9 +900,9 @@ static void arrange_subtree (tree, w, depth, x, y)
if (horiz) {
tc->tree.x = x;
adjusted = firstcc->tree.y +
- ((lastcc->tree.y + (Position) child->core.height +
+ ((lastcc->tree.y + (Position) child->core.height +
(Position) child->core.border_width * 2 -
- firstcc->tree.y - (Position) w->core.height -
+ firstcc->tree.y - (Position) w->core.height -
(Position) w->core.border_width * 2 + 1) / 2);
if (adjusted > tc->tree.y) tc->tree.y = adjusted;
} else {
@@ -960,7 +960,7 @@ static void layout_tree (tw, insetvalues)
tw->tree.maxwidth = tw->tree.maxheight = 0;
for (i = 0, dp = tw->tree.largest; i < tw->tree.n_largest; i++, dp++)
*dp = 0;
- initialize_dimensions (&tw->tree.largest, &tw->tree.n_largest,
+ initialize_dimensions (&tw->tree.largest, &tw->tree.n_largest,
tw->tree.n_largest);
compute_bounding_box_subtree (tw, tw->tree.tree_root, 0);