]> git.donarmstrong.com Git - lilypond.git/blob - lily/single-malt-grouping-item.cc
release: 1.1.32
[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   break_helper_only_b_ = true;
17   transparent_b_ = true;
18   set_empty (true);
19 }
20
21 void
22 Single_malt_grouping_item::add_item (Item* i)
23 {
24   assert (i);
25   item_l_arr_.push (i);
26   add_dependency (i);
27 }
28
29 Interval
30 Single_malt_grouping_item::my_width () const
31 {
32   Paper_column * pc = column_l ();
33   Interval w;
34   for (int i=0; i < item_l_arr_.size (); i++)
35     {
36       Item *il = item_l_arr_[i];
37       if (pc != il->column_l ())
38         {
39           /* this shouldn't happen, but let's continue anyway. */
40           warning (_("Single_malt_grouping_item: I've been drinking too much (fixme)"));
41           continue;             /*UGH UGH*/ 
42         }
43       w.unite  (il->extent (X_AXIS) + il->relative_coordinate (&pc->dim_cache_[X_AXIS], X_AXIS));
44     }
45
46   return w;
47  // add this->offset_ ? this-> relative_coordinate ()? 
48 }
49
50
51
52 void
53 Single_malt_grouping_item::do_substitute_element_pointer (Score_element*o, Score_element*n)
54 {
55   if (dynamic_cast <Item *> (o))
56     {
57       item_l_arr_.unordered_substitute (dynamic_cast <Item *> (o),
58                                         dynamic_cast <Item *> (n));
59     }
60 }
61
62 void
63 Single_malt_grouping_item::do_print () const
64 {
65 #ifndef NDEBUG
66   for (int i=0; i < item_l_arr_.size (); i++)
67     {
68       DOUT << classname (item_l_arr_[i]) << ", ";
69     }
70 #endif
71 }