]> git.donarmstrong.com Git - lilypond.git/blob - lily/axis-group-engraver.cc
44b85b416e7ac3fc5e7b9a2463ce92bd4dc246f1
[lilypond.git] / lily / axis-group-engraver.cc
1 /*   
2   axis-group-engraver.cc --  implement Axis_group_engraver
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7  */
8
9 #include "axis-group-engraver.hh"
10 #include "axis-group-spanner.hh"
11 #include "p-col.hh"
12
13 Axis_group_engraver::Axis_group_engraver ()
14 {
15   staffline_p_ = 0;
16 }
17
18 void
19 Axis_group_engraver::do_creation_processing ()
20 {
21   staffline_p_ = get_spanner_p ();
22   staffline_p_->set_axes (Y_AXIS, Y_AXIS);
23   staffline_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ());
24   announce_element (Score_element_info (staffline_p_, 0));
25 }
26
27 Axis_group_spanner*
28 Axis_group_engraver::get_spanner_p () const
29 {
30   return new Axis_group_spanner;
31 }
32 void
33 Axis_group_engraver::do_removal_processing ()
34 {
35   staffline_p_->set_bounds(RIGHT,get_staff_info().command_pcol_l ());
36   typeset_element (staffline_p_);
37   staffline_p_ = 0;
38 }
39
40 void
41 Axis_group_engraver::acknowledge_element (Score_element_info i)
42 {
43   if (!i.elem_l_->parent_l (Y_AXIS))
44     {
45       elts_.push (i.elem_l_);
46     }
47 }
48
49 void
50 Axis_group_engraver::process_acknowledged ()
51 {
52   for (int i=0; i < elts_.size (); i++)
53     {
54       if (!elts_[i]->parent_l (Y_AXIS))
55         staffline_p_->add_element (elts_[i]);
56     }
57   elts_.clear ();
58 }
59
60 ADD_THIS_TRANSLATOR(Axis_group_engraver);