source file of the GNU LilyPond music typesetter
- (c) 2000--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 2000--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
Grob * me = unsmob_grob (element_smob);
Axis ax = (Axis)gh_scm2int (axis);
Grob * par = me->get_parent (ax);
- if (par && !to_boolean (par->get_grob_property ("alignment-done")))
+ if (par && !to_boolean (par->get_grob_property ("positioning-done")))
{
Align_interface::align_elements_to_extents (par, ax);
}
Grob * me = unsmob_grob (element_smob);
Axis ax = (Axis)gh_scm2int (axis);
Grob * par = me->get_parent (ax);
- if (par && !to_boolean (par->get_grob_property ("alignment-done")))
+ if (par && !to_boolean (par->get_grob_property ("positioning-done")))
{
Align_interface::align_to_fixed_distance (par, ax);
}
void
Align_interface::align_to_fixed_distance (Grob *me , Axis a)
{
- me->set_grob_property ("alignment-done", SCM_BOOL_T);
+ me->set_grob_property ("positioning-done", SCM_BOOL_T);
SCM d = me->get_grob_property ("stacking-dir");
if (!stacking_dir)
stacking_dir = DOWN;
- SCM force = me->get_grob_property ("forced-distance");
-
- Real dy = 0.0;
- if (gh_number_p (force))
- {
- dy = gh_scm2double (force);
- }
+ Real dy = robust_scm2double (me->get_grob_property ("forced-distance"),0.0);
Link_array<Grob> elems
= Pointer_group_interface__extract_grobs (me, (Grob*) 0, "elements");
void
Align_interface::align_elements_to_extents (Grob * me, Axis a)
{
- me->set_grob_property ("alignment-done", SCM_BOOL_T);
+ me->set_grob_property ("positioning-done", SCM_BOOL_T);
SCM d = me->get_grob_property ("stacking-dir");
if (!stacking_dir)
stacking_dir = DOWN;
- Interval threshold = Interval (0, Interval::infinity ());
- SCM thr = me->get_grob_property ("threshold");
- if (gh_pair_p (thr))
- {
- threshold[SMALLER] = gh_scm2double (ly_car (thr));
- threshold[BIGGER] = gh_scm2double (ly_cdr (thr));
- }
-
+ Interval threshold = robust_scm2interval ( me->get_grob_property ("threshold"), Interval (0, Interval::infinity ()));
Array<Interval> dims;
for (int i=0; i < all_grobs.size (); i++)
{
Interval y = all_grobs[i]->extent (me, a);
- if (!y.empty_b ())
+ if (!y.is_empty ())
{
Grob *e =dynamic_cast<Grob*> (all_grobs[i]);
FIXME: uncommenting freaks out the Y-alignment of
line-of-score.
*/
- // Real align_param = ly_dir_p (align) ? gh_scm2double (align) : 0.0;
+ // Real align_param = is_direction (align) ? gh_scm2double (align) : 0.0;
if (gh_number_p (align))
center_offset = total.linear_combination (gh_scm2double (align));
}
+/*
+ Find Y-axis parent of G that has a #'forced-distance property. This
+ has the effect of finding the piano-staff given an object in that
+ piano staff.
+ */
+Grob *
+find_fixed_alignment_parent (Grob *g)
+{
+ while (g)
+ {
+ if (gh_number_p (g->get_grob_property ("forced-distance")))
+ return g;
+
+ g = g->get_parent (Y_AXIS);
+ }
+
+ return 0;
+}
+
+
+
ADD_INTERFACE (Align_interface, "align-interface",
" Order grobs top to bottom/left to right/right to left etc.",
- "forced-distance stacking-dir align-dir threshold alignment-done center-element elements axes");
+ "forced-distance stacking-dir align-dir threshold positioning-done center-element elements axes");
struct Foobar
{
bool has_interface (Grob*);
};
+