]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/vaticana-ligature-engraver.cc
texi2html: Use only one <pre class="example"> for @example -> valid HTML now
[lilypond.git] / lily / vaticana-ligature-engraver.cc
index 5618465120c02a313bbff876e9ff15e9f5c23269..414020db7a7de54ec0e816e376f23866b491e0e8 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2003--2007 Juergen Reuter <reuter@ipd.uka.de>
+  (c) 2003--2009 Juergen Reuter <reuter@ipd.uka.de>
 */
 
 #include "gregorian-ligature-engraver.hh"
@@ -13,6 +13,7 @@
 #include "international.hh"
 #include "output-def.hh"
 #include "paper-column.hh"
+#include "separation-item.hh"
 #include "spanner.hh"
 #include "staff-symbol-referencer.hh"
 #include "stream-event.hh"
@@ -105,41 +106,41 @@ bool
 Vaticana_ligature_engraver::is_stacked_head (int prefix_set,
                                             int context_info)
 {
-  bool is_stacked_b;
+  bool is_stacked;
 
   // upper head of pes is stacked upon lower head of pes ...
-  is_stacked_b = context_info & PES_UPPER;
+  is_stacked = context_info & PES_UPPER;
 
   // ... unless this note starts a flexa
   if (context_info & FLEXA_LEFT)
-    is_stacked_b = false;
+    is_stacked = false;
 
   // ... or another pes
   if (context_info & PES_LOWER)
-    is_stacked_b = false;
+    is_stacked = false;
 
   // ... or the previous note is a semivocalis or inclinatum
   if (context_info & AFTER_DEMINUTUM)
-    is_stacked_b = false;
+    is_stacked = false;
 
   // auctum head is never stacked upon preceding note
   if (prefix_set & AUCTUM)
-    is_stacked_b = false;
+    is_stacked = false;
 
   // virga is never stacked upon preceding note
   if (prefix_set & VIRGA)
-    is_stacked_b = false;
+    is_stacked = false;
 
   // oriscus is never stacked upon preceding note
   if (prefix_set & ORISCUS)
-    is_stacked_b = false;
+    is_stacked = false;
 
   if ((prefix_set & DEMINUTUM)
       && ! (prefix_set & INCLINATUM)
       && (context_info & FLEXA_RIGHT))
-    is_stacked_b = true; // semivocalis head of deminutus form
+    is_stacked = true; // semivocalis head of deminutus form
 
-  return is_stacked_b;
+  return is_stacked;
 }
 
 /*
@@ -238,8 +239,8 @@ Vaticana_ligature_engraver::align_heads (vector<Grob_info> primitives,
       if (glyph_name_scm == SCM_EOL)
        {
          primitive->programming_error ("Vaticana_ligature:"
-                                       "undefined glyph-name -> "
-                                       "ignoring grob");
+                                       " undefined glyph-name ->"
+                                       " ignoring grob");
          continue;
        }
       string glyph_name = ly_scm2string (glyph_name_scm);
@@ -253,8 +254,8 @@ Vaticana_ligature_engraver::align_heads (vector<Grob_info> primitives,
          else
            {
              primitive->programming_error ("Vaticana_ligature:"
-                                           "delta-position undefined -> "
-                                           "ignoring grob");
+                                           " delta-position undefined ->"
+                                           " ignoring grob");
              continue;
            }
        }
@@ -413,6 +414,9 @@ Vaticana_ligature_engraver::add_mora_column (Paper_column *column)
       dot->set_parent (primitive, Y_AXIS);
       primitive->set_object ("dot", dot->self_scm ());
       Dot_column::add_head (dotcol, primitive);
+
+      // FIXME: why isn't the dot picked up by Paper_column_engraver?
+      Separation_item::add_item (column, dot);
     }
 }
 
@@ -433,10 +437,10 @@ Vaticana_ligature_engraver::add_mora_column (Paper_column *column)
 void
 Vaticana_ligature_engraver::check_for_ambiguous_dot_pitch (Grob_info primitive)
 {
-  // TODO: Fix performance, which is currently O(n^2) (since this
-  // method is called O(n) times and takes O(n) steps in the for
-  // loop), but could be O(n) (by replacing the for loop by e.g. a
-  // bitmask based O(1) test); where n=<number of primitives in the
+  // TODO: Fix performance, which is currently O (n^2) (since this
+  // method is called O (n) times and takes O (n) steps in the for
+  // loop), but could be O (n) (by replacing the for loop by e.g. a
+  // bitmask based O (1) test); where n=<number of primitives in the
   // ligature> (which is typically small (n<10), though).
   Stream_event *new_cause = primitive.event_cause ();
   int new_pitch = unsmob_pitch (new_cause->get_property ("pitch"))->steps ();
@@ -480,8 +484,8 @@ Vaticana_ligature_engraver::transform_heads (Spanner *ligature,
       else
        {
          primitive->programming_error ("Vaticana_ligature:"
-                                       "delta-position undefined -> "
-                                       "ignoring grob");
+                                       " delta-position undefined ->"
+                                       " ignoring grob");
          continue;
        }
 
@@ -546,66 +550,70 @@ Vaticana_ligature_engraver::transform_heads (Spanner *ligature,
        else
          glyph_name = "vaticana.inclinatum";
       else if (prefix_set & DEMINUTUM)
-       if (i == 0)
-         {
-           // initio debilis
-           glyph_name = "vaticana.reverse.plica";
-         }
-       else if (prev_delta_pitch > 0)
-         {
-           // epiphonus
-           if (! (prev_context_info & FLEXA_RIGHT))
-             /* correct head of previous primitive */
+       {
+         if (i == 0)
+           {
+             // initio debilis
+             glyph_name = "vaticana.reverse.plica";
+           }
+         else if (prev_delta_pitch > 0)
+           {
+             // epiphonus
+             if (! (prev_context_info & FLEXA_RIGHT))
+               {
+                 /* correct head of previous primitive */
+                 if (prev_delta_pitch > 1)
+                   prev_glyph_name = "vaticana.epiphonus";
+                 else
+                   prev_glyph_name = "vaticana.vepiphonus";
+               }
              if (prev_delta_pitch > 1)
-               prev_glyph_name = "vaticana.epiphonus";
+               glyph_name = "vaticana.plica";
              else
-               prev_glyph_name = "vaticana.vepiphonus";
-           if (prev_delta_pitch > 1)
-             glyph_name = "vaticana.plica";
-           else
-             glyph_name = "vaticana.vplica";
-         }
-       else if (prev_delta_pitch < 0)
-         {
-           // cephalicus
-           if (! (prev_context_info & FLEXA_RIGHT))
-             /* correct head of previous primitive */
-             {
-               if (i > 1)
-                 {
-                   /* cephalicus head with fixed size cauda */
-                   prev_glyph_name = "vaticana.inner.cephalicus";
-                 }
-               else
-                 {
-                   /* cephalicus head without cauda */
-                   prev_glyph_name = "vaticana.cephalicus";
-                 }
-
-               /*
-                * Flexa has no variable size cauda if its left head is
-                * stacked on the right head.  This is true for
-                * cephalicus.  Hence, remove the cauda.
-                *
-                * Urgh: for the current implementation, this rule only
-                * applies for cephalicus; but it is a fundamental rule.
-                * Therefore, the following line of code should be
-                * placed somewhere else.
-                */
-               prev_primitive->set_property ("add-cauda",
-                                             ly_bool2scm (false));
-             }
-           if (prev_delta_pitch < - 1)
-             glyph_name = "vaticana.reverse.plica";
-           else
-             glyph_name = "vaticana.reverse.vplica";
-         }
-       else // (prev_delta_pitch == 0)
-         {
-           primitive->programming_error ("Vaticana_ligature:"
-                                         "deminutum head must have different "
-                                         "pitch -> ignoring grob");
-         }
+               glyph_name = "vaticana.vplica";
+           }
+         else if (prev_delta_pitch < 0)
+           {
+             // cephalicus
+             if (! (prev_context_info & FLEXA_RIGHT))
+               /* correct head of previous primitive */
+               {
+                 if (i > 1)
+                   {
+                     /* cephalicus head with fixed size cauda */
+                     prev_glyph_name = "vaticana.inner.cephalicus";
+                   }
+                 else
+                   {
+                     /* cephalicus head without cauda */
+                     prev_glyph_name = "vaticana.cephalicus";
+                   }
+
+                 /*
+                  * Flexa has no variable size cauda if its left head is
+                  * stacked on the right head.  This is true for
+                  * cephalicus.  Hence, remove the cauda.
+                  *
+                  * Urgh: for the current implementation, this rule only
+                  * applies for cephalicus; but it is a fundamental rule.
+                  * Therefore, the following line of code should be
+                  * placed somewhere else.
+                  */
+                 prev_primitive->set_property ("add-cauda",
+                                               ly_bool2scm (false));
+               }
+             if (prev_delta_pitch < - 1)
+               glyph_name = "vaticana.reverse.plica";
+             else
+               glyph_name = "vaticana.reverse.vplica";
+           }
+         else // (prev_delta_pitch == 0)
+           {
+             primitive->programming_error ("Vaticana_ligature:"
+                                           " deminutum head must have different"
+                                           " pitch -> ignoring grob");
+           }
+       }
       else if (prefix_set & (CAVUM | LINEA))
        if ((prefix_set & CAVUM) && (prefix_set & LINEA))
          glyph_name = "vaticana.linea.punctum.cavum";
