]> git.donarmstrong.com Git - lilypond.git/commitdiff
Allow unsetting Voice.instrumentCueName
authorReinhold Kainhofer <reinhold@kainhofer.com>
Mon, 5 Oct 2009 12:43:36 +0000 (14:43 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Thu, 8 Oct 2009 11:21:11 +0000 (13:21 +0200)
Don't assume that Voice.instrumentCueName is a valid markup! If it is
empty (i.e. it has been manually unset), don't create an InstrumentSwitch
grob.

input/regression/instrument-cue-name.ly [new file with mode: 0644]
lily/instrument-switch-engraver.cc

diff --git a/input/regression/instrument-cue-name.ly b/input/regression/instrument-cue-name.ly
new file mode 100644 (file)
index 0000000..351ec57
--- /dev/null
@@ -0,0 +1,18 @@
+\header {
+
+  texidoc = "The @code{Voice.instrumentCueName} property generates instrument
+names for cue notes. It can also be unset properly."
+  }
+
+\version "2.13.5"
+
+
+\relative c'' {
+  c4
+  \set Voice.instrumentCueName = "In.1"
+  c2.
+  \set Voice.instrumentCueName = "I.2"
+  c1
+  \unset Voice.instrumentCueName
+  c
+}
index a2830554ede8a30e50acfc5c8191815288d7e984..9ca24bc95c0b866d9480844761a5090e62ee60d7 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "engraver.hh"
 #include "item.hh"
+#include "text-interface.hh"
 #include "translator.icc"
 
 
@@ -41,8 +42,12 @@ 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))
+//       if (!scm_is_null (cue_text))
+        {
+          text_ = make_item ("InstrumentSwitch", SCM_EOL);
+          text_->set_property ("text", cue_text);
+        }
       cue_name_ = cue_text;
     }
 }