X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fforbid-break-engraver.cc;h=64dedf735815329db94c45e35dadf6cc19a415e7;hb=931465a3c93bd73bdabfcaccb71c37f4b4e5b814;hp=b2a5d802c5dae18b20415c297c540e10dd82b2bc;hpb=f12ef1c68506b5d8a9ae4d8b5d894109ce8fe17a;p=lilypond.git diff --git a/lily/forbid-break-engraver.cc b/lily/forbid-break-engraver.cc index b2a5d802c5..64dedf7358 100644 --- a/lily/forbid-break-engraver.cc +++ b/lily/forbid-break-engraver.cc @@ -1,46 +1,56 @@ -#include "rhythmic-head.hh" +/* + forbid-break-engraver.cc -- implement Forbid_line_break_engraver + + source file of the GNU LilyPond music typesetter + + (c) 2002--_2005 Han-Wen Nienhuys +*/ +#include "context.hh" +#include "duration.hh" #include "engraver.hh" #include "grob.hh" -#include "score-engraver.hh" +#include "input.hh" +#include "moment.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 (); + TRANSLATOR_DECLARATIONS (Forbid_line_break_engraver); + 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() +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); + Moment now = now_mom (); + while (scm_is_pair (busy) && unsmob_moment (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_grob (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); } } - -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 */ ""); +ADD_TRANSLATOR (Forbid_line_break_engraver, + /* doc */ "Forbid line breaks when note heads " + "are still playing at some point.", + /* create */ "", + /* read */ "busyGrobs", + /* write */ "forbidBreak");