2 axis-group.cc -- implement Graphical_axis_group
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "graphical-axis-group.hh"
11 #include "axis-group-element.hh"
12 #include "graphical-element.hh"
15 /** don't copy anything: an element can only be in one
16 Graphical_axis_group at one time. */
17 Graphical_axis_group::Graphical_axis_group(Graphical_axis_group const&s)
20 ordered_b_ = s.ordered_b_;
24 Graphical_axis_group::contains_b (Graphical_element const *e) const
26 return elem_l_arr_.find_l (e);
30 Graphical_axis_group::extent (Axis axis) const
33 for (int i=0; i < elem_l_arr_.size(); i++)
34 r.unite (elem_l_arr_[i]->extent (axis));
39 Graphical_axis_group::add_element (Graphical_element*e)
43 for (int i = 0; i < 2; i++)
47 Dimension_cache * &d = e->dim_cache_[a]->parent_l_;
48 assert (!d || d == dim_cache_[a]);
50 d->dependencies_l_arr_.push (dim_cache_[a]);
59 Graphical_axis_group::remove_element (Graphical_element*e)
61 assert (contains_b (e));
63 elem_l_arr_.substitute (e,0);
65 elem_l_arr_.unordered_substitute (e,0);
67 for (int i=0; i< 2; i++)
70 Dimension_cache * d = e->dim_cache_[a];
72 d->dependencies_l_arr_.unordered_substitute (dim_cache_[a], 0);
77 Graphical_axis_group::remove_all ()
79 for (int i=0; i < elem_l_arr_.size(); i++)
81 Graphical_element*e=elem_l_arr_[i];
82 for (int i=0; i< 2; i++)
85 Dimension_cache * d = e->dim_cache_[a];
87 d->dependencies_l_arr_.clear ();
96 Graphical_axis_group::do_print() const
99 for (int i=0; i < elem_l_arr_.size(); i++)
100 DOUT << classname(elem_l_arr_[i]) << " ";
104 Graphical_axis_group::Graphical_axis_group ()
107 axes_[0] = (Axis)-1 ;
108 axes_[1] = (Axis)-1 ;
112 Graphical_axis_group::set_axes (Axis a1, Axis a2)