]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/hairpin.cc: use Line_interface
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 18 Jan 2004 19:29:01 +0000 (19:29 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 18 Jan 2004 19:29:01 +0000 (19:29 +0000)
* lily/line-interface.cc: new file. Line_interface for everything
with dotted/dashed lines.

* lily/tuplet-bracket.cc (make_bracket): use Line_interface.

* lily/ottava-bracket.cc (brew_molecule): new file, separate routine
for constructing ottava brackets.

* lily/ottava-engraver.cc (acknowledge_grob): hang the bracket on
the note heads.

* Documentation/user/internals.itely (Engravers and performers):
fix broken link.

* scm/music-functions.scm (make-mark-set): new function.

* lily/lookup.cc: remove Lookup::horizontal_slope (): it is
functionally identical to beam.

* lily/mensural-ligature.cc (brew_flexa): replace horizontal_slope
() with beam ().

* Documentation/user/refman.itely (Rehearsal marks): document new
functionality.

22 files changed:
ChangeLog
Documentation/user/internals.itely
Documentation/user/refman.itely
input/regression/ottava.ly
lily/directional-element-interface.cc
lily/hairpin.cc
lily/include/lily-guile.hh
lily/include/line-interface.hh [new file with mode: 0644]
lily/include/lookup.hh
lily/include/tuplet-bracket.hh
lily/lily-guile.cc
lily/line-interface.cc [new file with mode: 0644]
lily/line-spanner.cc
lily/lookup.cc
lily/mensural-ligature.cc
lily/ottava-bracket.cc [new file with mode: 0644]
lily/ottava-engraver.cc
lily/text-spanner.cc
lily/tuplet-bracket.cc
lily/volta-bracket.cc
scm/define-grobs.scm
scm/music-functions.scm

index a74997b4c5e25359a3c102084c25d9578e68efb3..c3ee2c36a8c0d54fe359791136efab0afa398204 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,30 @@
 2004-01-18  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * lily/hairpin.cc: use Line_interface
+
+       * lily/line-interface.cc: new file. Line_interface for everything
+       with dotted/dashed lines.
+       
+
+       * lily/tuplet-bracket.cc (make_bracket): use Line_interface.
+
+       * lily/ottava-bracket.cc (brew_molecule): new file, separate routine
+       for constructing ottava brackets.
+       
+       * lily/ottava-engraver.cc (acknowledge_grob): hang the bracket on
+       the note heads.
+
+       * Documentation/user/internals.itely (Engravers and performers):
+       fix broken link.
+
+       * scm/music-functions.scm (make-mark-set): new function.
+
+       * lily/lookup.cc: remove Lookup::horizontal_slope (): it is
+       functionally identical to beam.
+
+       * lily/mensural-ligature.cc (brew_flexa): replace horizontal_slope
+       () with beam (). 
+
        * Documentation/user/refman.itely (Rehearsal marks): document new
        functionality.
 
index 9d35ceb79a1f5eaa87e23c31d84ef5ce490c4632..3fed2a848b18d49704abf2b4603aa94d84ebc2dc 100644 (file)
@@ -452,7 +452,7 @@ the central C is at its default position, the center line:
 @end lilypond
 
 A list of all engravers is in the internal documentation,
-see @internalsref{All engravers}.
+see @internalsref{Engravers}.
 
 @node Defining new contexts
 @subsection Defining new contexts
index c8bd42b319a8d3f0e5503fe936844dc92fa8e068..3a798e564a183b7b2c9dcd191c7af39f068ac050 100644 (file)
@@ -356,10 +356,6 @@ direction manually:
 
 Internals: @internalsref{Dots}, and @internalsref{DotColumn}. 
 
-@refbugs
-
-In dense chords, dots can overlap.
-
 @node Stems
 @subsection Stems
 
@@ -504,10 +500,16 @@ instead.
 
 Internals: @internalsref{TupletBracket}, and @internalsref{TimeScaledMusic}.
 
+Examples: @inputfileref{input/regression,tuplet-nest.ly}.
+
 @refbugs
 
 Nested tuplets are not formatted automatically.  In this case, outer
-tuplet brackets should be moved manually.
+tuplet brackets should be moved manually, which is demonstrated in
+@inputfileref{input/regression,tuplet-nest.ly}.
+
+
+
 
 @node Easy Notation note heads
 @subsection Easy Notation note heads
@@ -2149,7 +2151,7 @@ Internals: @internalsref{ScriptEvent}, and @internalsref{Script}.
 
 @refbugs
 
- These note ornaments appear in the printed output but have no
+These note ornaments appear in the printed output but have no
 effect on the MIDI rendering of the music.
 
 
@@ -2373,8 +2375,6 @@ Internals: @internalsref{GraceMusic}.
 
 @refbugs
 
-Grace notes cannot be used in the smallest size (@file{paper11.ly}).
-
 A score that starts with an @code{\grace} section needs an explicit
 @code{\context Voice} declaration, otherwise the main note and grace
 note end up on different staves.
@@ -2392,9 +2392,6 @@ Grace sections should only be used within sequential music
 expressions.  Nesting or juxtaposing grace sections is not supported,
 and might produce crashes or other errors.
 
-Overriding settings cannot be done in separate styles for appoggiatura
-and acciaccatura.
-
 
 @node Glissando
 @subsection Glissando
@@ -3136,7 +3133,8 @@ handle this cross-staffing behavior.  In this section we discuss the
 There is no support for putting chords across staves.  You can get
 this result by increasing the length of the stem in the lower stave so
 it reaches the stem in the upper stave, or vice versa. An example is
-included with the distribution as @inputfileref{input/test,stem-cross-staff.ly}.
+included with the distribution as
+@inputfileref{input/test,stem-cross-staff.ly}.
 
 Dynamics are not centered, but kludges do exist. See
 @inputfileref{input/template,piano-dynamics.ly}.
@@ -3546,8 +3544,7 @@ Examples: @inputfileref{input/template,satb.ly},
  
 @refbugs
 
-@code{\lyricsto} is not automatic enough: melismata are not detected
-automatically, and melismata are not stopped when they hit a rest.
+Melismata are not detected automatically, and must be inserted by hand.
 
 
 @node More stanzas
@@ -4188,6 +4185,9 @@ To print a  rehearsal mark, use the @code{\mark} command:
 }
 @end lilypond
 
