]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/script-column-engraver.cc
Run grand replace for 2015.
[lilypond.git] / lily / script-column-engraver.cc
index e621bdfca23b4b632c84bba9b235b740b52977f3..dc34098664d19f6d8ae59ea7d460813d508775de 100644 (file)
@@ -1,88 +1,94 @@
-/*   
-  g-script-column-engraver.cc --  implement Script_column_engraver
-  
-  source file of the GNU LilyPond music typesetter
-  
-  (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  
- */
+/*
+  This file is part of LilyPond, the GNU music typesetter.
+
+  Copyright (C) 1999--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
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  LilyPond is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
+*/
 
 #include "engraver.hh"
 #include "script-column.hh"
-#include "item.hh"
 #include "side-position-interface.hh"
+#include "item.hh"
+
+#include "translator.icc"
 
 /**
    Find potentially colliding scripts, and put them in a
    Script_column, that will fix the collisions.  */
 class Script_column_engraver : public Engraver
 {
-  Score_element *scol_p_;
-  Link_array<Item> script_l_arr_;
+  Grob *script_column_;
+  vector<Grob *> scripts_;
 
 public:
-  Script_column_engraver ();
-  VIRTUAL_COPY_CONS(Translator);
+  TRANSLATOR_DECLARATIONS (Script_column_engraver);
 protected:
-  virtual void acknowledge_element (Score_element_info);
-  virtual void process_acknowledged ();
-  virtual void  do_pre_move_processing ();
-  virtual void  do_post_move_processing ();
+  DECLARE_ACKNOWLEDGER (side_position);
+  void process_acknowledged ();
+  void stop_translation_timestep ();
 };
 
-
-Script_column_engraver::Script_column_engraver()
+Script_column_engraver::Script_column_engraver ()
 {
-  scol_p_ =0;
+  script_column_ = 0;
 }
 
 void
-Script_column_engraver::do_pre_move_processing ()
+Script_column_engraver::stop_translation_timestep ()
 {
-  if (scol_p_)
+  if (script_column_)
     {
-      typeset_element (scol_p_);
-      scol_p_ =0;
+      for (vsize i = 0; i < scripts_.size (); i++)
+        if (Side_position_interface::get_axis (scripts_[i]) == Y_AXIS)
+          Script_column::add_side_positioned (script_column_, scripts_[i]);
     }
-}
-
-void
-Script_column_engraver::do_post_move_processing ()
-{
-  script_l_arr_.clear ();
 
+  script_column_ = 0;
+  scripts_.clear ();
 }
 
 void
-Script_column_engraver::acknowledge_element(Score_element_info inf) 
+Script_column_engraver::acknowledge_side_position (Grob_info inf)
 {
-  Item *thing = dynamic_cast<Item*> (inf.elem_l_);
-  if (thing && Side_position::has_interface (inf.elem_l_)) // ugh FIXME
+  Item *thing = dynamic_cast<Item *> (inf.grob ());
+  if (thing)
     {
-      if (!Item::breakable_b (thing)
-         && Side_position::get_axis (inf.elem_l_) == Y_AXIS)
-       {
-         script_l_arr_.push (thing);
-       }
+      if (!Item::is_non_musical (thing))
+        scripts_.push_back (thing);
     }
 }
 
 void
 Script_column_engraver::process_acknowledged ()
 {
-  if (!scol_p_ && script_l_arr_.size () > 1)
-    {
-      scol_p_ = new Item (get_property ("ScriptColumn"));
+  if (!script_column_ && scripts_.size () > 1)
+    script_column_ = make_item ("ScriptColumn", SCM_EOL);
+}
 
+ADD_ACKNOWLEDGER (Script_column_engraver, side_position);
+ADD_TRANSLATOR (Script_column_engraver,
+                /* doc */
+                "Find potentially colliding scripts and put them into a"
+                " @code{ScriptColumn} object; that will fix the collisions.",
 
-      announce_element (scol_p_, 0);
-    }
+                /* create */
+                "ScriptColumn ",
 
-  if (scol_p_)
-    {
-      for (int i=0; i < script_l_arr_.size (); i++)
-       Script_column::add_staff_sided (scol_p_, script_l_arr_[i]);
-      script_l_arr_.clear ();
-    }
-}
-ADD_THIS_TRANSLATOR(Script_column_engraver);
+                /* read */
+                "",
+
+                /* write */
+                ""
+               );