lilypond-1.1.67
[lilypond.git] / lily / note-head-side.cc
bloba5ef70294ca42df6326f86e25cb532a6d80624f7
1 /*
2 note-head-side.cc -- implement Note_head_side
4 source file of the GNU LilyPond music typesetter
6 (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
10 #include "note-head-side.hh"
12 void
13 Note_head_side::add_support (Item*head_l)
15 if (support_l_arr_.find_l(head_l))
16 return ;
17 support_l_arr_.push (head_l);
18 add_dependency (head_l);
21 void
22 Note_head_side::do_pre_processing ()
24 Interval x_int;
25 for (int i=0; i < support_l_arr_.size(); i++)
27 Dimension_cache *common =
28 common_group (support_l_arr_[i], X_AXIS);
30 Real x = support_l_arr_[i]->relative_coordinate (common, X_AXIS)
31 - relative_coordinate (common, X_AXIS);
33 x_int.unite (x + support_l_arr_[i]->extent (X_AXIS));
36 if (x_int.empty_b ())
37 x_int = Interval(0,0);
39 translate_axis (-extent(X_AXIS)[-notehead_align_dir_] + x_int[notehead_align_dir_], X_AXIS);
42 void
43 Note_head_side::do_substitute_element_pointer (Score_element*o,Score_element*n)
45 if (Item* o_l = dynamic_cast <Item *> (o))
46 support_l_arr_.substitute (o_l,dynamic_cast <Item *> (n));
49 Note_head_side:: Note_head_side()
51 notehead_align_dir_ = LEFT;
53 bool
54 Note_head_side::supported_b ()const
56 return support_l_arr_.size ();