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"
18 Stem_tremolo::Stem_tremolo ()
25 Stem_tremolo::do_print () const
27 DOUT
<< "abbrev_flags_i_ " << abbrev_flags_i_
;
31 Stem_tremolo::do_width () const
33 Real space
= stem_l_
->staff_line_leading_f ();
34 return Interval (-space
, space
);
38 Stem_tremolo::do_pre_processing ()
43 Stem_tremolo::do_brew_molecule_p () const
46 if (Beam
* b
= stem_l_
->beam_l_
)
48 Stem_info i
= b
->get_stem_info (stem_l_
);
52 Real interbeam_f
= paper_l ()->interbeam_f (mult
);
53 Real w
= 1.5 * lookup_l ()->notehead (2, "").dim_
[X_AXIS
].length ();
54 Real space
= stem_l_
->staff_line_leading_f ();
55 Real internote_f
= space
/2;
57 Real beam_f
= paper_l ()->beam_thickness_f ();
60 Real slope_f
= internote_f
/ 4 / internote_f
; // HUH?
62 if (stem_l_
&& stem_l_
->beam_l_
) {
63 slope_f
= stem_l_
->beam_l_
->slope_f_
;
64 // ugh, rather calc from Stem_tremolo_req
65 beams_i
= stem_l_
->beams_i_drul_
[RIGHT
] >? stem_l_
->beams_i_drul_
[LEFT
];
67 Real sl
= slope_f
* internote_f
;
69 Molecule
a (lookup_l ()->beam (sl
, w
, beam_f
));
70 a
.translate (Offset (-w
/2, w
/ 2 * slope_f
));
72 Molecule
*beams
= new Molecule
;
73 for (int i
= 0; i
< abbrev_flags_i_
; i
++)
76 b
.translate_axis (interbeam_f
* i
, Y_AXIS
);
77 beams
->add_molecule (b
);
79 beams
->translate_axis (-beams
->extent ()[Y_AXIS
].center (), Y_AXIS
);
85 beams
->translate (Offset(stem_l_
->hpos_f () - hpos_f (),
86 stem_l_
->stem_end_f () * internote_f
-
87 stem_l_
->beam_l_
->dir_
* beams_i
* interbeam_f
));
92 Beams should intersect one beamthickness below staff end
94 Real dy
= - beams
->extent ()[Y_AXIS
].length () / 2 * stem_l_
->dir_
;
97 uhg. Should use relative coords and placement
99 Real whole_note_correction
= (stem_l_
&& stem_l_
->invisible_b( ))
100 ? -stem_l_
->get_dir () * stem_l_
->note_delta_f ()/2
104 UGH. Internote fudging.
107 dy
+= stem_l_
->stem_end_f ();
109 beams
->translate (Offset(stem_l_
->hpos_f () - hpos_f ()+
110 whole_note_correction
, dy
));
114 there used to be half a page of code that was long commented out.
123 Stem_tremolo::do_substitute_element_pointer (Score_element
*o
, Score_element
*n
)
126 stem_l_
= dynamic_cast<Stem
*> (n
);
131 Stem_tremolo::set_stem (Stem
*s
)