2 chord-name-engraver.cc -- implement Chord_name_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--1999 Jan Nieuwenhuizen <janneke@gnu.org>
9 #include "chord-name-engraver.hh"
11 #include "musical-request.hh"
12 #include "paper-def.hh"
14 #include "paper-def.hh"
16 #include "dimensions.hh"
17 #include "text-item.hh"
19 ADD_THIS_TRANSLATOR (Chord_name_engraver
);
21 Chord_name_engraver::Chord_name_engraver ()
30 Chord_name_engraver::acknowledge_element (Score_element_info i
)
32 if (Note_req
* n
= dynamic_cast<Note_req
*> (i
.req_l_
))
33 pitch_arr_
.push (n
->pitch_
);
37 Chord_name_engraver::do_try_music (Music
* m
)
39 if (Note_req
* n
= dynamic_cast<Note_req
*> (m
))
41 pitch_arr_
.push (n
->pitch_
);
44 if (Tonic_req
* t
= dynamic_cast<Tonic_req
*> (m
))
49 if (Inversion_req
* i
= dynamic_cast<Inversion_req
*> (m
))
54 if (Bass_req
* b
= dynamic_cast<Bass_req
*> (m
))
63 Chord_name_engraver::do_process_requests ()
67 if (!pitch_arr_
.size ())
70 bool find_inversion_b
= false;
71 SCM chord_inversion
= get_property ("chordInversion", 0);
72 if (gh_boolean_p (chord_inversion
))
73 find_inversion_b
= gh_scm2bool (chord_inversion
);
75 chord_p_
= new Chord (to_chord (pitch_arr_
, tonic_req_
, inversion_req_
, bass_req_
, find_inversion_b
));
77 announce_element (Score_element_info (chord_p_
, 0));
81 Chord_name_engraver::do_pre_move_processing ()
85 typeset_element (chord_p_
);