changed the class VCButton to MediaReplicant because the Media preferences

asks for that name when removing it, and the view name must match the class name.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5224 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2003-11-01 01:24:29 +00:00
parent 5e69d7c826
commit 0443cf316f

View File

@ -43,27 +43,29 @@
#define TOGGLE_DONT_BEEP 'tdbp' #define TOGGLE_DONT_BEEP 'tdbp'
#define SET_VOLUME_WHICH 'svwh' #define SET_VOLUME_WHICH 'svwh'
#define VOLUME_CTL_NAME "MediaReplicant" /* R5 name needed, Media prefs manel removes by name */
#define SETTINGS_FILE "x-vnd.OBOS.DeskbarVolumeControlSettings" #define SETTINGS_FILE "x-vnd.OBOS.DeskbarVolumeControlSettings"
const char *app_signature = "application/x-vnd.be.desklink"; const char *app_signature = "application/x-vnd.be.desklink";
// the application signature used by the replicant to find the supporting // the application signature used by the replicant to find the supporting
// code // code
class _EXPORT VCButton; class _EXPORT MediaReplicant;
// the dragger part has to be exported // the dragger part has to be exported
class VCButton : public BView { class MediaReplicant : public BView {
public: public:
VCButton(BRect frame, const char *name, MediaReplicant(BRect frame, const char *name,
uint32 resizeMask = B_FOLLOW_ALL, uint32 resizeMask = B_FOLLOW_ALL,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE | B_PULSE_NEEDED); uint32 flags = B_WILL_DRAW | B_NAVIGABLE | B_PULSE_NEEDED);
VCButton(BMessage *); MediaReplicant(BMessage *);
// BMessage * based constructor needed to support archiving // BMessage * based constructor needed to support archiving
virtual ~VCButton(); virtual ~MediaReplicant();
// archiving overrides // archiving overrides
static VCButton *Instantiate(BMessage *data); static MediaReplicant *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const; virtual status_t Archive(BMessage *data, bool deep = true) const;
@ -92,11 +94,11 @@ extern "C" _EXPORT BView* instantiate_deskbar_item();
BView * BView *
instantiate_deskbar_item() instantiate_deskbar_item()
{ {
return new VCButton(BRect(0, 0, 16, 16), "VCButton"); return new MediaReplicant(BRect(0, 0, 16, 16), VOLUME_CTL_NAME);
} }
VCButton::VCButton(BRect frame, const char *name, MediaReplicant::MediaReplicant(BRect frame, const char *name,
uint32 resizeMask, uint32 flags) uint32 resizeMask, uint32 flags)
: BView(frame, name, resizeMask, flags) : BView(frame, name, resizeMask, flags)
{ {
@ -117,7 +119,7 @@ VCButton::VCButton(BRect frame, const char *name,
} }
VCButton::VCButton(BMessage *message) MediaReplicant::MediaReplicant(BMessage *message)
: BView(message), : BView(message),
volumeSlider(NULL) volumeSlider(NULL)
{ {
@ -128,7 +130,7 @@ VCButton::VCButton(BMessage *message)
} }
VCButton::~VCButton() MediaReplicant::~MediaReplicant()
{ {
delete segments; delete segments;
SaveSettings(); SaveSettings();
@ -136,17 +138,17 @@ VCButton::~VCButton()
// archiving overrides // archiving overrides
VCButton * MediaReplicant *
VCButton::Instantiate(BMessage *data) MediaReplicant::Instantiate(BMessage *data)
{ {
if (!validate_instantiation(data, "VCButton")) if (!validate_instantiation(data, VOLUME_CTL_NAME))
return NULL; return NULL;
return new VCButton(data); return new MediaReplicant(data);
} }
status_t status_t
VCButton::Archive(BMessage *data, bool deep) const MediaReplicant::Archive(BMessage *data, bool deep) const
{ {
BView::Archive(data, deep); BView::Archive(data, deep);
@ -156,7 +158,7 @@ VCButton::Archive(BMessage *data, bool deep) const
void void
VCButton::MessageReceived(BMessage *message) MediaReplicant::MessageReceived(BMessage *message)
{ {
switch (message->what) { switch (message->what) {
case B_ABOUT_REQUESTED: case B_ABOUT_REQUESTED:
@ -190,7 +192,7 @@ VCButton::MessageReceived(BMessage *message)
void void
VCButton::Draw(BRect rect) MediaReplicant::Draw(BRect rect)
{ {
BView::Draw(rect); BView::Draw(rect);
@ -200,7 +202,7 @@ VCButton::Draw(BRect rect)
void void
VCButton::MouseDown(BPoint point) MediaReplicant::MouseDown(BPoint point)
{ {
uint32 mouseButtons; uint32 mouseButtons;
BPoint where; BPoint where;
@ -247,12 +249,12 @@ VCButton::MouseDown(BPoint point)
void void
VCButton::MouseUp(BPoint point) MediaReplicant::MouseUp(BPoint point)
{ {
/* don't Quit() ! thanks for FFM users */ /* don't Quit() ! thanks for FFM users */
} }
void VCButton::LoadSettings() void MediaReplicant::LoadSettings()
{ {
confDontBeep = false; confDontBeep = false;
confVolumeWhich = VOLUME_USE_MIXER; confVolumeWhich = VOLUME_USE_MIXER;
@ -270,7 +272,7 @@ void VCButton::LoadSettings()
msg.FindBool("dontbeep", &confDontBeep); msg.FindBool("dontbeep", &confDontBeep);
} }
void VCButton::SaveSettings() void MediaReplicant::SaveSettings()
{ {
BPath p; BPath p;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &p, false) < B_OK) if (find_directory(B_USER_SETTINGS_DIRECTORY, &p, false) < B_OK)