Ejemplo n.º 1
0
// -----------------------------------------------------------------------------
GRBowing::GRBowing(GRStaff * grstaff, GRNotationElement * startEl,
					GRNotationElement * endEl)
			: GRPTagARNotationElement(new ARBowing, 1)
{
	GRSystemStartEndStruct * sse = initGRBowing( grstaff );

	// The timeposition is set. Because only timeordered
	// Graphicalelements can be added into a staff,
	// the end-time-position is chosen as a default
	// .....

	// a new entry for the SSEList (SystemStartEnd)
	// as defined in GRPositionTag

	// - First, setup the start/end informations, check if we're
	// opened to the left or to the right.

	if (startEl)
	{
		setStartElement(grstaff, startEl);
	}
	else // no start element: we're left-opened
	{
		setStartElement(grstaff, /*dynamic cast<GRNotationElement *>*/(grstaff->getSecondGlue()));
		sse->startflag = GRSystemStartEndStruct::OPENLEFT;
	}

	if (endEl)
	{
		setEndElement(grstaff,endEl);
		sse->endflag = GRSystemStartEndStruct::RIGHTMOST;
	}
	else  // no end element: we're righ-opened
	{
		setEndElement(grstaff, /*dynamic cast<GRNotationElement *>*/(grstaff->getEndGlue()));
		sse->endflag = GRSystemStartEndStruct::OPENRIGHT;
	}

	// - Get the time position.
	GRNotationElement * endElement;
	GRNotationElement * startElement;
	if(( endElement = getEndElement(grstaff)) != 0 )
	{
		mRelativeTimePositionOfGR = endElement->getRelativeTimePosition();
	}
	else if((startElement = getStartElement(grstaff)) != 0 )
	{
		mRelativeTimePositionOfGR = startElement->getRelativeTimePosition();
	}


	mBoundingBox.Set( 0, 0, 0, 0 );

//	updateBow(grstaff);
}
Ejemplo n.º 2
0
// Inserts a grafical object sorted by time into the datastream
GuidoPos NEPointerList::AddAtTimePosition(const TYPE_TIMEPOSITION & tp,
		GRNotationElement * grne)
{
	GuidoPos pos = GetHeadPosition();
	GRNotationElement * tmp;
	// this loop can be improved!
	
	// the element will be inserted at a position so that
	// time(position) < time(element) 
	while (pos)
	{
		tmp = GetAt(pos);
		if (tmp->getRelativeTimePosition() > tp)
		{
			return AddElementAt(pos, grne);
		}
		GetNext(pos);
	}
	return push_back(grne);
}
Ejemplo n.º 3
0
// ATTENTION, aend timePosition!
void NEPointerList::setSpacing(const TYPE_TIMEPOSITION & timePosition, 
							   NVPoint& position)
{
	// this is obolete!
	assert(false);
#ifdef BALBAL
	if (empty()) return;
	assert(!empty());
	GRNotationElement * criticalElement = 0;
	NEPointerList * list= this; // getElementsWithTimePosition(timePosition);
	
	// think about it.
	TYPE_TIMEPOSITION nextTimePosition (getNextTimePosition(timePosition));
	TYPE_SPACING spacing = 0;
	if(!list->empty())
	{
		NEPointerList* shortyList=list->getElementsWithShortestDuration();
		criticalElement=shortyList->getElementWithMaxSpacing();
		float criticalElementSize=criticalElement->getBoundingBox().right;
		assert(criticalElementSize>=0); // get size of real element
		if(criticalElement->getRelativeEndTimePosition()>nextTimePosition) // is there an Overlap?
		{
			criticalElement = new GRSingleNote(nextTimePosition-timePosition);
			// Dummy element for spacing calculation
			// I Believe abstractRepresentation will not be created?
			delete criticalElement;
		}
		else
		{
		}

		GuidoPos pos = GetHeadPosition();
		GRNotationElement * e;
		float min = 0;
		while (pos)
		{
			e = GetNext(pos);
			if (e->getRelativeTimePosition()==timePosition
			  && e->getBoundingBox().left<min)
				 min = e->getBoundingBox().left;
		}
		pos = GetHeadPosition();
		while(pos)
		{
			e = GetNext(pos);
			if (tmp)
			{
				tmp->setHPosition(position.x-min);
			}
			else
			{
			}
		}
		position.x += spacing+criticalElementSize;
		position.x -= min;

		delete shortyList;
	}
	else
	{
		criticalElement = new GRSingleNote(nextTimePosition-timePosition); // special Dummy-Object??
		delete criticalElement;

		GRNotationElement * e;
		GuidoPos pos=GetHeadPosition();
		while(pos)
		{
			e=GetNext(pos);
		}
		position.x += spacing;
	}
#endif
}