+@noindent
+(The letter I is skipped in accordance with engraving traditions.)
+
 The mark is incremented automatically if you use @code{\mark
 \default}, but you can also use an integer argument to set the mark
 manually.  The value to use is stored in the property
@@ -4199,7 +4199,7 @@ as argument. It should return a markup object. In the following
 example, @code{markFormatter} is set to a canned procedure. After a
 few measures, it is set to function that produces a boxed number. 
 
-@lilypond[verbatim,fragment,relative 2]
+@lilypond[verbatim,fragment,relative 1]
   \property Score.markFormatter = #format-mark-numbers 
   c1 \mark \default
   c1 \mark \default
@@ -8035,7 +8035,7 @@ added to LilyPond.
 @refbugs
 
 There is no style sheet provided for other fonts besides the @TeX{}
-family.
+Computer Modern family.
 
 @cindex font selection
 @cindex font magnification
index 922d7a79b20fc59243fa3147dd977936c500d8b7..d8011816eb0ca3d424a02798a9ea94f90ce8ac44 100644 (file)
@@ -43,9 +43,10 @@ with @code{Staff.ottavation}.
   a b c a
   #(set-octavation 0)
   #(set-octavation -1)
-  a b c a
+  a b c a 
   #(set-octavation 0)
-  a,
+  \break
+  a, 
   #(set-octavation 1)
   \property Staff.ottavation = #"8"
   b
@@ -53,7 +54,10 @@ with @code{Staff.ottavation}.
   c a 
   #(set-octavation -1) b a g 
   #(set-octavation 0)
-  c
+  c 
+  #(set-octavation -1)
+  \property Staff.ottavation = #"8"
+  c,,16
 }
 }
 
index 230bcc8cd0689289ea4ccd3de46c851523f9d4e1..499d82803657f23e8cfb39dcb11775efa9049315 100644 (file)
@@ -1,5 +1,5 @@
 /*   
-  directional-element.cc -- implement Directional_element
+  directional-element-interface.cc -- implement Directional_element
   
   source file of the GNU LilyPond music typesetter
   
index ab3dabeee300936800fa2895da734d2288293a36..8dc7cda20d4c327b5889a5e037eaf679c7aec8ba 100644 (file)
@@ -7,6 +7,7 @@
 */
 
 #include "molecule.hh"
