2 g-staff-side.cc -- implement G_staff_side_item
4 source file of the GNU LilyPond music typesetter
6 (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "g-staff-side.hh"
12 G_staff_side_item::G_staff_side_item ()
16 transparent_b_ = true;
23 G_staff_side_item::do_pre_processing ()
26 set_default_direction ();
33 G_staff_side_item::set_default_direction ()
40 G_staff_side_item::set_victim (Score_element *e)
44 to_position_l_->dim_cache_[axis_].parent_l_ = &dim_cache_[axis_];
48 G_staff_side_item::add_support (Score_element*e)
51 support_l_arr_.push (e);
56 G_staff_side_item::do_substitute_dependency (Score_element*o, Score_element*n)
58 if (o == to_position_l_)
61 support_l_arr_.unordered_substitute (o,n);
65 G_staff_side_item::position_self ()
68 Dimension_cache *common = 0;
69 if (support_l_arr_.size ())
71 common = common_group (typecast_array (support_l_arr_, (Graphical_element*)0),
74 for (int i=0; i < support_l_arr_.size (); i++)
76 Score_element * e = support_l_arr_ [i];
77 Real coord = e->relative_coordinate (common, axis_);
78 dim.unite (coord + e->extent (axis_));
84 common = dim_cache_[axis_].parent_l_;
86 Interval sym_dim = to_position_l_->extent (axis_);
87 Real off = dim_cache_[axis_].relative_coordinate (common) - padding_f_ * dir_;
89 dim_cache_[axis_].set_offset (dim[dir_] - sym_dim[-dir_] - off);
93 G_staff_side_item::do_post_processing ()