]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/span-bar-stub-engraver.cc
Doc-es: various updates.
[lilypond.git] / lily / span-bar-stub-engraver.cc
index 88d82b36c6dedbb32879eb67268e24893bce539e..914e73ed4b89ebecc735e1c531a53be3be8eaed1 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2011--2014 Mike Solomon <mike@mikesolomon.org>
+  Copyright (C) 2011--2015 Mike Solomon <mike@mikesolomon.org>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 #include "align-interface.hh"
 #include "context.hh"
 #include "grob.hh"
+#include "grob-properties.hh"
 #include "item.hh"
 #include "pointer-group-interface.hh"
 #include "engraver.hh"
 
+#include "translator.icc"
+
 /*
   The Span_bar_stub_engraver creates SpanBarStub grobs in the contexts
   that a grouping context contains.  For example, if a PianoStaff contains
@@ -52,14 +55,15 @@ class Span_bar_stub_engraver : public Engraver
 public:
   TRANSLATOR_DECLARATIONS (Span_bar_stub_engraver);
 protected:
-  DECLARE_ACKNOWLEDGER (span_bar);
-  DECLARE_ACKNOWLEDGER (hara_kiri_group_spanner);
+  void acknowledge_span_bar (Grob_info);
+  void acknowledge_hara_kiri_group_spanner (Grob_info);
   void process_acknowledged ();
   void stop_translation_timestep ();
   virtual void derived_mark () const;
 };
 
-Span_bar_stub_engraver::Span_bar_stub_engraver ()
+Span_bar_stub_engraver::Span_bar_stub_engraver (Context *c)
+  : Engraver (c)
 {
   axis_groups_ = SCM_EOL;
 }
@@ -93,7 +97,7 @@ Span_bar_stub_engraver::process_acknowledged ()
       programming_error ("At least one vertical axis group needs to be created in the first time step.");
       return;
     }
-  Grob *vertical_alignment = Grob::get_root_vertical_alignment (unsmob_grob (scm_caar (axis_groups_)));
+  Grob *vertical_alignment = Grob::get_root_vertical_alignment (unsmob<Grob> (scm_caar (axis_groups_)));
   if (!vertical_alignment) // we are at the beginning of a score, so no need for stubs
     return;
 
@@ -112,8 +116,8 @@ Span_bar_stub_engraver::process_acknowledged ()
       vector<bool> keep_extent;
       for (SCM s = axis_groups_; scm_is_pair (s); s = scm_cdr (s))
         {
-          Context *c = unsmob_context (scm_cdar (s));
-          Grob *g = unsmob_grob (scm_caar (s));
+          Context *c = unsmob<Context> (scm_cdar (s));
+          Grob *g = unsmob<Grob> (scm_caar (s));
           if (!c || !g)
             continue;
           if (c->is_removable ())
@@ -142,11 +146,10 @@ Span_bar_stub_engraver::process_acknowledged ()
 
       for (vsize j = 0; j < affected_contexts.size (); j++)
         {
-          Item *it = new Item (updated_grob_properties (affected_contexts[j], ly_symbol2scm ("SpanBarStub")));
+          Item *it = new Item (Grob_property_info (affected_contexts[j], ly_symbol2scm ("SpanBarStub")).updated ());
           it->set_parent (spanbars_[i], X_AXIS);
           Grob_info gi = make_grob_info (it, spanbars_[i]->self_scm ());
-          gi.rerouting_daddy_context_ = affected_contexts[j];
-          announce_grob (gi);
+          announce_grob (gi, affected_contexts[j]);
           if (!keep_extent[j])
             it->suicide ();
         }
@@ -162,8 +165,8 @@ Span_bar_stub_engraver::stop_translation_timestep ()
   SCM axis_groups = SCM_EOL;
   for (SCM s = axis_groups_; scm_is_pair (s); s = scm_cdr (s))
     {
-      Context *c = unsmob_context (scm_cdar (s));
-      Grob *g = unsmob_grob (scm_caar (s));
+      Context *c = unsmob<Context> (scm_cdar (s));
+      Grob *g = unsmob<Grob> (scm_caar (s));
       if (!c || !g)
         continue;
       if (c->is_removable ())
@@ -173,10 +176,13 @@ Span_bar_stub_engraver::stop_translation_timestep ()
   axis_groups_ = axis_groups;
 }
 
-#include "translator.icc"
+void
+Span_bar_stub_engraver::boot ()
+{
+  ADD_ACKNOWLEDGER (Span_bar_stub_engraver, span_bar);
+  ADD_ACKNOWLEDGER (Span_bar_stub_engraver, hara_kiri_group_spanner);
+}
 
-ADD_ACKNOWLEDGER (Span_bar_stub_engraver, span_bar);
-ADD_ACKNOWLEDGER (Span_bar_stub_engraver, hara_kiri_group_spanner);
 ADD_TRANSLATOR (Span_bar_stub_engraver,
                 /* doc */
                 "Make stubs for span bars in all contexts that the span bars cross.",