X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fstaff-symbol-engraver.cc;h=55e118245f2c793ac5b2ff92e995595e639d586e;hb=e90f0536f9be39ada0bef0aeb0d275dec3b2fb5b;hp=5d5acd9a4285addc9213e70fe4b9d63c98d1394c;hpb=2eb63c6977706ba261e4ee0674c734a34b3ee904;p=lilypond.git diff --git a/lily/staff-symbol-engraver.cc b/lily/staff-symbol-engraver.cc index 5d5acd9a42..55e118245f 100644 --- a/lily/staff-symbol-engraver.cc +++ b/lily/staff-symbol-engraver.cc @@ -1,9 +1,20 @@ /* - staff-symbol-engraver.cc -- implement Staff_symbol_engraver + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 1997--2011 Han-Wen Nienhuys - (c) 1997--2007 Han-Wen Nienhuys + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include "engraver.hh" @@ -39,7 +50,11 @@ protected: Staff_symbol_engraver::~Staff_symbol_engraver () { - assert (!span_); + if (span_) + { + // Somehow finalize() was not called? + programming_error ("Have a pending spanner in destructor."); + } } Staff_symbol_engraver::Staff_symbol_engraver () @@ -47,8 +62,7 @@ Staff_symbol_engraver::Staff_symbol_engraver () finished_span_ = 0; first_start_ = true; span_ = 0; - span_events_[LEFT] = 0; - span_events_[RIGHT] = 0; + span_events_.set (0, 0); } IMPLEMENT_TRANSLATOR_LISTENER (Staff_symbol_engraver, staff_span); @@ -59,7 +73,7 @@ Staff_symbol_engraver::listen_staff_span (Stream_event *ev) if (d) ASSIGN_EVENT_ONCE (span_events_[d], ev); else - programming_error (_ ("staff-span event has no direction")); + programming_error ("staff-span event has no direction"); } void @@ -97,12 +111,12 @@ Staff_symbol_engraver::stop_spanner () if (!finished_span_->get_bound (RIGHT)) finished_span_->set_bound (RIGHT, unsmob_grob (get_property ("currentCommandColumn"))); - + announce_end_grob (finished_span_, span_events_[STOP] ? span_events_[STOP]->self_scm () : SCM_EOL); - + finished_span_ = 0; } @@ -111,12 +125,9 @@ Staff_symbol_engraver::stop_translation_timestep () { if ((span_events_[START] || first_start_) && span_) - { - first_start_ = false; - } + first_start_ = false; - span_events_[START] = 0; - span_events_[STOP] = 0; + span_events_.set (0, 0); stop_spanner (); } @@ -134,10 +145,6 @@ Staff_symbol_engraver::finalize () void Staff_symbol_engraver::acknowledge_grob (Grob_info s) { - /* - Perhaps should try to take SeparationItem as bound of the staff - symbol? - */ if (span_ || finished_span_) { Spanner *my = span_ ? span_ : finished_span_;