lilypond-1.1.55
[lilypond.git] / lily / single-malt-grouping-item.cc
blob77848e79faec7f323b472c56f5d2499611f6c3d7
1 /*
2 single-malt-grouping-item.cc -- implement Single_malt_grouping_item
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
10 #include "single-malt-grouping-item.hh"
11 #include "p-col.hh"
12 #include "debug.hh"
14 Single_malt_grouping_item ::Single_malt_grouping_item()
16 set_elt_property (break_helper_only_scm_sym, SCM_BOOL_T);
17 set_elt_property (transparent_scm_sym, SCM_BOOL_T);
19 // this is weird! , but needed!
20 set_empty (true);
23 void
24 Single_malt_grouping_item::add_item (Item* i)
26 assert (i);
27 item_l_arr_.push (i);
28 add_dependency (i);
31 Interval
32 Single_malt_grouping_item::my_width () const
34 Paper_column * pc = column_l ();
35 Interval w;
36 for (int i=0; i < item_l_arr_.size (); i++)
38 Item *il = item_l_arr_[i];
39 if (pc != il->column_l ())
41 /* this shouldn't happen, but let's continue anyway. */
42 programming_error (_("Single_malt_grouping_item: I've been drinking too much"));
43 continue; /*UGH UGH*/
46 Interval iv (il->extent (X_AXIS));
47 if (!iv.empty_b ())
49 Real off = il->relative_coordinate (pc->dim_cache_[X_AXIS], X_AXIS);
50 w.unite (iv + off);
54 return w;
55 // add this->offset_ ? this-> relative_coordinate ()?
60 void
61 Single_malt_grouping_item::do_substitute_element_pointer (Score_element*o,
62 Score_element*n)
64 if (dynamic_cast <Item *> (o))
66 item_l_arr_.unordered_substitute (dynamic_cast <Item *> (o),
67 dynamic_cast <Item *> (n));
71 void
72 Single_malt_grouping_item::do_print () const
74 #ifndef NDEBUG
75 for (int i=0; i < item_l_arr_.size (); i++)
77 DOUT << classname (item_l_arr_[i]) << ", ";
79 #endif