Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / lily / axis-group-engraver.cc
blob4f19938ef8c3e90c3b45cc9bc7e53682fbe9be79
1 /*
2 axis-group-engraver.cc -- implement Axis_group_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "axis-group-engraver.hh"
11 #include "axis-group-interface.hh"
12 #include "pointer-group-interface.hh"
13 #include "context.hh"
14 #include "international.hh"
15 #include "spanner.hh"
16 #include "warn.hh"
18 #include "translator.icc"
20 Axis_group_engraver::Axis_group_engraver ()
22 must_be_last_ = true;
23 staffline_ = 0;
26 void
27 Axis_group_engraver::process_music ()
29 if (!staffline_)
31 staffline_ = get_spanner ();
32 Grob *it = unsmob_grob (get_property ("currentCommandColumn"));
33 staffline_->set_bound (LEFT, it);
37 Spanner *
38 Axis_group_engraver::get_spanner ()
40 return make_spanner ("VerticalAxisGroup", SCM_EOL);
43 void
44 Axis_group_engraver::finalize ()
46 if (staffline_)
48 Grob *it = unsmob_grob (get_property ("currentCommandColumn"));
49 staffline_->set_bound (RIGHT, it);
51 Pointer_group_interface::set_ordered (staffline_, ly_symbol2scm ("elements"), false);
55 void
56 Axis_group_engraver::acknowledge_grob (Grob_info i)
58 elts_.push_back (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
64 the context. */
65 void
66 Axis_group_engraver::process_acknowledged ()
68 if (!staffline_)
69 return;
71 for (vsize 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 ();
82 staffline_ = 0;
83 break;
85 add_element (elts_[i]);
88 elts_.clear ();
91 void
92 Axis_group_engraver::add_element (Grob *e)
94 Axis_group_interface::add_element (staffline_, e);
97 ADD_ACKNOWLEDGER (Axis_group_engraver, grob);
99 ADD_TRANSLATOR (Axis_group_engraver,
100 /* doc */
101 "Group all objects created in this context in a"
102 " @code{VerticalAxisGroup} spanner.",
104 /* create */
105 "VerticalAxisGroup ",
107 /* read */
108 "currentCommandColumn ",
110 /* write */