2 abbreviation-beam-engraver.cc -- implement Abbreviation_beam_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 Jan Nieuwenhuizen <jan@digicash.com>
10 #include "duration-convert.hh"
11 #include "time-description.hh"
12 #include "abbreviation-beam-engraver.hh"
14 #include "abbreviation-beam.hh"
15 #include "musical-request.hh"
18 IMPLEMENT_IS_TYPE_B1(Abbreviation_beam_engraver
, Engraver
);
19 ADD_THIS_TRANSLATOR(Abbreviation_beam_engraver
);
21 Abbreviation_beam_engraver::Abbreviation_beam_engraver ()
23 span_reqs_drul_
[LEFT
] = span_reqs_drul_
[RIGHT
] = 0;
28 Abbreviation_beam_engraver::do_try_request (Request
*r
)
30 Musical_req
* mus_l
= r
->musical ();
34 Abbreviation_beam_req
* b
= mus_l
->abbrev_beam ();
39 if (bool (abeam_p_
) == bool (b
->spantype
== Span_req::START
))
42 Direction d
= (!abeam_p_
) ? LEFT
: RIGHT
;
43 if (span_reqs_drul_
[d
] && !span_reqs_drul_
[d
]->equal_b (mus_l
))
46 span_reqs_drul_
[d
] = b
;
51 Abbreviation_beam_engraver::do_process_requests ()
53 if (!abeam_p_
&& span_reqs_drul_
[LEFT
]) {
54 abeam_p_
= new Abbreviation_beam
;
55 announce_element (Score_elem_info (abeam_p_
, span_reqs_drul_
[LEFT
]));
60 Abbreviation_beam_engraver::do_pre_move_processing ()
62 if (abeam_p_
&& span_reqs_drul_
[RIGHT
]) {
63 typeset_element (abeam_p_
);
66 span_reqs_drul_
[RIGHT
] =
67 span_reqs_drul_
[LEFT
] = 0;
72 Abbreviation_beam_engraver::do_removal_processing ()
76 span_reqs_drul_
[LEFT
]->warning (_("unterminated beam"));
77 typeset_element (abeam_p_
);
83 Abbreviation_beam_engraver::acknowledge_element (Score_elem_info i
)
85 if (!abeam_p_
|| !i
.elem_l_
->is_type_b (Stem::static_name ()))
88 Stem
* s
= (Stem
*)i
.elem_l_
->item ();
90 int type_i
= span_reqs_drul_
[LEFT
]->type_i_
;
91 s
->flag_i_
= intlog2 (type_i
) - 2;
92 if (span_reqs_drul_
[RIGHT
])
93 s
->beams_left_i_
= s
->flag_i_
;
95 s
->beams_right_i_
= s
->flag_i_
;
97 if (s
->type_i () != 1) // no abbrev gaps on half note
98 s
->beam_gap_i_
= s
->flag_i_
- ((s
->type_i () >? 2) - 2);