]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/vertical-align-engraver.cc
Imported Upstream version 2.19.45
[lilypond.git] / lily / vertical-align-engraver.cc
index 65cf6e7f772d7af5086ccbe6bfab11a94664a1d7..0226173a2e115ec81d153212a5c3317cee6755c2 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1997--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1997--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -37,7 +37,7 @@ class Vertical_align_engraver : public Engraver
 
 public:
   TRANSLATOR_DECLARATIONS (Vertical_align_engraver);
-  DECLARE_ACKNOWLEDGER (axis_group);
+  void acknowledge_axis_group (Grob_info);
 
 protected:
   virtual void derived_mark () const;
@@ -48,7 +48,12 @@ protected:
   bool top_level_;
 };
 
-ADD_ACKNOWLEDGER (Vertical_align_engraver, axis_group);
+void
+Vertical_align_engraver::boot ()
+{
+  ADD_ACKNOWLEDGER (Vertical_align_engraver, axis_group);
+}
+
 ADD_TRANSLATOR (Vertical_align_engraver,
                 /* doc */
                 "Catch groups (staves, lyrics lines, etc.) and stack them"
@@ -100,7 +105,7 @@ Vertical_align_engraver::process_music ()
       top_level_ = to_boolean (get_property ("topLevelAlignment"));
 
       valign_ = make_spanner (top_level_ ? "VerticalAlignment" : "StaffGrouper", SCM_EOL);
-      valign_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
+      valign_->set_bound (LEFT, unsmob<Grob> (get_property ("currentCommandColumn")));
       Align_interface::set_ordered (valign_);
     }
 }
@@ -110,7 +115,7 @@ Vertical_align_engraver::finalize ()
 {
   if (valign_)
     {
-      valign_->set_bound (RIGHT, unsmob_grob (get_property ("currentCommandColumn")));
+      valign_->set_bound (RIGHT, unsmob<Grob> (get_property ("currentCommandColumn")));
       valign_ = 0;
     }
 }
@@ -120,7 +125,7 @@ Vertical_align_engraver::qualifies (Grob_info i) const
 {
   int sz = i.origin_contexts ((Translator *)this).size ();
 
-  return sz > 0 && Axis_group_interface::has_interface (i.grob ())
+  return sz > 0 && has_interface<Axis_group_interface> (i.grob ())
          && !i.grob ()->get_parent (Y_AXIS)
          && !to_boolean (i.grob ()->get_property ("no-alignment"))
          && Axis_group_interface::has_axis (i.grob (), Y_AXIS);
@@ -145,14 +150,14 @@ Vertical_align_engraver::acknowledge_axis_group (Grob_info i)
       SCM before = scm_hash_ref (id_to_group_hashtab_, before_id, SCM_BOOL_F);
       SCM after = scm_hash_ref (id_to_group_hashtab_, after_id, SCM_BOOL_F);
 
-      Grob *before_grob = unsmob_grob (before);
-      Grob *after_grob = unsmob_grob (after);
+      Grob *before_grob = unsmob<Grob> (before);
+      Grob *after_grob = unsmob<Grob> (after);
 
       Align_interface::add_element (valign_, i.grob ());
 
       if (before_grob || after_grob)
         {
-          Grob_array *ga = unsmob_grob_array (valign_->get_object ("elements"));
+          Grob_array *ga = unsmob<Grob_array> (valign_->get_object ("elements"));
           vector<Grob *> &arr = ga->array_reference ();
 
           Grob *added = arr.back ();
@@ -182,7 +187,7 @@ Vertical_align_engraver::acknowledge_axis_group (Grob_info i)
   else if (qualifies (i))
     {
       Pointer_group_interface::add_grob (valign_, ly_symbol2scm ("elements"), i.grob ());
-      if (!unsmob_grob (i.grob ()->get_object ("staff-grouper")))
+      if (!unsmob<Grob> (i.grob ()->get_object ("staff-grouper")))
         i.grob ()->set_object ("staff-grouper", valign_->self_scm ());
     }
 }