2 separation-item.cc -- implement Separation_item
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "separation-item.hh"
11 #include "paper-column.hh"
13 #include "group-interface.hh"
17 Separation_item::add_item (Grob*s,Item* i)
20 Pointer_group_interface::add_grob (s, ly_symbol2scm ("elements"),i);
21 s->add_dependency (i);
27 why don't we use extent()
30 Separation_item::my_width (Grob *me)
32 Item *item = dynamic_cast<Item*> (me);
33 Paper_column * pc = item->column_l ();
36 for (SCM s = me->get_grob_property ("elements"); gh_pair_p (s); s = ly_cdr (s))
39 if (!unsmob_grob (elt))
42 Item *il = unsmob_item (elt);
43 if (pc != il->column_l ())
45 /* this shouldn't happen, but let's continue anyway. */
46 programming_error (_ ("Separation_item: I've been drinking too much"));
50 if (to_boolean (il->get_grob_property ("no-spacing-rods")))
55 Interval iv (il->extent (pc, X_AXIS));
62 SCM pad = me->get_grob_property ("padding");
64 if (gh_number_p (pad))
66 w[RIGHT] += gh_scm2double (pad)/2;
67 w[LEFT] -= gh_scm2double (pad)/2;
71 // add this->offset_ ? this-> relative_coordinate ()?
78 ADD_INTERFACE (Separation_item,"separation-item-interface",
79 "Item that computes widths to generate spacing rods.
81 Calc dimensions for the Separating_group_spanner; this has to be
82 an item to get dependencies correct. It can't be an grob_group
83 since these usually are in a different X_group