Beispiel #1
0
void GRDiminuendo::getDiminuendoEndingContext(GRDiminuendoContext *ioContext, GRSystemStartEndStruct * sse)
{	
    GRNotationElement * endElement = sse->endElement;
	if(sse->endflag == GRSystemStartEndStruct::OPENRIGHT)
		endElement = lastendElement;

	GRSingleNote *note  = dynamic_cast<GRSingleNote *>(endElement);
	if (note)
	{
		ioContext->rightHead = note->getNoteHead();
		ioContext->rightNoteDX = note->getOffset().x;
	}
}
Beispiel #2
0
void GRDiminuendo::getDiminuendoBeginingContext(GRDiminuendoContext *ioContext, GRSystemStartEndStruct *sse )
{
    GRNotationElement * startElement = sse->startElement;
	if (sse->startflag == GRSystemStartEndStruct::OPENLEFT)
		startElement = flaststartElement;
		
	GRSingleNote *note  = dynamic_cast<GRSingleNote *>(startElement);
	if (note)
	{
		ioContext->leftHead = note->getNoteHead();
		ioContext->leftNoteDX = note->getOffset().x;
	}

}
Beispiel #3
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 #4
0
/** \brief Returns the highest and lowest notehead
	(with respect to y-position.
	this is needed for slurs from and to chords.
*/
int GRGlobalStem::getHighestAndLowestNoteHead(GRStdNoteHead ** highest,
											  GRStdNoteHead ** lowest) const
{
	*highest = *lowest = NULL;
	if (mAssociated == 0 )	return 0;

	GuidoPos pos = mAssociated->GetHeadPosition();
	while (pos)
	{
		GRSingleNote * sn = dynamic_cast<GRSingleNote *>(mAssociated->GetNext(pos));
		if (sn)
		{
			GRStdNoteHead * tmp = sn->getNoteHead();
			if (tmp)
			{
				if (*highest && *lowest)
				{
					if ((*highest)->getPosition().y > tmp->getPosition().y)
					{
						*highest = tmp;
					}
					if ((*lowest)->getPosition().y < tmp->getPosition().y)
					{
						*lowest = tmp;
					}
				}
				else 
				{
					*highest = tmp;
					*lowest = tmp;
				}
			}
		}
	}
	if (*highest != NULL)
		return 1;
	
	return 0;	// is it a stem dir ?
}
Beispiel #5
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;
	}
}