2 abbrev.cc -- implement Abbreviation
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 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 ();
34 Real w
= 1.5 * paper ()->lookup_l ()->ball (2).dim_
.x ().length ();
35 Real interline_f
= paper ()->interline_f ();
36 Real beamdy
= interline_f
/2;
39 Real slope_f
= paper ()->internote_f () / 4;
41 if (stem_l_
&& stem_l_
->beam_l_
) {
43 slope_f
= 2 * stem_l_
->beam_l_
->slope_f_
;
44 // ugh, rather calc from Abbreviation_req
45 beams_i
= stem_l_
->beams_right_i_
>? stem_l_
->beams_left_i_
;
47 paper ()->lookup_l ()->beam (slope_f
, 20 PT
, 1 PT
);
49 Atom
a (paper ()->lookup_l ()->beam (slope_f
, w
, .48 * interline_f
));
50 a
.translate (Offset (-w
/2, w
/ 2 * slope_f
));
52 Molecule
*beams
= new Molecule
;
53 for (int i
= 0; i
< abbrev_flags_i_
; i
++)
56 b
.translate_axis (dy
* i
, Y_AXIS
);
59 beams
->translate_axis (-beams
->extent ()[Y_AXIS
].center (), Y_AXIS
);
63 /* Try to be in the middle of the open part of the stem and
68 Direction sd
= stem_l_
->dir_
;
69 Interval
empty_stem (stem_l_
->chord_start_f () * sd
,
70 (stem_l_
->stem_end_f ()* sd
) - beams_i
* dy
);
73 Interval instaff
= empty_stem
;
74 instaff
.intersect (interline_f
* Interval (-2,2));
75 if (instaff
.empty_b ())
79 beams
->translate (Offset(stem_l_
->hpos_f () - hpos_f (),
87 Abbreviation::do_substitute_dependent (Score_elem
*o
, Score_elem
*n
)
90 stem_l_
= n
? (Stem
*)n
->item () : 0;
95 Abbreviation::set_stem (Stem
*s
)