#include "engraver.hh"
#include "grob.hh"
#include "grob-array.hh"
+#include "international.hh"
#include "translator.icc"
public:
TRANSLATOR_DECLARATIONS (Keep_alive_together_engraver);
- DECLARE_ACKNOWLEDGER (hara_kiri_group_spanner);
+ void acknowledge_hara_kiri_group_spanner (Grob_info);
virtual void finalize ();
};
{
if (i == j)
continue;
+
+ if (scm_is_symbol (this_layer))
+ {
+ if (scm_is_eq (this_layer, ly_symbol2scm ("any")))
+ {
+ // layer is kept alive by any other layer
+ live->add (group_spanners_[j]);
+ continue;
+ }
+ else if (scm_is_eq (this_layer, ly_symbol2scm ("above")))
+ {
+ // layer is kept alive by the layer preceding it
+ if (i == j + 1)
+ live->add (group_spanners_[j]);
+ continue;
+ }
+ else if (scm_is_eq (this_layer, ly_symbol2scm ("below")))
+ {
+ // layer is kept alive by the layer following it
+ if (i == j - 1)
+ live->add (group_spanners_[j]);
+ continue;
+ }
+ else
+ {
+ group_spanners_[i]->warning (_f ("unknown remove-layer value `%s'",
+ ly_symbol2string (this_layer).c_str ()));
+ continue;
+ }
+ }
+
SCM that_layer = group_spanners_[j]->get_property ("remove-layer");
+
if (scm_is_false (that_layer))
continue;
if (!scm_is_integer (this_layer))
{
- // Unspecified layers are kept alive by anything else
+ // unset layers are kept alive by all but ignored layers
live->add (group_spanners_[j]);
continue;
}
}
}
-ADD_ACKNOWLEDGER (Keep_alive_together_engraver, hara_kiri_group_spanner);
+
+void
+Keep_alive_together_engraver::boot ()
+{
+ ADD_ACKNOWLEDGER (Keep_alive_together_engraver, hara_kiri_group_spanner);
+}
ADD_TRANSLATOR (Keep_alive_together_engraver,
/* doc */