desklink: Replaced muted speaker icon with stippi's version

* Replaced the muted speaker icon with a new one, thanks Stephan!
* Moved speaker icons into resources.
This commit is contained in:
Axel Dörfler 2018-11-03 12:39:15 +00:00
parent bae2263db9
commit 49135c955b
5 changed files with 93 additions and 115 deletions

Binary file not shown.

View File

@ -13,7 +13,7 @@ BinCommand desklink :
VolumeWindow.cpp
: be libmedia.so localestub [ TargetLibsupc++ ]
: desklink.rdef
: desklink.rdef SpeakerBox.rdef
;
DoCatalogs desklink :

View File

@ -1,5 +1,5 @@
/*
* Copyright 2003-2013, Haiku. All rights reserved.
* Copyright 2003-2018, Haiku. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -29,6 +29,7 @@
#include <MenuItem.h>
#include <Path.h>
#include <PopUpMenu.h>
#include <Resources.h>
#include <Roster.h>
#include <String.h>
#include <StringView.h>
@ -37,7 +38,6 @@
#include <ToolTipManager.h>
#include "desklink.h"
#include "iconfile.h"
#include "MixerControl.h"
#include "VolumeWindow.h"
@ -141,6 +141,7 @@ private:
void _LoadSettings();
void _SaveSettings();
void _Init();
BBitmap* _LoadIcon(BResources& resources, const char* name);
void _DisconnectMixer();
status_t _ConnectMixer();
@ -158,6 +159,23 @@ private:
};
status_t
our_image(image_info& image)
{
int32 cookie = 0;
while (get_next_image_info(B_CURRENT_TEAM, &cookie, &image) == B_OK) {
if ((char*)our_image >= (char*)image.text
&& (char*)our_image <= (char*)image.text + image.text_size)
return B_OK;
}
return B_ERROR;
}
// #pragma mark -
MediaReplicant::MediaReplicant(BRect frame, const char* name,
uint32 resizeMask, uint32 flags)
:
@ -527,14 +545,20 @@ MediaReplicant::_SaveSettings()
void
MediaReplicant::_Init()
{
fIcon = new BBitmap(BRect(0, 0, kSpeakerWidth - 1, kSpeakerHeight - 1),
B_RGBA32);
BIconUtils::GetVectorIcon(kSpeakerIcon, sizeof(kSpeakerIcon), fIcon);
image_info info;
if (our_image(info) != B_OK)
return;
fMutedIcon = new BBitmap(BRect(0, 0, kSpeakerWidth - 1, kSpeakerHeight - 1),
B_RGBA32);
BIconUtils::GetVectorIcon(kMutedSpeakerIcon, sizeof(kMutedSpeakerIcon),
fMutedIcon);
BFile file(info.name, B_READ_ONLY);
if (file.InitCheck() != B_OK)
return;
BResources resources(&file);
if (resources.InitCheck() != B_OK)
return;
fIcon = _LoadIcon(resources, "Speaker");
fMutedIcon = _LoadIcon(resources, "SpeakerMuted");
_LoadSettings();
@ -542,6 +566,25 @@ MediaReplicant::_Init()
}
BBitmap*
MediaReplicant::_LoadIcon(BResources& resources, const char* name)
{
size_t size;
const void* data = resources.LoadResource(B_VECTOR_ICON_TYPE, name, &size);
if (data == NULL)
return NULL;
// Scale tray icon
BBitmap* icon = new BBitmap(Bounds(), B_RGBA32);
if (icon->InitCheck() != B_OK
|| BIconUtils::GetVectorIcon((const uint8*)data, size, icon) != B_OK) {
delete icon;
return NULL;
}
return icon;
}
void
MediaReplicant::_DisconnectMixer()
{

View File

@ -0,0 +1,40 @@
resource(42, "Speaker") #'VICN' array {
$"6E6369660B0401740500020016023BEC7C3D464BBDC2113C40664A53A4492170"
$"00DDFFC5020016023B9E032FED63B0F24F3CB6C14A533F3ABE8400FFFFC50200"
$"1602395E1E32DB49B6921A3D07D74A57904908D60064FF8C050102031604BEBE"
$"2BBEE9573EE957BEBE2B48B7784A2FD30001C270D073FFFF020116033B400000"
$"00000000003C200048400049E000BE4B0084FF32020316023C4E213D44DABD44"
$"DA3C4E214926894A428EA143FFFF02031603BC6B27BD2F9C3D2F9CBC6B2748B0"
$"FD4A3D7C2A01B228FFFF0300FF00070A0446604E60604C54470A04262B264E46"
$"5E46340A044635465E564E562A0A04262B4635562A39220A06262B264E465E56"
$"4E562A39220204B9A5BB36BC06BA55B744BC17B77347B649BF5FB89EC5B6BDDE"
$"C6B1BB7DC792C03FC5D0C011BF5DC13BC288BEE6BC310204C01CC7C1C06DC7A8"
$"BFCBC7DABFC6C8B1BFA5C845BFE8C91CC095C946C044C95FC0E6C92DC0EBC856"
$"C10CC8C2C0C9C7EB0C0A0001002021210A0101041001178400040A020101000A"
$"030103000A040102000A0501051001178400040A060105000A070105023DBBBB"
$"0000000000003DBBBB4744444862220A0801051A3FA0000000000000003FA000"
$"41FFFB42FFFD13FF01178100040A0901051A3F38270000000000003F3DFB4432"
$"8545595C13FF01178200040A0101061001178200040A0A010600"
};
resource(43, "SpeakerMuted") #'VICN' array {
$"6E6369660E0401740500020016023BEC7C3D464BBDC2113C40664A53A4492170"
$"00DDFFC5020016023B9E032FED63B0F24F3CB6C14A533F3ABE8400FFFFC50200"
$"1602395E1E32DB49B6921A3D07D74A57904908D60064FF8C050102031604BEBE"
$"2BBEE9573EE957BEBE2B48B7784A2FD30001C270D073FFFF020116033B400000"
$"00000000003C200048400049E000BE4B0084FF32020316023C4E213D44DABD44"
$"DA3C4E214926894A428EA143FFFF02031603BC6B27BD2F9C3D2F9CBC6B2748B0"
$"FD4A3D7C2A01B228FFFF0300FF0004003903800000020006020000003B4000C0"
$"00000000004C00004AB00000FFABABFFEA0606080A0446604E60604C54470A04"
$"262B264E465E46340A044635465E564E562A0A04262B4635562A39220A06262B"
$"264E465E564E562A39220204B9A5BB36BC06BA55B744BC17B77347B649BF5FB8"
$"9EC5B6BDDEC6B1BB7DC792C03FC5D0C011BF5DC13BC288BEE6BC310204C01CC7"
$"C1C06DC7A8BFCBC7DABFC6C8B1BFA5C845BFE8C91CC095C946C044C95FC0E6C9"
$"2DC0EBC856C10CC8C2C0C9C7EB0A0C4A4C4056445A4E50585A5C56524C5C4258"
$"3E4E48443E40420E0A0001002021210A0101041001178400040A020101000A03"
$"0103000A040102000A0501051001178400040A060105000A070105023DBBBB00"
$"00000000003DBBBB4744444862220A0801051A3FA0000000000000003FA00041"
$"FFFB42FFFD13FF01178100040A0901051A3F38270000000000003F3DFB443285"
$"45595C13FF01178200040A0101061001178200040A0A0106000A0C0107100117"
$"8422040A0D010700"
};

View File

@ -1,105 +0,0 @@
/*
* Copyright 2003-2010, Haiku. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Jérôme Duval
* Stephan Aßmus <superstippi@gmx.de>
*/
const int32 kSpeakerWidth = 16;
const int32 kSpeakerHeight = 16;
const unsigned char kSpeakerIcon[] = {
0x6e, 0x63, 0x69, 0x66, 0x0b, 0x04, 0x01, 0x74, 0x05, 0x00, 0x02, 0x00,
0x16, 0x02, 0x3b, 0xec, 0x7c, 0x3d, 0x46, 0x4b, 0xbd, 0xc2, 0x11, 0x3c,
0x40, 0x66, 0x4a, 0x53, 0xa4, 0x49, 0x21, 0x70, 0x00, 0xdd, 0xff, 0xc5,
0x02, 0x00, 0x16, 0x02, 0x3b, 0x9e, 0x03, 0x2f, 0xed, 0x63, 0xb0, 0xf2,
0x4f, 0x3c, 0xb6, 0xc1, 0x4a, 0x53, 0x3f, 0x3a, 0xbe, 0x84, 0x00, 0xff,
0xff, 0xc5, 0x02, 0x00, 0x16, 0x02, 0x39, 0x5e, 0x1e, 0x32, 0xdb, 0x49,
0xb6, 0x92, 0x1a, 0x3d, 0x07, 0xd7, 0x4a, 0x57, 0x90, 0x49, 0x08, 0xd6,
0x00, 0x64, 0xff, 0x8c, 0x05, 0x01, 0x02, 0x03, 0x16, 0x04, 0xbe, 0xbe,
0x2b, 0xbe, 0xe9, 0x57, 0x3e, 0xe9, 0x57, 0xbe, 0xbe, 0x2b, 0x48, 0xb7,
0x78, 0x4a, 0x2f, 0xd3, 0x00, 0x01, 0xc2, 0x70, 0xd0, 0x73, 0xff, 0xff,
0x02, 0x01, 0x16, 0x03, 0x3b, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x3c, 0x20, 0x00, 0x48, 0x40, 0x00, 0x49, 0xe0, 0x00, 0xbe, 0x4b,
0x00, 0x84, 0xff, 0x32, 0x02, 0x03, 0x16, 0x02, 0x3c, 0x4e, 0x21, 0x3d,
0x44, 0xda, 0xbd, 0x44, 0xda, 0x3c, 0x4e, 0x21, 0x49, 0x26, 0x89, 0x4a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x56, 0xc1, 0x0c, 0xc8, 0xc2, 0xc0, 0xc9, 0xc7, 0xeb,
0x0c, 0x0a, 0x00, 0x01, 0x00, 0x20, 0x21, 0x21, 0x0a, 0x01, 0x01, 0x04,
0x10, 0x01, 0x17, 0x84, 0x00, 0x04, 0x0a, 0x02, 0x01, 0x01, 0x00, 0x0a,
0x03, 0x01, 0x03, 0x00, 0x0a, 0x04, 0x01, 0x02, 0x00, 0x0a, 0x05, 0x01,
0x05, 0x10, 0x01, 0x17, 0x84, 0x00, 0x04, 0x0a, 0x06, 0x01, 0x05, 0x00,
0x0a, 0x07, 0x01, 0x05, 0x02, 0x3d, 0xbb, 0xbb, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3d, 0xbb, 0xbb, 0x47, 0x44, 0x44, 0x48, 0x62, 0x22, 0x0a,
0x08, 0x01, 0x05, 0x1a, 0x3f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x3f, 0xa0, 0x00, 0x41, 0xff, 0xfb, 0x42, 0xff, 0xfd, 0x13, 0xff,
0x01, 0x17, 0x81, 0x00, 0x04, 0x0a, 0x09, 0x01, 0x05, 0x1a, 0x3f, 0x38,
0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3d, 0xfb, 0x44, 0x32,
0x85, 0x45, 0x59, 0x5c, 0x13, 0xff, 0x01, 0x17, 0x82, 0x00, 0x04, 0x0a,
0x01, 0x01, 0x06, 0x10, 0x01, 0x17, 0x82, 0x00, 0x04, 0x0a, 0x0a, 0x01,
0x06, 0x00
};
const unsigned char kMutedSpeakerIcon[] = {
0x6e, 0x63, 0x69, 0x66, 0x0b, 0x04, 0x01, 0x74, 0x05, 0x00, 0x02, 0x00,
0x16, 0x02, 0x3b, 0xec, 0x7c, 0x3d, 0x46, 0x4b, 0xbd, 0xc2, 0x11, 0x3c,
0x40, 0x66, 0x4a, 0x53, 0xa4, 0x49, 0x21, 0x70, 0x00, 0xdd, 0xff, 0xc5,
0x02, 0x00, 0x16, 0x02, 0x3b, 0x9e, 0x03, 0x2f, 0xed, 0x63, 0xb0, 0xf2,
0x4f, 0x3c, 0xb6, 0xc1, 0x4a, 0x53, 0x3f, 0x3a, 0xbe, 0x84, 0x00, 0xff,
0xff, 0xc5, 0x02, 0x00, 0x16, 0x02, 0x39, 0x5e, 0x1e, 0x32, 0xdb, 0x49,
0xb6, 0x92, 0x1a, 0x3d, 0x07, 0xd7, 0x4a, 0x57, 0x90, 0x49, 0x08, 0xd6,
0x00, 0x64, 0xff, 0x8c, 0x05, 0x01, 0x02, 0x03, 0x16, 0x04, 0xbe, 0xbe,
0x2b, 0xbe, 0xe9, 0x57, 0x3e, 0xe9, 0x57, 0xbe, 0xbe, 0x2b, 0x48, 0xb7,
0x78, 0x4a, 0x2f, 0xd3, 0x00, 0x01, 0xc2, 0x70, 0xd0, 0x73, 0xff, 0xff,
0x02, 0x01, 0x16, 0x03, 0x3b, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x3c, 0x20, 0x00, 0x48, 0x40, 0x00, 0x49, 0xe0, 0x00, 0x00, 0x84,
0xbe, 0x4b, 0xff, 0x32, 0x02, 0x03, 0x16, 0x02, 0x3c, 0x4e, 0x21, 0x3d,
0x44, 0xda, 0xbd, 0x44, 0xda, 0x3c, 0x4e, 0x21, 0x49, 0x26, 0x89, 0x4a,
0x42, 0x8e, 0xa1, 0x43, 0xff, 0xff, 0x02, 0x03, 0x16, 0x03, 0xbc, 0x6b,
0x27, 0xbd, 0x2f, 0x9c, 0x3d, 0x2f, 0x9c, 0xbc, 0x6b, 0x27, 0x48, 0xb0,
0xfd, 0x4a, 0x3d, 0x7c, 0x2a, 0x01, 0xb2, 0x28, 0xff, 0xff, 0x03, 0xff,
0x00, 0x00, 0x09, 0x0a, 0x04, 0x46, 0x60, 0x4e, 0x60, 0x60, 0x4c, 0x54,
0x47, 0x0a, 0x04, 0x26, 0x2b, 0x26, 0x4e, 0x46,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, 0x10, 0x01, 0x17, 0x84, 0x00, 0x04, 0x0a, 0x06, 0x01, 0x05, 0x00,
0x0a, 0x07, 0x01, 0x05, 0x02, 0x3d, 0xbb, 0xbb, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3d, 0xbb, 0xbb, 0x47, 0x44, 0x44, 0x48, 0x62, 0x22, 0x0a,
0x08, 0x01, 0x05, 0x1a, 0x3f, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x3f, 0xa0, 0x00, 0x41, 0xff, 0xfb, 0x42, 0xff, 0xfd, 0x13, 0xff,
0x01, 0x17, 0x81, 0x00, 0x04, 0x0a, 0x09, 0x01, 0x05, 0x1a, 0x3f, 0x38,
0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3d, 0xfb, 0x44, 0x32,
0x85, 0x45, 0x59, 0x5c, 0x13, 0xff, 0x01, 0x17, 0x82, 0x00, 0x04, 0x0a,
0x01, 0x01, 0x06, 0x10, 0x01, 0x17, 0x82, 0x00, 0x04, 0x0a, 0x0a, 0x01,
0x06, 0x00, 0x0a, 0x0a, 0x01, 0x07, 0x10, 0x01, 0x17, 0x86, 0x22, 0x04,
0x0a, 0x0a, 0x01, 0x08, 0x10, 0x01, 0x17, 0x86, 0x20, 0x04
};