]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/page-turn-engraver.cc
Issue 4630/2: Add override_input to music created from loc_on_music
[lilypond.git] / lily / page-turn-engraver.cc
index 22d26371a0e3c2e6d2afc38e027f5264c48a9c8c..874ebe7e7e56ce62791f5d2281e5270f8a609e72 100644 (file)
@@ -29,6 +29,9 @@
 
 #include "translator.icc"
 
+using std::string;
+using std::vector;
+
 class Page_turn_event
 {
 public:
@@ -61,12 +64,12 @@ public:
         return ret;
       }
 
-    Real new_pen = max (penalty_, penalty.penalty_);
+    Real new_pen = std::max (penalty_, penalty.penalty_);
 
     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])
@@ -118,8 +121,8 @@ Page_turn_engraver::Page_turn_engraver ()
 Grob *
 Page_turn_engraver::breakable_column (Page_turn_event const &brk)
 {
-  vsize start = lower_bound (breakable_moments_, brk.duration_[LEFT], less<Rational> ());
-  vsize end = upper_bound (breakable_moments_, brk.duration_[RIGHT], less<Rational> ());
+  vsize start = lower_bound (breakable_moments_, brk.duration_[LEFT], std::less<Rational> ());
+  vsize end = upper_bound (breakable_moments_, brk.duration_[RIGHT], std::less<Rational> ());
 
   if (start == breakable_moments_.size ())
     return NULL;
@@ -148,7 +151,7 @@ Page_turn_engraver::acknowledge_note_head (Grob_info gi)
   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)
@@ -208,7 +211,7 @@ Page_turn_engraver::start_translation_timestep ()
 void
 Page_turn_engraver::stop_translation_timestep ()
 {
-  Grob *pc = Grob::unsmob (get_property ("currentCommandColumn"));
+  Grob *pc = unsmob<Grob> (get_property ("currentCommandColumn"));
 
   if (pc)
     {
@@ -229,9 +232,9 @@ Page_turn_engraver::stop_translation_timestep ()
   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;
     }
 
@@ -239,7 +242,7 @@ Page_turn_engraver::stop_translation_timestep ()
     {
       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;
 
@@ -265,9 +268,10 @@ Page_turn_engraver::stop_translation_timestep ()
 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;
 }
@@ -319,7 +323,7 @@ Page_turn_engraver::finalize ()
       if (pc)
         {
           SCM perm = max_permission (pc->get_property ("page-turn-permission"), brk.permission_);
-          Real pen = min (robust_scm2double (pc->get_property ("page-turn-penalty"), infinity_f), brk.penalty_);
+          Real pen = std::min (robust_scm2double (pc->get_property ("page-turn-penalty"), infinity_f), brk.penalty_);
           pc->set_property ("page-turn-permission", perm);
           pc->set_property ("page-turn-penalty", scm_from_double (pen));
         }