]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge branch 'master' into lilypond/translation
authorJohn Mandereau <john.mandereau@gmail.com>
Sun, 26 Aug 2007 17:01:58 +0000 (19:01 +0200)
committerJohn Mandereau <john.mandereau@gmail.com>
Sun, 26 Aug 2007 17:01:58 +0000 (19:01 +0200)
* master:
  Partially update German macros.itexi
  Calculate vertical extent of arpeggio via positions property.
  define default output-suffix
  Fix style nits.

lily/arpeggio.cc
lily/include/arpeggio.hh
ly/init.ly
scm/define-grob-properties.scm
scm/define-grobs.scm
scripts/musicxml2ly.py

index b50111762498d5b941062e4d9b9c4534115ab790..6773b846e93afe9d182999c972e4e04b44c2ddd5 100644 (file)
 #include "lookup.hh"
 #include "pointer-group-interface.hh"
 
-MAKE_SCHEME_CALLBACK (Arpeggio, print, 1);
-SCM
-Arpeggio::print (SCM smob)
+Grob *
+Arpeggio::get_common_y (Grob *me)
 {
-  Grob *me = unsmob_grob (smob);
-
   Grob *common = me;
 
   extract_grob_set (me, "stems", stems);
@@ -34,17 +31,27 @@ Arpeggio::print (SCM smob)
                                        Y_AXIS);
     }
 
+  return common;
+}
+
+MAKE_SCHEME_CALLBACK(Arpeggio, calc_positions, 1);
+SCM
+Arpeggio::calc_positions (SCM grob)
+{
+  Grob *me = unsmob_grob (grob);
+  Grob *common = get_common_y (me);
+  
   /*
     TODO:
 
     Using stems here is not very convenient; should store noteheads
     instead, and also put them into the support. Now we will mess up
     in vicinity of a collision.
-
   */
   Interval heads;
   Real my_y = me->relative_coordinate (common, Y_AXIS);
 
+  extract_grob_set (me, "stems", stems);
   for (vsize i = 0; i < stems.size (); i++)
     {
       Grob *stem = stems[i];
@@ -56,6 +63,20 @@ Arpeggio::print (SCM smob)
                   - my_y);
     }
 
