* 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,
uint32 resizeMask, uint32 flags)
: BView(frame, name, resizeMask, flags),
:
BView(frame, name, resizeMask, flags),
fVolumeSlider(NULL)
{
_Init();
@@ -92,7 +93,8 @@ MediaReplicant::MediaReplicant(BRect frame, const char* name,
MediaReplicant::MediaReplicant(BMessage* message)
: BView(message),
:
BView(message),
fVolumeSlider(NULL)
{
_Init();
@@ -258,7 +260,8 @@ MediaReplicant::MessageReceived(BMessage *message)
float deltaY;
if (message->FindFloat("be:wheel_delta_y", &deltaY) == B_OK
&& deltaY != 0.0) {
MixerControl mixerControl(fVolumeWhich);
MixerControl mixerControl;
mixerControl.Connect(fVolumeWhich);
mixerControl.ChangeVolumeBy(deltaY < 0 ? 6 : -6);
}
break;
+1 -1
View File
@@ -23,7 +23,7 @@ class BContinuousParameter;
class MixerControl {
public:
MixerControl(int32 volumeWhich);
MixerControl(int32 volumeWhich = VOLUME_USE_MIXER);
~MixerControl();
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)
: BSlider("VolumeControl", "Volume", message, 0, 1, B_HORIZONTAL),
:
BSlider("VolumeControl", "Volume", message, 0, 1, B_HORIZONTAL),
fMixerControl(new MixerControl(volumeWhich)),
fBeep(beep),
fSnapping(false),
@@ -56,7 +57,8 @@ VolumeControl::VolumeControl(int32 volumeWhich, bool beep, BMessage* message)
VolumeControl::VolumeControl(BMessage* archive)
: BSlider(archive),
:
BSlider(archive),
fMixerControl(NULL),
fSnapping(false),
fConnectRetries(0)
@@ -245,7 +247,7 @@ VolumeControl::MessageReceived(BMessage* msg)
switch (msg->what) {
case B_MOUSE_WHEEL_CHANGED:
{
if (Value() == -1)
if (!fMixerControl->Connected())
return;
// Even though the volume bar is horizontal, we use the more common