X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finstrument-switch-engraver.cc;h=cfc3cd5c825e2ddc491048a177ad08ed668b7113;hb=a6a51abfd0195a3cf7d6ea095cf69808852f21ce;hp=a3694f075574ad8ffef4399426dd1ccd07ac0ace;hpb=a276a19dc6bd57832db3107f2f2cbb04cb4677b6;p=lilypond.git diff --git a/lily/instrument-switch-engraver.cc b/lily/instrument-switch-engraver.cc index a3694f0755..cfc3cd5c82 100644 --- a/lily/instrument-switch-engraver.cc +++ b/lily/instrument-switch-engraver.cc @@ -1,31 +1,51 @@ /* - instrument-switch-engraver.cc -- implement + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 2006--2015 Han-Wen Nienhuys - (c) 2006--2007 Han-Wen Nienhuys + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include "engraver.hh" #include "item.hh" -#include "translator.icc" +#include "text-interface.hh" +#include "translator.icc" class Instrument_switch_engraver : public Engraver { - TRANSLATOR_DECLARATIONS(Instrument_switch_engraver); + TRANSLATOR_DECLARATIONS (Instrument_switch_engraver); protected: Grob *text_; SCM cue_name_; void stop_translation_time_step (); void process_music (); + + virtual void derived_mark () const; }; +void +Instrument_switch_engraver::derived_mark () const +{ + scm_gc_mark (cue_name_); +} -Instrument_switch_engraver::Instrument_switch_engraver () +Instrument_switch_engraver::Instrument_switch_engraver (Context *c) + : Engraver (c) { cue_name_ = SCM_EOL; text_ = 0; @@ -38,11 +58,14 @@ void Instrument_switch_engraver::process_music () { SCM cue_text = get_property ("instrumentCueName"); - + if (!scm_is_eq (cue_name_, cue_text)) { - text_ = make_item ("InstrumentSwitch", SCM_EOL); - text_->set_property ("text", cue_text); + if (Text_interface::is_markup (cue_text)) + { + text_ = make_item ("InstrumentSwitch", SCM_EOL); + text_->set_property ("text", cue_text); + } cue_name_ = cue_text; } } @@ -53,11 +76,22 @@ Instrument_switch_engraver::stop_translation_time_step () text_ = 0; } -ADD_TRANSLATOR(Instrument_switch_engraver, - "Create a cue text for taking instrument.", - - "InstrumentSwitch ", +void +Instrument_switch_engraver::boot () +{ + +} + +ADD_TRANSLATOR (Instrument_switch_engraver, + /* doc */ + "Create a cue text for taking instrument.", + + /* create */ + "InstrumentSwitch ", + + /* read */ + "instrumentCueName ", - "instrumentCueName", - - ""); + /* write */ + "" + );