]> git.donarmstrong.com Git - lilypond.git/blob - lily/stem-staff-side.cc
4df6a8e9c9c39fe55eabdafdd1ea9d4c4e848a83
[lilypond.git] / lily / stem-staff-side.cc
1 /*   
2   g-stem-staff-side.cc --  implement Stem_staff_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 "stem-staff-side.hh"
11 #include "stem.hh"
12
13 Stem_staff_side_item::Stem_staff_side_item ()
14 {
15   stem_l_ =0;
16   relative_dir_ = CENTER;
17 }
18
19 void
20 Stem_staff_side_item::do_substitute_element_pointer (Score_element*o,
21                                                        Score_element*n)
22 {
23   if (o == stem_l_)
24     {
25       stem_l_ = dynamic_cast<Stem*> (n);
26     }
27 }
28
29 void
30 Stem_staff_side_item::set_stem (Stem*s)
31 {
32   stem_l_ =s;
33   add_dependency (s);
34 }
35
36
37 Direction
38 Stem_staff_side_item::get_default_direction () const
39 {
40   return relative_dir_ * stem_l_->dir_;
41 }
42
43 void
44 Stem_staff_side_item::do_pre_processing ()
45 {
46   SCM p = remove_elt_property (padding_scm_sym);
47   if (p != SCM_BOOL_F && stem_l_)
48     {
49       p = SCM_CDR (p);
50       set_elt_property (padding_scm_sym,
51                         gh_double2scm(stem_l_->staff_line_leading_f ()
52                                       * gh_scm2double (p)));
53     }
54   Staff_side_item::do_pre_processing ();
55 }