source file of the GNU LilyPond music typesetter
- (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
+ (c) 2000--2003 Jan Nieuwenhuizen <janneke@gnu.org>
*/
#include "engraver.hh"
#include "item.hh"
-#include "musical-request.hh"
+#include "event.hh"
#include "translator-group.hh"
class Voice_devnull_engraver : public Engraver
{
public:
- VIRTUAL_COPY_CONS (Translator);
+ TRANSLATOR_DECLARATIONS(Voice_devnull_engraver);
protected:
virtual bool try_music (Music *m);
virtual void acknowledge_grob (Grob_info);
};
-ADD_THIS_TRANSLATOR (Voice_devnull_engraver);
+/*
+
+ARGH .
+
+
+This really sucks.
+
+ */
static char const *eat_spanners[] = {
- "beam-interface",
+ "beam",
+ "crescendo",
+ "decrescendo",
+ "rest",
"slur",
- "tie",
- "dynamic-interface",
- "crescendo-interface",
0
};
Voice_devnull_engraver::try_music (Music *m)
{
SCM s = get_property ("devNullVoice");
-#if 0
- /* No need */
- if (gh_equal_p (s, ly_symbol2scm ("never")))
- return;
-#endif
- if (gh_equal_p (s, ly_symbol2scm ("allways"))
+ if (gh_equal_p (s, ly_symbol2scm ("always"))
|| (s == SCM_EOL
- && daddy_trans_l_->id_str_.left_str (3) == "two"
+ && daddy_trans_->id_string_.left_string (3) == "two"
&& (to_boolean (get_property ("unison"))
|| to_boolean (get_property ("unisilence")))))
{
- for (char const **p = eat_spanners; *p; p++)
+ if (m->is_mus_type ("span-event"))
{
- if (Span_req *s = dynamic_cast <Span_req *> (m))
+ SCM t = m->get_mus_property ("span-type");
+
+ for (char const **p = eat_spanners; *p; p++)
{
- if (scm_equal_p (s->get_mus_property ("span-type"),
- ly_str02scm ( *p)) == SCM_BOOL_T)
- {
- return true;
- }
+ if (t == scm_makfrom0str (*p))
+ return true;
}
}
+ /* Ugh. Should eat other events, script etc. too. */
+ else if (m->is_mus_type ("tie-event"))
+ return true;
}
return false;
}
-
+
static char const *junk_interfaces[] = {
-#if 0
"beam-interface",
-#endif
+ "dynamic-interface",
+ "hairpin-interface",
+ "multi-measure-rest-interface",
+ "script-interface",
"slur-interface",
- "tie-interface",
+ "text-interface",
"text-item-interface",
"text-script-interface",
- "dynamic-interface",
- "crescendo-interface",
+ "text-spanner-interface",
+ "tie-interface",
0
};
Voice_devnull_engraver::acknowledge_grob (Grob_info i)
{
SCM s = get_property ("devNullVoice");
-#if 0
- /* No need */
- if (gh_equal_p (s, ly_symbol2scm ("never")))
- return;
-#endif
- if (gh_equal_p (s, ly_symbol2scm ("allways"))
- || (gh_equal_p (s, ly_symbol2scm ("unisolo"))
- && daddy_trans_l_->id_str_.left_str (3) == "two"
- && (to_boolean (get_property ("unison"))
- || to_boolean (get_property ("unisilence")))))
+ if (s == ly_symbol2scm ("always")
+ || (s == SCM_EOL
+ && to_boolean (get_property ("soloADue"))
+ && ((daddy_trans_->id_string_.left_string (3) == "two"
+ && (to_boolean (get_property ("unison"))
+ || to_boolean (get_property ("unisilence"))))
+
+ /* Maybe this should be optional? */
+ || to_boolean (get_property ("othersolo")))))
+
for (char const **p = junk_interfaces; *p; p++)
- if (i.elem_l_->has_interface (ly_symbol2scm (*p)))
+ if (i.grob_->internal_has_interface (ly_symbol2scm (*p)))
{
- i.elem_l_->suicide ();
+ i.grob_->suicide ();
return;
}
}
+Voice_devnull_engraver::Voice_devnull_engraver(){}
+
+ENTER_DESCRIPTION(Voice_devnull_engraver,
+/* descr */ "Kill off certain items and spanners if we're Voice `two' and unison or unisilence is set.",
+/* creats*/ "",
+/* accepts */ "general-music", /*UGH.*/
+/* acks */ "grob-interface",
+/* reads */ "",
+/* write */ "");