예제 #1
0
void SeqPhraseMatrixView::MessageReceived(BMessage* msg)
{
    if (TrackMessageReceived(msg) ) return;

    SeqSongWinPropertiesI*		win = dynamic_cast<SeqSongWinPropertiesI*>( Window() );
    _SeqPhraseToolTarget*	target;
    if (win && (target = new _SeqPhraseToolTarget(win, this, &mMtc)) ) {
        track_id	trackId = CurrentTrackId();
        bool		handled = mTool.HandleMessage(msg, trackId, target);
        delete target;
        if (handled) return;
    }

    switch (msg->what) {
    case AmSong::END_TIME_CHANGE_OBS:
        AmTime		endTime;
        if(find_time(*msg, "end_time", &endTime ) == B_OK) {
            mCachedEndTime = endTime;
            SetupScrollBars(true, false);
        }
        break;
    case AmSong::TRACK_CHANGE_OBS:
        TrackChangeReceived(msg);
        break;
    case AmTrack::MODE_CHANGE_OBS: {
        BRect			invalid = arp_invalid_rect();
        track_id		tid;
        BRect			b(Bounds() );
        for (uint32 k = 0; msg->FindPointer(SZ_TRACK_ID, k, & tid) == B_OK; k++) {
            _SeqTrackMetric*	metric = TrackMetric(tid);
            if (metric) {
                BRect	r(b.left, metric->mTop, b.right, metric->mBottom);
                invalid = arp_merge_rects(invalid, r);
            }
        }
        if (arp_is_valid_rect(invalid) ) Invalidate(invalid);
    }
    break;
    case SHOW_POPUP_MSG:
        if (mDownTime >= 0) {
            StopPopUpTimer();
            ShowPopUp();
            mDownTime = -1;
        }
        break;
    case PROPERTIES_MSG: {
        BPoint		where;
        if (msg->FindPoint(WHERE_STR, &where) == B_OK)
            ShowProperties(where);
    }
    break;
    default:
        inherited::MessageReceived(msg);
        break;
    }
}
예제 #2
0
void SeqPhraseMatrixView::FrameResized(float new_width, float new_height)
{
    inherited::FrameResized(new_width, new_height);
    AddAsObserver();
    if (mVsb) SetVsbSteps();
    SetupScrollBars(true, true);
    if (Parent() && Window() && mMeasureView && Window()->Lock() ) {
        BRect		f = Parent()->Frame();
        float		topW = furthest_right( Window() );
        mMeasureView->SetRightIndent(topW - f.right);
        Window()->Unlock();
    }
}
예제 #3
0
void SeqPhraseMatrixView::TrackChangeReceived(BMessage* msg)
{
    // READ SONG BLOCK
#ifdef AM_TRACE_LOCKS
    printf("SeqPhraseMatrixView::TrackChangeReceived() read lock\n");
    fflush(stdout);
#endif
    const AmSong*	song = mSongRef.ReadLock();
    if (song) FillTrackMetrics(song);
    mSongRef.ReadUnlock(song);
    // END READ SONG BLOCK

    int32		position;
    if (lowest_position(*msg, &position) != B_OK) return;

    float		top = TrackTop( (uint32)position);
    BRect		b = Bounds();
    Invalidate( BRect(b.left, top, b.right, b.bottom) );

    SetupScrollBars(false, true);
}
예제 #4
0
void WebListBox::DrawThisOnly (DISPLAY_INT x, DISPLAY_INT y, WebGraphics *gc)
{
	WebRect visibleRegion, oldClip, frame(mRect);

	CalculateTextMetrics(gc);
	SetupScrollBars(gc);

	WebColor hilite, lolite, black, blue, white;
	hilite = white = gc->RGBToColor(0xff, 0xff, 0xff);
	lolite = black = gc->RGBToColor(0, 0, 0);
	blue = gc->RGBToColor(0, 0, 0xff);

	frame.MoveTo(x,y);

	if (mFlags & DISPLAY_FLAG_FOCUS && !(mStyle & LISTBOX_STYLE_NOFOCUSFRAME))
	{
		gc->Rectangle(&frame, black, black, WEBC_FALSE);
	}
	if (mStyle & LISTBOX_STYLE_NOT3D)
	{
		hilite = lolite = black;
	}

	frame.top += GetMargin();
	frame.left += GetMargin();
	frame.bottom -= GetMargin();
	frame.right -= GetMargin();

//	gc->StartBuffer();

	gc->Rectangle(&frame, GetBgColor(gc), GetBgColor(gc), WEBC_TRUE);
	DrawFrame(&frame, gc);

	DISPLAY_INT windowX, windowY;
	GetScrollOffset(&windowX, &windowY);
	long firstVisible = windowY / (miTextHeight + GetSpacing()) - 1;
	if (firstVisible < 0)
		firstVisible = 0;

	gc->GetClip(&oldClip);

	GetOptionsRect(&visibleRegion);
	visibleRegion.Shift(x,y);

	WebRect clip(visibleRegion);
	clip.And(&oldClip);
	gc->SetClip(&clip);

	WEBC_BOOL invert;
	int offset = firstVisible * (miTextHeight + GetSpacing());
	for (int t = firstVisible; t < miNumOptions; t++)
	{
		invert = ( ((t == GetSelected()) && !(mStyle & LISTBOX_STYLE_FOLLOW_MOUSE)) ||
		           ((t == miMouseOver)   &&  (mStyle & LISTBOX_STYLE_FOLLOW_MOUSE)) );

		if (invert)
		{
			PresetWebRect r (visibleRegion.left - windowX,  visibleRegion.top + offset - windowY,
			                 visibleRegion.right - windowX, visibleRegion.top + offset - windowY + miTextHeight - 1);
			gc->Rectangle(&r, GetSelectColor(gc), GetSelectColor(gc), WEBC_TRUE);
		}
		gc->Text(visibleRegion.left - windowX, visibleRegion.top + offset - windowY,
			 mppOption[t], (invert? GetBgColor(gc) : GetTextColor(gc)),
			 blue, WEBC_FALSE, mFont.GetFont());

		offset += miTextHeight + GetSpacing();
	}

	gc->SetClip(&oldClip);
//	gc->EndBuffer();
}