]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/score-element.cc
release: 1.2.4
[lilypond.git] / lily / score-element.cc
index 992d2eee1d770802fd7a836a9e90a0d759176675..2dab6212bcbf1d4d6445a71d04857c5846148211 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <string.h>
 
-#include "p-score.hh"
+#include "paper-score.hh"
 #include "paper-def.hh"
 #include "lookup.hh"
 #include "molecule.hh"
 #include "spanner.hh"
 #include "line-of-score.hh"
 #include "item.hh"
-#include "p-col.hh"
+#include "paper-column.hh"
 #include "molecule.hh"
 #include "misc.hh"
 #include "paper-outputter.hh"
+#include "dimension-cache.hh"
+
 
 Interval
 Score_element::dim_cache_callback (Dimension_cache*c)
 {
   Score_element *  e =dynamic_cast<Score_element*>( c->element_l());
-  if(&e->dim_cache_[X_AXIS] == c)
+  if(e->dim_cache_[X_AXIS] == c)
     return e->do_width ();
   else
     return e->do_height ();
@@ -36,14 +38,14 @@ Score_element::dim_cache_callback (Dimension_cache*c)
 Score_element::Score_element()
 {
   output_p_ =0;
-  dim_cache_[X_AXIS].set_callback (dim_cache_callback);
-  dim_cache_[Y_AXIS].set_callback (dim_cache_callback); 
+  dim_cache_[X_AXIS]->set_callback (dim_cache_callback);
+  dim_cache_[Y_AXIS]->set_callback (dim_cache_callback); 
   used_b_ = false;
   pscore_l_=0;
   lookup_l_ =0;
   status_i_ = 0;
   original_l_ = 0;
-  element_property_alist_ = SCM_EOL;
+  element_property_alist_ = scm_protect_object (gh_cons (gh_cons (void_scm_sym, SCM_BOOL_T) , SCM_EOL));
 }
 
 Score_element::Score_element (Score_element const&s)
@@ -51,7 +53,7 @@ Score_element::Score_element (Score_element const&s)
 {
   used_b_ = true;
   original_l_ =(Score_element*) &s;
-  element_property_alist_ = scm_list_copy (s.element_property_alist_);
+  element_property_alist_ = scm_protect_object (scm_list_copy (s.element_property_alist_));
   dependency_arr_ = s.dependency_arr_;
   output_p_ =0;
   status_i_ = s.status_i_;
@@ -61,7 +63,6 @@ Score_element::Score_element (Score_element const&s)
 
 Score_element::~Score_element()
 {
-  element_property_alist_ = SCM_EOL; // try to be nice to GC.
   delete output_p_; 
   assert (status_i_ >=0);
   status_i_  = -1;
@@ -79,8 +80,6 @@ Score_element::dependency_size () const
   return dependency_arr_.size ();
 }
 
-
-
 SCM
 Score_element::get_elt_property (SCM sym) const
 {
@@ -97,15 +96,15 @@ SCM
 Score_element::remove_elt_property (SCM key)
 {
   SCM s = get_elt_property (key); 
-  element_property_alist_ =  scm_assq_remove_x (element_property_alist_, key);
+  SCM_CDR(element_property_alist_) =  scm_assq_remove_x (SCM_CDR (element_property_alist_), key);
   return s;
 }
 
 void
 Score_element::set_elt_property (SCM s, SCM v)
 {
-  element_property_alist_ =
-    scm_assoc_set_x (element_property_alist_, s, v);
+  SCM_CDR(element_property_alist_) =
+    scm_assoc_set_x (SCM_CDR (element_property_alist_), s, v);
 }
 
 Interval
@@ -139,6 +138,8 @@ Score_element::print() const
 {
 #ifndef NPRINT
   DOUT << classname(this) << "{\n";
+  if (check_debug && !monitor->silent_b ("Score_element"))
+    ly_display_scm (element_property_alist_);
   DOUT << "dependencies: " << dependency_size();
   if (original_l_)
     DOUT << "Copy ";
@@ -149,26 +150,24 @@ Score_element::print() const
 #endif
 }
 
-
 Paper_def*
 Score_element::paper_l ()  const
 {
  return pscore_l_->paper_l_;
 }
 
-
 Lookup const *
 Score_element::lookup_l () const
 {
   if (!lookup_l_)
     {
-      Score_element * me = (Score_element*)this;
-      SCM sz = me->remove_elt_property (fontsize_scm_sym);
+      Score_element * urg = (Score_element*)this;
+      SCM sz = urg->remove_elt_property (fontsize_scm_sym);
       int i = (sz != SCM_BOOL_F)
        ? gh_scm2int (SCM_CDR (sz))
        : 0;
 
-      me->lookup_l_ =  pscore_l_->paper_l_->lookup_l (i);
+      urg->lookup_l_ =  (Lookup*)pscore_l_->paper_l_->lookup_l (i);
     }
   return lookup_l_;
 }
@@ -183,7 +182,6 @@ Score_element::add_processing()
   do_add_processing();
 }
 
-
 void
 Score_element::calculate_dependencies (int final, int busy,
                                    Score_element_method_pointer funcptr)
@@ -220,21 +218,18 @@ Score_element::output_processing ()
     delete output_p_;
   
   output_p_ = do_brew_molecule_p ();
+  Offset o (relative_coordinate (0, X_AXIS), relative_coordinate (0, Y_AXIS));
+  
   pscore_l_->outputter_l_->output_molecule (output_p_,
-                                           absolute_offset (),
+                                           o,
                                            classname(this));
-
-  pscore_l_->schedule_for_delete (this);
 }
 
-
-
 /*
   
   VIRTUAL STUBS
 
  */
-
 void
 Score_element::do_break_processing()
 {
@@ -312,9 +307,9 @@ Score_element::add_dependency (Score_element*e)
       e->used_b_ = true;
     }
   else
-    warning("Null dependency added");
-      
+    programming_error ("Null dependency added");
 }
+
 void
 Score_element::substitute_dependency (Score_element* old, Score_element* new_l)
 {
@@ -417,6 +412,11 @@ Score_element::handle_prebroken_dependents()
 {
 }
 
+void
+Score_element::handle_broken_dependents()
+{
+}
+
 
 
 Link_array<Score_element>