From f2f96e6f066c3037816334aff3d8c67c2ff34f14 Mon Sep 17 00:00:00 2001 From: beveloper Date: Mon, 8 Sep 2003 17:48:17 +0000 Subject: [PATCH] small tweak to allow control of continuous parameter range 0.0 to 1.0 git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4564 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/media/DefaultMediaTheme.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kits/media/DefaultMediaTheme.cpp b/src/kits/media/DefaultMediaTheme.cpp index 0105fd7e6a..8d9a532b07 100644 --- a/src/kits/media/DefaultMediaTheme.cpp +++ b/src/kits/media/DefaultMediaTheme.cpp @@ -280,11 +280,11 @@ ContinuousMessageFilter::ContinuousMessageFilter(BControl *control, BContinuousP } if (BSlider *slider = dynamic_cast(control)) { - slider->SetValue((int32)value[0]); + slider->SetValue((int32) (1000 * value[0])); slider->SetModificationMessage(new BMessage(kMsgParameterChanged)); } else if (BChannelSlider *slider = dynamic_cast(control)) { for (int32 i = 0; i < fParameter.CountChannels(); i++) - slider->SetValueFor(i, (int32)value[i]); + slider->SetValueFor(i, (int32) (1000 * value[i])); slider->SetModificationMessage(new BMessage(kMsgParameterChanged)); } else @@ -312,10 +312,10 @@ ContinuousMessageFilter::Filter(BMessage *message, BHandler **target) float value[fParameter.CountChannels()]; if (BSlider *slider = dynamic_cast(control)) { - value[0] = (float)slider->Value(); + value[0] = (float)(slider->Value() / 1000.0); } else if (BChannelSlider *slider = dynamic_cast(control)) { for (int32 i = 0; i < fParameter.CountChannels(); i++) - value[i] = (float)slider->ValueFor(i); + value[i] = (float)(slider->ValueFor(i) / 1000.0); } printf("update view %s, %ld channels\n", control->Name(), fParameter.CountChannels()); @@ -742,7 +742,7 @@ DefaultMediaTheme::MakeViewFor(BParameter *parameter, const BRect *hintRect) // ToDo: take BContinuousParameter::GetResponse() & ValueStep() into account! for (int32 i = 0; i < continuous.CountChannels(); i++) - slider->SetLimitsFor(i, continuous.MinValue(), continuous.MaxValue()); + slider->SetLimitsFor(i, continuous.MinValue() * 1000, continuous.MaxValue() * 1000); return slider; }