interface_kit/ChannelSlider: Divide value by 1000 and show one digit after the point.

Fixes #17600

Change-Id: I4357655915270e0ed61f0ce305f299555578bb8b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8384
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Niklas Poslovski 2024-10-01 17:59:58 +02:00 committed by waddlesplash
parent 7bd2986f91
commit 08028803b1
3 changed files with 22 additions and 6 deletions

View File

@ -84,6 +84,8 @@ public:
virtual float ThumbDeltaFor(int32 channel);
virtual float ThumbRangeFor(int32 channel);
virtual void UpdateToolTip(int32 currentValue);
private:
// FBC padding
BChannelSlider(const BChannelSlider&);
@ -97,7 +99,6 @@ private:
virtual void _Reserved_BChannelSlider_4(void*, ...);
virtual void _Reserved_BChannelSlider_5(void*, ...);
virtual void _Reserved_BChannelSlider_6(void*, ...);
virtual void _Reserved_BChannelSlider_7(void*, ...);
private:
void _InitData();

View File

@ -701,6 +701,15 @@ BChannelSlider::ThumbRangeFor(int32 channel)
}
void
BChannelSlider::UpdateToolTip(int32 currentValue)
{
BString valueString;
valueString.SetToFormat("%" B_PRId32, currentValue);
SetToolTip(valueString);
}
// #pragma mark -
@ -821,10 +830,7 @@ BChannelSlider::_DrawThumbs()
// draw some kind of current value tool tip
if (fCurrentChannel != -1 && fMinPoint != 0) {
char valueString[32];
snprintf(valueString, 32, "%" B_PRId32,
ValueFor(fCurrentChannel));
SetToolTip(valueString);
UpdateToolTip(ValueFor(fCurrentChannel));
ShowToolTip(ToolTip());
} else {
HideToolTip();
@ -900,4 +906,3 @@ void BChannelSlider::_Reserved_BChannelSlider_3(void*, ...) {}
void BChannelSlider::_Reserved_BChannelSlider_4(void*, ...) {}
void BChannelSlider::_Reserved_BChannelSlider_5(void*, ...) {}
void BChannelSlider::_Reserved_BChannelSlider_6(void*, ...) {}
void BChannelSlider::_Reserved_BChannelSlider_7(void*, ...) {}

View File

@ -104,6 +104,7 @@ class ChannelSlider : public BChannelSlider {
virtual void AttachedToWindow();
virtual void DetachedFromWindow();
virtual void UpdateToolTip(int32 currentValue);
private:
BContinuousParameter &fParameter;
};
@ -432,6 +433,15 @@ ChannelSlider::DetachedFromWindow()
}
void
ChannelSlider::UpdateToolTip(int32 currentValue)
{
BString valueString;
valueString.SetToFormat("%.1f", currentValue / 1000.0);
SetToolTip(valueString);
}
TextControl::TextControl(const char* name, const char* label,
BTextParameter &parameter)
: BTextControl(name, label, "", NULL),