2 abbrev.cc -- implement Stem_tremolo
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "stem-tremolo.hh"
13 #include "paper-def.hh"
17 #include "dimension-cache.hh"
19 Stem_tremolo::Stem_tremolo ()
21 set_elt_property ("stem", SCM_EOL);
26 Stem_tremolo::do_print () const
28 DEBUG_OUT << "abbrev_flags_i_ " << abbrev_flags_i_;
32 Stem_tremolo::stem_l ()const
34 SCM s = get_elt_property ("stem");
36 return dynamic_cast<Stem*> ( unsmob_element (s));
40 Stem_tremolo::dim_callback (Dimension_cache const *c)
42 Stem_tremolo * s = dynamic_cast<Stem_tremolo*> (c->element_l ());
43 Real space = s->stem_l ()->staff_line_leading_f ();
44 return Interval (-space, space);
49 Stem_tremolo::do_brew_molecule_p () const
51 Stem * st = stem_l ();
53 if (Beam * b = st->beam_l ())
55 Stem_info i = b->get_stem_info (st);
59 Real interbeam_f = paper_l ()->interbeam_f (mult);
60 Real w = gh_scm2double (get_elt_property ("beam-width"));
61 Real space = st->staff_line_leading_f ();
62 Real internote_f = space/2;
64 Real beam_f = gh_scm2double (get_elt_property ("beam-thickness"));
67 Real slope_f = internote_f / 4 / internote_f; // HUH?
69 if (st && st->beam_l ()) {
70 slope_f = st->beam_l ()->slope_f_;
71 // ugh, rather calc from Stem_tremolo_req
72 beams_i = st->beams_i_drul_[RIGHT] >? st->beams_i_drul_[LEFT];
74 Real sl = slope_f * internote_f;
76 Molecule a (lookup_l ()->beam (sl, w, beam_f));
77 a.translate (Offset (-w/2, w / 2 * slope_f));
79 Molecule *beams= new Molecule;
80 for (int i = 0; i < abbrev_flags_i_; i++)
83 b.translate_axis (interbeam_f * i, Y_AXIS);
84 beams->add_molecule (b);
86 beams->translate_axis (-beams->extent ()[Y_AXIS].center (), Y_AXIS);
92 beams->translate (Offset(st->hpos_f () - hpos_f (),
93 st->stem_end_f () * internote_f -
94 st->beam_l ()->get_direction () * beams_i * interbeam_f));
99 Beams should intersect one beamthickness below staff end
101 Real dy = - beams->extent ()[Y_AXIS].length () / 2 * st->get_direction ();
104 uhg. Should use relative coords and placement
106 Real whole_note_correction = (st && st->invisible_b( ))
107 ? -st->get_direction () * st->note_delta_f ()/2
111 UGH. Internote fudging.
114 dy += st->stem_end_f ();
116 beams->translate (Offset(st->hpos_f () - hpos_f ()+
117 whole_note_correction, dy));
121 there used to be half a page of code that was long commented out.
131 Stem_tremolo::set_stem (Stem *s)
133 set_elt_property ("stem", s->self_scm_);