lilypond-1.3.67
[lilypond.git] / lily / single-malt-grouping-item.cc
blob84d10f7230e5e4cce8ebbc558652f3af7a5f2490
1 /*
2 single-malt-grouping-item.cc -- implement Single_malt_grouping_item
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
10 #include "single-malt-grouping-item.hh"
11 #include "paper-column.hh"
12 #include "debug.hh"
13 #include "group-interface.hh"
15 Single_malt_grouping_item ::Single_malt_grouping_item(SCM s)
16 : Item (s)
18 set_elt_pointer ("elements", SCM_EOL);
20 // this is weird! , but needed!
21 set_extent_callback (0, X_AXIS);
22 set_extent_callback (0, Y_AXIS);
26 void
27 Single_malt_grouping_item::add_item (Item* i)
29 assert (i);
30 Pointer_group_interface (this).add_element (i);
32 add_dependency (i);
35 Interval
36 Single_malt_grouping_item::my_width () const
38 Paper_column * pc = column_l ();
39 Interval w;
41 for (SCM s = get_elt_pointer ("elements"); gh_pair_p (s); s = gh_cdr (s))
43 SCM elt = gh_car (s);
44 if (!SMOB_IS_TYPE_B(Score_element, elt))
45 continue;
47 Item *il = dynamic_cast<Item*> (SMOB_TO_TYPE (Score_element, elt));
48 if (pc != il->column_l ())
50 /* this shouldn't happen, but let's continue anyway. */
51 programming_error (_("Single_malt_grouping_item: I've been drinking too much"));
52 continue; /*UGH UGH*/
55 if (to_boolean (il->get_elt_property ("no-spacing-rods")))
57 continue;
60 Interval iv (il->extent (X_AXIS));
61 if (!iv.empty_b ())
63 Real off = il->relative_coordinate (pc, X_AXIS);
64 w.unite (iv + off);
68 return w;
69 // add this->offset_ ? this-> relative_coordinate ()?