]> git.donarmstrong.com Git - lilypond.git/commitdiff
* input/regression/hairpin-dashed.ly: new file.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 19 Sep 2003 01:07:39 +0000 (01:07 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 19 Sep 2003 01:07:39 +0000 (01:07 +0000)
* scripts/convert-ly.py (conv): warn about dash-length.

* lily/dynamic-engraver.cc (try_music): end (de)crescendo
automatically if we get a new one.

* lily/lookup.cc (dashed_line): new function

* lily/line-spanner.cc (dashed_line_molecule): cleanups. Use
dash-fraction.

15 files changed:
ChangeLog
Documentation/user/refman.itely
input/regression/hairpin-dashed.ly [new file with mode: 0644]
input/test/ambitus-mixed.ly
lily/arpeggio.cc
lily/breathing-sign.cc
lily/dynamic-engraver.cc
lily/hairpin.cc
lily/include/lookup.hh
lily/line-spanner.cc
lily/lookup.cc
lily/text-spanner.cc
scm/define-grob-properties.scm
scm/define-grobs.scm
scripts/convert-ly.py

index bad9fb76a4144342773a5ff07d68e6f2f03dfac7..4cd5909050722610a3cb3f8510d64b00ec92fcae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2003-09-19  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * input/regression/hairpin-dashed.ly: new file.
+
+       * scripts/convert-ly.py (conv): warn about dash-length.
+
+       * lily/dynamic-engraver.cc (try_music): end (de)crescendo
+       automatically if we get a new one.
+
+       * lily/lookup.cc (dashed_line): new function
+
+       * lily/line-spanner.cc (dashed_line_molecule): cleanups. Use
+       dash-fraction.
+
 2003-09-18  Heikki Junes  <hjunes@cc.hut.fi>
 
        * buildscripts/lilypond.words.py: extract note names.
 
 2003-09-18  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
+       * lily/breathing-sign.cc: remove railtracks() function. 
+
+       * input/regression/arpeggio-bracket.ly (texidoc): add file.
+
+       * lily/arpeggio.cc (brew_chord_bracket): clean-up 
+       (brew_molecule): bugfix don't make arpeggio shorter when
+       arpeggio-direction is set.
+
        *  debian/rules: small corrections in the (Pedro K)
 
        * Documentation/user/tutorial.itely (Tutorial): use lyinc in
index 956048b805a9e2fe7070b22caf3c498cf2b62f91..d3cd143765dfc65c639880836cbe2ab26d45981f 100644 (file)
@@ -3557,18 +3557,19 @@ making or a music identifier @code{\foo} containing the syllable
 @subsection Ambitus
 @cindex ambitus
 
-The term @emph{ambitus} denotes a range of pitches for a given voice in
-a part of music.  It also may denote the pitch range that a musical
-instrument is capable of playing.  Most musical instruments have their
-ambitus standardized (or at least there is agreement upon the minimal
-ambitus of a particular type of instrument), such that a composer or
-arranger of a piece of music can easily meet the ambitus constraints of
-the targeted instrument.  However, the ambitus of the human voice
-depends on individual physiological state, including education and
-training of the voice.  Therefore, a singer potentially has to check for
-each piece of music if the ambitus of that piece meets his individual
-capabilities.  This is why the ambitus of a piece may be of particular
-value to vocal performers.
+The term @emph{ambitus} (plural: ambituses) denotes a range of pitches
+for a given voice in a part of music.  It also may denote the pitch
+range that a musical instrument is capable of playing.  Most musical
+instruments have their ambitus standardized (or at least there is
+agreement upon the minimal ambitus of a particular type of
+instrument), such that a composer or arranger of a piece of music can
+easily meet the ambitus constraints of the targeted instrument.
+However, the ambitus of the human voice depends on individual
+physiological state, including education and training of the voice.
+Therefore, a singer potentially has to check for each piece of music
+if the ambitus of that piece meets his individual capabilities.  This
+is why the ambitus of a piece may be of particular value to vocal
+performers.
 
 The ambitus is typically notated on a per-voice basis at the very
 beginning of a piece, e.g. nearby the initial clef or time signature of
@@ -3622,7 +3623,7 @@ ambitus per staff rather than per each voice, then add the
 @internalsref{Ambitus_engraver} to the @internalsref{Staff} context
 rather than to the @internalsref{Voice} context.
 
-It is possible to tune individual ambiti for multiple voices on a
+It is possible to tune individual ambituses for multiple voices on a
 single staff, for example by erasing or shifting them horizontally. An
 example is in @inputfileref{input/test,ambitus-mixed.ly}
 
diff --git a/input/regression/hairpin-dashed.ly b/input/regression/hairpin-dashed.ly
new file mode 100644 (file)
index 0000000..d305f49
--- /dev/null
@@ -0,0 +1,7 @@
+
+\score {
+    \notes \relative c' {
+       \property Voice.Hairpin \set #'dash-fraction = #0.4
+       \property Voice.Hairpin \set #'dash-period = #1
+       f2\< g c1 d4\> b a gis\! }     
+    }
index e20da8689fb58b4f01fa2530b307a1c1d30bdf10..74e8722b155b61588cbd4991ca5a34479dc7e4fd 100644 (file)
@@ -3,7 +3,7 @@
 texidoc = "Ambituses can be switched off or translated by using
 applyoutput.
 
