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>
9 #include "dimension-cache.hh"
10 #include "interval.hh"
11 #include "graphical-axis-group.hh"
12 #include "axis-group-element.hh"
13 #include "graphical-element.hh"
16 /** don't copy anything: an element can only be in one
17 Graphical_axis_group at one time. */
18 Graphical_axis_group::Graphical_axis_group(Graphical_axis_group const&s)
22 gcc-2.95: huh? why can't i assign a const value to a var?
23 graphical-axis-group.cc:20: incompatible types in assignment of `const Axis[2]' to `Axis[2]'
27 axes_[0] = s.axes_[0];
28 axes_[1] = s.axes_[1];
30 ordered_b_ = s.ordered_b_;
34 Graphical_axis_group::contains_b (Graphical_element const *e) const
36 return elem_l_arr_.find_l (e);
40 Graphical_axis_group::extent (Axis axis) const
43 for (int i=0; i < elem_l_arr_.size(); i++)
44 r.unite (elem_l_arr_[i]->extent (axis));
49 Graphical_axis_group::add_element (Graphical_element*e)
53 for (int i = 0; i < 2; i++)
57 Dimension_cache * &d = e->dim_cache_[a]->parent_l_;
58 assert (!d || d == dim_cache_[a]);
60 d->dependencies_l_arr_.push (dim_cache_[a]);
69 Graphical_axis_group::remove_element (Graphical_element*e)
71 assert (contains_b (e));
73 elem_l_arr_.substitute (e,0);
75 elem_l_arr_.unordered_substitute (e,0);
77 for (int i=0; i< 2; i++)
80 Dimension_cache * d = e->dim_cache_[a];
82 d->dependencies_l_arr_.unordered_substitute (dim_cache_[a], 0);
87 Graphical_axis_group::remove_all ()
89 for (int i=0; i < elem_l_arr_.size(); i++)
91 Graphical_element*e=elem_l_arr_[i];
92 for (int i=0; i< 2; i++)
95 Dimension_cache * d = e->dim_cache_[a];
97 d->dependencies_l_arr_.clear ();
101 elem_l_arr_.clear ();
106 Graphical_axis_group::do_print() const
109 for (int i=0; i < elem_l_arr_.size(); i++)
110 DOUT << classname(elem_l_arr_[i]) << " ";
114 Graphical_axis_group::Graphical_axis_group ()
117 axes_[0] = (Axis)-1 ;
118 axes_[1] = (Axis)-1 ;
122 Graphical_axis_group::set_axes (Axis a1, Axis a2)