Ticket #9604: patchbay.diff

File patchbay.diff, 77.1 KB (added by Pete, 11 years ago)

Updates to the original PatchBay app

  • src/tests/kits/midi/patchbay/CountEventConsumer.h

    diff --git a/src/tests/kits/midi/patchbay/CountEventConsumer.h b/src/tests/kits/midi/patchbay/CountEventConsumer.h
    index 553c1e0..d6fe12f 100644
    a b  
    1 // CountEventConsumer.h
    2 // --------------------
    3 // A simple MIDI consumer that counts incoming MIDI events.
    4 //
    5 // Copyright 1999, Be Incorporated.   All Rights Reserved.
    6 // This file may be used under the terms of the Be Sample Code License.
    7 
     1/* CountEventConsumer.h
     2 * --------------------
     3 * A simple MIDI consumer that counts incoming MIDI events.
     4 *
     5 * Copyright 2013, Haiku, Inc. All rights reserved.
     6 * Distributed under the terms of the MIT License.
     7 *
     8 * Revisions by Pete Goodeve
     9 *
     10 * Copyright 1999, Be Incorporated.   All Rights Reserved.
     11 * This file may be used under the terms of the Be Sample Code License.
     12 */
     13 
    814#ifndef _CountEventConsumer_h
    915#define _CountEventConsumer_h
    1016
    class CountEventConsumer : public BMidiLocalConsumer  
    1521{
    1622public:
    1723    CountEventConsumer(const char* name)   
    18         : BMidiLocalConsumer(name), m_eventCount(0)
     24        :
     25        BMidiLocalConsumer(name),
     26        fEventCount(0)
    1927    {}
    20     void Reset() { m_eventCount = 0; }
    21     int32 CountEvents() { return m_eventCount; }
     28    void Reset()
     29    {
     30        fEventCount = 0;
     31    }
     32    int32 CountEvents()
     33    {
     34        return fEventCount;
     35    }
    2236   
    2337    void Data(uchar*, size_t, bool, bigtime_t)
    24     { atomic_add(&m_eventCount, 1); }
     38    {
     39        atomic_add(&fEventCount, 1);
     40    }
    2541   
    2642private:
    27     int32 m_eventCount;
     43    int32 fEventCount;
    2844};
    2945
    3046#endif /* _CountEventConsumer_h */
  • src/tests/kits/midi/patchbay/EndpointInfo.cpp

    diff --git a/src/tests/kits/midi/patchbay/EndpointInfo.cpp b/src/tests/kits/midi/patchbay/EndpointInfo.cpp
    index a4caf5a..4ee9911 100644
    a b  
    1 // EndpointInfo.cpp
    2 // ----------------
    3 // Implements the EndpointInfo object.
    4 //
    5 // Copyright 1999, Be Incorporated.   All Rights Reserved.
    6 // This file may be used under the terms of the Be Sample Code License.
    7 
     1/* EndpointInfo.cpp
     2 * ----------------
     3 * Implements the EndpointInfo object.
     4 *
     5 * Copyright 2013, Haiku, Inc. All rights reserved.
     6 * Distributed under the terms of the MIT License.
     7 *
     8 * Revisions by Pete Goodeve
     9 *
     10 * Copyright 1999, Be Incorporated.   All Rights Reserved.
     11 * This file may be used under the terms of the Be Sample Code License.
     12 */
    813#include "EndpointInfo.h"
    914
    1015#include <Bitmap.h>
     
    1621
    1722const char* LARGE_ICON_NAME = "be:large_icon";
    1823const char* MINI_ICON_NAME = "be:mini_icon";
    19 const char* VECTOR_ICON_NAME = "icon";   
     24const char* VECTOR_ICON_NAME = "icon";
    2025const uint32 LARGE_ICON_TYPE = 'ICON';
    2126const uint32 MINI_ICON_TYPE = 'MICN';
    2227const uint32 VECTOR_ICON_TYPE = 'VICN';
    extern const color_space ICON_COLOR_SPACE = B_CMAP8;  
    2732
    2833static BBitmap* CreateIcon(const BMessage* msg, icon_size which);
    2934
     35
    3036EndpointInfo::EndpointInfo()
    31     : m_id(-1), m_icon(NULL)
     37    :
     38    fId(-1),
     39    fIcon(NULL)
    3240{}
    3341
     42
    3443EndpointInfo::EndpointInfo(int32 id)
    35     : m_id(id), m_icon(NULL)
     44    :
     45    fId(id),
     46    fIcon(NULL)
    3647{
    3748    BMidiRoster* roster = BMidiRoster::MidiRoster();
    3849    if (roster) {
    EndpointInfo::EndpointInfo(int32 id)  
    4152            printf("endpoint %ld = %p\n", id, endpoint);
    4253            BMessage msg;
    4354            if (endpoint->GetProperties(&msg) == B_OK) {
    44                 m_icon = CreateIcon(&msg, DISPLAY_ICON_SIZE);
     55                fIcon = CreateIcon(&msg, DISPLAY_ICON_SIZE);
    4556            }
    4657            endpoint->Release();
    4758        }
    4859    }   
    4960}
    5061
     62
    5163EndpointInfo::EndpointInfo(const EndpointInfo& info)
    52     : m_id(info.m_id)
     64    :
     65    fId(info.fId)
    5366{
    54     m_icon = (info.m_icon) ? new BBitmap(info.m_icon) : NULL;   
     67    fIcon = (info.fIcon) ? new BBitmap(info.fIcon) : NULL; 
    5568}
    5669
    57 EndpointInfo& EndpointInfo::operator=(const EndpointInfo& info)
     70
     71EndpointInfo&
     72EndpointInfo::operator=(const EndpointInfo& info)
    5873{
    5974    if (&info != this) {
    60         m_id = info.m_id;
    61         delete m_icon;
    62         m_icon = (info.m_icon) ? new BBitmap(info.m_icon) : NULL;
     75        fId = info.fId;
     76        delete fIcon;
     77        fIcon = (info.fIcon) ? new BBitmap(info.fIcon) : NULL;
    6378    }
    6479    return *this;
    6580}
    6681
     82
    6783EndpointInfo::~EndpointInfo()
    6884{
    69     delete m_icon;
     85    delete fIcon;
    7086}
    7187
    72 void EndpointInfo::UpdateProperties(const BMessage* props)
     88
     89void
     90EndpointInfo::UpdateProperties(const BMessage* props)
    7391{
    74     delete m_icon;
    75     m_icon = CreateIcon(props, DISPLAY_ICON_SIZE);
     92    delete fIcon;
     93    fIcon = CreateIcon(props, DISPLAY_ICON_SIZE);
    7694}
    7795
    78 static BBitmap* CreateIcon(const BMessage* msg, icon_size which)
     96
     97static BBitmap*
     98CreateIcon(const BMessage* msg, icon_size which)
    7999{
    80     float iconSize;
    81     uint32 iconType;
    82     const char* iconName;
    83    
    84     if (which == B_LARGE_ICON) {
    85         iconSize = LARGE_ICON_SIZE;
    86         iconType = LARGE_ICON_TYPE;
    87         iconName = LARGE_ICON_NAME;
    88     } else if (which == B_MINI_ICON) {
    89         iconSize = MINI_ICON_SIZE;
    90         iconType = MINI_ICON_TYPE;
    91         iconName = MINI_ICON_NAME;
    92     } else {
    93         return NULL;
    94     }
    95                            
     100
    96101    const void* data;
    97102    ssize_t size;
    98103    BBitmap* bitmap = NULL;
    99104
    100 #ifdef __HAIKU__
    101     iconSize = LARGE_ICON_SIZE;
    102    
     105    // See if a Haiku Vector Icon available
    103106    if (msg->FindData(VECTOR_ICON_NAME, VECTOR_ICON_TYPE, &data,
    104107        &size) == B_OK)  {
    105         BRect r(0, 0, iconSize-1, iconSize-1);
     108        BRect r(0, 0, LARGE_ICON_SIZE - 1, LARGE_ICON_SIZE - 1);
    106109        bitmap = new BBitmap(r, B_RGBA32);
    107110        if (BIconUtils::GetVectorIcon((const uint8*)data, size,
    108111            bitmap) == B_OK) {
    static BBitmap* CreateIcon(const BMessage* msg, icon_size which)  
    111114        } else
    112115            delete bitmap;
    113116    }
    114 #endif
    115117
     118    // If not, look for BeOS style icon
     119    float bmapSize;
     120    uint32 iconType;
     121    const char* iconName;
     122   
     123    if (which == B_LARGE_ICON) {
     124        bmapSize = LARGE_ICON_SIZE - 1;
     125        iconType = LARGE_ICON_TYPE;
     126        iconName = LARGE_ICON_NAME;
     127    } else if (which == B_MINI_ICON) {
     128        bmapSize = MINI_ICON_SIZE - 1;
     129        iconType = MINI_ICON_TYPE;
     130        iconName = MINI_ICON_NAME;
     131    } else {
     132        return NULL;
     133    }
     134                           
    116135    if (msg->FindData(iconName, iconType, &data, &size) == B_OK)
    117136    {
    118         BRect r(0, 0, iconSize-1, iconSize-1);
    119         bitmap = new BBitmap(r, ICON_COLOR_SPACE);
     137        ;
     138        bitmap = new BBitmap(BRect(0, 0, bmapSize, bmapSize),
     139            ICON_COLOR_SPACE);
    120140        ASSERT((bitmap->BitsLength() == size));
    121141        memcpy(bitmap->Bits(), data, size);
    122142    }
  • src/tests/kits/midi/patchbay/EndpointInfo.h

    diff --git a/src/tests/kits/midi/patchbay/EndpointInfo.h b/src/tests/kits/midi/patchbay/EndpointInfo.h
    index b75c9a8..92a65dc 100644
    a b  
    1 // EndpointInfo.h
    2 // --------------
    3 // A simple structure that describes a MIDI object.
    4 // Currently, it only contains icon data associated with the object.
    5 //
    6 // Copyright 1999, Be Incorporated.   All Rights Reserved.
    7 // This file may be used under the terms of the Be Sample Code License.
    8 
     1/* EndpointInfo.h
     2 * --------------
     3 * A simple structure that describes a MIDI object.
     4 * Currently, it only contains icon data associated with the object.
     5 *
     6 * Copyright 2013, Haiku, Inc. All rights reserved.
     7 * Distributed under the terms of the MIT License.
     8 *
     9 * Revisions by Pete Goodeve
     10 *
     11 * Copyright 1999, Be Incorporated.   All Rights Reserved.
     12 * This file may be used under the terms of the Be Sample Code License.
     13 */
     14 
    915#ifndef _EndpointInfo_h
    1016#define _EndpointInfo_h
    1117
    public:  
    2834    EndpointInfo& operator=(const EndpointInfo& info);
    2935    ~EndpointInfo();
    3036   
    31     int32 ID() const { return m_id; }
    32     const BBitmap* Icon() const { return m_icon; }
     37    int32 ID() const
     38    {
     39        return fId;
     40    }
     41    const BBitmap* Icon() const
     42    {
     43        return fIcon;
     44    }
    3345    void UpdateProperties(const BMessage* props);
    3446   
    3547private:
    36     int32 m_id;
    37     BBitmap* m_icon;
     48    int32 fId;
     49    BBitmap* fIcon;
    3850};
    3951
    4052#endif /* _EndpointInfo_h */
  • src/tests/kits/midi/patchbay/Jamfile

    diff --git a/src/tests/kits/midi/patchbay/Jamfile b/src/tests/kits/midi/patchbay/Jamfile
    index 7cea736..01b4526 100644
    a b SimpleTest PatchBay  
    1010    PatchRow.cpp
    1111    EndpointInfo.cpp
    1212    MidiEventMeter.cpp
    13     TToolTip.cpp
    1413    :
    1514    midi midi2 be libicon.a $(TARGET_LIBSTDC++)
     15    :
     16    PatchBay.rdef
    1617;
    1718
  • src/tests/kits/midi/patchbay/MidiEventMeter.cpp

    diff --git a/src/tests/kits/midi/patchbay/MidiEventMeter.cpp b/src/tests/kits/midi/patchbay/MidiEventMeter.cpp
    index f625be0..719cf61 100644
    a b  
    1 // MidiEventMeter.cpp
    2 // ------------------
    3 // Implements the MidiEventMeter class.
    4 //
    5 // Copyright 1999, Be Incorporated.   All Rights Reserved.
    6 // This file may be used under the terms of the Be Sample Code License.
    7 
     1/* MidiEventMeter.cpp
     2 * ------------------
     3 * Implements the MidiEventMeter class.
     4 *
     5 * Copyright 2013, Haiku, Inc. All rights reserved.
     6 * Distributed under the terms of the MIT License.
     7 *
     8 * Revisions by Pete Goodeve
     9 *
     10 * Copyright 1999, Be Incorporated.   All Rights Reserved.
     11 * This file may be used under the terms of the Be Sample Code License.
     12 */
     13 
    814#include <stdio.h>
    915#include <MidiRoster.h>
    1016#include <MidiProducer.h>
     
    1319#include "CountEventConsumer.h"
    1420#include "MidiEventMeter.h"
    1521
    16 static const BRect METER_BOUNDS(0,0,7,31);
     22static const BRect METER_BOUNDS(0, 0, 7, 31);
    1723
    1824// If we get this number of events per pulse or greater, we will
    1925// max out the event meter.
    static const BRect METER_BOUNDS(0,0,7,31);  
    2127// keyboard controller with a pulse of 200ms.
    2228static const int32 METER_SCALE = 10;
    2329
     30
    2431MidiEventMeter::MidiEventMeter(int32 producerID)
    25     : m_counter(NULL), m_meterLevel(0)
     32    :
     33    fCounter(NULL),
     34    fMeterLevel(0)
    2635{
    2736    BMidiRoster* roster = BMidiRoster::MidiRoster();
    2837    if (roster) {
    MidiEventMeter::MidiEventMeter(int32 producerID)  
    3039        if (producer) {
    3140            BString name;
    3241            name << producer->Name() << " Event Meter";
    33             m_counter = new CountEventConsumer(name.String());
    34             producer->Connect(m_counter);
     42            fCounter = new CountEventConsumer(name.String());
     43            producer->Connect(fCounter);
    3544            producer->Release();
    3645        }
    3746    }
    3847}
    3948
     49
    4050MidiEventMeter::~MidiEventMeter()
    4151{
    42     if (m_counter) m_counter->Release();
     52    if (fCounter)
     53        fCounter->Release();
    4354}
    4455
    45 void MidiEventMeter::Pulse(BView* view)
     56
     57void
     58MidiEventMeter::Pulse(BView* view)
    4659{
    47     int32 newLevel = m_meterLevel;
    48     if (m_counter) {
    49         newLevel = CalcMeterLevel(m_counter->CountEvents());
    50         m_counter->Reset();
     60    int32 newLevel = fMeterLevel;
     61    if (fCounter) {
     62        newLevel = CalcMeterLevel(fCounter->CountEvents());
     63        fCounter->Reset();
    5164    }
    52     if (newLevel != m_meterLevel) {
    53         m_meterLevel = newLevel;
    54         view->Invalidate(BRect(METER_BOUNDS).InsetBySelf(1,1));
     65    if (newLevel != fMeterLevel) {
     66        fMeterLevel = newLevel;
     67        view->Invalidate(BRect(METER_BOUNDS).InsetBySelf(1, 1));
    5568    }
    5669}
    5770
    58 BRect MidiEventMeter::Bounds() const
     71
     72BRect
     73MidiEventMeter::Bounds() const
    5974{
    6075    return METER_BOUNDS;
    6176}
    6277
    63 void MidiEventMeter::Draw(BView* view)
     78
     79void
     80MidiEventMeter::Draw(BView* view)
    6481{
    6582    const rgb_color METER_BLACK = { 0, 0, 0, 255 };
    6683    const rgb_color METER_GREY = { 180, 180, 180, 255 };
    void MidiEventMeter::Draw(BView* view)  
    8097   
    8198    // draw the cells
    8299    BRect cell = METER_BOUNDS;
    83     cell.InsetBy(1,1);
     100    cell.InsetBy(1, 1);
    84101    cell.bottom = cell.top + (cell.Height() + 1) / 5;
    85102    cell.bottom--;
    86103
    87     const float kTintArray[] = { B_DARKEN_4_TINT, B_DARKEN_3_TINT, B_DARKEN_2_TINT, B_DARKEN_1_TINT, B_NO_TINT };
     104    const float kTintArray[] =
     105        {B_DARKEN_4_TINT,
     106         B_DARKEN_3_TINT,
     107         B_DARKEN_2_TINT,
     108         B_DARKEN_1_TINT,
     109         B_NO_TINT};
    88110   
    89     for (int32 i=4; i>=0; i--)
     111    for (int32 i = 4; i >= 0; i--)
    90112    {
    91113        rgb_color color;
    92         if (m_meterLevel > i) {
     114        if (fMeterLevel > i) {
    93115            color = tint_color(METER_GREEN, kTintArray[i]);
    94116        } else {
    95117            color = METER_GREY;
    void MidiEventMeter::Draw(BView* view)  
    102124    view->PopState();
    103125}
    104126
    105 int32 MidiEventMeter::CalcMeterLevel(int32 eventCount) const
     127
     128int32
     129MidiEventMeter::CalcMeterLevel(int32 eventCount) const
    106130{
    107131    // we use an approximately logarithmic scale for determing the actual
    108132    // drawn meter level, so that low-density event streams show up well.
    109     if (eventCount == 0) {
     133    if (eventCount == 0)
    110134        return 0;
    111     } else if (eventCount < (int32)(.5*METER_SCALE)) {
     135    else if (eventCount < (int32)(0.5 * METER_SCALE))
    112136        return 1;
    113     } else if (eventCount < (int32)(.75*METER_SCALE)) {
     137    else if (eventCount < (int32)(0.75 * METER_SCALE))
    114138        return 2;
    115     } else if (eventCount < (int32)(.9*METER_SCALE)) {
     139    else if (eventCount < (int32)(0.9 * METER_SCALE))
    116140        return 3;
    117     } else if (eventCount < METER_SCALE) {
     141    else if (eventCount < METER_SCALE)
    118142        return 4;
    119     } else {
    120         return 5;
    121     }
     143    return 5;
    122144}
  • src/tests/kits/midi/patchbay/MidiEventMeter.h

    diff --git a/src/tests/kits/midi/patchbay/MidiEventMeter.h b/src/tests/kits/midi/patchbay/MidiEventMeter.h
    index b154d05..5866e6e 100644
    a b  
    1 // MidiEventMeter.h
    2 // ----------------
    3 // A UI widget that measures the amount of MIDI data generated by a
    4 // consumer.
    5 //
    6 // Copyright 1999, Be Incorporated.   All Rights Reserved.
    7 // This file may be used under the terms of the Be Sample Code License.
    8 
     1/* MidiEventMeter.h
     2 * ----------------
     3 * A UI widget that measures the amount of MIDI data generated by a
     4 * consumer.
     5 *
     6 * Copyright 2013, Haiku, Inc. All rights reserved.
     7 * Distributed under the terms of the MIT License.
     8 *
     9 * Revisions by Pete Goodeve
     10 *
     11 * Copyright 1999, Be Incorporated.   All Rights Reserved.
     12 * This file may be used under the terms of the Be Sample Code License.
     13 */
     14 
    915#ifndef _MidiEventMeter_h
    1016#define _MidiEventMeter_h
    1117
    public:  
    2935private:
    3036    int32 CalcMeterLevel(int32 eventCount) const;
    3137   
    32     CountEventConsumer* m_counter;
    33     int32 m_meterLevel;
     38    CountEventConsumer* fCounter;
     39    int32 fMeterLevel;
    3440};
    3541
    3642#endif /* _MidiMeterWidget_h */
  • src/tests/kits/midi/patchbay/PatchApp.cpp

    diff --git a/src/tests/kits/midi/patchbay/PatchApp.cpp b/src/tests/kits/midi/patchbay/PatchApp.cpp
    index ebe42ea..2f693b5 100644
    a b  
    1 // PatchApp.cpp
    2 // ------------
    3 // Implements the PatchBay application class and main().
    4 //
    5 // Copyright 1999, Be Incorporated.   All Rights Reserved.
    6 // This file may be used under the terms of the Be Sample Code License.
     1/* PatchApp.cpp
     2 * ------------
     3 * Implements the PatchBay application class and main().
     4 *
     5 * Copyright 2013, Haiku, Inc. All rights reserved.
     6 * Distributed under the terms of the MIT License.
     7 *
     8 * Revisions by Pete Goodeve
     9 *
     10 * Copyright 1999, Be Incorporated.   All Rights Reserved.
     11 * This file may be used under the terms of the Be Sample Code License.
     12 */
     13 
     14#include "PatchApp.h"
    715
    816#include <Roster.h>
    9 #include "PatchApp.h"
    1017#include "PatchWin.h"
    11 #include "TToolTip.h"
    1218
    1319PatchApp::PatchApp()
    14     : BApplication("application/x-vnd.Be-DTS.PatchBay"), m_toolTip(NULL)
    15 {
    16     m_toolTip = new TToolTip;
    17 }
     20    :
     21    BApplication("application/x-vnd.Be.PatchBay")
     22{}
    1823
    19 void PatchApp::ReadyToRun()
     24
     25void
     26PatchApp::ReadyToRun()
    2027{
    2128    new PatchWin;
    2229}
    2330
    24 void PatchApp::MessageReceived(BMessage* msg)
     31
     32void
     33PatchApp::MessageReceived(BMessage* msg)
    2534{
    26     switch (msg->what) {
    27     case B_SOME_APP_ACTIVATED:
    28     case eToolTipStart:
    29     case eToolTipStop:
    30         if (m_toolTip) m_toolTip->PostMessage(msg);
    31         break; 
    32     default:
    33         BApplication::MessageReceived(msg);
    34         break;
    35     }
     35    BApplication::MessageReceived(msg);
    3636}
    3737
    38 int main()
     38
     39int
     40main(void)
    3941{
    4042    PatchApp app;
    4143    app.Run();
  • src/tests/kits/midi/patchbay/PatchApp.h

    diff --git a/src/tests/kits/midi/patchbay/PatchApp.h b/src/tests/kits/midi/patchbay/PatchApp.h
    index b4537a1..e45f32a 100644
    a b  
    1 // PatchApp.h
    2 // ----------
    3 // The PatchBay application class.
    4 //
    5 // Copyright 1999, Be Incorporated.   All Rights Reserved.
    6 // This file may be used under the terms of the Be Sample Code License.
    7 
     1/* PatchApp.h
     2 * ----------
     3 * The PatchBay application class.
     4 *
     5 * Copyright 2013, Haiku, Inc. All rights reserved.
     6 * Distributed under the terms of the MIT License.
     7 *
     8 * Revisions by Pete Goodeve
     9 *
     10 * Copyright 1999, Be Incorporated.   All Rights Reserved.
     11 * This file may be used under the terms of the Be Sample Code License.
     12 */
     13 
    814#ifndef _PatchApp_h
    915#define _PatchApp_h
    1016
    1117#include <Application.h>
    1218
    13 class TToolTip;
    14 
    1519class PatchApp : public BApplication
    1620{
    1721public:
    1822    PatchApp();
    1923    void ReadyToRun();
    2024    void MessageReceived(BMessage* msg);
    21    
    22 private:
    23     TToolTip* m_toolTip;
    2425};
    2526
    2627#endif /* _PatchApp_h */
  • new file src/tests/kits/midi/patchbay/PatchBay.rdef

    diff --git a/src/tests/kits/midi/patchbay/PatchBay.rdef b/src/tests/kits/midi/patchbay/PatchBay.rdef
    new file mode 100644
    index 0000000..d728b1d
    - +  
     1
     2resource app_signature "application/x-vnd.Be.PatchBay";
     3
     4resource app_version {
     5    major  = 1,
     6    middle = 0,
     7    minor  = 0,
     8
     9    variety = 2,
     10    internal = 0,
     11
     12    short_info = "PatchBay",
     13
     14    long_info = "PatchBay MIDI Port interconnection ©2013 Haiku, Inc."
     15};
     16
     17resource app_flags B_SINGLE_LAUNCH;
     18
     19
     20resource vector_icon {
     21    $"6E636966140401740500020006023C5783372F7CB8EFFB3E28D3482623479BB1"
     22    $"00E1FCF3FF8DDAC0020006023B3049396B0ABA90833C646E4A101543299500E1"
     23    $"FCF3FFB4EEDB02000603395E1E32DB49B6921A3D07D74A57904908D600646464"
     24    $"0678948AFF78948A050102031604BEBE2BBEE9573EE957BEBE2B48B7784A2FD3"
     25    $"0001C670D073FFFF020116033EB0000000000000003EB000470000486000BE4B"
     26    $"0084FF32020316023C4E213D44DABD44DA3C4E214926894A428EA143FFFF0203"
     27    $"1602BC6B27BD2F9C3D2F9CBC6B2748B0FD4A3D7CAB08FFFF0300FF0005010200"
     28    $"1605BF2F31BF38ED3ED85CBECFC4499A0C4B50220001377000716D73FFFF0201"
     29    $"16033EB0000000000000003EB000482000482000BE4B0084FF3202000604BE37"
     30    $"C8B7C456379553BE1C1A4B24CF4C81BE0E0000008F040202FF685B5BFFFFFFFF"
     31    $"02030603BCD4ABBC8A9D3DAD85BE0C574A5F474B05CB8A080808FFC9C4C4FFB2"
     32    $"A7A702000603BA8802BC993B3DD226BBB8D249CA264BD1370008010100FFAA00"
     33    $"FF08010102000603BA51E2B9CF15B97D653A20214B39494A12BA0008010100FF"
     34    $"AA00FF08010102000603390B9BBB2FCAB9D8B1B7AD044A23004B7F9900080101"
     35    $"00FFAA00FF08010102000603B847EDB76620BB18843C13D84A521C4A634F00F9"
     36    $"EED70037290DFFF9EED7090A04455F4F5E5F4E4F460A04272B2750465E46350A"
     37    $"044636465E564E562B0A04272B4636562B38230A06262B2650465F574E572B38"
     38    $"2202043735BEB4BC7430322A3F2ABC962AC21D3551B8D3C56F3C54434743C54D"
     39    $"433E020440304932BC50B89C303D30BB0830C2133F4FBC02C49C48524F444FC4"
     40    $"DD4FBDD20A043A4A3A554459444D060AFEF107BF0048BF00C3A2BF00C3A2BF00"
     41    $"C3A23DC4553DC3A23DC507BF00C507BF00C523BF00C4EB4FBF4DBF4DC507BF4D"
     42    $"C50DBF4DC50140C45540C50740C3A2BF4DC39DBF4DC397BF4DC3A248290A0001"
     43    $"002021210A0101041001178200040A020101000A030103000A040102000A0B01"
     44    $"051001178400040A0F0105123FAFC50000000000003FB0194301D643017D0117"
     45    $"8500040A0E0105123FA0000000000000003FA04841FFFB42FB8801178200040A"
     46    $"0C0105023F77770000000000003F77774244444422220A130107123DB13B0000"
     47    $"000000003E023E455D893B535E01178100040A100107023D60B1B053F32F5F01"
     48    $"3E551D45E7E1C3AE060A11010830172101158000040A120108123F3E45BE5759"
     49    $"3E57593F3E45C90928495A4C01158000040A110108123C90423FCA00BFCA003C"
     50    $"90424AE74EC4752501158000040A120108123C7791BFCE173FCE173C7791C8BD"
     51    $"2F4B800301158000040A110108123EE5493EC273BEC2733EE549490C6EC67EAD"
     52    $"01158000040A0B000237D7012A6354AAA73E38221B486CD349FAFB0A0B010512"
     53    $"BE04150000000000003FAF574BA0103ED0A801178400040A0F010512BDB74D00"
     54    $"00000000003F65BC4B87D043790B01178500040A0E010512BDA7670000000000"
     55    $"003F572A4B8FEF43738E01178200040A0C010502BD7E8C0000000000003F3190"
     56    $"4B8DC94451320A13010712BBB8C50000000000003DB3794B69C93F94BC011781"
     57    $"00040A10010702BB6797B02503AD65E43E26154B6112C2AFA90A11010812BE04"
     58    $"150000000000003FAF574BE8A341400001158000040A12010812BD44E6BE2824"
     59    $"BC5C223EFCE04C31F3492D3701158000040A11010812BA957F3F7D993DD1BE3C"
     60    $"5C914A2972C3D30401158000040A12010812BA7C9BBF815DBDD5DD3C45D24C28"
     61    $"614B44B201158000040A11010812BCEB333E8ACE3CC8163EAAE54ADB66C61F54"
     62    $"01158000040A0B0002B5DED92A332D28ACAA37EE2F4B039E49C13E0A0B010512"
     63    $"BFEE20BBF39CB90B913D07574B9193440B9D01178400040A0F010512BF9F4CBB"
     64    $"A45AB8CEBC3CCAD74B5DB9443E3501178500040A0E010512BF8FCEBB94C6B8C2"
     65    $"B23CBEDE4B5DA144656901178200040A0C010502BF67FABB6CBAB8A39F3C9FF6"
     66    $"4B577B449B340A13010712BDA0BBB9A5CBB70EFB3B0ABC4B177B4292CB011781"
     67    $"00040A10010702BD16C6BAF1F5B934283B45744B2953443BF50A11010812BFE3"
     68    $"13BC4AC7B9885D3CFED34C04CD45CD7C01158000040A12010812BEE4A7BD9C97"
     69    $"BEA2143A2C9E4C64D548B4E801158000040A11010812BD53E43C1A5C3F8A613D"
     70    $"218E46D73DC69FE701158000040A12010812BB1D51BD8E67BFD570BA83684C38"
     71    $"9B49FCC101158000040A11010812BF1E563742033E5CA93DBFED4A15DFC50930"
     72    $"01158000040A0B0002B78654B54AE7B2B098350C6A4A20C547001D"
     73};
  • src/tests/kits/midi/patchbay/PatchRow.cpp

    diff --git a/src/tests/kits/midi/patchbay/PatchBay.rsrc b/src/tests/kits/midi/patchbay/PatchBay.rsrc
    deleted file mode 100644
    index 1fecbba..0000000
    Binary files a/src/tests/kits/midi/patchbay/PatchBay.rsrc and /dev/null differ
    diff --git a/src/tests/kits/midi/patchbay/PatchRow.cpp b/src/tests/kits/midi/patchbay/PatchRow.cpp
    index 5906a29..6dfe353 100644
    a b  
    1 // PatchRow.cpp
    2 // ------------
    3 // Implements the PatchRow class.
    4 //
    5 // Copyright 1999, Be Incorporated.   All Rights Reserved.
    6 // This file may be used under the terms of the Be Sample Code License.
     1/* PatchRow.cpp
     2 * ------------
     3 *
     4 * Copyright 2013, Haiku, Inc. All rights reserved.
     5 * Distributed under the terms of the MIT License.
     6 *
     7 * Revisions by Pete Goodeve
     8 *
     9 * Copyright 1999, Be Incorporated.   All Rights Reserved.
     10 * This file may be used under the terms of the Be Sample Code License.
     11 */
     12 
     13#include "PatchRow.h"
    714
    815#include <stdio.h>
    916#include <CheckBox.h>
     
    1320#include <MidiProducer.h>
    1421#include <Window.h>
    1522#include "MidiEventMeter.h"
    16 #include "PatchRow.h"
    1723
    1824extern const float ROW_LEFT = 50.0f;
    1925extern const float ROW_TOP = 50.0f;
    extern const float COLUMN_WIDTH = 40.0f;  
    2228extern const float METER_PADDING = 15.0f;
    2329extern const uint32 MSG_CONNECT_REQUEST = 'mCRQ';
    2430
    25 static const BPoint kBoxOffset(8,7);
     31static const BPoint kBoxOffset(8, 7);
    2632
    2733// PatchCheckBox is the check box that describes a connection
    2834// between a producer and a consumer.
    class PatchCheckBox : public BCheckBox  
    3036{
    3137public:
    3238    PatchCheckBox(BRect r, int32 producerID, int32 consumerID)
    33         : BCheckBox(r, "", "", new BMessage(MSG_CONNECT_REQUEST))
     39        :
     40        BCheckBox(r, "", "", new BMessage(MSG_CONNECT_REQUEST)),
     41        fProducerID(producerID),
     42        fConsumerID(consumerID)
     43    {}
     44
     45    int32 ProducerID() const
    3446    {
    35         m_producerID = producerID;
    36         m_consumerID = consumerID;
     47        return fProducerID;
     48    }
     49    int32 ConsumerID() const
     50    {
     51        return fConsumerID;
    3752    }
    38 
    39     int32 ProducerID() const { return m_producerID; }
    40     int32 ConsumerID() const { return m_consumerID; }
    4153
    4254    void DoConnect();
    4355   
    4456private:
    45     int32 m_producerID;
    46     int32 m_consumerID;
     57    int32 fProducerID;
     58    int32 fConsumerID;
    4759};
    4860
     61
    4962PatchRow::PatchRow(int32 producerID)
    50     : BView(BRect(0,0,0,0), "PatchRow", B_FOLLOW_NONE,
    51     B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED),
    52     m_producerID(producerID), m_eventMeter(NULL)
     63    :
     64    BView(BRect(0, 0, 0, 0), "PatchRow", B_FOLLOW_NONE,
     65        B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED),
     66    fProducerID(producerID),
     67    fEventMeter(NULL)
    5368{
    54     m_eventMeter = new MidiEventMeter(m_producerID);
     69    fEventMeter = new MidiEventMeter(fProducerID);
    5570}
    5671
     72
    5773PatchRow::~PatchRow()
    5874{
    59     delete m_eventMeter;
     75    delete fEventMeter;
    6076}
    6177
    62 int32 PatchRow::ID() const
     78
     79int32
     80PatchRow::ID() const
    6381{
    64     return m_producerID;
     82    return fProducerID;
    6583}
    6684
    67 void PatchRow::Pulse()
     85
     86void
     87PatchRow::Pulse()
    6888{
    69     if (m_eventMeter) m_eventMeter->Pulse(this);
     89    if (fEventMeter)
     90        fEventMeter->Pulse(this);
    7091}
    7192
    72 void PatchRow::Draw(BRect)
     93
     94void
     95PatchRow::Draw(BRect)
    7396{
    74     if (m_eventMeter) m_eventMeter->Draw(this);
     97    if (fEventMeter)
     98        fEventMeter->Draw(this);
    7599}
    76100
    77 void PatchRow::AddColumn(int32 consumerID)
     101
     102void
     103PatchRow::AddColumn(int32 consumerID)
    78104{
    79     BRect r;
     105    BRect rect;
    80106    int32 numColumns = CountChildren();
    81     r.left = numColumns*COLUMN_WIDTH + METER_PADDING + kBoxOffset.x;
    82     r.top = kBoxOffset.y;
    83     r.right = r.left + 20;
    84     r.bottom = r.top + 20;
     107    rect.left = numColumns * COLUMN_WIDTH + METER_PADDING + kBoxOffset.x;
     108    rect.top = kBoxOffset.y;
     109    rect.right = rect.left + 20;
     110    rect.bottom = rect.top + 20;
    85111   
    86     PatchCheckBox* box = new PatchCheckBox(r, m_producerID, consumerID);
     112    PatchCheckBox* box = new PatchCheckBox(rect, fProducerID, consumerID);
    87113    AddChild(box);
    88114    box->SetTarget(this);
    89115}
    90116
    91 void PatchRow::RemoveColumn(int32 consumerID)
     117
     118void
     119PatchRow::RemoveColumn(int32 consumerID)
    92120{
    93121    int32 numChildren = CountChildren();
    94     for (int32 i=0; i<numChildren; i++) {
     122    for (int32 i = 0; i < numChildren; i++) {
    95123        PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
    96124        if (box && box->ConsumerID() == consumerID) {
    97125            RemoveChild(box);
    98126            delete box;
    99127            while (i < numChildren) {
    100128                box = dynamic_cast<PatchCheckBox*>(ChildAt(i++));
    101                 if (box) {
     129                if (box)
    102130                    box->MoveBy(-COLUMN_WIDTH, 0);
    103                 }
    104131            }
    105132            break;
    106133        }
    107134    }
    108135}
    109136
    110 void PatchRow::Connect(int32 consumerID)
     137
     138void
     139PatchRow::Connect(int32 consumerID)
    111140{
    112141    int32 numChildren = CountChildren();
    113     for (int32 i=0; i<numChildren; i++) {
     142    for (int32 i = 0; i < numChildren; i++) {
    114143        PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
    115         if (box && box->ConsumerID() == consumerID) {
     144        if (box && box->ConsumerID() == consumerID)
    116145            box->SetValue(1);
    117         }
    118146    }
    119147}
    120148
    121 void PatchRow::Disconnect(int32 consumerID)
     149
     150void
     151PatchRow::Disconnect(int32 consumerID)
    122152{
    123153    int32 numChildren = CountChildren();
    124     for (int32 i=0; i<numChildren; i++) {
     154    for (int32 i = 0; i < numChildren; i++) {
    125155        PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
    126         if (box && box->ConsumerID() == consumerID) {
     156        if (box && box->ConsumerID() == consumerID)
    127157            box->SetValue(0);
    128         }
    129158    }
    130159}
    131160
    132 void PatchRow::AttachedToWindow()
     161
     162void
     163PatchRow::AttachedToWindow()
    133164{
    134165    Window()->SetPulseRate(200000);
    135166    SetViewColor(Parent()->ViewColor());
    136167    int32 numChildren = CountChildren();
    137     for (int32 i=0; i<numChildren; i++) {
     168    for (int32 i = 0; i < numChildren; i++) {
    138169        PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i));
    139         if (box) {
     170        if (box)
    140171            box->SetTarget(this);
    141         }
    142172    }
    143173}
    144174
    145 void PatchRow::MessageReceived(BMessage* msg)
     175
     176void
     177PatchRow::MessageReceived(BMessage* msg)
    146178{
    147179    switch (msg->what) {
    148180    case MSG_CONNECT_REQUEST:
    void PatchRow::MessageReceived(BMessage* msg)  
    150182            BControl* ctrl;
    151183            if (msg->FindPointer("source", (void**) &ctrl) == B_OK) {
    152184                PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ctrl);
    153                 if (box) {
     185                if (box)
    154186                    box->DoConnect();
    155                 }
    156187            }
    157188        }
    158189        break;
    void PatchRow::MessageReceived(BMessage* msg)  
    162193    }
    163194}
    164195
    165 void PatchCheckBox::DoConnect()
     196
     197void
     198PatchCheckBox::DoConnect()
    166199{
    167200    int32 value = Value();
    168201    int32 inverseValue = (value + 1) % 2;
    169202
    170203    BMidiRoster* roster = BMidiRoster::MidiRoster();
    171     if (! roster) {
     204    if (roster == NULL) {
    172205        SetValue(inverseValue);
    173206        return;
    174207    }
    175208   
    176     BMidiProducer* producer = roster->FindProducer(m_producerID);
    177     BMidiConsumer* consumer = roster->FindConsumer(m_consumerID);   
     209    BMidiProducer* producer = roster->FindProducer(fProducerID);
     210    BMidiConsumer* consumer = roster->FindConsumer(fConsumerID);   
    178211    if (producer && consumer) {
    179212        status_t err;
    180         if (value) {
     213        if (value)
    181214            err = producer->Connect(consumer);
    182         } else {
     215        else
    183216            err = producer->Disconnect(consumer);
    184         }
    185217       
    186218        if (err != B_OK) {
    187219            SetValue(inverseValue);
    188220        }
    189     } else {
     221    } else
    190222        SetValue(inverseValue);
    191     }
     223
    192224    if (producer) producer->Release();
    193225    if (consumer) consumer->Release();
    194226}
  • src/tests/kits/midi/patchbay/PatchRow.h

    diff --git a/src/tests/kits/midi/patchbay/PatchRow.h b/src/tests/kits/midi/patchbay/PatchRow.h
    index a534313..21977b6 100644
    a b  
     1/* PatchRow.h
     2 * ----------
     3 *
     4 * Copyright 2013, Haiku, Inc. All rights reserved.
     5 * Distributed under the terms of the MIT License.
     6 *
     7 * Revisions by Pete Goodeve
     8 *
     9 * Copyright 1999, Be Incorporated.   All Rights Reserved.
     10 * This file may be used under the terms of the Be Sample Code License.
     11 */
     12
    113#ifndef _PatchRow_h
    214#define _PatchRow_h
    315
    public:  
    3143    void Disconnect(int32 consumerID);
    3244
    3345private:
    34     int32 m_producerID;
    35     MidiEventMeter* m_eventMeter;
     46    int32 fProducerID;
     47    MidiEventMeter* fEventMeter;
    3648};
    3749
    3850#endif /* _PatchRow_h */
  • src/tests/kits/midi/patchbay/PatchView.cpp

    diff --git a/src/tests/kits/midi/patchbay/PatchView.cpp b/src/tests/kits/midi/patchbay/PatchView.cpp
    index 8235577..dc0054e 100644
    a b  
    1 // PatchView.cpp
    2 // -------------
    3 // Implements the main PatchBay view class.
    4 //
    5 // Copyright 1999, Be Incorporated.   All Rights Reserved.
    6 // This file may be used under the terms of the Be Sample Code License.
     1/* PatchView.cpp
     2 * -------------
     3 * Implements the main PatchBay view class.
     4 *
     5 * Copyright 2013, Haiku, Inc. All rights reserved.
     6 * Distributed under the terms of the MIT License.
     7 *
     8 * Revisions by Pete Goodeve
     9 *
     10 * Copyright 1999, Be Incorporated.   All Rights Reserved.
     11 * This file may be used under the terms of the Be Sample Code License.
     12 */
     13 
     14#include "PatchView.h"
    715
    816#include <Application.h>
    917#include <Bitmap.h>
    1018#include <Debug.h>
     19#include <IconUtils.h>
    1120#include <InterfaceDefs.h>
    1221#include <Message.h>
    1322#include <Messenger.h>
    1423#include <MidiRoster.h>
    1524#include <Window.h>
    1625#include "EndpointInfo.h"
    17 #include "PatchView.h"
    1826#include "PatchRow.h"
    19 #include "TToolTip.h"
    2027#include "UnknownDeviceIcons.h"
    2128
    22 PatchView::PatchView(BRect r)
    23     : BView(r, "PatchView", B_FOLLOW_ALL, B_WILL_DRAW),
    24     m_unknownDeviceIcon(NULL), m_trackIndex(-1), m_trackType(TRACK_COLUMN)
     29
     30PatchView::PatchView(BRect rect)
     31    :
     32    BView(rect, "PatchView", B_FOLLOW_ALL, B_WILL_DRAW),
     33    fUnknownDeviceIcon(NULL)
    2534{
    2635    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    27    
    28     uint8 iconSize;
    29     const uint8* iconData;
    30    
    31     if (DISPLAY_ICON_SIZE == B_LARGE_ICON) {
    32         iconSize = LARGE_ICON_SIZE;
    33         iconData = UnknownDevice::kLargeIconBits;
    34     } else {
    35         iconSize = MINI_ICON_SIZE;
    36         iconData = UnknownDevice::kMiniIconBits;
    37     }
    38    
    39     BRect iconFrame(0, 0, iconSize-1, iconSize-1);
    40     m_unknownDeviceIcon = new BBitmap(iconFrame, ICON_COLOR_SPACE);
    41     memcpy(m_unknownDeviceIcon->Bits(), iconData, m_unknownDeviceIcon->BitsLength());   
     36
     37    BRect iconRect(0, 0, LARGE_ICON_SIZE - 1, LARGE_ICON_SIZE - 1);
     38    fUnknownDeviceIcon = new BBitmap(iconRect, B_RGBA32);
     39    if (BIconUtils::GetVectorIcon(
     40            UnknownDevice::kVectorIcon,
     41            sizeof(UnknownDevice::kVectorIcon),
     42            fUnknownDeviceIcon) == B_OK)
     43        return;
     44    delete fUnknownDeviceIcon;
    4245}
    4346
     47
    4448PatchView::~PatchView()
    4549{
    46     delete m_unknownDeviceIcon;
     50    delete fUnknownDeviceIcon;
    4751}
    4852
    49 void PatchView::AttachedToWindow()
     53
     54void
     55PatchView::AttachedToWindow()
    5056{
    5157    BMidiRoster* roster = BMidiRoster::MidiRoster();
    52     if (! roster) {
     58    if (roster == NULL) {
    5359        PRINT(("Couldn't get MIDI roster\n"));
    5460        be_app->PostMessage(B_QUIT_REQUESTED);
    5561        return;
    void PatchView::AttachedToWindow()  
    5965    roster->StartWatching(&msgr);
    6066}
    6167
    62 void PatchView::MessageReceived(BMessage* msg)
     68
     69void
     70PatchView::MessageReceived(BMessage* msg)
    6371{
    6472    switch (msg->what) {
    6573    case B_MIDI_EVENT:
    void PatchView::MessageReceived(BMessage* msg)  
    7179    }
    7280}
    7381
    74 void PatchView::MouseMoved(BPoint pt, uint32 transit, const BMessage* /* dragMsg */)
     82
     83bool
     84PatchView::GetToolTipAt(BPoint point, BToolTip** tip)
    7585{
    76     if (transit == B_EXITED_VIEW || transit == B_OUTSIDE_VIEW) {
    77         StopTipTracking();
    78         return;
    79     }   
    80    
    8186    bool found = false;
    82     int32 size = m_consumers.size();
    83     for (int32 i=0; (! found) && i<size; i++) {
     87    int32 index = 0;
     88    endpoint_itor begin, end;
     89    int32 size = fConsumers.size();
     90    for (int32 i = 0; !found && i < size; i++) {
    8491        BRect r = ColumnIconFrameAt(i);
    85         if (r.Contains(pt)) {
    86             StartTipTracking(pt, r, i, TRACK_COLUMN);
     92        if (r.Contains(point)) {
     93            begin = fConsumers.begin();
     94            end = fConsumers.end();
    8795            found = true;
     96            index = i;
    8897        }
    8998    }
    90     size = m_producers.size();
    91     for (int32 i=0; (! found) && i<size; i++) {
     99    size = fProducers.size();
     100    for (int32 i = 0; !found && i < size; i++) {
    92101        BRect r = RowIconFrameAt(i);
    93         if (r.Contains(pt)) {
    94             StartTipTracking(pt, r, i, TRACK_ROW);
     102        if (r.Contains(point)) {
     103            begin = fProducers.begin();
     104            end = fProducers.end();
    95105            found = true;
     106            index = i;
    96107        }
    97108    }
    98 }
    99 
    100 void PatchView::StopTipTracking()
    101 {
    102     m_trackIndex = -1;
    103     m_trackType = TRACK_COLUMN;
    104     StopTip();
    105 }
    106 
    107 void PatchView::StartTipTracking(BPoint pt, BRect rect, int32 index, track_type type)
    108 {   
    109     if (index == m_trackIndex && type == m_trackType)
    110         return;
    111        
    112     StopTip();
    113     m_trackIndex = index;
    114     m_trackType = type;
    115    
    116     endpoint_itor begin, end;
    117     if (type == TRACK_COLUMN) {
    118         begin = m_consumers.begin();
    119         end = m_consumers.end();
    120     } else {
    121         begin = m_producers.begin();
    122         end = m_producers.end();
    123     }
    124109   
    125     endpoint_itor i;
    126     for (i = begin; i != end; i++, index--)
     110    if (!found)
     111        return false;
     112
     113    endpoint_itor itor;
     114    for (itor = begin; itor != end; itor++, index--)
    127115        if (index <= 0) break;
    128116   
    129     if (i == end)
    130         return;
    131            
     117    if (itor == end)
     118        return false;
     119
    132120    BMidiRoster* roster = BMidiRoster::MidiRoster();
    133     if (! roster)
    134         return;
    135     BMidiEndpoint* obj = roster->FindEndpoint(i->ID());
    136     if (! obj)
    137         return;
     121    if (roster == NULL)
     122        return false;
     123    BMidiEndpoint* obj = roster->FindEndpoint(itor->ID());
     124    if (obj == NULL)
     125        return false;
    138126
    139127    BString str;
    140128    str << "<" << obj->ID() << ">: " << obj->Name();
    141129    obj->Release();
    142     StartTip(pt, rect, str.String());
    143 }
    144130
    145 void PatchView::StartTip(BPoint pt, BRect rect, const char* str)
    146 {
    147     BMessage msg(eToolTipStart);
    148     msg.AddPoint("start", ConvertToScreen(pt));
    149     msg.AddRect("bounds", ConvertToScreen(rect));
    150     msg.AddString("string", str);
    151     be_app->PostMessage(&msg);
    152 }
     131    SetToolTip(str.String());
    153132
    154 void PatchView::StopTip()
    155 {
    156     be_app->PostMessage(eToolTipStop);
     133    *tip = ToolTip();
     134
     135    return true;
    157136}
    158137
    159 void PatchView::Draw(BRect /* updateRect */)
     138
     139void
     140PatchView::Draw(BRect /* updateRect */)
    160141{
    161142    // draw producer icons
    162143    SetDrawingMode(B_OP_OVER);
    163144    int32 index = 0;
    164     for (list<EndpointInfo>::const_iterator i = m_producers.begin(); i != m_producers.end(); i++) {
    165         const BBitmap* bitmap = (i->Icon()) ? i->Icon() : m_unknownDeviceIcon;
    166         DrawBitmapAsync(bitmap, RowIconFrameAt(index++).LeftTop());
     145    for (list<EndpointInfo>::const_iterator i = fProducers.begin();
     146        i != fProducers.end(); i++) {
     147            const BBitmap* bitmap = (i->Icon()) ? i->Icon() : fUnknownDeviceIcon;
     148            DrawBitmapAsync(bitmap, RowIconFrameAt(index++).LeftTop());
    167149    }
    168150           
    169151    // draw consumer icons
    170152    index = 0;
    171     for (list<EndpointInfo>::const_iterator i = m_consumers.begin(); i != m_consumers.end(); i++) {
    172         const BBitmap* bitmap = (i->Icon()) ? i->Icon() : m_unknownDeviceIcon;
    173         DrawBitmapAsync(bitmap, ColumnIconFrameAt(index++).LeftTop());
     153    for (list<EndpointInfo>::const_iterator i = fConsumers.begin();
     154        i != fConsumers.end(); i++) {
     155            const BBitmap* bitmap = (i->Icon()) ? i->Icon() : fUnknownDeviceIcon;
     156            DrawBitmapAsync(bitmap, ColumnIconFrameAt(index++).LeftTop());
    174157    }
    175158}
    176159
    177 BRect PatchView::ColumnIconFrameAt(int32 index) const
     160
     161BRect
     162PatchView::ColumnIconFrameAt(int32 index) const
    178163{
    179     BRect r;
    180     r.left = ROW_LEFT + METER_PADDING + index*COLUMN_WIDTH;
    181     r.top = 10;
    182     r.right = r.left + 31;
    183     r.bottom = r.top + 31;
    184     return r;
     164    BRect rect;
     165    rect.left = ROW_LEFT + METER_PADDING + index * COLUMN_WIDTH;
     166    rect.top = 10;
     167    rect.right = rect.left + 31;
     168    rect.bottom = rect.top + 31;
     169    return rect;
    185170}
    186171
    187 BRect PatchView::RowIconFrameAt(int32 index) const
     172
     173BRect
     174PatchView::RowIconFrameAt(int32 index) const
    188175{
    189     BRect r;
    190     r.left = 10;
    191     r.top = ROW_TOP + index*ROW_HEIGHT;
    192     r.right = r.left + 31;
    193     r.bottom = r.top + 31;
    194     return r;
     176    BRect rect;
     177    rect.left = 10;
     178    rect.top = ROW_TOP + index * ROW_HEIGHT;
     179    rect.right = rect.left + 31;
     180    rect.bottom = rect.top + 31;
     181    return rect;
    195182}
    196183
    197 void PatchView::HandleMidiEvent(BMessage* msg)
     184
     185void
     186PatchView::HandleMidiEvent(BMessage* msg)
    198187{
    199188    SET_DEBUG_ENABLED(true);
    200189   
    void PatchView::HandleMidiEvent(BMessage* msg)  
    209198        {
    210199            int32 id;
    211200            if (msg->FindInt32("be:id", &id) != B_OK) {
    212                 PRINT(("PatchView::HandleMidiEvent: \"be:id\" field not found in B_MIDI_REGISTERED event\n"));
     201                PRINT(("PatchView::HandleMidiEvent: \"be:id\""
     202                    " field not found in B_MIDI_REGISTERED event\n"));
    213203                break;
    214204            }
    215205           
    216206            const char* type;
    217207            if (msg->FindString("be:type", &type) != B_OK) {
    218                 PRINT(("PatchView::HandleMidiEvent: \"be:type\" field not found in B_MIDI_REGISTERED event\n"));
     208                PRINT(("PatchView::HandleMidiEvent: \"be:type\""
     209                    " field not found in B_MIDI_REGISTERED event\n"));
    219210                break;
    220211            }
    221212           
    222             PRINT(("MIDI Roster Event B_MIDI_REGISTERED: id=%ld, type=%s\n", id, type));
    223             if (! strcmp(type, "producer")) {
     213            PRINT(("MIDI Roster Event B_MIDI_REGISTERED: id=%ld, type=%s\n",
     214                id, type));
     215            if (strcmp(type, "producer") == 0)
    224216                AddProducer(id);
    225             } else if (! strcmp(type, "consumer")) {
     217            else if (strcmp(type, "consumer") == 0)
    226218                AddConsumer(id);
    227             }
    228219        }
    229220        break;
    230221    case B_MIDI_UNREGISTERED:
    231222        {
    232223            int32 id;
    233224            if (msg->FindInt32("be:id", &id) != B_OK) {
    234                 PRINT(("PatchView::HandleMidiEvent: \"be:id\" field not found in B_MIDI_UNREGISTERED\n"));
     225                PRINT(("PatchView::HandleMidiEvent: \"be:id\""
     226                    " field not found in B_MIDI_UNREGISTERED\n"));
    235227                break;
    236228            }
    237229           
    238230            const char* type;
    239231            if (msg->FindString("be:type", &type) != B_OK) {
    240                 PRINT(("PatchView::HandleMidiEvent: \"be:type\" field not found in B_MIDI_UNREGISTERED\n"));
     232                PRINT(("PatchView::HandleMidiEvent: \"be:type\""
     233                    " field not found in B_MIDI_UNREGISTERED\n"));
    241234                break;
    242235            }
    243236           
    244             PRINT(("MIDI Roster Event B_MIDI_UNREGISTERED: id=%ld, type=%s\n", id, type));
    245             if (! strcmp(type, "producer")) {
     237            PRINT(("MIDI Roster Event B_MIDI_UNREGISTERED: id=%ld, type=%s\n",
     238                id, type));
     239            if (strcmp(type, "producer") == 0)
    246240                RemoveProducer(id);
    247             } else if (! strcmp(type, "consumer")) {
     241            else if (strcmp(type, "consumer") == 0)
    248242                RemoveConsumer(id);
    249             }
    250243        }
    251244        break;
    252245    case B_MIDI_CHANGED_PROPERTIES:
    253246        {
    254247            int32 id;
    255248            if (msg->FindInt32("be:id", &id) != B_OK) {
    256                 PRINT(("PatchView::HandleMidiEvent: \"be:id\" field not found in B_MIDI_CHANGED_PROPERTIES\n"));
     249                PRINT(("PatchView::HandleMidiEvent: \"be:id\""
     250                    " field not found in B_MIDI_CHANGED_PROPERTIES\n"));
    257251                break;
    258252            }
    259253           
    260254            const char* type;
    261255            if (msg->FindString("be:type", &type) != B_OK) {
    262                 PRINT(("PatchView::HandleMidiEvent: \"be:type\" field not found in B_MIDI_CHANGED_PROPERTIES\n"));
     256                PRINT(("PatchView::HandleMidiEvent: \"be:type\""
     257                    " field not found in B_MIDI_CHANGED_PROPERTIES\n"));
    263258                break;
    264259            }
    265260           
    266261            BMessage props;
    267262            if (msg->FindMessage("be:properties", &props) != B_OK) {
    268                 PRINT(("PatchView::HandleMidiEvent: \"be:properties\" field not found in B_MIDI_CHANGED_PROPERTIES\n"));
     263                PRINT(("PatchView::HandleMidiEvent: \"be:properties\""
     264                    " field not found in B_MIDI_CHANGED_PROPERTIES\n"));
    269265                break;
    270266            }
    271267           
    272             PRINT(("MIDI Roster Event B_MIDI_CHANGED_PROPERTIES: id=%ld, type=%s\n", id, type));
    273             if (! strcmp(type, "producer")) {
     268            PRINT(("MIDI Roster Event B_MIDI_CHANGED_PROPERTIES: id=%ld, type=%s\n",
     269                id, type));
     270            if (strcmp(type, "producer") == 0)
    274271                UpdateProducerProps(id, &props);
    275             } else if (! strcmp(type, "consumer")) {
     272            else if (strcmp(type, "consumer") == 0)
    276273                UpdateConsumerProps(id, &props);
    277             }
    278274           
    279275        }
    280276        break;
    void PatchView::HandleMidiEvent(BMessage* msg)  
    286282        {
    287283            int32 prod;
    288284            if (msg->FindInt32("be:producer", &prod) != B_OK) {
    289                 PRINT(("PatchView::HandleMidiEvent: \"be:producer\" field not found in B_MIDI_CONNECTED\n"));
     285                PRINT(("PatchView::HandleMidiEvent: \"be:producer\""
     286                    " field not found in B_MIDI_CONNECTED\n"));
    290287                break;
    291288            }
    292289           
    293290            int32 cons;
    294291            if (msg->FindInt32("be:consumer", &cons) != B_OK) {
    295                 PRINT(("PatchView::HandleMidiEvent: \"be:consumer\" field not found in B_MIDI_CONNECTED\n"));
     292                PRINT(("PatchView::HandleMidiEvent: \"be:consumer\""
     293                    " field not found in B_MIDI_CONNECTED\n"));
    296294                break;
    297295            }
    298             PRINT(("MIDI Roster Event B_MIDI_CONNECTED: producer=%ld, consumer=%ld\n", prod, cons));
     296            PRINT(("MIDI Roster Event B_MIDI_CONNECTED: producer=%ld, consumer=%ld\n",
     297                prod, cons));
    299298            Connect(prod, cons);
    300299        }
    301300        break;
    void PatchView::HandleMidiEvent(BMessage* msg)  
    303302        {
    304303            int32 prod;
    305304            if (msg->FindInt32("be:producer", &prod) != B_OK) {
    306                 PRINT(("PatchView::HandleMidiEvent: \"be:producer\" field not found in B_MIDI_DISCONNECTED\n"));
     305                PRINT(("PatchView::HandleMidiEvent: \"be:producer\""
     306                    " field not found in B_MIDI_DISCONNECTED\n"));
    307307                break;
    308308            }
    309309           
    310310            int32 cons;
    311311            if (msg->FindInt32("be:consumer", &cons) != B_OK) {
    312                 PRINT(("PatchView::HandleMidiEvent: \"be:consumer\" field not found in B_MIDI_DISCONNECTED\n"));
     312                PRINT(("PatchView::HandleMidiEvent: \"be:consumer\""
     313                    " field not found in B_MIDI_DISCONNECTED\n"));
    313314                break;
    314315            }
    315             PRINT(("MIDI Roster Event B_MIDI_DISCONNECTED: producer=%ld, consumer=%ld\n", prod, cons));
     316            PRINT(("MIDI Roster Event B_MIDI_DISCONNECTED: producer=%ld, consumer=%ld\n",
     317                prod, cons));
    316318            Disconnect(prod, cons);
    317319        }
    318320        break;
    void PatchView::HandleMidiEvent(BMessage* msg)  
    322324    }
    323325}
    324326
    325 void PatchView::AddProducer(int32 id)
     327
     328void
     329PatchView::AddProducer(int32 id)
    326330{
    327331    EndpointInfo info(id);
    328     m_producers.push_back(info);
     332    fProducers.push_back(info);
    329333   
    330334    Window()->BeginViewTransaction();
    331335    PatchRow* row = new PatchRow(id);
    332     m_patchRows.push_back(row);
    333     BPoint p1 = CalcRowOrigin(m_patchRows.size() - 1);
     336    fPatchRows.push_back(row); 
     337    BPoint p1 = CalcRowOrigin(fPatchRows.size() - 1);
    334338    BPoint p2 = CalcRowSize();
    335339    row->MoveTo(p1);
    336340    row->ResizeTo(p2.x, p2.y);
    337     for (list<EndpointInfo>::const_iterator i = m_consumers.begin(); i != m_consumers.end(); i++) {
    338         row->AddColumn(i->ID());
    339     }
     341    for (list<EndpointInfo>::const_iterator i = fConsumers.begin();
     342        i != fConsumers.end(); i++)
     343            row->AddColumn(i->ID());
    340344    AddChild(row);
    341345    Invalidate();
    342346    Window()->EndViewTransaction();
    343347}
    344348
    345 void PatchView::AddConsumer(int32 id)
     349
     350void
     351PatchView::AddConsumer(int32 id)
    346352{
    347353    EndpointInfo info(id);
    348     m_consumers.push_back(info);
     354    fConsumers.push_back(info);
    349355   
    350356    Window()->BeginViewTransaction();
    351357    BPoint newSize = CalcRowSize();
    352     for (row_itor i = m_patchRows.begin(); i != m_patchRows.end(); i++) {
     358    for (row_itor i = fPatchRows.begin(); i != fPatchRows.end(); i++) {
    353359        (*i)->AddColumn(id);
    354360        (*i)->ResizeTo(newSize.x, newSize.y - 1);
    355361    }
    void PatchView::AddConsumer(int32 id)  
    357363    Window()->EndViewTransaction();
    358364}
    359365
    360 void PatchView::RemoveProducer(int32 id)
     366
     367void
     368PatchView::RemoveProducer(int32 id)
    361369{
    362     for (endpoint_itor i = m_producers.begin(); i != m_producers.end(); i++) {
     370    for (endpoint_itor i = fProducers.begin(); i != fProducers.end(); i++) {
    363371        if (i->ID() == id) {
    364             m_producers.erase(i);
     372            fProducers.erase(i);
    365373            break;
    366374        }
    367375    }
    368376
    369377    Window()->BeginViewTransaction();
    370     for (row_itor i = m_patchRows.begin(); i != m_patchRows.end(); i++) {
     378    for (row_itor i = fPatchRows.begin(); i != fPatchRows.end(); i++) {
    371379        if ((*i)->ID() == id) {
    372380            PatchRow* row = *i;
    373             i = m_patchRows.erase(i);
     381            i = fPatchRows.erase(i);
    374382            RemoveChild(row);
    375383            delete row;
    376             float moveBy = -1*CalcRowSize().y;
    377             while (i != m_patchRows.end()) {
     384            float moveBy = -1 * CalcRowSize().y;
     385            while (i != fPatchRows.end()) {
    378386                (*i++)->MoveBy(0, moveBy);
    379387            }
    380388            break;
    void PatchView::RemoveProducer(int32 id)  
    384392    Window()->EndViewTransaction();
    385393}
    386394
    387 void PatchView::RemoveConsumer(int32 id)
     395
     396void
     397PatchView::RemoveConsumer(int32 id)
    388398{
    389399    Window()->BeginViewTransaction();
    390     for (endpoint_itor i = m_consumers.begin(); i != m_consumers.end(); i++) {
     400    for (endpoint_itor i = fConsumers.begin(); i != fConsumers.end(); i++) {
    391401        if (i->ID() == id) {
    392             m_consumers.erase(i);
     402            fConsumers.erase(i);
    393403            break;
    394404        }
    395405    }
    396406
    397407    BPoint newSize = CalcRowSize();
    398     for (row_itor i = m_patchRows.begin(); i != m_patchRows.end(); i++) {
     408    for (row_itor i = fPatchRows.begin(); i != fPatchRows.end(); i++) {
    399409        (*i)->RemoveColumn(id);
    400410        (*i)->ResizeTo(newSize.x, newSize.y - 1);
    401411    }
    void PatchView::RemoveConsumer(int32 id)  
    403413    Window()->EndViewTransaction();
    404414}
    405415
    406 void PatchView::UpdateProducerProps(int32 id, const BMessage* props)
     416
     417void
     418PatchView::UpdateProducerProps(int32 id, const BMessage* props)
    407419{
    408     for (endpoint_itor i = m_producers.begin(); i != m_producers.end(); i++) {
     420    for (endpoint_itor i = fProducers.begin(); i != fProducers.end(); i++) {
    409421        if (i->ID() == id) {
    410422            i->UpdateProperties(props);
    411423            Invalidate();
    void PatchView::UpdateProducerProps(int32 id, const BMessage* props)  
    414426    }
    415427}
    416428
    417 void PatchView::UpdateConsumerProps(int32 id, const BMessage* props)
     429
     430void
     431PatchView::UpdateConsumerProps(int32 id, const BMessage* props)
    418432{
    419     for (endpoint_itor i = m_consumers.begin(); i != m_consumers.end(); i++) {
     433    for (endpoint_itor i = fConsumers.begin(); i != fConsumers.end(); i++) {
    420434        if (i->ID() == id) {
    421435            i->UpdateProperties(props);
    422436            Invalidate();
    void PatchView::UpdateConsumerProps(int32 id, const BMessage* props)  
    425439    }
    426440}
    427441
    428 void PatchView::Connect(int32 prod, int32 cons)
     442
     443void
     444PatchView::Connect(int32 prod, int32 cons)
    429445{
    430     for (row_itor i = m_patchRows.begin(); i != m_patchRows.end(); i++) {
     446    for (row_itor i = fPatchRows.begin(); i != fPatchRows.end(); i++) {
    431447        if ((*i)->ID() == prod) {
    432448            (*i)->Connect(cons);
    433449            break;
    void PatchView::Connect(int32 prod, int32 cons)  
    435451    }
    436452}
    437453
    438 void PatchView::Disconnect(int32 prod, int32 cons)
     454
     455void
     456PatchView::Disconnect(int32 prod, int32 cons)
    439457{
    440     for (row_itor i = m_patchRows.begin(); i != m_patchRows.end(); i++) {
     458    for (row_itor i = fPatchRows.begin(); i != fPatchRows.end(); i++) {
    441459        if ((*i)->ID() == prod) {
    442460            (*i)->Disconnect(cons);
    443461            break;
    void PatchView::Disconnect(int32 prod, int32 cons)  
    445463    }
    446464}
    447465
    448 BPoint PatchView::CalcRowOrigin(int32 rowIndex) const
     466
     467BPoint
     468PatchView::CalcRowOrigin(int32 rowIndex) const
    449469{
    450     BPoint pt;
    451     pt.x = ROW_LEFT;
    452     pt.y = ROW_TOP + rowIndex*ROW_HEIGHT;
    453     return pt;
     470    BPoint point;
     471    point.x = ROW_LEFT;
     472    point.y = ROW_TOP + rowIndex * ROW_HEIGHT;
     473    return point;
    454474}
    455475
    456 BPoint PatchView::CalcRowSize() const
     476
     477BPoint
     478PatchView::CalcRowSize() const
    457479{
    458     BPoint pt;
    459     pt.x = METER_PADDING + m_consumers.size()*COLUMN_WIDTH;
    460     pt.y = ROW_HEIGHT - 1;
    461     return pt;
     480    BPoint point;
     481    point.x = METER_PADDING + fConsumers.size()*COLUMN_WIDTH;
     482    point.y = ROW_HEIGHT - 1;
     483    return point;
    462484}
  • src/tests/kits/midi/patchbay/PatchView.h

    diff --git a/src/tests/kits/midi/patchbay/PatchView.h b/src/tests/kits/midi/patchbay/PatchView.h
    index 9b36d55..3298c5b 100644
    a b  
    1 // PatchView.h
    2 // -----------
    3 // The main PatchBay view contains a row of icons along the top and
    4 // left sides representing available consumers and producers, and
    5 // a set of PatchRows which build the matrix of connections.
    6 //
    7 // Copyright 1999, Be Incorporated.   All Rights Reserved.
    8 // This file may be used under the terms of the Be Sample Code License.
    9 
     1/* PatchView.h
     2 * -----------
     3 * The main PatchBay view contains a row of icons along the top and
     4 * left sides representing available consumers and producers, and
     5 * a set of PatchRows which build the matrix of connections.
     6 *
     7 * Copyright 2013, Haiku, Inc. All rights reserved.
     8 * Distributed under the terms of the MIT License.
     9 *
     10 * Revisions by Pete Goodeve
     11 *
     12 * Copyright 1999, Be Incorporated.   All Rights Reserved.
     13 * This file may be used under the terms of the Be Sample Code License.
     14 */
     15 
    1016#ifndef _PatchView_h
    1117#define _PatchView_h
    1218
     
    1723
    1824class PatchRow;
    1925class BBitmap;
    20 class TToolTip;
    2126
    2227using namespace std;
    2328
    public:  
    3035    void AttachedToWindow();
    3136    void MessageReceived(BMessage* msg);
    3237    void Draw(BRect updateRect);
    33     void MouseMoved(BPoint point, uint32 transit, const BMessage* dragMsg);
    3438   
    3539private:
    3640    typedef enum { 
    private:  
    4044   
    4145    BRect ColumnIconFrameAt(int32 index) const;
    4246    BRect RowIconFrameAt(int32 index) const;
    43     void StartTipTracking(BPoint pt, BRect rect, int32 index, track_type type=TRACK_COLUMN);
    44     void StopTipTracking();
    45     void StartTip(BPoint pt, BRect rect, const char* str);
    46     void StopTip();
    47    
     47    virtual bool GetToolTipAt(BPoint point, BToolTip** tip);
     48
    4849    void AddProducer(int32 id);
    4950    void AddConsumer(int32 id);
    5051    void RemoveProducer(int32 id);
    private:  
    6364    typedef list<EndpointInfo>::const_iterator const_endpoint_itor;
    6465    typedef list<PatchRow*>::iterator row_itor;
    6566   
    66     list<EndpointInfo> m_producers;
    67     list<EndpointInfo> m_consumers;
    68     list<PatchRow*> m_patchRows;
    69     BBitmap* m_unknownDeviceIcon;
    70     int32 m_trackIndex;
    71     track_type m_trackType;
    72     TToolTip* m_toolTip;
     67    list<EndpointInfo> fProducers;
     68    list<EndpointInfo> fConsumers;
     69    list<PatchRow*> fPatchRows;
     70    BBitmap* fUnknownDeviceIcon;
    7371};
    7472
    7573#endif /* _PatchView_h */
  • src/tests/kits/midi/patchbay/PatchWin.cpp

    diff --git a/src/tests/kits/midi/patchbay/PatchWin.cpp b/src/tests/kits/midi/patchbay/PatchWin.cpp
    index 2511b85..8c45054 100644
    a b  
    1 // PatchWin.cpp
    2 // ------------
    3 // Implements the main PatchBay window class.
    4 //
    5 // Copyright 1999, Be Incorporated.   All Rights Reserved.
    6 // This file may be used under the terms of the Be Sample Code License.
     1/* PatchWin.cpp
     2 * ------------
     3 * Implements the main PatchBay window class.
     4 *
     5 * Copyright 2013, Haiku, Inc. All rights reserved.
     6 * Distributed under the terms of the MIT License.
     7 *
     8 * Revisions by Pete Goodeve
     9 *
     10 * Copyright 1999, Be Incorporated.   All Rights Reserved.
     11 * This file may be used under the terms of the Be Sample Code License.
     12 */
     13 
     14#include "PatchWin.h"
    715
    816#include <Application.h>
    9 #include "PatchWin.h"
    1017#include "PatchView.h"
    1118
     19
    1220PatchWin::PatchWin()
    13     : BWindow(BRect(50,50,450,450), "Patch Bay", B_TITLED_WINDOW, 0)
     21    :
     22    BWindow(BRect(50, 50, 450, 450), "Patch Bay", B_TITLED_WINDOW, 0)
    1423{
    1524    BRect r = Bounds();
    16     m_patchView = new PatchView(r);
    17     AddChild(m_patchView);
     25    fPatchView = new PatchView(r);
     26    AddChild(fPatchView);
    1827    Show();
    1928}
    2029
    21 bool PatchWin::QuitRequested()
     30
     31bool
     32PatchWin::QuitRequested()
    2233{
    2334    be_app->PostMessage(B_QUIT_REQUESTED);
    2435    return true;
    2536}
    26 
  • src/tests/kits/midi/patchbay/PatchWin.h

    diff --git a/src/tests/kits/midi/patchbay/PatchWin.h b/src/tests/kits/midi/patchbay/PatchWin.h
    index a7ab58e..c5659ea 100644
    a b  
    1 // PatchWin.h
    2 // ----------
    3 // The main PatchBay window class.
    4 //
    5 // Copyright 1999, Be Incorporated.   All Rights Reserved.
    6 // This file may be used under the terms of the Be Sample Code License.
     1/* PatchWin.h
     2 * ----------
     3 * The main PatchBay window class.
     4 *
     5 * Copyright 2013, Haiku, Inc. All rights reserved.
     6 * Distributed under the terms of the MIT License.
     7 *
     8 * Revisions by Pete Goodeve
     9 *
     10 * Copyright 1999, Be Incorporated.   All Rights Reserved.
     11 * This file may be used under the terms of the Be Sample Code License.
     12 */
    713
    814#ifndef _PatchWin_h
    915#define _PatchWin_h
    public:  
    1824    PatchWin();
    1925    bool QuitRequested();
    2026private:
    21     PatchView* m_patchView;
     27    PatchView* fPatchView;
    2228};
    2329
    2430#endif /* _PatchWin_h */
  • deleted file src/tests/kits/midi/patchbay/TToolTip.cpp

    diff --git a/src/tests/kits/midi/patchbay/TToolTip.cpp b/src/tests/kits/midi/patchbay/TToolTip.cpp
    deleted file mode 100644
    index 17ee1ca..0000000
    + -  
    1 //--------------------------------------------------------------------
    2 // 
    3 //  TToolTip.cpp
    4 //
    5 //  Written by: Robert Polic
    6 // 
    7 //--------------------------------------------------------------------
    8 
    9 #include <Screen.h>
    10 #include <stdio.h>
    11 #include <stdlib.h>
    12 #include <string.h>
    13 
    14 #include <Application.h>
    15 #include <Roster.h>
    16 
    17 #include "TToolTip.h"
    18 
    19 #define kHOR_MARGIN                   4     // hor. gap between frame and tip
    20 #define kVER_MARGIN                   3     // ver. gap between frame and tip
    21 #define kTIP_HOR_OFFSET              10     // tip position right of cursor
    22 #define kTIP_VER_OFFSET              16     // tip position below cursor
    23 #define kSLOP                         4     // mouse slop before tip hides
    24 
    25 #define kTOOL_TIP_DELAY_TIME     500000     // default delay time before tip shows (.5 secs.)
    26 #define kTOOL_TIP_HOLD_TIME     3000000     // default hold time of time (3 secs.)
    27 
    28 #define kDRAW_WINDOW_FRAME
    29 
    30 const rgb_color kVIEW_COLOR = {255, 203, 0, 255};   // view background color (light yellow)
    31 const rgb_color kLIGHT_VIEW_COLOR = {255, 255, 80, 255}; // top left frame highlight
    32 const rgb_color kDARK_VIEW_COLOR = {175, 123, 0, 255}; // bottom right frame highlight
    33 const rgb_color kTEXT_COLOR = {0, 0, 0, 255};       // text color (black)
    34 
    35 
    36 //====================================================================
    37 
    38 TToolTip::TToolTip(tool_tip_settings *settings)
    39        :BWindow(BRect(0, 0, 10, 10), "tool_tip", B_NO_BORDER_WINDOW_LOOK,
    40                 B_FLOATING_ALL_WINDOW_FEEL, B_AVOID_FRONT)
    41 {
    42     // setup the tooltip view
    43     AddChild(fView = new TToolTipView(settings));
    44     // start the message loop thread
    45     Run();
    46 }
    47 
    48 //--------------------------------------------------------------------
    49 
    50 void TToolTip::MessageReceived(BMessage *msg)
    51 {
    52     switch (msg->what) {
    53         // forward interesting messages to the view
    54         case B_SOME_APP_ACTIVATED:
    55         case eToolTipStart:
    56         case eToolTipStop:
    57             PostMessage(msg, fView);
    58             break;
    59         default:
    60             BWindow::MessageReceived(msg);
    61     }
    62 }
    63 
    64 //--------------------------------------------------------------------
    65 
    66 void TToolTip::GetSettings(tool_tip_settings *settings)
    67 {
    68     fView->GetSettings(settings);
    69 }
    70 
    71 //--------------------------------------------------------------------
    72 
    73 void TToolTip::SetSettings(tool_tip_settings *settings)
    74 {
    75     fView->SetSettings(settings);
    76 }
    77 
    78 
    79 //====================================================================
    80 
    81 TToolTipView::TToolTipView(tool_tip_settings *settings)
    82              :BView(BRect(0, 0, 10, 10), "tool_tip", B_FOLLOW_ALL, B_WILL_DRAW)
    83 {
    84     // initialize tooltip settings
    85     if (settings)
    86         // we should probably sanity-check user defined settings (but we won't)
    87         fTip.settings = *settings;
    88     else {
    89         // use defaults if no settings are passed
    90         fTip.settings.enabled = true;
    91         fTip.settings.one_time_only = false;
    92         fTip.settings.delay = kTOOL_TIP_DELAY_TIME;
    93         fTip.settings.hold = kTOOL_TIP_HOLD_TIME;
    94         fTip.settings.font = be_plain_font;
    95     }
    96 
    97     // initialize the tip
    98     fString = (char *)malloc(1);
    99     fString[0] = 0;
    100 
    101     // initialize the view
    102     SetFont(&fTip.settings.font);
    103     SetViewColor(kVIEW_COLOR);
    104 }
    105 
    106 //--------------------------------------------------------------------
    107 
    108 TToolTipView::~TToolTipView()
    109 {
    110     status_t    status;
    111 
    112     // kill tool_tip thread
    113     fTip.quit = true;
    114     wait_for_thread(fThread, &status);
    115 
    116     // free tip
    117     free(fString);
    118 }
    119 
    120 //--------------------------------------------------------------------
    121 
    122 void TToolTipView::AllAttached()
    123 {
    124     // initialize internal settings
    125     fTip.app_active = true;
    126     fTip.quit = false;
    127     fTip.stopped = true;
    128 
    129     fTip.tool_tip_view = this;
    130     fTip.tool_tip_window = Window();
    131 
    132     // start tool_tip thread
    133     resume_thread(fThread = spawn_thread((status_t (*)(void *)) ToolTipThread,
    134                 "tip_thread", B_DISPLAY_PRIORITY, &fTip));
    135 }
    136 
    137 //--------------------------------------------------------------------
    138 
    139 void TToolTipView::Draw(BRect /* where */)
    140 {
    141     char        *src_strings[1];
    142     char        *tmp_string;
    143     char        *truncated_strings[1];
    144     BFont       font;
    145     BRect       r = Bounds();
    146     font_height finfo;
    147 
    148     // draw border around window
    149 #ifdef kDRAW_WINDOW_FRAME
    150     SetHighColor(0, 0, 0, 255);
    151     StrokeRect(r);
    152     r.InsetBy(1, 1);
    153 #endif
    154     SetHighColor(kLIGHT_VIEW_COLOR);
    155     StrokeLine(BPoint(r.left, r.bottom), BPoint(r.left, r.top));
    156     StrokeLine(BPoint(r.left + 1, r.top), BPoint(r.right - 1, r.top));
    157     SetHighColor(kDARK_VIEW_COLOR);
    158     StrokeLine(BPoint(r.right, r.top), BPoint(r.right, r.bottom));
    159     StrokeLine(BPoint(r.right - 1, r.bottom), BPoint(r.left + 1, r.bottom));
    160 
    161     // set pen position
    162     GetFont(&font);
    163     font.GetHeight(&finfo);
    164     MovePenTo(kHOR_MARGIN + 1, kVER_MARGIN + finfo.ascent);
    165 
    166     // truncate string if needed
    167     src_strings[0] = fString;
    168     tmp_string = (char *)malloc(strlen(fString) + 16);
    169     truncated_strings[0] = tmp_string;
    170     font.GetTruncatedStrings((const char **)src_strings, 1, B_TRUNCATE_END,
    171         Bounds().Width() - (2 * kHOR_MARGIN) + 1, truncated_strings);
    172 
    173     // draw string
    174     SetLowColor(kVIEW_COLOR);
    175     SetHighColor(kTEXT_COLOR);
    176     DrawString(tmp_string);
    177     free(tmp_string);
    178 }
    179 
    180 //--------------------------------------------------------------------
    181 
    182 void TToolTipView::MessageReceived(BMessage *msg)
    183 {
    184     switch (msg->what) {
    185         case B_SOME_APP_ACTIVATED:
    186             msg->FindBool("active", &fTip.app_active);
    187             break;
    188 
    189         case eToolTipStart:
    190             {
    191                 const char  *str;
    192 
    193                 // extract parameters
    194                 msg->FindPoint("start", &fTip.start);
    195                 msg->FindRect("bounds", &fTip.bounds);
    196                 msg->FindString("string", &str);
    197                 free(fString);
    198                 fString = (char *)malloc(strlen(str) + 1);
    199                 strcpy(fString, str);
    200 
    201                 // force window to fit new parameters
    202                 AdjustWindow();
    203 
    204                 // flag thread to reset
    205                 fTip.reset = true;
    206             }
    207             break;
    208 
    209         case eToolTipStop:
    210             // flag thread to stop
    211             fTip.stop = true;
    212             break;
    213     }
    214 }
    215 
    216 //--------------------------------------------------------------------
    217 
    218 void TToolTipView::GetSettings(tool_tip_settings *settings)
    219 {
    220     // return current settings
    221     *settings = fTip.settings;
    222 }
    223 
    224 //--------------------------------------------------------------------
    225 
    226 void TToolTipView::SetSettings(tool_tip_settings *settings)
    227 {
    228     bool    invalidate = fTip.settings.font != settings->font;
    229 
    230     // we should probably sanity-check user defined settings (but we won't)
    231     fTip.settings = *settings;
    232 
    233     // if the font changed, adjust window to fit
    234     if (invalidate) {
    235         Window()->Lock();
    236         SetFont(&fTip.settings.font);
    237         AdjustWindow();
    238         Window()->Unlock();
    239     }
    240 }
    241 
    242 //--------------------------------------------------------------------
    243 
    244 void TToolTipView::AdjustWindow()
    245 {
    246     float       width;
    247     float       height;
    248     float       x;
    249     float       y;
    250     BScreen     s(B_MAIN_SCREEN_ID);
    251     BRect       screen = s.Frame();
    252     BWindow     *wind = Window();
    253     font_height finfo;
    254 
    255     screen.InsetBy(2, 2);   // we want a 2-pixel clearance
    256     fTip.settings.font.GetHeight(&finfo);
    257     width = fTip.settings.font.StringWidth(fString) + (kHOR_MARGIN * 2);  // string width
    258     height = (finfo.ascent + finfo.descent + finfo.leading) + (kVER_MARGIN * 2);  // string height
    259 
    260     // calculate new position and size of window
    261     x = fTip.start.x + kTIP_HOR_OFFSET;
    262     if ((x + width) > screen.right)
    263         x = screen.right - width;
    264     y = fTip.start.y + kTIP_VER_OFFSET;
    265     if ((y + height) > screen.bottom) {
    266         y = screen.bottom - height;
    267         if ((fTip.start.y >= (y - kSLOP)) && (fTip.start.y <= (y + height)))
    268             y = fTip.start.y - kTIP_VER_OFFSET - height;
    269     }
    270     if (x < screen.left) {
    271         width -= screen.left - x;
    272         x = screen.left;
    273     }
    274     if (y < screen.top) {
    275         height -= screen.top - y;
    276         y = screen.top;
    277     }
    278 
    279     wind->MoveTo((int)x, (int)y);
    280     wind->ResizeTo((int)width, (int)height);
    281 
    282     // force an update
    283     Invalidate(Bounds());
    284 }
    285 
    286 //--------------------------------------------------------------------
    287 
    288 status_t TToolTipView::ToolTipThread(tool_tip *tip)
    289 {
    290     uint32  buttons;
    291     BPoint  where;
    292     BScreen s(B_MAIN_SCREEN_ID);
    293     BRect   screen = s.Frame();
    294 
    295     screen.InsetBy(2, 2);
    296     while (!tip->quit) {
    297         if (tip->tool_tip_window->LockWithTimeout(0) == B_NO_ERROR) {
    298             tip->tool_tip_view->GetMouse(&where, &buttons);
    299             tip->tool_tip_view->ConvertToScreen(&where);
    300 
    301             tip->stopped = tip->stop;
    302             if (tip->reset) {
    303                 if (tip->showing)
    304                     tip->tool_tip_window->Hide();
    305                 tip->stop = false;
    306                 tip->stopped = false;
    307                 tip->reset = false;
    308                 tip->shown = false;
    309                 tip->showing = false;
    310                 tip->start_time = system_time() + tip->settings.delay;
    311             }
    312             else if (tip->showing) {
    313                 if ((tip->stop) ||
    314                     (!tip->settings.enabled) ||
    315                     (!tip->app_active) ||
    316                     (!tip->bounds.Contains(where)) ||
    317                     (tip->expire_time < system_time()) ||
    318                     (abs((int)tip->start.x - (int)where.x) > kSLOP) ||
    319                     (abs((int)tip->start.y - (int)where.y) > kSLOP) ||
    320                     (buttons)) {
    321                     tip->tool_tip_window->Hide();
    322                     tip->shown = tip->settings.one_time_only;
    323                     tip->showing = false;
    324                     tip->tip_timed_out = (tip->expire_time < system_time());
    325                     tip->start_time = system_time() + tip->settings.delay;
    326                 }
    327             }
    328             else if ((tip->settings.enabled) &&
    329                      (!tip->stopped) &&
    330                      (tip->app_active) &&
    331                      (!tip->shown) &&
    332                      (!tip->tip_timed_out) &&
    333                      (!buttons) &&
    334                      (tip->bounds.Contains(where)) &&
    335                      (tip->start_time < system_time())) {
    336                 tip->start = where;
    337                 tip->tool_tip_view->AdjustWindow();
    338                 tip->tool_tip_window->Show();
    339                 tip->tool_tip_window->Activate(false);
    340                 tip->showing = true;
    341                 tip->expire_time = system_time() + tip->settings.hold;
    342                 tip->start = where;
    343             }
    344             else if ((abs((int)tip->start.x - (int)where.x) > kSLOP) ||
    345                      (abs((int)tip->start.y - (int)where.y) > kSLOP)) {
    346                 tip->start = where;
    347                 tip->start_time = system_time() + tip->settings.delay;
    348                 tip->tip_timed_out = false;
    349             }
    350             if (buttons)
    351                 tip->start_time = system_time() + tip->settings.delay;
    352             tip->tool_tip_window->Unlock();
    353         }
    354         snooze(50000);
    355     }
    356     return B_NO_ERROR;
    357 }
    358  No newline at end of file
  • deleted file src/tests/kits/midi/patchbay/TToolTip.h

    diff --git a/src/tests/kits/midi/patchbay/TToolTip.h b/src/tests/kits/midi/patchbay/TToolTip.h
    deleted file mode 100644
    index 1288d55..0000000
    + -  
    1 //--------------------------------------------------------------------
    2 // 
    3 //  TToolTip.h
    4 //
    5 //  Written by: Robert Polic
    6 // 
    7 //--------------------------------------------------------------------
    8 
    9 #ifndef T_TOOL_TIPS_H
    10 #define T_TOOL_TIPS_H
    11 
    12 #include <Font.h>
    13 #include <Window.h>
    14 #include <View.h>
    15 
    16 enum    TOOL_TIP_MESSAGES       {eToolTipStart = 'ttGo',
    17                                  eToolTipStop = 'ttSp'};
    18 
    19 // ui settings
    20 struct tool_tip_settings {
    21     bool                enabled;        // flag whether tips are enables or not
    22     bool                one_time_only;  // flag to only display the tip once per time in view
    23     bigtime_t           delay;          // delay before tip is shown in microseconds
    24     bigtime_t           hold;           // amount of time tip is displayed in microseconds
    25     BFont               font;           // font tip is drawn in
    26 };
    27 
    28 // internal settings
    29 struct tool_tip {
    30     bool                app_active;
    31     bool                quit;
    32     bool                stop;
    33     bool                stopped;
    34     bool                reset;
    35     bool                shown;
    36     bool                showing;
    37     bool                tip_timed_out;
    38     BPoint              start;
    39     BRect               bounds;
    40     class TToolTipView  *tool_tip_view;
    41     BWindow             *tool_tip_window;
    42     bigtime_t           start_time;
    43     bigtime_t           expire_time;
    44     tool_tip_settings   settings;
    45 };
    46 
    47 
    48 //====================================================================
    49 
    50 class TToolTip : public BWindow {
    51 
    52 public:
    53                         TToolTip(tool_tip_settings *settings = NULL);
    54     virtual void        MessageReceived(BMessage*);
    55 
    56     void                GetSettings(tool_tip_settings*);
    57     void                SetSettings(tool_tip_settings*);
    58 
    59 private:
    60     class TToolTipView  *fView;
    61 };
    62 
    63 
    64 //====================================================================
    65 
    66 class TToolTipView : public BView {
    67 
    68 public:
    69                         TToolTipView(tool_tip_settings *settings = NULL);
    70                         ~TToolTipView();
    71     virtual void        AllAttached();
    72     virtual void        Draw(BRect);
    73     virtual void        MessageReceived(BMessage*);
    74 
    75     void                GetSettings(tool_tip_settings*);
    76     void                SetSettings(tool_tip_settings*);
    77 
    78 private:
    79     void                AdjustWindow();
    80     static status_t     ToolTipThread(tool_tip*);
    81 
    82     char                *fString;
    83     thread_id           fThread;
    84     tool_tip            fTip;
    85 };
    86 #endif
  • src/tests/kits/midi/patchbay/UnknownDeviceIcons.h

    diff --git a/src/tests/kits/midi/patchbay/UnknownDeviceIcons.h b/src/tests/kits/midi/patchbay/UnknownDeviceIcons.h
    index 27efec7..365d607 100644
    a b  
    1 // UnknownDeviceIcons.h
    2 // --------------------
    3 // The icons to be used in case a device doesn't supply its icons.
    4 // In the future, this could be better selected if the device supported
    5 // other descriptive property fields.
    6 //
    7 // Large and mini versions are available. PatchBay currently uses the
    8 // large version.
    9 //
    10 // Copyright 1999, Be Incorporated.   All Rights Reserved.
    11 // This file may be used under the terms of the Be Sample Code License.
    12 
     1/* UnknownDeviceIcons.h
     2 * --------------------
     3 * The icons to be used in case a device doesn't supply its icons.
     4 *
     5 * Copyright 2013, Haiku, Inc. All rights reserved.
     6 * Distributed under the terms of the MIT License.
     7 *
     8 * Revisions by Pete Goodeve
     9 *
     10 * Copyright 1999, Be Incorporated.   All Rights Reserved.
     11 * This file may be used under the terms of the Be Sample Code License.
     12 */
     13 
    1314#ifndef _UnknownDeviceIcons_h
    1415#define _UnknownDeviceIcons_h
    1516
    1617namespace UnknownDevice {
    1718
    18 const unsigned char kLargeIconBits [] = {
    19     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    20     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    21     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    22     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    23     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    24     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    25     0xff,0xff,0xff,0xff,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,
    26     0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0xff,
    27     0xff,0xff,0xff,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,
    28     0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0c,0x0c,
    29     0xff,0xff,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,
    30     0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0x08,0x0c,
    31     0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    32     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x08,0x0c,
    33     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
    34     0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    35     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x0d,0x04,0x00,0x00,0x04,
    36     0x0d,0x1b,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    37     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x16,0x00,0x00,0x00,0x00,0x00,0x00,
    38     0x00,0x00,0x12,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    39     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    40     0x00,0x00,0x00,0x16,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    41     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x0d,0x00,0x00,0x00,0x0d,0x1b,0x3f,0x16,
    42     0x04,0x00,0x00,0x09,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    43     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x04,0x00,0x00,0x0d,0x3f,0x3f,0x3f,0x3f,
    44     0x16,0x00,0x00,0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    45     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00,0x00,0x1b,0x3f,0x3f,0x3f,0x3f,
    46     0x1b,0x00,0x00,0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    47     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x1b,
    48     0x04,0x00,0x00,0x04,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    49     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x0d,0x00,
    50     0x00,0x00,0x00,0x16,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    51     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x1b,0x00,0x00,0x00,
    52     0x00,0x0d,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    53     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x04,0x00,0x00,0x09,
    54     0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    55     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00,0x00,0x3f,
    56     0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    57     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
    58     0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    59     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
    60     0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    61     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00,0x00,0x00,
    62     0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    63     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00,0x00,0x00,
    64     0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0x0c,
    65     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00,0x00,0x00,
    66     0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0x08,0xff,
    67     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x00,0x00,0x00,
    68     0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x04,0xff,0xff,
    69     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
    70     0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0xff,0xff,0xff,
    71     0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    72     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,
    73     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    74     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    75     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    76     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    77     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    78     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    79     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    80     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    81     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    82     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
    83 };
    84 
    85 const unsigned char kMiniIconBits [] = {
    86     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    87     0xff,0xff,0xff,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0xff,
    88     0xff,0xff,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0c,0x0c,
    89     0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08,0x0c,
    90     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x08,0x0c,
    91     0x00,0x3f,0x3f,0x3f,0x16,0x00,0x00,0x00,0x1b,0x3f,0x3f,0x3f,0x3f,0x00,0x08,0x0c,
    92     0x00,0x3f,0x3f,0x3f,0x00,0x16,0x3f,0x1b,0x00,0x3f,0x3f,0x3f,0x3f,0x00,0x08,0x0c,
    93     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x1b,0x00,0x3f,0x3f,0x3f,0x3f,0x00,0x08,0x0c,
    94     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x09,0x00,0x1b,0x3f,0x3f,0x3f,0x3f,0x00,0x08,0x0c,
    95     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x1b,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x08,0x0c,
    96     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x08,0x0c,
    97     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0x08,0xff,
    98     0x00,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x00,0xff,0xff,
    99     0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,
    100     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
    101     0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
     19// For Haiku we only need the Vector Icon
     20const unsigned char kVectorIcon[] = {
     21    0x6e, 0x63, 0x69, 0x66, 0x0c, 0x05, 0x01, 0x02, 0x00, 0x16, 0x05, 0xbf,
     22    0x2f, 0x31, 0xbf, 0x38, 0xed, 0x3e, 0xd8, 0x5c, 0xbe, 0xcf, 0xc4, 0x49,
     23    0x9a, 0x0c, 0x4b, 0x50, 0x22, 0x00, 0x01, 0x37, 0x70, 0x00, 0x71, 0x6d,
     24    0x73, 0xff, 0xff, 0x02, 0x01, 0x16, 0x03, 0x3e, 0xb0, 0x00, 0x00, 0x00,
     25    0x00, 0x00, 0x00, 0x00, 0x3e, 0xb0, 0x00, 0x48, 0x20, 0x00, 0x48, 0x20,
     26    0x00, 0xbe, 0x4b, 0x00, 0x84, 0xff, 0x32, 0x02, 0x00, 0x06, 0x04, 0xbe,
     27    0x37, 0xc8, 0xb7, 0xc4, 0x56, 0x37, 0x95, 0x53, 0xbe, 0x1c, 0x1a, 0x4b,
     28    0x24, 0xcf, 0x4c, 0x81, 0xbe, 0x0e, 0x00, 0x00, 0x00, 0x8f, 0x04, 0x02,
     29    0x02, 0xff, 0x68, 0x5b, 0x5b, 0xff, 0xff, 0xff, 0xff, 0x02, 0x03, 0x06,
     30    0x03, 0xbc, 0xd4, 0xab, 0xbc, 0x8a, 0x9d, 0x3d, 0xad, 0x85, 0xbe, 0x0c,
     31    0x57, 0x4a, 0x5f, 0x47, 0x4b, 0x05, 0xcb, 0x8a, 0x08, 0x08, 0x08, 0xff,
     32    0xc9, 0xc4, 0xc4, 0xff, 0xb2, 0xa7, 0xa7, 0x02, 0x00, 0x06, 0x03, 0xba,
     33    0x88, 0x02, 0xbc, 0x99, 0x3b, 0x3d, 0xd2, 0x26, 0xbb, 0xb8, 0xd2, 0x49,
     34    0xca, 0x26, 0x4b, 0xd1, 0x37, 0x00, 0x08, 0x01, 0x01, 0x00, 0xff, 0xaa,
     35    0x00, 0xff, 0x08, 0x01, 0x01, 0x02, 0x00, 0x06, 0x03, 0xba, 0x51, 0xe2,
     36    0xb9, 0xcf, 0x15, 0xb9, 0x7d, 0x65, 0x3a, 0x20, 0x21, 0x4b, 0x39, 0x49,
     37    0x4a, 0x12, 0xba, 0x00, 0x08, 0x01, 0x01, 0x00, 0xff, 0xaa, 0x00, 0xff,
     38    0x08, 0x01, 0x01, 0x02, 0x00, 0x06, 0x03, 0x39, 0x0b, 0x9b, 0xbb, 0x2f,
     39    0xca, 0xb9, 0xd8, 0xb1, 0xb7, 0xad, 0x04, 0x4a, 0x23, 0x00, 0x4b, 0x7f,
     40    0x99, 0x00, 0x08, 0x01, 0x01, 0x00, 0xff, 0xaa, 0x00, 0xff, 0x08, 0x01,
     41    0x01, 0x02, 0x00, 0x06, 0x03, 0x36, 0xa6, 0x66, 0x35, 0xf2, 0xe6, 0xbb,
     42    0x18, 0x84, 0x3c, 0x13, 0xd8, 0x4a, 0x92, 0x1c, 0x4a, 0xb3, 0x4f, 0x00,
     43    0xf9, 0xee, 0xd7, 0x00, 0x37, 0x29, 0x0d, 0xff, 0xf9, 0xee, 0xd7, 0x05,
     44    0x00, 0x02, 0x00, 0x06, 0x03, 0x3a, 0x89, 0x7d, 0xbc, 0xf6, 0x83, 0x3d,
     45    0x95, 0x65, 0x3b, 0x11, 0x89, 0xc0, 0xa4, 0x24, 0x4a, 0xaf, 0xae, 0x00,
     46    0xff, 0xb1, 0x1b, 0x69, 0xf6, 0xff, 0x1a, 0xff, 0xff, 0xf9, 0xc7, 0x02,
     47    0x00, 0x06, 0x03, 0xbc, 0xe8, 0xf1, 0x3d, 0xc1, 0x1a, 0xbf, 0x29, 0x59,
     48    0xbe, 0x73, 0x51, 0x4b, 0x4e, 0xe9, 0x4b, 0x19, 0x62, 0x00, 0xe3, 0xf0,
     49    0xeb, 0x81, 0x00, 0xff, 0xaa, 0xff, 0x00, 0x00, 0x00, 0x06, 0x02, 0x04,
     50    0x40, 0x22, 0xc6, 0x59, 0x22, 0xb9, 0x26, 0x22, 0x22, 0x40, 0x22, 0xb9,
     51    0x26, 0x22, 0xc6, 0x59, 0x40, 0x5e, 0xb9, 0x26, 0x5e, 0xc6, 0x59, 0x5e,
     52    0x5e, 0x40, 0x5e, 0xc6, 0x59, 0x5e, 0xb9, 0x26, 0x0a, 0x04, 0x3a, 0x4e,
     53    0x3a, 0x5a, 0x46, 0x5a, 0x46, 0x4e, 0x06, 0x0a, 0xfe, 0xf1, 0x07, 0xbf,
     54    0x73, 0x48, 0xbf, 0x73, 0xc4, 0x6e, 0xbf, 0x73, 0xc4, 0x6e, 0xbf, 0x73,
     55    0xc4, 0x6e, 0x3d, 0xc5, 0xed, 0x3d, 0xc4, 0x6e, 0x3d, 0xc7, 0x6b, 0xbf,
     56    0x73, 0xc7, 0x6b, 0xbf, 0x73, 0xc7, 0xa6, 0xbf, 0x73, 0xc7, 0x30, 0x57,
     57    0xc0, 0x0c, 0xc0, 0x0c, 0xc7, 0x6b, 0xc0, 0x0c, 0xc7, 0x77, 0xc0, 0x0c,
     58    0xc7, 0x5f, 0x43, 0xc5, 0xed, 0x43, 0xc7, 0x6b, 0x43, 0xc4, 0x6e, 0xc0,
     59    0x0c, 0xc4, 0x62, 0xc0, 0x0c, 0xc4, 0x57, 0xc0, 0x0c, 0xc4, 0x6e, 0x48,
     60    0x06, 0x10, 0xff, 0xaf, 0xfb, 0xef, 0x29, 0x43, 0xb5, 0x83, 0xc1, 0xeb,
     61    0xb7, 0x6e, 0xc0, 0x2d, 0x2e, 0x41, 0x2c, 0x41, 0x33, 0x41, 0x38, 0x44,
     62    0xbb, 0x8b, 0xc0, 0x53, 0x3a, 0x46, 0x38, 0x4e, 0x3a, 0x4a, 0xbc, 0x0e,
     63    0xc6, 0x56, 0x31, 0x52, 0x32, 0x51, 0x30, 0x53, 0x2f, 0x53, 0x2e, 0x55,
     64    0xb9, 0x27, 0xc6, 0xf6, 0x2e, 0x58, 0x2c, 0x57, 0x2c, 0x53, 0x2b, 0x56,
     65    0x2d, 0x50, 0x2f, 0x50, 0x35, 0x4b, 0xbb, 0x02, 0xc4, 0xd8, 0x37, 0x47,
     66    0x32, 0x45, 0x34, 0x46, 0xb9, 0xa6, 0xc1, 0x7b, 0xb7, 0xbf, 0xc1, 0xb1,
     67    0xb8, 0x82, 0xc1, 0x3e, 0x2a, 0x46, 0x29, 0x47, 0xb6, 0xdc, 0xc2, 0x1f,
     68    0x28, 0xc3, 0x21, 0x28, 0x4c, 0x26, 0x47, 0x25, 0x49, 0xb6, 0x59, 0xc0,
     69    0x9e, 0x02, 0x04, 0xb8, 0x61, 0x5a, 0xb8, 0xed, 0x5a, 0xb7, 0xd4, 0x5a,
     70    0x2b, 0xcb, 0x1b, 0x2b, 0xca, 0x8e, 0x2b, 0xcb, 0xa7, 0xb8, 0x61, 0x5f,
     71    0xb7, 0xd4, 0x5f, 0xb8, 0xed, 0x5f, 0x30, 0xcb, 0x1b, 0x30, 0xcb, 0xa7,
     72    0x30, 0xca, 0x8e, 0x02, 0x04, 0x30, 0x3c, 0xbc, 0x74, 0x3c, 0xb6, 0x4b,
     73    0x3c, 0x22, 0x4e, 0x22, 0x41, 0x22, 0x5c, 0x30, 0x60, 0xb6, 0x4b, 0x60,
     74    0xbc, 0x74, 0x60, 0x3e, 0x4e, 0x3e, 0x5a, 0x3e, 0x41, 0x0f, 0x0a, 0x00,
     75    0x01, 0x00, 0x10, 0x01, 0x17, 0x84, 0x00, 0x04, 0x0a, 0x04, 0x01, 0x00,
     76    0x12, 0x3f, 0xaf, 0xc5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xb0,
     77    0x19, 0x43, 0x01, 0xd6, 0x43, 0x01, 0x7d, 0x01, 0x17, 0x85, 0x00, 0x04,
     78    0x0a, 0x03, 0x01, 0x00, 0x12, 0x3f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00,
     79    0x00, 0x00, 0x3f, 0xa0, 0x48, 0x41, 0xff, 0xfb, 0x42, 0xfb, 0x88, 0x01,
     80    0x17, 0x82, 0x00, 0x04, 0x0a, 0x01, 0x01, 0x00, 0x02, 0x3f, 0x77, 0x77,
     81    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x77, 0x77, 0x44, 0x22, 0x22,
     82    0x44, 0x22, 0x22, 0x0a, 0x08, 0x01, 0x01, 0x12, 0x3f, 0x62, 0x76, 0x00,
     83    0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x62, 0x76, 0x44, 0x76, 0x27, 0xca,
     84    0x10, 0x00, 0x01, 0x17, 0x81, 0x00, 0x04, 0x0a, 0x05, 0x01, 0x01, 0x02,
     85    0x3f, 0x56, 0x9f, 0xb1, 0x54, 0xf4, 0x31, 0x54, 0xf4, 0x3f, 0x56, 0x9f,
     86    0x44, 0x7a, 0x31, 0xca, 0x03, 0x0c, 0x0a, 0x06, 0x01, 0x02, 0x30, 0x20,
     87    0x22, 0x01, 0x15, 0x80, 0x00, 0x04, 0x0a, 0x07, 0x01, 0x02, 0x12, 0x3f,
     88    0x3e, 0x45, 0xbe, 0x57, 0x59, 0x3e, 0x57, 0x59, 0x3f, 0x3e, 0x45, 0xc6,
     89    0xd2, 0x50, 0x49, 0x3a, 0x4c, 0x01, 0x15, 0x80, 0x00, 0x04, 0x0a, 0x06,
     90    0x01, 0x02, 0x12, 0x3e, 0xe5, 0x49, 0x3e, 0xc2, 0x73, 0xbe, 0xc2, 0x73,
     91    0x3e, 0xe5, 0x49, 0x49, 0xcc, 0x6e, 0xc6, 0xfe, 0xad, 0x01, 0x15, 0x80,
     92    0x00, 0x04, 0x0a, 0x06, 0x01, 0x02, 0x12, 0x3c, 0x90, 0x42, 0x3f, 0xca,
     93    0x00, 0xbf, 0xca, 0x00, 0x3c, 0x90, 0x42, 0x4b, 0x27, 0x4e, 0xc6, 0x7a,
     94    0x92, 0x01, 0x15, 0x80, 0x00, 0x04, 0x0a, 0x07, 0x01, 0x02, 0x12, 0x3c,
     95    0x77, 0x91, 0xbf, 0xce, 0x17, 0x3f, 0xce, 0x17, 0x3c, 0x77, 0x91, 0xc4,
     96    0xf4, 0xbd, 0x4b, 0x40, 0x03, 0x01, 0x15, 0x80, 0x00, 0x04, 0x0a, 0x0b,
     97    0x01, 0x05, 0x20, 0x30, 0x0d, 0x0a, 0x09, 0x02, 0x04, 0x03, 0x38, 0x30,
     98    0x0d, 0x15, 0xff, 0x01, 0x17, 0x83, 0x00, 0x04, 0x0a, 0x09, 0x02, 0x03,
     99    0x04, 0x38, 0x30, 0x0d, 0x00, 0x15, 0x01, 0x17, 0x86, 0x00, 0x04, 0x0a,
     100    0x0a, 0x02, 0x04, 0x03, 0x20, 0x30, 0x0d
    102101};
    103102
    104103}