]> git.donarmstrong.com Git - lilypond.git/blob - lily/note-head-side.cc
release: 1.1.58
[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       Dimension_cache *common = 
28         common_group (support_l_arr_[i], X_AXIS);
29
30       Real x = support_l_arr_[i]->relative_coordinate (common, X_AXIS)
31         - relative_coordinate (common, X_AXIS);
32
33       x_int.unite (x + support_l_arr_[i]->extent (X_AXIS));
34     }
35
36   if (x_int.empty_b ())
37     x_int = Interval(0,0);
38   
39   translate_axis (-extent(X_AXIS)[-align_dir_] + x_int[align_dir_], X_AXIS);
40 }
41
42 void
43 Note_head_side::do_substitute_element_pointer (Score_element*o,Score_element*n)
44 {
45   if (Item* o_l = dynamic_cast <Item *> (o))
46     support_l_arr_.substitute (o_l,dynamic_cast <Item *> (n));
47 }
48
49 Note_head_side:: Note_head_side()
50 {
51   align_dir_ = LEFT;
52 }