]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/script-column-engraver.cc
* lily/tie-column.cc (new_directions): put Tie down on center
[lilypond.git] / lily / script-column-engraver.cc
index df4ca98b880aa4a5f5dfad3d8977f37078094deb..5e9c668093bc9e6a6331576521480690c684b3a8 100644 (file)
@@ -1,92 +1,74 @@
-/*   
-  script-column-engraver.cc --  implement Script_column_engraver
-  
+/*
+  script-column-engraver.cc -- implement Script_column_engraver
+
   source file of the GNU LilyPond music typesetter
-  
-  (c) 1999--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  
- */
+
+  (c) 1999--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
 
 #include "engraver.hh"
 #include "script-column.hh"
-#include "item.hh"
 #include "side-position-interface.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
 {
-  Grob *scol_p_;
-  Link_array<Item> script_l_arr_;
+  Grob *scol_;
+  Link_array<Item> scripts_;
 
 public:
-  TRANSLATOR_DECLARATIONS(Script_column_engraver);
+  TRANSLATOR_DECLARATIONS (Script_column_engraver);
 protected:
-  virtual void acknowledge_grob (Grob_info);
-  virtual void create_grobs ();
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
+  DECLARE_ACKNOWLEDGER (side_position);
+  void process_acknowledged ();
+  void stop_translation_timestep ();
 };
 
-
 Script_column_engraver::Script_column_engraver ()
 {
-  scol_p_ =0;
+  scol_ = 0;
 }
 
 void
 Script_column_engraver::stop_translation_timestep ()
 {
-  if (scol_p_)
-    {
-      typeset_grob (scol_p_);
-      scol_p_ =0;
-    }
+  scol_ = 0;
+  scripts_.clear ();
 }
 
 void
-Script_column_engraver::start_translation_timestep ()
+Script_column_engraver::acknowledge_side_position (Grob_info inf)
 {
-  script_l_arr_.clear ();
-
-}
-
-void
-Script_column_engraver::acknowledge_grob (Grob_info inf) 
-{
-  Item *thing = dynamic_cast<Item*> (inf.grob_l_);
-  if (thing && Side_position_interface::has_interface (inf.grob_l_)) // ugh FIXME
+  Item *thing = dynamic_cast<Item *> (inf.grob ());
+  if (thing)
     {
-      if (!Item::breakable_b (thing)
-         && Side_position_interface::get_axis (inf.grob_l_) == Y_AXIS)
-       {
-         script_l_arr_.push (thing);
-       }
+      if (!Item::is_breakable (thing)
+         && Side_position_interface::get_axis (inf.grob ()) == Y_AXIS)
+       scripts_.push (thing);
     }
 }
 
 void
-Script_column_engraver::create_grobs ()
+Script_column_engraver::process_acknowledged ()
 {
-  if (!scol_p_ && script_l_arr_.size () > 1)
-    {
-      scol_p_ = new Item (get_property ("ScriptColumn"));
-      announce_grob (scol_p_, 0);
-    }
+  if (!scol_ && scripts_.size () > 1)
+    scol_ = make_item ("ScriptColumn", SCM_EOL);
 
-  if (scol_p_)
+  if (scol_)
     {
-      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 ();
+      for (int i = 0; i < scripts_.size (); i++)
+       Script_column::add_staff_sided (scol_, scripts_[i]);
+      scripts_.clear ();
     }
-
 }
-
-ENTER_DESCRIPTION(Script_column_engraver,
-/* descr */       "",
-/* creats*/       "ScriptColumn",
-/* acks  */       "side-position-interface",
-/* reads */       "",
-/* write */       "");
+ADD_ACKNOWLEDGER (Script_column_engraver, side_position);
+ADD_TRANSLATOR (Script_column_engraver,
+               /* doc */ "",
+               /* create */ "ScriptColumn",
+               /* accept */ "",
+               /* read */ "",
+               /* write */ "");