lilypond-1.3.67
[lilypond.git] / lily / staff-symbol-engraver.cc
blob6440a5941436b863de259e868c27321f87c6111c
1 /*
2 staff-symbol-engraver.cc -- implement Staff_symbol_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
9 #include "staff-symbol.hh"
10 #include "score.hh"
11 #include "paper-column.hh"
12 #include "paper-def.hh"
13 #include "side-position-interface.hh"
14 #include "engraver.hh"
15 #include "moment.hh"
17 /**
18 Manage the staff symbol.
20 class Staff_symbol_engraver : public Engraver {
21 Staff_symbol *span_p_;
22 public:
23 VIRTUAL_COPY_CONS(Translator);
24 Staff_symbol_engraver();
26 protected:
27 virtual ~Staff_symbol_engraver();
29 virtual void acknowledge_element (Score_element_info);
30 virtual void do_removal_processing();
31 virtual void do_creation_processing();
36 Staff_symbol_engraver::~Staff_symbol_engraver()
38 assert (!span_p_);
41 Staff_symbol_engraver::Staff_symbol_engraver()
43 span_p_ = 0;
46 void
47 Staff_symbol_engraver::do_creation_processing()
49 span_p_ = new Staff_symbol (get_property ("staffSymbolBasicProperties"));
50 span_p_->set_bound(LEFT,unsmob_element (get_property ("currentCommandColumn")));
52 announce_element (Score_element_info (span_p_, 0));
55 void
56 Staff_symbol_engraver::do_removal_processing()
58 SCM n = get_property ("numberOfStaffLines");
59 SCM ss = get_property ("staffSpace");
61 if (gh_number_p (ss))
62 span_p_->set_elt_property ("staff-space", ss);
63 if (gh_number_p (n))
64 span_p_->set_elt_property ("line-count", n);
66 span_p_->set_bound(RIGHT,unsmob_element (get_property ("currentCommandColumn")));
67 typeset_element (span_p_);
68 span_p_ =0;
71 void
72 Staff_symbol_engraver::acknowledge_element (Score_element_info s)
74 s.elem_l_->set_elt_pointer ("staff-symbol", span_p_->self_scm_);
75 s.elem_l_->add_dependency (span_p_); // UGH. UGH. UGH
79 ADD_THIS_TRANSLATOR(Staff_symbol_engraver);