2 stem-grav.cc -- implement Stem_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "stem-grav.hh"
10 #include "note-head.hh"
12 #include "musical-request.hh"
13 #include "duration-convert.hh"
17 Stem_engraver::Stem_engraver()
22 default_abbrev_i_
= 16;
27 Stem_engraver::do_creation_processing ()
29 Scalar prop
= get_property ("abbrev");
32 default_abbrev_i_
= prop
;
37 Stem_engraver::acknowledge_element(Score_elem_info i
)
39 if (i
.elem_l_
->is_type_b (Rhythmic_head::static_name()))
41 Rhythmic_head
*h
= (Rhythmic_head
*) i
.elem_l_
->item();
44 Rhythmic_req
* r
= i
.req_l_
->musical()->rhythmic();
46 int durlog_i
= r
->duration_
.durlog_i_
;
47 stem_p_
->flag_i_
= durlog_i
;
52 int t
= abbrev_req_l_
->type_i_
;
54 t
= default_abbrev_i_
;
56 default_abbrev_i_
= t
;
58 abbrev_p_
= new Abbreviation
;
59 announce_element (Score_elem_info (abbrev_p_
, abbrev_req_l_
));
60 abbrev_p_
->abbrev_flags_i_
=intlog2 (t
) - (durlog_i
>? 2);
62 announce_element (Score_elem_info (stem_p_
, r
));
69 Stem_engraver::do_pre_move_processing()
73 abbrev_p_
->set_stem (stem_p_
);
74 typeset_element (abbrev_p_
);
79 Scalar prop
= get_property ("ydirection");
80 dir_
= prop
.isnum_b () ? (Direction
)int(prop
) : CENTER
;
84 stem_p_
->dir_forced_b_
= true;
87 typeset_element(stem_p_
);
94 Stem_engraver::do_try_request (Request
* r
)
96 Musical_req
* mus_l
= r
->musical ();
100 Abbreviation_req
* a
= mus_l
->abbrev ();
109 IMPLEMENT_IS_TYPE_B1(Stem_engraver
, Engraver
);
110 ADD_THIS_TRANSLATOR(Stem_engraver
);