]> git.donarmstrong.com Git - lilypond.git/blob - lily/single-malt-grouping-item.cc
release: 1.1.29
[lilypond.git] / lily / single-malt-grouping-item.cc
1 /*   
2   single-malt-grouping-item.cc --  implement Single_malt_grouping_item
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1998--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #include "single-malt-grouping-item.hh"
11 #include "p-col.hh"
12 #include "debug.hh"
13
14 Single_malt_grouping_item ::Single_malt_grouping_item()
15 {
16   transparent_b_ = true;
17   set_empty (true);
18 }
19
20 void
21 Single_malt_grouping_item::add_item (Item* i)
22 {
23   assert (i);
24   item_l_arr_.push (i);
25   add_dependency (i);
26 }
27
28 Interval
29 Single_malt_grouping_item::my_width () const
30 {
31   Paper_column * pc = column_l ();
32   Interval w;
33   for (int i=0; i < item_l_arr_.size (); i++)
34     {
35       Item *il = item_l_arr_[i];
36       if (pc != il->column_l ())
37         {
38           /* this shouldn't happen, but let's continue anyway. */
39           warning (_("Single_malt_grouping_item: I've been drinking too much (fixme)"));
40           continue;             /*UGH UGH*/ 
41         }
42       w.unite  (il->extent (X_AXIS) + il->relative_coordinate (&pc->dim_cache_[X_AXIS], X_AXIS));
43     }
44
45   return w;
46  // add this->offset_ ? this-> relative_coordinate ()? 
47 }
48
49
50
51 void
52 Single_malt_grouping_item::do_substitute_dependency (Score_element*o, Score_element*n)
53 {
54   if (dynamic_cast <Item *> (o))
55     {
56       item_l_arr_.unordered_substitute (dynamic_cast <Item *> (o),
57                                         dynamic_cast <Item *> (n));
58     }
59 }
60
61 void
62 Single_malt_grouping_item::do_print () const
63 {
64 #ifndef NDEBUG
65   for (int i=0; i < item_l_arr_.size (); i++)
66     {
67       DOUT << classname (item_l_arr_[i]) << ", ";
68     }
69 #endif
70 }