]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/slur.cc
patch::: 1.3.79.jcn3
[lilypond.git] / lily / slur.cc
index 05ff6477eafef83fbbf80becce13cd5acf83393e..a2228c73ce13da30d21186a27ce28401b7a197a7 100644 (file)
@@ -9,6 +9,7 @@
 
 /*
   [TODO]
+    * fix broken interstaff slurs
     * begin and end should be treated as a/acknowledge Scripts.
     * broken slur should have uniform trend
     * smart changing of endings
 #include "debug.hh"
 #include "slur-bezier-bow.hh"
 #include "main.hh"
-#include "cross-staff.hh"
 #include "group-interface.hh"
 #include "staff-symbol-referencer.hh"
+#include "spanner.hh"
 
-Slur::Slur (SCM s)
-  : Spanner (s)
+
+void
+Slur::set_interface (Score_element*me)
 {
-  set_elt_property ("attachment", gh_cons (SCM_BOOL_F, SCM_BOOL_F));
-  set_elt_pointer ("note-columns", SCM_EOL);
-  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"));
 }
 
 void
-Slur::add_column (Note_column*n)
+Slur::add_column (Score_element*me, Score_element*n)
 {
-  if (!gh_pair_p (n->get_elt_pointer ("note-heads")))
+  if (!gh_pair_p (n->get_elt_property ("note-heads")))
     warning (_ ("Putting slur over rest.  Ignoring."));
   else
     {
-      Pointer_group_interface (this, "note-columns").add_element (n);
-      add_dependency (n);
+      Pointer_group_interface (me, "note-columns").add_element (n);
+      me->add_dependency (n);
     }
 
-  add_bound_item (this, n);
+  add_bound_item (dynamic_cast<Spanner*> (me), dynamic_cast<Item*>(n));
 }
 
 void
-Slur::de_uglyfy (Slur_bezier_bow* bb, Real default_height)
+Slur::de_uglyfy (Score_element*me, Slur_bezier_bow* bb, Real default_height)
 {
   Real length = bb->curve_.control_[3][X_AXIS] ; 
   Real ff = bb->fit_factor ();
@@ -66,9 +67,9 @@ Slur::de_uglyfy (Slur_bezier_bow* bb, Real default_height)
       Real h = bb->curve_.control_[i][Y_AXIS] * ff / length;
 
       Real f = default_height / length;
-      Real c1 = paper_l ()->get_var ("bezier_control1");
-      Real c2 = paper_l ()->get_var ("bezier_control2");
-      Real c3 = paper_l ()->get_var ("bezier_control3");
+      Real c1 = me->paper_l ()->get_var ("bezier_control1");
+      Real c2 = me->paper_l ()->get_var ("bezier_control2");
+      Real c3 = me->paper_l ()->get_var ("bezier_control3");
       if (h > c1 * f)
        {
          h = c1 * f; 
@@ -85,15 +86,15 @@ Slur::de_uglyfy (Slur_bezier_bow* bb, Real default_height)
 }
 
 Direction
-Slur::get_default_dir () const
+Slur::get_default_dir (Score_element*me) 
 {
-  Link_array<Note_column> encompass_arr =
-    Pointer_group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+  Link_array<Score_element> encompass_arr =
+    Pointer_group_interface__extract_elements (me, (Score_element*)0, "note-columns");
   
   Direction d = DOWN;
   for (int i=0; i < encompass_arr.size (); i ++) 
     {
-      if (encompass_arr[i]->dir () < 0) 
+      if (Note_column::dir (encompass_arr[i]) < 0) 
        {
          d = UP;
          break;
@@ -102,36 +103,25 @@ Slur::get_default_dir () const
   return d;
 }
 
-void
-Slur::do_add_processing ()
-{
-#if 0
-  Link_array<Note_column> encompass_arr =
-    Pointer_group_interface__extract_elements (this, (Note_column*)0, "note-columns");
 
-  if (encompass_arr.size ())
-    {
-      set_bound (LEFT, encompass_arr[0]);    
-      if (encompass_arr.size () > 1)
-       set_bound (RIGHT, encompass_arr.top ());
-    }
-#endif
-}
 
 
 
 Offset
-Slur::encompass_offset (Note_column const* col) const
+Slur::encompass_offset (Score_element*me,
+                       Score_element* col,
+                       Score_element **common) 
 {
   Offset o;
-  Stem* stem_l = col->stem_l ();
-  Direction dir = Directional_element_interface (this).get ();
+  Score_element* stem_l = unsmob_element (col->get_elt_property ("stem"));
+  
+  Direction dir = Directional_element_interface (me).get ();
   
   if (!stem_l)
     {
       warning (_ ("Slur over rest?"));
-     o[X_AXIS] = col->relative_coordinate (0, X_AXIS);
-      o[Y_AXIS] = col->extent (Y_AXIS)[dir];
+      o[X_AXIS] = col->relative_coordinate (common[X_AXIS], X_AXIS);
+      o[Y_AXIS] = col->relative_coordinate (common[Y_AXIS], Y_AXIS);
       return o;  
     }
   Direction stem_dir = Directional_element_interface (stem_l).get ();
@@ -146,87 +136,58 @@ Slur::encompass_offset (Note_column const* col) const
   if ((stem_dir == dir)
       && !stem_l->extent (Y_AXIS).empty_b ())
     {
-      o[Y_AXIS] = stem_l->extent (Y_AXIS)[dir];
+      o[Y_AXIS] = stem_l->relative_coordinate (common[Y_AXIS], Y_AXIS); // iuhg
+      o[Y_AXIS] += stem_l->extent (Y_AXIS)[dir];
     }
   else
     {
-      o[Y_AXIS] = col->extent (Y_AXIS)[dir];
+      o[Y_AXIS] = col->relative_coordinate (common[Y_AXIS], Y_AXIS);   // ugh
+      o[Y_AXIS] += col->extent (Y_AXIS)[dir];
     }
 
   /*
    leave a gap: slur mustn't touch head/stem
    */