-If you want to mix per-voice and per-staff ambiti, then you have to
+If you want to mix per-voice and per-staff ambituses, then you have to
 define you have to declare a new context type derived from the
 @code{Voice} context or @code{Staff} context.  The derived context
 must consist of the @code{Ambitus_engraver} and it must be accepted by
index 08d9430544f0e53aa7909aa47a6d70c0831a7161..daf53c6eacffcac30e9b2c38b3ad8d901a57270b 100644 (file)
@@ -65,28 +65,31 @@ Arpeggio::brew_molecule (SCM smob)
       return SCM_EOL;
     }
 
+  SCM ad = me->get_grob_property ("arpeggio-direction");
   Direction dir = CENTER;
-  if (ly_dir_p (me->get_grob_property ("arpeggio-direction")))
+  if (ly_dir_p (ad))
     {
-      dir = to_dir (me->get_grob_property ("arpeggio-direction"));
+      dir = to_dir (ad);
     }
   
   Molecule mol;
   Font_metric *fm =Font_interface::get_default_font (me);
   Molecule squiggle = fm->find_by_name ("scripts-arpeggio");
 
-  Real arrow_space = (dir) ? Staff_symbol_referencer::staff_space (me)  : 0.0;
-  
-  Real y = heads[LEFT];
-  while (y < heads[RIGHT] - arrow_space)
+  Molecule arrow ;  
+  if (dir)
     {
-      mol.add_at_edge (Y_AXIS, UP,squiggle, 0.0, 0);
-      y+= squiggle. extent (Y_AXIS).length ();
+      arrow = fm->find_by_name ("scripts-arpeggio-arrow-" + to_string (dir));
+      heads[dir] -= dir * arrow.extent (Y_AXIS).length();
     }
+  
+  for (Real  y= heads[LEFT] ; y < heads[RIGHT];
+       y+= squiggle. extent (Y_AXIS).length ())
+      mol.add_at_edge (Y_AXIS, UP,squiggle, 0.0, 0);
+
   mol.translate_axis (heads[LEFT], Y_AXIS);
   if (dir)
-    mol.add_at_edge (Y_AXIS, dir,
-                    fm->find_by_name ("scripts-arpeggio-arrow-" + to_string (dir)), 0.0, 0);
+    mol.add_at_edge (Y_AXIS, dir,arrow, 0,0);
   
   return mol.smobbed_copy () ;
 }
@@ -125,13 +128,7 @@ Arpeggio::brew_chord_bracket (SCM smob)
   Real dy = heads.length() + sp;
   Real x = 0.7;
 
