]> git.donarmstrong.com Git - lilypond.git/blob - lily/note-head-side.cc
release: 1.2.4
[lilypond.git] / lily / note-head-side.cc
1 /*   
2   note-head-side.cc --  implement Note_head_side
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #include "note-head-side.hh"
11
12 void
13 Note_head_side::add_support (Item*head_l)
14 {
15   if (support_l_arr_.find_l(head_l))
16     return ;
17   support_l_arr_.push (head_l);
18   add_dependency (head_l);
19 }
20
21 void
22 Note_head_side::do_pre_processing ()
23 {
24   Interval x_int;
25   for (int i=0; i < support_l_arr_.size(); i++) 
26     {
27       Graphical_element *common = 
28         common_refpoint (support_l_arr_[i], X_AXIS);
29       Real x = support_l_arr_[i]->relative_coordinate (common, X_AXIS)
30         - relative_coordinate (common, X_AXIS);
31
32       x_int.unite (x + support_l_arr_[i]->extent (X_AXIS));
33     }
34
35   if (x_int.empty_b ())
36     x_int = Interval(0,0);
37   
38   translate_axis (-extent(X_AXIS)[-notehead_align_dir_] + x_int[notehead_align_dir_], X_AXIS);
39 }
40
41 void
42 Note_head_side::do_substitute_element_pointer (Score_element*o,Score_element*n)
43 {
44   if (Item* o_l = dynamic_cast <Item *> (o))
45     support_l_arr_.substitute (o_l,dynamic_cast <Item *> (n));
46 }
47
48 Note_head_side:: Note_head_side()
49 {
50   notehead_align_dir_ = LEFT;
51 }
52 bool
53 Note_head_side::supported_b ()const
54 {
55   return support_l_arr_.size ();
56 }