]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/score-element.hh
release: 1.2.13
[lilypond.git] / lily / include / score-element.hh
index 719cc16d8ed2938e517f3d08e47c1e834809d273..af9b484faa5f19e137d0223565779be05721d9ef 100644 (file)
@@ -9,9 +9,7 @@
 
 #include "parray.hh"
 #include "virtual-methods.hh"
-#include "directed-graph.hh"
 #include "graphical-element.hh"
-#include "protected-scm.hh"
 #include "lily-guile.hh"
 
 
@@ -37,7 +35,16 @@ Boolean (true iff defined)
 
 */
 class Score_element : public virtual Graphical_element {
-  Protected_scm element_property_alist_;
+
+  friend class Paper_score;
+  /**
+     properties specific for this element. Destructor will not call
+     scm_unprotect, so as to allow more flexible GC arrangements.  The
+     real alist is in (cdr element_property_alist_), to reduce the
+     need for more scm_protect calls.
+
+  */
+  SCM element_property_alist_;
   Link_array<Score_element> dependency_arr_;
   /**
      The lookup, determined by the font size. Cache this value.
@@ -98,6 +105,8 @@ public:
    */
   void calculate_dependencies (int final, int busy, Score_element_method_pointer funcptr);
 
+
+  virtual Score_element *find_broken_piece (Line_of_score*) const;
 protected:
   Score_element* dependency (int) const;
   int dependency_size () const;
@@ -105,7 +114,8 @@ protected:
   virtual void output_processing ();
   virtual Interval do_height () const;
   virtual Interval do_width () const;
-    
+
+
   /// do printing of derived info.
   virtual void do_print () const;
   /// generate the molecule    
@@ -118,6 +128,9 @@ protected:
   /// generate rods & springs
   virtual void do_space_processing ();
 
+  /// do postbreak substs on array of pointers.
+  virtual void do_substitute_arrays ();
+
   virtual void do_breakable_col_processing ();
   /// do calculations after determining horizontal spacing
   virtual void do_post_processing ();
@@ -127,11 +140,33 @@ protected:
   virtual void handle_broken_dependencies ();
   virtual void handle_prebroken_dependencies ();
   virtual void handle_prebroken_dependents ();
+  virtual void handle_broken_dependents ();
   virtual Link_array<Score_element> get_extra_dependencies () const;
 
   static Interval dim_cache_callback (Dimension_cache*);
 };
 
 
+template<class T>
+void
+substitute_element_array (Link_array<T> &arr, Line_of_score * to)
+{
+  Link_array<T> newarr;
+  for (int i =0; i < arr.size (); i++)
+    {
+      T * t = arr[i];
+      if (t->line_l () != to)
+       {
+         t = dynamic_cast<T*> (t->find_broken_piece (to));
+       }
+      
+      if (t)
+       newarr.push (t);
+    }
+  arr = newarr;
+}
+
+
+
 #endif // STAFFELEM_HH