-  o[Y_AXIS] += dir * paper_l ()->get_var ("slur_y_free");
-  o[Y_AXIS] -= calc_interstaff_dist (stem_l, this);
+  o[Y_AXIS] += dir * me->paper_l ()->get_var ("slur_y_free");
   return o;
 }
 
-GLUE_SCORE_ELEMENT(Slur,after_line_breaking);
-
+MAKE_SCHEME_CALLBACK (Slur, after_line_breaking);
 SCM
-Slur::member_after_line_breaking ()
+Slur::after_line_breaking (SCM smob)
 {
-  set_extremities ();
-  set_control_points ();
-  return SCM_UNDEFINED;
+  Score_element *me = unsmob_element (smob);
+  if (!gh_scm2int(scm_length (me->get_elt_property ("note-columns"))))
+    {
+      me->suicide ();
+      return SCM_UNSPECIFIED;
+    }
+  set_extremities (me);
+  set_control_points (me);
+  return SCM_UNSPECIFIED;
 } 
 
-SCM
-slur_get_bound (SCM slur, SCM dir)
-{
-  return ((Slur*)unsmob_element (slur))->get_bound (to_dir (dir))->self_scm_;
-}
-
-SCM
-score_element_get_pointer (SCM se, SCM name)
-{
-  SCM s = scm_assq (name, unsmob_element (se)->pointer_alist_);
-  return (s == SCM_BOOL_F) ? SCM_UNDEFINED : gh_cdr (s); 
-}
-
-SCM
-score_element_get_property (SCM se, SCM name)
-{
-  SCM s = scm_assq (name, unsmob_element (se)->property_alist_);
-  return (s == SCM_BOOL_F) ? SCM_UNDEFINED : gh_cdr (s); 
-}
-
 void
