]> git.donarmstrong.com Git - lilypond.git/blob - lily/axis-group-engraver.cc
release: 1.3.39
[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--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7  */
8
9 #include "axis-group-engraver.hh"
10 #include "spanner.hh"
11 #include "paper-column.hh"
12 #include "axis-group-interface.hh"
13
14 Axis_group_engraver::Axis_group_engraver ()
15 {
16   staffline_p_ = 0;
17 }
18
19 void
20 Axis_group_engraver::do_creation_processing ()
21 {
22   staffline_p_ = get_spanner_p ();
23   Axis_group_interface (staffline_p_).set_interface ();
24   Axis_group_interface (staffline_p_).set_axes (Y_AXIS, Y_AXIS);
25   staffline_p_->set_bound(LEFT,get_staff_info().command_pcol_l ());
26   announce_element (Score_element_info (staffline_p_, 0));
27 }
28
29 Spanner*
30 Axis_group_engraver::get_spanner_p () const
31 {
32   return new Spanner;
33 }
34
35 void
36 Axis_group_engraver::do_removal_processing ()
37 {
38   staffline_p_->set_bound(RIGHT,get_staff_info().command_pcol_l ());
39   typeset_element (staffline_p_);
40   staffline_p_ = 0;
41 }
42
43 void
44 Axis_group_engraver::acknowledge_element (Score_element_info i)
45 {
46   elts_.push (i.elem_l_);
47 }
48
49 void
50 Axis_group_engraver::process_acknowledged ()
51 {
52   /* UGH UGH UGH */
53   for (int i=0; i < elts_.size (); i++)
54     {
55       Score_element *par = elts_[i]->parent_l (Y_AXIS);
56
57       if (!par || !Axis_group_interface (par).has_interface_b ())
58         Axis_group_interface (staffline_p_).add_element (elts_[i]);
59     }
60   elts_.clear ();
61 }
62
63 ADD_THIS_TRANSLATOR(Axis_group_engraver);