Exemplo n.º 1
0
void SeqPhraseMatrixView::DrawOn(	BRect clip, BView* view, const AmTrack* track,
                                    AmPhraseRendererI* renderer)
{
    mDrawMuted = false;
    if ( track->ModeFlags()&track->MUTE_MODE && !(track->ModeFlags()&track->SOLO_MODE) )
        mDrawMuted = true;

    rgb_color	bgC = Prefs().Color(AM_DATA_BACKDROP_C);
    if (mDrawMuted) bgC = shade_color(bgC, BACKDROP_MUTE_SHADE);
    view->SetHighColor(bgC);
    if (!gPhraseBg) view->FillRect(clip);

    float	pipeTop = clip.top + ((clip.bottom - clip.top) / 2) - 3;
    seq_draw_hrz_pipe(view, clip.left, pipeTop, clip.right);

    drawing_mode	mode = view->DrawingMode();
    view->SetDrawingMode(B_OP_ALPHA);
    view->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_COMPOSITE);
    mLines.SetTarget(view);

    mSelectionRange.MakeInvalid();
    SeqSongWinPropertiesI*	win = dynamic_cast<SeqSongWinPropertiesI*>( Window() );
    bool		drawSelection = false;
    if (win) {
        SeqSongSelections*	selections = win->Selections();
        if (selections && selections->IncludesTrack( track->Id() ) ) {
            mSelectionRange = selections->TimeRange();
            drawSelection = true;
        }
    }

    if (drawSelection) {
        BRect				selectClip(clip);
        if (mSelectionRange.IsValid() ) {
            selectClip.left = mMtc.TickToPixel(mSelectionRange.start);
            selectClip.right = mMtc.TickToPixel(mSelectionRange.end);
        }
        rgb_color	bgC;
        if (win && win->IsRecording() ) bgC = Prefs().Color(AM_SONG_RECORD_SELECTION_C);
        else bgC = Prefs().Color(AM_SONG_SELECTION_C);
        view->SetHighColor(bgC);
        view->FillRect(selectClip);
    }
    view->SetDrawingMode(mode);
#if 0
    _AmBgMeasureBackground		bg( SongRef(), mTrackRef, *mMtc );
    bg.SetLeftIndent( mLeftIndent );
    bg.LockedDraw( view, clip, track->Signatures() );
#endif

    DrawTrack(clip, view, track, renderer);
}
Exemplo n.º 2
0
void SeqSongIndexMatrixView::MouseMoved(BPoint where,
										uint32 code,
										const BMessage* dragMessage)
{
	int32		buttons = 0;
	Window()->CurrentMessage()->FindInt32("buttons", &buttons);
	if (buttons == 0) {
		if (mMouseDown != DOWN_ON_MODE) mMouseDown = DOWN_ON_NOTHING;
		return;
	}

	if (mMouseDown != DOWN_ON_SELECTED_TRACK && mMouseDown != DOWN_ON_DESELECTED_TRACK)
		return;
	if (mMouseDownIndex < 0) return;
	int32						metricIndex;
	_SeqIndexMetric*			metric = MetricAt(where, &metricIndex);
	if (!metric) return;
	/* There should never NOT be a props -- that's my window
	 * object, so it would be quite odd.
	 */
	SeqSongWinPropertiesI*		props = SongWinProperties();
	if (!props) return;

	/* The mouse down that initiated this drag should have guaranteed
	 * there's a selection object.  If there isn't, there's probably
	 * a memory problem, so I just fail.  I copy so that I'm not modifying
	 * the original selections object, which could cause confusion for
	 * the view updating routines.
	 */
	SeqSongSelections*			selections = props->Selections();
	if (!selections) return;
	selections = selections->Copy();
	if (!selections) return;
	/* If I'm selecting tracks, make sure every track between myself
	 * and the origin is selected.  If I'm deselecting, make sure they're
	 * deselected.
	 */
	bool						changes;
	if (mMouseDown == DOWN_ON_DESELECTED_TRACK)
		changes = SelectBetween(selections, mMouseDownIndex, metricIndex);
	else changes = DeselectBetween(selections, mMouseDownIndex, metricIndex);
	if (changes) props->SetSelections(selections);
	else delete selections;

}
Exemplo n.º 3
0
void SeqSongIndexMatrixView::MouseDown(BPoint where)
{
	mMouseDown = DOWN_ON_NOTHING;
	mMouseDownIndex = -1;
	mMouseDownOnMode = 0;
	/* There should never NOT be a props -- that's my window
	 * object, so it would be quite odd.
	 */
	SeqSongWinPropertiesI*		props = SongWinProperties();
	if (!props) return;

	_SeqIndexMetric*	metric = MetricAt(where, &mMouseDownIndex);
	if (!metric) {
		props->SetSelections(NULL);
		return;
	}
	mMouseDownOnMode = metric->ModeForPoint(where);
	if (mMouseDownOnMode != 0) {
		mMouseDown = DOWN_ON_MODE;
		return;
	}
	/* If there is a current selections object and it isn't
	 * empty, then I maintain it's time range, regardless of
	 * whether I'm adding to it or replacing it.
	 */
	SeqSongSelections*		selections = props->Selections();
	AmRange					curRange;
	bool					selectionsEmpty = true;
	if (selections && !selections->IsEmpty() ) {
		curRange = selections->TimeRange();
		selectionsEmpty = false;
	}
	
	selections = NULL;
	if (modifiers() & B_SHIFT_KEY) selections = props->Selections();
	if (selections) selections = selections->Copy();
	if (!selections) selections = SeqSongSelections::New();
	if (!selections) return;
	selections->SetTimeRange(curRange);

	if (selections->IncludesTrack(metric->mTrackId) ) {
		mMouseDown = DOWN_ON_SELECTED_TRACK;
		selections->RemoveTrack(metric->mTrackId);
	} else {
		mMouseDown = DOWN_ON_DESELECTED_TRACK;
		selections->AddTrack(metric->mTrackId);
	}
	
	props->SetSelections(selections);
}