2 axis-group-engraver.cc -- implement Axis_group_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "axis-group-engraver.hh"
11 #include "paper-column.hh"
12 #include "axis-group-interface.hh"
14 #include "engraver-group-engraver.hh"
16 Axis_group_engraver::Axis_group_engraver ()
22 Axis_group_engraver::do_creation_processing ()
24 staffline_p_
= get_spanner_p ();
25 Axis_group_interface::set_interface (staffline_p_
);
26 Axis_group_interface::set_axes (staffline_p_
, Y_AXIS
, Y_AXIS
);
28 Score_element
* it
= unsmob_element (get_property ("currentCommandColumn"));
29 Pointer_group_interface (it
, "bounded-by-me").add_element (staffline_p_
);
30 staffline_p_
->set_bound(LEFT
,it
);
32 announce_element (Score_element_info (staffline_p_
, 0));
36 Axis_group_engraver::get_spanner_p () const
38 return new Spanner (get_property ("basicVerticalAxisGroupProperties"));
42 Axis_group_engraver::do_removal_processing ()
44 String type
= daddy_grav_l ()->type_str_
;
45 SCM dims
= get_property ((type
+ "VerticalExtent").ch_C());
47 if (gh_pair_p (dims
) && gh_number_p (gh_car (dims
))
48 && gh_number_p (gh_cdr (dims
)))
50 staffline_p_
->set_extent_callback (&Score_element::preset_extent
, Y_AXIS
);
51 staffline_p_
->set_elt_property ("extent-Y", dims
);
54 dims
= get_property ((type
+ "MinimumVerticalExtent").ch_C());
55 if (gh_pair_p (dims
) && gh_number_p (gh_car (dims
))
56 && gh_number_p (gh_cdr (dims
)))
57 staffline_p_
->set_elt_property ("minimum-extent-Y", dims
);
59 dims
= get_property ((type
+ "ExtraVerticalExtent").ch_C());
60 if (gh_pair_p (dims
) && gh_number_p (gh_car (dims
))
61 && gh_number_p (gh_cdr (dims
)))
62 staffline_p_
->set_elt_property ("extra-extent-Y", dims
);
64 Score_element
* it
= unsmob_element (get_property ("currentCommandColumn"));
66 Pointer_group_interface (it
, "bounded-by-me").add_element (staffline_p_
);
67 staffline_p_
->set_bound(RIGHT
,it
);
69 typeset_element (staffline_p_
);
74 Axis_group_engraver::acknowledge_element (Score_element_info i
)
76 elts_
.push (i
.elem_l_
);
80 Axis_group_engraver::process_acknowledged ()
83 for (int i
=0; i
< elts_
.size (); i
++)
85 Score_element
*par
= elts_
[i
]->parent_l (Y_AXIS
);
87 if ((!par
|| !Axis_group_interface::has_interface (par
))
88 && ! elts_
[i
]->empty_b (Y_AXIS
))
89 Axis_group_interface::add_element (staffline_p_
, elts_
[i
]);
94 ADD_THIS_TRANSLATOR(Axis_group_engraver
);