+2005-08-05 Jürgen Reuter <reuter@ipd.uka.de>
+
+ * lily/ligature-engaver.cc, lily/coherent-ligature-engaver.cc,
+ lily/gregorian-ligature-engaver.cc,
+ lily/include/ligature-engraver.hh,
+ lily/include/coherent-ligature-engraver.hh,
+ lily/include/gregorian-ligature-engraver.hh: make these classes
+ truely abstract. This should fix some internal oddities such as
+ duplicate as well as dead translator/property declarations, and
+ also some dead code.
+
+ * lily/ligature-bracket-engraver.cc, lily/ligature-engraver.cc:
+ bugfix: avoid message "junking empty ligature" on ligature
+ brackets by collecting dummy grobs.
+
2005-08-05 Han-Wen Nienhuys <hanwen@xs4all.nl>
* lily/tuplet-bracket.cc (print): default right overshoot to 0.0
}
#endif
-Coherent_ligature_engraver::Coherent_ligature_engraver ()
-{
-}
-
/*
* TODO: move this function to class Item?
*/
primitive->set_property ("delta-pitch", scm_from_int (0));
}
-void
-Coherent_ligature_engraver::build_ligature (Spanner *, Array<Grob_info>)
-{
- programming_error ("Coherent_ligature_engraver::build_ligature (): "
- "this is an abstract method that should not be called, "
- "but overridden by a subclass");
-}
-
void
Coherent_ligature_engraver::typeset_ligature (Spanner *ligature,
Array<Grob_info> primitives)
collect_accidentals (ligature, primitives);
}
-#include "translator.icc"
-
-ADD_ACKNOWLEDGER (Coherent_ligature_engraver, note_head);
-ADD_ACKNOWLEDGER (Coherent_ligature_engraver, rest);
-ADD_TRANSLATOR (Coherent_ligature_engraver,
- /* descr */ "This is an abstract class. Subclasses such as Gregorian_ligature_engraver handle ligatures by glueing special ligature heads together.",
- /* creats*/ "",
- /* accepts */ "ligature-event",
- /* reads */ "",
- /* write */ "");
+// no ADD_ACKNOWLEDGER / ADD_ACKNOWLEDGER / ADD_TRANSLATOR macro calls
+// since this class is abstract
scm_from_int (prev_context_info));
}
-void
-Gregorian_ligature_engraver::transform_heads (Spanner *, Array<Grob_info>)
-{
- programming_error ("Gregorian_ligature_engraver::transform_heads (): "
- "this is an abstract method that should not be called, "
- "but overridden by a subclass");
-}
-
void
Gregorian_ligature_engraver::build_ligature (Spanner *ligature,
Array<Grob_info> primitives)
pes_or_flexa_req_ = 0;
}
-#include "translator.icc"
-
-ADD_ACKNOWLEDGER (Gregorian_ligature_engraver, rest);
-ADD_ACKNOWLEDGER (Gregorian_ligature_engraver, note_head);
-ADD_TRANSLATOR (Gregorian_ligature_engraver,
- /* descr */ "This is an abstract class. Subclasses such as Vaticana_ligature_engraver handle ligatures by glueing special ligature heads together.",
- /* creats*/ "",
- /* accepts */ "ligature-event",
- /* reads */ "",
- /* write */ "");
+// no ADD_ACKNOWLEDGER / ADD_ACKNOWLEDGER / ADD_TRANSLATOR macro calls
+// since this class is abstract
class Coherent_ligature_engraver : public Ligature_engraver
{
public:
- TRANSLATOR_DECLARATIONS (Coherent_ligature_engraver);
+ // no TRANSLATOR_DECLARATIONS (Coherent_ligature_engraver) needed
+ // since this class is abstract
protected:
virtual void build_ligature (Spanner *ligature,
- Array<Grob_info> primitives); /* abstract */
+ Array<Grob_info> primitives) = 0;
virtual void typeset_ligature (Spanner *ligature,
Array<Grob_info> primitives);
virtual void get_set_column (Item *, Paper_column *);
Music *pes_or_flexa_req_;
public:
- TRANSLATOR_DECLARATIONS (Gregorian_ligature_engraver);
+ // no TRANSLATOR_DECLARATIONS (Gregorian_ligature_engraver) needed
+ // since this class is abstract
protected:
+ Gregorian_ligature_engraver ();
virtual bool try_music (Music *);
virtual void build_ligature (Spanner *ligature, Array<Grob_info> primitives);
virtual void transform_heads (Spanner *ligature,
- Array<Grob_info> primitives); /* abstract method */
+ Array<Grob_info> primitives) = 0;
void stop_translation_timestep ();
};
#include "engraver.hh"
#include "moment.hh"
-
-/*
- * FIXME: Spanner *create_ligature_spanner () and virtual void
- * typeset_ligature (...) are abstract methods, such that we would
- * like to declare them abstract:
- *
- * virtual Spanner *create_ligature_spanner () = 0;
- * virtual void typeset_ligature (...) = 0;
- *
- * Unfortunately, clone_const_helper() (as expanded from the
- * TRANSLATOR_DECLARATIONS macro) requires this class to be
- * instantiatable, such that it may not have any abstract virtual
- * functions. As a workaround, the actually abstract methods are
- * implemented, but produce a programming_error whenever called. --jr
- */
-
class Ligature_engraver : public Engraver
{
protected:
+ Ligature_engraver ();
void stop_translation_timestep ();
virtual void finalize ();
DECLARE_ACKNOWLEDGER (note_head);
virtual bool try_music (Music *);
void process_music ();
- virtual Spanner *create_ligature_spanner (); /* abstract method */
+ virtual Spanner *create_ligature_spanner () = 0;
virtual void typeset_ligature (Spanner *ligature,
- Array<Grob_info> primitives); /* abstract method */
+ Array<Grob_info> primitives) = 0;
virtual Spanner *current_ligature ();
SCM brew_ligature_primitive_proc;
public:
- TRANSLATOR_DECLARATIONS (Ligature_engraver);
+ // no TRANSLATOR_DECLARATIONS (Ligature_engraver) needed since this
+ // class is abstract
private:
Drul_array<Music *> events_drul_;
{
protected:
virtual Spanner *create_ligature_spanner ();
+ virtual void typeset_ligature (Spanner *ligature,
+ Array<Grob_info> primitives);
DECLARE_ACKNOWLEDGER (rest);
DECLARE_ACKNOWLEDGER (note_column);
public:
return make_spanner ("LigatureBracket", SCM_EOL);
}
+void
+Ligature_bracket_engraver::typeset_ligature (Spanner *, Array<Grob_info>)
+{
+ // no real ligature to typeset; the LigatureBracket just does it
+}
+
void
Ligature_bracket_engraver::acknowledge_note_column (Grob_info info)
{
{
Tuplet_bracket::add_column (current_ligature (),
dynamic_cast<Item *> (info.grob ()));
+
+ // avoid "junking empty ligature" message by acknowledging dummy
+ // note head
+ Ligature_engraver::acknowledge_note_head (Grob_info ());
}
}
return false;
}
-Spanner *
-Ligature_engraver::create_ligature_spanner ()
-{
- programming_error ("Ligature_engraver::create_ligature_spanner (): "
- "this is an abstract method that should not be called, "
- "but overridden by a subclass");
- return 0;
-}
-
/*
* This method should do something that comes close to the following
* .ly snippet:
}
}
-void
-Ligature_engraver::typeset_ligature (Spanner *, Array<Grob_info>)
-{
- programming_error ("Ligature_engraver::typeset_ligature (): "
- "this is an abstract method that should not be called, "
- "but overridden by a subclass");
-}
-
void
Ligature_engraver::stop_translation_timestep ()
{
if (ligature_)
{
primitives_.push (info);
- info.grob ()->set_property ("print-function",
- brew_ligature_primitive_proc);
+ if (info.grob ())
+ {
+ info.grob ()->set_property ("print-function",
+ brew_ligature_primitive_proc);
+ }
}
}
}
}
-
-ADD_ACKNOWLEDGER (Ligature_engraver, rest);
-ADD_ACKNOWLEDGER (Ligature_engraver, note_head);
-ADD_TRANSLATOR (Ligature_engraver,
- /* descr */ "Abstract class; a concrete subclass handles Ligature_events by engraving Ligatures in a concrete style.",
- /* creats */ "",
- /* accepts */ "ligature-event",
- /* reads */ "",
- /* write */ "");
+// no ADD_ACKNOWLEDGER / ADD_ACKNOWLEDGER / ADD_TRANSLATOR macro calls
+// since this class is abstract