CVSROOT:        /cvsroot/lilypond
Module name:    lilypond
Branch:         
Changes by:     Jürgen Reuter <[EMAIL PROTECTED]>       05/08/05 21:37:15

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

Log message:
        * 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.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3974&tr2=1.3975&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/coherent-ligature-engraver.cc.diff?tr1=1.33&tr2=1.34&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/gregorian-ligature-engraver.cc.diff?tr1=1.32&tr2=1.33&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/ligature-bracket-engraver.cc.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/ligature-engraver.cc.diff?tr1=1.48&tr2=1.49&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/coherent-ligature-engraver.hh.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/gregorian-ligature-engraver.hh.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/ligature-engraver.hh.diff?tr1=1.18&tr2=1.19&r1=text&r2=text

Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3974 lilypond/ChangeLog:1.3975
--- lilypond/ChangeLog:1.3974   Fri Aug  5 20:30:21 2005
+++ lilypond/ChangeLog  Fri Aug  5 21:37:15 2005
@@ -1,3 +1,18 @@
+2005-08-05  Jürgen Reuter  <[EMAIL PROTECTED]>
+
+       * 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  <[EMAIL PROTECTED]>
 
        * lily/tuplet-bracket.cc (print): default right overshoot to 0.0
Index: lilypond/lily/coherent-ligature-engraver.cc
diff -u lilypond/lily/coherent-ligature-engraver.cc:1.33 
lilypond/lily/coherent-ligature-engraver.cc:1.34
--- lilypond/lily/coherent-ligature-engraver.cc:1.33    Tue Jul 26 22:24:30 2005
+++ lilypond/lily/coherent-ligature-engraver.cc Fri Aug  5 21:37:15 2005
@@ -105,10 +105,6 @@
   }
 #endif
 
-Coherent_ligature_engraver::Coherent_ligature_engraver ()
-{
-}
-
 /*
  * TODO: move this function to class Item?
  */
@@ -197,14 +193,6 @@
 }
 
 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 @@
   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: lilypond/lily/gregorian-ligature-engraver.cc
diff -u lilypond/lily/gregorian-ligature-engraver.cc:1.32 
lilypond/lily/gregorian-ligature-engraver.cc:1.33
--- lilypond/lily/gregorian-ligature-engraver.cc:1.32   Tue Jul 26 22:24:30 2005
+++ lilypond/lily/gregorian-ligature-engraver.cc        Fri Aug  5 21:37:15 2005
@@ -246,14 +246,6 @@
 }
 
 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 @@
   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: lilypond/lily/include/coherent-ligature-engraver.hh
diff -u lilypond/lily/include/coherent-ligature-engraver.hh:1.5 
lilypond/lily/include/coherent-ligature-engraver.hh:1.6
--- lilypond/lily/include/coherent-ligature-engraver.hh:1.5     Thu Mar 10 
14:36:12 2005
+++ lilypond/lily/include/coherent-ligature-engraver.hh Fri Aug  5 21:37:15 2005
@@ -13,11 +13,12 @@
 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: lilypond/lily/include/gregorian-ligature-engraver.hh
diff -u lilypond/lily/include/gregorian-ligature-engraver.hh:1.9 
lilypond/lily/include/gregorian-ligature-engraver.hh:1.10
--- lilypond/lily/include/gregorian-ligature-engraver.hh:1.9    Sun Jul 24 
18:58:43 2005
+++ lilypond/lily/include/gregorian-ligature-engraver.hh        Fri Aug  5 
21:37:15 2005
@@ -15,13 +15,15 @@
   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: lilypond/lily/include/ligature-engraver.hh
diff -u lilypond/lily/include/ligature-engraver.hh:1.18 
lilypond/lily/include/ligature-engraver.hh:1.19
--- lilypond/lily/include/ligature-engraver.hh:1.18     Tue Jul 26 22:24:30 2005
+++ lilypond/lily/include/ligature-engraver.hh  Fri Aug  5 21:37:15 2005
@@ -11,25 +11,10 @@
 #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 @@
   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: lilypond/lily/ligature-bracket-engraver.cc
diff -u lilypond/lily/ligature-bracket-engraver.cc:1.27 
lilypond/lily/ligature-bracket-engraver.cc:1.28
--- lilypond/lily/ligature-bracket-engraver.cc:1.27     Tue Jul 26 22:24:30 2005
+++ lilypond/lily/ligature-bracket-engraver.cc  Fri Aug  5 21:37:15 2005
@@ -21,6 +21,8 @@
 {
 protected:
   virtual Spanner *create_ligature_spanner ();
+  virtual void typeset_ligature (Spanner *ligature,
+                                Array<Grob_info> primitives);
   DECLARE_ACKNOWLEDGER (rest);
   DECLARE_ACKNOWLEDGER (note_column);
 public:
@@ -38,12 +40,22 @@
 }
 
 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)
 {
   if (current_ligature ())
     {
       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: lilypond/lily/ligature-engraver.cc
diff -u lilypond/lily/ligature-engraver.cc:1.48 
lilypond/lily/ligature-engraver.cc:1.49
--- lilypond/lily/ligature-engraver.cc:1.48     Tue Jul 26 22:24:30 2005
+++ lilypond/lily/ligature-engraver.cc  Fri Aug  5 21:37:15 2005
@@ -89,15 +89,6 @@
   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:
@@ -215,14 +206,6 @@
 }
 
 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 (finished_ligature_)
@@ -272,8 +255,11 @@
   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 @@
     }
 }
 
-
-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


_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs

Reply via email to