Ticket #9604: 0001-additional-style-update-to-patchbay.patch

File 0001-additional-style-update-to-patchbay.patch, 11.8 KB (added by Pete, 7 years ago)

2nd attempt to bring code up to style guide

  • src/apps/patchbay/CountEventConsumer.h

    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  
    1010 * Copyright 1999, Be Incorporated.   All Rights Reserved.
    1111 * This file may be used under the terms of the Be Sample Code License.
    1212 */
    13  
    14 #ifndef _CountEventConsumer_h
    15 #define _CountEventConsumer_h
     13#ifndef COUNTEVENTCONSUMER_H
     14#define COUNTEVENTCONSUMER_H
    1615
    1716#include <MidiConsumer.h>
    1817#include <SupportDefs.h>
    private:  
    4342    int32 fEventCount;
    4443};
    4544
    46 #endif /* _CountEventConsumer_h */
     45#endif /* COUNTEVENTCONSUMER_H */
  • src/apps/patchbay/EndpointInfo.cpp

    diff --git a/src/apps/patchbay/EndpointInfo.cpp b/src/apps/patchbay/EndpointInfo.cpp
    index 4ee9911..4e4a438 100644
    a b EndpointInfo::EndpointInfo(int32 id)  
    4646    fIcon(NULL)
    4747{
    4848    BMidiRoster* roster = BMidiRoster::MidiRoster();
    49     if (roster) {
     49    if (roster != NULL) {
    5050        BMidiEndpoint* endpoint = roster->FindEndpoint(id);
    51         if (endpoint) {
     51        if (endpoint != NULL) {
    5252            printf("endpoint %ld = %p\n", id, endpoint);
    5353            BMessage msg;
    5454            if (endpoint->GetProperties(&msg) == B_OK) {
    CreateIcon(const BMessage* msg, icon_size which)  
    132132        return NULL;
    133133    }
    134134                           
    135     if (msg->FindData(iconName, iconType, &data, &size) == B_OK)
    136     {
    137         ;
     135    if (msg->FindData(iconName, iconType, &data, &size) == B_OK) {
    138136        bitmap = new BBitmap(BRect(0, 0, bmapSize, bmapSize),
    139137            ICON_COLOR_SPACE);
    140138        ASSERT((bitmap->BitsLength() == size));
  • src/apps/patchbay/EndpointInfo.h

    diff --git a/src/apps/patchbay/EndpointInfo.h b/src/apps/patchbay/EndpointInfo.h
    index 92a65dc..49a52d8 100644
    a b  
    1111 * Copyright 1999, Be Incorporated.   All Rights Reserved.
    1212 * This file may be used under the terms of the Be Sample Code License.
    1313 */
    14  
    15 #ifndef _EndpointInfo_h
    16 #define _EndpointInfo_h
     14#ifndef ENDPOINTINFO_H
     15#define ENDPOINTINFO_H
    1716
    1817#include <Mime.h> /* for icon_size */
    1918#include <GraphicsDefs.h> /* for color_space */
    private:  
    4948    BBitmap* fIcon;
    5049};
    5150
    52 #endif /* _EndpointInfo_h */
     51#endif /* ENDPOINTINFO_H */
  • src/apps/patchbay/MidiEventMeter.cpp

    diff --git a/src/apps/patchbay/MidiEventMeter.cpp b/src/apps/patchbay/MidiEventMeter.cpp
    index 719cf61..893f27d 100644
    a b  
    1010 * Copyright 1999, Be Incorporated.   All Rights Reserved.
    1111 * This file may be used under the terms of the Be Sample Code License.
    1212 */
     13
     14#include "MidiEventMeter.h"
    1315 
    1416#include <stdio.h>
    1517#include <MidiRoster.h>
    1618#include <MidiProducer.h>
    1719#include <MidiConsumer.h>
    1820#include <View.h>
     21
    1922#include "CountEventConsumer.h"
    20 #include "MidiEventMeter.h"
    2123
    2224static const BRect METER_BOUNDS(0, 0, 7, 31);
    2325
    MidiEventMeter::MidiEventMeter(int32 producerID)  
    3436    fMeterLevel(0)
    3537{
    3638    BMidiRoster* roster = BMidiRoster::MidiRoster();
    37     if (roster) {
     39    if (roster != NULL) {
    3840        BMidiProducer* producer = roster->FindProducer(producerID);
    39         if (producer) {
     41        if (producer != NULL) {
    4042            BString name;
    4143            name << producer->Name() << " Event Meter";
    4244            fCounter = new CountEventConsumer(name.String());
    MidiEventMeter::MidiEventMeter(int32 producerID)  
    4951
    5052MidiEventMeter::~MidiEventMeter()
    5153{
    52     if (fCounter)
     54    if (fCounter != NULL)
    5355        fCounter->Release();
    5456}
    5557
    void  
    5860MidiEventMeter::Pulse(BView* view)
    5961{
    6062    int32 newLevel = fMeterLevel;
    61     if (fCounter) {
     63    if (fCounter != NULL) {
    6264        newLevel = CalcMeterLevel(fCounter->CountEvents());
    6365        fCounter->Reset();
    6466    }
    MidiEventMeter::Draw(BView* view)  
    108110         B_DARKEN_1_TINT,
    109111         B_NO_TINT};
    110112   
    111     for (int32 i = 4; i >= 0; i--)
    112     {
     113    for (int32 i = 4; i >= 0; i--) {
    113114        rgb_color color;
    114115        if (fMeterLevel > i) {
    115116            color = tint_color(METER_GREEN, kTintArray[i]);
  • src/apps/patchbay/MidiEventMeter.h

    diff --git a/src/apps/patchbay/MidiEventMeter.h b/src/apps/patchbay/MidiEventMeter.h
    index 5866e6e..6894693 100644
    a b  
    1111 * Copyright 1999, Be Incorporated.   All Rights Reserved.
    1212 * This file may be used under the terms of the Be Sample Code License.
    1313 */
    14  
    15 #ifndef _MidiEventMeter_h
    16 #define _MidiEventMeter_h
     14#ifndef MIDIEVENTMETER_H
     15#define MIDIEVENTMETER_H
    1716
    1817#include <Point.h>
    1918#include <Rect.h>
    private:  
    3938    int32 fMeterLevel;
    4039};
    4140
    42 #endif /* _MidiMeterWidget_h */
     41#endif /* MIDIEVENTMETER_H */
  • src/apps/patchbay/PatchApp.cpp

    diff --git a/src/apps/patchbay/PatchApp.cpp b/src/apps/patchbay/PatchApp.cpp
    index acf3512..a443a77 100644
    a b  
    1414#include "PatchApp.h"
    1515
    1616#include <Roster.h>
     17
    1718#include "PatchWin.h"
    1819
    1920PatchApp::PatchApp()
  • src/apps/patchbay/PatchApp.h

    diff --git a/src/apps/patchbay/PatchApp.h b/src/apps/patchbay/PatchApp.h
    index e45f32a..c511da3 100644
    a b  
    1010 * Copyright 1999, Be Incorporated.   All Rights Reserved.
    1111 * This file may be used under the terms of the Be Sample Code License.
    1212 */
    13  
    14 #ifndef _PatchApp_h
    15 #define _PatchApp_h
     13#ifndef PATCHAPP_H
     14#define PATCHAPP_H
    1615
    1716#include <Application.h>
    1817
    public:  
    2423    void MessageReceived(BMessage* msg);
    2524};
    2625
    27 #endif /* _PatchApp_h */
     26#endif /* PATCHAPP_H */
  • src/apps/patchbay/PatchRow.cpp

    diff --git a/src/apps/patchbay/PatchRow.cpp b/src/apps/patchbay/PatchRow.cpp
    index 6dfe353..f22a8ce 100644
    a b  
    1919#include <MidiConsumer.h>
    2020#include <MidiProducer.h>
    2121#include <Window.h>
     22
    2223#include "MidiEventMeter.h"
    2324
    2425extern const float ROW_LEFT = 50.0f;
    PatchRow::ID() const  
    8687void
    8788PatchRow::Pulse()
    8889{
    89     if (fEventMeter)
     90    if (fEventMeter != NULL)
    9091        fEventMeter->Pulse(this);
    9192}
    9293
    PatchRow::Pulse()  
    9495void
    9596PatchRow::Draw(BRect)
    9697{
    97     if (fEventMeter)
     98    if (fEventMeter != NULL)
    9899        fEventMeter->Draw(this);
    99100}
    100101
    PatchRow::RemoveColumn(int32 consumerID)  
    121122    int32 numChildren = CountChildren();
    122123    for (int32 i = 0; i < numChildren; i++) {
    123124        PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
    124         if (box && box->ConsumerID() == consumerID) {
     125        if (box != NULL && box->ConsumerID() == consumerID) {
    125126            RemoveChild(box);
    126127            delete box;
    127128            while (i < numChildren) {
    128129                box = dynamic_cast<PatchCheckBox*>(ChildAt(i++));
    129                 if (box)
     130                if (box != NULL)
    130131                    box->MoveBy(-COLUMN_WIDTH, 0);
    131132            }
    132133            break;
    PatchRow::Connect(int32 consumerID)  
    141142    int32 numChildren = CountChildren();
    142143    for (int32 i = 0; i < numChildren; i++) {
    143144        PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
    144         if (box && box->ConsumerID() == consumerID)
     145        if (box != NULL && box->ConsumerID() == consumerID)
    145146            box->SetValue(1);
    146147    }
    147148}
    PatchRow::Disconnect(int32 consumerID)  
    153154    int32 numChildren = CountChildren();
    154155    for (int32 i = 0; i < numChildren; i++) {
    155156        PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
    156         if (box && box->ConsumerID() == consumerID)
     157        if (box != NULL && box->ConsumerID() == consumerID)
    157158            box->SetValue(0);
    158159    }
    159160}
    PatchRow::AttachedToWindow()  
    167168    int32 numChildren = CountChildren();
    168169    for (int32 i = 0; i < numChildren; i++) {
    169170        PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
    170         if (box)
     171        if (box != NULL)
    171172            box->SetTarget(this);
    172173    }
    173174}
    PatchRow::MessageReceived(BMessage* msg)  
    182183            BControl* ctrl;
    183184            if (msg->FindPointer("source", (void**) &ctrl) == B_OK) {
    184185                PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ctrl);
    185                 if (box)
     186                if (box != NULL)
    186187                    box->DoConnect();
    187188            }
    188189        }
    PatchCheckBox::DoConnect()  
    208209   
    209210    BMidiProducer* producer = roster->FindProducer(fProducerID);
    210211    BMidiConsumer* consumer = roster->FindConsumer(fConsumerID);   
    211     if (producer && consumer) {
     212    if (producer != NULL && consumer != NULL) {
    212213        status_t err;
    213         if (value)
     214        if (value != 0)
    214215            err = producer->Connect(consumer);
    215216        else
    216217            err = producer->Disconnect(consumer);
    PatchCheckBox::DoConnect()  
    221222    } else
    222223        SetValue(inverseValue);
    223224
    224     if (producer) producer->Release();
    225     if (consumer) consumer->Release();
     225    if (producer != NULL)
     226        producer->Release();
     227    if (consumer != NULL)
     228        consumer->Release();
    226229}
  • src/apps/patchbay/PatchRow.h

    diff --git a/src/apps/patchbay/PatchRow.h b/src/apps/patchbay/PatchRow.h
    index 21977b6..2e97076 100644
    a b  
    99 * Copyright 1999, Be Incorporated.   All Rights Reserved.
    1010 * This file may be used under the terms of the Be Sample Code License.
    1111 */
    12 
    13 #ifndef _PatchRow_h
    14 #define _PatchRow_h
     12#ifndef PATCHROW_H
     13#define PATCHROW_H
    1514
    1615#include <View.h>
    1716
    private:  
    4746    MidiEventMeter* fEventMeter;
    4847};
    4948
    50 #endif /* _PatchRow_h */
     49#endif /* PATCHROW_H */
  • src/apps/patchbay/PatchView.cpp

    diff --git a/src/apps/patchbay/PatchView.cpp b/src/apps/patchbay/PatchView.cpp
    index dc0054e..55892f4 100644
    a b  
    2222#include <Messenger.h>
    2323#include <MidiRoster.h>
    2424#include <Window.h>
     25
    2526#include "EndpointInfo.h"
    2627#include "PatchRow.h"
    2728#include "UnknownDeviceIcons.h"
    PatchView::GetToolTipAt(BPoint point, BToolTip** tip)  
    112113
    113114    endpoint_itor itor;
    114115    for (itor = begin; itor != end; itor++, index--)
    115         if (index <= 0) break;
     116        if (index <= 0)
     117            break;
    116118   
    117119    if (itor == end)
    118120        return false;
  • src/apps/patchbay/PatchView.h

    diff --git a/src/apps/patchbay/PatchView.h b/src/apps/patchbay/PatchView.h
    index 3298c5b..15d4cb9 100644
    a b  
    1212 * Copyright 1999, Be Incorporated.   All Rights Reserved.
    1313 * This file may be used under the terms of the Be Sample Code License.
    1414 */
    15  
    16 #ifndef _PatchView_h
    17 #define _PatchView_h
     15#ifndef PATCHVIEW_H
     16#define PATCHVIEW_H
    1817
    1918#include <Rect.h>
    2019#include <View.h>
    2120#include <list>
     21
    2222#include "EndpointInfo.h"
    2323
    2424class PatchRow;
    private:  
    7070    BBitmap* fUnknownDeviceIcon;
    7171};
    7272
    73 #endif /* _PatchView_h */
     73#endif /* PATCHVIEW_H */
  • src/apps/patchbay/PatchWin.cpp

    diff --git a/src/apps/patchbay/PatchWin.cpp b/src/apps/patchbay/PatchWin.cpp
    index 8c45054..0ef0947 100644
    a b  
    1414#include "PatchWin.h"
    1515
    1616#include <Application.h>
     17
    1718#include "PatchView.h"
    1819
    1920
  • src/apps/patchbay/PatchWin.h

    diff --git a/src/apps/patchbay/PatchWin.h b/src/apps/patchbay/PatchWin.h
    index c5659ea..0667d23 100644
    a b  
    1010 * Copyright 1999, Be Incorporated.   All Rights Reserved.
    1111 * This file may be used under the terms of the Be Sample Code License.
    1212 */
    13 
    14 #ifndef _PatchWin_h
    15 #define _PatchWin_h
     13#ifndef PATCHWIN_H
     14#define PATCHWIN_H
    1615
    1716#include <Window.h>
    1817
    private:  
    2726    PatchView* fPatchView;
    2827};
    2928
    30 #endif /* _PatchWin_h */
     29#endif /* PATCHWIN_H */