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);
18 staff_support_b_ = true;
25 G_staff_side_item::do_pre_processing ()
28 dir_ = get_default_direction ();
35 G_staff_side_item::get_default_direction () const
42 G_staff_side_item::set_victim (Score_element *e)
46 to_position_l_->dim_cache_[axis_].parent_l_ = &dim_cache_[axis_];
50 G_staff_side_item::add_support (Score_element*e)
53 support_l_arr_.push (e);
58 G_staff_side_item::do_substitute_element_pointer (Score_element*o, Score_element*n)
60 Staff_symbol_referencer::do_substitute_element_pointer (o,n);
61 if (o == to_position_l_)
64 support_l_arr_.unordered_substitute (o,n);
68 G_staff_side_item::position_self ()
72 Dimension_cache *common = 0;
73 if (support_l_arr_.size ())
75 common = common_group (typecast_array (support_l_arr_, (Graphical_element*)0),
78 for (int i=0; i < support_l_arr_.size (); i++)
80 Score_element * e = support_l_arr_ [i];
81 Real coord = e->relative_coordinate (common, axis_);
82 dim.unite (coord + e->extent (axis_));
88 common = dim_cache_[axis_].parent_l_;
94 ? to_position_l_->extent (axis_)
97 Real off = dim_cache_[axis_].relative_coordinate (common);
99 SCM pad = remove_elt_property (padding_scm_sym);
100 if (pad != SCM_BOOL_F)
102 off += gh_scm2double (SCM_CDR(pad)) * dir_;
104 dim_cache_[axis_].set_offset (dim[dir_] - sym_dim[-dir_] + off);
108 G_staff_side_item::do_post_processing ()
116 G_staff_side_item::do_add_processing ()
119 && axis_ == Y_AXIS && staff_symbol_l ())
121 add_support (staff_symbol_l ());