示例#1
0
//-------------------------------------------------------------------------
bool QGuidoPainter::setGMNData( const QString& dataSource , GuidoParseFunction parseFunction )
{
	// Read the gmnCode and build the score's Abstract Representation,
	// containing all the notes, rests, staffs, lyrics ...
	ARHandler arh;
	GRHandler grh;
	mLastErr = parseFunction( dataSource.toAscii().data(), &arh );		
	if ( mLastErr != guidoNoErr )
		return false;

	// Build a new score Graphic Representation according the score's Abstract Representation.
	GuidoPageFormat currentFormat;
	GuidoGetDefaultPageFormat ( &currentFormat );
	GuidoSetDefaultPageFormat( &mPageFormat );

	mLastErr = GuidoAR2GR (arh, &mLayoutSettings , &grh);

	GuidoSetDefaultPageFormat( &currentFormat );
	if (mLastErr == guidoNoErr)
	{
		GuidoFreeGR( mDesc.handle );
		mDesc.handle = grh;
		GuidoFreeAR( mARHandler );
		mARHandler = arh;
		if ( mResizePageToMusic )
			mLastErr = GuidoResizePageToMusic( mDesc.handle );
	}
	return (mLastErr == guidoNoErr);
}
示例#2
0
//-------------------------------------------------------------------------
void QGuidoPainter::setARHandler( ARHandler ar )
{
	if (!ar) return;
	if (mDesc.handle)	GuidoFreeGR( mDesc.handle );
	if (mARHandler)		GuidoFreeAR( mARHandler );

	// Build a new score Graphic Representation according the score's Abstract Representation.
	mARHandler = ar;
	mGMNCode = "";
	GuidoPageFormat currentFormat;
	GuidoGetDefaultPageFormat ( &currentFormat );
	GuidoSetDefaultPageFormat( &mPageFormat );
	GuidoAR2GR (mARHandler, &mLayoutSettings , &mDesc.handle);
	GuidoSetDefaultPageFormat( &currentFormat );
	if ( mResizePageToMusic )
		mLastErr = GuidoResizePageToMusic( mDesc.handle );
}
示例#3
0
ofxGuido::ofxGuido(int w, int h) :
	mARHandler(0), mGRHandler(0), mW(w), mH(h), mBackground(){
	mGuidoDevice = mGuidoSystem.CreateMemoryDevice(w, h);
	mGuidoDevice->SelectFillColor(VGColor(0, 0, 0));
	mGuidoInitDesc.graphicDevice = mGuidoDevice;
	mGuidoInitDesc.musicFont = "guido2t.ttf";
	mGuidoInitDesc.textFont = "guidotext.ttf";
	GuidoInit(&mGuidoInitDesc);
	GuidoGetDefaultLayoutSettings(&mGuidoLayoutSettings);
	mGuidoOnDrawDesc.hdc = mGuidoDevice;
	mGuidoParser = GuidoOpenParser();
	// Setup a large default format to avoid system breaks. They can also be avoided
	// by using the GMN advanced tag \set<autoSystemBreak="off">
	// Extra right margin makes room for the systems brace.
	GuidoPageFormat gpf = { 5000, 5000, 150, 100, 100, 100 }; // w, h, ml, mt, mr, mb
	GuidoSetDefaultPageFormat(&gpf);
	mBackground.set(0, 0, 0, 0);
}