2 g-staff-side.cc -- implement G_staff_side_item
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "g-staff-side.hh"
11 #include "staff-symbol.hh"
13 G_staff_side_item::G_staff_side_item ()
17 set_elt_property (transparent_scm_sym, SCM_BOOL_T);
24 G_staff_side_item::do_pre_processing ()
27 set_default_direction ();
34 G_staff_side_item::set_default_direction ()
41 G_staff_side_item::set_victim (Score_element *e)
45 to_position_l_->dim_cache_[axis_].parent_l_ = &dim_cache_[axis_];
49 G_staff_side_item::add_support (Score_element*e)
52 support_l_arr_.push (e);
57 G_staff_side_item::do_substitute_element_pointer (Score_element*o, Score_element*n)
59 Staff_symbol_referencer::do_substitute_element_pointer (o,n);
60 if (o == to_position_l_)
63 support_l_arr_.unordered_substitute (o,n);
67 G_staff_side_item::position_self ()
70 Dimension_cache *common = 0;
71 if (support_l_arr_.size ())
73 common = common_group (typecast_array (support_l_arr_, (Graphical_element*)0),
76 for (int i=0; i < support_l_arr_.size (); i++)
78 Score_element * e = support_l_arr_ [i];
79 Real coord = e->relative_coordinate (common, axis_);
80 dim.unite (coord + e->extent (axis_));
86 common = dim_cache_[axis_].parent_l_;
88 Interval sym_dim = to_position_l_->extent (axis_);
89 Real off = dim_cache_[axis_].relative_coordinate (common) - padding_f_ * dir_;
91 dim_cache_[axis_].set_offset (dim[dir_] - sym_dim[-dir_] - off);
95 G_staff_side_item::do_post_processing ()
103 G_staff_side_item::do_add_processing ()
105 if (axis_ == Y_AXIS && staff_symbol_l ())
107 add_support (staff_symbol_l ());