]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/span-arpeggio-engraver.cc
release: 1.3.121
[lilypond.git] / lily / span-arpeggio-engraver.cc
index 8fb13aeb93cdca8f98194f8d81899a0d8de01fa3..c1f92a775dfb105b6147a05a42f9d48a8756b4bd 100644 (file)
@@ -7,14 +7,15 @@
 */
 
 #include "engraver.hh"
+#include "lily-guile.hh"
 #include "item.hh"
 #include "arpeggio.hh"
-#include "span-arpeggio.hh"
 #include "group-interface.hh"
+#include "side-position-interface.hh"
+#include "staff-symbol-referencer.hh"
 
 
 /** 
-
   Make arpeggios that span multiple staffs.  Catch arpeggios, and span a
   Span_arpeggio over them if we find more than two arpeggios.
   */
@@ -25,13 +26,13 @@ public:
   Span_arpeggio_engraver ();
 
 protected:
-  virtual void acknowledge_element (Score_element_info);
-  virtual void process_acknowledged ();
-  virtual void do_pre_move_processing ();
+  virtual void acknowledge_grob (Grob_info);
+  virtual void create_grobs ();
+  virtual void stop_translation_timestep ();
 
 private:
   Item *span_arpeggio_;
-  Link_array<Score_element> arpeggios_;
+  Link_array<Grob> arpeggios_;
 };
 
 
@@ -41,7 +42,7 @@ Span_arpeggio_engraver::Span_arpeggio_engraver ()
 }
 
 void
-Span_arpeggio_engraver::acknowledge_element (Score_element_info info)
+Span_arpeggio_engraver::acknowledge_grob (Grob_info info)
 {
     if (info.origin_trans_l_arr (this).size ()
         && Arpeggio::has_interface (info.elem_l_))
@@ -51,31 +52,50 @@ Span_arpeggio_engraver::acknowledge_element (Score_element_info info)
 }
 
 void
-Span_arpeggio_engraver::process_acknowledged ()
+Span_arpeggio_engraver::create_grobs ()
 {
-  if (arpeggios_.size () > 1 && !span_arpeggio_) 
+  /*
+    connectArpeggios is slightly brusque; we should really read a elt
+    property of the caught non-span arpeggios. That way, we can have
+
+    both non-connected and connected arps in one pianostaff.
+    
+
+  */
+  if (!span_arpeggio_ && arpeggios_.size () > 1
+      && to_boolean (get_property ("connectArpeggios")))
     {
-      span_arpeggio_ = new Item (get_property ("SpanArpeggio"));
-      Pointer_group_interface pgi (span_arpeggio_, "arpeggios");
-      for (int i = 0; i < arpeggios_.size () ; i++)
-       {
-         pgi.add_element (arpeggios_[i]);
-         span_arpeggio_->add_dependency (arpeggios_[i]);
-       }
-      
-      span_arpeggio_->set_parent (arpeggios_[0], Y_AXIS);
-      span_arpeggio_->set_parent (arpeggios_[0], X_AXIS);
-      
-      announce_element (span_arpeggio_, 0);
+      span_arpeggio_ = new Item (get_property ("Arpeggio"));
+      announce_grob (span_arpeggio_, 0);      
     }
 }
 
 void
-Span_arpeggio_engraver::do_pre_move_processing ()
+Span_arpeggio_engraver::stop_translation_timestep ()
 {
   if (span_arpeggio_) 
     {
-      typeset_element (span_arpeggio_);
+      /*
+       we do this very late, to make sure we also catch `extra'
+       side-pos support like accidentals.
+       */
+      for (int i=0; i < arpeggios_.size (); i ++)
+       {
+         for (SCM s = arpeggios_[i]->get_grob_property ("stems");
+              gh_pair_p (s); s = gh_cdr (s))
+           Group_interface::add_thing (span_arpeggio_, "stems", gh_car (s));
+         for (SCM s = arpeggios_[i]->get_grob_property ("side-support-elements");
+              gh_pair_p (s); s = gh_cdr (s))
+           Group_interface::add_thing (span_arpeggio_, "side-support-elements", gh_car (s));
+
+         /*
+           we can't kill the children, since we don't want to the
+           previous note to bump into the span arpeggio; so we make
+           it transparent.  */
+         arpeggios_[i]->set_grob_property ("molecule-callback", SCM_BOOL_T);
+       }
+      
+      typeset_grob (span_arpeggio_);
       span_arpeggio_ = 0;
     }
   arpeggios_.clear ();