1 #include "cross-staff.hh"
3 #include "align-element.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_element
* align
= dynamic_cast<Align_element
*> (common
);
13 if (align
&& align
->axis() == Y_AXIS
)
15 if (align
->threshold_interval_
[MIN
] !=
16 align
->threshold_interval_
[MAX
])
17 warning (_ ("minVerticalAlign != maxVerticalAlign: cross staff spanners may be broken"));
19 interstaff
= align
->threshold_interval_
[MIN
];
21 Score_element
const * span_refpoint
= span
;
22 while (span_refpoint
->parent_l (Y_AXIS
) != common
)
23 span_refpoint
= span_refpoint
->parent_l (Y_AXIS
);
25 Score_element
const * note_refpoint
= item
;
26 while (note_refpoint
->parent_l (Y_AXIS
) != common
)
27 note_refpoint
= note_refpoint
->parent_l (Y_AXIS
);
30 align
->get_count ((Score_element
*) dynamic_cast<Score_element
const*> (span_refpoint
));
32 align
->get_count ((Score_element
*) dynamic_cast<Score_element
const *> (note_refpoint
));
35 our staff is lower -> interstaff *= -1
38 if (span_prio
< item_prio
)