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"
15 #include "text-interface.hh"
17 #include "translator.icc"
19 class Instrument_name_engraver : public Engraver
22 TRANSLATOR_DECLARATIONS (Instrument_name_engraver);
25 Spanner *text_spanner_;
27 virtual void finalize ();
28 DECLARE_ACKNOWLEDGER (axis_group);
29 void process_music ();
32 Instrument_name_engraver::Instrument_name_engraver ()
38 Instrument_name_engraver::process_music ()
42 SCM long_text = get_property ("instrument");
43 SCM short_text = get_property ("instr");
45 if (!(Text_interface::is_markup (long_text)
46 || Text_interface::is_markup (short_text)))
48 long_text = get_property ("vocalName");
49 short_text = get_property ("vocNam");
52 if (Text_interface::is_markup (long_text)
53 || Text_interface::is_markup (short_text))
55 text_spanner_ = make_spanner ("InstrumentName", SCM_EOL);
56 text_spanner_->set_bound (LEFT,
57 unsmob_grob (get_property ("currentCommandColumn")));
58 text_spanner_->set_property ("text", short_text);
59 text_spanner_->set_property ("long-text", long_text);
65 Instrument_name_engraver::acknowledge_axis_group (Grob_info info)
68 && dynamic_cast<Spanner *> (info.grob ())
69 && Axis_group_interface::has_axis (info.grob (), Y_AXIS)
70 && (!Align_interface::has_interface (info.grob ())))
72 Grob *staff = info.grob();
73 Pointer_group_interface::add_grob (text_spanner_, ly_symbol2scm ("elements"), staff);
74 Side_position_interface::add_support (text_spanner_, staff);
79 Instrument_name_engraver::finalize ()
83 text_spanner_->set_bound (RIGHT,
84 unsmob_grob (get_property ("currentCommandColumn")));
88 #include "translator.icc"
90 ADD_ACKNOWLEDGER (Instrument_name_engraver, axis_group);
92 ADD_TRANSLATOR (Instrument_name_engraver,
95 "Creates a system start text for instrument or vocal names.",
103 "vocNam vocalName instrument instr "
104 "currentCommandColumn",