From 1666648e29ce7601fb86f5efef12561b02b8bc94 Mon Sep 17 00:00:00 2001 From: Niklas Poslovski Date: Sun, 5 Jan 2025 10:14:50 +0100 Subject: [PATCH] Try to solve the interface_kit/ChannelSlider thing,but it doesn't work Change-Id: I54592ef4437a608552049fcedfebb789d0d9fb71 --- headers/os/interface/ChannelSlider.h | 2 ++ src/kits/interface/ChannelSlider.cpp | 11 ++++++++++- src/kits/media/DefaultMediaTheme.cpp | 9 +++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/headers/os/interface/ChannelSlider.h b/headers/os/interface/ChannelSlider.h index 5151ef14b1..e057a7b3a5 100644 --- a/headers/os/interface/ChannelSlider.h +++ b/headers/os/interface/ChannelSlider.h @@ -84,6 +84,8 @@ public: virtual float ThumbDeltaFor(int32 channel); virtual float ThumbRangeFor(int32 channel); + virtual void FormatToolTip(char* valueString, int32 currentValue); + private: // FBC padding BChannelSlider(const BChannelSlider&); diff --git a/src/kits/interface/ChannelSlider.cpp b/src/kits/interface/ChannelSlider.cpp index 20917fc477..29952d8917 100644 --- a/src/kits/interface/ChannelSlider.cpp +++ b/src/kits/interface/ChannelSlider.cpp @@ -701,6 +701,15 @@ BChannelSlider::ThumbRangeFor(int32 channel) } +void +BChannelSlider::FormatToolTip(char* valueString, int32 currentValue) +{ + printf("called......"); + printf("%d", currentValue); + snprintf(valueString, 32, "%" B_PRId32, currentValue); +} + + // #pragma mark - @@ -822,7 +831,7 @@ BChannelSlider::_DrawThumbs() // draw some kind of current value tool tip if (fCurrentChannel != -1 && fMinPoint != 0) { char valueString[32]; - snprintf(valueString, 32, "%.1f", ValueFor(fCurrentChannel) / 1000.0); + FormatToolTip(valueString, ValueFor(fCurrentChannel)); SetToolTip(valueString); ShowToolTip(ToolTip()); } else { diff --git a/src/kits/media/DefaultMediaTheme.cpp b/src/kits/media/DefaultMediaTheme.cpp index c292b7c491..ca7ad7b929 100644 --- a/src/kits/media/DefaultMediaTheme.cpp +++ b/src/kits/media/DefaultMediaTheme.cpp @@ -104,6 +104,7 @@ class ChannelSlider : public BChannelSlider { virtual void AttachedToWindow(); virtual void DetachedFromWindow(); + //virtual void FormatTooltip(char* valueString, int32 currentValue); private: BContinuousParameter &fParameter; }; @@ -437,6 +438,14 @@ ChannelSlider::DetachedFromWindow() } + +/*void +ChannelSlider::FormatTooltip(char* valueString, int32 currentValue) +{ + snprintf(valueString, 32, "%.1f", currentValue / 1000.0); +}*/ + + TextControl::TextControl(const char* name, const char* label, BTextParameter ¶meter) : BTextControl(name, label, "", NULL), -- 2.45.2