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

Modified files:
        .              : ChangeLog 
        lily           : stem.cc tie.cc 
        lily/include   : stem.hh 
        scm            : define-grobs.scm 
Added files:
        input/regression: tie-single.ly 

Log message:
        

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.4051&tr2=1.4052&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/input/regression/tie-single.ly?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/stem.cc.diff?tr1=1.276&tr2=1.277&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/tie.cc.diff?tr1=1.142&tr2=1.143&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/stem.hh.diff?tr1=1.91&tr2=1.92&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-grobs.scm.diff?tr1=1.227&tr2=1.228&r1=text&r2=text

Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.4051 lilypond/ChangeLog:1.4052
--- lilypond/ChangeLog:1.4051   Sun Aug 21 11:24:57 2005
+++ lilypond/ChangeLog  Sun Aug 21 12:34:52 2005
@@ -4,6 +4,10 @@
 
 2005-08-21  Han-Wen Nienhuys  <[EMAIL PROTECTED]>
 
+       * input/regression/tie-single.ly: new file.
+
+       * scm/define-grobs.scm (all-grob-descriptions): height limit .75
+
        * lily/midi-item.cc (name): new method.
 
        * lily/staff-performer.cc (acknowledge_audio_element): use
Index: lilypond/lily/include/stem.hh
diff -u lilypond/lily/include/stem.hh:1.91 lilypond/lily/include/stem.hh:1.92
--- lilypond/lily/include/stem.hh:1.91  Thu Mar 10 14:36:12 2005
+++ lilypond/lily/include/stem.hh       Sun Aug 21 12:34:52 2005
@@ -38,6 +38,7 @@
   static void position_noteheads (Grob *);
   static Real stem_end_position (Grob *);
   static Stencil flag (Grob *);
+  static Stencil get_translated_flag (Grob*);
   static bool has_interface (Grob *);
   static void set_spacing_hints (Grob *);
 
Index: lilypond/lily/stem.cc
diff -u lilypond/lily/stem.cc:1.276 lilypond/lily/stem.cc:1.277
--- lilypond/lily/stem.cc:1.276 Sat Aug 13 21:35:22 2005
+++ lilypond/lily/stem.cc       Sun Aug 21 12:34:52 2005
@@ -528,9 +528,15 @@
 Stencil
 Stem::flag (Grob *me)
 {
-  /* TODO: maybe property stroke-style should take different values,
-     e.g. "" (i.e. no stroke), "single" and "double" (currently, it's
-     '() or "grace").  */
+  int log = duration_log (me);
+  if (log < 3
+      || unsmob_grob (me->get_object ("beam")))
+    return Stencil ();
+
+  /*
+    TODO: maybe property stroke-style should take different values,
+    e.g. "" (i.e. no stroke), "single" and "double" (currently, it's
+    '() or "grace").  */
   String flag_style;
 
   SCM flag_style_scm = me->get_property ("flag-style");
@@ -566,7 +572,7 @@
 
   char dir = (get_direction (me) == UP) ? 'u' : 'd';
   String font_char = flag_style
-    + to_string (dir) + staffline_offs + to_string (duration_log (me));
+    + to_string (dir) + staffline_offs + to_string (log);
   Font_metric *fm = Font_interface::get_default_font (me);
   Stencil flag = fm->find_by_name ("flags." + font_char);
   if (flag.is_empty ())
@@ -694,16 +700,29 @@
   Stencil ss = Lookup::round_filled_box (b, blot);
   mol.add_stencil (ss);
 
-  if (!get_beam (me) && abs (duration_log (me)) > 2)
+  mol.add_stencil (get_translated_flag (me));
+
+  return mol.smobbed_copy ();
+}
+
+Stencil
+Stem::get_translated_flag (Grob *me)
+{
+  Stencil fl = flag (me);
+  if (!fl.is_empty ())
     {
-      Stencil fl = flag (me);
-      fl.translate_axis (stem_y[d] * half_space - d * blot / 2, Y_AXIS);
+      Direction d = get_direction (me);
+      Real blot
+       = me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
+      Real stem_width = thickness (me);
+      Real half_space = Staff_symbol_referencer::staff_space (me) * 0.5;
+      Real y2 = stem_end_position (me);
+      fl.translate_axis (y2 * half_space - d * blot / 2, Y_AXIS);
       fl.translate_axis (stem_width / 2, X_AXIS);
-      mol.add_stencil (fl);
     }
-
-  return mol.smobbed_copy ();
+  return fl;
 }
