Esempio n. 1
0
void AmTrackDataView::DrawPhrase(	BRect clip,
									BView* view,
									track_id trackId,
									const AmPhraseEvent& topPhrase,
									AmPhraseEvent* pe,
									AmTime start,
									AmTime end,
									int32 properties,
									AmSelectionsI* selections)
{
	ArpASSERT(pe && pe->Phrase());
	AmNode*		n = pe->Phrase()->HeadNode();
	if (!n) return;
	AmRange		eventRange = topPhrase.EventRange( n->Event() );
	while (n && eventRange.start <= end) {
		if (eventRange.end >= start) {
			if (mTarget->IsInteresting( n->Event() )) {
				if (selections && selections->IncludesEvent(trackId, &topPhrase, n->Event() ) )
					DrawEvent(view, topPhrase, n->Event(), eventRange, ARPEVENT_SELECTED);
				else
					DrawEvent(view, topPhrase, n->Event(), eventRange, properties);
			} else if (n->Event()->Type() == n->Event()->PHRASE_TYPE) {
				AmPhraseEvent*	pe2 = dynamic_cast<AmPhraseEvent*>( n->Event() );
				if (pe2) DrawPhrase(clip, view, trackId, topPhrase, pe2, start, end, properties, selections);
			}
		}
		n = n->next;
		if (n) eventRange = topPhrase.EventRange( n->Event() );
	}
}
Esempio n. 2
0
void AmTrackDataView::SelectRightEvent()
{
#if 0
	ArpASSERT(mTarget);
	AmSelectionsI*		newSelections = NULL;
	// READ SONG BLOCK
	#ifdef AM_TRACE_LOCKS
	printf("AmTrackDataView::SelectRightEvent() read lock\n"); fflush(stdout);
	#endif
	const AmSong*	song = mSongRef.ReadLock();
	const AmTrack*	track = song ? song->Track(mTrackWinProps.OrderedTrackAt(0)) : NULL;
	if (track) {
		AmSelectionsI*	selections = mTrackWinProps.Selections();
		/* If there are no selections, select the first event
		 * starting on or after the left edge of the window.
		 */
		if (!selections || selections->CountEvents() < 1) {
			newSelections = SelectFirstEvent(track);
		/* If there are already events, select the next event
		 * over from the end of the last selected event.  And if
		 * that event isn't visible, select the first visible event.
		 */
		} else {
			/* Find the event to move right from.
			 */
			AmEvent*		event = 0;
			AmPhraseEvent*	container = 0;
			AmEvent*		iteratingEvent;
			AmPhraseEvent*	iteratingContainer;
			for (uint32 k = 0; selections->EventAt(k, &iteratingContainer, &iteratingEvent) == B_OK; k++) {
				if (!event || (iteratingContainer->EventRange(iteratingEvent).start > container->EventRange(event).start) ) {
					event = iteratingEvent;
					container = iteratingContainer;
				}
			}
			if (!event) newSelections = SelectFirstEvent(track);
			else {
				/* Select the next event over.  This has a lot of problems,
				 * like not dealing with operlapping phrases.
				 */
				if (NextRightEvent(track, event, container, &iteratingEvent, &iteratingContainer) == B_OK)
					newSelections = SelectEvent(iteratingEvent, iteratingContainer);
				else newSelections = SelectFirstEvent(track);
			}
		}

	}
	mSongRef.ReadUnlock(song);
	// END READ SONG BLOCK
	if (newSelections) mTrackWinProps.SetSelections(newSelections);
#endif
}
Esempio n. 3
0
void _AmControlTarget::GetMoveValues(	const AmPhraseEvent& topPhrase,
										const AmEvent* event,
										AmTime* x, int32* y) const
{
	ArpASSERT(event);
	*x = topPhrase.EventRange(event).start;
	const AmControlChange*		ccEvent = dynamic_cast<const AmControlChange*>(event);
	if (ccEvent) *y = ccEvent->ControlValue();
	else *y = 0;
}
Esempio n. 4
0
void _AmControlTarget::SetMove(	AmPhraseEvent& topPhrase,
								AmEvent* event,
								AmTime originalX, int32 originalY,
								AmTime deltaX, int32 deltaY,
								uint32 flags)
{
	ArpASSERT(event);
	AmControlChange*		ccEvent = dynamic_cast<AmControlChange*>(event);
	if (!ccEvent) return;
//	if (flags&TRANSFORM_X) {

	AmTime			newStart = originalX + deltaX;
	if (newStart < 0) newStart = 0;
	if (newStart != topPhrase.EventRange(event).start)
		topPhrase.SetEventStartTime(ccEvent, newStart);

//	if (flags&TRANSFORM_Y) {
		int32			newVal = originalY + deltaY;
		if (newVal > 127) newVal = 127;
		else if (newVal < 0) newVal = 0;
		ccEvent->SetControlValue(newVal);
//	}
}