//--------------------------------------------------------------------------------------- LUnits ChordEngraver::check_if_accidentals_overlap(GmoShapeAccidentals* pPrevAcc, GmoShapeAccidentals* pCurAcc) { URect overlap = pPrevAcc->get_bounds(); overlap.intersection( pCurAcc->get_bounds() ); return overlap.get_width(); }
//--------------------------------------------------------------------------------------- void ArticulationEngraver::center_on_parent() { if (!m_pParentShape) return; LUnits uCenterPos; if (m_pParentShape->is_shape_note()) { //it is a note. Center articulation on notehead shape GmoShapeNote* pNote = dynamic_cast<GmoShapeNote*>(m_pParentShape); uCenterPos = pNote->get_notehead_left() + pNote->get_notehead_width() / 2.0f; } else { //it is not a note (normally it would be a rest). //Center articulation on parent shape uCenterPos = m_pParentShape->get_left() + m_pParentShape->get_width() / 2.0f; } LUnits xShift = uCenterPos - (m_pArticulationShape->get_left() + m_pArticulationShape->get_width() / 2.0f); if (xShift != 0.0f) { USize shift(xShift, 0.0f); m_pArticulationShape->shift_origin(shift); } //ensure that articulation does not collides with parent shape URect overlap = m_pParentShape->get_bounds(); overlap.intersection( m_pArticulationShape->get_bounds() ); LUnits yShift = overlap.get_height(); if (yShift != 0.0f) { yShift += tenths_to_logical(5.0f); yShift = m_fAbove ? - yShift : yShift; USize shift(0.0f, yShift); m_pArticulationShape->shift_origin(shift); } }
//--------------------------------------------------------------------------------------- LUnits ChordEngraver::check_if_overlap(GmoShape* pShape, GmoShape* pNewShape) { URect overlap = pShape->get_bounds(); overlap.intersection( pNewShape->get_bounds() ); return overlap.get_width(); }