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"
14 G_staff_side_item::G_staff_side_item ()
18 set_elt_property (transparent_scm_sym, SCM_BOOL_T);
19 staff_support_b_ = true;
26 G_staff_side_item::do_pre_processing ()
29 dir_ = get_default_direction ();
36 G_staff_side_item::get_default_direction () const
43 G_staff_side_item::set_victim (Score_element *e)
47 to_position_l_->dim_cache_[axis_].parent_l_ = &dim_cache_[axis_];
51 G_staff_side_item::add_support (Score_element*e)
54 support_l_arr_.push (e);
59 G_staff_side_item::do_substitute_element_pointer (Score_element*o, Score_element*n)
61 Staff_symbol_referencer::do_substitute_element_pointer (o,n);
62 if (o == to_position_l_)
65 support_l_arr_.unordered_substitute (o,n);
69 G_staff_side_item::position_self ()
73 Dimension_cache *common = 0;
74 if (support_l_arr_.size ())
76 common = common_group (typecast_array (support_l_arr_, (Graphical_element*)0),
79 for (int i=0; i < support_l_arr_.size (); i++)
81 Score_element * e = support_l_arr_ [i];
82 Real coord = e->relative_coordinate (common, axis_);
83 dim.unite (coord + e->extent (axis_));
89 common = dim_cache_[axis_].parent_l_;
95 ? to_position_l_->extent (axis_)
98 Real off = dim_cache_[axis_].relative_coordinate (common);
100 SCM pad = remove_elt_property (padding_scm_sym);
101 if (pad != SCM_BOOL_F)
103 off += gh_scm2double (SCM_CDR(pad)) * dir_;
105 dim_cache_[axis_].set_offset (dim[dir_] - sym_dim[-dir_] + off);
109 G_staff_side_item::do_post_processing ()
117 G_staff_side_item::do_add_processing ()
120 && axis_ == Y_AXIS && staff_symbol_l ())
122 add_support (staff_symbol_l ());
127 G_staff_side_item::do_height () const
131 return to_position_l_->extent (Y_AXIS);
136 G_staff_side_item::do_width () const
140 return to_position_l_->extent (X_AXIS);
144 G_staff_side_item::do_print () const
148 DOUT << "positioning " << to_position_l_->name();
150 DOUT << "axis == " << axis_name_str (axis_)
151 << ", dir == " << to_str (dir_ );