additional style update to patchbay
This commit is contained in:
committed by
Philippe Houdoin
parent
42b7984a6e
commit
82fbbe21aa
@@ -10,9 +10,8 @@
|
|||||||
* Copyright 1999, Be Incorporated. All Rights Reserved.
|
* Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||||
* This file may be used under the terms of the Be Sample Code License.
|
* This file may be used under the terms of the Be Sample Code License.
|
||||||
*/
|
*/
|
||||||
|
#ifndef COUNTEVENTCONSUMER_H
|
||||||
#ifndef _CountEventConsumer_h
|
#define COUNTEVENTCONSUMER_H
|
||||||
#define _CountEventConsumer_h
|
|
||||||
|
|
||||||
#include <MidiConsumer.h>
|
#include <MidiConsumer.h>
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
@@ -43,4 +42,4 @@ private:
|
|||||||
int32 fEventCount;
|
int32 fEventCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _CountEventConsumer_h */
|
#endif /* COUNTEVENTCONSUMER_H */
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ EndpointInfo::EndpointInfo(int32 id)
|
|||||||
fIcon(NULL)
|
fIcon(NULL)
|
||||||
{
|
{
|
||||||
BMidiRoster* roster = BMidiRoster::MidiRoster();
|
BMidiRoster* roster = BMidiRoster::MidiRoster();
|
||||||
if (roster) {
|
if (roster != NULL) {
|
||||||
BMidiEndpoint* endpoint = roster->FindEndpoint(id);
|
BMidiEndpoint* endpoint = roster->FindEndpoint(id);
|
||||||
if (endpoint) {
|
if (endpoint != NULL) {
|
||||||
printf("endpoint %ld = %p\n", id, endpoint);
|
printf("endpoint %ld = %p\n", id, endpoint);
|
||||||
BMessage msg;
|
BMessage msg;
|
||||||
if (endpoint->GetProperties(&msg) == B_OK) {
|
if (endpoint->GetProperties(&msg) == B_OK) {
|
||||||
@@ -132,9 +132,7 @@ CreateIcon(const BMessage* msg, icon_size which)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->FindData(iconName, iconType, &data, &size) == B_OK)
|
if (msg->FindData(iconName, iconType, &data, &size) == B_OK) {
|
||||||
{
|
|
||||||
;
|
|
||||||
bitmap = new BBitmap(BRect(0, 0, bmapSize, bmapSize),
|
bitmap = new BBitmap(BRect(0, 0, bmapSize, bmapSize),
|
||||||
ICON_COLOR_SPACE);
|
ICON_COLOR_SPACE);
|
||||||
ASSERT((bitmap->BitsLength() == size));
|
ASSERT((bitmap->BitsLength() == size));
|
||||||
|
|||||||
@@ -11,9 +11,8 @@
|
|||||||
* Copyright 1999, Be Incorporated. All Rights Reserved.
|
* Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||||
* This file may be used under the terms of the Be Sample Code License.
|
* This file may be used under the terms of the Be Sample Code License.
|
||||||
*/
|
*/
|
||||||
|
#ifndef ENDPOINTINFO_H
|
||||||
#ifndef _EndpointInfo_h
|
#define ENDPOINTINFO_H
|
||||||
#define _EndpointInfo_h
|
|
||||||
|
|
||||||
#include <Mime.h> /* for icon_size */
|
#include <Mime.h> /* for icon_size */
|
||||||
#include <GraphicsDefs.h> /* for color_space */
|
#include <GraphicsDefs.h> /* for color_space */
|
||||||
@@ -49,4 +48,4 @@ private:
|
|||||||
BBitmap* fIcon;
|
BBitmap* fIcon;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _EndpointInfo_h */
|
#endif /* ENDPOINTINFO_H */
|
||||||
|
|||||||
@@ -11,13 +11,15 @@
|
|||||||
* This file may be used under the terms of the Be Sample Code License.
|
* This file may be used under the terms of the Be Sample Code License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "MidiEventMeter.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <MidiRoster.h>
|
#include <MidiRoster.h>
|
||||||
#include <MidiProducer.h>
|
#include <MidiProducer.h>
|
||||||
#include <MidiConsumer.h>
|
#include <MidiConsumer.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
#include "CountEventConsumer.h"
|
#include "CountEventConsumer.h"
|
||||||
#include "MidiEventMeter.h"
|
|
||||||
|
|
||||||
static const BRect METER_BOUNDS(0, 0, 7, 31);
|
static const BRect METER_BOUNDS(0, 0, 7, 31);
|
||||||
|
|
||||||
@@ -34,9 +36,9 @@ MidiEventMeter::MidiEventMeter(int32 producerID)
|
|||||||
fMeterLevel(0)
|
fMeterLevel(0)
|
||||||
{
|
{
|
||||||
BMidiRoster* roster = BMidiRoster::MidiRoster();
|
BMidiRoster* roster = BMidiRoster::MidiRoster();
|
||||||
if (roster) {
|
if (roster != NULL) {
|
||||||
BMidiProducer* producer = roster->FindProducer(producerID);
|
BMidiProducer* producer = roster->FindProducer(producerID);
|
||||||
if (producer) {
|
if (producer != NULL) {
|
||||||
BString name;
|
BString name;
|
||||||
name << producer->Name() << " Event Meter";
|
name << producer->Name() << " Event Meter";
|
||||||
fCounter = new CountEventConsumer(name.String());
|
fCounter = new CountEventConsumer(name.String());
|
||||||
@@ -49,7 +51,7 @@ MidiEventMeter::MidiEventMeter(int32 producerID)
|
|||||||
|
|
||||||
MidiEventMeter::~MidiEventMeter()
|
MidiEventMeter::~MidiEventMeter()
|
||||||
{
|
{
|
||||||
if (fCounter)
|
if (fCounter != NULL)
|
||||||
fCounter->Release();
|
fCounter->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +60,7 @@ void
|
|||||||
MidiEventMeter::Pulse(BView* view)
|
MidiEventMeter::Pulse(BView* view)
|
||||||
{
|
{
|
||||||
int32 newLevel = fMeterLevel;
|
int32 newLevel = fMeterLevel;
|
||||||
if (fCounter) {
|
if (fCounter != NULL) {
|
||||||
newLevel = CalcMeterLevel(fCounter->CountEvents());
|
newLevel = CalcMeterLevel(fCounter->CountEvents());
|
||||||
fCounter->Reset();
|
fCounter->Reset();
|
||||||
}
|
}
|
||||||
@@ -108,8 +110,7 @@ MidiEventMeter::Draw(BView* view)
|
|||||||
B_DARKEN_1_TINT,
|
B_DARKEN_1_TINT,
|
||||||
B_NO_TINT};
|
B_NO_TINT};
|
||||||
|
|
||||||
for (int32 i = 4; i >= 0; i--)
|
for (int32 i = 4; i >= 0; i--) {
|
||||||
{
|
|
||||||
rgb_color color;
|
rgb_color color;
|
||||||
if (fMeterLevel > i) {
|
if (fMeterLevel > i) {
|
||||||
color = tint_color(METER_GREEN, kTintArray[i]);
|
color = tint_color(METER_GREEN, kTintArray[i]);
|
||||||
|
|||||||
@@ -11,9 +11,8 @@
|
|||||||
* Copyright 1999, Be Incorporated. All Rights Reserved.
|
* Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||||
* This file may be used under the terms of the Be Sample Code License.
|
* This file may be used under the terms of the Be Sample Code License.
|
||||||
*/
|
*/
|
||||||
|
#ifndef MIDIEVENTMETER_H
|
||||||
#ifndef _MidiEventMeter_h
|
#define MIDIEVENTMETER_H
|
||||||
#define _MidiEventMeter_h
|
|
||||||
|
|
||||||
#include <Point.h>
|
#include <Point.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
@@ -39,4 +38,4 @@ private:
|
|||||||
int32 fMeterLevel;
|
int32 fMeterLevel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _MidiMeterWidget_h */
|
#endif /* MIDIEVENTMETER_H */
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "PatchApp.h"
|
#include "PatchApp.h"
|
||||||
|
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
|
|
||||||
#include "PatchWin.h"
|
#include "PatchWin.h"
|
||||||
|
|
||||||
PatchApp::PatchApp()
|
PatchApp::PatchApp()
|
||||||
|
|||||||
@@ -10,9 +10,8 @@
|
|||||||
* Copyright 1999, Be Incorporated. All Rights Reserved.
|
* Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||||
* This file may be used under the terms of the Be Sample Code License.
|
* This file may be used under the terms of the Be Sample Code License.
|
||||||
*/
|
*/
|
||||||
|
#ifndef PATCHAPP_H
|
||||||
#ifndef _PatchApp_h
|
#define PATCHAPP_H
|
||||||
#define _PatchApp_h
|
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
|
||||||
@@ -24,4 +23,4 @@ public:
|
|||||||
void MessageReceived(BMessage* msg);
|
void MessageReceived(BMessage* msg);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _PatchApp_h */
|
#endif /* PATCHAPP_H */
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <MidiConsumer.h>
|
#include <MidiConsumer.h>
|
||||||
#include <MidiProducer.h>
|
#include <MidiProducer.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
#include "MidiEventMeter.h"
|
#include "MidiEventMeter.h"
|
||||||
|
|
||||||
extern const float ROW_LEFT = 50.0f;
|
extern const float ROW_LEFT = 50.0f;
|
||||||
@@ -86,7 +87,7 @@ PatchRow::ID() const
|
|||||||
void
|
void
|
||||||
PatchRow::Pulse()
|
PatchRow::Pulse()
|
||||||
{
|
{
|
||||||
if (fEventMeter)
|
if (fEventMeter != NULL)
|
||||||
fEventMeter->Pulse(this);
|
fEventMeter->Pulse(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +95,7 @@ PatchRow::Pulse()
|
|||||||
void
|
void
|
||||||
PatchRow::Draw(BRect)
|
PatchRow::Draw(BRect)
|
||||||
{
|
{
|
||||||
if (fEventMeter)
|
if (fEventMeter != NULL)
|
||||||
fEventMeter->Draw(this);
|
fEventMeter->Draw(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,12 +122,12 @@ PatchRow::RemoveColumn(int32 consumerID)
|
|||||||
int32 numChildren = CountChildren();
|
int32 numChildren = CountChildren();
|
||||||
for (int32 i = 0; i < numChildren; i++) {
|
for (int32 i = 0; i < numChildren; i++) {
|
||||||
PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
|
PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
|
||||||
if (box && box->ConsumerID() == consumerID) {
|
if (box != NULL && box->ConsumerID() == consumerID) {
|
||||||
RemoveChild(box);
|
RemoveChild(box);
|
||||||
delete box;
|
delete box;
|
||||||
while (i < numChildren) {
|
while (i < numChildren) {
|
||||||
box = dynamic_cast<PatchCheckBox*>(ChildAt(i++));
|
box = dynamic_cast<PatchCheckBox*>(ChildAt(i++));
|
||||||
if (box)
|
if (box != NULL)
|
||||||
box->MoveBy(-COLUMN_WIDTH, 0);
|
box->MoveBy(-COLUMN_WIDTH, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -141,7 +142,7 @@ PatchRow::Connect(int32 consumerID)
|
|||||||
int32 numChildren = CountChildren();
|
int32 numChildren = CountChildren();
|
||||||
for (int32 i = 0; i < numChildren; i++) {
|
for (int32 i = 0; i < numChildren; i++) {
|
||||||
PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
|
PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
|
||||||
if (box && box->ConsumerID() == consumerID)
|
if (box != NULL && box->ConsumerID() == consumerID)
|
||||||
box->SetValue(1);
|
box->SetValue(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -153,7 +154,7 @@ PatchRow::Disconnect(int32 consumerID)
|
|||||||
int32 numChildren = CountChildren();
|
int32 numChildren = CountChildren();
|
||||||
for (int32 i = 0; i < numChildren; i++) {
|
for (int32 i = 0; i < numChildren; i++) {
|
||||||
PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
|
PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
|
||||||
if (box && box->ConsumerID() == consumerID)
|
if (box != NULL && box->ConsumerID() == consumerID)
|
||||||
box->SetValue(0);
|
box->SetValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -167,7 +168,7 @@ PatchRow::AttachedToWindow()
|
|||||||
int32 numChildren = CountChildren();
|
int32 numChildren = CountChildren();
|
||||||
for (int32 i = 0; i < numChildren; i++) {
|
for (int32 i = 0; i < numChildren; i++) {
|
||||||
PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
|
PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
|
||||||
if (box)
|
if (box != NULL)
|
||||||
box->SetTarget(this);
|
box->SetTarget(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -182,7 +183,7 @@ PatchRow::MessageReceived(BMessage* msg)
|
|||||||
BControl* ctrl;
|
BControl* ctrl;
|
||||||
if (msg->FindPointer("source", (void**) &ctrl) == B_OK) {
|
if (msg->FindPointer("source", (void**) &ctrl) == B_OK) {
|
||||||
PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ctrl);
|
PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ctrl);
|
||||||
if (box)
|
if (box != NULL)
|
||||||
box->DoConnect();
|
box->DoConnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -208,9 +209,9 @@ PatchCheckBox::DoConnect()
|
|||||||
|
|
||||||
BMidiProducer* producer = roster->FindProducer(fProducerID);
|
BMidiProducer* producer = roster->FindProducer(fProducerID);
|
||||||
BMidiConsumer* consumer = roster->FindConsumer(fConsumerID);
|
BMidiConsumer* consumer = roster->FindConsumer(fConsumerID);
|
||||||
if (producer && consumer) {
|
if (producer != NULL && consumer != NULL) {
|
||||||
status_t err;
|
status_t err;
|
||||||
if (value)
|
if (value != 0)
|
||||||
err = producer->Connect(consumer);
|
err = producer->Connect(consumer);
|
||||||
else
|
else
|
||||||
err = producer->Disconnect(consumer);
|
err = producer->Disconnect(consumer);
|
||||||
@@ -221,6 +222,8 @@ PatchCheckBox::DoConnect()
|
|||||||
} else
|
} else
|
||||||
SetValue(inverseValue);
|
SetValue(inverseValue);
|
||||||
|
|
||||||
if (producer) producer->Release();
|
if (producer != NULL)
|
||||||
if (consumer) consumer->Release();
|
producer->Release();
|
||||||
|
if (consumer != NULL)
|
||||||
|
consumer->Release();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,9 +9,8 @@
|
|||||||
* Copyright 1999, Be Incorporated. All Rights Reserved.
|
* Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||||
* This file may be used under the terms of the Be Sample Code License.
|
* This file may be used under the terms of the Be Sample Code License.
|
||||||
*/
|
*/
|
||||||
|
#ifndef PATCHROW_H
|
||||||
#ifndef _PatchRow_h
|
#define PATCHROW_H
|
||||||
#define _PatchRow_h
|
|
||||||
|
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
|
||||||
@@ -47,4 +46,4 @@ private:
|
|||||||
MidiEventMeter* fEventMeter;
|
MidiEventMeter* fEventMeter;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _PatchRow_h */
|
#endif /* PATCHROW_H */
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
#include <MidiRoster.h>
|
#include <MidiRoster.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
#include "EndpointInfo.h"
|
#include "EndpointInfo.h"
|
||||||
#include "PatchRow.h"
|
#include "PatchRow.h"
|
||||||
#include "UnknownDeviceIcons.h"
|
#include "UnknownDeviceIcons.h"
|
||||||
@@ -112,7 +113,8 @@ PatchView::GetToolTipAt(BPoint point, BToolTip** tip)
|
|||||||
|
|
||||||
endpoint_itor itor;
|
endpoint_itor itor;
|
||||||
for (itor = begin; itor != end; itor++, index--)
|
for (itor = begin; itor != end; itor++, index--)
|
||||||
if (index <= 0) break;
|
if (index <= 0)
|
||||||
|
break;
|
||||||
|
|
||||||
if (itor == end)
|
if (itor == end)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -12,13 +12,13 @@
|
|||||||
* Copyright 1999, Be Incorporated. All Rights Reserved.
|
* Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||||
* This file may be used under the terms of the Be Sample Code License.
|
* This file may be used under the terms of the Be Sample Code License.
|
||||||
*/
|
*/
|
||||||
|
#ifndef PATCHVIEW_H
|
||||||
#ifndef _PatchView_h
|
#define PATCHVIEW_H
|
||||||
#define _PatchView_h
|
|
||||||
|
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#include "EndpointInfo.h"
|
#include "EndpointInfo.h"
|
||||||
|
|
||||||
class PatchRow;
|
class PatchRow;
|
||||||
@@ -70,4 +70,4 @@ private:
|
|||||||
BBitmap* fUnknownDeviceIcon;
|
BBitmap* fUnknownDeviceIcon;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _PatchView_h */
|
#endif /* PATCHVIEW_H */
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "PatchWin.h"
|
#include "PatchWin.h"
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
|
||||||
#include "PatchView.h"
|
#include "PatchView.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,8 @@
|
|||||||
* Copyright 1999, Be Incorporated. All Rights Reserved.
|
* Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||||
* This file may be used under the terms of the Be Sample Code License.
|
* This file may be used under the terms of the Be Sample Code License.
|
||||||
*/
|
*/
|
||||||
|
#ifndef PATCHWIN_H
|
||||||
#ifndef _PatchWin_h
|
#define PATCHWIN_H
|
||||||
#define _PatchWin_h
|
|
||||||
|
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
@@ -27,4 +26,4 @@ private:
|
|||||||
PatchView* fPatchView;
|
PatchView* fPatchView;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _PatchWin_h */
|
#endif /* PATCHWIN_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user