SCM support = me->get_elt_property ("side-support");
for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
{
- Score_element * e = unsmob_element ( gh_car (s));
+ Score_element * e = unsmob_element (gh_car (s));
if (e)
common = common->common_refpoint (e, axis);
}
dim = Interval(0,0);
}
- Real off = me->parent_l (axis)->relative_coordinate (common, axis);
-
-
Direction dir = Side_position_interface (me).get_direction ();
- SCM pad = me->remove_elt_property ("padding");
- if (gh_number_p (pad))
+ Real off = me->parent_l (axis)->relative_coordinate (common, axis);
+ SCM minimum = me->remove_elt_property ("minimum-space");
+
+ Real total_off = dim[dir] + off;
+ SCM padding = me->remove_elt_property ("padding");
+ if (gh_number_p (padding))
{
- off += gh_scm2double (pad) * dir;
+ total_off += gh_scm2double (padding) * dir;
+ }
+ if (gh_number_p (minimum) && total_off * dir < gh_scm2double (minimum))
+ {
+ total_off = gh_scm2double (minimum) * dir;
}
- Real total_off = dim[dir] + off;
-
if (fabs (total_off) > 100 CM)
programming_error ("Huh ? Improbable staff side dim.");
{
Direction d = to_dir (align);
Interval ext(elm->extent (ax));
- if (d)
+
+ if (ext.empty_b ())
+ {
+ programming_error ("I'm empty. Can't align on self");
+ return 0.0;
+ }
+ else if (d)
{
return - ext[d];
}
return 0.0;
}
+
+
Real
directed_round (Real f, Direction d)
{
if (elt_l_->get_elt_property ("side-support") == SCM_UNDEFINED)
elt_l_->set_elt_property ("side-support" ,SCM_EOL);
- elt_l_->dim_cache_[a]->off_callbacks_.push (aligned_side);
+ if (!elt_l_->has_offset_callback_b (aligned_side, a))
+ elt_l_->add_offset_callback (aligned_side, a);
}
void
Side_position_interface::set_quantised (Axis a)
{
- Dimension_cache * c = elt_l_->dim_cache_[a];
-
- c->off_callbacks_.push (quantised_position);
+ elt_l_->add_offset_callback (quantised_position, a);
}
Axis
Side_position_interface::get_axis () const
{
- Dimension_cache * c = elt_l_->dim_cache_[X_AXIS];
- for (int i=0 ; i < c->off_callbacks_.size();i ++)
- if (c->off_callbacks_[i] == side_position
- ||c->off_callbacks_[i] == aligned_side)
- return X_AXIS;
+ if (elt_l_->has_offset_callback_b (&side_position, X_AXIS)
+ || elt_l_->has_offset_callback_b (&aligned_side , X_AXIS))
+ return X_AXIS;
return Y_AXIS;
elt_l_->set_elt_property ("direction", gh_int2scm (d));
}
+void
+Side_position_interface::set_minimum_space (Real m)
+{
+ elt_l_->set_elt_property ("minimum-space", gh_double2scm (m));
+}
+
+void
+Side_position_interface::set_padding (Real p)
+{
+ elt_l_->set_elt_property ("padding", gh_double2scm (p));
+}
+
bool
Side_position_interface::has_interface_b () const
{