-  Molecule l1     = Lookup::line (lt, Offset(0, 0),  Offset (0, dy));
-  Molecule bottom = Lookup::line (lt, Offset(0, 0),  Offset (x, 0));
-  Molecule top    = Lookup::line (lt, Offset(0, dy), Offset (x, dy));
-  Molecule mol;
-  mol.add_molecule (l1);
-  mol.add_molecule (bottom);
-  mol.add_molecule (top);
+  Molecule mol (Lookup::bracket (Y_AXIS, Interval (0, dy), lt, x));
   mol.translate_axis (heads[LEFT] - sp/2.0, Y_AXIS);
   return mol.smobbed_copy();
 }
index bd3bc598b11b9ebf49b326e03b8c7f57936a9489..30e24dfb39fa402b10c29050d46292fa1f170dae 100644 (file)
 
   
 
-/*
-  Simplistic caesura.
- */
-MAKE_SCHEME_CALLBACK (Breathing_sign,railtracks,1);
-SCM 
-Breathing_sign::railtracks (SCM smob)
-{
-  Grob * me = unsmob_grob (smob);
-  Real space = Staff_symbol_referencer::staff_space (me);
-  Real th = me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness"));
-  SCM lt =  me->get_grob_property ("thickness");
-  if (gh_number_p (lt))
-    th *= gh_scm2double (lt);
-  
-  Offset x1 (0, -space);
-  Offset x2 (space / 3, space);
-  Molecule l1 (Lookup::line (th, x1, x2));
-  Molecule l2 (l1);
-  l2.translate_axis (space *0.6 , X_AXIS);
-  l1.add_molecule (l2);
-  return l1.smobbed_copy();
-}
-
 /*
   Gregorian chant divisio minima.  (Actually, this was the original
   breathing sign by Michael. -- jr)
index 12dc059501cc22e6ab619b5460b74e3314145cfa..3344f8753ed37cd7dac26808c2d6024cd2bf509d 100644 (file)
@@ -122,7 +122,10 @@ Dynamic_engraver::try_music (Music * m)
           || m->is_mus_type ("crescendo-event"))
     {
       Direction d = to_dir (m->get_mus_property ("span-direction"));
+
       accepted_spanreqs_drul_[d] = m;
+      if (current_cresc_ev_ && d == START)
+       accepted_spanreqs_drul_[STOP] = m;
       return true;
     }
   return false;
index af539b871b3a40cf5cd942e648c96ac54912dd07..a069fb0079aeb4838fcbcfb752a29a4ce60afc80 100644 (file)
@@ -116,16 +116,32 @@ Hairpin::brew_molecule (SCM smob)
       endh = height;
     }
 
+  /*
+    should do relative to staff-symbol staff-space?
+   */
+
+  Real period = 1.0;
+  s = me->get_grob_property ("dash-period");
+  if (gh_number_p (s))
+    period = gh_scm2double (s);
+  
+  Real fraction = 1.0;
+  s = me->get_grob_property ("dash-fraction");
+  if (gh_number_p (s))
+    fraction = gh_scm2double (s);
+  
   /*
     TODO: set line style.
    */
-  Molecule mol  = Lookup::line (thick,
+  Molecule mol  = Lookup::dashed_line (thick,
                                Offset (0, starth),
-                               Offset (width, endh));
-  mol.add_molecule (Lookup::line (thick,
+                               Offset (width, endh),
+                               period, fraction);
+  mol.add_molecule (Lookup::dashed_line (thick,
                                  Offset (0, -starth),
-                                 Offset (width, -endh)));
-                   
+                                 Offset (width, -endh),
+                                 period, fraction));
+  
   mol.translate_axis (x_points[LEFT]
                      - bounds[LEFT]->relative_coordinate (common, X_AXIS),
                      X_AXIS);
@@ -137,5 +153,5 @@ Hairpin::brew_molecule (SCM smob)
 
 ADD_INTERFACE (Hairpin, "hairpin-interface",
   "hairpin crescendo.",
-  "grow-direction thickness height if-text-padding");
+  "dash-period dash-fraction grow-direction thickness height if-text-padding");
 
