Beispiel #1
0
// --------------------------------------------------------------------------
void GRRepeatBegin::updateBoundingBox()
{
	const float halfExtent = GetSymbolExtent(mSymbol) * 0.5f;

	mBoundingBox.top    = 0;
	mBoundingBox.left   = -halfExtent;
	mBoundingBox.right  = halfExtent;
	mBoundingBox.bottom = 4 * LSPACE;

    GRStaff *staff = getGRStaff();

    if (staff)
    {
        fLineNumber = staff->getNumlines();

        int linesOffset = fLineNumber - 5;

        if (linesOffset)
            mPosition.y += staff->getStaffLSPACE() * linesOffset / 2;

        fStaffThickness = staff->getLineThickness();
        fSize = staff->getSizeRatio();
        fBaseThickness = LSPACE * 0.6f * fSize;

        mTagSize *= fSize;
    }
}
Beispiel #2
0
// --------------------------------------------------------------------------
void GRRepeatEnd::InitRepeatEnd()
{
	mNeedsSpring = 1;
	sconst = SCONST_BAR - 2;
//	sconst = 5; //SCONST_BAR;

	mSymbol = kRepeatEndSymbol; 
	mLeftSpace =  mRightSpace = 0;
	refpos.Set( -LSPACE * 0.8f, 4 * LSPACE );

    GRStaff *staff = getGRStaff();

    if (staff)
    {
        fLineNumber = staff->getNumlines();

        fStaffThickness = staff->getLineThickness();
        fSize = staff->getSizeRatio();
        fBaseThickness = LSPACE * 0.6f * fSize;
    }

    mBoundingBox.bottom = 4 * LSPACE;
}
Beispiel #3
0
void GRArticulation::placeAfterNote( GREvent * inParent, NVPoint & ioPos, bool upward )
{
	GRStaff * staff = inParent->getGRStaff();
	const float space = staff->getStaffLSPACE();
	const float halfSpace = float(0.5) * space;

	const int externalFlags = (kFlagAccent | kFlagMarcato | kFlagFermataUp);
	const bool hasExternal = inParent->hasArticulation( externalFlags );

	if( upward )
	{
		// -- Walk from the note through the possible attribute positions 
		// Stop when we've reached our attribute position.

		// - Starts at one space from the note.
		ioPos.y -= space;	
		if(( ioPos.y >= 0 ) && positionIsOnStaffLine( ioPos.y, space ))
			ioPos.y -= halfSpace;
	
		// - If we have internal mixed with externals, don't start deeper
		// than one linespace 
		if( hasExternal && ( ioPos.y > halfSpace ))
			ioPos.y = halfSpace;
	
		// - If we're a staccato or a staccatissimo, we have finished.
		if(( mArticulationFlag & ( kFlagStaccato )) != 0 )
			return;	

		// - Move by one position if we passed an existing staccato or staccatissimo
		if( inParent->hasArticulation( kFlagStaccato ))
			ioPos.y += (ioPos.y > 0) ? -space : -halfSpace;
		
		// - If we're a tenuto, then we have finished.
		if( mArticulationFlag == kFlagTenuto )
			return;	

		// - Move by one position if we passed an existing tenuto
		if( inParent->hasArticulation( kFlagTenuto ))
			ioPos.y += (ioPos.y > 0) ? -space : -halfSpace;

		// - So, we're an outside-staff symbol, force being outside-staff.	
		/*if( ioPos.y > -space )
			ioPos.y = -space;
		else
			ioPos.y -= halfSpace;*/
		if (ioPos.y > -halfSpace)
			ioPos.y = -halfSpace;
		else
			/*ioPos.y -= halfSpace*/; // only if...

		// - If we're a pizzicato then we have finished
		if((mArticulationFlag & (kFlagPizz)) != 0)
			{
				ioPos.y -= halfSpace;
				return;
			}
			
		// - Move by one linespace and a half if we passed an existing pizzicato
		if (inParent->hasArticulation(kFlagPizz))
			ioPos.y -= (1.5f*space);

		// - If we're an Accent or a Marcato, then we have finished.
		if(( mArticulationFlag & (kFlagAccent | kFlagMarcato)) != 0 )
			{
			ioPos.y -= halfSpace;
			return;	
			}

		// - Move by one position if we passed an existing Accent,
		// or by 1.5 positions if we passed an existing Marcato
		if( inParent->hasArticulation( kFlagAccent ))
			ioPos.y -= space; 
		else 
		{
			if( inParent->hasArticulation( kFlagMarcato ))
			ioPos.y -= (space + halfSpace);
			else
			ioPos.y += halfSpace; // it's a fermata : we need one less halfspace
		}
	}
	else
	{
		int linesCount = staff->getNumlines();
		const float bottom = (linesCount - 1) * space;
		
		ioPos.y += space;	
		if(( ioPos.y <= bottom ) && positionIsOnStaffLine( ioPos.y, space ))
			ioPos.y += halfSpace;
	
		// - If we have internal mixed with externals, don't start deeper
		// than one linespace 
		if( hasExternal && ( ioPos.y < ( bottom - halfSpace )))
			ioPos.y = (bottom - halfSpace);
	
		// - If we're a staccato or a staccatissimo, we have finished.
		if(( mArticulationFlag & (kFlagStaccato)) != 0 )
			return;	

		// - Move by one position if we passed an existing staccato or staccatissimo
		if( inParent->hasArticulation( kFlagStaccato ))
			ioPos.y += (ioPos.y < bottom) ? space : halfSpace;
		
		// - If we're a tenuto, then we have finished.
		if( mArticulationFlag == kFlagTenuto )
			return;	

		// - Move by one position if we passed an existing tenuto
		if( inParent->hasArticulation( kFlagTenuto ))
			ioPos.y += (ioPos.y < bottom) ? space : halfSpace;

		// - So, we're an outside-staff symbol, force being outside-staff.	
		if( ioPos.y < ( bottom + halfSpace ))
			ioPos.y = ( bottom + halfSpace );
		else
			/*ioPos.y += space*/; // ?

		// - If we're an Accent or a Marcato, then we have finished.
		if(( mArticulationFlag & (kFlagAccent | kFlagMarcato)) != 0 )
		{
			ioPos.y += halfSpace;
			return;	
		}
		// - Move by one position if we passed an existing Accent,
		// or by 1.5 positions if we passed an existing Marcato
		if( inParent->hasArticulation( kFlagAccent ))
			ioPos.y += (space + halfSpace); 
		else if( inParent->hasArticulation( kFlagMarcato ))
			ioPos.y += 2 * space;
	}
}