]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/single-malt-grouping-item.cc
release: 1.1.24
[lilypond.git] / lily / single-malt-grouping-item.cc
index e9fe0a7398c1ca38df2d8e5e297c1decae3bc3e6..69140eb0244963f82e31da08ccf019709a4f086d 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1998 Han-Wen Nienhuys <hanwen@cs.ruu.nl>
+  (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
@@ -18,7 +18,7 @@ Single_malt_grouping_item ::Single_malt_grouping_item()
 }
 
 void
-Single_malt_grouping_item::add (Item* i)
+Single_malt_grouping_item::add_item (Item* i)
 {
   assert (i);
   item_l_arr_.push (i);
@@ -33,22 +33,28 @@ Single_malt_grouping_item::my_width () const
   for (int i=0; i < item_l_arr_.size (); i++)
     {
       Item *il = item_l_arr_[i];
-      assert (pc == il->column_l ());
-      w.unite  (il->width () + il->relative_coordinate (pc, X_AXIS));
+      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)"));
+         continue;             /*UGH UGH*/ 
+       }
+      w.unite  (il->extent (X_AXIS) + il->relative_coordinate (&pc->dim_cache_[X_AXIS], X_AXIS));
     }
 
   return w;
  // add this->offset_ ? this-> relative_coordinate ()? 
 }
 
-IMPLEMENT_IS_TYPE_B1(Single_malt_grouping_item, Item);
+
 
 void
-Single_malt_grouping_item::do_substitute_dependency (Score_elem*o, Score_elem*n)
+Single_malt_grouping_item::do_substitute_dependency (Score_element*o, Score_element*n)
 {
-  if (o->item ())
+  if (dynamic_cast <Item *> (o))
     {
-      item_l_arr_.unordered_substitute (o->item (),  n ? n->item () : 0);
+      item_l_arr_.unordered_substitute (dynamic_cast <Item *> (o),
+                                       dynamic_cast <Item *> (n));
     }
 }
 
@@ -58,7 +64,7 @@ Single_malt_grouping_item::do_print () const
 #ifndef NDEBUG
   for (int i=0; i < item_l_arr_.size (); i++)
     {
-      DOUT << item_l_arr_[i]->name () << ", ";
+      DOUT << classname (item_l_arr_[i]) << ", ";
     }
 #endif
 }