]> git.donarmstrong.com Git - lilypond.git/blob - lily/single-malt-grouping-item.cc
release: 0.1.52
[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
13 Single_malt_grouping_item ::Single_malt_grouping_item()
14 {
15   transparent_b_ = true;
16 }
17
18 void
19 Single_malt_grouping_item::add (Item* i)
20 {
21   assert (i);
22   item_l_arr_.push (i);
23   add_dependency (i);
24 }
25
26 Interval
27 Single_malt_grouping_item::do_width () const
28 {
29   Paper_column * pc = column_l ();
30   Interval w;
31   for (int i=0; i < item_l_arr_.size (); i++)
32     {
33       Item *il = item_l_arr_[i];
34       assert (pc == il->column_l ());
35       w.unite  (il->width () + il->relative_coordinate (pc, X_AXIS));
36     }
37   
38   return w + (- relative_coordinate (pc, X_AXIS)); // TODO
39 }
40
41 IMPLEMENT_IS_TYPE_B1(Single_malt_grouping_item, Item);
42
43 void
44 Single_malt_grouping_item::do_substitute_dependency (Score_elem*o, Score_elem*n)
45 {
46   if (o->item ())
47     {
48       item_l_arr_.unordered_substitute (o->item (),  n ? n->item () : 0);
49     }
50 }