]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.72
authorfred <fred>
Tue, 26 Mar 2002 23:24:43 +0000 (23:24 +0000)
committerfred <fred>
Tue, 26 Mar 2002 23:24:43 +0000 (23:24 +0000)
54 files changed:
CHANGES
input/test/tie.ly
lily/align-interface.cc
lily/axis-group-interface.cc
lily/bar.cc
lily/beam.cc
lily/bezier-bow.cc
lily/bezier.cc
lily/break-align-item.cc
lily/chord-name.cc
lily/clef-item.cc
lily/crescendo.cc
lily/cross-staff.cc
lily/dot-column.cc
lily/grace-align-item.cc
lily/include/bezier-bow.hh
lily/include/bezier.hh
lily/include/cross-staff.hh
lily/include/score-element.hh
lily/include/slur-bezier-bow.hh
lily/include/staff-symbol-referencer.hh
lily/include/tie-column.hh
lily/include/tie.hh
lily/least-squares.cc
lily/local-key-item.cc
lily/lookup.cc
lily/multi-measure-rest.cc
lily/my-lily-lexer.cc
lily/note-head.cc
lily/property-engraver.cc
lily/rest-collision.cc
lily/rest.cc
lily/score-element.cc
lily/script-column-engraver.cc
lily/script-column.cc
lily/script.cc
lily/separating-group-spanner.cc
lily/side-position-interface.cc
lily/slur-bezier-bow.cc
lily/slur.cc
lily/spacing-spanner.cc
lily/span-bar.cc
lily/staff-symbol-referencer.cc
lily/stem.cc
lily/system-start-delimiter.cc
lily/tie-column.cc
lily/tie-engraver.cc
lily/tie.cc
lily/translator-group.cc
lily/tuplet-spanner.cc
lily/volta-spanner.cc
ly/engraver.ly
ly/params.ly
scm/paper.scm

diff --git a/CHANGES b/CHANGES
index 659d970b22675b4c3fbede5d26020ed6cbbca6f3..17afb3dfa8e1469bf81d62fc7ff53848a316c32f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,21 @@
+* Robustness fix for minimise_least_squares ()
+
+* cleanups of Slur_bezier_bow, removed Bezier_bow.
+
+* cleanup of Tie. Changed Tie into interface. Made ties flatter by default.
+
+* changed SCM_UNDEFINED to SCM_UNSPECIFIED for return values that go
+back into Scheme.
+
+* changed SCM_UNSPECIFIED to SCM_EOL for undefined element
+properties. This makes initializing list properties redundant.
+
+* removed idiotic code for including tfm.[1-5] into search path.
+
+* fixed problem with tuplet placement for cross staff tuplets.
+
+1.3.71
+======
 * Small cleanups to bring down  compile time and binary ensmallment.
 
 * Made Lookup into a smob, and use guile alist iso. an STL map.