+#include "line-interface.hh"
 #include "hairpin.hh"
 #include "spanner.hh"
 #include "font-interface.hh"
@@ -120,41 +121,16 @@ Hairpin::brew_molecule (SCM smob)
     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;
-  if (fraction < 1.0)
-    {
-      mol  = Lookup::dashed_line (thick,
-                                 Offset (0, starth),
-                                 Offset (width, endh),
-                                 period, fraction);
-      mol.add_molecule (Lookup::dashed_line (thick,
-                                            Offset (0, -starth),
-                                            Offset (width, -endh),
-                                            period, fraction));
-    }
-  else
-    {
-      mol  = Lookup::line (thick,
-                          Offset (0, starth),
-                          Offset (width, endh));
-      mol.add_molecule (Lookup::line (thick,
-                                     Offset (0, -starth),
-                                     Offset (width, -endh)
-                                     ));
-    }
+  mol  = Line_interface::dashed_line (me,
+                                     thick,
+                                     Offset (0, starth),
+                                     Offset (width, endh));
+  mol.add_molecule (Line_interface::dashed_line (me,
+                                                thick,
+                                                Offset (0, -starth),
+                                                Offset (width, -endh)));
+
   mol.translate_axis (x_points[LEFT]
                      - bounds[LEFT]->relative_coordinate (common, X_AXIS),
                      X_AXIS);
@@ -165,5 +141,5 @@ Hairpin::brew_molecule (SCM smob)
 
 ADD_INTERFACE (Hairpin, "hairpin-interface",
   "hairpin crescendo.",
-  "dash-period dash-fraction grow-direction thickness height if-text-padding");
+  "grow-direction height if-text-padding");
 
index f0c82421f2876e13195ccf17d1a4f3b2884b5085..613099e24e26c84a9bf7ad4101f22e9c780bd6b0 100644 (file)
@@ -159,7 +159,9 @@ Interval ly_scm2interval (SCM);
 Slice int_list_to_slice (SCM l);
 SCM ly_interval2scm (Drul_array<Real>);
 
-
+Real robust_scm2double (SCM, double);
+Drul_array<Real> robust_scm2interval (SCM, Drul_array<Real>);
+Offset robust_scm2offset (SCM, Offset);
 
 SCM ly_quote_scm (SCM s);
 bool type_check_assignment (SCM val, SCM sym,  SCM type_symbol) ;
diff --git a/lily/include/line-interface.hh b/lily/include/line-interface.hh
new file mode 100644 (file)
index 0000000..f81d9f6
--- /dev/null
@@ -0,0 +1,24 @@
+/*   
+line-interface.hh -- declare 
+
+source file of the GNU LilyPond music typesetter
+
+(c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ */
+
+#ifndef LINE_INTERFACE_HH
+#define LINE_INTERFACE_HH
+
+#include "lily-proto.hh"
+
+struct Line_interface
+{
+  static Molecule dashed_line (Grob *me, Real thick, Offset from, Offset to);
+  static bool has_interface (Grob*);
+  static Molecule make_dashed_line (Real th, Offset from, Offset to, Real, Real);
+
+};
+#endif /* LINE_INTERFACE_HH */
+
+
index 43d5f68761593804c7ce971bf87d89593917be34..959b278a8dac17bf47caa6d648077028943fc041 100644 (file)
@@ -25,7 +25,6 @@ struct Lookup
   static Molecule frame (Box b, Real thick, Real blot);
   static Molecule slur (Bezier controls, Real cthick, Real thick);
   static Molecule bezier_sandwich (Bezier top_curve, Bezier bottom_curve);
-  static Molecule horizontal_slope (Real width, Real slope, Real height);
   static Molecule beam (Real slope, Real width, Real thick, Real blot);
   static Molecule dashed_slur (Bezier, Real thick, Real dash);
   static Molecule blank (Box b);
@@ -33,7 +32,6 @@ 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 b0095c6d23b28cd58dae4ff38cb1cf60247449e0..46ff0bd0069c78f1faef34cbf244a9e74912e356 100644 (file)
@@ -32,8 +32,8 @@ public:
   DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM ));
 
   DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM ));
