]> git.donarmstrong.com Git - lilypond.git/blob - lily/axis-group-engraver.cc
patch::: 1.3.18.jcn1
[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 "paper-column.hh"
12
13 ADD_THIS_TRANSLATOR (Axis_group_engraver);
14
15 Axis_group_engraver::Axis_group_engraver ()
16 {
17   staffline_p_ = 0;
18 }
19
20 void
21 Axis_group_engraver::do_creation_processing ()
22 {
23   staffline_p_ = get_spanner_p ();
24   staffline_p_->set_axes (Y_AXIS, Y_AXIS);
25   staffline_p_->set_bounds(LEFT,get_staff_info().command_pcol_l ());
26   announce_element (Score_element_info (staffline_p_, 0));
27 }
28
29 Axis_group_spanner*
30 Axis_group_engraver::get_spanner_p () const
31 {
32   return new Axis_group_spanner;
33 }
34 void
35 Axis_group_engraver::do_removal_processing ()
36 {
37   staffline_p_->set_bounds(RIGHT,get_staff_info().command_pcol_l ());
38   typeset_element (staffline_p_);
39   staffline_p_ = 0;
40 }
41
42 void
43 Axis_group_engraver::acknowledge_element (Score_element_info i)
44 {
45   elts_.push (i.elem_l_);
46 }
47
48 void
49 Axis_group_engraver::process_acknowledged ()
50 {
51   /* UGH UGH UGH */
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       else
57         if (
58             // elts_[i]->get_elt_property ("Axis_group_element::add_extra_element") == SCM_UNDEFINED &&
59             ! dynamic_cast<Axis_group_element*> (elts_[i]->parent_l (Y_AXIS)))
60                
61         {
62           staffline_p_->add_element (elts_[i]);
63         }
64     }
65   elts_.clear ();
66 }
67