]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/single-malt-grouping-item.cc
release: 1.3.45
[lilypond.git] / lily / single-malt-grouping-item.cc
index fc66d9baa504048624672b5bcc4c7d67bb224cc3..b03d4c59beb48e0061f8a80cf839bedff701dbdb 100644 (file)
@@ -3,25 +3,33 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1998--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
 #include "single-malt-grouping-item.hh"
-#include "p-col.hh"
+#include "paper-column.hh"
 #include "debug.hh"
 
 Single_malt_grouping_item ::Single_malt_grouping_item()
 {
-  transparent_b_ = true;
-  set_empty (true);
+  set_elt_property ("transparent", SCM_BOOL_T);
+  set_elt_property ("elements", SCM_EOL);
+
+  // this is weird! , but needed!
+  set_extent_callback (0, X_AXIS);
+  set_extent_callback (0,  Y_AXIS);
+
 }
 
 void
 Single_malt_grouping_item::add_item (Item* i)
 {
   assert (i);
-  item_l_arr_.push (i);
+  set_elt_property ("elements",
+                   gh_cons (i->self_scm_,
+                            get_elt_property ("elements")));
+
   add_dependency (i);
 }
 
@@ -30,16 +38,29 @@ Single_malt_grouping_item::my_width () const
 {
   Paper_column * pc = column_l ();
   Interval w;
-  for (int i=0; i < item_l_arr_.size (); i++)
+  
+  for (SCM s = get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
     {
-      Item *il = item_l_arr_[i];
+      SCM elt = gh_car (s);
+      if (!SMOB_IS_TYPE_B(Score_element, elt))
+       continue;
+
+      
+      
+      Item *il = dynamic_cast<Item*> (SMOB_TO_TYPE (Score_element, elt));
       if (pc != il->column_l ())
        {
          /* this shouldn't happen, but let's continue anyway. */
-         warning (_("Single_malt_grouping_item: I've been drinking too much (fixme)"));
+         programming_error (_("Single_malt_grouping_item:  I've been drinking too much"));
          continue;             /*UGH UGH*/ 
        }
-      w.unite  (il->extent (X_AXIS) + il->relative_coordinate (&pc->dim_cache_[X_AXIS], X_AXIS));
+
+      Interval iv (il->extent (X_AXIS));
+      if (!iv.empty_b ())
+       {
+         Real off = il->relative_coordinate (pc, X_AXIS);
+         w.unite  (iv + off);
+       }
     }
 
   return w;
@@ -48,23 +69,3 @@ Single_malt_grouping_item::my_width () const
 
 
 
-void
-Single_malt_grouping_item::do_substitute_dependency (Score_element*o, Score_element*n)
-{
-  if (dynamic_cast <Item *> (o))
-    {
-      item_l_arr_.unordered_substitute (dynamic_cast <Item *> (o),
-                                       dynamic_cast <Item *> (n));
-    }
-}
-
-void
-Single_malt_grouping_item::do_print () const
-{
-#ifndef NDEBUG
-  for (int i=0; i < item_l_arr_.size (); i++)
-    {
-      DOUT << classname (item_l_arr_[i]) << ", ";
-    }
-#endif
-}