]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/script-column-engraver.cc
release: 1.3.147
[lilypond.git] / lily / script-column-engraver.cc
index df81722ee68a66bf5a2233e347fcef786b8017a3..93083a1cb0ab7232add7fcb278db3ad997c34014 100644 (file)
@@ -3,68 +3,64 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1999--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
 #include "engraver.hh"
 #include "script-column.hh"
+#include "item.hh"
 #include "side-position-interface.hh"
-#include "dimension-cache.hh"
 
 /**
    Find potentially colliding scripts, and put them in a
    Script_column, that will fix the collisions.  */
 class Script_column_engraver : public Engraver
 {
-  Script_column *scol_p_;
+  Grob *scol_p_;
   Link_array<Item> script_l_arr_;
 
 public:
   Script_column_engraver ();
-  VIRTUAL_COPY_CONS(Translator);
+  VIRTUAL_COPY_CONS (Translator);
 protected:
-  virtual void acknowledge_element (Score_element_info);
-  virtual void process_acknowledged ();
-  virtual void  do_pre_move_processing ();
-  virtual void  do_post_move_processing ();
+  virtual void acknowledge_grob (Grob_info);
+  virtual void create_grobs ();
+  virtual void stop_translation_timestep ();
+  virtual void start_translation_timestep ();
 };
 
 
-ADD_THIS_TRANSLATOR (Script_column_engraver);
-
-Script_column_engraver::Script_column_engraver()
+Script_column_engraver::Script_column_engraver ()
 {
   scol_p_ =0;
 }
 
 void
-Script_column_engraver::do_pre_move_processing ()
+Script_column_engraver::stop_translation_timestep ()
 {
   if (scol_p_)
     {
-      typeset_element (scol_p_);
+      typeset_grob (scol_p_);
       scol_p_ =0;
     }
 }
 
 void
-Script_column_engraver::do_post_move_processing ()
+Script_column_engraver::start_translation_timestep ()
 {
   script_l_arr_.clear ();
 
 }
 
 void
-Script_column_engraver::acknowledge_element( Score_element_info inf) 
+Script_column_engraver::acknowledge_grob (Grob_info inf) 
 {
-  Item *thing =  dynamic_cast<Item*>(inf.elem_l_);
-  if (!thing)
-    return;
-  
-  if (Side_position_interface (thing).has_interface_b ())
+  Item *thing = dynamic_cast<Item*> (inf.elem_l_);
+  if (thing && Side_position_interface::has_interface (inf.elem_l_)) // ugh FIXME
     {
-      if (!thing->breakable_b () && Side_position_interface (thing).get_axis () == Y_AXIS)
+      if (!Item::breakable_b (thing)
+         && Side_position_interface::get_axis (inf.elem_l_) == Y_AXIS)
        {
          script_l_arr_.push (thing);
        }
@@ -72,18 +68,21 @@ Script_column_engraver::acknowledge_element( Score_element_info inf)
 }
 
 void
-Script_column_engraver::process_acknowledged ()
+Script_column_engraver::create_grobs ()
 {
   if (!scol_p_ && script_l_arr_.size () > 1)
     {
-      scol_p_ = new Script_column;
-      announce_element (Score_element_info (scol_p_, 0));
+      scol_p_ = new Item (get_property ("ScriptColumn"));
+
+
+      announce_grob (scol_p_, 0);
     }
 
   if (scol_p_)
     {
       for (int i=0; i < script_l_arr_.size (); i++)
-       scol_p_->add_staff_sided (script_l_arr_[i]);
+       Script_column::add_staff_sided (scol_p_, script_l_arr_[i]);
       script_l_arr_.clear ();
     }
 }
+ADD_THIS_TRANSLATOR (Script_column_engraver);