]> git.donarmstrong.com Git - lilypond.git/blob - lily/rhythmic-head.cc
release: 1.2.4
[lilypond.git] / lily / rhythmic-head.cc
1 /*
2   rhythmic-head.cc -- implement Rhythmic_head
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "rhythmic-head.hh"
10 #include "debug.hh"
11 #include "molecule.hh"
12 #include "paper-def.hh"
13 #include "lookup.hh"
14 #include "rest.hh"
15 #include "dots.hh"
16 #include "axis-group-element.hh"
17 #include "paper-score.hh"
18 #include "stem.hh"
19
20
21
22 int
23 Rhythmic_head::dots_i () const
24 {
25   return dots_l_ ? dots_l_->dots_i_ : 0;
26 }
27   
28 void
29 Rhythmic_head::do_post_processing ()
30 {
31   if (dots_l_)
32     {
33       dots_l_->position_i_ = position_i ();
34     }
35 }
36
37 void
38 Rhythmic_head::do_pre_processing ()
39 {
40   translate_axis (position_i_ * staff_line_leading_f () /2.0, Y_AXIS);
41   position_i_ = 0;
42 }
43
44 int
45 Rhythmic_head::position_i () const
46 {
47   return position_i_ +  Staff_symbol_referencer::position_i ();
48 }
49
50
51 void
52 Rhythmic_head::add_dots (Dots *dot_l)
53 {
54   dots_l_ = dot_l;  
55   dot_l->add_dependency (this);  
56 }
57
58 Rhythmic_head::Rhythmic_head ()
59 {
60   dots_l_ =0;
61   balltype_i_ =0;
62   stem_l_ =0;
63   position_i_ =0;
64 }
65
66 void
67 Rhythmic_head::do_substitute_element_pointer (Score_element*o,Score_element*n)
68 {
69   Staff_symbol_referencer::do_substitute_element_pointer (o,n);
70   if (o == dots_l_)
71     dots_l_ = dynamic_cast<Dots *> (n) ;
72   else if (o == stem_l_)
73     stem_l_ = dynamic_cast<Stem*>(n);
74 }
75
76
77 void
78 Rhythmic_head::do_print () const
79 {
80 #ifndef NPRINT
81   DOUT << "balltype = "<< balltype_i_ << "dots = " << dots_i ();
82 #endif
83 }
84