Beispiel #1
0
// -----------------------------------------------------------------------------
// (JB) It is similar to the beginning one, but has some additionnal code to
// try to get the right stem direction from a global location. Why not
// for the beginning context ?
void
GRBowing::getBowEndingContext( GRBowingContext * ioContext, GRSystemStartEndStruct * sse )
{
	GRNotationElement * endElement = sse->endElement;

	GRSingleNote * note = dynamic_cast<GRSingleNote *>(endElement);
	if( note )
	{
		ioContext->bottomRightHead = note->getNoteHead();
		ioContext->topRightHead = ioContext->bottomRightHead; // the same as bottom head.

		ioContext->stemDirRight = note->getThroatDirection();
	}
	else
	{
		GRGlobalStem * stem = findGlobalStem( sse, endElement );
		if( stem )
		{
			stem->getHighestAndLowestNoteHead( &ioContext->topRightHead, &ioContext->bottomRightHead );
			ioContext->stemDirRight = stem->getStemDir();
		}
		else		// we have not found one ....
		{
			const NEPointerList * ptlist2 = endElement->getAssociations();
			GuidoPos nepos = ptlist2->GetHeadPosition();
			while (nepos)
			{
				GRGlobalLocation * gloc = dynamic_cast<GRGlobalLocation *>(ptlist2->GetNext(nepos));
				if (gloc)
				{
					ioContext->stemDirRight = (GDirection)gloc->getHighestAndLowestNoteHead(
											&ioContext->topRightHead, &ioContext->bottomRightHead );
					break;
				}
			}
		}
		ioContext->rightChordStem = stem;
	}
}
Beispiel #2
0
// -----------------------------------------------------------------------------
// Figure out if the first element is a part of a chord.
// Find the highest and lowest note heads.
// Get the stem directions (or the possible stem directions)
void
GRBowing::getBowBeginingContext( GRBowingContext * ioContext, GRSystemStartEndStruct * sse )
{
	GRNotationElement * startElement = sse->startElement;

	GRSingleNote * note = dynamic_cast<GRSingleNote *>(startElement);
	if( note )
	{
		ioContext->bottomLeftHead = note->getNoteHead();
		ioContext->topLeftHead = ioContext->bottomLeftHead;	// the same as bottom head.

		ioContext->stemDirLeft = note->getThroatDirection();
	}
	else
	{
		GRGlobalStem * stem = findGlobalStem( sse, startElement );
		if( stem )
		{
			stem->getHighestAndLowestNoteHead( &ioContext->topLeftHead, &ioContext->bottomLeftHead );
			ioContext->stemDirLeft = stem->getStemDir();
		}
		ioContext->leftChordStem = stem;
	}
}