CVSROOT:        /cvsroot/lilypond
Module name:    lilypond
Branch:         
Changes by:     Han-Wen Nienhuys <[EMAIL PROTECTED]>    05/08/21 13:11:51

Modified files:
        input/regression: tie-single.ly 
        lily           : note-head.cc tie.cc 
        scm            : define-grobs.scm 
Removed files:
        input/regression: tie.ly 

Log message:
        * lily/tie.cc (get_control_points): rewrite. Put short ties in
        staff-spaces, make long ties cross staff lines. Avoid flags and dots.
        
        * input/regression/tie-single.ly: new file.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/input/regression/tie-single.ly.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/note-head.cc.diff?tr1=1.150&tr2=1.151&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/tie.cc.diff?tr1=1.144&tr2=1.145&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-grobs.scm.diff?tr1=1.228&tr2=1.229&r1=text&r2=text

Patches:
Index: lilypond/input/regression/tie-single.ly
diff -u lilypond/input/regression/tie-single.ly:1.1 
lilypond/input/regression/tie-single.ly:1.2
--- lilypond/input/regression/tie-single.ly:1.1 Sun Aug 21 12:34:52 2005
+++ lilypond/input/regression/tie-single.ly     Sun Aug 21 13:11:51 2005
@@ -1,7 +1,6 @@
 \header
 {
   texidoc = "Formatting for isolated ties.
- Things to note:
 
 @itemize @bullet
 @item short ties are in spaces
@@ -11,6 +10,8 @@
 
 @item short ties are vertically centered in the space, as well those
 that otherwise don't fit in a space
+
[EMAIL PROTECTED] extremely short ties are put over the noteheads, instead of 
inbetween.
  
 @end itemize
 "
Index: lilypond/lily/note-head.cc
diff -u lilypond/lily/note-head.cc:1.150 lilypond/lily/note-head.cc:1.151
--- lilypond/lily/note-head.cc:1.150    Sat Aug 13 21:35:22 2005
+++ lilypond/lily/note-head.cc  Sun Aug 21 13:11:51 2005
@@ -129,5 +129,9 @@
 
 ADD_INTERFACE (Note_head, "note-head-interface",
               "Note head",
-              "note-names glyph-name-procedure accidental-grob style 
stem-attachment-function");
+              "note-names "
+              "glyph-name-procedure "
+              "accidental-grob "
+              "style "
+              "stem-attachment-function");
 
Index: lilypond/lily/tie.cc
diff -u lilypond/lily/tie.cc:1.144 lilypond/lily/tie.cc:1.145
--- lilypond/lily/tie.cc:1.144  Sun Aug 21 12:44:43 2005
+++ lilypond/lily/tie.cc        Sun Aug 21 13:11:51 2005
@@ -151,7 +151,7 @@
       common[ax] = me->get_bound (RIGHT)->common_refpoint (common[a], ax); 
     }
 
-  Drul_array<Real> attachments;
+  Interval attachments;
 
   Direction d = LEFT;
   Real gap = robust_scm2double (me->get_property ("x-gap"), 0.2);
@@ -165,6 +165,44 @@
     }
   while (flip (&d) != LEFT);
 
+  bool in_between = true;
+  if (attachments.length () < 0.6 * staff_space)
+    {
+      /*
+       Let short ties start over note heads, instead of between.
+       */
+      Drul_array<bool> allow (true, true);
+
+      Direction d = LEFT;
+      do {
+       if (Note_head::has_interface (me->get_bound (d)))
+         {
+           Grob *stem = unsmob_grob (me->get_bound (d)->get_object ("stem"));
+           if (get_grob_direction (stem) == dir
+               && -d == dir)
+             allow[d] = false;
+         }
+      } while (flip (&d) != LEFT);
+
+      if (allow[LEFT] && allow[RIGHT])
+       {
+         staff_position += dir;
+         do
+           {
+             if (Note_head::has_interface (me->get_bound (d)))
+               {
+                 Interval extent
+                   = robust_relative_extent (me->get_bound (d),
+                                             common[X_AXIS], X_AXIS);
+
+                 attachments[d] = extent.linear_combination (- 0.5 * d);
+                 in_between = false;
+               }
+           }
+         while (flip (&d) != LEFT);
+       }
+    }
+
   SCM details = me->get_property ("details");
 
   SCM limit
@@ -174,7 +212,7 @@
   Real r_0 = robust_scm2double (scm_cdr (scm_assq (ly_symbol2scm ("ratio"), 
details)),
                                .333);
 
-  Bezier b = slur_shape (attachments[RIGHT] - attachments[LEFT],
+  Bezier b = slur_shape (attachments.length(),
                         h_inf, r_0);
   b.scale (1, dir);
   
@@ -185,8 +223,9 @@
   
   Real dy = fabs (middle[Y_AXIS] - edge[Y_AXIS]);
   bool in_space = !(Staff_symbol_referencer::on_staffline (me, (int) 
staff_position));
-  bool fits_in_space = (dy < 0.6 * staff_space);
-
+  bool fits_in_space =
+    (dy < 0.6 * staff_space);
+  
   /*
     Avoid dot
    */
@@ -225,7 +264,7 @@
     {
       staff_position += 2 * dir; 
     }
-  
+
   if (in_space != fits_in_space)
     {
       if (in_space)
@@ -239,6 +278,12 @@
        }
     }
 
+  if (!in_between
+      && in_space
+      && fabs (staff_position - Tie::get_position (me)) <= 1)
+    staff_position += 2*dir;
+  
+  
   if (in_space)
     {
       if (fabs (dy) < 0.4 * staff_space)
Index: lilypond/scm/define-grobs.scm
diff -u lilypond/scm/define-grobs.scm:1.228 lilypond/scm/define-grobs.scm:1.229
--- lilypond/scm/define-grobs.scm:1.228 Sun Aug 21 12:34:52 2005
+++ lilypond/scm/define-grobs.scm       Sun Aug 21 13:11:51 2005
@@ -1436,7 +1436,7 @@
     (Tie
      . (
        (print-function . ,Tie::print)
-       (spacing-procedure . ,Spanner::set_spacing_rods)
+;      (spacing-procedure . ,Spanner::set_spacing_rods)
        (staffline-clearance . 0.35)
        (details . ((ratio . 0.333) (height-limit . 1.0)))
        (thickness . 1.0)


_______________________________________________
Lilypond-cvs mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs

Reply via email to