2 axis-group-engraver.cc -- implement Axis_group_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "axis-group-engraver.hh"
12 #include "axis-group-interface.hh"
16 #include "translator.icc"
18 Axis_group_engraver::Axis_group_engraver ()
25 Axis_group_engraver::process_music ()
29 staffline_ = get_spanner ();
30 Grob *it = unsmob_grob (get_property ("currentCommandColumn"));
31 staffline_->set_bound (LEFT, it);
36 Axis_group_engraver::get_spanner ()
38 return make_spanner ("VerticalAxisGroup", SCM_EOL);
42 TODO: should we junk minimumVerticalExtent/extraVerticalExtent ?
46 Axis_group_engraver::finalize ()
50 Grob *it = unsmob_grob (get_property ("currentCommandColumn"));
51 staffline_->set_bound (RIGHT, it);
56 Axis_group_engraver::acknowledge_grob (Grob_info i)
58 elts_.push (i.grob ());
62 maybe should check if our parent is set, because we now get a
63 cyclic parent relationship if we have two Axis_group_engravers in
66 Axis_group_engraver::process_acknowledged ()
71 for (int i = 0; i < elts_.size (); i++)
73 if (!unsmob_grob (elts_[i]->get_object ("axis-group-parent-Y")))
75 if (staffline_->get_parent (Y_AXIS)
76 && staffline_->get_parent (Y_AXIS) == elts_[i])
78 staffline_->warning (_ ("Axis_group_engraver: vertical group already has a parent"));
79 staffline_->warning (_ ("are there two Axis_group_engravers?"));
80 staffline_->warning (_ ("removing this vertical group"));
81 staffline_->suicide ();
86 else if (elts_[i]->is_empty (Y_AXIS))
89 We have to do _something_, otherwise staff objects will
90 end up with System as parent.
93 elts_[i]->set_parent (staffline_, Y_AXIS);
97 add_element (elts_[i]);
104 Axis_group_engraver::add_element (Grob *e)
106 Axis_group_interface::add_element (staffline_, e);
109 ADD_ACKNOWLEDGER (Axis_group_engraver, grob);
111 ADD_TRANSLATOR (Axis_group_engraver,
112 /* doc */ "Group all objects created in this context in a VerticalAxisGroup spanner.",
113 /* create */ "VerticalAxisGroup",
115 /* read */ "verticalExtent minimumVerticalExtent extraVerticalExtent",