X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fforbid-break-engraver.cc;h=9cfdef24c82566634160bc4d22ba655e2be1e9e2;hb=3cdc909d8cea64c8faef90d3a6a391f32a424ba2;hp=a7bf47b2df2924dc84165092c3b2df49ce91f6be;hpb=947454c5cc430a9627262de4f25274a64789d3c2;p=lilypond.git diff --git a/lily/forbid-break-engraver.cc b/lily/forbid-break-engraver.cc index a7bf47b2df..9cfdef24c8 100644 --- a/lily/forbid-break-engraver.cc +++ b/lily/forbid-break-engraver.cc @@ -1,46 +1,80 @@ -#include "rhythmic-head.hh" +/* + This file is part of LilyPond, the GNU music typesetter. + + Copyright (C) 2002--_2005 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 "context.hh" +#include "duration.hh" #include "engraver.hh" #include "grob.hh" -#include "score-engraver.hh" +#include "input.hh" +#include "pitch.hh" +#include "rhythmic-head.hh" + +#include "translator.icc" class Forbid_line_break_engraver : public Engraver { public: TRANSLATOR_DECLARATIONS (Forbid_line_break_engraver); - virtual void start_translation_timestep (); + void start_translation_timestep (); }; -Forbid_line_break_engraver::Forbid_line_break_engraver (){} +Forbid_line_break_engraver::Forbid_line_break_engraver () +{ +} void Forbid_line_break_engraver::start_translation_timestep () { /* Check for running note heads. This should probably be done elsewhere. - */ + */ SCM busy = get_property ("busyGrobs"); Moment now = now_mom (); - while (gh_pair_p (busy) && unsmob_moment (gh_caar (busy))->main_part_ == now.main_part_) - busy = gh_cdr (busy); + while (scm_is_pair (busy) && unsmob (scm_caar (busy))->main_part_ == now.main_part_) + busy = scm_cdr (busy); - - while (gh_pair_p (busy)) + while (scm_is_pair (busy)) { - Grob *g = unsmob_grob (gh_cdar (busy)); - if (Rhythmic_head::has_interface (g)) - { - get_score_engraver ()->forbid_breaks (); - } - busy = gh_cdr (busy); + Grob *g = unsmob (scm_cdar (busy)); + if (g->internal_has_interface (ly_symbol2scm ("rhythmic-grob-interface"))) + context ()->get_score_context ()->set_property ("forbidBreak", SCM_BOOL_T); + busy = scm_cdr (busy); } } +void +Forbid_line_break_engraver::boot () +{ + +} + +ADD_TRANSLATOR (Forbid_line_break_engraver, + /* doc */ + "Forbid line breaks when note heads are still playing at some" + " point.", + + /* create */ + "", + + /* read */ + "busyGrobs ", -ENTER_DESCRIPTION (Forbid_line_break_engraver, -/* descr */ "Forbid line breaks when note heads are still playing at some point.", -/* creats*/ "", -/* accepts */ "", -/* acks */ "", -/* reads */ "busyGrobs", -/* write */ ""); + /* write */ + "forbidBreak " + );