/*
This file is part of LilyPond, the GNU music typesetter.
- Copyright (C) 2006--2014 Joe Neeman <joeneeman@gmail.com>
+ Copyright (C) 2006--2015 Joe Neeman <joeneeman@gmail.com>
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
if (duration_[LEFT] < penalty.duration_[LEFT])
ret.push_back (Page_turn_event (duration_[LEFT], penalty.duration_[LEFT], permission_, penalty_));
- if (penalty.permission_ != SCM_EOL)
+ if (!scm_is_null (penalty.permission_))
ret.push_back (Page_turn_event (intersect[LEFT], intersect[RIGHT], permission_, new_pen));
if (penalty.duration_[RIGHT] < duration_[RIGHT])
Grob *breakable_column (Page_turn_event const &);
protected:
- DECLARE_TRANSLATOR_LISTENER (break);
- DECLARE_ACKNOWLEDGER (note_head);
+ void listen_break (Stream_event *);
+ void acknowledge_note_head (Grob_info);
public:
TRANSLATOR_DECLARATIONS (Page_turn_engraver);
void finalize ();
};
-Page_turn_engraver::Page_turn_engraver ()
+Page_turn_engraver::Page_turn_engraver (Context *c)
+ : Engraver (c)
{
repeat_begin_ = Moment (-1);
repeat_begin_rest_length_ = 0;
Stream_event *cause = gi.event_cause ();
Duration *dur_ptr = cause
- ? Duration::unsmob (cause->get_property ("duration"))
+ ? unsmob<Duration> (cause->get_property ("duration"))
: 0;
if (!dur_ptr)
note_end_ = now_mom () + dur_ptr->get_length ();
}
-IMPLEMENT_TRANSLATOR_LISTENER (Page_turn_engraver, break);
void
Page_turn_engraver::listen_break (Stream_event *ev)
{
void
Page_turn_engraver::stop_translation_timestep ()
{
- Grob *pc = Grob::unsmob (get_property ("currentCommandColumn"));
+ Grob *pc = unsmob<Grob> (get_property ("currentCommandColumn"));
if (pc)
{
for (; scm_is_pair (cs); cs = scm_cdr (cs))
{
SCM command = scm_car (cs);
- if (command == ly_symbol2scm ("start-repeat"))
+ if (scm_is_eq (command, ly_symbol2scm ("start-repeat")))
start = true;
- else if (command == ly_symbol2scm ("end-repeat"))
+ else if (scm_is_eq (command, ly_symbol2scm ("end-repeat")))
end = true;
}
{
Rational now = now_mom ().main_part_;
Real pen = penalty ((now_mom () - rest_begin_).main_part_ + repeat_begin_rest_length_);
- Moment *m = Moment::unsmob (get_property ("minimumRepeatLengthForPageTurn"));
+ Moment *m = unsmob<Moment> (get_property ("minimumRepeatLengthForPageTurn"));
if (m && *m > (now_mom () - repeat_begin_))
pen = infinity_f;
SCM
Page_turn_engraver::max_permission (SCM perm1, SCM perm2)
{
- if (perm1 == SCM_EOL)
+ if (scm_is_null (perm1))
return perm2;
- if (perm1 == ly_symbol2scm ("allow") && perm2 == ly_symbol2scm ("force"))
+ if (scm_is_eq (perm1, ly_symbol2scm ("allow"))
+ && scm_is_eq (perm2, ly_symbol2scm ("force")))
return perm2;
return perm1;
}
}
}
-ADD_ACKNOWLEDGER (Page_turn_engraver, note_head);
+
+void
+Page_turn_engraver::boot ()
+{
+ ADD_LISTENER (Page_turn_engraver, break);
+ ADD_ACKNOWLEDGER (Page_turn_engraver, note_head);
+}
ADD_TRANSLATOR (Page_turn_engraver,
/* doc */