]> git.donarmstrong.com Git - lilypond.git/blob - lily/single-malt-grouping-item.cc
release: 0.1.54
[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 Han-Wen Nienhuys <hanwen@cs.ruu.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* 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       assert (pc == il->column_l ());
37       w.unite  (il->width () + il->relative_coordinate (pc, X_AXIS));
38     }
39
40   return w;
41  // add this->offset_ ? this-> relative_coordinate ()? 
42 }
43
44 IMPLEMENT_IS_TYPE_B1(Single_malt_grouping_item, Item);
45
46 void
47 Single_malt_grouping_item::do_substitute_dependency (Score_elem*o, Score_elem*n)
48 {
49   if (o->item ())
50     {
51       item_l_arr_.unordered_substitute (o->item (),  n ? n->item () : 0);
52     }
53 }
54
55 void
56 Single_malt_grouping_item::do_print () const
57 {
58 #ifndef NDEBUG
59   for (int i=0; i < item_l_arr_.size (); i++)
60     {
61       DOUT << item_l_arr_[i]->name () << ", ";
62     }
63 #endif
64 }