lilypond-1.3.69
[lilypond.git] / lily / separation-item.cc
blob7613471c7f66dc9a50b15b7da8951991f6c2b876
1 /*
2 single-malt-grouping-item.cc -- implement Separation_item
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
10 #include "separation-item.hh"
11 #include "paper-column.hh"
12 #include "debug.hh"
13 #include "group-interface.hh"
15 void
16 Separation_item::set_interface (Score_element*s)
18 s->set_elt_property ("elements", SCM_EOL);
19 s->set_extent_callback (0, X_AXIS);
20 s->set_extent_callback (0, Y_AXIS);
23 void
24 Separation_item::add_item (Score_element*s,Item* i)
26 assert (i);
27 Pointer_group_interface (s).add_element (i);
28 s->add_dependency (i);
31 Interval
32 Separation_item::my_width (Score_element *me)
34 Item *item = dynamic_cast<Item*> (me);
35 Paper_column * pc = item->column_l ();
36 Interval w;
38 for (SCM s = me->get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
40 SCM elt = gh_car (s);
41 if (!SMOB_IS_TYPE_B(Score_element, elt))
42 continue;
44 Item *il = dynamic_cast<Item*> (unsmob_element (elt));
45 if (pc != il->column_l ())
47 /* this shouldn't happen, but let's continue anyway. */
48 programming_error (_("Separation_item: I've been drinking too much"));
49 continue; /*UGH UGH*/
52 if (to_boolean (il->get_elt_property ("no-spacing-rods")))
54 continue;
57 Interval iv (il->extent (X_AXIS));
58 if (!iv.empty_b ())
60 Real off = il->relative_coordinate (pc, X_AXIS);
61 w.unite (iv + off);
65 return w;
66 // add this->offset_ ? this-> relative_coordinate ()?