]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/instrument-switch-engraver.cc
Doc-hu: updated top of Learning
[lilypond.git] / lily / instrument-switch-engraver.cc
index c9dce0aafb7ff1186a57d7b311027cbbb56b05a3..717d06d6776ba2119febe790733692d3011b4659 100644 (file)
@@ -1,21 +1,33 @@
 /*
-  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--2010 Han-Wen Nienhuys <hanwen@lilypond.org>
 
-  (c) 2006 Han-Wen Nienhuys <hanwen@lilypond.org>
 
+  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 <http://www.gnu.org/licenses/>.
 */
 
 #include "engraver.hh"
 #include "item.hh"
+#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_;
@@ -41,8 +53,11 @@ Instrument_switch_engraver::process_music ()
   
   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 +68,16 @@ Instrument_switch_engraver::stop_translation_time_step ()
   text_ = 0;
 }
 
-ADD_TRANSLATOR(Instrument_switch_engraver,
-              "Create a cue text for taking instrument.",
+ADD_TRANSLATOR (Instrument_switch_engraver,
+               /* doc */
+               "Create a cue text for taking instrument.",
                        
-              "InstrumentSwitch ",
+               /* create */
+               "InstrumentSwitch ",
 
-              "instrumentCueName",
+               /* read */
+               "instrumentCueName ",
                        
-              "");
+               /* write */
+               ""
+               );