Ticket #9604: patchbay.diff
File patchbay.diff, 77.1 KB (added by , 11 years ago) |
---|
-
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 8 14 #ifndef _CountEventConsumer_h 9 15 #define _CountEventConsumer_h 10 16 … … class CountEventConsumer : public BMidiLocalConsumer 15 21 { 16 22 public: 17 23 CountEventConsumer(const char* name) 18 : BMidiLocalConsumer(name), m_eventCount(0) 24 : 25 BMidiLocalConsumer(name), 26 fEventCount(0) 19 27 {} 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 } 22 36 23 37 void Data(uchar*, size_t, bool, bigtime_t) 24 { atomic_add(&m_eventCount, 1); } 38 { 39 atomic_add(&fEventCount, 1); 40 } 25 41 26 42 private: 27 int32 m_eventCount;43 int32 fEventCount; 28 44 }; 29 45 30 46 #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 */ 8 13 #include "EndpointInfo.h" 9 14 10 15 #include <Bitmap.h> … … 16 21 17 22 const char* LARGE_ICON_NAME = "be:large_icon"; 18 23 const char* MINI_ICON_NAME = "be:mini_icon"; 19 const char* VECTOR_ICON_NAME = "icon"; 24 const char* VECTOR_ICON_NAME = "icon"; 20 25 const uint32 LARGE_ICON_TYPE = 'ICON'; 21 26 const uint32 MINI_ICON_TYPE = 'MICN'; 22 27 const uint32 VECTOR_ICON_TYPE = 'VICN'; … … extern const color_space ICON_COLOR_SPACE = B_CMAP8; 27 32 28 33 static BBitmap* CreateIcon(const BMessage* msg, icon_size which); 29 34 35 30 36 EndpointInfo::EndpointInfo() 31 : m_id(-1), m_icon(NULL) 37 : 38 fId(-1), 39 fIcon(NULL) 32 40 {} 33 41 42 34 43 EndpointInfo::EndpointInfo(int32 id) 35 : m_id(id), m_icon(NULL) 44 : 45 fId(id), 46 fIcon(NULL) 36 47 { 37 48 BMidiRoster* roster = BMidiRoster::MidiRoster(); 38 49 if (roster) { … … EndpointInfo::EndpointInfo(int32 id) 41 52 printf("endpoint %ld = %p\n", id, endpoint); 42 53 BMessage msg; 43 54 if (endpoint->GetProperties(&msg) == B_OK) { 44 m_icon = CreateIcon(&msg, DISPLAY_ICON_SIZE);55 fIcon = CreateIcon(&msg, DISPLAY_ICON_SIZE); 45 56 } 46 57 endpoint->Release(); 47 58 } 48 59 } 49 60 } 50 61 62 51 63 EndpointInfo::EndpointInfo(const EndpointInfo& info) 52 : m_id(info.m_id) 64 : 65 fId(info.fId) 53 66 { 54 m_icon = (info.m_icon) ? new BBitmap(info.m_icon) : NULL;67 fIcon = (info.fIcon) ? new BBitmap(info.fIcon) : NULL; 55 68 } 56 69 57 EndpointInfo& EndpointInfo::operator=(const EndpointInfo& info) 70 71 EndpointInfo& 72 EndpointInfo::operator=(const EndpointInfo& info) 58 73 { 59 74 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; 63 78 } 64 79 return *this; 65 80 } 66 81 82 67 83 EndpointInfo::~EndpointInfo() 68 84 { 69 delete m_icon;85 delete fIcon; 70 86 } 71 87 72 void EndpointInfo::UpdateProperties(const BMessage* props) 88 89 void 90 EndpointInfo::UpdateProperties(const BMessage* props) 73 91 { 74 delete m_icon;75 m_icon = CreateIcon(props, DISPLAY_ICON_SIZE);92 delete fIcon; 93 fIcon = CreateIcon(props, DISPLAY_ICON_SIZE); 76 94 } 77 95 78 static BBitmap* CreateIcon(const BMessage* msg, icon_size which) 96 97 static BBitmap* 98 CreateIcon(const BMessage* msg, icon_size which) 79 99 { 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 96 101 const void* data; 97 102 ssize_t size; 98 103 BBitmap* bitmap = NULL; 99 104 100 #ifdef __HAIKU__ 101 iconSize = LARGE_ICON_SIZE; 102 105 // See if a Haiku Vector Icon available 103 106 if (msg->FindData(VECTOR_ICON_NAME, VECTOR_ICON_TYPE, &data, 104 107 &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); 106 109 bitmap = new BBitmap(r, B_RGBA32); 107 110 if (BIconUtils::GetVectorIcon((const uint8*)data, size, 108 111 bitmap) == B_OK) { … … static BBitmap* CreateIcon(const BMessage* msg, icon_size which) 111 114 } else 112 115 delete bitmap; 113 116 } 114 #endif115 117 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 116 135 if (msg->FindData(iconName, iconType, &data, &size) == B_OK) 117 136 { 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); 120 140 ASSERT((bitmap->BitsLength() == size)); 121 141 memcpy(bitmap->Bits(), data, size); 122 142 } -
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 9 15 #ifndef _EndpointInfo_h 10 16 #define _EndpointInfo_h 11 17 … … public: 28 34 EndpointInfo& operator=(const EndpointInfo& info); 29 35 ~EndpointInfo(); 30 36 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 } 33 45 void UpdateProperties(const BMessage* props); 34 46 35 47 private: 36 int32 m_id;37 BBitmap* m_icon;48 int32 fId; 49 BBitmap* fIcon; 38 50 }; 39 51 40 52 #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 10 10 PatchRow.cpp 11 11 EndpointInfo.cpp 12 12 MidiEventMeter.cpp 13 TToolTip.cpp14 13 : 15 14 midi midi2 be libicon.a $(TARGET_LIBSTDC++) 15 : 16 PatchBay.rdef 16 17 ; 17 18 -
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 8 14 #include <stdio.h> 9 15 #include <MidiRoster.h> 10 16 #include <MidiProducer.h> … … 13 19 #include "CountEventConsumer.h" 14 20 #include "MidiEventMeter.h" 15 21 16 static const BRect METER_BOUNDS(0, 0,7,31);22 static const BRect METER_BOUNDS(0, 0, 7, 31); 17 23 18 24 // If we get this number of events per pulse or greater, we will 19 25 // max out the event meter. … … static const BRect METER_BOUNDS(0,0,7,31); 21 27 // keyboard controller with a pulse of 200ms. 22 28 static const int32 METER_SCALE = 10; 23 29 30 24 31 MidiEventMeter::MidiEventMeter(int32 producerID) 25 : m_counter(NULL), m_meterLevel(0) 32 : 33 fCounter(NULL), 34 fMeterLevel(0) 26 35 { 27 36 BMidiRoster* roster = BMidiRoster::MidiRoster(); 28 37 if (roster) { … … MidiEventMeter::MidiEventMeter(int32 producerID) 30 39 if (producer) { 31 40 BString name; 32 41 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); 35 44 producer->Release(); 36 45 } 37 46 } 38 47 } 39 48 49 40 50 MidiEventMeter::~MidiEventMeter() 41 51 { 42 if (m_counter) m_counter->Release(); 52 if (fCounter) 53 fCounter->Release(); 43 54 } 44 55 45 void MidiEventMeter::Pulse(BView* view) 56 57 void 58 MidiEventMeter::Pulse(BView* view) 46 59 { 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(); 51 64 } 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)); 55 68 } 56 69 } 57 70 58 BRect MidiEventMeter::Bounds() const 71 72 BRect 73 MidiEventMeter::Bounds() const 59 74 { 60 75 return METER_BOUNDS; 61 76 } 62 77 63 void MidiEventMeter::Draw(BView* view) 78 79 void 80 MidiEventMeter::Draw(BView* view) 64 81 { 65 82 const rgb_color METER_BLACK = { 0, 0, 0, 255 }; 66 83 const rgb_color METER_GREY = { 180, 180, 180, 255 }; … … void MidiEventMeter::Draw(BView* view) 80 97 81 98 // draw the cells 82 99 BRect cell = METER_BOUNDS; 83 cell.InsetBy(1, 1);100 cell.InsetBy(1, 1); 84 101 cell.bottom = cell.top + (cell.Height() + 1) / 5; 85 102 cell.bottom--; 86 103 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}; 88 110 89 for (int32 i =4; i>=0; i--)111 for (int32 i = 4; i >= 0; i--) 90 112 { 91 113 rgb_color color; 92 if ( m_meterLevel > i) {114 if (fMeterLevel > i) { 93 115 color = tint_color(METER_GREEN, kTintArray[i]); 94 116 } else { 95 117 color = METER_GREY; … … void MidiEventMeter::Draw(BView* view) 102 124 view->PopState(); 103 125 } 104 126 105 int32 MidiEventMeter::CalcMeterLevel(int32 eventCount) const 127 128 int32 129 MidiEventMeter::CalcMeterLevel(int32 eventCount) const 106 130 { 107 131 // we use an approximately logarithmic scale for determing the actual 108 132 // drawn meter level, so that low-density event streams show up well. 109 if (eventCount == 0) {133 if (eventCount == 0) 110 134 return 0; 111 } else if (eventCount < (int32)(.5*METER_SCALE)) {135 else if (eventCount < (int32)(0.5 * METER_SCALE)) 112 136 return 1; 113 } else if (eventCount < (int32)(.75*METER_SCALE)) {137 else if (eventCount < (int32)(0.75 * METER_SCALE)) 114 138 return 2; 115 } else if (eventCount < (int32)(.9*METER_SCALE)) {139 else if (eventCount < (int32)(0.9 * METER_SCALE)) 116 140 return 3; 117 } else if (eventCount < METER_SCALE) {141 else if (eventCount < METER_SCALE) 118 142 return 4; 119 } else { 120 return 5; 121 } 143 return 5; 122 144 } -
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 9 15 #ifndef _MidiEventMeter_h 10 16 #define _MidiEventMeter_h 11 17 … … public: 29 35 private: 30 36 int32 CalcMeterLevel(int32 eventCount) const; 31 37 32 CountEventConsumer* m_counter;33 int32 m_meterLevel;38 CountEventConsumer* fCounter; 39 int32 fMeterLevel; 34 40 }; 35 41 36 42 #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" 7 15 8 16 #include <Roster.h> 9 #include "PatchApp.h"10 17 #include "PatchWin.h" 11 #include "TToolTip.h"12 18 13 19 PatchApp::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 {} 18 23 19 void PatchApp::ReadyToRun() 24 25 void 26 PatchApp::ReadyToRun() 20 27 { 21 28 new PatchWin; 22 29 } 23 30 24 void PatchApp::MessageReceived(BMessage* msg) 31 32 void 33 PatchApp::MessageReceived(BMessage* msg) 25 34 { 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); 36 36 } 37 37 38 int main() 38 39 int 40 main(void) 39 41 { 40 42 PatchApp app; 41 43 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 8 14 #ifndef _PatchApp_h 9 15 #define _PatchApp_h 10 16 11 17 #include <Application.h> 12 18 13 class TToolTip;14 15 19 class PatchApp : public BApplication 16 20 { 17 21 public: 18 22 PatchApp(); 19 23 void ReadyToRun(); 20 24 void MessageReceived(BMessage* msg); 21 22 private:23 TToolTip* m_toolTip;24 25 }; 25 26 26 27 #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 2 resource app_signature "application/x-vnd.Be.PatchBay"; 3 4 resource 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 17 resource app_flags B_SINGLE_LAUNCH; 18 19 20 resource 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" 7 14 8 15 #include <stdio.h> 9 16 #include <CheckBox.h> … … 13 20 #include <MidiProducer.h> 14 21 #include <Window.h> 15 22 #include "MidiEventMeter.h" 16 #include "PatchRow.h"17 23 18 24 extern const float ROW_LEFT = 50.0f; 19 25 extern const float ROW_TOP = 50.0f; … … extern const float COLUMN_WIDTH = 40.0f; 22 28 extern const float METER_PADDING = 15.0f; 23 29 extern const uint32 MSG_CONNECT_REQUEST = 'mCRQ'; 24 30 25 static const BPoint kBoxOffset(8, 7);31 static const BPoint kBoxOffset(8, 7); 26 32 27 33 // PatchCheckBox is the check box that describes a connection 28 34 // between a producer and a consumer. … … class PatchCheckBox : public BCheckBox 30 36 { 31 37 public: 32 38 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 34 46 { 35 m_producerID = producerID; 36 m_consumerID = consumerID; 47 return fProducerID; 48 } 49 int32 ConsumerID() const 50 { 51 return fConsumerID; 37 52 } 38 39 int32 ProducerID() const { return m_producerID; }40 int32 ConsumerID() const { return m_consumerID; }41 53 42 54 void DoConnect(); 43 55 44 56 private: 45 int32 m_producerID;46 int32 m_consumerID;57 int32 fProducerID; 58 int32 fConsumerID; 47 59 }; 48 60 61 49 62 PatchRow::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) 53 68 { 54 m_eventMeter = new MidiEventMeter(m_producerID);69 fEventMeter = new MidiEventMeter(fProducerID); 55 70 } 56 71 72 57 73 PatchRow::~PatchRow() 58 74 { 59 delete m_eventMeter;75 delete fEventMeter; 60 76 } 61 77 62 int32 PatchRow::ID() const 78 79 int32 80 PatchRow::ID() const 63 81 { 64 return m_producerID;82 return fProducerID; 65 83 } 66 84 67 void PatchRow::Pulse() 85 86 void 87 PatchRow::Pulse() 68 88 { 69 if (m_eventMeter) m_eventMeter->Pulse(this); 89 if (fEventMeter) 90 fEventMeter->Pulse(this); 70 91 } 71 92 72 void PatchRow::Draw(BRect) 93 94 void 95 PatchRow::Draw(BRect) 73 96 { 74 if (m_eventMeter) m_eventMeter->Draw(this); 97 if (fEventMeter) 98 fEventMeter->Draw(this); 75 99 } 76 100 77 void PatchRow::AddColumn(int32 consumerID) 101 102 void 103 PatchRow::AddColumn(int32 consumerID) 78 104 { 79 BRect r ;105 BRect rect; 80 106 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; 85 111 86 PatchCheckBox* box = new PatchCheckBox(r , m_producerID, consumerID);112 PatchCheckBox* box = new PatchCheckBox(rect, fProducerID, consumerID); 87 113 AddChild(box); 88 114 box->SetTarget(this); 89 115 } 90 116 91 void PatchRow::RemoveColumn(int32 consumerID) 117 118 void 119 PatchRow::RemoveColumn(int32 consumerID) 92 120 { 93 121 int32 numChildren = CountChildren(); 94 for (int32 i =0; i<numChildren; i++) {122 for (int32 i = 0; i < numChildren; i++) { 95 123 PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i)); 96 124 if (box && box->ConsumerID() == consumerID) { 97 125 RemoveChild(box); 98 126 delete box; 99 127 while (i < numChildren) { 100 128 box = dynamic_cast<PatchCheckBox*>(ChildAt(i++)); 101 if (box) {129 if (box) 102 130 box->MoveBy(-COLUMN_WIDTH, 0); 103 }104 131 } 105 132 break; 106 133 } 107 134 } 108 135 } 109 136 110 void PatchRow::Connect(int32 consumerID) 137 138 void 139 PatchRow::Connect(int32 consumerID) 111 140 { 112 141 int32 numChildren = CountChildren(); 113 for (int32 i =0; i<numChildren; i++) {142 for (int32 i = 0; i < numChildren; i++) { 114 143 PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i)); 115 if (box && box->ConsumerID() == consumerID) {144 if (box && box->ConsumerID() == consumerID) 116 145 box->SetValue(1); 117 }118 146 } 119 147 } 120 148 121 void PatchRow::Disconnect(int32 consumerID) 149 150 void 151 PatchRow::Disconnect(int32 consumerID) 122 152 { 123 153 int32 numChildren = CountChildren(); 124 for (int32 i =0; i<numChildren; i++) {154 for (int32 i = 0; i < numChildren; i++) { 125 155 PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i)); 126 if (box && box->ConsumerID() == consumerID) {156 if (box && box->ConsumerID() == consumerID) 127 157 box->SetValue(0); 128 }129 158 } 130 159 } 131 160 132 void PatchRow::AttachedToWindow() 161 162 void 163 PatchRow::AttachedToWindow() 133 164 { 134 165 Window()->SetPulseRate(200000); 135 166 SetViewColor(Parent()->ViewColor()); 136 167 int32 numChildren = CountChildren(); 137 for (int32 i =0; i<numChildren; i++) {168 for (int32 i = 0; i < numChildren; i++) { 138 169 PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ChildAt(i)); 139 if (box) {170 if (box) 140 171 box->SetTarget(this); 141 }142 172 } 143 173 } 144 174 145 void PatchRow::MessageReceived(BMessage* msg) 175 176 void 177 PatchRow::MessageReceived(BMessage* msg) 146 178 { 147 179 switch (msg->what) { 148 180 case MSG_CONNECT_REQUEST: … … void PatchRow::MessageReceived(BMessage* msg) 150 182 BControl* ctrl; 151 183 if (msg->FindPointer("source", (void**) &ctrl) == B_OK) { 152 184 PatchCheckBox* box = dynamic_cast<PatchCheckBox*>(ctrl); 153 if (box) {185 if (box) 154 186 box->DoConnect(); 155 }156 187 } 157 188 } 158 189 break; … … void PatchRow::MessageReceived(BMessage* msg) 162 193 } 163 194 } 164 195 165 void PatchCheckBox::DoConnect() 196 197 void 198 PatchCheckBox::DoConnect() 166 199 { 167 200 int32 value = Value(); 168 201 int32 inverseValue = (value + 1) % 2; 169 202 170 203 BMidiRoster* roster = BMidiRoster::MidiRoster(); 171 if ( ! roster) {204 if (roster == NULL) { 172 205 SetValue(inverseValue); 173 206 return; 174 207 } 175 208 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); 178 211 if (producer && consumer) { 179 212 status_t err; 180 if (value) {213 if (value) 181 214 err = producer->Connect(consumer); 182 } else {215 else 183 216 err = producer->Disconnect(consumer); 184 }185 217 186 218 if (err != B_OK) { 187 219 SetValue(inverseValue); 188 220 } 189 } else {221 } else 190 222 SetValue(inverseValue); 191 } 223 192 224 if (producer) producer->Release(); 193 225 if (consumer) consumer->Release(); 194 226 } -
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 1 13 #ifndef _PatchRow_h 2 14 #define _PatchRow_h 3 15 … … public: 31 43 void Disconnect(int32 consumerID); 32 44 33 45 private: 34 int32 m_producerID;35 MidiEventMeter* m_eventMeter;46 int32 fProducerID; 47 MidiEventMeter* fEventMeter; 36 48 }; 37 49 38 50 #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" 7 15 8 16 #include <Application.h> 9 17 #include <Bitmap.h> 10 18 #include <Debug.h> 19 #include <IconUtils.h> 11 20 #include <InterfaceDefs.h> 12 21 #include <Message.h> 13 22 #include <Messenger.h> 14 23 #include <MidiRoster.h> 15 24 #include <Window.h> 16 25 #include "EndpointInfo.h" 17 #include "PatchView.h"18 26 #include "PatchRow.h" 19 #include "TToolTip.h"20 27 #include "UnknownDeviceIcons.h" 21 28 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 30 PatchView::PatchView(BRect rect) 31 : 32 BView(rect, "PatchView", B_FOLLOW_ALL, B_WILL_DRAW), 33 fUnknownDeviceIcon(NULL) 25 34 { 26 35 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; 42 45 } 43 46 47 44 48 PatchView::~PatchView() 45 49 { 46 delete m_unknownDeviceIcon;50 delete fUnknownDeviceIcon; 47 51 } 48 52 49 void PatchView::AttachedToWindow() 53 54 void 55 PatchView::AttachedToWindow() 50 56 { 51 57 BMidiRoster* roster = BMidiRoster::MidiRoster(); 52 if ( ! roster) {58 if (roster == NULL) { 53 59 PRINT(("Couldn't get MIDI roster\n")); 54 60 be_app->PostMessage(B_QUIT_REQUESTED); 55 61 return; … … void PatchView::AttachedToWindow() 59 65 roster->StartWatching(&msgr); 60 66 } 61 67 62 void PatchView::MessageReceived(BMessage* msg) 68 69 void 70 PatchView::MessageReceived(BMessage* msg) 63 71 { 64 72 switch (msg->what) { 65 73 case B_MIDI_EVENT: … … void PatchView::MessageReceived(BMessage* msg) 71 79 } 72 80 } 73 81 74 void PatchView::MouseMoved(BPoint pt, uint32 transit, const BMessage* /* dragMsg */) 82 83 bool 84 PatchView::GetToolTipAt(BPoint point, BToolTip** tip) 75 85 { 76 if (transit == B_EXITED_VIEW || transit == B_OUTSIDE_VIEW) {77 StopTipTracking();78 return;79 }80 81 86 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++) { 84 91 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(); 87 95 found = true; 96 index = i; 88 97 } 89 98 } 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++) { 92 101 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(); 95 105 found = true; 106 index = i; 96 107 } 97 108 } 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 }124 109 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--) 127 115 if (index <= 0) break; 128 116 129 if (i == end)130 return ;131 117 if (itor == end) 118 return false; 119 132 120 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; 138 126 139 127 BString str; 140 128 str << "<" << obj->ID() << ">: " << obj->Name(); 141 129 obj->Release(); 142 StartTip(pt, rect, str.String());143 }144 130 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()); 153 132 154 void PatchView::StopTip() 155 { 156 be_app->PostMessage(eToolTipStop);133 *tip = ToolTip(); 134 135 return true; 157 136 } 158 137 159 void PatchView::Draw(BRect /* updateRect */) 138 139 void 140 PatchView::Draw(BRect /* updateRect */) 160 141 { 161 142 // draw producer icons 162 143 SetDrawingMode(B_OP_OVER); 163 144 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()); 167 149 } 168 150 169 151 // draw consumer icons 170 152 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()); 174 157 } 175 158 } 176 159 177 BRect PatchView::ColumnIconFrameAt(int32 index) const 160 161 BRect 162 PatchView::ColumnIconFrameAt(int32 index) const 178 163 { 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; 185 170 } 186 171 187 BRect PatchView::RowIconFrameAt(int32 index) const 172 173 BRect 174 PatchView::RowIconFrameAt(int32 index) const 188 175 { 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; 195 182 } 196 183 197 void PatchView::HandleMidiEvent(BMessage* msg) 184 185 void 186 PatchView::HandleMidiEvent(BMessage* msg) 198 187 { 199 188 SET_DEBUG_ENABLED(true); 200 189 … … void PatchView::HandleMidiEvent(BMessage* msg) 209 198 { 210 199 int32 id; 211 200 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")); 213 203 break; 214 204 } 215 205 216 206 const char* type; 217 207 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")); 219 210 break; 220 211 } 221 212 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) 224 216 AddProducer(id); 225 } else if (! strcmp(type, "consumer")) {217 else if (strcmp(type, "consumer") == 0) 226 218 AddConsumer(id); 227 }228 219 } 229 220 break; 230 221 case B_MIDI_UNREGISTERED: 231 222 { 232 223 int32 id; 233 224 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")); 235 227 break; 236 228 } 237 229 238 230 const char* type; 239 231 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")); 241 234 break; 242 235 } 243 236 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) 246 240 RemoveProducer(id); 247 } else if (! strcmp(type, "consumer")) {241 else if (strcmp(type, "consumer") == 0) 248 242 RemoveConsumer(id); 249 }250 243 } 251 244 break; 252 245 case B_MIDI_CHANGED_PROPERTIES: 253 246 { 254 247 int32 id; 255 248 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")); 257 251 break; 258 252 } 259 253 260 254 const char* type; 261 255 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")); 263 258 break; 264 259 } 265 260 266 261 BMessage props; 267 262 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")); 269 265 break; 270 266 } 271 267 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) 274 271 UpdateProducerProps(id, &props); 275 } else if (! strcmp(type, "consumer")) {272 else if (strcmp(type, "consumer") == 0) 276 273 UpdateConsumerProps(id, &props); 277 }278 274 279 275 } 280 276 break; … … void PatchView::HandleMidiEvent(BMessage* msg) 286 282 { 287 283 int32 prod; 288 284 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")); 290 287 break; 291 288 } 292 289 293 290 int32 cons; 294 291 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")); 296 294 break; 297 295 } 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)); 299 298 Connect(prod, cons); 300 299 } 301 300 break; … … void PatchView::HandleMidiEvent(BMessage* msg) 303 302 { 304 303 int32 prod; 305 304 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")); 307 307 break; 308 308 } 309 309 310 310 int32 cons; 311 311 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")); 313 314 break; 314 315 } 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)); 316 318 Disconnect(prod, cons); 317 319 } 318 320 break; … … void PatchView::HandleMidiEvent(BMessage* msg) 322 324 } 323 325 } 324 326 325 void PatchView::AddProducer(int32 id) 327 328 void 329 PatchView::AddProducer(int32 id) 326 330 { 327 331 EndpointInfo info(id); 328 m_producers.push_back(info);332 fProducers.push_back(info); 329 333 330 334 Window()->BeginViewTransaction(); 331 335 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); 334 338 BPoint p2 = CalcRowSize(); 335 339 row->MoveTo(p1); 336 340 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()); 340 344 AddChild(row); 341 345 Invalidate(); 342 346 Window()->EndViewTransaction(); 343 347 } 344 348 345 void PatchView::AddConsumer(int32 id) 349 350 void 351 PatchView::AddConsumer(int32 id) 346 352 { 347 353 EndpointInfo info(id); 348 m_consumers.push_back(info);354 fConsumers.push_back(info); 349 355 350 356 Window()->BeginViewTransaction(); 351 357 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++) { 353 359 (*i)->AddColumn(id); 354 360 (*i)->ResizeTo(newSize.x, newSize.y - 1); 355 361 } … … void PatchView::AddConsumer(int32 id) 357 363 Window()->EndViewTransaction(); 358 364 } 359 365 360 void PatchView::RemoveProducer(int32 id) 366 367 void 368 PatchView::RemoveProducer(int32 id) 361 369 { 362 for (endpoint_itor i = m_producers.begin(); i != m_producers.end(); i++) {370 for (endpoint_itor i = fProducers.begin(); i != fProducers.end(); i++) { 363 371 if (i->ID() == id) { 364 m_producers.erase(i);372 fProducers.erase(i); 365 373 break; 366 374 } 367 375 } 368 376 369 377 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++) { 371 379 if ((*i)->ID() == id) { 372 380 PatchRow* row = *i; 373 i = m_patchRows.erase(i);381 i = fPatchRows.erase(i); 374 382 RemoveChild(row); 375 383 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()) { 378 386 (*i++)->MoveBy(0, moveBy); 379 387 } 380 388 break; … … void PatchView::RemoveProducer(int32 id) 384 392 Window()->EndViewTransaction(); 385 393 } 386 394 387 void PatchView::RemoveConsumer(int32 id) 395 396 void 397 PatchView::RemoveConsumer(int32 id) 388 398 { 389 399 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++) { 391 401 if (i->ID() == id) { 392 m_consumers.erase(i);402 fConsumers.erase(i); 393 403 break; 394 404 } 395 405 } 396 406 397 407 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++) { 399 409 (*i)->RemoveColumn(id); 400 410 (*i)->ResizeTo(newSize.x, newSize.y - 1); 401 411 } … … void PatchView::RemoveConsumer(int32 id) 403 413 Window()->EndViewTransaction(); 404 414 } 405 415 406 void PatchView::UpdateProducerProps(int32 id, const BMessage* props) 416 417 void 418 PatchView::UpdateProducerProps(int32 id, const BMessage* props) 407 419 { 408 for (endpoint_itor i = m_producers.begin(); i != m_producers.end(); i++) {420 for (endpoint_itor i = fProducers.begin(); i != fProducers.end(); i++) { 409 421 if (i->ID() == id) { 410 422 i->UpdateProperties(props); 411 423 Invalidate(); … … void PatchView::UpdateProducerProps(int32 id, const BMessage* props) 414 426 } 415 427 } 416 428 417 void PatchView::UpdateConsumerProps(int32 id, const BMessage* props) 429 430 void 431 PatchView::UpdateConsumerProps(int32 id, const BMessage* props) 418 432 { 419 for (endpoint_itor i = m_consumers.begin(); i != m_consumers.end(); i++) {433 for (endpoint_itor i = fConsumers.begin(); i != fConsumers.end(); i++) { 420 434 if (i->ID() == id) { 421 435 i->UpdateProperties(props); 422 436 Invalidate(); … … void PatchView::UpdateConsumerProps(int32 id, const BMessage* props) 425 439 } 426 440 } 427 441 428 void PatchView::Connect(int32 prod, int32 cons) 442 443 void 444 PatchView::Connect(int32 prod, int32 cons) 429 445 { 430 for (row_itor i = m_patchRows.begin(); i != m_patchRows.end(); i++) {446 for (row_itor i = fPatchRows.begin(); i != fPatchRows.end(); i++) { 431 447 if ((*i)->ID() == prod) { 432 448 (*i)->Connect(cons); 433 449 break; … … void PatchView::Connect(int32 prod, int32 cons) 435 451 } 436 452 } 437 453 438 void PatchView::Disconnect(int32 prod, int32 cons) 454 455 void 456 PatchView::Disconnect(int32 prod, int32 cons) 439 457 { 440 for (row_itor i = m_patchRows.begin(); i != m_patchRows.end(); i++) {458 for (row_itor i = fPatchRows.begin(); i != fPatchRows.end(); i++) { 441 459 if ((*i)->ID() == prod) { 442 460 (*i)->Disconnect(cons); 443 461 break; … … void PatchView::Disconnect(int32 prod, int32 cons) 445 463 } 446 464 } 447 465 448 BPoint PatchView::CalcRowOrigin(int32 rowIndex) const 466 467 BPoint 468 PatchView::CalcRowOrigin(int32 rowIndex) const 449 469 { 450 BPoint p t;451 p t.x = ROW_LEFT;452 p t.y = ROW_TOP + rowIndex*ROW_HEIGHT;453 return p t;470 BPoint point; 471 point.x = ROW_LEFT; 472 point.y = ROW_TOP + rowIndex * ROW_HEIGHT; 473 return point; 454 474 } 455 475 456 BPoint PatchView::CalcRowSize() const 476 477 BPoint 478 PatchView::CalcRowSize() const 457 479 { 458 BPoint p t;459 p t.x = METER_PADDING + m_consumers.size()*COLUMN_WIDTH;460 p t.y = ROW_HEIGHT - 1;461 return p t;480 BPoint point; 481 point.x = METER_PADDING + fConsumers.size()*COLUMN_WIDTH; 482 point.y = ROW_HEIGHT - 1; 483 return point; 462 484 } -
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 10 16 #ifndef _PatchView_h 11 17 #define _PatchView_h 12 18 … … 17 23 18 24 class PatchRow; 19 25 class BBitmap; 20 class TToolTip;21 26 22 27 using namespace std; 23 28 … … public: 30 35 void AttachedToWindow(); 31 36 void MessageReceived(BMessage* msg); 32 37 void Draw(BRect updateRect); 33 void MouseMoved(BPoint point, uint32 transit, const BMessage* dragMsg);34 38 35 39 private: 36 40 typedef enum { … … private: 40 44 41 45 BRect ColumnIconFrameAt(int32 index) const; 42 46 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 48 49 void AddProducer(int32 id); 49 50 void AddConsumer(int32 id); 50 51 void RemoveProducer(int32 id); … … private: 63 64 typedef list<EndpointInfo>::const_iterator const_endpoint_itor; 64 65 typedef list<PatchRow*>::iterator row_itor; 65 66 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; 73 71 }; 74 72 75 73 #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" 7 15 8 16 #include <Application.h> 9 #include "PatchWin.h"10 17 #include "PatchView.h" 11 18 19 12 20 PatchWin::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) 14 23 { 15 24 BRect r = Bounds(); 16 m_patchView = new PatchView(r);17 AddChild( m_patchView);25 fPatchView = new PatchView(r); 26 AddChild(fPatchView); 18 27 Show(); 19 28 } 20 29 21 bool PatchWin::QuitRequested() 30 31 bool 32 PatchWin::QuitRequested() 22 33 { 23 34 be_app->PostMessage(B_QUIT_REQUESTED); 24 35 return true; 25 36 } 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 */ 7 13 8 14 #ifndef _PatchWin_h 9 15 #define _PatchWin_h … … public: 18 24 PatchWin(); 19 25 bool QuitRequested(); 20 26 private: 21 PatchView* m_patchView;27 PatchView* fPatchView; 22 28 }; 23 29 24 30 #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.cpp4 //5 // Written by: Robert Polic6 //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 tip20 #define kVER_MARGIN 3 // ver. gap between frame and tip21 #define kTIP_HOR_OFFSET 10 // tip position right of cursor22 #define kTIP_VER_OFFSET 16 // tip position below cursor23 #define kSLOP 4 // mouse slop before tip hides24 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_FRAME29 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 highlight32 const rgb_color kDARK_VIEW_COLOR = {175, 123, 0, 255}; // bottom right frame highlight33 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 view43 AddChild(fView = new TToolTipView(settings));44 // start the message loop thread45 Run();46 }47 48 //--------------------------------------------------------------------49 50 void TToolTip::MessageReceived(BMessage *msg)51 {52 switch (msg->what) {53 // forward interesting messages to the view54 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 settings85 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 passed90 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 tip98 fString = (char *)malloc(1);99 fString[0] = 0;100 101 // initialize the view102 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 thread113 fTip.quit = true;114 wait_for_thread(fThread, &status);115 116 // free tip117 free(fString);118 }119 120 //--------------------------------------------------------------------121 122 void TToolTipView::AllAttached()123 {124 // initialize internal settings125 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 thread133 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 window149 #ifdef kDRAW_WINDOW_FRAME150 SetHighColor(0, 0, 0, 255);151 StrokeRect(r);152 r.InsetBy(1, 1);153 #endif154 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 position162 GetFont(&font);163 font.GetHeight(&finfo);164 MovePenTo(kHOR_MARGIN + 1, kVER_MARGIN + finfo.ascent);165 166 // truncate string if needed167 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 string174 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 parameters194 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 parameters202 AdjustWindow();203 204 // flag thread to reset205 fTip.reset = true;206 }207 break;208 209 case eToolTipStop:210 // flag thread to stop211 fTip.stop = true;212 break;213 }214 }215 216 //--------------------------------------------------------------------217 218 void TToolTipView::GetSettings(tool_tip_settings *settings)219 {220 // return current settings221 *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 fit234 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 clearance256 fTip.settings.font.GetHeight(&finfo);257 width = fTip.settings.font.StringWidth(fString) + (kHOR_MARGIN * 2); // string width258 height = (finfo.ascent + finfo.descent + finfo.leading) + (kVER_MARGIN * 2); // string height259 260 // calculate new position and size of window261 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 update283 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.h4 //5 // Written by: Robert Polic6 //7 //--------------------------------------------------------------------8 9 #ifndef T_TOOL_TIPS_H10 #define T_TOOL_TIPS_H11 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 settings20 struct tool_tip_settings {21 bool enabled; // flag whether tips are enables or not22 bool one_time_only; // flag to only display the tip once per time in view23 bigtime_t delay; // delay before tip is shown in microseconds24 bigtime_t hold; // amount of time tip is displayed in microseconds25 BFont font; // font tip is drawn in26 };27 28 // internal settings29 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 13 14 #ifndef _UnknownDeviceIcons_h 14 15 #define _UnknownDeviceIcons_h 15 16 16 17 namespace UnknownDevice { 17 18 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 20 const 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 102 101 }; 103 102 104 103 }