From ef05af80f4e428730c8a1a40157a8193e59e2495 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Mon, 5 Oct 2009 14:43:36 +0200 Subject: [PATCH] Allow unsetting Voice.instrumentCueName 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 | 18 ++++++++++++++++++ lily/instrument-switch-engraver.cc | 9 +++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 input/regression/instrument-cue-name.ly diff --git a/input/regression/instrument-cue-name.ly b/input/regression/instrument-cue-name.ly new file mode 100644 index 0000000000..351ec57ed6 --- /dev/null +++ b/input/regression/instrument-cue-name.ly @@ -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 +} diff --git a/lily/instrument-switch-engraver.cc b/lily/instrument-switch-engraver.cc index a2830554ed..9ca24bc95c 100644 --- a/lily/instrument-switch-engraver.cc +++ b/lily/instrument-switch-engraver.cc @@ -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; } } -- 2.39.2