2 instrument-name-engraver.cc -- implement Instrument_name_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
11 #include "pointer-group-interface.hh"
12 #include "side-position-interface.hh"
13 #include "axis-group-interface.hh"
14 #include "align-interface.hh"
16 #include "translator.icc"
18 class Instrument_name_engraver : public Engraver
21 TRANSLATOR_DECLARATIONS (Instrument_name_engraver);
24 Spanner *text_spanner_;
26 virtual void finalize ();
27 DECLARE_ACKNOWLEDGER (axis_group);
28 void process_music ();
31 Instrument_name_engraver::Instrument_name_engraver ()
37 Instrument_name_engraver::process_music ()
41 SCM long_text = get_property ("instrument");
42 SCM short_text = get_property ("instr");
44 if (! (scm_is_string (long_text)
45 || scm_is_string (short_text)))
47 long_text = get_property ("vocalName");
48 short_text = get_property ("vocNam");
51 if (scm_is_string (long_text)
52 || scm_is_string (short_text))
54 text_spanner_ = make_spanner ("InstrumentName", SCM_EOL);
55 text_spanner_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
56 text_spanner_->set_property ("text", short_text);
57 text_spanner_->set_property ("long-text", long_text);
63 Instrument_name_engraver::acknowledge_axis_group (Grob_info info)
66 && dynamic_cast<Spanner *> (info.grob ())
67 && Axis_group_interface::has_axis (info.grob (), Y_AXIS)
68 && (!Align_interface::has_interface (info.grob ())))
70 Grob *staff = info.grob();
71 Pointer_group_interface::add_grob (text_spanner_, ly_symbol2scm ("elements"), staff);
72 Side_position_interface::add_support (text_spanner_, staff);
77 Instrument_name_engraver::finalize ()
81 text_spanner_->set_bound (RIGHT,
82 unsmob_grob (get_property ("currentCommandColumn")));
86 #include "translator.icc"
88 ADD_ACKNOWLEDGER (Instrument_name_engraver, axis_group);
90 ADD_TRANSLATOR (Instrument_name_engraver,
93 "Creates a system start text for instrument or vocal names.",
101 "vocNam vocalName instrument instr "
102 "currentCommandColumn",