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