本文整理汇总了C++中Chord::GetCrossStaffExtremes方法的典型用法代码示例。如果您正苦于以下问题:C++ Chord::GetCrossStaffExtremes方法的具体用法?C++ Chord::GetCrossStaffExtremes怎么用?C++ Chord::GetCrossStaffExtremes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chord
的用法示例。
在下文中一共展示了Chord::GetCrossStaffExtremes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalcArtic
int Artic::CalcArtic(FunctorParams *functorParams)
{
FunctorDocParams *params = dynamic_cast<FunctorDocParams *>(functorParams);
assert(params);
/************** Get the parent and the stem direction **************/
LayerElement *parent = NULL;
Note *parentNote = NULL;
Chord *parentChord = dynamic_cast<Chord *>(this->GetFirstParent(CHORD, 2));
data_STEMDIRECTION stemDir = STEMDIRECTION_NONE;
data_STAFFREL place = STAFFREL_NONE;
if (!parentChord) {
parentNote = dynamic_cast<Note *>(this->GetFirstParent(NOTE));
parent = parentNote;
}
else {
parent = parentChord;
}
if (!parentChord && !parentNote) {
// no parent chord or note, nothing we can do...
return FUNCTOR_CONTINUE;
}
Staff *staff = dynamic_cast<Staff *>(this->GetFirstParent(STAFF));
assert(staff);
Layer *layer = dynamic_cast<Layer *>(this->GetFirstParent(LAYER));
assert(layer);
stemDir = parentNote ? parentNote->GetDrawingStemDir() : parentChord->GetDrawingStemDir();
/************** placement **************/
bool allowAbove = true;
// for now we ignore within @place
if (this->HasPlace() && (this->GetPlace() != STAFFREL_within)) {
place = this->GetPlace();
// If we have a place indication do not allow to be changed to above
allowAbove = false;
}
else if (layer->GetDrawingStemDir() != STEMDIRECTION_NONE) {
place = (layer->GetDrawingStemDir() == STEMDIRECTION_up) ? STAFFREL_above : STAFFREL_below;
// If we have more than one layer do not allow to be changed to above
allowAbove = false;
}
else if (stemDir == STEMDIRECTION_up)
place = STAFFREL_below;
else
place = STAFFREL_above;
/************** set it to both the inside and outside part **************/
ArticPart *insidePart = this->GetInsidePart();
ArticPart *outsidePart = this->GetOutsidePart();
if (insidePart) {
insidePart->SetPlace(place);
}
if (outsidePart) {
// If allowAbove is true it will place the above if the content requires so (even if place below if given)
if (place == STAFFREL_below && allowAbove && outsidePart->AlwaysAbove()) place = STAFFREL_above;
outsidePart->SetPlace(place);
}
/************** calculate the y position **************/
Staff *staffAbove = NULL;
Staff *staffBelow = NULL;
// Cross-staff handling of articulation will need to be re-thought. We can look at assiging a cross-staff to the
// appropriate ArticPart
// (see below) - For chords, we need to distinguish cross-staff chords and cross-staff chord notes
if (parent->m_crossStaff && parent->m_crossLayer) {
staff = parent->m_crossStaff;
staffAbove = staff;
staffBelow = staff;
}
else if (parentChord) {
parentChord->GetCrossStaffExtremes(staffAbove, staffBelow);
}
int staffYBottom = -params->m_doc->GetDrawingStaffSize(staff->m_drawingStaffSize);
// Avoid in artic to be in legder lines
int yInAbove = std::max(
parent->GetDrawingTop(params->m_doc, staff->m_drawingStaffSize, false) - staff->GetDrawingY(), staffYBottom);
int yInBelow
= std::min(parent->GetDrawingBottom(params->m_doc, staff->m_drawingStaffSize, false) - staff->GetDrawingY(), 0);
int yOutAbove = std::max(yInAbove, 0);
int yOutBelow = std::min(yInBelow, staffYBottom);
// Does not work properly with chords, needs rethinking - It might be better to make artic or articPart relative to
// notes
// The problem is that in MEI artic are children of chord element and not of the notes
if (insidePart) {
if (insidePart->GetPlace() == STAFFREL_above) {
insidePart->SetDrawingYRel(yInAbove);
//.........这里部分代码省略.........