]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/side-position-interface.cc (out_of_staff): also do
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 13 Jan 2004 12:48:57 +0000 (12:48 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 13 Jan 2004 12:48:57 +0000 (12:48 +0000)
out_of_staff() correctly for d == DOWN.

* lily/text-spanner.cc (brew_molecule): only put vertical line and
horizontal line if they move to the right.

* scm/define-grobs.scm (all-grob-descriptions): set
text-repeat-if-broken for ottava spanner

* lily/text-spanner.cc (brew_molecule): text-repeat-if-broken
property.

ChangeLog
input/regression/ottava.ly
lily/ottava-engraver.cc
lily/side-position-interface.cc
lily/text-spanner.cc
scm/define-grob-properties.scm
scm/define-grobs.scm
scm/music-functions.scm

index 16a36943d2f8750e9729f986a301ac64e42722b0..72eadf0cc4fb9240aa08c260bd88398915bd19ef 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2004-01-13  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * lily/side-position-interface.cc (out_of_staff): also do
+       out_of_staff() correctly for d == DOWN.
+
+       * lily/text-spanner.cc (brew_molecule): only put vertical line and
+       horizontal line if they move to the right.
+       
+       * scm/define-grobs.scm (all-grob-descriptions): set
+       text-repeat-if-broken for ottava spanner
+
+       * lily/text-spanner.cc (brew_molecule): text-repeat-if-broken
+       property.
+
        * mf/feta18.mf: design size is 18 not 22.5
 
        * lily/new-lyric-combine-music-iterator.cc (process): new file.
index a271427c0371093f196e26f5a0fde36cb7d616ee..06423dbf6e4d66de151713dc8ed274d05e1ece99 100644 (file)
@@ -2,7 +2,11 @@
 \header
 {
 texidoc = "Ottava brackets are supported, through the
-use of the scheme function @code{set-octavation}. 
+use of the scheme function @code{set-octavation}.
+
+The spanner should go below for 8va bassa, and the string can be tuned
+with @code{Staff.ottavation}.
+
 "
 
 }
@@ -13,17 +17,24 @@ use of the scheme function @code{set-octavation}.
 \score {
   \notes\relative c''' \notes {
   a b c a
+  #(set-octavation 1)
+  a b c a
+  #(set-octavation 0)
   #(set-octavation 2)
-  a' b
-  c a
+  a b c a
   #(set-octavation 0)
-
-  a, #(set-octavation 1) b
+  #(set-octavation -1)
+  a b c a
+  #(set-octavation 0)
+  a,
+  #(set-octavation 1)
+  \property Staff.ottavation = #"8"
+  b
   #(set-octavation 0)
   c a 
   #(set-octavation -1) b a g 
   #(set-octavation 0)
-  c 
+  c
 }
 }
 
index 2afa0c321aa930bf3ebfe8d632a1544b6430f700..3426052280a014a8610fb4eabe5d0775f7931fa9 100644 (file)
@@ -52,9 +52,13 @@ Ottava_spanner_engraver::process_music ()
          span_  = new Spanner (get_property ("OttavaSpanner"));
          span_->set_grob_property ("edge-text", gh_cons (ott, SCM_EOL));
          announce_grob (span_, SCM_EOL);
+
+         SCM c0 (get_property ("centralCPosition"));
+         SCM oc0 (get_property ("originalCentralCPosition"));
+         if (scm_less_p (oc0, c0) == SCM_BOOL_T)
+           span_->set_grob_property ("direction", gh_int2scm (DOWN));
        }
     }
-
   last_ottavation_ = ott;
 }
 
@@ -76,8 +80,6 @@ Ottava_spanner_engraver::typeset_all ()
 {  
   if (finished_)
     {
-      Side_position_interface::add_staff_support (finished_);
-
       Direction d = LEFT;
       do
        {
index 40a8e0767fe89ac0adaca12342d806007a79771b..ea15805b3ecd49f84e11f503d6c1070000a03aad 100644 (file)
@@ -239,7 +239,7 @@ Side_position_interface::out_of_staff (SCM element_smob, SCM axis)
   Interval staff_size = st->extent (common, Y_AXIS);
   Interval me_ext = me->extent (common, a);
   Real diff =  d*staff_size[d] + padding - d*me_ext[-d];
-  return gh_double2scm (diff >? 0);
+  return gh_double2scm (d*  (diff >? 0));
 }
 
 void
index b441bdf8c94aab95e37bccdd5fc31e67f1d715c3..61de7fbc342c00af749b1d637458c6ff772d8e17 100644 (file)
@@ -32,6 +32,16 @@ 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) 
@@ -80,8 +90,8 @@ Text_spanner::brew_molecule (SCM smob)
       Direction d = LEFT;
       do
        {
-         /*  Don't repeat edge text for broken end */
-         if (broken[d])
+         if (!to_boolean (me->get_grob_property ("text-repeat-if-broken"))
+             && broken[d])
            continue;
          
          SCM text = index_get_cell (edge_text, d);
@@ -113,6 +123,7 @@ Text_spanner::brew_molecule (SCM smob)
       span_points[RIGHT] -= gh_scm2double (ly_cdr (ew));
     }
 
+
   Real thick = paper->get_realvar (ly_symbol2scm ("linethickness"));  
   SCM st = me->get_grob_property ("thickness");
   if (gh_number_p (st))
@@ -147,21 +158,31 @@ Text_spanner::brew_molecule (SCM smob)
   do
     {
       Interval ext = edge[d].extent (X_AXIS);
-
-      edge[d].translate_axis (span_points[d], X_AXIS);
-      m.add_molecule (edge[d]);
-      edge_line[d].translate_axis (span_points[d], X_AXIS);
-      m.add_molecule (edge_line[d]);
       if (!ext.is_empty ())
-       span_points[d] += -d *  ext[-d];
+       {
+         edge[d].translate_axis (span_points[d], X_AXIS);
+         m.add_molecule (edge[d]);
+         span_points[d] += -d *  ext[-d];
+       }
+    }
+  while (flip (&d) != LEFT);
+  do
+    {
+      if (d* span_points[d] > d * edge[-d].extent(X_AXIS)[d])
+       {
+         edge_line[d].translate_axis (span_points[d], X_AXIS);
+         m.add_molecule (edge_line[d]);
+       }
     }
   while (flip (&d) != LEFT);
 
-  Molecule l =Line_spanner::line_molecule (me, thick,
-                                          Offset (span_points[LEFT], 0),
-                                          Offset (span_points[RIGHT], 0));
-  m.add_molecule (l);
-
+  if (!span_points.is_empty ())
+    {
+      Molecule l =Line_spanner::line_molecule (me, thick,
+                                              Offset (span_points[LEFT], 0),
+                                              Offset (span_points[RIGHT], 0));
+      m.add_molecule (l);
+    }
   m.translate_axis (- me->relative_coordinate (common, X_AXIS), X_AXIS);
   return m.smobbed_copy ();
 }
@@ -171,5 +192,5 @@ Text_spanner::brew_molecule (SCM smob)
 
 ADD_INTERFACE (Text_spanner,"text-spanner-interface",
               "generic text spanner",
-              "dash-period if-text-padding dash-fraction edge-height bracket-flare edge-text shorten-pair style thickness enclose-bounds width-correct");
+              "text-repeat-if-broken dash-period if-text-padding dash-fraction edge-height bracket-flare edge-text shorten-pair style thickness enclose-bounds width-correct");
 
index 0fa1c14207a5437e21a5309291095cfcab20d16e..e9d4e2bc772381a34939bd50643c4b5debfe1c4f 100644 (file)
@@ -435,6 +435,8 @@ the Nth element of the list gives the amount stem shortening of a note with N fl
 (grob-property-description 'stems grob-list? "list of stem objects, corresponding to the notes that the arpeggio has to be before.")
 (grob-property-description 'stropha boolean? "is this neume a stropha?.")
 (grob-property-description 'style symbol? "a string determining what style of  glyph is typeset. Valid choices depend on the function that is reading this property. .")
+(grob-property-description 'text-repeat-if-broken boolean?
+                          "Repeat text on broken text-spanner?")
 (grob-property-description 'text markup? "Text markup.  See the
 notation manual for more information.")
 (grob-property-description 'thick-thickness number? "thickness, measured in stafflinethickness.")
index 5569834df6742a864371a49c4ebab4fe7c68babb..5999f0474990c4deeab9fcfacc55bc4d16166d0e 100644 (file)
     
     (OttavaSpanner
      . (
-       (Y-offset-callbacks . (,Side_position_interface::aligned_side))
+       (Y-offset-callbacks . (,Side_position_interface::out_of_staff
+                              ,Side_position_interface::aligned_side))
        (molecule-callback . ,Text_spanner::brew_molecule)
        (font-family . roman)
+       (text-repeat-if-broken . #t)
+       (shorten-pair . (0.0 . -0.6))
+       (staff-padding . 1.0)
        (enclose-bounds . #t)
        (width-correct . 0.0)
        (style . dashed-line)
index 41a725101a4f6a55d2fd455058d5dbcbee07de30..f5ed7b89cdae5a1b595b572fbfc4c88670bbbfbc 100644 (file)
@@ -189,6 +189,19 @@ i.e.  this is not an override"
      m
    
    ))
+(define-public (make-grob-property-override grob gprop val)
+
+  "Make a Music expression that sets GPROP to VAL in GROB. Does a pop first,
+i.e.  this is not an override"
+  
+   (let* ((m (make-music-by-name  'OverrideProperty)))
+     (ly:set-mus-property! m 'symbol grob)
+     (ly:set-mus-property! m 'grob-property gprop)
+     (ly:set-mus-property! m 'grob-value val)
+               
+     m
+   
+   ))
 
 
 (define-public (make-grob-property-revert grob gprop)
@@ -363,9 +376,10 @@ a property set for MultiMeasureRestNumber."
     
   
   (define (ottava-modify context)
-    "Either reset centralCPosition to the stored original,
-or remember old centralCPosition, add OCTAVATION to centralCPosition,
-and set OTTAVATION to `8va', or whatever appropriate."
+    "Either reset centralCPosition to the stored original, or remember
+old centralCPosition, add OCTAVATION to centralCPosition, and set
+OTTAVATION to `8va', or whatever appropriate."
+    
     (if (number? (ly:get-context-property  context 'centralCPosition))
        
        (if (= octavation 0)