2 g-stem-staff-side.cc -- implement Stem_staff_side
4 source file of the GNU LilyPond music typesetter
6 (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "dimension-cache.hh"
11 #include "stem-staff-side.hh"
13 #include "staff-symbol.hh"
14 #include "paper-def.hh"
16 Stem_staff_side_item::Stem_staff_side_item ()
19 relative_dir_ = CENTER;
23 Stem_staff_side_item::do_substitute_element_pointer (Score_element*o,
28 stem_l_ = dynamic_cast<Stem*> (n);
30 Staff_side_item::do_substitute_element_pointer (o,n);
34 Stem_staff_side_item::set_stem (Stem*s)
42 Stem_staff_side_item::get_default_direction () const
44 return (Direction)(relative_dir_ * stem_l_->get_direction ());
48 Stem_staff_side_item::do_pre_processing ()
50 SCM p = remove_elt_property ("padding");
51 Real pad = paper_l ()->get_var ("articulation_script_padding_default");
52 if (get_elt_property ("no-staff-support") != SCM_UNDEFINED)
55 Real il = (stem_l_) ? stem_l_->staff_line_leading_f (): paper_l ()->get_var ("interline");
57 if (p != SCM_UNDEFINED)
59 pad = gh_scm2double (p);
62 set_elt_property ("padding",
65 Staff_side_item::do_pre_processing ();
69 Stem_staff_side_item::do_post_processing ()
71 Staff_side_item::do_post_processing ();
74 Ugh: try to get staccato dots right.
79 should use general no_staff_line_collision elt property, and use
80 the same elt prop also for positioning slurs, ties and dots.
82 if (get_elt_property ("no-staff-support") != SCM_UNDEFINED)
84 Graphical_element * c =common_refpoint (staff_symbol_l (), Y_AXIS);
85 Real staff_coord = staff_symbol_l ()->relative_coordinate (c, Y_AXIS);
86 Real self_coord = relative_coordinate (c, Y_AXIS);
87 Real now_coord = self_coord - staff_coord;
89 Real desired_coord = ceil (get_direction () * 2.0 * now_coord / staff_line_leading_f ());
90 if (! (int (desired_coord) % 2))
95 translate_axis (desired_coord * get_direction () * staff_line_leading_f () / 2.0 - now_coord, Y_AXIS);