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>
11 #include "grid-line-interface.hh"
13 class Grid_line_span_engraver
: public Engraver
19 TRANSLATOR_DECLARATIONS (Grid_line_span_engraver
);
21 DECLARE_ACKNOWLEDGER (grid_point
);
22 void stop_translation_timestep ();
25 Grid_line_span_engraver::Grid_line_span_engraver ()
31 Grid_line_span_engraver::acknowledge_grid_point (Grob_info i
)
33 int depth
= i
.origin_contexts (this).size ();
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
);
48 Grid_line_span_engraver::stop_translation_timestep ()
52 for (vsize i
= 0; i
< lines_
.size (); i
++)
53 Grid_line_interface::add_grid_point (spanline_
, lines_
[i
]);
60 #include "translator.icc"
61 ADD_ACKNOWLEDGER (Grid_line_span_engraver
, grid_point
);
62 ADD_TRANSLATOR (Grid_line_span_engraver
,
64 "This engraver makes cross-staff lines: It catches all normal"
65 " lines and draws a single span line across them.",