コード例 #1
0
ファイル: GRPositionTag.cpp プロジェクト: EQ4/guido-engine
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();
}
コード例 #2
0
ファイル: GRPositionTag.cpp プロジェクト: EQ4/guido-engine
void GRPositionTag::addAssociation(GRNotationElement * grnot)
{
	if (error) return;

	const GRStaff * pstaff = grnot->getGRStaff();
	assert(pstaff);
	GRSystemStartEndStruct * sse= getSystemStartEndStruct(pstaff->getGRSystem());	

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

	if (!associated) return;
	
	if (sse && sse->startflag == GRSystemStartEndStruct::OPENLEFT 
		&& sse->startpos == NULL)
		sse->startpos = associated->GetTailPosition();
}
コード例 #3
0
ファイル: GRPositionTag.cpp プロジェクト: EQ4/guido-engine
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();

}
コード例 #4
0
ファイル: NEPointerList.cpp プロジェクト: EQ4/guido-engine
NEPointerList* NEPointerList::getElementsWithTimePosition(const TYPE_TIMEPOSITION & timePosition)
{
	assert(false);

#ifdef BLABLA

  //## begin NEPointerList::getElementsWithTimePosition
	NEPointerList * list = new NEPointerList;
	GRNotationElement * e;
	GuidoPos pos=GetHeadPosition();
	while(pos)
	{
		e = GetNext(pos);
		GRNotationElement * tmp = e->getGRNotationElementAtTimePosition(timePosition);
		if (tmp)
			list->push_back(tmp);
	}
	return list;
  //## end NEPointerList::getElementsWithTimePosition
#endif
	return NULL;
}
コード例 #5
0
ファイル: NEPointerList.cpp プロジェクト: EQ4/guido-engine
NEPointerList* NEPointerList::getElementsWithShortestDuration()
{
	assert(!empty());
	NEPointerList * list = new NEPointerList;
	GRNotationElement *e = NULL;
	GuidoPos pos=GetHeadPosition();
	TYPE_DURATION dur(INT_MAX,1);
	while (pos)
	  {
	  e = GetNext(pos);
	  if (e->getDuration() < dur)
		 dur = e->getDuration();
	  }
	pos = GetHeadPosition();
	while (pos)
	  {
	  e = GetNext(pos);
	  if (e->getDuration() == dur)
		 {
		 list->push_back(e);
		 }
	  }
	return list;
}
コード例 #6
0
ファイル: GRPositionTag.cpp プロジェクト: EQ4/guido-engine
/** \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 ?

}
コード例 #7
0
/** \brief This removes a whole list of associations */
void GRNotationElement::removeAssociation( const NEPointerList & nl )
{
	GuidoPos pos = nl.GetHeadPosition();
	while (pos)
		removeAssociation( nl.GetNext(pos));
}