source file of the GNU LilyPond music typesetter
- (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+
#include "interval.hh"
#include "graphical-axis-group.hh"
#include "axis-group-element.hh"
#include "debug.hh"
/** don't copy anything: an element can only be in one
- Graphical_axis_group at one time. */
-Graphical_axis_group::Graphical_axis_group (Graphical_axis_group const&s)
+ Graphical_axis_group at one time. */
+Graphical_axis_group::Graphical_axis_group(Graphical_axis_group const&s)
{
- axis1_ = s.axis1_;
- axis2_ = s.axis2_;
+ axes_ = s.axes_;
+ ordered_b_ = s.ordered_b_;
}
bool
void
Graphical_axis_group::add_element (Graphical_element*e)
{
- Graphical_axis_group *& g1 = e->axis_group_l_a_[axis1_];
- Graphical_axis_group *& g2 = e->axis_group_l_a_[axis2_];
-
- assert (!g1 || g1 == this);
- assert (!g2 || g2 == this);
- g1 = this;
- g2 = this;
+ used_b_ =true;
+ e->used_b_ = true;
+ for (int i = 0; i < 2; i++)
+ {
+ Axis a = axes_[i];
+ assert (a>=0);
+ Dimension_cache * &d = e->dim_cache_[a]->parent_l_;
+ assert (!d || d == dim_cache_[a]);
+ d = dim_cache_[a];
+ d->dependencies_l_arr_.push (dim_cache_[a]);
+ }
+
elem_l_arr_.push (e);
}
Graphical_axis_group::remove_element (Graphical_element*e)
{
assert (contains_b (e));
- elem_l_arr_.unordered_substitute (e,0);
+ if (ordered_b_)
+ elem_l_arr_.substitute (e,0);
+ else
+ elem_l_arr_.unordered_substitute (e,0);
- e->axis_group_l_a_[axis1_] = 0;
- e->axis_group_l_a_[axis2_] = 0;
+ for (int i=0; i< 2; i++)
+ {
+ Axis a=axes_[i];
+ Dimension_cache * d = e->dim_cache_[a];
+ d->parent_l_ = 0;
+ d->dependencies_l_arr_.unordered_substitute (dim_cache_[a], 0);
+ }
}
void
for (int i=0; i < elem_l_arr_.size(); i++)
{
Graphical_element*e=elem_l_arr_[i];
- e->axis_group_l_a_[axis1_] = 0;
- e->axis_group_l_a_[axis2_] = 0;
+ for (int i=0; i< 2; i++)
+ {
+ Axis a=axes_[i];
+ Dimension_cache * d = e->dim_cache_[a];
+ d->parent_l_ = 0;
+ d->dependencies_l_arr_.clear ();
+ }
+
}
elem_l_arr_.clear ();
}
#endif
}
-Graphical_axis_group::Graphical_axis_group (Axis a1, Axis a2)
+Graphical_axis_group::Graphical_axis_group ()
{
- axis1_ =a1;
- axis2_ = a2;
+ ordered_b_ = false;
+ axes_[0] = -1 ;
+ axes_[1] = -1 ;
}
-
+void
+Graphical_axis_group::set_axes (Axis a1, Axis a2)
+{
+ axes_[0] = a1 ;
+ axes_[1] = a2 ;
+}