]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/ligature-engaver.cc, lily/coherent-ligature-engaver.cc,
authorreuter <reuter>
Fri, 5 Aug 2005 21:37:15 +0000 (21:37 +0000)
committerreuter <reuter>
Fri, 5 Aug 2005 21:37:15 +0000 (21:37 +0000)
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.

ChangeLog
lily/coherent-ligature-engraver.cc
lily/gregorian-ligature-engraver.cc
lily/include/coherent-ligature-engraver.hh
lily/include/gregorian-ligature-engraver.hh
lily/include/ligature-engraver.hh
lily/ligature-bracket-engraver.cc
lily/ligature-engraver.cc

index 3bf1d552f1537ec688ac853070c6ea8455ab9e77..daa9720efd0087d3dd7274fbe9987592e9dae9cc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+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
index 0d777f37540a81b3772d6a58629d6368b88181f0..ed89983026c048ae4585a91f757a1a50b56b8d51 100644 (file)
@@ -105,10 +105,6 @@ if (incr_scm != SCM_EOL) /* (Paper_column::is_musical (l)) */
   }
 #endif
 
-Coherent_ligature_engraver::Coherent_ligature_engraver ()
-{
-}
-
 /*
  * TODO: move this function to class Item?
  */
@@ -196,14 +192,6 @@ compute_delta_pitches (Array<Grob_info> primitives)
   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)
@@ -217,13 +205,5 @@ Coherent_ligature_engraver::typeset_ligature (Spanner *ligature,
   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
index a38c9ef095c25824e3b5c7ff8306fa0452e52f68..29690da2f9f2261e293681431bcb24d3a77eeed9 100644 (file)
@@ -245,14 +245,6 @@ provide_context_info (Array<Grob_info> primitives)
                                  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)
@@ -273,13 +265,5 @@ Gregorian_ligature_engraver::stop_translation_timestep ()
   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
index c90677aac736961647ae2f1e984fc1cdd1fa60e1..6fcbdd62447e766f3362933208354a2fd1f1d08a 100644 (file)
 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 *);
index efcb73ae16e8840d47ad179b38f21d269c9d5295..9a8ae4c217b6d089e24c28541ce4de26f3993d3f 100644 (file)
@@ -15,13 +15,15 @@ class Gregorian_ligature_engraver : public Coherent_ligature_engraver
   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 ();
 };
 
index 80c8537af6458c0f881fbdaffe6177fdee482768..ce3cba4aa88db8c06b2bcfb3ef02ac1c0214f93c 100644 (file)
 #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 ();
 
@@ -38,14 +23,15 @@ protected:
   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_;
index b483f660586b841715d7ae76d18d640d8fd7292b..13a9e72ccb1b1953c54f2509933b4a0c6802c9f6 100644 (file)
@@ -21,6 +21,8 @@ class Ligature_bracket_engraver : public Ligature_engraver
 {
 protected:
   virtual Spanner *create_ligature_spanner ();
+  virtual void typeset_ligature (Spanner *ligature,
+                                Array<Grob_info> primitives);
   DECLARE_ACKNOWLEDGER (rest);
   DECLARE_ACKNOWLEDGER (note_column);
 public:
@@ -37,6 +39,12 @@ Ligature_bracket_engraver::create_ligature_spanner ()
   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)
 {
@@ -44,6 +52,10 @@ 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 ());
     }
 }
 
index d200e65ba3357063ae091546c776f3933545cb02..e13798034b16a7cdb858130a665b197f9cd21e86 100644 (file)
@@ -89,15 +89,6 @@ Ligature_engraver::try_music (Music *m)
   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:
@@ -214,14 +205,6 @@ Ligature_engraver::process_music ()
     }
 }
 
-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 ()
 {
@@ -272,8 +255,11 @@ Ligature_engraver::acknowledge_note_head (Grob_info info)
   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);
+       }
     }
 }
 
@@ -289,12 +275,5 @@ Ligature_engraver::acknowledge_rest (Grob_info info)
     }
 }
 
-
-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