+  heads *= 1/Staff_symbol_referencer::staff_space(me);
+
+  return ly_interval2scm (heads);
+}
+
+MAKE_SCHEME_CALLBACK (Arpeggio, print, 1);
+SCM
+Arpeggio::print (SCM smob)
+{
+  Grob *me = unsmob_grob (smob);
+  Interval heads = robust_scm2interval (me->get_property ("positions"),
+                                       Interval())
+    * Staff_symbol_referencer::staff_space (me);
+  
   if (heads.is_empty () || heads.length () < 0.5)
     {
       if (!to_boolean (me->get_property ("transparent")))
@@ -101,27 +122,9 @@ SCM
 Arpeggio::brew_chord_bracket (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-  Grob *common = me;
-
-  extract_grob_set (me, "stems", stems);
-  for (vsize i = 0; i < stems.size (); i++)
-    {
-      Grob *stem = stems[i];
-      common = common->common_refpoint (Staff_symbol_referencer::get_staff_symbol (stem),
-                                       Y_AXIS);
-    }
-
-  Interval heads;
-  Real my_y = me->relative_coordinate (common, Y_AXIS);
-
-  for (vsize i = 0; i < stems.size (); i++)
-    {
-      Grob *stem = stems[i];
-      Grob *ss = Staff_symbol_referencer::get_staff_symbol (stem);
-      Interval iv = Stem::head_positions (stem);
-      iv *= Staff_symbol::staff_space (ss) / 2.0;
-      heads.unite (iv + ss->relative_coordinate (common, Y_AXIS) - my_y);
-    }
+  Interval heads = robust_scm2interval (me->get_property ("positions"),
+                                       Interval())
+    * Staff_symbol_referencer::staff_space (me);
 
   Real lt = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
   Real sp = 1.5 * Staff_symbol_referencer::staff_space (me);
@@ -170,6 +173,7 @@ ADD_INTERFACE (Arpeggio,
 
               /* properties */
               "arpeggio-direction "
+              "positions "
               "stems "
               "script-priority " // TODO: make around-note-interface
               );
index c18eb10c3ebf121199adb49e120e1583f639530b..7db201bb0004f5fba9b6e7373a2125a04036d82c 100644 (file)
@@ -16,7 +16,9 @@
 class Arpeggio
 {
 public:
+  static Grob *get_common_y (Grob *);
   DECLARE_SCHEME_CALLBACK (print, (SCM));
+  DECLARE_SCHEME_CALLBACK (calc_positions, (SCM));
   DECLARE_SCHEME_CALLBACK (brew_chord_bracket, (SCM));
   DECLARE_SCHEME_CALLBACK (width, (SCM));
   DECLARE_SCHEME_CALLBACK (height, (SCM));
index 6dc602828cbdc95eee9ec3354a840b50307a9057..a4bd1c3a3985a466f1c888ac2a58e30197739ae8 100644 (file)
@@ -16,7 +16,7 @@
 #(define version-seen #f)
 #(define expect-error #f) 
 #(define output-empty-score-list #f)
-
+#(define output-suffix #f)
 #(use-modules (scm clip-region))
 \maininput
 %% there is a problem at the end of the input file
index 1319cf645d225343d4f39f149284d135534dbbd2..754ebcb00e5682ea7b6824bc86e56b244ef250cd 100644 (file)
@@ -406,11 +406,12 @@ at a column with a negative penalty.")
 whether to put a page turn at this column.  Can be @code{force} or
 @code{allow}.")
      (parenthesized ,boolean? "Parenthesize this grob.")
-     (positions ,pair? "Pair of staff coordinates @code{(@var{left}
+     (positions ,number-pair? "Pair of staff coordinates @code{(@var{left}
 . @var{right})}, where both @var{left} and @var{right} are in
-@code{staff-space} units of the current staff.  LilyPond uses these
-values to select which slur candidate positions to use; if extreme
-positions are requested, LilyPond selects the closest positions.")
+@code{staff-space} units of the current staff.
+
+For slurs, this value selects which slur candidate
+to use; if extreme positions are requested, the closest one is taken.")
 
      (ratio ,number? "Parameter for slur shape.  The higher this
 number, the quicker the slur attains its @code{height-limit}.")
index ce76c346f861aae96b3daefcb6446e497e5621f2..caf1947323d5f04f1474327f119ed930ae2d07e7 100644 (file)
        (Y-offset . ,ly:staff-symbol-referencer::callback)
        (X-offset . ,ly:side-position-interface::x-aligned-side)
        (direction . ,LEFT)
+       (positions . ,ly:arpeggio::calc-positions)
        (padding . 0.5)
        (script-priority . 0)
        (side-axis . ,X)
index 9a09fa2dc50e90150293d806c44a23ad003d875a..373dd5d1f10e25e78f84dea438388df5c6d4a91e 100644 (file)
@@ -495,9 +495,9 @@ def musicxml_voice_to_lily_voice (voice):
         
         # The <notation> element can have the following children (+ means implemented, ~ partially, - not):
         # +tied | +slur | +tuplet | glissando | slide | 
-             # ornaments | technical | articulations | dynamics |
-             # +fermata | arpeggiate | non-arpeggiate | 
-             # accidental-mark | other-notation
+        #    ornaments | technical | articulations | dynamics |
+        #    +fermata | arpeggiate | non-arpeggiate | 
+        #    accidental-mark | other-notation
         if notations:
             if notations.get_tuplet():
                 tuplet_event = notations.get_tuplet()
@@ -611,12 +611,12 @@ def musicxml_voice_to_lily_voice (voice):
 
 
 def musicxml_id_to_lily (id):
-    digits = ['Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight',
-              'Nine', 'Ten']
+    digits = ['Zero', 'One', 'Two', 'Three', 'Four', 'Five',
+              'Six', 'Seven', 'Eight', 'Nine', 'Ten']
     
-    for dig in digits:
-        d = digits.index (dig)
-        id = re.sub ('%d' % d, dig, id)
+    for digit in digits:
+        d = digits.index (digit)
+        id = re.sub ('%d' % d, digit, id)
 
     id = re.sub  ('[^a-zA-Z]', 'X', id)
     return id