int Measure::AdjustXPos(FunctorParams *functorParams) { AdjustXPosParams *params = dynamic_cast<AdjustXPosParams *>(functorParams); assert(params); params->m_minPos = 0; params->m_upcomingMinPos = VRV_UNSET; params->m_cumulatedXShift = 0; std::vector<int>::iterator iter; ArrayOfComparisons filters; for (iter = params->m_staffNs.begin(); iter != params->m_staffNs.end(); ++iter) { params->m_minPos = 0; params->m_upcomingMinPos = VRV_UNSET; params->m_cumulatedXShift = 0; params->m_staffN = (*iter); filters.clear(); // Create ad comparison object for each type / @n std::vector<int> ns; // -1 for barline attributes that need to be taken into account each time ns.push_back(-1); ns.push_back(*iter); AttNIntegerComparisonAny matchStaff(ALIGNMENT_REFERENCE, ns); filters.push_back(&matchStaff); m_measureAligner.Process(params->m_functor, params, params->m_functorEnd, &filters); } // m_measureAligner.Process(params->m_functor, params, params->m_functorEnd); int minMeasureWidth = params->m_doc->GetOptions()->m_unit.GetValue() * params->m_doc->GetOptions()->m_measureMinWidth.GetValue(); // First try to see if we have a double measure length element MeasureAlignerTypeComparison alignmentComparison(ALIGNMENT_FULLMEASURE2); Alignment *fullMeasure2 = dynamic_cast<Alignment *>(m_measureAligner.FindChildByComparison(&alignmentComparison, 1)); // With a double measure with element (mRpt2, multiRpt) if (fullMeasure2 != NULL) { minMeasureWidth *= 2; } // Nothing if the measure has at least one note or @metcon="false" else if ((this->FindChildByType(NOTE) != NULL) || (this->GetMetcon() == BOOLEAN_false)) { minMeasureWidth = 0; } int currentMeasureWidth = this->GetRightBarLineLeft() - this->GetLeftBarLineRight(); if (currentMeasureWidth < minMeasureWidth) { ArrayOfAdjustmentTuples boundaries{ std::make_tuple(this->GetLeftBarLine()->GetAlignment(), this->GetRightBarLine()->GetAlignment(), minMeasureWidth - currentMeasureWidth) }; m_measureAligner.AdjustProportionally(boundaries); } return FUNCTOR_SIBLINGS; }
int Measure::AdjustLayers(FunctorParams *functorParams) { AdjustLayersParams *params = dynamic_cast<AdjustLayersParams *>(functorParams); assert(params); if (!m_hasAlignmentRefWithMultipleLayers) return FUNCTOR_SIBLINGS; std::vector<int>::iterator iter; ArrayOfComparisons filters; for (iter = params->m_staffNs.begin(); iter != params->m_staffNs.end(); ++iter) { filters.clear(); // Create ad comparison object for each type / @n std::vector<int> ns; // -1 for barline attributes that need to be taken into account each time ns.push_back(-1); ns.push_back(*iter); AttNIntegerComparisonAny matchStaff(ALIGNMENT_REFERENCE, ns); filters.push_back(&matchStaff); m_measureAligner.Process(params->m_functor, params, NULL, &filters); } return FUNCTOR_SIBLINGS; }