-  static Molecule make_bracket (Axis protusion_axis,
-                               Real dx, Real dy, Real thick, Drul_array<Real> height,
+  static Molecule make_bracket (Grob *me,  Axis protusion_axis,
+                               Offset dz, Real thick, Drul_array<Real> height,
                                Real gap, Drul_array<Real> widen,
                                Drul_array<Real> shorten);
   static Direction get_default_dir (Grob*);
index b448a6396c4f95c262d00d004f28a5c8c432f92a..c7641e7447288fd1743309ec6aefb3bd45807fd6 100644 (file)
@@ -714,3 +714,29 @@ robust_list_ref(int i, SCM l)
   return gh_car(l);
 }
 
+
+
+Real
+robust_scm2double (SCM k, double x)
+{
+  if (gh_number_p (k))
+    x = gh_scm2double (k);
+  return x;
+}
+
+Drul_array<Real>
+robust_scm2interval (SCM k, Drul_array<Real> v)
+{
+  if (is_number_pair (k))
+    v = ly_scm2interval (k);
+  return v;
+}
+
+Offset
+robust_scm2offset (SCM k, Offset o)
+{
+  if (is_number_pair (k))
+    o = ly_scm2offset (k);
+
+  return o;
+}
diff --git a/lily/line-interface.cc b/lily/line-interface.cc
new file mode 100644 (file)
index 0000000..cac08cc
--- /dev/null
@@ -0,0 +1,76 @@
+/*   
+line-interface.cc --  implement Line_interface
+
+source file of the GNU LilyPond music typesetter
+
+(c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ */
+
+#include "line-interface.hh"
+#include "molecule.hh"
+#include "grob.hh"
+#include "staff-symbol-referencer.hh"
+#include "lookup.hh"
+
+
+
+Molecule
+Line_interface::make_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;
+}
+/*
+  TODO: read THICK from ME
+ */
+Molecule
+Line_interface::dashed_line (Grob *me, Real thick, Offset from, Offset to)
+{
+  SCM type = me->get_grob_property ("style");
+  if (type == ly_symbol2scm ("dotted-line")
+      || type == ly_symbol2scm ("dashed-line"))
+    {
+      Real fraction =
+       robust_scm2double (me->get_grob_property ("dash-fraction"),
+                          (type == ly_symbol2scm ("dotted-line")) ? 0.0 : 0.4);
+
+      fraction = (fraction >? 0) <? 1.0;
+      Real period = Staff_symbol_referencer::staff_space (me)
+       * robust_scm2double (me->get_grob_property ("dash-period"), 1.0);
+
+      if (period < 0)
+       return Molecule ();
+       
+      return make_dashed_line (thick, from, to, period, fraction);
+    }
+  else
+    {
+      return Lookup::line (thick, from, to);
+    }
+}
+
+ADD_INTERFACE(Line_interface, "line-interface",
+             "Generic line objects. Any object using lines supports this. ",
+             "dash-period dash-fraction thickness style")
index c47196d1f558429790ad89eb97ea75d8a2612af3..c6b0ff9df89eb8ad76c0b15683140976a4241f93 100644 (file)
@@ -6,6 +6,8 @@
   (c) 2000--2003 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
+#include <math.h>
+
 #include "molecule.hh"
 #include "item.hh"
 #include "spanner.hh"
@@ -17,8 +19,7 @@
 #include "warn.hh"
 #include "align-interface.hh"
 #include "lookup.hh"
-
-#include <math.h>
+#include "line-interface.hh"
 
 /*
   TODO: convert all Molecule functions to taking arguments of the form
   grob-properties. Make arbitrary paths.
   
  */
