]> git.donarmstrong.com Git - lilypond.git/blob - lily/axis-group-engraver.cc
release: 1.3.40
[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 #include "dimension-cache.hh"
14 #include "engraver-group-engraver.hh"
15
16 Axis_group_engraver::Axis_group_engraver ()
17 {
18   staffline_p_ = 0;
19 }
20
21 void
22 Axis_group_engraver::do_creation_processing ()
23 {
24   staffline_p_ = get_spanner_p ();
25   Axis_group_interface (staffline_p_).set_interface ();
26   Axis_group_interface (staffline_p_).set_axes (Y_AXIS, Y_AXIS);
27   staffline_p_->set_bound(LEFT,get_staff_info().command_pcol_l ());
28   announce_element (Score_element_info (staffline_p_, 0));
29 }
30
31 Spanner*
32 Axis_group_engraver::get_spanner_p () const
33 {
34   return new Spanner;
35 }
36
37 void
38 Axis_group_engraver::do_removal_processing ()
39 {
40   String name   = daddy_grav_l ()->type_str_ + "VerticalExtent";
41   SCM dims = get_property (name);
42   
43   if (gh_pair_p (dims) && gh_number_p (gh_car (dims))
44       && gh_number_p (gh_cdr (dims)))
45     {
46       staffline_p_->dim_cache_[Y_AXIS]->set_extent_callback (&Score_element::preset_extent);
47       staffline_p_->set_elt_property ("extent-Y", dims);
48     }
49   
50   staffline_p_->set_bound(RIGHT,get_staff_info().command_pcol_l ());
51   typeset_element (staffline_p_);
52   staffline_p_ = 0;
53 }
54
55 void
56 Axis_group_engraver::acknowledge_element (Score_element_info i)
57 {
58   elts_.push (i.elem_l_);
59 }
60
61 void
62 Axis_group_engraver::process_acknowledged ()
63 {
64   /* UGH UGH UGH */
65   for (int i=0; i < elts_.size (); i++)
66     {
67       Score_element *par = elts_[i]->parent_l (Y_AXIS);
68
69       if (!par || !Axis_group_interface (par).has_interface_b ())
70         Axis_group_interface (staffline_p_).add_element (elts_[i]);
71     }
72   elts_.clear ();
73 }
74
75 ADD_THIS_TRANSLATOR(Axis_group_engraver);