additional style update to patchbay

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