示例#1
0
//____________________________________________________________________________________
void GRSingleNote::OnDraw( VGDevice & hdc ) const
{
	float incy = 1;
	float posy = 0;
	int sum = mNumHelpLines;
	if (mNumHelpLines > 0)
	{ 	// ledger lines up
	  	incy = -mCurLSPACE;
	  	posy = -mCurLSPACE;
		hdc.SetFontAlign( VGDevice::kAlignLeft | VGDevice::kAlignBase );
	}
	else if( mNumHelpLines < 0 )
	{
		incy = mCurLSPACE;
		posy = mGrStaff->getNumlines() * mCurLSPACE;
		sum = - sum;
		hdc.SetFontAlign( VGDevice::kAlignLeft | VGDevice::kAlignBase );
	}

	// draw ledger lines
	const float ledXPos = -60 * 0.85f * mSize;
	for (int i = 0; i < sum; ++i, posy += incy)
		 GRNote::DrawSymbol( hdc, kLedgerLineSymbol, ledXPos, ( posy - mPosition.y ));

	const VGColor oldcolor = hdc.GetFontColor();
	if (mColRef) hdc.SetFontColor( VGColor( mColRef ));

	// - Draw elements (stems, dots...)
	DrawSubElements( hdc );

	// - draw articulations & ornament
	const GRNEList * articulations = getArticulations();
	if( articulations )
	{
		for( GRNEList::const_iterator ptr = articulations->begin(); ptr != articulations->end(); ++ptr )
		{
			GRNotationElement * el = *ptr;
			el->OnDraw(hdc);
		}
	}
	if (mOrnament )
		mOrnament->OnDraw(hdc);

	// - Restore
	if (mColRef) hdc.SetFontColor( oldcolor );
	if (gBoundingBoxesMap & kEventsBB)
		DrawBoundingBox( hdc, kEventBBColor);
}
示例#2
0
void GRSingleRest::OnDraw( VGDevice & hdc ) const
{
    traceMethod("OnDraw");
    if (mType == P0) return;		// don't know how to draw it !

    GRRest::OnDrawSymbol( hdc, mType );
    DrawSubElements( hdc );		// - Draw elements (dots...)

    // Draw articulations (fermata...)
    const GRNEList * articulations = getArticulations();
    if( articulations ) {
        for( GRNEList::const_iterator ptr = articulations->begin(); ptr != articulations->end(); ++ptr )
        {
            GRNotationElement * el = *ptr;
            el->OnDraw(hdc);
        }
    }

    if (gBoundingBoxesMap & kEventsBB)
        DrawBoundingBox( hdc, kEventBBColor);
}