From f76dd109bdaf55263095744daf450182402220d4 Mon Sep 17 00:00:00 2001
From: Pete Goodeve <pete.goodeve@computer.org>
Date: Sun, 19 May 2013 16:51:22 -0700
Subject: [PATCH] additional style update to patchbay
---
src/apps/patchbay/CountEventConsumer.h | 7 +++----
src/apps/patchbay/EndpointInfo.cpp | 8 +++-----
src/apps/patchbay/EndpointInfo.h | 7 +++----
src/apps/patchbay/MidiEventMeter.cpp | 15 ++++++++-------
src/apps/patchbay/MidiEventMeter.h | 7 +++----
src/apps/patchbay/PatchApp.cpp | 1 +
src/apps/patchbay/PatchApp.h | 7 +++----
src/apps/patchbay/PatchRow.cpp | 27 +++++++++++++++------------
src/apps/patchbay/PatchRow.h | 7 +++----
src/apps/patchbay/PatchView.cpp | 4 +++-
src/apps/patchbay/PatchView.h | 8 ++++----
src/apps/patchbay/PatchWin.cpp | 1 +
src/apps/patchbay/PatchWin.h | 7 +++----
13 files changed, 53 insertions(+), 53 deletions(-)
diff --git a/src/apps/patchbay/CountEventConsumer.h b/src/apps/patchbay/CountEventConsumer.h
index d6fe12f..3f8c574 100644
a
|
b
|
|
10 | 10 | * Copyright 1999, Be Incorporated. All Rights Reserved. |
11 | 11 | * This file may be used under the terms of the Be Sample Code License. |
12 | 12 | */ |
13 | | |
14 | | #ifndef _CountEventConsumer_h |
15 | | #define _CountEventConsumer_h |
| 13 | #ifndef COUNTEVENTCONSUMER_H |
| 14 | #define COUNTEVENTCONSUMER_H |
16 | 15 | |
17 | 16 | #include <MidiConsumer.h> |
18 | 17 | #include <SupportDefs.h> |
… |
… |
private:
|
43 | 42 | int32 fEventCount; |
44 | 43 | }; |
45 | 44 | |
46 | | #endif /* _CountEventConsumer_h */ |
| 45 | #endif /* COUNTEVENTCONSUMER_H */ |
diff --git a/src/apps/patchbay/EndpointInfo.cpp b/src/apps/patchbay/EndpointInfo.cpp
index 4ee9911..4e4a438 100644
a
|
b
|
EndpointInfo::EndpointInfo(int32 id)
|
46 | 46 | fIcon(NULL) |
47 | 47 | { |
48 | 48 | BMidiRoster* roster = BMidiRoster::MidiRoster(); |
49 | | if (roster) { |
| 49 | if (roster != NULL) { |
50 | 50 | BMidiEndpoint* endpoint = roster->FindEndpoint(id); |
51 | | if (endpoint) { |
| 51 | if (endpoint != NULL) { |
52 | 52 | printf("endpoint %ld = %p\n", id, endpoint); |
53 | 53 | BMessage msg; |
54 | 54 | if (endpoint->GetProperties(&msg) == B_OK) { |
… |
… |
CreateIcon(const BMessage* msg, icon_size which)
|
132 | 132 | return NULL; |
133 | 133 | } |
134 | 134 | |
135 | | if (msg->FindData(iconName, iconType, &data, &size) == B_OK) |
136 | | { |
137 | | ; |
| 135 | if (msg->FindData(iconName, iconType, &data, &size) == B_OK) { |
138 | 136 | bitmap = new BBitmap(BRect(0, 0, bmapSize, bmapSize), |
139 | 137 | ICON_COLOR_SPACE); |
140 | 138 | ASSERT((bitmap->BitsLength() == size)); |
diff --git a/src/apps/patchbay/EndpointInfo.h b/src/apps/patchbay/EndpointInfo.h
index 92a65dc..49a52d8 100644
a
|
b
|
|
11 | 11 | * Copyright 1999, Be Incorporated. All Rights Reserved. |
12 | 12 | * This file may be used under the terms of the Be Sample Code License. |
13 | 13 | */ |
14 | | |
15 | | #ifndef _EndpointInfo_h |
16 | | #define _EndpointInfo_h |
| 14 | #ifndef ENDPOINTINFO_H |
| 15 | #define ENDPOINTINFO_H |
17 | 16 | |
18 | 17 | #include <Mime.h> /* for icon_size */ |
19 | 18 | #include <GraphicsDefs.h> /* for color_space */ |
… |
… |
private:
|
49 | 48 | BBitmap* fIcon; |
50 | 49 | }; |
51 | 50 | |
52 | | #endif /* _EndpointInfo_h */ |
| 51 | #endif /* ENDPOINTINFO_H */ |
diff --git a/src/apps/patchbay/MidiEventMeter.cpp b/src/apps/patchbay/MidiEventMeter.cpp
index 719cf61..893f27d 100644
a
|
b
|
|
10 | 10 | * Copyright 1999, Be Incorporated. All Rights Reserved. |
11 | 11 | * This file may be used under the terms of the Be Sample Code License. |
12 | 12 | */ |
| 13 | |
| 14 | #include "MidiEventMeter.h" |
13 | 15 | |
14 | 16 | #include <stdio.h> |
15 | 17 | #include <MidiRoster.h> |
16 | 18 | #include <MidiProducer.h> |
17 | 19 | #include <MidiConsumer.h> |
18 | 20 | #include <View.h> |
| 21 | |
19 | 22 | #include "CountEventConsumer.h" |
20 | | #include "MidiEventMeter.h" |
21 | 23 | |
22 | 24 | static const BRect METER_BOUNDS(0, 0, 7, 31); |
23 | 25 | |
… |
… |
MidiEventMeter::MidiEventMeter(int32 producerID)
|
34 | 36 | fMeterLevel(0) |
35 | 37 | { |
36 | 38 | BMidiRoster* roster = BMidiRoster::MidiRoster(); |
37 | | if (roster) { |
| 39 | if (roster != NULL) { |
38 | 40 | BMidiProducer* producer = roster->FindProducer(producerID); |
39 | | if (producer) { |
| 41 | if (producer != NULL) { |
40 | 42 | BString name; |
41 | 43 | name << producer->Name() << " Event Meter"; |
42 | 44 | fCounter = new CountEventConsumer(name.String()); |
… |
… |
MidiEventMeter::MidiEventMeter(int32 producerID)
|
49 | 51 | |
50 | 52 | MidiEventMeter::~MidiEventMeter() |
51 | 53 | { |
52 | | if (fCounter) |
| 54 | if (fCounter != NULL) |
53 | 55 | fCounter->Release(); |
54 | 56 | } |
55 | 57 | |
… |
… |
void
|
58 | 60 | MidiEventMeter::Pulse(BView* view) |
59 | 61 | { |
60 | 62 | int32 newLevel = fMeterLevel; |
61 | | if (fCounter) { |
| 63 | if (fCounter != NULL) { |
62 | 64 | newLevel = CalcMeterLevel(fCounter->CountEvents()); |
63 | 65 | fCounter->Reset(); |
64 | 66 | } |
… |
… |
MidiEventMeter::Draw(BView* view)
|
108 | 110 | B_DARKEN_1_TINT, |
109 | 111 | B_NO_TINT}; |
110 | 112 | |
111 | | for (int32 i = 4; i >= 0; i--) |
112 | | { |
| 113 | for (int32 i = 4; i >= 0; i--) { |
113 | 114 | rgb_color color; |
114 | 115 | if (fMeterLevel > i) { |
115 | 116 | color = tint_color(METER_GREEN, kTintArray[i]); |
diff --git a/src/apps/patchbay/MidiEventMeter.h b/src/apps/patchbay/MidiEventMeter.h
index 5866e6e..6894693 100644
a
|
b
|
|
11 | 11 | * Copyright 1999, Be Incorporated. All Rights Reserved. |
12 | 12 | * This file may be used under the terms of the Be Sample Code License. |
13 | 13 | */ |
14 | | |
15 | | #ifndef _MidiEventMeter_h |
16 | | #define _MidiEventMeter_h |
| 14 | #ifndef MIDIEVENTMETER_H |
| 15 | #define MIDIEVENTMETER_H |
17 | 16 | |
18 | 17 | #include <Point.h> |
19 | 18 | #include <Rect.h> |
… |
… |
private:
|
39 | 38 | int32 fMeterLevel; |
40 | 39 | }; |
41 | 40 | |
42 | | #endif /* _MidiMeterWidget_h */ |
| 41 | #endif /* MIDIEVENTMETER_H */ |
diff --git a/src/apps/patchbay/PatchApp.cpp b/src/apps/patchbay/PatchApp.cpp
index acf3512..a443a77 100644
a
|
b
|
|
14 | 14 | #include "PatchApp.h" |
15 | 15 | |
16 | 16 | #include <Roster.h> |
| 17 | |
17 | 18 | #include "PatchWin.h" |
18 | 19 | |
19 | 20 | PatchApp::PatchApp() |
diff --git a/src/apps/patchbay/PatchApp.h b/src/apps/patchbay/PatchApp.h
index e45f32a..c511da3 100644
a
|
b
|
|
10 | 10 | * Copyright 1999, Be Incorporated. All Rights Reserved. |
11 | 11 | * This file may be used under the terms of the Be Sample Code License. |
12 | 12 | */ |
13 | | |
14 | | #ifndef _PatchApp_h |
15 | | #define _PatchApp_h |
| 13 | #ifndef PATCHAPP_H |
| 14 | #define PATCHAPP_H |
16 | 15 | |
17 | 16 | #include <Application.h> |
18 | 17 | |
… |
… |
public:
|
24 | 23 | void MessageReceived(BMessage* msg); |
25 | 24 | }; |
26 | 25 | |
27 | | #endif /* _PatchApp_h */ |
| 26 | #endif /* PATCHAPP_H */ |
diff --git a/src/apps/patchbay/PatchRow.cpp b/src/apps/patchbay/PatchRow.cpp
index 6dfe353..f22a8ce 100644
a
|
b
|
|
19 | 19 | #include <MidiConsumer.h> |
20 | 20 | #include <MidiProducer.h> |
21 | 21 | #include <Window.h> |
| 22 | |
22 | 23 | #include "MidiEventMeter.h" |
23 | 24 | |
24 | 25 | extern const float ROW_LEFT = 50.0f; |
… |
… |
PatchRow::ID() const
|
86 | 87 | void |
87 | 88 | PatchRow::Pulse() |
88 | 89 | { |
89 | | if (fEventMeter) |
| 90 | if (fEventMeter != NULL) |
90 | 91 | fEventMeter->Pulse(this); |
91 | 92 | } |
92 | 93 | |
… |
… |
PatchRow::Pulse()
|
94 | 95 | void |
95 | 96 | PatchRow::Draw(BRect) |
96 | 97 | { |
97 | | if (fEventMeter) |
| 98 | if (fEventMeter != NULL) |
98 | 99 | fEventMeter->Draw(this); |
99 | 100 | } |
100 | 101 | |
… |
… |
PatchRow::RemoveColumn(int32 consumerID)
|
121 | 122 | int32 numChildren = CountChildren(); |
122 | 123 | for (int32 i = 0; i < numChildren; i++) { |
123 | 124 | PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i)); |
124 | | if (box && box->ConsumerID() == consumerID) { |
| 125 | if (box != NULL && box->ConsumerID() == consumerID) { |
125 | 126 | RemoveChild(box); |
126 | 127 | delete box; |
127 | 128 | while (i < numChildren) { |
128 | 129 | box = dynamic_cast<PatchCheckBox*>(ChildAt(i++)); |
129 | | if (box) |
| 130 | if (box != NULL) |
130 | 131 | box->MoveBy(-COLUMN_WIDTH, 0); |
131 | 132 | } |
132 | 133 | break; |
… |
… |
PatchRow::Connect(int32 consumerID)
|
141 | 142 | int32 numChildren = CountChildren(); |
142 | 143 | for (int32 i = 0; i < numChildren; i++) { |
143 | 144 | PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i)); |
144 | | if (box && box->ConsumerID() == consumerID) |
| 145 | if (box != NULL && box->ConsumerID() == consumerID) |
145 | 146 | box->SetValue(1); |
146 | 147 | } |
147 | 148 | } |
… |
… |
PatchRow::Disconnect(int32 consumerID)
|
153 | 154 | int32 numChildren = CountChildren(); |
154 | 155 | for (int32 i = 0; i < numChildren; i++) { |
155 | 156 | PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i)); |
156 | | if (box && box->ConsumerID() == consumerID) |
| 157 | if (box != NULL && box->ConsumerID() == consumerID) |
157 | 158 | box->SetValue(0); |
158 | 159 | } |
159 | 160 | } |
… |
… |
PatchRow::AttachedToWindow()
|
167 | 168 | int32 numChildren = CountChildren(); |
168 | 169 | for (int32 i = 0; i < numChildren; i++) { |
169 | 170 | PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i)); |
170 | | if (box) |
| 171 | if (box != NULL) |
171 | 172 | box->SetTarget(this); |
172 | 173 | } |
173 | 174 | } |
… |
… |
PatchRow::MessageReceived(BMessage* msg)
|
182 | 183 | BControl* ctrl; |
183 | 184 | if (msg->FindPointer("source", (void**) &ctrl) == B_OK) { |
184 | 185 | PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ctrl); |
185 | | if (box) |
| 186 | if (box != NULL) |
186 | 187 | box->DoConnect(); |
187 | 188 | } |
188 | 189 | } |
… |
… |
PatchCheckBox::DoConnect()
|
208 | 209 | |
209 | 210 | BMidiProducer* producer = roster->FindProducer(fProducerID); |
210 | 211 | BMidiConsumer* consumer = roster->FindConsumer(fConsumerID); |
211 | | if (producer && consumer) { |
| 212 | if (producer != NULL && consumer != NULL) { |
212 | 213 | status_t err; |
213 | | if (value) |
| 214 | if (value != 0) |
214 | 215 | err = producer->Connect(consumer); |
215 | 216 | else |
216 | 217 | err = producer->Disconnect(consumer); |
… |
… |
PatchCheckBox::DoConnect()
|
221 | 222 | } else |
222 | 223 | SetValue(inverseValue); |
223 | 224 | |
224 | | if (producer) producer->Release(); |
225 | | if (consumer) consumer->Release(); |
| 225 | if (producer != NULL) |
| 226 | producer->Release(); |
| 227 | if (consumer != NULL) |
| 228 | consumer->Release(); |
226 | 229 | } |
diff --git a/src/apps/patchbay/PatchRow.h b/src/apps/patchbay/PatchRow.h
index 21977b6..2e97076 100644
a
|
b
|
|
9 | 9 | * Copyright 1999, Be Incorporated. All Rights Reserved. |
10 | 10 | * This file may be used under the terms of the Be Sample Code License. |
11 | 11 | */ |
12 | | |
13 | | #ifndef _PatchRow_h |
14 | | #define _PatchRow_h |
| 12 | #ifndef PATCHROW_H |
| 13 | #define PATCHROW_H |
15 | 14 | |
16 | 15 | #include <View.h> |
17 | 16 | |
… |
… |
private:
|
47 | 46 | MidiEventMeter* fEventMeter; |
48 | 47 | }; |
49 | 48 | |
50 | | #endif /* _PatchRow_h */ |
| 49 | #endif /* PATCHROW_H */ |
diff --git a/src/apps/patchbay/PatchView.cpp b/src/apps/patchbay/PatchView.cpp
index dc0054e..55892f4 100644
a
|
b
|
|
22 | 22 | #include <Messenger.h> |
23 | 23 | #include <MidiRoster.h> |
24 | 24 | #include <Window.h> |
| 25 | |
25 | 26 | #include "EndpointInfo.h" |
26 | 27 | #include "PatchRow.h" |
27 | 28 | #include "UnknownDeviceIcons.h" |
… |
… |
PatchView::GetToolTipAt(BPoint point, BToolTip** tip)
|
112 | 113 | |
113 | 114 | endpoint_itor itor; |
114 | 115 | for (itor = begin; itor != end; itor++, index--) |
115 | | if (index <= 0) break; |
| 116 | if (index <= 0) |
| 117 | break; |
116 | 118 | |
117 | 119 | if (itor == end) |
118 | 120 | return false; |
diff --git a/src/apps/patchbay/PatchView.h b/src/apps/patchbay/PatchView.h
index 3298c5b..15d4cb9 100644
a
|
b
|
|
12 | 12 | * Copyright 1999, Be Incorporated. All Rights Reserved. |
13 | 13 | * This file may be used under the terms of the Be Sample Code License. |
14 | 14 | */ |
15 | | |
16 | | #ifndef _PatchView_h |
17 | | #define _PatchView_h |
| 15 | #ifndef PATCHVIEW_H |
| 16 | #define PATCHVIEW_H |
18 | 17 | |
19 | 18 | #include <Rect.h> |
20 | 19 | #include <View.h> |
21 | 20 | #include <list> |
| 21 | |
22 | 22 | #include "EndpointInfo.h" |
23 | 23 | |
24 | 24 | class PatchRow; |
… |
… |
private:
|
70 | 70 | BBitmap* fUnknownDeviceIcon; |
71 | 71 | }; |
72 | 72 | |
73 | | #endif /* _PatchView_h */ |
| 73 | #endif /* PATCHVIEW_H */ |
diff --git a/src/apps/patchbay/PatchWin.cpp b/src/apps/patchbay/PatchWin.cpp
index 8c45054..0ef0947 100644
a
|
b
|
|
14 | 14 | #include "PatchWin.h" |
15 | 15 | |
16 | 16 | #include <Application.h> |
| 17 | |
17 | 18 | #include "PatchView.h" |
18 | 19 | |
19 | 20 | |
diff --git a/src/apps/patchbay/PatchWin.h b/src/apps/patchbay/PatchWin.h
index c5659ea..0667d23 100644
a
|
b
|
|
10 | 10 | * Copyright 1999, Be Incorporated. All Rights Reserved. |
11 | 11 | * This file may be used under the terms of the Be Sample Code License. |
12 | 12 | */ |
13 | | |
14 | | #ifndef _PatchWin_h |
15 | | #define _PatchWin_h |
| 13 | #ifndef PATCHWIN_H |
| 14 | #define PATCHWIN_H |
16 | 15 | |
17 | 16 | #include <Window.h> |
18 | 17 | |
… |
… |
private:
|
27 | 26 | PatchView* fPatchView; |
28 | 27 | }; |
29 | 28 | |
30 | | #endif /* _PatchWin_h */ |
| 29 | #endif /* PATCHWIN_H */ |