index 02fcea0f8027d55c2b16b125f409304f4525d8ac..565b907ada0ba72ee0fd1eb6d2cad6c9b8cb5446 100644 (file)
@@ -33,6 +33,7 @@ struct Lookup
   static Molecule round_filled_box (Box b, Real blotdiameter);
   static Molecule repeat_slash (Real w, Real slope, Real th);
   static Molecule line (Real th, Offset from, Offset to);
+  static Molecule dashed_line (Real th, Offset from, Offset to, Real, Real);
   static Molecule horizontal_line (Interval w, Real th);
   static Molecule triangle (Interval, Real, Real);
 };
index cc5011dbb15484b26ea50e96d2ec2f24a01f4205..ba96f5dcfd2fe4e9a3a41d5af5450f40d9bbdb1d 100644 (file)
@@ -16,6 +16,7 @@
 #include "font-interface.hh"
 #include "warn.hh"
 #include "align-interface.hh"
+#include "lookup.hh"
 
 #include <math.h>
 
   grob-properties. Make arbitrary paths.
   
  */
-
-/*
-  slightishly clumsy interface?
-
-  Make  a Scheme expression for a line going from (0,0) to (dx,dy). 
- */
-
-static SCM
-line_atom (Grob *me, Real thick, Real dx, Real dy)
+Molecule
+dashed_line_molecule (Grob *me, Real thick, Offset from, Offset to)
 {
   SCM type = me->get_grob_property ("style");
-  Real staff_space = Staff_symbol_referencer::staff_space (me);
-  
-      // maybe these should be in line-thickness?
-  Real length = staff_space;
-  SCM s = me->get_grob_property ("dash-length");
-  if (gh_number_p (s))
-    length = gh_scm2double (s) * staff_space;
+  if (type == ly_symbol2scm ("dotted-line")
+      || type == ly_symbol2scm ("dashed-line"))
+    {
+      Real fraction = (type == ly_symbol2scm ("dotted-line")) ? 0.0 : 0.4;
 
-  Real period = 2 * length + thick;
-  s = me->get_grob_property ("dash-period");
-  if (gh_number_p (s))
-    period = gh_scm2double (s) * staff_space;
       
-  if (type == ly_symbol2scm ("dotted-line"))
-    length = thick;
-       
-  if (type == ly_symbol2scm ("line"))
-    length = period + thick;
+      SCM s = me->get_grob_property ("dash-fraction");
+      if (gh_number_p (s))
+       fraction = gh_scm2double (s);
+      fraction = (fraction >? 0) <? 1.0;
 
-  Real on = length - thick;
-  Real off = period - on;
-
-  SCM list = scm_list_n (ly_symbol2scm ("dashed-line"),
-                     gh_double2scm (thick),
-                     gh_double2scm (on),
-                     gh_double2scm (off),
-                     gh_double2scm (dx),
-                     gh_double2scm (dy),
-                     SCM_UNDEFINED);
+      Real period = Staff_symbol_referencer::staff_space (me);
+      s = me->get_grob_property ("dash-period");
+      if (gh_number_p (s))
+       period *= gh_scm2double (s);
 
-  return list;
+      return Lookup::dashed_line (thick, from, to, period, fraction);
+    }
+  else
+    {
+      return Lookup::line (thick, from, to);
+    }
 }
 
-static SCM
-zigzag_atom (Grob *me, Real thick, Real dx, Real dy)
+Molecule
+zigzag_molecule (Grob *me, Real thick, 
+                Offset from,
+                Offset to)
 {
+  Offset dz = to -from;
+  Real dx = dz[X_AXIS];
+  Real dy = dz[Y_AXIS];
+  
   Real staff_space = Staff_symbol_referencer::staff_space (me);
   SCM ws = me->get_grob_property ("zigzag-width");
   SCM ls = me->get_grob_property ("zigzag-length");
@@ -93,8 +84,13 @@ zigzag_atom (Grob *me, Real thick, Real dx, Real dy)
                      gh_double2scm (dx),
                      gh_double2scm (dy),
                      SCM_UNDEFINED);