-init_score_elts ()
+Slur::set_extremities (Score_element*me)
 {
-  scm_make_gsubr ("get-pointer", 2 , 0, 0,  
-                 (SCM(*)(...)) score_element_get_pointer);
-  scm_make_gsubr ("get-property", 2 , 0, 0,  
-                 (SCM(*)(...)) score_element_get_property);
-  scm_make_gsubr ("get-bound", 2 , 0, 0,  
-                 (SCM(*)(...)) slur_get_bound);
-}
-
-ADD_SCM_INIT_FUNC (score_elt, init_score_elts);
-
-void
-Slur::set_extremities ()
-{
-  if (!Directional_element_interface (this).get ())
-    Directional_element_interface (this).set (get_default_dir ());
+  if (!Directional_element_interface (me).get ())
+    Directional_element_interface (me).set (get_default_dir (me));
 
   Direction dir = LEFT;
   do 
     {
-      if (!gh_symbol_p (index_cell (get_elt_property ("attachment"), dir)))
+      if (!gh_symbol_p (index_cell (me->get_elt_property ("attachment"), dir)))
        {
          
          // for (SCM s = get_elt_property ("slur-extremity-rules"); s != SCM_EOL; s = gh_cdr (s))
          for (SCM s = scm_eval (ly_symbol2scm ("slur-extremity-rules"));
               s != SCM_EOL; s = gh_cdr (s))
            {
-             SCM r = scm_eval (scm_listify (gh_caar (s),
-                                            this->self_scm_,
-                                            gh_int2scm ((int)dir),
-                                            SCM_UNDEFINED));
+             SCM r = gh_call2 (gh_caar (s), me->self_scm (),
+                                gh_int2scm ((int)dir));
              if (r != SCM_BOOL_F)
                {
-                 index_set_cell (get_elt_property ("attachment"), dir,
+                 index_set_cell (me->get_elt_property ("attachment"), dir,
                                  gh_cdar (s));
                  break;
                }
@@ -237,217 +198,233 @@ Slur::set_extremities ()
 }
 
 Offset
-Slur::get_attachment (Direction dir) const
+Slur::get_attachment (Score_element*me,Direction dir,
+                     Score_element **common) 
 {
-  SCM s = get_elt_property ("attachment");
+  Spanner*sp = dynamic_cast<Spanner*>(me);
+  SCM s = me->get_elt_property ("attachment");
   SCM a = dir == LEFT ? gh_car (s) : gh_cdr (s);
   String str = ly_symbol2string (a);
-  Real ss = Staff_symbol_referencer_interface (this).staff_space ();
+  Real ss = Staff_symbol_referencer::staff_space ((Score_element*)me);
   Real hs = ss / 2.0;
   Offset o;
-  if (Note_column* n = dynamic_cast<Note_column*> (get_bound (dir)))
+  
+  Score_element *stem = 0;
+  if (Note_column::has_interface (sp->get_bound (dir)))
     {
-      if (Stem* st = dynamic_cast<Stem*> (n->stem_l ()))
+      Score_element * n =sp->get_bound (dir);
+      if (Score_element *stem = Note_column::stem_l (n))
        {
+
          if (str == "head")
            {
-             o = Offset (0, st->chord_start_f ());
+             o = Offset (0, Stem::chord_start_f (stem));
              /*
                Default position is centered in X, on outer side of head Y
               */
              o += Offset (0.5 * n->extent (X_AXIS).length (),
-                          0.5 * ss * Directional_element_interface (this).get ());
+                          0.5 * ss * Directional_element_interface (me).get ());
            }
          else if (str == "alongside-stem")
            {
-             o = Offset (0, st->chord_start_f ());
+             o = Offset (0, Stem::chord_start_f (stem));
              /*
                Default position is on stem X, on outer side of head Y
               */
              o += Offset (n->extent (X_AXIS).length ()
-                          * (1 + st->get_direction ()),
-                          0.5 * ss * Directional_element_interface (this).get ());
+                          * (1 + Stem::get_direction (stem)),
+                          0.5 * ss * Directional_element_interface (me).get ());
            }
          else if (str == "stem")
            {
-             o = Offset (0, st->stem_end_position () * hs);
+             o = Offset (0, Stem::stem_end_position (stem) * hs);
              /*
                Default position is on stem X, at stem end Y
               */
              o += Offset (0.5 *
                           (n->extent (X_AXIS).length ()
-                           - st->extent (X_AXIS).length ())
-                           * (1 + st->get_direction ()),
+                           - stem->extent (X_AXIS).length ())
+                           * (1 + Stem::get_direction (stem)),
                            0);
            }
-         else if (str == "loose-end")
-           {
-             SCM other_a = dir == LEFT ? gh_cdr (s) : gh_car (s);
-             if (ly_symbol2string (other_a) != "loose-end")
-               {
-                 o = Offset (0, get_attachment (-dir)[Y_AXIS]);
-               }
-           }
-
-         
-         SCM l = scm_assoc
-           (scm_listify (a,
-                         gh_int2scm (st->get_direction () * dir),
-                         gh_int2scm (Directional_element_interface (this).get () * dir),
-                         SCM_UNDEFINED),
-            scm_eval (ly_symbol2scm ("slur-extremity-offset-alist")));
-         
-         if (l != SCM_BOOL_F)
-           {
-             o += ly_scm2offset (gh_cdr (l)) * ss * dir;
-           }
        }
     }
-
+  else if (str == "loose-end")
+    {
+      SCM other_a = dir == LEFT ? gh_cdr (s) : gh_car (s);
+      if (ly_symbol2string (other_a) != "loose-end")
+       {
+         o = Offset (0, get_attachment (me, -dir, common)[Y_AXIS]);
+       }
+    }
+         
+  SCM l = scm_assoc
+    (scm_listify (a,
+                 gh_int2scm (stem ? Stem::get_direction (stem) : 1 * dir),
+                 gh_int2scm (Directional_element_interface (me).get () * dir),
+                 SCM_UNDEFINED),
+     scm_eval (ly_symbol2scm ("slur-extremity-offset-alist")));
+  
+  if (l != SCM_BOOL_F)
+    {
+      o += ly_scm2offset (gh_cdr (l)) * ss * dir;
+    }
 
   /*
-    URG
+    What if get_bound () is not a note-column?
    */
-
-  if (str != "loose-end")
-    {
-      Link_array<Note_column> encompass_arr =
-       Pointer_group_interface__extract_elements (this, (Note_column*)0,
-                                                  "note-columns");
-      o -= Offset (0, calc_interstaff_dist (dir == LEFT ? encompass_arr[0]
-                                           : encompass_arr.top (), this));
+  if (str != "loose-end"
+      && sp->get_bound (dir)->common_refpoint (common[Y_AXIS], Y_AXIS) == common[Y_AXIS])
+    {      
+      o[Y_AXIS] += sp->get_bound (dir)->relative_coordinate (common[Y_AXIS], Y_AXIS) 
+       - me->relative_coordinate (common[Y_AXIS], Y_AXIS);
     }
+
   return o;
 }
 
-int
-Slur::cross_staff_count ()const
+Array<Offset>
+Slur::get_encompass_offset_arr (Score_element*me) 
 {
-  Link_array<Note_column> encompass_arr =
-    Pointer_group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+  Spanner*sp = dynamic_cast<Spanner*>(me);
+  SCM eltlist = me->get_elt_property ("note-columns");
+  Score_element *common[] = {me->common_refpoint (eltlist,X_AXIS),
+                            me->common_refpoint (eltlist,Y_AXIS)};
 
-  int k=0;
 
-  for (int i = 0; i < encompass_arr.size (); i++)
+  common[X_AXIS] = common[X_AXIS]->common_refpoint (sp->get_bound (RIGHT), X_AXIS);
+  common[X_AXIS] = common[X_AXIS]->common_refpoint (sp->get_bound (LEFT), X_AXIS);
+  
+  Link_array<Score_element>  encompass_arr;
+  while (gh_pair_p (eltlist))
     {
-      if (calc_interstaff_dist (encompass_arr[i], this))
-       k++;
+      encompass_arr.push (unsmob_element (gh_car (eltlist)));      
+      eltlist =gh_cdr (eltlist);
     }
-  return k;
-}
+  encompass_arr.reverse ();
 
-
-Array<Offset>
-Slur::get_encompass_offset_arr () const
-{
-  Link_array<Note_column> encompass_arr =
-    Pointer_group_interface__extract_elements (this, (Note_column*)0, "note-columns");
   
   Array<Offset> offset_arr;
 
-  Offset origin (relative_coordinate (0, X_AXIS), 0);
+  Offset origin (me->relative_coordinate (common[X_AXIS], X_AXIS),
+                me->relative_coordinate (common[Y_AXIS], Y_AXIS)); 
 
   int first = 1;
   int last = encompass_arr.size () - 2;
 
-  offset_arr.push (get_attachment (LEFT));
+  offset_arr.push (get_attachment (me, LEFT, common));
 
   /*
     left is broken edge
   */
-  int cross_count  = cross_staff_count ();
 
-  /*
-    URG
-  */
-  bool cross_b = cross_count && cross_count < encompass_arr.size ();
-  if (encompass_arr[0] != get_bound (LEFT))
+  if (encompass_arr[0] != sp->get_bound (LEFT))
     {
       first--;
-      Real is = calc_interstaff_dist (encompass_arr[0], this);
-      if (cross_b)
-       offset_arr[0][Y_AXIS] += is;
+
+      // ?
+      offset_arr[0][Y_AXIS] -=
+       encompass_arr[0]->relative_coordinate (common[Y_AXIS], Y_AXIS) 
+       - me->relative_coordinate (common[Y_AXIS], Y_AXIS); 
     }
 
   /*
     right is broken edge
   */
-  if (encompass_arr.top () != get_bound (RIGHT))
+  if (encompass_arr.top () != sp->get_bound (RIGHT))
     {
       last++;
     }
 
   for (int i = first; i <= last; i++)
     {
-      Offset o (encompass_offset (encompass_arr[i]));
+      Offset o (encompass_offset (me, encompass_arr[i], common));
       offset_arr.push (o - origin);
     }
 
-  offset_arr.push (Offset (spanner_length (), 0) + get_attachment (RIGHT));
+  offset_arr.push (Offset (sp->spanner_length (), 0) + get_attachment (me, RIGHT,common));
+
+  if (encompass_arr[0] != sp->get_bound (LEFT))
+    {
+      offset_arr.top ()[Y_AXIS] -= encompass_arr.top ()->relative_coordinate (common[Y_AXIS], Y_AXIS) 
+       - me->relative_coordinate (common[Y_AXIS], Y_AXIS);
+    }
 
   return offset_arr;
 }
 
 
-Array<Rod>
-Slur::get_rods () const
+MAKE_SCHEME_CALLBACK(Slur,set_spacing_rods);
+SCM
+Slur::set_spacing_rods (SCM smob)
 {
-  Array<Rod> a;
-  Rod r;
-  
-  r.item_l_drul_[LEFT] = get_bound (LEFT);
-  r.item_l_drul_[RIGHT] = get_bound (RIGHT);
-  r.distance_f_ = paper_l ()->get_var ("slur_x_minimum");
+  Score_element*me = unsmob_element (smob);
 
-  a.push (r);
-  return a;
+  Rod r;
+  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_ =
+    gh_scm2double (me->get_elt_property ("minimum-length"))
+    * me->paper_l ()->get_var ("staffspace");
+
+  r.add_to_cols ();
+  return SCM_UNSPECIFIED;
 }
 
 
 /*
   Ugh should have dash-length + dash-period
  */
-GLUE_SCORE_ELEMENT(Slur,brew_molecule);
+MAKE_SCHEME_CALLBACK (Slur, brew_molecule);
 SCM
-Slur::member_brew_molecule () const
+Slur::brew_molecule (SCM smob)
 {
-  Real thick = paper_l ()->get_var ("slur_thickness");
-  Bezier one = get_curve ();
+  Score_element * me = unsmob_element (smob);
+  if (!gh_scm2int(scm_length (me->get_elt_property ("note-columns"))))
+    {
+      me->suicide ();
+      return SCM_EOL;
+    }
+
+  Real thick = me->paper_l ()->get_var ("stafflinethickness") *
+    gh_scm2double (me->get_elt_property ("thickness"));
+  Bezier one = get_curve (me);
 
   Molecule a;
-  SCM d =  get_elt_property ("dashed");
+  SCM d =  me->get_elt_property ("dashed");
   if (gh_number_p (d))
-    a = lookup_l ()->dashed_slur (one, thick, thick * gh_scm2double (d));
+    a = me->lookup_l ()->dashed_slur (one, thick, thick * gh_scm2double (d));
   else
-    a = lookup_l ()->slur (one, Directional_element_interface (this).get () * thick, thick);
+    a = me->lookup_l ()->slur (one, Directional_element_interface (me).get () * thick, thick);
 
   return a.create_scheme();
 }
 
 void
-Slur::set_control_points ()
+Slur::set_control_points (Score_element*me)
 {
-  Slur_bezier_bow bb (get_encompass_offset_arr (),
-                     Directional_element_interface (this).get ());
-
-  Real staff_space = Staff_symbol_referencer_interface (this).staff_space ();
-  Real h_inf = paper_l ()->get_var ("slur_height_limit_factor") * staff_space;
-  Real r_0 = paper_l ()->get_var ("slur_ratio");
-
-  bb.set_default_bezier (h_inf, r_0);
+  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");
+  
+  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 (paper_l(), default_height);
+      Real default_height = slur_height (length, h_inf, r_0);
+      bb.minimise_enclosed_area (me->paper_l());
       
-      Real bff = paper_l ()->get_var ("slur_force_blowfit");
+      Real bff = me->paper_l ()->get_var ("slur_force_blowfit");
       bb.curve_.control_[1][Y_AXIS] *= bff;
       bb.curve_.control_[2][Y_AXIS] *= bff;
       bb.blow_fit ();
 
-      Real sb = paper_l ()->get_var ("slur_beautiful");
+      Real sb = me->paper_l ()->get_var ("slur_beautiful");
       Real beautiful = length * default_height * sb;
       Real area = bb.enclosed_area_f ();
       
@@ -455,7 +432,7 @@ Slur::set_control_points ()
        Slurs that fit beautifully are not ugly
       */
       if (area > beautiful)
-       de_uglyfy (&bb, default_height);
+       de_uglyfy (me, &bb, default_height);
     }
 
   Bezier b = bb.get_bezier ();
@@ -463,38 +440,44 @@ Slur::set_control_points ()
 
   SCM controls = SCM_EOL;
   for (int i= 4; i--;)
-    controls = gh_cons ( ly_offset2scm (b.control_[i]), controls);
+    {
+      controls = gh_cons ( ly_offset2scm (b.control_[i]), controls);
+      /*
+       BRRR WHURG.
+       All these null control-points, where do they all come from?
+      */
+      if (i && b.control_[i][X_AXIS] == 0)
+       me->suicide ();
+    }
 
-  set_elt_property ("control-points", controls);
+  me->set_elt_property ("control-points", controls);
 }
   
-  
 Bezier
-Slur::get_curve () const
+Slur::get_curve (Score_element*me) 
 {
   Bezier b;
   int i = 0;
 
-  if (!Directional_element_interface (this).get ()
-      || ! gh_symbol_p (index_cell (get_elt_property ("attachment"), LEFT)))
-    ((Slur*)this)->set_extremities ();
-  
-  if (!gh_pair_p (get_elt_property ("control-points")))
-    ((Slur*)this)->set_control_points ();
+  if (!Directional_element_interface (me).get ()
+      || ! gh_symbol_p (index_cell (me->get_elt_property ("attachment"), LEFT)))
+    set_extremities (me);
   
-  
-  for (SCM s= get_elt_property ("control-points"); s != SCM_EOL; s = gh_cdr (s))
+  if (!gh_pair_p (me->get_elt_property ("control-points")))
+    set_control_points (me);
+
+  for (SCM s= me->get_elt_property ("control-points"); s != SCM_EOL; s = gh_cdr (s))
     {
       b.control_[i] = ly_scm2offset (gh_car (s));
       i++;
     }
-  
-  Array<Offset> enc (get_encompass_offset_arr ());
-  Direction dir = Directional_element_interface (this).get ();
+
+  Array<Offset> enc (get_encompass_offset_arr (me));
+  Direction dir = Directional_element_interface (me).get ();
   
   Real x1 = enc[0][X_AXIS];
   Real x2 = enc.top ()[X_AXIS];
-  
+
   Real off = 0.0;
   for (int i=1; i < enc.size ()-1; i++)
     {
@@ -509,3 +492,11 @@ Slur::get_curve () const
   return b;
 }
 
+
+bool
+Slur::has_interface (Score_element*me)
+{
+  return me->has_interface (ly_symbol2scm ("slur-interface"));
+}
+
+