1 #include "cross-staff.hh"
3 #include "align-interface.hh"
8 calc_interstaff_dist (Item const *item, Spanner const *span)
10 Real interstaff = 0.0;
11 Score_element *common = item->common_refpoint (span, Y_AXIS);
12 Align_interface align(common);
14 if (align.has_interface_b () && align.axis() == Y_AXIS)
16 SCM threshold = common->get_elt_property ("threshold");
17 if (!gh_pair_p (threshold)
18 || !scm_equal_p (gh_car (threshold), gh_cdr (threshold)))
19 warning (_ ("minVerticalAlign != maxVerticalAlign: cross staff spanners may be broken"));
22 if (gh_pair_p (threshold))
23 interstaff = gh_scm2double (gh_car (threshold));
25 Score_element const * span_refpoint = span;
26 while (span_refpoint->parent_l (Y_AXIS) != common)
27 span_refpoint = span_refpoint->parent_l (Y_AXIS);
29 Score_element const * note_refpoint = item;
30 while (note_refpoint->parent_l (Y_AXIS) != common)
31 note_refpoint = note_refpoint->parent_l (Y_AXIS);
34 align.get_count ((Score_element*) dynamic_cast<Score_element const*> (span_refpoint));
36 align.get_count ((Score_element*) dynamic_cast<Score_element const *> (note_refpoint));
39 our staff is lower -> interstaff *= -1
42 if (span_prio < item_prio)