+
 
 /*
   move the stem to right of the notehead if it is up.
Index: lilypond/lily/tie.cc
diff -u lilypond/lily/tie.cc:1.142 lilypond/lily/tie.cc:1.143
--- lilypond/lily/tie.cc:1.142  Thu Aug 18 10:58:04 2005
+++ lilypond/lily/tie.cc        Sun Aug 21 12:34:52 2005
@@ -124,194 +124,6 @@
     }
 }
 
-/*
-  TODO: we should also use thickness for computing the clearance
-  between head and tie. Very thick ties will now touch the note head.
-*/
-SCM
-Tie::get_control_points (SCM smob)
-{
-  Spanner *me = unsmob_spanner (smob);
-  Direction headdir = CENTER;
-  if (head (me, LEFT))
-    headdir = LEFT;
-  else if (head (me, RIGHT))
-    headdir = RIGHT;
-  else
-    {
-      programming_error ("tie without heads");
-      me->suicide ();
-      return SCM_EOL;
-    }
-
-  set_direction (me);
-
-  Direction dir = get_grob_direction (me);
-
-  Real staff_space = Staff_symbol_referencer::staff_space (me);
-
-  Real x_gap_f = robust_scm2double (me->get_property ("x-gap"), 0);
-
-  Grob *l = me->get_bound (LEFT);
-  Grob *r = me->get_bound (RIGHT);
-
-  Grob *commonx = me->common_refpoint (l, X_AXIS);
-  commonx = me->common_refpoint (r, X_AXIS);
-
-  Real left_x;
-
-  /*
-    the tie has to be long enough to be visible, but should not go
-    through key sigs. In the 1.5 series the pref.matter - note
-    distance is fixed , so this won't be a problem anymore.
-  */
-  Real lambda = 0.9;
-
-  if (Note_head::has_interface (l))
-    {
-      Real where = RIGHT;
-
-      /*
-       This correction is due te the shape of the black note head.
-      */
-      if (Rhythmic_head::duration_log (l) == 2)
-       where += dir * 0.2;
-      left_x = l->extent (l, X_AXIS).linear_combination (where)
-       + x_gap_f;
-    }
-  else
-    left_x = l->extent (l, X_AXIS).linear_combination (lambda);
-
-  Real width;
-  if (Note_head::has_interface (l) && Note_head::has_interface (r))
-    {
-      width
-       = + r->extent (commonx, X_AXIS)[LEFT]
-       - l->extent (commonx, X_AXIS)[RIGHT]
-       -2 * x_gap_f;
-    }
-  else
-    {
-      if (Note_head::has_interface (l))
-       width = r->relative_coordinate (commonx, X_AXIS)
-         - l->extent (commonx, X_AXIS)[RIGHT]
-         - 2 * x_gap_f;
-      else
-       width
-         = -l->extent (commonx, X_AXIS).linear_combination (lambda)
-         + r->extent (commonx, X_AXIS)[LEFT]
-         - 2 * x_gap_f;
-    }
-
-  SCM details = me->get_property ("details");
-
-  SCM lim // groetjes aan de chirurgendochter.
-    = scm_assq (ly_symbol2scm ("height-limit"), details);
-
-  Real h_inf = scm_to_double (scm_cdr (lim)) * staff_space;
-  Real r_0 = scm_to_double (scm_cdr (scm_assq (ly_symbol2scm ("ratio"), 
details)));
-
-  Bezier b = slur_shape (width, h_inf, r_0);
-
-  /*
-    I think this better, particularly for small ties. It always allows
-    the user to move ties if they seem in the wrong place
-
-    TODO: what if 2 heads have different size.
-
-  */
-
-  Real ypos = Tie::get_position (me) * staff_space / 2
-    + dir * scm_to_double (me->get_property ("y-offset"));;
-
-  /*
-    Make sure we don't start on a dots
-  */
-  if (Note_head::has_interface (l) && Rhythmic_head::get_dots (l))
-    {
-      Grob *dots = Rhythmic_head::get_dots (l);
-      if (fabs (staff_space * Staff_symbol_referencer::get_position (dots) / 2
-               - ypos) < 0.5)
-       ypos += 0.5 * dir;
-    }
-
-  /*
-    todo: prevent ending / staffline collision.
-
-    todo: tie / stem collision
-  */
-
-  b = slur_shape (width, h_inf, r_0);
-  b.scale (1, dir);
-  b.translate (Offset (left_x, ypos));
-
-  /*
-    Avoid colliding of the horizontal part with stafflines.
-
-
-    TODO: redo this, heuristic is half-baken, and ties often look ugly
-    as a result.
-
-    TODO: doesn't work when on staff with even number of lines.
-  */
-  Array<Real> horizontal (b.solve_derivative (Offset (1, 0)));
-  if (horizontal.size ())
-    {
-      /*
-       ugh. Doesnt work for non-horizontal curves.
-      */
-      Real y = b.curve_point (horizontal[0])[Y_AXIS];
-
-      Real ry = rint (y / staff_space) * staff_space;
-      Real diff = ry - y;
-      Real newy = y;
-
-      Real clear = staff_space * scm_to_double (me->get_property 
("staffline-clearance"));
-
-      if (fabs (y)
-         <= Staff_symbol_referencer::staff_radius (me) * staff_space + clear
-         && fabs (diff) < clear)
-       {
-         Real y1 = ry + clear;
-         Real y2 = ry - clear;
-
-         /*
-           ugh, we shove the 0.5 out of our sleeves.
-
-           Any way. This test is to make sure that staffline
-           collision avoidance does not result in completely flat
-           ties.
-         */
-         if (fabs (y1 - ypos) < 0.5)
-           y1 = y2;
-         else if (fabs (y2 - ypos) < 0.5)
-           y2 = y1;
-
-         newy = (fabs (y1 - y) < fabs (y2 - y)) ? y1 : y2;
-
-         // newy = ry - 0.5 * staff_space * sign (diff) ;
-
-         /*
-           we don't want horizontal ties
-         */
-         if (fabs (newy - b.control_[0][Y_AXIS]) < 1e-2)
-           newy = newy + dir * staff_space;
-       }
-
-      Real y0 = b.control_ [0][Y_AXIS];
-      b.control_[2][Y_AXIS]
-       = b.control_[1][Y_AXIS]
-       = (b.control_[1][Y_AXIS] - y0) * ((newy - y0) / (y - y0)) + y0;
-    }
-  else
-    programming_error ("tie is nowhere horizontal");
-
-  SCM controls = SCM_EOL;
-  for (int i = 4; i--;)
-    controls = scm_cons (ly_offset2scm (b.control_[i]), controls);
-  return controls;
-}
-
 MAKE_SCHEME_CALLBACK (Tie, print, 1);
 SCM
 Tie::print (SCM smob)
Index: lilypond/scm/define-grobs.scm
diff -u lilypond/scm/define-grobs.scm:1.227 lilypond/scm/define-grobs.scm:1.228
--- lilypond/scm/define-grobs.scm:1.227 Thu Aug 18 12:57:20 2005
+++ lilypond/scm/define-grobs.scm       Sun Aug 21 12:34:52 2005
@@ -1440,7 +1440,7 @@
        (staffline-clearance . 0.35)
        (details . ((ratio . 0.333) (height-limit . 1.0)))
        (thickness . 1.0)
-       (x-gap . -0.1)
+;      (x-gap . -0.1)
        (y-offset . 0.6)
        (minimum-length . 2.5)
        (meta . ((class . Spanner)


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

Reply via email to