-Molecule
-dashed_line_molecule (Grob *me, Real thick, Offset from, Offset to)
-{
-  SCM type = me->get_grob_property ("style");
-  if (type == ly_symbol2scm ("dotted-line")
-      || type == ly_symbol2scm ("dashed-line"))
-    {
-      Real fraction = (type == ly_symbol2scm ("dotted-line")) ? 0.0 : 0.4;
 
-      
-      SCM s = me->get_grob_property ("dash-fraction");
-      if (gh_number_p (s))
-       fraction = gh_scm2double (s);
-
-      fraction = (fraction >? 0) <? 1.0;
-
-      Real period = Staff_symbol_referencer::staff_space (me);
-      s = me->get_grob_property ("dash-period");
-      if (gh_number_p (s))
-       period *= gh_scm2double (s);
-
-      if (period < 0)
-       return Molecule ();
-       
-      return Lookup::dashed_line (thick, from, to, period, fraction);
-    }
-  else
-    {
-      return Lookup::line (thick, from, to);
-    }
-}
 
 Molecule
 zigzag_molecule (Grob *me, Real thick, 
@@ -148,7 +119,7 @@ Line_spanner::line_molecule (Grob *me, Real thick,
     {
       return  (type == ly_symbol2scm ("zigzag"))
        ? zigzag_molecule (me, thick, from, to)
-       : dashed_line_molecule (me, thick, from, to);
+       : Line_interface::dashed_line (me, thick, from, to);
     }
   else if (gh_symbol_p (type)
           && type == ly_symbol2scm ("trill"))
@@ -340,6 +311,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-fraction zigzag-width zigzag-length thickness style");
+  "gap zigzag-width zigzag-length thickness");
 
 
index 0e8a40acb8bd597f10739d5b72ffeebe10319ebc..4bb7c2d8a6be10202d00f0d628797283a34d0c38 100644 (file)
@@ -39,6 +39,25 @@ Lookup::dot (Offset p, Real radius)
   return Molecule (box, at);
 }
 
+
+
+/*
+ * Horizontal Slope:
+ *
+ *            /|   ^
+ *           / |   |
+ *          /  |   | height
+ *         /   |   |
+ *        /    |   v
+ *       |    /
+ *       |   /
+ * (0,0) x  /slope=dy/dx
+ *       | /
+ *       |/
+ *
+ *       <----->
+ *        width
+ */
 Molecule 
 Lookup::beam (Real slope, Real width, Real thick, Real blot) 
 {
@@ -99,33 +118,6 @@ 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)
@@ -479,37 +471,6 @@ Lookup::bezier_sandwich (Bezier top_curve, Bezier bottom_curve)
   return Molecule (b, horizontal_bend);
 }
 
-/*
- * Horizontal Slope:
- *
- *            /|   ^
- *           / |   |
- *          /  |   | height
- *         /   |   |
- *        /    |   v
- *       |    /
- *       |   /
- * (0,0) x  /slope=dy/dx
- *       | /
- *       |/
- *
- *       <----->
- *        width
- */
-Molecule
-Lookup::horizontal_slope (Real width, Real slope, Real height)
-{
-  SCM width_scm = gh_double2scm (width);
-  SCM slope_scm = gh_double2scm (slope);
-  SCM height_scm = gh_double2scm (height);
-  SCM horizontal_slope = scm_list_n (ly_symbol2scm ("beam"),
-                                    width_scm, slope_scm,
-                                    height_scm, SCM_UNDEFINED);
-  Box b (Interval (0, width),
-        Interval (-height/2, height/2 + width*slope));
-  return Molecule (b, horizontal_slope);
-}
-
 /*
   TODO: junk me.
  */
