]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/cluster-engraver.cc
(DECLARE_BASE_SMOBS): add methods
[lilypond.git] / lily / cluster-engraver.cc
index 02c7613cbcb8f699fb656a31f5bf173fe1e0170e..51d262c00e1b8f8b50b4ff6f07152270998128ec 100644 (file)
@@ -10,7 +10,8 @@
 #include "spanner.hh"
 #include "note-head.hh"
 #include "note-column.hh"
-#include "group-interface.hh"
+#include "pointer-group-interface.hh"
+#include "pitch.hh"
 
 class Cluster_spanner_engraver : public Engraver
 {
@@ -18,9 +19,9 @@ class Cluster_spanner_engraver : public Engraver
 protected:
   TRANSLATOR_DECLARATIONS (Cluster_spanner_engraver);
   virtual bool try_music (Music *);
-  virtual void process_music ();
-  virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
+  DECLARE_ACKNOWLEDGER(note_column);
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void finalize ();
 private:
   Link_array<Music> cluster_notes_;
@@ -79,14 +80,14 @@ Cluster_spanner_engraver::process_music ()
       int pmax = INT_MIN;
       int pmin = INT_MAX;
 
-      for (int i = 0; i <cluster_notes_.size (); i++)
+      for (int i = 0; i < cluster_notes_.size (); i++)
        {
          Pitch *pit = unsmob_pitch (cluster_notes_[i]->get_property ("pitch"));
 
          int p = (pit ? pit->steps () : 0) + c0;
 
-         pmax = pmax >? p;
-         pmin = pmin <? p;
+         pmax = max (pmax, p);
+         pmin = min (pmin, p);
        }
 
       beacon_ = make_item ("ClusterSpannerBeacon", cluster_notes_[0]->self_scm ());
@@ -115,20 +116,22 @@ Cluster_spanner_engraver::stop_translation_timestep ()
 }
 
 void
-Cluster_spanner_engraver::acknowledge_grob (Grob_info info)
+Cluster_spanner_engraver::acknowledge_note_column (Grob_info info)
 {
-  if (!beacon_ && Note_column::has_interface (info.grob_))
+  if (!beacon_ && Note_column::has_interface (info.grob ()))
     {
       finished_spanner_ = spanner_;
       spanner_ = 0;
     }
 }
 
+#include "translator.icc"
+
+ADD_ACKNOWLEDGER(Cluster_spanner_engraver, note_column);
 ADD_TRANSLATOR (Cluster_spanner_engraver,
                /* descr */     "Engraves a cluster using Spanner notation ",
                /* creats*/     "ClusterSpanner ClusterSpannerBeacon",
                /* accepts */   "cluster-note-event busy-playing-event",
-               /* acks  */     "note-column-interface",
                /* reads */     "",
                /* write */     "");