* Fixed volume change via mouse wheel over the replicant icon regression.

See #2323.
* Also fixed the mouse wheel not working once the volume value equaled -1.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31582 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-07-15 09:16:12 +00:00
parent 2cff698572
commit 648b674d3f
3 changed files with 21 additions and 16 deletions
+6 -3
View File
@@ -84,7 +84,8 @@ private:
MediaReplicant::MediaReplicant(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),
fVolumeSlider(NULL) fVolumeSlider(NULL)
{ {
_Init(); _Init();
@@ -92,7 +93,8 @@ MediaReplicant::MediaReplicant(BRect frame, const char* name,
MediaReplicant::MediaReplicant(BMessage* message) MediaReplicant::MediaReplicant(BMessage* message)
: BView(message), :
BView(message),
fVolumeSlider(NULL) fVolumeSlider(NULL)
{ {
_Init(); _Init();
@@ -258,7 +260,8 @@ MediaReplicant::MessageReceived(BMessage *message)
float deltaY; float deltaY;
if (message->FindFloat("be:wheel_delta_y", &deltaY) == B_OK if (message->FindFloat("be:wheel_delta_y", &deltaY) == B_OK
&& deltaY != 0.0) { && deltaY != 0.0) {
MixerControl mixerControl(fVolumeWhich); MixerControl mixerControl;
mixerControl.Connect(fVolumeWhich);
mixerControl.ChangeVolumeBy(deltaY < 0 ? 6 : -6); mixerControl.ChangeVolumeBy(deltaY < 0 ? 6 : -6);
} }
break; break;
+1 -1
View File
@@ -23,7 +23,7 @@ class BContinuousParameter;
class MixerControl { class MixerControl {
public: public:
MixerControl(int32 volumeWhich); MixerControl(int32 volumeWhich = VOLUME_USE_MIXER);
~MixerControl(); ~MixerControl();
bool Connect(int32 volumeWhich, float* _value = NULL, bool Connect(int32 volumeWhich, float* _value = NULL,
+5 -3
View File
@@ -36,7 +36,8 @@ static const uint32 kMsgReconnectVolume = 'rcms';
VolumeControl::VolumeControl(int32 volumeWhich, bool beep, BMessage* message) VolumeControl::VolumeControl(int32 volumeWhich, bool beep, BMessage* message)
: BSlider("VolumeControl", "Volume", message, 0, 1, B_HORIZONTAL), :
BSlider("VolumeControl", "Volume", message, 0, 1, B_HORIZONTAL),
fMixerControl(new MixerControl(volumeWhich)), fMixerControl(new MixerControl(volumeWhich)),
fBeep(beep), fBeep(beep),
fSnapping(false), fSnapping(false),
@@ -56,7 +57,8 @@ VolumeControl::VolumeControl(int32 volumeWhich, bool beep, BMessage* message)
VolumeControl::VolumeControl(BMessage* archive) VolumeControl::VolumeControl(BMessage* archive)
: BSlider(archive), :
BSlider(archive),
fMixerControl(NULL), fMixerControl(NULL),
fSnapping(false), fSnapping(false),
fConnectRetries(0) fConnectRetries(0)
@@ -245,7 +247,7 @@ VolumeControl::MessageReceived(BMessage* msg)
switch (msg->what) { switch (msg->what) {
case B_MOUSE_WHEEL_CHANGED: case B_MOUSE_WHEEL_CHANGED:
{ {
if (Value() == -1) if (!fMixerControl->Connected())
return; return;
// Even though the volume bar is horizontal, we use the more common // Even though the volume bar is horizontal, we use the more common