index 36998a23f592123017044c40fbd3261d9f578e57..4a6d255da60ebfa16a168181b969693c84b922c4 100644 (file)
@@ -2,8 +2,9 @@
        \notes\relative c''{
                %b2~b4~b8~b16~b32~b64 r64\break
                %a2~a4~a8~a16~a32~a64 r64
-               d2~d4~d8~d16~d32~d64 r64\break
-               a2~a4~a8~a16~a32~a64 r64
+               \time 8/4;
+               d1 ~ d2~d4~d8~d16~d32~d64 r64\break
+               a1~ a2~a4~a8~a16~a32~a64 r64
                %c2~c4~c8~c16~c32~c64 r64
        }
        \paper{
index 200bd8d6c41ed95e5763e830b272f4a8fa24b212..51ac50d50980babc739c3550b0dd093f63335f4d 100644 (file)
@@ -21,7 +21,7 @@ Real
 Align_interface::alignment_callback (Score_element *sc, Axis ax)
 {
   Score_element * par = sc->parent_l (ax);
-  if (par && par->get_elt_property ("alignment-done") == SCM_UNDEFINED) 
+  if (par && !to_boolean (par->get_elt_property ("alignment-done")))
     {
       Align_interface::do_side_processing (par, ax);
     }
index 3b144f624f1665d47b4d2ba18d7723b102c5df84..83f391c976e426b452cdf77a650c80b3c02a93c9 100644 (file)
@@ -73,7 +73,7 @@ Axis_group_interface::set_axes (Score_element*me,Axis a1, Axis a2)
 
   SCM prop = me->get_elt_property ("axes");
   
-  if (prop == SCM_UNDEFINED
+  if (!gh_pair_p (prop)
       || scm_memq (sa1, prop) == SCM_BOOL_F
       || scm_memq (sa2, prop) == SCM_BOOL_F)
     {
index 19716114dd1a3ac90aeda0c14fdcab7e04857578..bb91147180bebba77fc9a8670eed611ebf761295 100644 (file)
@@ -146,7 +146,7 @@ Bar::before_line_breaking  (SCM smob)
     }
   else
     {
-      g = SCM_UNDEFINED;
+      g = SCM_EOL;
     }
   
   if (!gh_string_p (g))
@@ -159,7 +159,7 @@ Bar::before_line_breaking  (SCM smob)
     me->set_elt_property ("glyph", g);
 
 
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
   
 void
index 32bffce8dc2e23212589b1b9129043d6816f8b0d..1356abe3333460dec86d01cff87cfb3751ad198c 100644 (file)
@@ -14,7 +14,7 @@
     * less hairy code
     * move paper vars to scm
 
-    remove *-hs variables.
+  remove *-hs variables, and do all y-position stuff in staff-space.
 */
 
 
@@ -284,7 +284,7 @@ Beam::after_line_breaking (SCM smob)
 
   /* first, calculate y, dy */
   Real y, dy;
-calc_default_position_and_height (me, &y, &dy);
+  calc_default_position_and_height (me, &y, &dy);
   if (visible_stem_count (me))
     {
       if (suspect_slope_b (me, y, dy))
@@ -305,6 +305,10 @@ calc_default_position_and_height (me, &y, &dy);
 
   Real half_space = Staff_symbol_referencer::staff_space (me) / 2;
 
+  /* weird: why do we do calc_position_and_height () ? regardless of
+     this setting?
+
+  */
   /* check for user-override of dy */
   SCM s = me->remove_elt_property ("height-hs");
   if (gh_number_p (s))
@@ -347,7 +351,7 @@ calc_default_position_and_height (me, &y, &dy);
   set_stem_length (me, y, dy);
   me->set_elt_property ("y-position", gh_double2scm (y));
 
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 /*
@@ -370,6 +374,8 @@ Beam::calc_default_position_and_height (Score_element*me,Real* y, Real* dy)
     }
 
   Array<Offset> ideals;
+
+  // ugh -> use commonx
   Real x0 = first_visible_stem (me)->relative_coordinate (0, X_AXIS);
   Link_array<Item> stems=
     Pointer_group_interface__extract_elements (me, (Item*)0, "stems");
@@ -401,6 +407,7 @@ Beam::suspect_slope_b (Score_element*me, Real y, Real dy)
   Real lengthened = me->paper_l ()->get_var ("beam_lengthened");
   Real steep = me->paper_l ()->get_var ("beam_steep_slope");
 
+  // ugh -> use commonx
   Real dx = last_visible_stem (me)->relative_coordinate (0, X_AXIS) - first_visible_stem (me)->relative_coordinate (0, X_AXIS);
   Real dydx = dy && dx ? dy/dx : 0;
 
@@ -425,6 +432,7 @@ Beam::calc_slope_damping_f (Score_element*me,Real dy)
 
   if (damping)
     {
+  // ugh -> use commonx
       Real dx = last_visible_stem (me)->relative_coordinate (0, X_AXIS)
        - first_visible_stem (me)->relative_coordinate (0, X_AXIS);
       Real dydx = dy && dx ? dy/dx : 0;
@@ -444,6 +452,7 @@ Beam::calc_stem_y_f (Score_element*me,Item* s, Real y, Real dy)
   int stem_multiplicity = (Stem::flag_i (s) - 2) >? 0;
 
   Real interbeam_f = me->paper_l ()->interbeam_f (beam_multiplicity);
+  // ugh -> use commonx
   Real x0 = first_visible_stem (me)->relative_coordinate (0, X_AXIS);
   Real dx = last_visible_stem (me)->relative_coordinate (0, X_AXIS) - x0;
   Real stem_y = (dy && dx ? (s->relative_coordinate (0, X_AXIS) - x0) / dx * dy : 0) + y;
@@ -624,6 +633,7 @@ Beam::set_beaming (Score_element*me,Beaming_info_list *beaming)
 Molecule
 Beam::stem_beams (Score_element*me,Item *here, Item *next, Item *prev) 
 {
+  // ugh -> use commonx
   if ((next && !(next->relative_coordinate (0, X_AXIS) > here->relative_coordinate (0, X_AXIS))) ||
       (prev && !(prev->relative_coordinate (0, X_AXIS) < here->relative_coordinate (0, X_AXIS))))
       programming_error ("Beams are not left-to-right");
@@ -639,6 +649,7 @@ Beam::stem_beams (Score_element*me,Item *here, Item *next, Item *prev)
   Real bdy = interbeam_f;
   Real stemdx = staffline_f;
 
+    // ugh -> use commonx
   Real dx = visible_stem_count (me) ?
     last_visible_stem (me)->relative_coordinate (0, X_AXIS) - first_visible_stem (me)->relative_coordinate (0, X_AXIS)
     : 0.0;
@@ -756,6 +767,7 @@ Beam::brew_molecule (SCM smob)
     Pointer_group_interface__extract_elements (me, (Item*) 0, "stems");  
   if (visible_stem_count (me))
     {
+  // ugh -> use commonx
       x0 = first_visible_stem (me)->relative_coordinate (0, X_AXIS);
       dx = last_visible_stem (me)->relative_coordinate (0, X_AXIS) - x0;
     }
@@ -892,6 +904,7 @@ Beam::rest_collision_callback (Score_element *rest, Axis a )
   if (gh_number_p (s))
     beam_y = gh_scm2double (s);
   
+  // ugh -> use commonx
   Real x0 = first_visible_stem(beam)->relative_coordinate (0, X_AXIS);
   Real dx = last_visible_stem(beam)->relative_coordinate (0, X_AXIS) - x0;
   Real dydx = beam_dy && dx ? beam_dy/dx : 0;
@@ -932,6 +945,9 @@ Beam::set_interface (Score_element*me)
   Pointer_group_interface g (me, "stems");
   g.set_interface ();
 
+  /*
+    why the init? No way to tell difference between default and user
+    override.  */
   me->set_elt_property ("height", gh_int2scm (0)); // ugh.
   me->set_elt_property ("y-position" ,gh_int2scm (0));
   me->set_interface (ly_symbol2scm("beam-interface"));
index 8a92e9ddf4cfedd11f116faf96f2ef01869a07a8..6861f61fc4d1e3e2f8861b9ca70831595a393b0f 100644 (file)
 */
 
 #include <math.h>
+
 #include "bezier-bow.hh"
 #include "misc.hh"
 #include "bezier.hh"
-#include "dimensions.hh"
-#include "direction.hh"
-#include "debug.hh"
-#include "main.hh"
-#include "lily-guile.hh"
-#include "paper-def.hh"
-
 
-Bezier_bow::Bezier_bow (Array<Offset> encompass, Direction dir)
+static Real F0_1 (Real x)
 {
-  alpha_ = 0;
-  dir_ = dir;
-  encompass_ = encompass;
-  to_canonical_form ();
+  return M_PI /2 *  atan(2 * x / M_PI);
 }
 
-Bezier
-Bezier_bow::get_bezier () const
+Real
+slur_height (Real width, Real h_inf, Real r_0)
 {
-  Bezier rv = curve_;
-  if (dir_ == DOWN)
-    {
-      rv.flip (Y_AXIS);
-    }
-
-  rv.rotate (alpha_);
-  rv.translate (origin_);
-  
-  return rv;
+  return F0_1 (width * r_0 / h_inf) * h_inf;
 }
 
-void
-Bezier_bow::to_canonical_form ()
-{
-  origin_ = encompass_[0];
-  translate (&encompass_, -origin_);
-
-  Offset delta = encompass_.top () - encompass_[0];
-  alpha_ = delta.arg ();
-
-  rotate (&encompass_, -alpha_);
-  if (dir_ == DOWN)
-    {
-      flip (&encompass_, Y_AXIS);
-    }
-
-  while (encompass_.size () > 1 && encompass_[1][X_AXIS] <= 0.0)
-    {
-      programming_error ("Degenerate bow: infinite steepness reqd");
-      encompass_.del (1);
-    }
-
-  Real l = encompass_.top ()[X_AXIS];
-  while (encompass_.size () > 1 && encompass_.top (1)[X_AXIS] >= l)
-    {
-      programming_error ("Degenerate bow: infinite steepness reqd");
-      encompass_.del (encompass_.size ()-2);
-    }
-}
+  /*
+  For small w, the height should be proportional to w, for w ->
+  infinity, the height should rise to a limit asymptotically.
 
-void
-Bezier_bow::set_default_bezier (Real h_inf, Real r_0)
-{
-  curve_ = get_default_bezier (h_inf, r_0);
-}
+  Hence we take F(x) such that
+  F(0) = 0 , F'(0) = 1, and F(infty) = 1
+
+  and use
+
+  h = h_infinity * F(x * r_0 / h_infinity)
+
+  
+  Examples:
+
+  * F(x) = pi/2 * atan (2x/pi)
+
+  * F(x) 1/alpha * x^alpha / (1 + x^alpha)
+
+  * (etc.)
+
+  [with the 2nd recipe you can determine how quickly the conversion from
+  `small' slurs to `big' slurs occurs.]
+
+  Although this might seem cand_idates to SCM-ify, it is not all clear
+  which parameters (ie. h_inf, r_0, F(.)) should be candidates for
+  this.  At present h_inf and r_0 come from paper settings, but we did
+  no experiments for determining the best combinations of F, h_inf and
+  r_0.
+
+  */
 
-/*
-  See Documentation/programmer/fonts.doc
- */
 Bezier
-Bezier_bow::get_default_bezier (Real h_inf, Real r_0) const
+slur_shape (Real width, Real h_inf, Real r_0)
 {
-  Offset delta (encompass_.top ()[X_AXIS] - encompass_[0][X_AXIS], 0);
-  Real b = delta.length ();
-  Real height = get_default_height (h_inf, r_0, b);
-  // urg: scmify this?
+  Bezier curve;
+  Real height =  slur_height (width, h_inf, r_0);
   Real indent = height;
 
-  Bezier curve;
   curve.control_[0] = Offset (0, 0);
   curve.control_[1] = Offset (indent, height);
-  curve.control_[2] = Offset (b - indent, height);
-  curve.control_[3] = Offset (b, 0);
+  curve.control_[2] = Offset (width - indent, height);
+  curve.control_[3] = Offset (width, 0);
   return curve;
 }
 
-/*
-  See Documentation/programmer/fonts.doc
- */
-Real
-Bezier_bow::get_default_height (Real h_inf, Real r_0, Real b) const
-{
-
-  SCM h = scm_eval (scm_listify (ly_symbol2scm ("slur-default-height"),
-                                gh_double2scm (h_inf),
-                                gh_double2scm (r_0),
-                                gh_double2scm (b),
-                                SCM_UNDEFINED));
-  return gh_scm2double (h);
-}
-  
index 02f2f055e38bbd83f4518640c9e1155787abc199..faf5b899a2662a5c0aaabc347620d1298a97d2e2 100644 (file)
@@ -29,10 +29,13 @@ binomial_coefficient (Real over , int under)
 }
 
 void
-flip (Array<Offset>* arr_p, Axis a)
+scale (Array<Offset>* arr_p, Real x , Real y)
 {
   for (int i = 0; i < arr_p->size (); i++)
-    (*arr_p)[i][a] = - (*arr_p)[i][a];
+    {
+      (*arr_p)[i][X_AXIS] = x* (*arr_p)[i][X_AXIS];
+      (*arr_p)[i][Y_AXIS] = y* (*arr_p)[i][Y_AXIS];
+    }
 }
 
 void
@@ -179,10 +182,13 @@ Bezier::extent (Axis a)const
  */
 
 void
-Bezier::flip (Axis a)
+Bezier::scale (Real x, Real y)
 {
   for (int i = CONTROL_COUNT; i--;)
-    control_[i][a] = - control_[i][a];
+    {
+      control_[i][X_AXIS] = x * control_[i][X_AXIS];
+      control_[i][Y_AXIS] = y * control_[i][Y_AXIS];
+    }
 }
 
 void
index 53b6eaa23233e37aac26c9bed67ec4b2ae4e3290..2c9e705117786d907d3eeac253729f83deb809e9 100644 (file)
@@ -28,7 +28,7 @@ Break_align_item::before_line_breaking (SCM smob)
 {
   Score_element* me = unsmob_element (smob);
   do_alignment (me);
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 Real
@@ -97,9 +97,9 @@ Break_align_item::do_alignment (Score_element *me)
        {
          next_origin = next_elt->get_elt_property ("break-align-symbol");
          next_origin =
-           (next_origin == SCM_UNDEFINED)
-           ? ly_symbol2scm ("none")
-           : next_origin;
+           gh_symbol_p (next_origin)? 
+           next_origin : ly_symbol2scm ("none")
+;
        }
       else
        next_origin = ly_symbol2scm ("begin-of-note");
index 4becdee60fa1a5c1e30134629531a0cdc2b95bf2..c05ebfc18799a7e40b2c0d9af2ee37f0831cc7de 100644 (file)
@@ -131,19 +131,19 @@ Chord_name::brew_molecule (SCM smob)
 {
   Score_element *sc = unsmob_element (smob);
   SCM style = sc->get_elt_property ("style");
-  if (style == SCM_UNDEFINED)
+
+  if (!gh_string_p (style))
     style = ly_str02scm ("banter");
 
   SCM inversion = sc-> get_elt_property ("inversion");
-  if (inversion == SCM_UNDEFINED)
+  if (inversion != SCM_BOOL_T)
     inversion = SCM_BOOL_F;
 
   SCM bass =  sc->get_elt_property ("bass");
-  if (bass == SCM_UNDEFINED)
+  if (bass != SCM_BOOL_T)
     bass = SCM_BOOL_F;
 
   SCM pitches =  sc->get_elt_property ("pitches");
-
   SCM text = scm_eval (gh_list (ly_symbol2scm ("chord::user-name"),
                                style,
                                ly_quote_scm (pitches),
index 9c1179333d1adad3dd1d75b29fd5aff28a0dc83b..1b3adc4d4cd03aa9e2f2b39c850b7a686eb9ef77 100644 (file)
@@ -46,10 +46,10 @@ Clef::before_line_breaking (SCM smob)
   else
     {
       s->suicide ();
-      return SCM_UNDEFINED;
+      return SCM_UNSPECIFIED;
     }
 
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 bool
index 0c9fb96c69bda5780ebc5e39ebcd987bf1d60645..c21897facaee943190f1950b9304f38845ce23fc 100644 (file)
@@ -18,7 +18,7 @@
 void
 Crescendo::set_interface (Score_element*s)
 {
-  s->set_elt_property ("dynamic-drul", gh_cons (SCM_UNDEFINED, SCM_UNDEFINED));
+  s->set_elt_property ("dynamic-drul", gh_cons (SCM_EOL, SCM_EOL));
 }
 
 
index ad0ba0610983301ff266d8fc98f28b6b6fd93be6..68a18a9de41b6f07acc5bc414a584a97eaa98244 100644 (file)
@@ -8,7 +8,7 @@
   JUNKME
  */
 Real
-calc_interstaff_dist (Item const *item, Spanner const *span)
+calc_interstaff_dist (Item  *item, Spanner  *span)
 {
   Real interstaff = 0.0; 
   Score_element *common = item->common_refpoint (span, Y_AXIS);
@@ -25,18 +25,18 @@ calc_interstaff_dist (Item const *item, Spanner const *span)
       if (gh_pair_p (threshold))
        interstaff =  gh_scm2double (gh_car (threshold));
 
-      Score_element const * span_refpoint = span;
+      Score_element  * span_refpoint = span;
       while (span_refpoint->parent_l  (Y_AXIS) != common)
        span_refpoint = span_refpoint->parent_l (Y_AXIS);
 
-      Score_element const * note_refpoint = item;
+      Score_element  * note_refpoint = item;
       while (note_refpoint->parent_l (Y_AXIS) != common)
        note_refpoint = note_refpoint->parent_l (Y_AXIS);
 
       int span_prio =
-       Align_interface::get_count (common,(Score_element*) dynamic_cast<Score_element const*> (span_refpoint));
+       Align_interface::get_count (common,(Score_element*) dynamic_cast<Score_element *> (span_refpoint));
       int item_prio =
-       Align_interface::get_count (common,(Score_element*) dynamic_cast<Score_element  const *> (note_refpoint));
+       Align_interface::get_count (common,(Score_element*) dynamic_cast<Score_element   *> (note_refpoint));
 
       /*
        our staff is lower -> interstaff *= -1
index 556928f7daf9d8a85f51d4efd9013f7cf0009ef2..5557790b33915819b77c26dc6b0bfbf23129514c 100644 (file)
@@ -86,7 +86,7 @@ Dot_column::do_shifts (SCM l)
   dots.sort (compare_position);
   
   if (dots.size () < 2)
-    return SCM_UNDEFINED;
+    return SCM_UNSPECIFIED;
   Slice s;
   s.set_empty ();
 
@@ -106,7 +106,7 @@ Dot_column::do_shifts (SCM l)
     }
 
   if (!conflicts)
-    return SCM_UNDEFINED;
+    return SCM_UNSPECIFIED;
   
   int  middle = s.center ();
   /*
@@ -122,7 +122,7 @@ Dot_column::do_shifts (SCM l)
       Staff_symbol_referencer::set_position (d,pos);
     }
 
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 bool
index a8150dac67b2d14580051b4d54660a74166ffe79..d37bdb4d77943ab319743c3659bb607a8c995d71 100644 (file)
@@ -29,7 +29,7 @@ Grace_align_item::before_line_breaking (SCM smob)
                             gh_double2scm (infinity_f)));
   dynamic_cast<Item*>(me)->column_l ()->set_elt_property ("contains-grace", SCM_BOOL_T);
 
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 void
index e9b361e8fae4d9f56f31bebf63a7783e023f7477..43b09f0e756b561f3dc47603bd8636ced93a618d 100644 (file)
 #include "lily-proto.hh"
 #include "lily-guile.hh"
 
-/**
-  Implement bow specific bezier curve. Calculate bezier curve for bow
-  from bow paratime_signatures.  */
-class Bezier_bow
-{
-public:
-  Bezier_bow (Array<Offset> encompass, Direction dir);
-
-  Bezier get_bezier () const;
-  Bezier get_default_bezier (Real h_inf, Real r_0) const;
-  Real get_default_height (Real h_inf, Real r_0, Real length) const;
-  void set_default_bezier (Real h_inf, Real r_0);
-
-  /**
-     The canonical bezier.
-   */
-  Bezier curve_;
-
-protected:
-  Array<Offset> encompass_;
-
-private:
-  void to_canonical_form ();
-  Direction dir_;
-  Real alpha_;
-  Offset origin_;
-};
+
+
+Bezier slur_shape (Real width, Real height_limit,
+                  Real height_proportion);
+Real slur_height (Real width, Real height_limit, Real height_proportion); 
 
 
 #endif /* BEZIER_BOW_HH */
index 1f9bd2d2523c1bde1304a8eebe302e1e360f7a85..ebdfdb3939c226d650f44fa47cdec3d69d1f616a 100644 (file)
@@ -23,7 +23,7 @@ class Bezier
 {
 public:
   void assert_sanity () const;
-  void flip (Axis);
+  void scale (Real x,Real y);
   void reverse ();
   void rotate (Real);
   void translate (Offset);
@@ -46,7 +46,7 @@ public:
   Offset control_[4];
 };
 
-void flip (Array<Offset>* arr_p, Axis a);
+void scale (Array<Offset>* arr_p, Real xscale, Real yscale);
 void rotate (Array<Offset>* arr_p, Real phi);
 void translate (Array<Offset>* arr_p, Offset o);
 
index 673941a79d5e3b772053fe850050b6d05de8e6eb..c5186008c206fa35a1ced808393fd393ae83c707 100644 (file)
@@ -11,7 +11,7 @@
 #define CROSS_STAFF_HH
 #include "lily-proto.hh"
 Real
-calc_interstaff_dist (Item const *item, Spanner const *span);
+calc_interstaff_dist (Item  *item, Spanner  *span);
 
 #endif /* CROSS_STAFF_HH */
 
index ebd656070d6d9ee485c602eb78e87da8fcd20dba..eaf4e3cebded55e30e53613213337fadae3da9db 100644 (file)
@@ -60,18 +60,9 @@ class Score_element  {
    */
   Lookup * lookup_l_;
 
-  /**
-     properties specific for this element. Destructor will not call
-     scm_unprotect, so as to allow more flexible GC arrangements.  The
-     real alist is in (cdr element_property_alist_), to reduce the
-     need for more scm_protect calls.
-
-  */
-public:                                // ugh.
+public:
   SCM immutable_property_alist_;
   SCM mutable_property_alist_;
-
-public:
   Score_element *original_l_;
 
   /**
index 7fbbffd76201a57ac8d5f0b827e3b138afd7301c..96b6cd0420999a84be31304b58b4e4a29bd408d3 100644 (file)
 
 #include "bezier-bow.hh"
 
-class Slur_bezier_bow : public Bezier_bow
+class Slur_bezier_bow
 {
+
+protected:
+  Array<Offset> encompass_;
+
+private:
+  void to_canonical_form ();
+  Direction dir_;
+  Real alpha_;
+  Offset origin_;
+  Real h_inf_, r_0_;
 public:
-  Slur_bezier_bow (Array<Offset> encompass, Direction dir);
-  Array<Real> area_x_gradients_array (Real area);
+  /**
+     The canonical bezier.
+   */
+  Bezier curve_;
+
+
+  Slur_bezier_bow (Array<Offset> encompass, Direction dir,
+                  Real hinf, Real r0);
+  Bezier get_bezier () const;
+
+  void minimise_enclosed_area (Paper_def* paper_l);
+  Real fit_factor () const;
   void blow_fit ();
   Real enclosed_area_f () const;
-  Real fit_factor () const;
-  void minimise_enclosed_area (Paper_def* paper_l, Real default_height);
+private:
+  Array<Real> area_x_gradients_array (Real area);
 };
  
 #endif /* SLUR_BEZIER_BOW_HH */
index ea46d2d474ed68af374d815d09ccd95663a2a41e..82c84cfc6acb9cb266363fb2584c2a91470418a6 100644 (file)
@@ -35,6 +35,7 @@ public:
   static Score_element * staff_symbol_l (Score_element*);
   static int line_count (Score_element*);
   static Real position_f (Score_element*);
+  static Real staff_radius (Score_element*);
 };
 
 int compare_position (Score_element *const&,Score_element *const&); 
index 8dfab669bda63ac0921237636b1a5542eb86111e..2c8545a07908b5c18da2333610c56058d5578c6e 100644 (file)
@@ -19,7 +19,7 @@ class Tie_column
 public:
   static void set_interface (Score_element*me);
   static bool has_interface (Score_element*);
-  static void add_tie (Score_element*me,Tie*);
+  static void add_tie (Score_element*me,Score_element*);
   static SCM after_line_breaking (SCM);
   static void set_directions (Score_element*me);
 };
index 422a9fa375b33162a944323a4da3e4ed812f135d..4ecd9e56d054ea07bf3c2c0c97f0f7b8fc22d828 100644 (file)
 #ifndef TIE_HH
 #define TIE_HH
 
-#include "spanner.hh"
-#include "rod.hh"
+#include "lily-guile.hh"
+#include "lily-proto.hh"
 
-/**
-  Connect two noteheads.
-  */
-class Tie : public Spanner
+class Tie
 {
 public:
-  Tie (SCM);
   static void set_head (Score_element*,Direction, Item*head_l);
   static void set_interface (Score_element*);
   static bool has_interface (Score_element*);
-  VIRTUAL_COPY_CONS(Score_element);
   static Score_element * head (Score_element*,Direction) ;
   static Real position_f (Score_element*) ;
   static SCM brew_molecule (SCM);
   static Direction get_default_dir(Score_element*) ;
-  static SCM after_line_breaking (SCM);
-
-
-  /*
-    JUNKME
-   */
-  Array<Offset> get_encompass_offset_arr () const;
-  Bezier get_curve () const;
-  Drul_array<Real> dy_f_drul_;
-  Drul_array<Real> dx_f_drul_;
+  static SCM get_control_points (SCM);
   static SCM set_spacing_rods (SCM);
-  Array<Offset> get_controls () const;
 };
 
 #endif // TIE_HH
index 737cbd6d58743ffc83326504e9c490e9a2a3bc9e..4c63681fa53de20769f48f694ff46f78d3745e84 100644 (file)
@@ -36,8 +36,15 @@ minimise_least_squares (Real * coef, Real * offset,
   
   Real den = (N*sqx - sqr (sx));
   if (!N || !den)
-    programming_error ("minimise_least_squares():  Nothing to minimise");
-
-  *coef = (N * sxy - sx*sy)/den;
-  *offset = (sy - (*coef) * sx)/N;
+    {
+      programming_error ("minimise_least_squares():  Nothing to minimise");
+      *coef = 0.0;
+      *offset = N ? sy/N : 0.0;
+    }
+  else
+    {
+      *coef = (N * sxy - sx*sy)/den;
+      *offset = (sy - (*coef) * sx)/N;
+    }
 }
+
index 04445201ede731a355c504e6374e295869f033d1..9cc338a48a5180f7e1e0b3ac751f139506c1ea21 100644 (file)
@@ -35,10 +35,8 @@ SCM
 Local_key_item::before_line_breaking (SCM smob)
 {
   Local_key_item* me = dynamic_cast<Local_key_item*>(unsmob_element (smob));
-
-  
   me->accidental_arr_.sort (Local_key_cautionary_tuple::compare);
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 Molecule
@@ -79,7 +77,7 @@ Local_key_item::brew_molecule (SCM smob)
   bool oct_b = false;
   int lastoct = -100;
   
-  for  (int i = 0; i <  lki->accidental_arr_.size(); i++) 
+  for  (int i = 0; i < lki->accidental_arr_.size(); i++) 
     {
       Musical_pitch p (lki->accidental_arr_[i].pitch_);
       // do one octave
index 2b90ce5a79be8c4ecd5dcf7ce0a538a2c1a479cf..4b7a9bdc534210762785df5bc958f378847e58c4 100644 (file)
@@ -111,6 +111,7 @@ Lookup::afm_find (String s, bool warn) const
                    gh_int2scm (cm->code),
                    SCM_UNDEFINED));
 
+
   at= fontify_atom (afm_l_,at);
   return Molecule ( afm_bbox_to_box (cm->charBBox), at);
 }
index ba2e2cbc243e25d97b6d4eb4443c6fef3aafca2a..bd177cea04372a8b1b9f8d639f7bdf2a09c7c723 100644 (file)
@@ -158,7 +158,7 @@ Multi_measure_rest::set_spacing_rods (SCM smob)
   if (!(sp->get_bound (LEFT) && sp->get_bound (RIGHT)))
     {
       programming_error ("Multi_measure_rest::get_rods (): I am not spanned!");
-      return SCM_UNDEFINED;
+      return SCM_UNSPECIFIED;
     }
 
   Item * l = sp->get_bound (LEFT)->column_l ();
@@ -187,6 +187,6 @@ Multi_measure_rest::set_spacing_rods (SCM smob)
   
       rod.add_to_cols ();
     }
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
index adfde155302b912cd23a8278cbe2ee51701c2c4f..9020ae16590f1e81ce5b710369df54faa8fa71ec 100644 (file)
@@ -100,7 +100,7 @@ My_lily_lexer::lookup_identifier (String s)
   for (int i = scope_l_arr_.size (); i--; )
     if (scope_l_arr_[i]->elem_b (sym))
       return scope_l_arr_[i]->scm_elem(sym);
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 void
index eb23429a898cd35600890618539b3bb66f503426..505b75deb0fe8228c56a35ab17ab7aff0a9db121 100644 (file)
@@ -66,11 +66,13 @@ Note_head::brew_molecule (SCM smob)
     : (abs((int)p) - sz) /2;
 
   SCM style  = me->get_elt_property ("style");
-  if (style == SCM_UNDEFINED)
+  if (!gh_symbol_p (style))
     {
       style = ly_symbol2scm("default");
     }
   
+
+  // ugh: use gh_call ()
   Molecule out = me->lookup_l()->afm_find (String ("noteheads-") + 
                ly_scm2string (scm_eval (gh_list (ly_symbol2scm("find-notehead-symbol"),
                                                  me->get_elt_property ("duration-log"),
index 3a6f547c9176be4ee6081c5e779f7416f7178729..35d19d162a5e2580603f9ca8c5c45b9f37738d14 100644 (file)
@@ -77,7 +77,7 @@ Property_engraver::apply_properties (SCM p, Score_element *e)
       SCM elt_prop_sym = gh_caddr (entry);
 
       SCM preset = e->get_elt_property (elt_prop_sym); // scm_assq(elt_prop_sym, e->property_alist_);
-      if (preset != SCM_UNDEFINED)
+      if (preset != SCM_EOL)
        continue;
   
       SCM val = get_property (prop_sym);
index 9d86cbb81bbb5ceb96a92ecd298b2bbb2cba35f7..5427a20c6ddf74507c726d48bd50fad14227cdaa 100644 (file)
@@ -96,11 +96,11 @@ Rest_collision::do_shift (Score_element *me, SCM elts)
 
   // no rests to collide
   if (!rests.size())
-    return SCM_UNDEFINED;
+    return SCM_UNSPECIFIED;
 
   // no partners to collide with
   if (rests.size() + notes.size () < 2)
-    return SCM_UNDEFINED;
+    return SCM_UNSPECIFIED;
 
   // meisjes met meisjes
   if (!notes.size()) 
@@ -169,7 +169,7 @@ Rest_collision::do_shift (Score_element *me, SCM elts)
 
       Interval restdim = Note_column::rest_dim (rcol);
       if (restdim.empty_b ())
-       return SCM_UNDEFINED;
+       return SCM_UNSPECIFIED;
       
       // staff ref'd?
       Real staff_space = me->paper_l()->get_var ("interline");
@@ -210,7 +210,7 @@ Rest_collision::do_shift (Score_element *me, SCM elts)
       
       Note_column::translate_rests (rcol,dir * discrete_dist);
     }
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 void
index 7f4e6cf4f7246504ec7f59c430eae8ca0f2dd2f0..e3a1de5043fa22e73324a9f7d382d89436f8af6e 100644 (file)
@@ -34,7 +34,7 @@ Rest::after_line_breaking (SCM smob)
                           gh_int2scm ((bt == 7) ? 4 : 3));
     }
 
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 
index 3c4af38059204a34c17cc494b904793e5e90f39a..f53cd8e9b26470ddeb6255274f2a18fb4804b40c 100644 (file)
@@ -102,7 +102,7 @@ Score_element::get_elt_property (SCM sym) const
     return gh_cdr (s);
 
   s = scm_sloppy_assq (sym, immutable_property_alist_);
-  return (s == SCM_BOOL_F) ? SCM_UNDEFINED : gh_cdr (s); 
+  return (s == SCM_BOOL_F) ? SCM_EOL : gh_cdr (s); 
 }
 
 /*
@@ -114,8 +114,8 @@ SCM
 Score_element::remove_elt_property (const char* key)
 {
   SCM val = get_elt_property (key);
-  if (val != SCM_UNDEFINED)
-    set_elt_property (key, SCM_UNDEFINED);
+  if (val != SCM_EOL)
+    set_elt_property (key, SCM_EOL);
   return val;
 }
 
@@ -762,7 +762,7 @@ ly_set_elt_property (SCM elt, SCM sym, SCM val)
     {
       error ("Not a symbol");
       ly_display_scm (sym);
-      return SCM_UNDEFINED;
+      return SCM_UNSPECIFIED;
     }
 
   if (sc)
@@ -775,7 +775,7 @@ ly_set_elt_property (SCM elt, SCM sym, SCM val)
       ly_display_scm (elt);
     }
 
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 
@@ -793,7 +793,7 @@ ly_get_elt_property (SCM elt, SCM sym)
       error ("Not a score element");
       ly_display_scm (elt);
     }
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 
index 02676f0145213d268214556ca4a6689aa0b75090..73da3806688a3830b46036b2c7c8fb4ff138cad2 100644 (file)
@@ -56,7 +56,7 @@ Script_column_engraver::do_post_move_processing ()
 void
 Script_column_engraver::acknowledge_element( Score_element_info inf) 
 {
-  if (Side_position::has_interface (inf.elem_l_))
+  if (Side_position::has_interface (inf.elem_l_)) // ugh FIXME
     {
       Item *thing = dynamic_cast<Item*> (inf.elem_l_);
       if (thing
index 0da72b3d4b0f396f94854ef3c3e9ee984e14d95e..15b2eb58e982dee8397e0d2548a80b99cdc395bf 100644 (file)
@@ -70,6 +70,6 @@ Script_column::before_line_breaking (SCM smob)
     
   } while (flip (&d) != DOWN);
 
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
index 9cc53480a590a0b09c057661e3b741cfaa6849d6..677dbd22d7e517094f149484c4b86d6c0f1c29e0 100644 (file)
@@ -45,7 +45,7 @@ Script::after_line_breaking (SCM smob)
   Direction d = Side_position::get_direction (me);
   Side_position::set_direction (me,d);
 
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 MAKE_SCHEME_CALLBACK(Script,brew_molecule);
index cc6f70c219ac5450617da42981eb1e009d08677b..e0082e84b0c971c702d3404388bc8863f7c6a293 100644 (file)
@@ -92,7 +92,7 @@ Separating_group_spanner::set_spacing_rods (SCM smob)
       it->suicide ();
     }
   me->suicide ();
-  return SCM_UNDEFINED ;
+  return SCM_UNSPECIFIED ;
 }
 
 void
index c6598c608dbd478ec7e9ca5f66146e051fcc32e1..de2d398b70ad7eb9776fa2af73bcc4c7b6f5bb92 100644 (file)
@@ -219,10 +219,11 @@ Side_position::add_staff_support (Score_element*me)
 void
 Side_position::set_axis (Score_element*me, Axis a)
 {
+  /*
   // prop transparent ? 
   if (me->get_elt_property ("side-support-elements") == SCM_UNDEFINED)
     me->set_elt_property ("side-support-elements" ,SCM_EOL);
-
+  */
   if (!me->has_offset_callback_b (aligned_side, a))
     me->add_offset_callback (aligned_side, a);
 }
@@ -262,13 +263,13 @@ Side_position::set_padding (Score_element*me, Real p)
 bool
 Side_position::has_interface (Score_element*me) 
 {
-  return me->get_elt_property ("side-support-elements") != SCM_UNDEFINED;
+  return me->get_elt_property ("side-support-elements") != SCM_EOL;
 }
 
 bool
 Side_position::supported_b (Score_element*me) 
 {
-  SCM s =me->get_elt_property  ("side-support-elements"); 
+  SCM s = me->get_elt_property  ("side-support-elements"); 
   return s != SCM_UNDEFINED && s != SCM_EOL;
 }
 
index 0dc7ba241866effca0137ddb2a4bbe8e59ba5de8..e23f528a24a387f466b8d6978e61f527fbae529e 100644 (file)
 #include "slur-bezier-bow.hh"
 #include "main.hh"
 
-Slur_bezier_bow::Slur_bezier_bow (Array<Offset> encompass, Direction dir)
-  : Bezier_bow (encompass, dir)
+Slur_bezier_bow::Slur_bezier_bow (Array<Offset> encompass, Direction dir,
+                                 Real h_inf, Real r_0)
 {
+  h_inf_ = h_inf;
+  r_0_ = r_0;
+  alpha_ = 0;
+  dir_ = dir;
+  encompass_ = encompass;
+  to_canonical_form ();
+
+  Real w = encompass_.top ()[X_AXIS] - encompass_[0][X_AXIS];
+  curve_ = slur_shape (w, h_inf, r_0);
 }
 
+Bezier
+Slur_bezier_bow::get_bezier () const
+{
+  Bezier rv = curve_;
+  if (dir_ == DOWN)
+    {
+      rv.scale (1, -1);
+    }
+
+  rv.rotate (alpha_);
+  rv.translate (origin_);
+  
+  return rv;
+}
+
+void
+Slur_bezier_bow::to_canonical_form ()
+{
+  origin_ = encompass_[0];
+  translate (&encompass_, -origin_);
+
+  Offset delta = encompass_.top () - encompass_[0];
+  alpha_ = delta.arg ();
+
+  rotate (&encompass_, -alpha_);
+  if (dir_ == DOWN)
+    {
+      scale (&encompass_, 1, -1);
+    }
+
+  while (encompass_.size () > 1 && encompass_[1][X_AXIS] <= 0.0)
+    {
+      programming_error ("Degenerate bow: infinite steepness reqd");
+      encompass_.del (1);
+    }
+
+  Real l = encompass_.top ()[X_AXIS];
+  while (encompass_.size () > 1 && encompass_.top (1)[X_AXIS] >= l)
+    {
+      programming_error ("Degenerate bow: infinite steepness reqd");
+      encompass_.del (encompass_.size ()-2);
+    }
+}
+
+
+
 void
 Slur_bezier_bow::blow_fit ()
 {
@@ -84,17 +139,21 @@ Slur_bezier_bow::area_x_gradients_array (Real area)
   return da;
 }
 
+/*
+  ugh, should have another look, and use a regular optimization
+  algorithm, instead of this homebrew.
+*/
 void
-Slur_bezier_bow::minimise_enclosed_area (Paper_def* paper_l,
-                                        Real default_height)
+Slur_bezier_bow::minimise_enclosed_area (Paper_def* paper_l)
 {
   Real length = curve_.control_[3][X_AXIS]; 
+
   Real sb = paper_l->get_var ("slur_beautiful");
-  Real beautiful = length * default_height * sb;
+  Real beautiful = sb * length * slur_height (length, h_inf_, r_0_);
 
   DEBUG_OUT << to_str ("Beautiful: %f\n", beautiful);
   DEBUG_OUT << to_str ("Length: %f\n", length);
-  DEBUG_OUT << to_str ("D-height: %f\n", default_height);
+  //  DEBUG_OUT << to_str ("D-height: %f\n", default_height);
   DEBUG_OUT << to_str ("FitFac: %f\n", fit_factor ());
 
   if (fit_factor () > 1.0)
index f93069848dd170cace81f414eddb091a8ef8c305..19cabbc6c1d29a117ffade4201b08ed8f4be3fd0 100644 (file)
@@ -37,9 +37,7 @@
 void
 Slur::set_interface (Score_element*me)
 {
-  me-> set_elt_property ("attachment", gh_cons (SCM_BOOL_F, SCM_BOOL_F));
-  me->set_elt_property ("note-columns", SCM_EOL);
-  me->set_elt_property ("control-points", SCM_EOL);
+  me->set_elt_property ("attachment", gh_cons (SCM_BOOL_F, SCM_BOOL_F));
   me->set_interface (ly_symbol2scm ("slur-interface"));
 }
 
@@ -160,7 +158,7 @@ Slur::after_line_breaking (SCM smob)
   Score_element *me = unsmob_element (smob);
   set_extremities (me);
   set_control_points (me);
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 } 
 
 void
@@ -361,10 +359,12 @@ Slur::set_spacing_rods (SCM smob)
   Spanner*sp = dynamic_cast<Spanner*>(me);
   r.item_l_drul_[LEFT] = sp->get_bound (LEFT);
   r.item_l_drul_[RIGHT] = sp->get_bound (RIGHT);
-  r.distance_f_ = me->paper_l ()->get_var ("slur_x_minimum");
+  r.distance_f_ =
+    gh_scm2double (me->get_elt_property ("minimum-length"))
+    * me->paper_l ()->get_var ("staffspace");
 
   r.add_to_cols ();
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 
@@ -376,7 +376,8 @@ SCM
 Slur::brew_molecule (SCM smob)
 {
   Score_element * me = unsmob_element (smob);
-  Real thick = me->paper_l ()->get_var ("slur_thickness");
+  Real thick = me->paper_l ()->get_var ("stafflinethickness") *
+    gh_scm2double (me->get_elt_property ("thickness"));
   Bezier one = get_curve (me);
 
   Molecule a;
@@ -392,20 +393,20 @@ Slur::brew_molecule (SCM smob)
 void
 Slur::set_control_points (Score_element*me)
 {
-  Slur_bezier_bow bb (get_encompass_offset_arr (me),
-                     Directional_element_interface (me).get ());
-
-  Real staff_space = Staff_symbol_referencer::staff_space (me);
-  Real h_inf = me->paper_l ()->get_var ("slur_height_limit_factor") * staff_space;
+  Real staff_space = Staff_symbol_referencer::staff_space ((Score_element*)me);  
+  Real h_inf = me->paper_l ()->get_var ("slur_height_limit_factor") *
+    staff_space;
   Real r_0 = me->paper_l ()->get_var ("slur_ratio");
-
-  bb.set_default_bezier (h_inf, r_0);
+  
+  Slur_bezier_bow bb (get_encompass_offset_arr (me),
+                     Directional_element_interface (me).get (),
+                     h_inf, r_0);
 
   if (bb.fit_factor () > 1.0)
     {
       Real length = bb.curve_.control_[3][X_AXIS]; 
-      Real default_height = bb.get_default_height (h_inf, r_0, length);
-      bb.minimise_enclosed_area (me->paper_l(), default_height);
+      Real default_height = slur_height (length, h_inf, r_0);
+      bb.minimise_enclosed_area (me->paper_l());
       
       Real bff = me->paper_l ()->get_var ("slur_force_blowfit");
       bb.curve_.control_[1][Y_AXIS] *= bff;
index 234be7314e3ee134638822055e4a8163992503bd..d0320270051f061479343eed80dccc364b019093 100644 (file)
@@ -327,7 +327,7 @@ Spacing_spanner::set_springs (SCM smob)
     farewell, cruel world
    */
   me->suicide ();
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 
index eab329b9eaec5ed68b7ba7134462f14449e04807..e4e790da14d36e626e8fdb89c5713caf89c5fbe8 100644 (file)
@@ -47,7 +47,7 @@ Span_bar::before_line_breaking (SCM smob)
   
   evaluate_empty (unsmob_element (smob));
 
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 Real
index b67c577954ceac377f443636cdd4fa4778f47cb0..85b52f5aabc69a605ee96a33f28e9dea22aad621 100644 (file)
@@ -142,6 +142,15 @@ Staff_symbol_referencer::set_position (Score_element*me,Real p)
   me->add_offset_callback (callback, Y_AXIS);
 }
 
+/*
+  half  of the height, in staff space.
+ */
+Real
+Staff_symbol_referencer::staff_radius (Score_element*me)
+{
+  return  (line_count (me) -1) / 2;
+}
+
 
 int
 compare_position (Score_element *const  &a, Score_element * const &b)
index a8583c450a91b2bd1d3899cc751e806d498d6d29..9a0f2b468881c936591192ce256989e312e99811 100644 (file)
@@ -378,7 +378,7 @@ Stem::before_line_breaking (SCM smob)
     }
   
   set_spacing_hints (me);
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 
index 41b0dc32383e13749264329a8b5b2d5c29acd90c..ae4be7d551b757dbc0443b544c4a433fa3c2fa88 100644 (file)
@@ -69,7 +69,7 @@ SCM
 System_start_delimiter::after_line_breaking (SCM smob)
 {
   try_collapse (unsmob_element (smob));
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 void
index cd3badc526d83dd2cae796d88b3a89d40e500a27..346fa9992e0af2d23d664a84686408729c8d0380 100644 (file)
@@ -7,6 +7,7 @@
   
  */
 
+#include "spanner.hh"
 #include "tie-column.hh"
 #include "group-interface.hh"
 #include "tie.hh"
@@ -18,7 +19,6 @@
 void
 Tie_column::set_interface (Score_element*me)
 {
-  me-> set_elt_property ("ties", SCM_EOL);
   me->set_interface (ly_symbol2scm ("tie-column"));
   me->set_extent_callback (0, X_AXIS);
   me->set_extent_callback (0, Y_AXIS);  
@@ -31,7 +31,7 @@ Tie_column::has_interface (Score_element*me)
 }
 
 void
-Tie_column::add_tie (Score_element*me,Tie *s)
+Tie_column::add_tie (Score_element*me,Score_element *s)
 {
   Pointer_group_interface g (me, "ties");
   if (!g.count ())
@@ -46,8 +46,8 @@ Tie_column::add_tie (Score_element*me,Tie *s)
 
 
 int
-tie_compare (Tie* const & s1,
-            Tie* const & s2)
+tie_compare (Score_element* const & s1,
+            Score_element* const & s2)
 {
   return sign (Tie::position_f (s1) - Tie::position_f(s2));
 }
@@ -64,8 +64,8 @@ tie_compare (Tie* const & s1,
 void
 Tie_column::set_directions (Score_element*me)
 {
-  Link_array<Tie> ties =
-    Pointer_group_interface__extract_elements (me, (Tie*)0, "ties");
+  Link_array<Score_element> ties =
+    Pointer_group_interface__extract_elements (me, (Score_element*)0, "ties");
 
 
   Direction d = Directional_element_interface (me).get ();
@@ -74,7 +74,7 @@ Tie_column::set_directions (Score_element*me)
     {
       for (int i = ties.size (); i--;)
        {
-         Tie * t = ties[i];
+         Score_element *  t = ties[i];
          Directional_element_interface (t).set (d);
        }
       return;
@@ -82,7 +82,7 @@ Tie_column::set_directions (Score_element*me)
   
   if (ties.size () == 1)
     {
-      Tie * t = ties[0];      
+      Score_element *  t = ties[0];      
       Directional_element_interface (t).set (Tie::get_default_dir (t));
       return;
     }
@@ -97,7 +97,7 @@ Tie_column::set_directions (Score_element*me)
 
   for (int i=ties.size(); i--; )
     {
-      Tie * t = ties[i];
+      Score_element *  t = ties[i];
       Real p = Tie::position_f (t);
       Direction d = (Direction) sign (p);
       if (!d)
@@ -112,5 +112,5 @@ SCM
 Tie_column::after_line_breaking (SCM smob)
 {
   set_directions (unsmob_element (smob));
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
index d3ac6c48cd07732652b81cb598497b90dad97d8b..0f3f3b23007844e3a4b4e0bfda59e1ece727c21f 100644 (file)
@@ -13,6 +13,7 @@
 #include "musical-request.hh"
 #include "tie.hh"
 #include "translator-group.hh"
+#include "spanner.hh"
 #include "tie-column.hh"
 #include "pqueue.hh"
 #include "engraver.hh"
@@ -50,7 +51,7 @@ class Tie_engraver : public Engraver
   Tie_req *req_l_;
   Array<CHead_melodic_tuple> now_heads_;
   Array<CHead_melodic_tuple> stopped_heads_;
-  Link_array<Tie> tie_p_arr_;
+  Link_array<Score_element> tie_p_arr_;
 
   Spanner * tie_column_p_;
   
@@ -178,7 +179,7 @@ Tie_engraver::process_acknowledged ()
          
          SCM pair = gh_list_ref (head_list, gh_int2scm (i/2));
          
-         Tie * p = new Tie (basic);
+         Spanner * p = new Spanner (basic);
          Tie::set_head (p,LEFT, dynamic_cast<Item*> (unsmob_element (gh_car (pair))));
          Tie::set_head (p,RIGHT, dynamic_cast<Item*> (unsmob_element (gh_cdr (pair))));
          
@@ -187,7 +188,7 @@ Tie_engraver::process_acknowledged ()
        }
       else for (SCM s = head_list; gh_pair_p (s); s = gh_cdr (s))
        {
-         Tie * p = new Tie (basic);
+         Score_element * p = new Spanner (basic);
          Tie::set_interface (p);
          
          Tie::set_head (p, LEFT, dynamic_cast<Item*> (unsmob_element (gh_caar (s))));
index 85332353a825616c3dbf739ab5268f3b2b0bfcc5..8e1cacf4867793839683d14192504a6e67a0e226 100644 (file)
@@ -7,6 +7,7 @@
 */
 #include <math.h>
 
+#include "spanner.hh"
 #include "lookup.hh"
 #include "paper-def.hh"
 #include "tie.hh"
 #include "bezier-bow.hh"
 #include "stem.hh"
 
+/*
+  tie: Connect two noteheads.
+
+  What if we have
+
+  c4 ~ \clef bass ; c4 or
+
+  c4 \staffchange c4
+
+  do we have non-horizontal ties then?
+  */
+
+
 void
 Tie::set_head (Score_element*me,Direction d, Item * head_l)
 {
@@ -30,18 +44,13 @@ Tie::set_head (Score_element*me,Direction d, Item * head_l)
   me->add_dependency (head_l);
 }
 
-Tie::Tie(SCM s)
-  : Spanner (s)
-{
-  dy_f_drul_[LEFT] = dy_f_drul_[RIGHT] = 0.0;
-  dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0;
-}
 void
 Tie::set_interface (Score_element*me)
 {
   me->set_elt_property ("heads", gh_cons (SCM_EOL, SCM_EOL));
   me->set_interface (ly_symbol2scm ("tie-interface"));
 }
+
 bool
 Tie::has_interface (Score_element*me)
 {
@@ -66,8 +75,9 @@ Tie::position_f (Score_element*me)
 
 
 /*
-  ugh: direction of the Tie is more complicated.  See [Ross] p136 and further
- */
+  The direction of the Tie is more complicated (See [Ross] p136 and
+  further), the case of multiple ties is handled by Tie_column.
+*/
 Direction
 Tie::get_default_dir (Score_element*me) 
 {
@@ -82,93 +92,127 @@ Tie::get_default_dir (Score_element*me)
 }
 
 
-
-MAKE_SCHEME_CALLBACK(Tie,after_line_breaking);
 SCM
-Tie::after_line_breaking (SCM smob)
-{
-  Tie*me = dynamic_cast<Tie*> (unsmob_element (smob));
-  
-  if (!head (me,LEFT) && !head (me,RIGHT))
+Tie::get_control_points (SCM smob)
+{  
+  Spanner*me = dynamic_cast<Spanner*> (unsmob_element (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_UNDEFINED;
+      return SCM_UNSPECIFIED;
     }
-
+  
   if (!Directional_element_interface (me).get ())
     Directional_element_interface (me).set (Tie::get_default_dir (me));
   
   Real staff_space = Staff_symbol_referencer::staff_space (me);
-  Real half_space = staff_space / 2;
-  Real x_gap_f = me->paper_l ()->get_var ("tie_x_gap");
-  Real y_gap_f = me->paper_l ()->get_var ("tie_y_gap");
 
-  /* 
-   Slur and tie placement [OSU]
+  Real x_gap_f = me->paper_l ()->get_var ("tie_x_gap");
 
-   Ties:
+  Score_element* commonx = me->common_refpoint (me->get_bound (LEFT), X_AXIS);
+  commonx = me->common_refpoint (me->get_bound (RIGHT), X_AXIS);
+  
+  Score_element* l = me->get_bound (LEFT);
+  Score_element* r = me->get_bound (RIGHT);  
+  Real width = r->relative_coordinate (commonx, X_AXIS)
+    + r->extent (X_AXIS)[LEFT]
+    - l->relative_coordinate (commonx, X_AXIS)
+    - l->extent (X_AXIS)[RIGHT]
+    -2* x_gap_f;
+
+  Real left_x = l->extent (X_AXIS)[RIGHT] + x_gap_f;
+  
+  Direction dir = Directional_element_interface (me).get();
+  
+  Real h_inf = me->paper_l ()->get_var ("tie_height_limit_factor") * staff_space;
+  Real r_0 = me->paper_l ()->get_var ("tie_ratio");
 
-       * x = inner vertical tangent - d * gap
 
-   */
+  Bezier b  = slur_shape (width, h_inf, r_0);
+  
+  Offset leave_dir = b.control_[1] - b.control_[0];
 
+  Real dx = (head (me, headdir)->extent (X_AXIS).length () + x_gap_f)/2.0;
+  Real max_gap = leave_dir[Y_AXIS] * dx / leave_dir[X_AXIS];
 
   /*
-    OSU: not different for outer notes, so why all me code?
-    ie,  can we drop me, or should it be made switchable.
-   */
-  if (head (me,LEFT))
-    me->dx_f_drul_[LEFT] = Tie::head (me,LEFT)->extent (X_AXIS).length ();
-  else
-    me->dx_f_drul_[LEFT] = dynamic_cast<Spanner*>(me)->get_broken_left_end_align ();
-  me->dx_f_drul_[LEFT] += x_gap_f;
-  me->dx_f_drul_[RIGHT] -= x_gap_f;
+    for small ties (t small) we want to start in the Y-center (so dy = 0), for
+    large ties, the tie should appear to come from the center of the
+    head, so dy = max_gap
 
-  /* 
-   Slur and tie placement [OSU]  -- check me
+    maybe use a different formula?
 
-   Ties:
+    TODO: what if 2 heads have different size.
 
-       * y = dx <  5ss: horizontal tangent
-        y = dx >= 5ss: y next interline - d * 0.25 ss
+    TODO: for small ties, it is better to start over the heads
+    iso. next to the heads. 
+  */
+  Real t = (width / staff_space - 5.0);        // ugh.
+  Real dy = t > 0 ? max_gap * sqr (t / (1 + t)) : 0.0;
 
-        which probably means that OSU assumes that
+  Real ypos = Tie::position_f (me) * staff_space/2 + dir * dy;
 
-           dy <= 5 dx
+  /*
+    todo: prevent ending / staffline collision.
 
-        for smal slurs
+    todo: tie / stem collision
    */
 
+  b = slur_shape(width,h_inf, r_0);
+  b.scale (1, dir);
+  b.translate (Offset (left_x, ypos));
+  
 
-  Real ypos = Tie::position_f (me);
+  /*
+    Avoid colliding of the horizontal part with stafflines.
+    
+    should do me for slurs as well.
 
-  Real y_f = half_space * ypos; 
-  int ypos_i = int (ypos);
-  Real dx_f = me->extent (X_AXIS).length () + me->dx_f_drul_[RIGHT] - me->dx_f_drul_[LEFT];
-  Direction dir = Directional_element_interface (me).get();
-  if (dx_f < me->paper_l ()->get_var ("tie_staffspace_length"))
+   */
+  Array<Real> horizontal (b.solve_derivative (Offset (1,0)));
+  if (horizontal.size ())
     {
-      if (abs (ypos_i) % 2)
-       y_f += dir * half_space;
-      y_f += dir * y_gap_f;
+      /*
+       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;
+      if (fabs (y) <= Staff_symbol_referencer::staff_radius (me)
+         && fabs (diff) < me->paper_l ()->get_var ("tie_staffline_clearance"))
+       {
+         newy = ry - 0.5 * staff_space * sign (diff) ;
+       }
+
+      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
-    {
-      if (! (abs (ypos_i) % 2))
-       y_f += dir * half_space;
-      y_f += dir * half_space;
-      y_f -= dir * y_gap_f;
-    }
-  
-  me->dy_f_drul_[LEFT] = me->dy_f_drul_[RIGHT] = y_f;
+    programming_error ("Tie is nowhere horizontal");
 
-  return SCM_UNDEFINED;
-}
 
 
+  SCM controls = SCM_EOL;
+  for (int i= 4; i--;)
+    controls = gh_cons ( ly_offset2scm (b.control_[i]), controls);
+  return controls;
+}
+
 MAKE_SCHEME_CALLBACK(Tie,set_spacing_rods);
+
+/*
+  TODO: set minimum distances for begin/end of line
+ */
 SCM
 Tie::set_spacing_rods (SCM smob)  
 {
@@ -179,94 +223,41 @@ Tie::set_spacing_rods (SCM smob)
   r.item_l_drul_ [LEFT]=sp->get_bound (LEFT);
   r.item_l_drul_ [RIGHT]=sp->get_bound (RIGHT);  
   
-  r.distance_f_ = me->paper_l ()->get_var ("tie_x_minimum");
+  r.distance_f_
+    = gh_scm2double (me->get_elt_property ("minimum-length"))
+    * me->paper_l ()->get_var ("staffspace");
   r.add_to_cols ();
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
-
-
-
-
-
 MAKE_SCHEME_CALLBACK(Tie,brew_molecule);
 SCM
 Tie::brew_molecule (SCM smob) 
 {
   Score_element*me = unsmob_element (smob);
-  Real thick = me->paper_l ()->get_var ("tie_thickness");
-  Bezier one = dynamic_cast<Tie*> (me)->get_curve ();
 
-  Molecule a;
-  SCM d =  me->get_elt_property ("dashed");
-  if (gh_number_p (d))
-    a = me->lookup_l ()->dashed_slur (one, thick, gh_scm2int (d));
-  else
-    a = me->lookup_l ()->slur (one, Directional_element_interface (me).get () * thick, thick);
+  SCM cp = me->get_elt_property ("control-points");
+  if (cp == SCM_EOL)
+    {
+      cp = get_control_points (smob);
+      me->set_elt_property ("control-points", cp);
+    }
   
-  return a.create_scheme(); 
-}
-
-
+  Real thick =
+    gh_scm2double (me->get_elt_property ("thickness"))
+    * me->paper_l ()->get_var ("stafflinethickness");
 
-Bezier
-Tie::get_curve () const
-{
-  Score_element*me = (Score_element*)this;
-  Direction d (Directional_element_interface (me).get ());
-  Bezier_bow b (get_encompass_offset_arr (), d);
-
-  Real staff_space = Staff_symbol_referencer::staff_space (me);
-  Real h_inf = paper_l ()->get_var ("tie_height_limit_factor") * staff_space;
-  Real r_0 = paper_l ()->get_var ("tie_ratio");
-
-  b.set_default_bezier (h_inf, r_0);
-  Bezier c = b.get_bezier ();
-
-  /*
-    Avoid colliding of the horizontal part with stafflines.
-    
-    should do me for slurs as well.
-
-   */
-  Array<Real> horizontal (c.solve_derivative (Offset (1,0)));
-
-  
-  if (horizontal.size ())
+  Bezier b;
+  int i = 0;
+  for (SCM s= cp; s != SCM_EOL; s = gh_cdr (s))
     {
-      /*
-       ugh. Doesnt work for non-horizontal curves.
-       */
-      Real y = c.curve_point (horizontal[0])[Y_AXIS];
-
-      Real ry = rint (y/staff_space) * staff_space;
-      Real diff = ry - y;
-      Real newy = y;
-      if (fabs (y) <= 2.0
-         && fabs (diff) < paper_l ()->get_var ("tie_staffline_clearance"))
-       {
-         newy = ry - 0.5 * staff_space * sign (diff) ;
-       }
-
-      Real y0 = c.control_ [0][Y_AXIS];
-      c.control_[2][Y_AXIS] = 
-      c.control_[1][Y_AXIS] =
-       (c.control_[1][Y_AXIS] - y0)  * ((newy - y0) / (y - y0)) + y0; 
+      b.control_[i] = ly_scm2offset (gh_car (s));
+      i++;
     }
-  else
-    programming_error ("Tie is nowhere horizontal");
-  return c;
-}
-
-Array<Offset>
-Tie::get_encompass_offset_arr () const
-{
-  Array<Offset> offset_arr;
-  offset_arr.push (Offset (dx_f_drul_[LEFT], dy_f_drul_[LEFT]));
-  offset_arr.push (Offset (spanner_length () + dx_f_drul_[RIGHT],
-                          dy_f_drul_[RIGHT]));
-                     
-  return offset_arr;
+  
+   Molecule a = me->lookup_l ()->slur (b, Directional_element_interface (me).get () * thick, thick);
+   
+   return a.create_scheme ();
 }
 
 
index 4e1bf9212aa84a7ce37b9ff7ecdb1059d268e138..62de8aa63414296d4bec85bc88a789fb677cca0f 100644 (file)
@@ -453,7 +453,6 @@ Translator_group::get_property (SCM sym) const
   if (daddy_trans_l_)
     return daddy_trans_l_->get_property (sym);
   
-
   return SCM_UNDEFINED;
 }
 
index 10ddf988768e54c2b3fb197c59789bd22f357b7d..a86a222c8488f2ab4b79e73287f3b716b23482e8 100644 (file)
@@ -128,7 +128,8 @@ Tuplet_spanner::calc_position_and_height (Score_element*me,Real *offset, Real *
     Pointer_group_interface__extract_elements (me, (Score_element*)0, "columns");
 
 
-  Score_element * common = me->common_refpoint (me->get_elt_property ("columns"), Y_AXIS);
+  Score_element * commony = me->common_refpoint (me->get_elt_property ("columns"), Y_AXIS);
+  Score_element * commonx = me->common_refpoint (me->get_elt_property ("columns"), X_AXIS);  
   
   Direction d = Directional_element_interface (me).get ();
 
@@ -145,8 +146,8 @@ Tuplet_spanner::calc_position_and_height (Score_element*me,Real *offset, Real *
   
   if (l < r)
     {
-      *dy = column_arr[r]->extent (Y_AXIS) [d] + column_arr[r]->relative_coordinate (common, Y_AXIS)
-       - column_arr[l]->extent (Y_AXIS) [d] - column_arr[l]->relative_coordinate (common, Y_AXIS);
+      *dy = column_arr[r]->extent (Y_AXIS) [d] + column_arr[r]->relative_coordinate (commony, Y_AXIS)
+       - column_arr[l]->extent (Y_AXIS) [d] - column_arr[l]->relative_coordinate (commony, Y_AXIS);
     }
   else
     * dy = 0;
@@ -157,17 +158,18 @@ Tuplet_spanner::calc_position_and_height (Score_element*me,Real *offset, Real *
   if (!column_arr.size ())
     return;
   
-  Real x0 = column_arr[0]->relative_coordinate (0, X_AXIS);
-  Real x1 = column_arr.top ()->relative_coordinate (0, X_AXIS);
+  Real x0 = column_arr[0]->relative_coordinate (commonx, X_AXIS);
+  Real x1 = column_arr.top ()->relative_coordinate (commonx, X_AXIS);
   
   Real factor = column_arr.size () > 1 ? 1/(x1 - x0) : 1.0;
   
   for (int i = 0; i < column_arr.size ();  i++)
     {
-      Real notey = column_arr[i]->extent (Y_AXIS)[d] +
-       column_arr[i]->relative_coordinate (common, Y_AXIS)
-       ;
-      Real x = column_arr[i]->relative_coordinate (0, X_AXIS) - x0;
+      Real notey = column_arr[i]->extent (Y_AXIS)[d] 
+       + column_arr[i]->relative_coordinate (commony, Y_AXIS)
+       - me->relative_coordinate (commony, Y_AXIS);
+
+      Real x = column_arr[i]->relative_coordinate (commonx, X_AXIS) - x0;
       Real tuplety =  *dy * x * factor;
 
       if (notey * d > (*offset + tuplety) * d)
@@ -202,7 +204,7 @@ Tuplet_spanner::after_line_breaking (SCM smob)
   if (!column_arr.size ())
     {
       me->suicide ();
-      return SCM_UNDEFINED;
+      return SCM_UNSPECIFIED;
     }
 
   Direction d = Directional_element_interface (me).get ();
@@ -230,7 +232,7 @@ Tuplet_spanner::after_line_breaking (SCM smob)
          && sp->get_bound (RIGHT)->column_l () == beam_l->get_bound (RIGHT)->column_l ())
        me->set_elt_property ("parallel-beam", SCM_BOOL_T);
     }
-  return SCM_UNDEFINED;
+  return SCM_UNSPECIFIED;
 }
 
 
index 38052c5ba294659658b9d10a034d1fcd74f4ea5b..295e1665aed78cf0749f8295a43936c5af02e4a6 100644 (file)
@@ -29,7 +29,7 @@ Volta_spanner::set_interface (Score_element*me)
 
 
 /*
-  me is too complicated. Yet another version of side-positioning,
+  this is too complicated. Yet another version of side-positioning,
   badly implemented.
 
   --
@@ -71,6 +71,9 @@ Volta_spanner::brew_molecule (SCM smob)
   Real h = me->paper_l()->get_var ("volta_spanner_height");
   Real t = me->paper_l ()->get_var ("volta_thick");
 
+  /*
+    ugh: should build from line segments.
+   */
   SCM at = (gh_list (ly_symbol2scm ("volta"),
                     gh_double2scm (h),
                     gh_double2scm (w),
index da81fa71ef47c2062146e0e8f325e8225bc89d09..f458dda6c0830af09a437e3607ad5421263c75f4 100644 (file)
@@ -598,7 +598,9 @@ ScoreContext = \translator {
        )
        basicSlurProperties = #`(
                (molecule-callback . ,Slur::brew_molecule)
-               (spacing-procedure . ,Slur::set_spacing_rods)           
+               (thickness . 1.2)               
+               (spacing-procedure . ,Slur::set_spacing_rods)           e
+               (minimum-length . 1.5)
                (after-line-breaking-callback . ,Slur::after_line_breaking) 
        )
        basicSpacingSpannerProperties =#`(
@@ -662,8 +664,9 @@ ScoreContext = \translator {
        )
        basicTieProperties = #`(
                (molecule-callback . ,Tie::brew_molecule)
-               (after-line-breaking-callback . ,Tie::after_line_breaking)
-               (spacing-procedure . ,Tie::set_spacing_rods)                            
+               (spacing-procedure . ,Tie::set_spacing_rods)
+               (thickness . 1.2)
+               (minimum-length  . 2.5)
                (interfaces . (tie-interface))
        )
        basicTieColumnProperties = #`(
index ba6494591d0a4cba133cca27e86022bd0912faa7..e8643883668d7d6071cf9ec0ca131944cc7cc39a 100644 (file)
@@ -132,20 +132,13 @@ bezier_area_steps = 1.0;
   Tie parameters
 %}
 
-tie_height_limit_factor = \slur_height_limit_factor;
+tie_height_limit_factor = 1.0 ; 
 tie_ratio = \slur_ratio;
-tie_thickness = \slur_thickness;
 
-tie_x_minimum = \staffspace + \slur_x_minimum;
 % OSU: tie gap == slur gap
 tie_x_gap = \slur_x_gap;
-tie_y_gap = 0.25 * \staffspace;
-% length of a tie that's a staffspace high
-tie_staffspace_length = 4.0 * \staffspace;
-
-tie_staffline_clearance = 2.0 *\tie_thickness;
-
 
+tie_staffline_clearance = 2.0 *\slur_thickness;
 
 
 % ugh
index a615f9564f13c9b38b8d4c16a9d3164cb2920d43..9e8146da48a73b1fac413f19173dd68620da5ad0 100644 (file)
 (define stem-shorten '(0.5))
 (define grace-stem-shorten '(0.0))
 
-;; urg
-(define pi (* 2 (acos 0)))
-
-(define (slur-default-height h-inf r-0 b)
-  (let ((alpha (/ (* 2.0 h-inf) pi))
-       (beta (/ (* pi r-0) (* 2.0 h-inf))))
-    (* alpha (atan (* beta b)))))