2 abbrev.cc -- implement Abbreviation
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
13 #include "paper-def.hh"
18 Abbreviation::Abbreviation ()
25 Abbreviation::do_print () const
27 DOUT << "abbrev_flags_i_ " << abbrev_flags_i_;
31 Abbreviation::brew_molecule_p () const
33 Real dy = paper ()->interbeam_f (stem_l_->mult_i_);
34 Real w = 1.5 * paper ()->lookup_l ()->ball (2).dim_.x ().length ();
35 Real interline_f = paper ()->interline_f ();
38 Real slope_f = paper ()->internote_f () / 4;
40 if (stem_l_ && stem_l_->beam_l_) {
42 slope_f = 2 * stem_l_->beam_l_->slope_f_;
43 // ugh, rather calc from Abbreviation_req
44 beams_i = stem_l_->beams_right_i_ >? stem_l_->beams_left_i_;
46 paper ()->lookup_l ()->beam (slope_f, 20 PT, 1 PT);
48 Atom a (paper ()->lookup_l ()->beam (slope_f, w, .48 * interline_f));
49 a.translate (Offset (-w/2, w / 2 * slope_f));
51 Molecule *beams= new Molecule;
52 for (int i = 0; i < abbrev_flags_i_; i++)
55 b.translate_axis (dy * i, Y_AXIS);
58 beams->translate_axis (-beams->extent ()[Y_AXIS].center (), Y_AXIS);
62 /* Try to be in the middle of the open part of the stem and
67 Direction sd = stem_l_->dir_;
68 Interval empty_stem (stem_l_->chord_start_f () * sd ,
69 (stem_l_->stem_end_f ()* sd) - beams_i * dy);
72 Interval instaff = empty_stem;
73 instaff.intersect (interline_f * Interval (-2,2));
74 if (instaff.empty_b ())
78 beams->translate (Offset(stem_l_->hpos_f () - hpos_f (),
86 Abbreviation::do_substitute_dependent (Score_elem*o, Score_elem*n)
89 stem_l_ = n ? (Stem*)n->item () : 0;
94 Abbreviation::set_stem (Stem *s)