release commit
[lilypond.git] / lily / staff-symbol-engraver.cc
blobea7300749a7113cd29ba9c77dd12331f85826bc9
1 /*
2 staff-symbol-engraver.cc -- implement Staff_symbol_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
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 Spanner *span_;
22 public:
23 TRANSLATOR_DECLARATIONS(Staff_symbol_engraver);
25 protected:
26 virtual ~Staff_symbol_engraver ();
27 virtual void acknowledge_grob (Grob_info);
28 virtual void finalize ();
29 virtual void initialize ();
33 Staff_symbol_engraver::~Staff_symbol_engraver ()
35 assert (!span_);
38 Staff_symbol_engraver::Staff_symbol_engraver ()
40 span_ = 0;
43 void
44 Staff_symbol_engraver::initialize ()
46 span_ = new Spanner (get_property ("StaffSymbol"));
48 span_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
50 announce_grob(span_, SCM_EOL);
53 void
54 Staff_symbol_engraver::finalize ()
56 span_->set_bound (RIGHT,unsmob_grob (get_property ("currentCommandColumn")));
57 typeset_grob (span_);
58 span_ =0;
61 void
62 Staff_symbol_engraver::acknowledge_grob (Grob_info s)
64 s.grob_->set_grob_property ("staff-symbol", span_->self_scm ());
66 // remove this. probly not necessary?
67 s.grob_->add_dependency (span_); // UGH. UGH. UGH
73 ENTER_DESCRIPTION(Staff_symbol_engraver,
74 /* descr */ "create the constellation of five (default) "
75 "staff lines.",
76 /* creats*/ "StaffSymbol",
77 /* accepts */ "",
78 /* acks */ "grob-interface",
79 /* reads */ "",
80 /* write */ "");