2 figured-bass-position-engraver.cc -- implement Figured_bass_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "engraver.hh"
15 #include "side-position-interface.hh"
16 #include "translator.icc"
17 #include "axis-group-interface.hh"
19 class Figured_bass_position_engraver : public Engraver
21 TRANSLATOR_DECLARATIONS (Figured_bass_position_engraver);
23 Spanner *bass_figure_alignment_;
25 vector<Grob*> support_;
26 vector<Grob*> span_support_;
28 DECLARE_ACKNOWLEDGER (note_column);
29 DECLARE_ACKNOWLEDGER (slur);
30 DECLARE_END_ACKNOWLEDGER (slur);
31 DECLARE_ACKNOWLEDGER (tie);
32 DECLARE_ACKNOWLEDGER (bass_figure_alignment);
33 DECLARE_END_ACKNOWLEDGER (bass_figure_alignment);
35 virtual void finalize ();
36 void start_spanner ();
38 void stop_translation_timestep ();
41 Figured_bass_position_engraver::Figured_bass_position_engraver ()
44 bass_figure_alignment_ = 0;
48 Figured_bass_position_engraver::start_spanner ()
50 assert (!positioner_);
52 positioner_ = make_spanner ("BassFigureAlignmentPositioning", bass_figure_alignment_->self_scm ());
53 positioner_->set_bound (LEFT, bass_figure_alignment_->get_bound (LEFT));
54 Axis_group_interface::add_element (positioner_, bass_figure_alignment_);
58 Figured_bass_position_engraver::stop_spanner ()
60 if (positioner_ && !positioner_->get_bound (RIGHT))
62 positioner_->set_bound (RIGHT, bass_figure_alignment_->get_bound (RIGHT));
66 bass_figure_alignment_ = 0;
70 Figured_bass_position_engraver::finalize ()
76 Figured_bass_position_engraver::acknowledge_note_column (Grob_info info)
78 support_.push_back (info.grob ());
82 Figured_bass_position_engraver::acknowledge_end_slur (Grob_info info)
84 vector<Grob*>::iterator i = find (span_support_.begin (), span_support_.end (),
87 if (i < span_support_.end ())
88 span_support_.erase (i);
92 Figured_bass_position_engraver::acknowledge_slur (Grob_info info)
94 span_support_.push_back (info.grob ());
98 Figured_bass_position_engraver::acknowledge_tie (Grob_info info)
100 support_.push_back (info.grob ());
104 Figured_bass_position_engraver::stop_translation_timestep ()
108 for (vsize i = 0; i < span_support_.size (); i++)
109 Side_position_interface::add_support (positioner_, span_support_[i]);
110 for (vsize i = 0; i < support_.size (); i++)
111 Side_position_interface::add_support (positioner_, support_[i]);
118 Figured_bass_position_engraver::acknowledge_end_bass_figure_alignment (Grob_info /* info */)
124 Figured_bass_position_engraver::acknowledge_bass_figure_alignment (Grob_info info)
126 bass_figure_alignment_ = dynamic_cast<Spanner*> (info.grob ());
131 ADD_ACKNOWLEDGER (Figured_bass_position_engraver, note_column);
132 ADD_ACKNOWLEDGER (Figured_bass_position_engraver, slur);
133 ADD_END_ACKNOWLEDGER (Figured_bass_position_engraver, slur);
135 ADD_ACKNOWLEDGER (Figured_bass_position_engraver, tie);
136 ADD_ACKNOWLEDGER (Figured_bass_position_engraver, bass_figure_alignment);
137 ADD_END_ACKNOWLEDGER (Figured_bass_position_engraver, bass_figure_alignment);
139 ADD_TRANSLATOR (Figured_bass_position_engraver,
141 "Position figured bass alignments over notes.",
144 "BassFigureAlignmentPositioning ",