+ new_event_found_ = true;
+
+ /*
+ No ASSIGN_EVENT_ONCE () ; otherwise we get warnings about
+ polyphonic rests.
+ */
+ rest_event_ = ev;
+ }
+}
+
+IMPLEMENT_TRANSLATOR_LISTENER (Figured_bass_engraver, bass_figure);
+void
+Figured_bass_engraver::listen_bass_figure (Stream_event *ev)
+{
+ new_event_found_ = true;
+ Moment stop = now_mom () + get_event_length (ev, now_mom ());
+ stop_moment_ = max (stop_moment_, stop);
+
+ if (to_boolean (get_property ("useBassFigureExtenders")))
+ {
+ SCM fig = ev->get_property ("figure");
+ for (vsize i = 0; i < groups_.size (); i++)
+ {
+ if (!groups_[i].current_event_
+ && ly_is_equal (groups_[i].number_, fig))
+ {
+ groups_[i].current_event_ = ev;
+ groups_[i].force_no_continuation_
+ = to_boolean (ev->get_property ("no-continuation"));
+ continuation_ = true;
+ return;
+ }
+ }
+ }
+ new_events_.push_back (ev);
+}
+
+void
+Figured_bass_engraver::center_continuations (vector<Spanner*> const &consecutive_lines)
+{
+ if (consecutive_lines.size () == 2)
+ {
+ vector<Grob*> left_figs;
+ for (vsize j = consecutive_lines.size (); j--;)
+ left_figs.push_back (consecutive_lines[j]->get_bound (LEFT));
+
+ SCM ga = Grob_array::make_array ();
+ unsmob_grob_array (ga)->set_array (left_figs);
+
+ for (vsize j = consecutive_lines.size (); j--;)
+ consecutive_lines[j]->set_object ("figures",
+ unsmob_grob_array (ga)->smobbed_copy ());
+ }
+}
+
+void
+Figured_bass_engraver::center_repeated_continuations ()
+{
+ vector<Spanner*> consecutive_lines;
+ for (vsize i = 0; i <= groups_.size (); i++)
+ {
+ if (i < groups_.size ()
+ && groups_[i].continuation_line_
+ && (consecutive_lines.empty ()
+ || (consecutive_lines[0]->get_bound (LEFT)->get_column ()
+ == groups_[i].continuation_line_->get_bound (LEFT)->get_column ()
+ && consecutive_lines[0]->get_bound (RIGHT)->get_column ()
+ == groups_[i].continuation_line_->get_bound (RIGHT)->get_column ())))
+ consecutive_lines.push_back (groups_[i].continuation_line_);
+ else
+ {
+ center_continuations (consecutive_lines);
+ consecutive_lines.clear ();
+ }
+ }
+}
+
+void
+Figured_bass_engraver::clear_spanners ()
+{
+ if (!alignment_)
+ return;
+
+ if (alignment_)
+ {
+ announce_end_grob (alignment_, SCM_EOL);
+ alignment_ = 0;
+ }
+
+ if (to_boolean (get_property ("figuredBassCenterContinuations")))
+ center_repeated_continuations ();
+
+ for (vsize i = 0; i < groups_.size (); i++)
+ {
+ if (groups_[i].group_)
+ {
+ announce_end_grob (groups_[i].group_ , SCM_EOL);
+ groups_[i].group_ = 0;
+ }
+
+ if (groups_[i].continuation_line_)
+ {
+ announce_end_grob (groups_[i].continuation_line_ , SCM_EOL);
+ groups_[i].continuation_line_ = 0;
+ }