#include "side-position-interface.hh"
-#include <math.h> // ceil.
+#include <cmath> // ceil.
#include <algorithm>
-
+using namespace std;
#include "note-head.hh"
#include "warn.hh"
#include "warn.hh"
#include "dimensions.hh"
#include "staff-symbol-referencer.hh"
-#include "group-interface.hh"
+#include "pointer-group-interface.hh"
#include "directional-element-interface.hh"
#include "staff-symbol-referencer.hh"
#include "string-convert.hh"
-using namespace std;
-
void
Side_position_interface::add_support (Grob *me, Grob *e)
{
Direction
Side_position_interface::get_direction (Grob *me)
{
- SCM d = me->get_property ("direction");
- if (is_direction (d) && to_dir (d))
- return to_dir (d);
-
Direction relative_dir = Direction (1);
SCM reldir = me->get_property ("side-relative-direction"); // should use a lambda.
if (is_direction (reldir))
- {
- relative_dir = to_dir (reldir);
- }
+ relative_dir = to_dir (reldir);
- SCM other_elt = me->get_property ("direction-source");
+ SCM other_elt = me->get_object ("direction-source");
Grob *e = unsmob_grob (other_elt);
if (e)
- {
- return (Direction) (relative_dir * get_grob_direction (e));
- }
+ return (Direction) (relative_dir * get_grob_direction (e));
return CENTER;
}
Side_position_interface::general_side_position (Grob *me, Axis a, bool use_extents)
{
Real ss = Staff_symbol_referencer::staff_space (me);
- SCM support = me->get_property ("side-support-elements");
- Grob *common = common_refpoint_of_list (support, me->get_parent (a), a);
+
+ extract_grob_set (me, "side-support-elements", support);
+
+ Grob *common = common_refpoint_of_array (support, me->get_parent (a), a);
Grob *st = Staff_symbol_referencer::get_staff_symbol (me);
bool include_staff = (st
&& a == Y_AXIS
dim = st->extent (common, Y_AXIS);
}
- for (SCM s = support; s != SCM_EOL; s = scm_cdr (s))
+ for (int i = 0; i < support.size (); i++)
{
- Grob *e = unsmob_grob (scm_car (s));
+ Grob *e = support[i];
if (e)
if (use_extents)
dim.unite (e->extent (common, a));
if (dim.is_empty ())
dim = Interval (0, 0);
- Direction dir = Side_position_interface::get_direction (me);
+ Direction dir = get_grob_direction (me);
Real off = me->get_parent (a)->relative_coordinate (common, a);
Real minimum_space = ss * robust_scm2double (me->get_property ("minimum-space"), -1);
programming_error (msg);
}
- return scm_make_real (total_off);
+ return scm_from_double (total_off);
}
/*
{
Grob *me = unsmob_grob (element_smob);
- Direction d = Side_position_interface::get_direction (me);
+ Direction d = get_grob_direction (me);
Grob *stsym = Staff_symbol_referencer::get_staff_symbol (me);
if (stsym)
rp += d;
}
- return scm_make_real ((rp - p) * Staff_symbol_referencer::staff_space (me) / 2.0);
+ return scm_from_double ((rp - p) * Staff_symbol_referencer::staff_space (me) / 2.0);
}
- return scm_make_real (0.0);
+ return scm_from_double (0.0);
}
/*
Grob *me = unsmob_grob (element_smob);
Axis a = (Axis) scm_to_int (axis);
- Direction d = Side_position_interface::get_direction (me);
-
+ Direction d = get_grob_direction (me);
Real o = scm_to_double (aligned_on_support_extents (element_smob, axis));
Interval iv = me->extent (me, a);
o += d * max (diff, 0.0);
}
- return scm_make_real (o);
+ return scm_from_double (o);
}
void
"victim object relative to the support (left or right, up or down?)\n\n "
"The routine also takes the size the staff into account if "
"@code{staff-padding} is set. If undefined, the staff symbol is ignored.",
- "staff-padding side-support-elements direction-source "
- "direction side-relative-direction minimum-space padding");
+
+ /* properties */
+ "direction "
+ "direction-source "
+ "minimum-space "
+ "padding "
+ "side-relative-direction "
+ "side-support-elements "
+ "slur-padding "
+ "staff-padding "
+ );