Пример #1
0
bool
PatchView::GetToolTipAt(BPoint point, BToolTip** tip)
{
	bool found = false;
	int32 index = 0;
	endpoint_itor begin, end;
	int32 size = fConsumers.size();
	for (int32 i = 0; !found && i < size; i++) {
		BRect r = ColumnIconFrameAt(i);
		if (r.Contains(point)) {
			begin = fConsumers.begin();
			end = fConsumers.end();
			found = true;
			index = i;
		}
	}
	size = fProducers.size();
	for (int32 i = 0; !found && i < size; i++) {
		BRect r = RowIconFrameAt(i);
		if (r.Contains(point)) {
			begin = fProducers.begin();
			end = fProducers.end();
			found = true;
			index = i;
		}
	}
	
	if (!found)
		return false;

	endpoint_itor itor;
	for (itor = begin; itor != end; itor++, index--)
		if (index <= 0)
			break;
	
	if (itor == end)
		return false;

	BMidiRoster* roster = BMidiRoster::MidiRoster();
	if (roster == NULL)
		return false;
	BMidiEndpoint* obj = roster->FindEndpoint(itor->ID());
	if (obj == NULL)
		return false;

	BString str;
	str << "<" << obj->ID() << ">: " << obj->Name();
	obj->Release();

	SetToolTip(str.String());

	*tip = ToolTip();

	return true;
}
Пример #2
0
void
PatchView::AttachedToWindow()
{
	BMidiRoster* roster = BMidiRoster::MidiRoster();
	if (roster == NULL) {
		PRINT(("Couldn't get MIDI roster\n"));
		be_app->PostMessage(B_QUIT_REQUESTED);
		return;
	}
	
	BMessenger msgr(this);
	roster->StartWatching(&msgr);
}
Пример #3
0
EndpointInfo::EndpointInfo(int32 id)
    : m_id(id), m_icon(NULL)
{
    BMidiRoster* roster = BMidiRoster::MidiRoster();
    if (roster) {
        BMidiEndpoint* endpoint = roster->FindEndpoint(id);
        if (endpoint) {
            printf("endpoint %ld = %p\n", id, endpoint);
            BMessage msg;
            if (endpoint->GetProperties(&msg) == B_OK) {
                m_icon = CreateIcon(&msg, DISPLAY_ICON_SIZE);
            }
            endpoint->Release();
        }
    }
}
Пример #4
0
MidiEventMeter::MidiEventMeter(int32 producerID)
	:
	fCounter(NULL),
	fMeterLevel(0)
{
	BMidiRoster* roster = BMidiRoster::MidiRoster();
	if (roster != NULL) {
		BMidiProducer* producer = roster->FindProducer(producerID);
		if (producer != NULL) {
			BString name;
			name << producer->Name() << " Event Meter";
			fCounter = new CountEventConsumer(name.String());
			producer->Connect(fCounter);
			producer->Release();
		}
	}
}