]> git.donarmstrong.com Git - lilypond.git/blob - lily/axis-group-engraver.cc
patch::: 1.3.33.jcn3
[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 "axis-group-spanner.hh"
11 #include "paper-column.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_bound(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_bound(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   elts_.push (i.elem_l_);
44 }
45
46 void
47 Axis_group_engraver::process_acknowledged ()
48 {
49   /* UGH UGH UGH */
50   for (int i=0; i < elts_.size (); i++)
51     {
52       if (!elts_[i]->parent_l (Y_AXIS))
53         staffline_p_->add_element (elts_[i]);
54       else
55         if (
56             // elts_[i]->get_elt_property ("Axis_group_element::add_extra_element") == SCM_UNDEFINED &&
57             ! dynamic_cast<Axis_group_element*> (elts_[i]->parent_l (Y_AXIS)))
58                
59         {
60           staffline_p_->add_element (elts_[i]);
61         }
62     }
63   elts_.clear ();
64 }
65
66 ADD_THIS_TRANSLATOR(Axis_group_engraver);