]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/ottava-bracket.cc
Imported sources
[lilypond.git] / lily / ottava-bracket.cc
index 1df2dbafbed885357c94d144931406e7fb68bdf3..9adaded43ca4ca6d659f7407742d1636ae51cc8a 100644 (file)
@@ -1,3 +1,12 @@
+/*   
+  ottava-bracket.cc --  implement Ottava_bracket
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ */
+
 #include "molecule.hh"
 #include "text-item.hh"
 #include "text-spanner.hh"
@@ -15,7 +24,7 @@
 
 struct Ottava_bracket
 {
-  DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
+  DECLARE_SCHEME_CALLBACK (print, (SCM));
   static bool has_interface (Grob*);
 };
 
@@ -30,9 +39,9 @@ struct Ottava_bracket
 
 */
 
-MAKE_SCHEME_CALLBACK (Ottava_bracket, brew_molecule, 1);
+MAKE_SCHEME_CALLBACK (Ottava_bracket, print, 1);
 SCM
-Ottava_bracket::brew_molecule (SCM smob)
+Ottava_bracket::print (SCM smob)
 {
   Spanner*me  = dynamic_cast<Spanner*> (unsmob_grob (smob));
   
@@ -66,6 +75,12 @@ Ottava_bracket::brew_molecule (SCM smob)
 
   Drul_array<Real> shorten = robust_scm2interval (me->get_grob_property ("shorten-pair"),
                                                  Interval (0,0));
+
+
+  /*
+    TODO: we should check if there are ledgers, and modify length of
+    the spanner to that.
+   */
   do
     {
       Item *b = me->get_bound (d);
@@ -122,7 +137,25 @@ Ottava_bracket::brew_molecule (SCM smob)
                                       edge_height,
                                      0.0,
                                      flare, shorten);
+
+  /*
+    The vertical lines should not take space, for the following scenario:
+
+    8 -----+
+        o  |
+       |
+       |
+       
+
+    Just a small amount, yes.  In tight situations, it is even
+    possible to center the `8' directly below the note, dropping the
+    ottava line completely...
+
+  */
   
+  b = Molecule (Box (b.extent (X_AXIS),
+                    Interval (0.1,0.1)),
+               b.get_expr ());
   
   b.translate_axis (bracket_span_points[LEFT], X_AXIS);
   text.translate_axis (span_points[LEFT], X_AXIS);