index e978d4b518f7d67a66ace8a609e92a12877e4afc..c0bb7fac49b63f5baa657d15f78cb274c19ed15c 100644 (file)
@@ -73,28 +73,28 @@ brew_flexa (Grob *me,
   if (solid)
     {
       Molecule solid_head =
-       Lookup::horizontal_slope (width, corrected_slope, height);
+       Lookup::beam (corrected_slope, width, height, 0.0);
       molecule.add_molecule (solid_head);
     }
   else // outline
     {
       Molecule left_edge =
-       Lookup::horizontal_slope (thickness, corrected_slope, height);
+       Lookup::beam (corrected_slope, thickness, height, 0.0);
       molecule.add_molecule(left_edge);
 
       Molecule right_edge =
-       Lookup::horizontal_slope (thickness, corrected_slope, height);
+       Lookup::beam (corrected_slope, thickness, height, 0.0);
       right_edge.translate_axis (width-thickness, X_AXIS);
       right_edge.translate_axis (corrected_slope * (width-thickness), Y_AXIS);
       molecule.add_molecule(right_edge);
 
       Molecule bottom_edge =
-       Lookup::horizontal_slope (width, corrected_slope, thickness);
+       Lookup::beam (corrected_slope, width, thickness, 0.0);
       bottom_edge.translate_axis (-0.5*height, Y_AXIS);
       molecule.add_molecule (bottom_edge);
 
       Molecule top_edge =
-       Lookup::horizontal_slope (width, corrected_slope, thickness);
+       Lookup::beam (corrected_slope, width, thickness, 0.0);
       top_edge.translate_axis (+0.5*height, Y_AXIS);
       molecule.add_molecule (top_edge);
     }
diff --git a/lily/ottava-bracket.cc b/lily/ottava-bracket.cc
new file mode 100644 (file)
index 0000000..f72ccf9
--- /dev/null
@@ -0,0 +1,140 @@
+#include "molecule.hh"
+#include "text-item.hh"
+#include "text-spanner.hh"
+#include "line-spanner.hh"
+#include "spanner.hh"
+#include "font-interface.hh"
+#include "dimensions.hh"
+#include "paper-def.hh"
+#include "warn.hh"
+#include "paper-column.hh"
+#include "staff-symbol-referencer.hh"
+#include "note-column.hh"
+#include "directional-element-interface.hh"
+#include "tuplet-bracket.hh"
+
+struct Ottava_bracket
+{
+  DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
+  static bool has_interface (Grob*);
+};
+
+
+/*
+  TODO: the string for ottava shoudl depend on the available space, ie.
+
+  
+  Long: 15ma        Short: 15ma    Empty: 15
+         8va                8va            8
+         8va bassa          8ba            8
+
+*/
+
+MAKE_SCHEME_CALLBACK (Ottava_bracket, brew_molecule, 1);
+SCM
+Ottava_bracket::brew_molecule (SCM smob)
+{
+  Spanner*me  = dynamic_cast<Spanner*> (unsmob_grob (smob));
+  
+  
+  Interval span_points;
+  
+  Grob *common = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS);
+  Paper_def * paper = me->get_paper();
+
+  
+  Drul_array<bool> broken;
+  Direction d = LEFT;
+  do
+    {
+      Item *b = me->get_bound (d);
+      broken[d] = (b->break_status_dir () != CENTER);
+
+      if (Note_column::has_interface (b))
+       {
+         common = common_refpoint_of_list (b->get_grob_property ("heads"), common, X_AXIS);
+       }
+    }
+  while (flip (&d) != LEFT);
+
+  SCM properties = Font_interface::font_alist_chain (me);
+  SCM markup = me->get_grob_property ("text");
+  Molecule text;
+  if (Text_item::markup_p (markup)) 
+    text = *unsmob_molecule (Text_item::interpret_markup (paper->self_scm (), properties, markup));
+
+
+  Drul_array<Real> shorten = robust_scm2interval (me->get_grob_property ("shorten-pair"),
+                                                 Interval (0,0));
+  do
+    {
+      Item *b = me->get_bound (d);
+
+      Interval ext;
+      if (Note_column::has_interface (b))
+       {
+         for (SCM s = b->get_grob_property ("note-heads"); gh_pair_p (s); s =gh_cdr (s))
+           ext.unite (unsmob_grob (gh_car (s))->extent (common, X_AXIS));
+       }
+
+      if (ext.is_empty ())
+       ext = Interval (0,0);
+      
+      span_points[d] =  (broken [d]) ? b->extent (common, X_AXIS)[-d] : ext[d];
+
+      if (broken[d])
+       shorten [d] = 0.0; 
+    }
+  while (flip (&d) != LEFT);
+
+
+  /*
+    0.3 is ~ italic correction. 
+   */
+  Real text_offset = text.extent (X_AXIS).is_empty ()
+    ? 0.0 : text.extent (X_AXIS)[RIGHT] +  0.3;
+
+  Interval bracket_span_points = span_points;
+  bracket_span_points[LEFT] += text_offset;
+  
+  Real thick = paper->get_realvar (ly_symbol2scm ("linethickness"));  
+  thick *= robust_scm2double (me->get_grob_property ("thickness"), 1.0);
+
+  Drul_array<Real> edge_height = robust_scm2interval (me->get_grob_property ("edge-height"),
+                                                     Interval (1.0, 1.0));
+
+  
+  Drul_array<Real> flare = robust_scm2interval (me->get_grob_property ("bracket-flare"),
+                                               Interval (0,0));
+
+
+
+  edge_height[LEFT] = 0.0;
+  edge_height[RIGHT] *=  - get_grob_direction (me);
+  if (broken[RIGHT])
+    edge_height[RIGHT] = 0.0;
+  
+  Molecule b;
+  if (!bracket_span_points.is_empty ())
+    b = Tuplet_bracket::make_bracket (me,
+                                     Y_AXIS, Offset (bracket_span_points.length (), 0),
+                                     thick, edge_height,
+                                     0.0,
+                                     flare, shorten);
+  
+  
+  b.translate_axis (bracket_span_points[LEFT], X_AXIS);
+  text.translate_axis (span_points[LEFT], X_AXIS);
+  text.align_to (Y_AXIS, CENTER);
+  b.add_molecule (text);
+  
+  b.translate_axis (- me->relative_coordinate (common, X_AXIS), X_AXIS);
+  
+  return b.smobbed_copy ();  
+}
+
+
+ADD_INTERFACE (Ottava_bracket, "ottava-bracket-interface",
+              "An ottava bracket",
+              "edge-height bracket-flare shorten-pair");
+
index bd0d698f289c97d4a36221b36ebe533a9680ba08..fba507e10c335590769baf901239f8149d244912 100644 (file)
@@ -50,7 +50,7 @@ Ottava_spanner_engraver::process_music ()
       if (gh_string_p (ott))
        {
          span_  = new Spanner (get_property ("OttavaSpanner"));
-         span_->set_grob_property ("edge-text", gh_cons (ott, SCM_EOL));
+         span_->set_grob_property ("text", ott);
          announce_grob (span_, SCM_EOL);
 
          SCM c0 (get_property ("centralCPosition"));
@@ -69,6 +69,7 @@ Ottava_spanner_engraver::acknowledge_grob (Grob_info info)
   if (span_ && it && Note_column::has_interface (info.grob_))
     {
       Side_position_interface::add_support (span_, it);
+
       if (!span_->get_bound (LEFT))
        span_->set_bound (LEFT, it);
       span_->set_bound (RIGHT, it);
index 37ca80ae3fef8d11d7ddf7bd4780af5ced48e470..9b4bcadaab64f1f55e5cbfd41778bf95f57a88a9 100644 (file)
@@ -34,14 +34,6 @@ MAKE_SCHEME_CALLBACK (Text_spanner, brew_molecule, 1);
   TODO: this function is too long
 
 
-  TODO: the string for ottava shoudl depend on the available space, ie.
-
-  
-  Long: 15ma        Short: 15ma    Empty: 15
-         8va                8va            8
-         8va bassa          8ba            8
-
-
 */
 SCM
 Text_spanner::brew_molecule (SCM smob) 
@@ -121,9 +113,9 @@ Text_spanner::brew_molecule (SCM smob)
       thick *=  gh_scm2double (st);
     }
   
+  Drul_array<Real> edge_height = robust_scm2interval (me->get_grob_property ("edge-height"),
+                                                     Interval (1.0, 1.0));
   Drul_array<Molecule> edge_line;
-  SCM edge_height = me->get_grob_property ("edge-height");
-  if (is_number_pair (edge_height))
     {
       Direction d = LEFT;
       int dir = to_dir (me->get_grob_property ("direction"));
@@ -136,7 +128,7 @@ Text_spanner::brew_molecule (SCM smob)
          if (gh_pair_p (flare))
            dx = gh_scm2double (index_get_cell (flare, d)) * d;
 
-         Real dy = gh_scm2double (index_get_cell (edge_height, d)) * - dir;
+         Real dy = - dir * edge_height[d] ;
          if (dy)
            edge_line[d] = Line_spanner::line_molecule (me, thick, Offset(0,0),
                                                        Offset (dx, dy));
index c351f374f4fd6846661a529f8d07a0914552fb68..4b4d76383f738dea14d7c21a63b7374749e3a40e 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <math.h>
 
+#include "line-interface.hh"
 #include "beam.hh"
 #include "box.hh"
 #include "warn.hh"
@@ -220,8 +221,8 @@ Tuplet_bracket::brew_molecule (SCM smob)
       }
       while (flip (&d) != LEFT);
       
-      Molecule brack = make_bracket (Y_AXIS,
-                                    w, ry - ly, lt,
+      Molecule brack = make_bracket (me, Y_AXIS,
+                                    Offset (w, ry - ly), lt,
                                     height,
                                     gh_scm2double (gap),
                                     flare,
@@ -241,13 +242,14 @@ Tuplet_bracket::brew_molecule (SCM smob)
   brackets.
  */
 Molecule
-Tuplet_bracket::make_bracket (Axis protusion_axis,
-                             Real dx, Real dy, Real thick, Drul_array<Real> height,
+Tuplet_bracket::make_bracket (Grob *me,        // for line properties.
+                             Axis protusion_axis,
+                             Offset dz,
+                             Real thick, Drul_array<Real> height,
                              Real gap,
                              Drul_array<Real> flare,
                              Drul_array<Real> shorten)
 {
-  Offset dz = Offset (dx,dy);
   Drul_array<Offset> corners (Offset(0,0), dz);
   
   Real length = dz.length ();
@@ -273,12 +275,11 @@ Tuplet_bracket::make_bracket (Axis protusion_axis,
 
   Molecule m;
   do {
-
-    m.add_molecule (Lookup::line (thick, straight_corners[d],
-                                 gap_corners[d]));
+    m.add_molecule (Line_interface::dashed_line (me, thick, straight_corners[d],
+                                                gap_corners[d]));
     
-    m.add_molecule (Lookup::line (thick, straight_corners[d],
-                                 flare_corners[d]));
+    m.add_molecule (Line_interface::dashed_line (me, thick, straight_corners[d],
+                                                flare_corners[d]));
   } while (flip (&d) != LEFT);
 
   return m;  
index 2200983609cdb9110abe18e5ef3adb1ebb7ccb68..195b0a7d600e909be576cedea7d6f273e8bec6c2 100644 (file)
@@ -92,7 +92,6 @@ Volta_bracket_interface::brew_molecule (SCM smob)
   Real h =  gh_scm2double (me->get_grob_property ("height"));
   Real t =  staff_thick * gh_scm2double (me->get_grob_property ("thickness"));
 
-
   Molecule start,end ;
   if (!no_vertical_start)
     start = Lookup::line (t, Offset (0,0), Offset (0, h)); 
index cf45e539146d5409a85a228b59b2738caecf0f44..41b052e13808aef40422f495ab2bb70864a79b24 100644 (file)
        (minimum-length . 2.0)
        (if-text-padding . 1.0)
        (width-correct . -1.0)
-
-       (dash-thickness . 1.2)
        (dash-length . 4.0)
        (self-alignment-Y . 0)
        (Y-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
-       (meta . ((interfaces . (hairpin-interface self-alignment-interface dynamic-interface spanner-interface))))
+       (meta . ((interfaces . (hairpin-interface line-interface self-alignment-interface dynamic-interface spanner-interface))))
        ))
 
     (HorizontalBracket
      . (
        (Y-offset-callbacks . (,Side_position_interface::out_of_staff
                               ,Side_position_interface::aligned_side))
-       (molecule-callback . ,Text_spanner::brew_molecule)
+       (molecule-callback . ,Ottava_bracket::brew_molecule)
        (font-shape . italic)
        (font-family . roman)
        (text-repeat-if-broken . #t)
        (dash-fraction . 0.3)
        (edge-height . (0 . 1.2))
        (direction . 1)
-       (meta . ((interfaces . (text-spanner-interface side-position-interface font-interface spanner-interface))))             
+       (meta . ((interfaces . (ottava-bracket-interface
+                               line-interface side-position-interface
+                               font-interface text-interface spanner-interface))))             
        ))
     
     (TabNoteHead
        (font-series . bold)
 
        (font-size . -2)
-       (meta .  ((interfaces . (text-interface tuplet-bracket-interface font-interface spanner-interface))))
+       (meta .  ((interfaces . (text-interface line-interface tuplet-bracket-interface font-interface spanner-interface))))
        ))
 
     (UnaCordaPedal
index cf9ecd7e55422aa665852a1f29584f352631b925..ba78fc0ed7610c6739b6856fff31445581fdf4bc 100644 (file)
@@ -437,10 +437,7 @@ Rest can contain a list of beat groupings
      (make-sequential-music basic) 'Timing)))
 
 (define-public (make-mark-set label)
-  " Set properties for time signature NUM/DEN.
-Rest can contain a list of beat groupings 
-
-"
+  "make the music for the \\mark command."
   
   (let*
       ((set (if (integer? label)