source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1996--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
Jan Nieuwenhuizen <janneke@gnu.org>
*/
#include "cross-staff.hh"
#include "group-interface.hh"
#include "staff-symbol-referencer.hh"
-#include "lily-guile.icc"
-
class Slur_bezier_bow : public Bezier_bow
{
Slur
*/
-Slur::Slur ()
+Slur::Slur (SCM s)
+ : Spanner (s)
{
// URG
dy_f_drul_[LEFT] = dy_f_drul_[RIGHT] = 0.0;
dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0;
- set_elt_property ("note-columns", SCM_EOL);
+ set_elt_pointer ("note-columns", SCM_EOL);
set_elt_property ("control-points", SCM_EOL);
-
-#if 0
- /*
- I still don't understand the merits of this Group_interface.
- */
- Group_interface c (this, "control-points");
- c.set_interface ();
-#endif
}
void
Slur::add_column (Note_column*n)
{
- if (!gh_pair_p (n->get_elt_property ("note-heads")))
+ if (!gh_pair_p (n->get_elt_pointer ("note-heads")))
warning (_ ("Putting slur over rest. Ignoring."));
else
{
- Group_interface gi (this, "note-columns");
- gi.add_element (n);
+ Pointer_group_interface (this, "note-columns").add_element (n);
add_dependency (n);
}
}
Slur::get_default_dir () const
{
Link_array<Note_column> encompass_arr =
- Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+ Pointer_group_interface__extract_elements (this, (Note_column*)0, "note-columns");
Direction d = DOWN;
for (int i=0; i < encompass_arr.size (); i ++)
Slur::do_add_processing ()
{
Link_array<Note_column> encompass_arr =
- Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+ Pointer_group_interface__extract_elements (this, (Note_column*)0, "note-columns");
if (encompass_arr.size ())
{
if (!stem_l)
{
warning (_ ("Slur over rest?"));
- o[X_AXIS] = col->hpos_f ();
+ o[X_AXIS] = col->relative_coordinate (0, X_AXIS);
o[Y_AXIS] = col->extent (Y_AXIS)[dir];
return o;
}
Direction stem_dir = directional_element (stem_l).get ();
- o[X_AXIS] = stem_l->hpos_f ();
+ o[X_AXIS] = stem_l->relative_coordinate (0, X_AXIS);
/*
Simply set x to middle of notehead
}
void
-Slur::do_post_processing ()
+Slur::after_line_breaking ()
{
set_extremities ();
set_control_points ();
Slur::set_extremities ()
{
Link_array<Note_column> encompass_arr =
- Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+ Pointer_group_interface__extract_elements (this, (Note_column*)0, "note-columns");
if (!encompass_arr.size ())
{
- set_elt_property ("transparent", SCM_BOOL_T);
- set_empty (X_AXIS);
- set_empty (Y_AXIS);
+ suicide();
return;
}
*/
else
{
- dx_f_drul_[d] = stem_l->hpos_f ()
+ dx_f_drul_[d] = stem_l->relative_coordinate (0, X_AXIS)
- get_bound (d)->relative_coordinate (0, X_AXIS);
/*
side attached to beamed stem
Slur::cross_staff_count ()const
{
Link_array<Note_column> encompass_arr =
- Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+ Pointer_group_interface__extract_elements (this, (Note_column*)0, "note-columns");
int k=0;
Slur::get_encompass_offset_arr () const
{
Link_array<Note_column> encompass_arr =
- Group_interface__extract_elements (this, (Note_column*)0, "note-columns");
+ Pointer_group_interface__extract_elements (this, (Note_column*)0, "note-columns");
Array<Offset> offset_arr;
+
#if 0
/*
check non-disturbed slur
{
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");
a.push (r);
+MAKE_SCHEME_SCORE_ELEMENT_CALLBACKS(Slur);
+
/*
Ugh should have dash-length + dash-period
*/
}
Bezier b = bb.get_bezier ();
- SCM controls = array_to_scm (b.control_);
+
+
+ SCM controls = SCM_EOL;
+ for (int i= 4; i--;)
+ controls = gh_cons ( ly_offset2scm (b.control_[i]), controls);
+
set_elt_property ("control-points", controls);
}
Slur::get_curve () const
{
Bezier b;
- Array<Offset> controls (4);
- scm_to_array (get_elt_property ("control-points"), &controls);
- b.control_ = controls;
+ int i = 0;
+
+ if (!directional_element (this).get ())
+ ((Slur*)this)->set_extremities ();
+
+ if (!gh_pair_p (get_elt_property ("control-points")))
+ ((Slur*)this)->set_control_points ();
+
+
+ for (SCM s= 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 (this).get ();