]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/grid-line-span-engraver.cc
Web-ja: update introduction
[lilypond.git] / lily / grid-line-span-engraver.cc
index 55dacf3de0d478351833decd1d114052b5d2fe55..d5f0335a480f7cff62b0a2d9a6e3e3bb90d66331 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2005--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 2005--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
 #include "item.hh"
 #include "grid-line-interface.hh"
 
+#include "translator.icc"
+
 class Grid_line_span_engraver : public Engraver
 {
   Item *spanline_;
-  vector<Item*> lines_;
+  vector<Item *> lines_;
 
 public:
   TRANSLATOR_DECLARATIONS (Grid_line_span_engraver);
 protected:
-  DECLARE_ACKNOWLEDGER (grid_point);
+  void acknowledge_grid_point (Grob_info);
   void stop_translation_timestep ();
 };
 
-Grid_line_span_engraver::Grid_line_span_engraver ()
+Grid_line_span_engraver::Grid_line_span_engraver (Context *c)
+  : Engraver (c)
 {
   spanline_ = 0;
 }
@@ -48,10 +51,10 @@ Grid_line_span_engraver::acknowledge_grid_point (Grob_info i)
       lines_.push_back (it);
 
       if (lines_.size () >= 2 && !spanline_)
-       {
-         spanline_ = make_item ("GridLine", SCM_EOL);
-         spanline_->set_parent (lines_[0], X_AXIS);
-       }
+        {
+          spanline_ = make_item ("GridLine", SCM_EOL);
+          spanline_->set_parent (lines_[0], X_AXIS);
+        }
     }
 }
 
@@ -61,26 +64,30 @@ Grid_line_span_engraver::stop_translation_timestep ()
   if (spanline_)
     {
       for (vsize i = 0; i < lines_.size (); i++)
-       Grid_line_interface::add_grid_point (spanline_, lines_[i]);
+        Grid_line_interface::add_grid_point (spanline_, lines_[i]);
 
       spanline_ = 0;
     }
   lines_.resize (0);
 }
 
-#include "translator.icc"
-ADD_ACKNOWLEDGER (Grid_line_span_engraver, grid_point);
+void
+Grid_line_span_engraver::boot ()
+{
+  ADD_ACKNOWLEDGER (Grid_line_span_engraver, grid_point);
+}
+
 ADD_TRANSLATOR (Grid_line_span_engraver,
-               /* doc */
-               "This engraver makes cross-staff lines: It catches all normal"
-               " lines and draws a single span line across them.",
+                /* doc */
+                "This engraver makes cross-staff lines: It catches all normal"
+                " lines and draws a single span line across them.",
 
-               /* create */
-               "GridLine ",
+                /* create */
+                "GridLine ",
 
-               /* read */
-               "",
+                /* read */
+                "",
 
-               /* write */
-               ""
-               );
+                /* write */
+                ""
+               );