]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/mensural-ligature-engraver.cc
Issue 4865/2: Rewrite of new translator initializations
[lilypond.git] / lily / mensural-ligature-engraver.cc
index 8f70fa4e487a0a84d1b0d436e0d8e77851269409..b6a83f7d3efc471c0cb9163344a8467c7affd40d 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2002--2012 Juergen Reuter <reuter@ipd.uka.de>,
+  Copyright (C) 2002--2015 Juergen Reuter <reuter@ipd.uka.de>,
   Pal Benko <benkop@freestart.hu>
 
   LilyPond is free software: you can redistribute it and/or modify
@@ -63,6 +63,7 @@ protected:
 
 public:
   TRANSLATOR_DECLARATIONS (Mensural_ligature_engraver);
+  TRANSLATOR_INHERIT (Coherent_ligature_engraver);
 
 private:
   void transform_heads (vector<Grob_info> const &primitives);
@@ -73,7 +74,6 @@ private:
                            Real &min_length);
 };
 
-IMPLEMENT_TRANSLATOR_LISTENER (Mensural_ligature_engraver, ligature);
 void
 Mensural_ligature_engraver::listen_ligature (Stream_event *ev)
 {
@@ -129,7 +129,7 @@ Mensural_ligature_engraver::transform_heads (vector<Grob_info> const &primitives
           continue;
         }
 
-      int pitch = unsmob_pitch (nr->get_property ("pitch"))->steps ();
+      int pitch = unsmob<Pitch> (nr->get_property ("pitch"))->steps ();
       int prim = 0;
 
       if (at_beginning)
@@ -182,7 +182,7 @@ Mensural_ligature_engraver::transform_heads (vector<Grob_info> const &primitives
             }
           // b. descendens longa or brevis
           else if (i < s - 1
-                   && (unsmob_pitch (primitives[i + 1].event_cause ()
+                   && (unsmob<Pitch> (primitives[i + 1].event_cause ()
                                      ->get_property ("pitch"))->steps () < pitch)
                    && duration_log > -3)
             {
@@ -275,7 +275,7 @@ Mensural_ligature_engraver::transform_heads (vector<Grob_info> const &primitives
                   /*
                     breve: check whether descending
                   */
-                  int const next_pitch = unsmob_pitch
+                  int const next_pitch = unsmob<Pitch>
                                          (next_info.event_cause ()->get_property ("pitch"))->steps ();
                   if (next_pitch < pitch)
                     /*
@@ -495,8 +495,14 @@ Mensural_ligature_engraver::build_ligature (Spanner *ligature,
     ligature->set_property ("minimum-length", scm_from_double (min_length));
 }
 
-ADD_ACKNOWLEDGER (Mensural_ligature_engraver, rest);
-ADD_ACKNOWLEDGER (Mensural_ligature_engraver, ligature_head);
+
+void
+Mensural_ligature_engraver::boot ()
+{
+  ADD_LISTENER (Mensural_ligature_engraver, ligature);
+  ADD_ACKNOWLEDGER (Mensural_ligature_engraver, rest);
+  ADD_ACKNOWLEDGER (Mensural_ligature_engraver, ligature_head);
+}
 
 ADD_TRANSLATOR (Mensural_ligature_engraver,
                 /* doc */