Esempio n. 1
0
void GRPositionTag::RangeEnd(GRStaff * grstaff)
{
	if (grstaff == 0) return;

	GRSystemStartEndStruct * sse = getSystemStartEndStruct(grstaff->getGRSystem());
	assert(sse);
	if (error)
	{
		setStartElement(grstaff,NULL);
		setEndElement(grstaff,NULL);
		return;
	}

	NEPointerList * associated = NULL;
	GRNotationElement * el = dynamic_cast<GRNotationElement *>(this);
	if (el)
		associated = el->getAssociations();
	if (associated == 0) return;

	if (sse->startflag == GRSystemStartEndStruct::LEFTMOST
		&& sse->startElement == NULL)
	{
		setStartElement(grstaff,associated->GetHead());
		sse->startpos = associated->GetHeadPosition();
	}

	setEndElement(grstaff,associated->GetTail());
	sse->endflag = GRSystemStartEndStruct::RIGHTMOST;
	sse->endpos = associated->GetTailPosition();
}
Esempio n. 2
0
void GRPositionTag::StaffBegin(GRStaff *grstaff)
{
	// now we need to build a new staff 
	if (!grstaff) return;

	GRSystemStartEndStruct * sse = new GRSystemStartEndStruct;
	GRSaveStruct * st = getNewGRSaveStruct();
	sse->p = (void *) st;

	sse->grsystem = grstaff->getGRSystem();
	sse->startflag = GRSystemStartEndStruct::OPENLEFT;
	sse->startpos = NULL;

	// ths startpos needs to be filled
	// by the next addAssociation call!

	// no need to call addAssociation (did that already ...)!
	sse->endflag = lastendflag;
	sse->endElement = lastendElement;
	sse->endpos = lastendpos;
	
	mStartEndList.AddTail(sse);

	if(error)
	{
		setStartElement(grstaff,NULL);
		setEndElement(grstaff,NULL);
		return;
	}

	setStartElement(grstaff, /*dynamic cast<GRNotationElement *>*/
		(grstaff->getSecondGlue()));
}
Esempio n. 3
0
/** \brief Called after the new Staff has been created by the
	Staffmanager after a pbreak-Break.

	(It is ALWAYS called after a call to BreakTag)
	It is somewhat analogous to StaffBegin but uses the assocpos.`
*/
void GRPositionTag::ResumeTag(GRStaff * grstaff,GuidoPos assocpos)
{
	if (!grstaff) return;

	GRSystemStartEndStruct * sse = new GRSystemStartEndStruct;
	sse->grsystem = grstaff->getGRSystem();
	sse->startflag = GRSystemStartEndStruct::OPENLEFT;
	// here, we use the assocpos
	sse->startpos = assocpos;

	// no need to call addAssociation (did that already ...)!
	sse->endflag = lastendflag;
	sse->endElement = lastendElement;
	sse->endpos = lastendpos;
	
	GRSaveStruct * st = getNewGRSaveStruct();
	sse->p = (void *) st;

	mStartEndList.AddTail(sse);

	if (error)
	{
		setStartElement(grstaff,NULL);
		setEndElement(grstaff,NULL);
		return;
	}

	setStartElement(grstaff, /*ynamic_cast<GRNotationElement *>*/(grstaff->getSecondGlue()));
}
Esempio n. 4
0
void GRPositionTag::StaffFinished(GRStaff * grstaff)
{
	if (!grstaff) return;

	GRSystemStartEndStruct * sse = getSystemStartEndStruct(grstaff->getGRSystem());

	assert(sse);

	if (error)
	{
		setStartElement(grstaff,NULL);
		setEndElement(grstaff,NULL);
		lastendElement = NULL;
		return;
	}

	NEPointerList * associated = NULL;
	GRNotationElement * el = dynamic_cast<GRNotationElement *>(this);
	if (el)
		associated = el->getAssociations();
	if (associated == 0) return;


	if (sse->startflag == GRSystemStartEndStruct::LEFTMOST
		&& sse->startElement == NULL)
	{
		setStartElement(grstaff,associated->GetHead());
		sse->startpos = associated->GetHeadPosition();
	}

	lastendflag = sse->endflag;
	lastendElement = sse->endElement;
	lastendpos = sse->endpos;

	// there is no old lastendelement in this case
	assert(lastendElement == NULL);

	setEndElement(grstaff, /*ynamic_cast<GRNotationElement *>*/(grstaff->getEndGlue()));
	sse->endflag = GRSystemStartEndStruct::OPENRIGHT;
	sse->endpos = associated->GetTailPosition();

}
Esempio n. 5
0
void Tie::setStartNote(Note* note)
      {
      setStartElement(note);
      setParent(note);
      }
Esempio n. 6
0
/** \brief Called to break a tag at a previously saved PBreak-Location.
	It sets the sse-Positions ...

	(It is somewhat equivalent to StaffFinished,
	with the difference, that assocpos is used). assocpos is the tail-position
	of the associated list at the time of the pbreak-situation.
	Now, this routine is called when a tag needs to be broken
	because the optimum line break algorithm has determined the breaklocation.
*/
void GRPositionTag::BreakTag(GRStaff * grstaff, GuidoPos & assocpos)
{
	if (grstaff == 0) return;

	GRSystemStartEndStruct * sse = getSystemStartEndStruct(grstaff->getGRSystem());
	assert(sse);

	if (error)
	{
		setStartElement(grstaff,NULL);
		setEndElement(grstaff,NULL);
		lastendElement = NULL;
		return;
	}

	// now we do something .....
	NEPointerList * associated = 0;
	GRNotationElement * el = dynamic_cast<GRNotationElement *>(this);
	if (el)
		associated = el->getAssociations();

	if (!associated) return;

	// only, if the startElement is not set and
	// we do not have an OPENLEFT, the very first
	// element from the association is made the
	// startElement.
	if (sse->startflag == GRSystemStartEndStruct::LEFTMOST 
		&& sse->startElement == NULL)
	{
		setStartElement(grstaff,associated->GetHead());
		sse->startpos = associated->GetHeadPosition();
	}

	// now, we remeber the last end-setting ...
	lastendElement = sse->endElement;
	lastendflag = sse->endflag;
	lastendpos = sse->endpos;

	// now, we set the new OPENRIGHT and get the
	// endglue ...

	// the old association of the end-element MUST
	// be maintained! -> 
	sse->endElement = NULL;

	setEndElement(grstaff,grstaff->getEndGlue());
	sse->endflag = GRSystemStartEndStruct::OPENRIGHT;
	// this uses assocpos!
	sse->endpos = assocpos;

	sse->grsystem = grstaff->getGRSystem();

	// now, we increment the assocpos, so that
	// we can save this position for
	// the NEW Segment build with ResumeTag
	if (associated && assocpos)
		associated->GetNext(assocpos);

	// I now have to add a new sse-that handles the next system ?

}