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

Modified files:
        lily           : tie-column.cc tie.cc 
        lily/include   : tie.hh 

Log message:
        * lily/tie.cc: remove minimum-length
        
        * lily/tie.cc (get_control_points): rewrite. Put short ties in
        staff-spaces, make long ties cross staff lines. Avoid flags and dots.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/tie-column.cc.diff?tr1=1.49&tr2=1.50&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/tie.cc.diff?tr1=1.148&tr2=1.149&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/tie.hh.diff?tr1=1.53&tr2=1.54&r1=text&r2=text

Patches:
Index: lilypond/lily/include/tie.hh
diff -u lilypond/lily/include/tie.hh:1.53 lilypond/lily/include/tie.hh:1.54
--- lilypond/lily/include/tie.hh:1.53   Thu Mar 10 14:36:12 2005
+++ lilypond/lily/include/tie.hh        Sun Aug 21 21:47:18 2005
@@ -12,6 +12,24 @@
 #include "lily-guile.hh"
 #include "lily-proto.hh"
 
+
+struct Tie_configuration
+{
+  int position_;
+  Direction dir_;
+  Interval attachment_x_;
+  Real edge_y_;
+  
+  Tie_configuration ()
+  {
+    dir_ = CENTER;
+    position_ = 0;
+  }
+  
+  static int compare (Tie_configuration const &a,
+                     Tie_configuration const &b);
+};
+
 class Tie
 {
 public:
@@ -24,8 +42,10 @@
   static Real get_position (Grob *);
   static Direction get_default_dir (Grob *);
   static SCM get_control_points (SCM);
+  static SCM get_configuration (SCM);
   DECLARE_SCHEME_CALLBACK (print, (SCM));
   DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
 };
+
 
 #endif // TIE_HH
Index: lilypond/lily/tie-column.cc
diff -u lilypond/lily/tie-column.cc:1.49 lilypond/lily/tie-column.cc:1.50
--- lilypond/lily/tie-column.cc:1.49    Fri Aug 12 00:04:45 2005
+++ lilypond/lily/tie-column.cc Sun Aug 21 21:47:18 2005
@@ -51,6 +51,7 @@
   return sign (Tie::get_position (s1) - Tie::get_position (s2));
 }
 
+#if 0
 /*
   Werner:
 
@@ -133,6 +134,7 @@
 
   return;
 }
+#endif
 
 MAKE_SCHEME_CALLBACK (Tie_column, after_line_breaking, 1);
 SCM
@@ -168,4 +170,5 @@
 ADD_INTERFACE (Tie_column, "tie-column-interface",
               "Object that sets directions of multiple ties in a tied chord",
               "direction");
+
 
Index: lilypond/lily/tie.cc
diff -u lilypond/lily/tie.cc:1.148 lilypond/lily/tie.cc:1.149
--- lilypond/lily/tie.cc:1.148  Sun Aug 21 20:47:15 2005
+++ lilypond/lily/tie.cc        Sun Aug 21 21:47:18 2005
@@ -126,9 +126,12 @@
 
 
 SCM
-Tie::get_control_points (SCM smob)
+Tie::get_configuration (Grob *me_grob,
+                       Grob **common,
+                       Tie_configuration *conf)
 {
-  Spanner *me = unsmob_spanner (smob);
+  Spanner *me = dynamic_cast<Spanner*> (me_grob);
+  
   if (!head (me, LEFT) && !head (me, RIGHT))
     {
       programming_error ("tie without heads");
@@ -144,16 +147,6 @@
   Real staff_space = Staff_symbol_referencer::staff_space (me);
   Real staff_position = tie_position;
 
-  Grob *common[NO_AXES];
-  for (int a = X_AXIS; a < NO_AXES; a++)
-    {
-      Axis ax ((Axis) a); 
-      common[ax] = me->get_bound (LEFT)->common_refpoint (me, ax); 
-      common[ax] = me->get_bound (RIGHT)->common_refpoint (common[a], ax); 
-    }
-
-  Interval attachments;
-
   Direction d = LEFT;
   Real gap = robust_scm2double (me->get_property ("x-gap"), 0.2);
   do
@@ -296,15 +289,15 @@
          Offset edge = b.curve_point (0.0);
 
          Real center = (edge[Y_AXIS] + middle[Y_AXIS])/2.0;
-         b.translate (Offset (0,
-                              staff_position * staff_space * 0.5
-                              - center));
+
+         conf->edge_y_ = staff_position * staff_space * 0.5
+           - center;
        }
       else
        {
-         b.translate (Offset (0,
-                              (staff_position - dir) * staff_space * 0.5
-                              + dir * 0.2 * staff_space));
+         conf->edge_y_ = 
+           (staff_position - dir) * staff_space * 0.5
+           + dir * 0.2 * staff_space;
        }
     }
   else
@@ -312,20 +305,59 @@
       Real where = 0.5 * dir;
       
       Real rounding_dy = (where - middle[Y_AXIS]);
-      b.translate (Offset (0,
-                          0.5 * staff_position * staff_space + rounding_dy));
+      conf->edge_y_ = 0.5 * staff_position * staff_space + rounding_dy;
 
       if (dir * b.curve_point (0.0)[Y_AXIS] <
          dir * tie_position * 0.5 * staff_space)
-       b.translate (Offset (0, staff_space * dir)); 
+       conf->edge_y_ +=  staff_space * dir; 
     }
+
+  conf->position_ = staff_position;
+  conf->dir_ = dir;
+  conf->attachment_x_ = attachments;
+}
+
+
+SCM
+Tie::get_control_points (SCM smob)
+{
+  Spanner *me = unsmob_spanner (smob);
+
+  Grob *common[NO_AXES] = {
+    0, 0
+  };
+  for (int a = X_AXIS; a < NO_AXES; a++)
+    {
+      Axis ax ((Axis) a); 
+      common[ax] = me->get_bound (LEFT)->common_refpoint (me, ax); 
+      common[ax] = me->get_bound (RIGHT)->common_refpoint (common[a], ax); 
+    }
+  
+  Tie_configuration conf;
+  get_configuration (me, common, &conf);
   
-  b.translate (Offset (attachments[LEFT]
+  SCM details = me->get_property ("details");
+  SCM limit
+    = scm_assq (ly_symbol2scm ("height-limit"), details);
+
+  Real h_inf = robust_scm2double (scm_cdr (limit), 0.75) * staff_space;
+  Real r_0 = robust_scm2double (scm_cdr (scm_assq (ly_symbol2scm ("ratio"),
+                                                  details)),
+                               .333);
+
+  Bezier b = slur_shape (conf->attachment_x_.length(),
+                        h_inf, r_0);
+  b.scale (1, conf->dir_);
+  
+  Bezier b;
+  
+  b.translate (Offset (conf->attachment_x_[LEFT]
                       - me->relative_coordinate (common[X_AXIS], X_AXIS), 0));
   
   SCM controls = SCM_EOL;
   for (int i = 4; i--;)
     controls = scm_cons (ly_offset2scm (b.control_[i]), controls);
+
   return controls;
 }
 
@@ -388,3 +420,6 @@
               "head-pair "
               "thickness "
               "x-gap ");
+
+
+


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

Reply via email to