@@ -672,10 +680,12 @@ Vaticana_ligature_engraver::transform_heads (Spanner *ligature,
          if ((context_info & PES_UPPER) && (context_info & STACKED_HEAD))
            {
              if (prev_glyph_name == "vaticana.punctum")
-               if (prev_delta_pitch > 1)
-                 prev_glyph_name = "vaticana.lpes";
-               else
-                 prev_glyph_name = "vaticana.vlpes";
+               {
+                 if (prev_delta_pitch > 1)
+                   prev_glyph_name = "vaticana.lpes";
+                 else
+                   prev_glyph_name = "vaticana.vlpes";
+               }
            }
        }
 
@@ -722,7 +732,16 @@ Vaticana_ligature_engraver::transform_heads (Spanner *ligature,
 ADD_ACKNOWLEDGER (Vaticana_ligature_engraver, rest);
 ADD_ACKNOWLEDGER (Vaticana_ligature_engraver, note_head);
 ADD_TRANSLATOR (Vaticana_ligature_engraver,
-               /* doc */ "Handles ligatures by glueing special ligature heads together.",
-               /* create */ "VaticanaLigature DotColumn",
-               /* read */ "",
-               /* write */ "");
+               /* doc */
+               "Handle ligatures by glueing special ligature heads together.",
+
+               /* create */
+               "VaticanaLigature "
+               "DotColumn ",
+
+               /* read */
+               "",
+
+               /* write */
+               ""
+               );