Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / lily / grid-line-span-engraver.cc
blob15ce55a13debeca338534a4ba19a13c32bdd625a
1 /*
2 grid-line-span-engraver.cc -- implement Grid_line_span_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2005--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
9 #include "engraver.hh"
10 #include "item.hh"
11 #include "grid-line-interface.hh"
13 class Grid_line_span_engraver : public Engraver
15 Item *spanline_;
16 vector<Item*> lines_;
18 public:
19 TRANSLATOR_DECLARATIONS (Grid_line_span_engraver);
20 protected:
21 DECLARE_ACKNOWLEDGER (grid_point);
22 void stop_translation_timestep ();
25 Grid_line_span_engraver::Grid_line_span_engraver ()
27 spanline_ = 0;
30 void
31 Grid_line_span_engraver::acknowledge_grid_point (Grob_info i)
33 int depth = i.origin_contexts (this).size ();
34 if (depth)
36 Item *it = dynamic_cast<Item *> (i.grob ());
37 lines_.push_back (it);
39 if (lines_.size () >= 2 && !spanline_)
41 spanline_ = make_item ("GridLine", SCM_EOL);
42 spanline_->set_parent (lines_[0], X_AXIS);
47 void
48 Grid_line_span_engraver::stop_translation_timestep ()
50 if (spanline_)
52 for (vsize i = 0; i < lines_.size (); i++)
53 Grid_line_interface::add_grid_point (spanline_, lines_[i]);
55 spanline_ = 0;
57 lines_.resize (0);
60 #include "translator.icc"
61 ADD_ACKNOWLEDGER (Grid_line_span_engraver, grid_point);
62 ADD_TRANSLATOR (Grid_line_span_engraver,
63 /* doc */
64 "This engraver makes cross-staff lines: It catches all normal"
65 " lines and draws a single span line across them.",
67 /* create */
68 "GridLine ",
70 /* read */
71 "",
73 /* write */