-
-  return list;
+  Box b;
+  b.add_point (Offset (0,0));
+  b.add_point (dz);
+  b[X_AXIS].widen (thick/2);
+  b[Y_AXIS].widen (thick/2);
+     
+  return Molecule (b, list);
 }
 
 MAKE_SCHEME_CALLBACK(Line_spanner, after_line_breaking, 1);
@@ -138,7 +134,6 @@ Line_spanner::line_molecule (Grob *me, Real thick,
                             Offset to)
 {
   Offset dz = to -from ; 
-  Molecule mol;
   SCM type = me->get_grob_property ("style");
   if (gh_symbol_p (type)
       && (type == ly_symbol2scm ("line")
@@ -147,18 +142,9 @@ Line_spanner::line_molecule (Grob *me, Real thick,
          || type == ly_symbol2scm ("zigzag") 
          || (type == ly_symbol2scm ("trill") && dz[Y_AXIS] != 0)))
     {
-      Box b;
-      b.add_point (Offset (0,0));
-      b.add_point (dz);
-      b[X_AXIS].widen (thick/2);
-      b[Y_AXIS].widen (thick/2);
-
-      SCM atom =  (type == ly_symbol2scm ("zigzag"))
-       ? zigzag_atom (me, thick, dz[X_AXIS], dz[Y_AXIS])
-       : line_atom (me, thick, dz[X_AXIS], dz[Y_AXIS]);
-
-      mol = Molecule (b, atom);
-      mol.translate (from);
+      return  (type == ly_symbol2scm ("zigzag"))
+       ? zigzag_molecule (me, thick, from, to)
+       : dashed_line_molecule (me, thick, from, to);
     }
   else if (gh_symbol_p (type)
           && type == ly_symbol2scm ("trill"))
@@ -172,6 +158,8 @@ Line_spanner::line_molecule (Grob *me, Real thick,
                                                  gh_cons (style_alist,
                                                           alist_chain));
       Molecule m = fm->find_by_name ("scripts-trill-element");
+      Molecule mol;
+
       do
        mol.add_at_edge (X_AXIS, RIGHT, m, 0,0);
       while (m.extent (X_AXIS).length ()
@@ -186,9 +174,9 @@ Line_spanner::line_molecule (Grob *me, Real thick,
                            + mol.extent (Y_AXIS).length ())/2, Y_AXIS);
 
       mol.translate (from);
+      return mol;
     }
-
-  return mol;
+  return Molecule();
 }
 
 /*
@@ -348,6 +336,6 @@ ADD_INTERFACE (Line_spanner, "line-spanner-interface",
 "gap is measured in staff-spaces.\n"
 "The property 'type is one of: line, dashed-line, trill, dotted-line or zigzag.\n"
 "\n",
-  "gap dash-period dash-length zigzag-width zigzag-length thickness style");
+  "gap dash-period dash-fraction zigzag-width zigzag-length thickness style");
 
 
index 9eeb6cbdb9b73737d66ea47fa5bceea18731c348..9666930e3a94bbb2594d738c99d82245edac247a 100644 (file)
@@ -101,6 +101,34 @@ Lookup::line (Real th, Offset from, Offset to)
   return Molecule (box, at);
 }
 
+Molecule
+Lookup::dashed_line (Real thick, Offset from, Offset to,
+                    Real dash_period, Real dash_fraction)
+{
+  dash_fraction = (dash_fraction >? 0) <? 1.0;
+  Real on = dash_fraction * dash_period + thick; 
+  Real off = dash_period - on;
+  
+  SCM at = scm_list_n (ly_symbol2scm ("dashed-line"),
+                       gh_double2scm (thick), 
+                       gh_double2scm (on),
+                       gh_double2scm (off),
+                       gh_double2scm (to[X_AXIS] - from[X_AXIS]),
+                       gh_double2scm (to[Y_AXIS] - from[Y_AXIS]),
+                       SCM_UNDEFINED);
+  
+  Box box;
+  box.add_point (Offset (0,0));
+  box.add_point (to - from);
+
+  box[X_AXIS].widen (thick/2);
+  box[Y_AXIS].widen (thick/2);  
+
+  Molecule m = Molecule (box, at);
+  m.translate (from);
+  return m;
+}
+
 Molecule
 Lookup::horizontal_line (Interval w, Real th)
 {
index 88d20d457b71721aa580e96002ba11ae7d495964..ce660216ffb0d6174a9dac43188e74e703ccb33b 100644 (file)
@@ -172,5 +172,5 @@ Text_spanner::brew_molecule (SCM smob)
 
 ADD_INTERFACE (Text_spanner,"text-spanner-interface",
               "generic text spanner",
-              "dash-period if-text-padding dash-length edge-height bracket-flare edge-text shorten-pair style thickness enclose-bounds width-correct");
+              "dash-period if-text-padding dash-fraction edge-height bracket-flare edge-text shorten-pair style thickness enclose-bounds width-correct");
 
index 6bcb585d5336385d450bbe3c44e2ba42794d34a9..519caf96d2414f7ac0ea9cd476172443870b5366 100644 (file)
@@ -150,8 +150,8 @@ square of the inner notes involved.")
 
 (grob-property-description 'control-points list? "List of 4 offsets (number-pairs) that form control points for the  tie/slur shape.")
 (grob-property-description 'damping integer? "amount of beam slope damping should beam slope be damped? 0: no, 1: yes, 100000: horizontal beams .")
-(grob-property-description 'dash-length number? "the length of a dash.")
 (grob-property-description 'dash-period number? "the length of one dash + white space.")
+(grob-property-description 'dash-fraction number? "Size of the dashes, relative to dash-period. Should be between 0.0 (no line) and 1.0 (continuous line).")
 (grob-property-description 'dashed number? "[FIXME: use dash-period/dash length; see text-spanner] number representing the length of the dashes.")
 (grob-property-description 'descendens boolean? "is this neume of a descendent type?.")
 (grob-property-description 'de-uglify-parameters list? "list of 3 real constants. They define the valid areas for the middle control points. Used in de_uglyfy. They are a bit empirical.")
index a2d25377714be09d86a707071a5c3b4b4d05816c..b884bd8598085a8db775c0503993872a8c219bd3 100644 (file)
      . (
        (molecule-callback . ,Text_spanner::brew_molecule)
        (font-family . roman)
-       (style . line)
+       (style . dashed-line)
 
        ;; urg, only for (de)cresc. text spanners
        (if-text-padding . 1.0)
        (width-correct . -1)
+       (dash-fraction . 0.2)
+       (dash-period . 3.0)
        (direction . 1)
        (meta . ((interfaces . (text-spanner-interface side-position-interface font-interface spanner-interface))))             
        ))
        (enclose-bounds . #t)
        (width-correct . 0.0)
        (style . dashed-line)
+       (dash-fraction . 0.3)
        (edge-height . (0 . 1.5))
        (direction . 1)
        (meta . ((interfaces . (text-spanner-interface side-position-interface font-interface spanner-interface))))             
index 0a933e2b0650a7ba46e99b34bc10e0f370b045ab..bc6b6dcb2bfddbc7d65e9e38baec2f7bda720120 100644 (file)
@@ -1575,6 +1575,13 @@ conversions.append (((1,9,7), conv,
 remove \\outputproperty, move ly:verbose into ly:get-option'''))
 
 
+def conv (str):
+       if re.search ("dash-length",str):
+               sys.stderr.write ("""dash-length has been removed. Use dash-fraction instead.""")
+               raise FatalConversionError()
+       return str
+
+conversions.append (((1,9,8), conv, """dash-length -> dash-fraction""")
 
 ################################
 #      END OF CONVERSIONS