]> git.donarmstrong.com Git - lilypond.git/blob - lily/single-malt-grouping-item.cc
1824f70a325319354aeb860d291c0ac4db3a9db7
[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 "paper-column.hh"
12 #include "debug.hh"
13
14 Single_malt_grouping_item ::Single_malt_grouping_item()
15 {
16   set_elt_property (break_helper_only_scm_sym, SCM_BOOL_T);
17   set_elt_property (transparent_scm_sym, SCM_BOOL_T);
18
19   // this is weird! , but needed!
20   set_empty (true, X_AXIS, Y_AXIS);
21
22 }
23
24 void
25 Single_malt_grouping_item::add_item (Item* i)
26 {
27   assert (i);
28   item_l_arr_.push (i);
29   add_dependency (i);
30 }
31
32 Interval
33 Single_malt_grouping_item::my_width () const
34 {
35   Paper_column * pc = column_l ();
36   Interval w;
37   for (int i=0; i < item_l_arr_.size (); i++)
38     {
39       Item *il = item_l_arr_[i];
40       if (pc != il->column_l ())
41         {
42           /* this shouldn't happen, but let's continue anyway. */
43           programming_error (_("Single_malt_grouping_item:  I've been drinking too much"));
44           continue;             /*UGH UGH*/ 
45         }
46
47       Interval iv (il->extent (X_AXIS));
48       if (!iv.empty_b ())
49         {
50           Real off = il->relative_coordinate (pc, X_AXIS);
51           w.unite  (iv + off);
52         }
53     }
54
55   return w;
56  // add this->offset_ ? this-> relative_coordinate ()? 
57 }
58
59
60
61 void
62 Single_malt_grouping_item::do_substitute_element_pointer (Score_element*o,
63                                                           Score_element*n)
64 {
65   if (dynamic_cast <Item *> (o))
66     {
67       item_l_arr_.unordered_substitute (dynamic_cast <Item *> (o),
68                                         dynamic_cast <Item *> (n));
69     }
70 }
71
72 void
73 Single_malt_grouping_item::do_print () const
74 {
75 #ifndef NDEBUG
76   for (int i=0; i < item_l_arr_.size (); i++)
77     {
78       DOUT << classname (item_l_arr_[i]) << ", ";
79     }
80 #endif
81 }