* fix small mem leak

* whitespace cleanup, etc
* some renaming to fit Haiku style



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28856 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Karsten Heimrich
2009-01-08 15:48:10 +00:00
parent 359176d906
commit e6753e37c6
2 changed files with 282 additions and 297 deletions
+92 -116
View File
@@ -10,148 +10,124 @@
/ /
*******************************************************************************/ *******************************************************************************/
#if !defined(_CHANNEL_SLIDER_H) #ifndef _CHANNEL_SLIDER_H
#define _CHANNEL_SLIDER_H #define _CHANNEL_SLIDER_H
#include <ChannelControl.h> #include <ChannelControl.h>
class BChannelSlider :
public BChannelControl class BChannelSlider : public BChannelControl
{ {
public: public:
BChannelSlider( BChannelSlider(BRect area, const char* name,
BRect area, const char* label, BMessage* message,
const char * name, int32 channels = 1,
const char * label, uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP,
BMessage * model, uint32 flags = B_WILL_DRAW);
int32 channels = 1, BChannelSlider(BRect area, const char* name,
uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP, const char* label, BMessage* message,
uint32 flags = B_WILL_DRAW); orientation o, int32 channels = 1,
BChannelSlider( uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP,
BRect area, uint32 flags = B_WILL_DRAW);
const char * name, BChannelSlider(BMessage* archive);
const char * label,
BMessage * model,
orientation o,
int32 channels = 1,
uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW);
BChannelSlider(
BMessage * from);
virtual ~BChannelSlider(); virtual ~BChannelSlider();
static BArchivable * Instantiate(BMessage * from); static BArchivable* Instantiate(BMessage* from);
virtual status_t Archive(BMessage * into, bool deep = true) const; virtual status_t Archive(BMessage* into, bool deep = true) const;
virtual orientation Orientation() const; virtual orientation Orientation() const;
void SetOrientation(orientation o); void SetOrientation(orientation o);
virtual int32 MaxChannelCount() const;
virtual bool SupportsIndividualLimits() const;
virtual void AttachedToWindow(); virtual int32 MaxChannelCount() const;
virtual void AllAttached(); virtual bool SupportsIndividualLimits() const;
virtual void DetachedFromWindow();
virtual void AllDetached();
virtual void MessageReceived(BMessage *msg); virtual void AttachedToWindow();
virtual void AllAttached();
virtual void DetachedFromWindow();
virtual void AllDetached();
virtual void Draw(BRect area); virtual void MessageReceived(BMessage* msg);
virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint pt);
virtual void MouseMoved( BPoint pt,
uint32 code,
const BMessage * message);
virtual void WindowActivated(bool state);
virtual void KeyDown(const char *bytes, int32 numBytes);
virtual void KeyUp(const char *bytes, int32 numBytes);
virtual void FrameResized(float width, float height);
virtual void SetFont(const BFont *font, uint32 mask = B_FONT_ALL); virtual void Draw(BRect area);
virtual void MakeFocus(bool focusState = true); virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint pt);
virtual void MouseMoved(BPoint pt,uint32 code,
const BMessage* message);
virtual void WindowActivated(bool state);
virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void KeyUp(const char* bytes, int32 numBytes);
virtual void FrameResized(float width, float height);
virtual void SetEnabled(bool on); virtual void SetFont(const BFont* font, uint32 mask = B_FONT_ALL);
virtual void MakeFocus(bool focusState = true);
virtual void GetPreferredSize(float *width, float *height); virtual void SetEnabled(bool on);
virtual BHandler *ResolveSpecifier(BMessage *msg, virtual void GetPreferredSize(float* width, float* height);
int32 index,
BMessage *specifier,
int32 form,
const char *property);
virtual status_t GetSupportedSuites(BMessage *data);
// Perform rendering for an entire slider channel. virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index,
virtual void DrawChannel(BView* into, BMessage* specifier, int32 form, const char* p);
int32 channel, virtual status_t GetSupportedSuites(BMessage* data);
BRect area,
bool pressed);
// Draw the groove that appears behind a channel's thumb. // Perform rendering for an entire slider channel.
virtual void DrawGroove( BView* into, virtual void DrawChannel(BView* into, int32 channel, BRect area,
int32 channel, bool pressed);
BPoint tl,
BPoint br);
// Draw the thumb for a single channel. // Draw groove that appears behind a channel's thumb.
virtual void DrawThumb( BView* into, virtual void DrawGroove(BView* into, int32 channel, BPoint lt,
int32 channel, BPoint br);
BPoint where,
bool pressed );
virtual const BBitmap * ThumbFor(int32 channel, bool pressed); // Draw the thumb for a single channel.
virtual BRect ThumbFrameFor(int32 channel); virtual void DrawThumb(BView* into, int32 channel, BPoint where,
virtual float ThumbDeltaFor(int32 channel); bool pressed);
virtual float ThumbRangeFor(int32 channel);
virtual const BBitmap* ThumbFor(int32 channel, bool pressed);
virtual BRect ThumbFrameFor(int32 channel);
virtual float ThumbDeltaFor(int32 channel);
virtual float ThumbRangeFor(int32 channel);
private: private:
typedef BChannelControl inherited; BChannelSlider(const BChannelSlider &);
BChannelSlider& operator=(const BChannelSlider &);
BChannelSlider( /* unimplemented */
const BChannelSlider &);
BChannelSlider& operator=( /* unimplemented */
const BChannelSlider &);
virtual void _Reserved_BChannelSlider_0(void *, ...); virtual void _Reserved_BChannelSlider_0(void* , ...);
virtual void _Reserved_BChannelSlider_1(void *, ...); virtual void _Reserved_BChannelSlider_1(void* , ...);
virtual void _Reserved_BChannelSlider_2(void *, ...); virtual void _Reserved_BChannelSlider_2(void* , ...);
virtual void _Reserved_BChannelSlider_3(void *, ...); virtual void _Reserved_BChannelSlider_3(void* , ...);
virtual void _Reserved_BChannelSlider_4(void *, ...); virtual void _Reserved_BChannelSlider_4(void* , ...);
virtual void _Reserved_BChannelSlider_5(void *, ...); virtual void _Reserved_BChannelSlider_5(void* , ...);
virtual void _Reserved_BChannelSlider_6(void *, ...); virtual void _Reserved_BChannelSlider_6(void* , ...);
virtual void _Reserved_BChannelSlider_7(void *, ...); virtual void _Reserved_BChannelSlider_7(void* , ...);
float fBaseLine; float fBaseLine;
float fLineFeed; float fLineFeed;
BBitmap * fLeftKnob; BBitmap* fLeftKnob;
BBitmap * fMidKnob; BBitmap* fMidKnob;
BBitmap * fRightKnob; BBitmap* fRightKnob;
BBitmap * fBacking; BBitmap* fBacking;
BView * fBackingView; BView* fBackingView;
bool fVertical; bool fVertical;
bool fPadding[3]; bool fPadding[3];
BPoint fClickDelta; BPoint fClickDelta;
int32 fCurrentChannel;
bool fAllChannels;
int32* fInitialValues;
float fMinpoint;
int32 fFocusChannel;
uint32 _reserved_[12];
void InitData(); int32 fCurrentChannel;
bool fAllChannels;
void FinishChange(); int32* fInitialValues;
void UpdateFontDimens(); float fMinpoint;
void DrawThumbs(); int32 fFocusChannel;
void DrawThumbFrame(
BView * where, uint32 _reserved_[12];
const BRect & area);
bool Vertical() const; void _InitData();
void Redraw(); void _FinishChange();
void MouseMovedCommon(BPoint , BPoint ); void _UpdateFontDimens();
void _DrawThumbs();
void _DrawGrooveFrame(BView* where, const BRect& area);
bool _Vertical() const;
void _Redraw();
void _MouseMovedCommon(BPoint point, BPoint point2);
}; };
+190 -181
View File
@@ -1,9 +1,9 @@
/* /*
* Copyright 2005, Haiku Inc. All Rights Reserved. * Copyright 2005 - 2008, Haiku Inc. All Rights Reserved.
* Author: Stefano Ceccherini ([email protected]) * Author: Stefano Ceccherini ([email protected])
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#include <Bitmap.h> #include <Bitmap.h>
#include <ChannelSlider.h> #include <ChannelSlider.h>
#include <Debug.h> #include <Debug.h>
@@ -34,18 +34,22 @@ kVerticalKnobData[] = {
const static unsigned char const static unsigned char
kHorizontalKnobData[] = { kHorizontalKnobData[] = {
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0xff, 0xff, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0xff, 0xff, 0xff, 0x00, 0x3f, 0x3f,
0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xcb, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12, 0xff, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0xff, 0xff,
0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xcb, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12, 0xff, 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xcb, 0x3f, 0x3f, 0x3f, 0x3f,
0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xcb, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12, 0xff, 0x3f, 0x00, 0x12, 0xff, 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xcb,
0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xcb, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12, 0xff, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12, 0xff, 0xff, 0x00, 0x3f, 0x3f,
0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12, 0xff, 0x3f, 0x3f, 0x3f, 0xcb, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12, 0xff,
0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12, 0xff, 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xcb, 0x3f, 0x3f, 0x3f, 0x3f,
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0xff, 0x3f, 0x00, 0x12, 0xff, 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
0xff, 0xff, 0xff, 0xff, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0xff, 0xff, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12, 0xff, 0xff, 0x00, 0x3f, 0x3f,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12, 0xff,
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0c, 0x12, 0xff, 0xff, 0xff, 0xff, 0xff, 0x12, 0x12, 0x12, 0x12,
0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
}; };
@@ -55,18 +59,19 @@ sPropertyInfo[] = {
{ B_GET_PROPERTY, B_SET_PROPERTY, 0 }, { B_GET_PROPERTY, B_SET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 }, NULL, 0, { B_INT32_TYPE } { B_DIRECT_SPECIFIER, 0 }, NULL, 0, { B_INT32_TYPE }
}, },
{ 0 } { 0 }
}; };
const static float kPadding = 10.0; const static float kPadding = 10.0;
BChannelSlider::BChannelSlider(BRect area, const char *name, const char *label, BChannelSlider::BChannelSlider(BRect area, const char *name, const char *label,
BMessage *model, int32 channels, uint32 resizeMode, uint32 flags) BMessage *model, int32 channels, uint32 resizeMode, uint32 flags)
: BChannelControl(area, name, label, model, channels, resizeMode, flags) : BChannelControl(area, name, label, model, channels, resizeMode, flags)
{ {
InitData(); _InitData();
} }
@@ -75,7 +80,7 @@ BChannelSlider::BChannelSlider(BRect area, const char *name, const char *label,
: BChannelControl(area, name, label, model, channels, resizeMode, flags) : BChannelControl(area, name, label, model, channels, resizeMode, flags)
{ {
InitData(); _InitData();
SetOrientation(o); SetOrientation(o);
} }
@@ -83,7 +88,7 @@ BChannelSlider::BChannelSlider(BRect area, const char *name, const char *label,
BChannelSlider::BChannelSlider(BMessage *archive) BChannelSlider::BChannelSlider(BMessage *archive)
: BChannelControl(archive) : BChannelControl(archive)
{ {
InitData(); _InitData();
orientation orient; orientation orient;
if (archive->FindInt32("_orient", (int32 *)&orient) == B_OK) if (archive->FindInt32("_orient", (int32 *)&orient) == B_OK)
@@ -93,6 +98,7 @@ BChannelSlider::BChannelSlider(BMessage *archive)
BChannelSlider::~BChannelSlider() BChannelSlider::~BChannelSlider()
{ {
delete fBacking;
delete fLeftKnob; delete fLeftKnob;
delete fMidKnob; delete fMidKnob;
delete fRightKnob; delete fRightKnob;
@@ -124,7 +130,7 @@ BChannelSlider::Archive(BMessage *into, bool deep) const
orientation orientation
BChannelSlider::Orientation() const BChannelSlider::Orientation() const
{ {
return Vertical() ? B_VERTICAL : B_HORIZONTAL; return _Vertical() ? B_VERTICAL : B_HORIZONTAL;
} }
@@ -132,10 +138,10 @@ void
BChannelSlider::SetOrientation(orientation _orientation) BChannelSlider::SetOrientation(orientation _orientation)
{ {
bool isVertical = _orientation == B_VERTICAL; bool isVertical = _orientation == B_VERTICAL;
if (isVertical != Vertical()) { if (isVertical != _Vertical()) {
fVertical = isVertical; fVertical = isVertical;
Invalidate(Bounds()); Invalidate(Bounds());
} }
} }
@@ -159,29 +165,29 @@ BChannelSlider::AttachedToWindow()
BView *parent = Parent(); BView *parent = Parent();
if (parent != NULL) if (parent != NULL)
SetViewColor(parent->ViewColor()); SetViewColor(parent->ViewColor());
inherited::AttachedToWindow(); BChannelControl::AttachedToWindow();
} }
void void
BChannelSlider::AllAttached() BChannelSlider::AllAttached()
{ {
BControl::AllAttached(); BChannelControl::AllAttached();
} }
void void
BChannelSlider::DetachedFromWindow() BChannelSlider::DetachedFromWindow()
{ {
inherited::DetachedFromWindow(); BChannelControl::DetachedFromWindow();
} }
void void
BChannelSlider::AllDetached() BChannelSlider::AllDetached()
{ {
BControl::AllDetached(); BChannelControl::AllDetached();
} }
@@ -189,19 +195,19 @@ void
BChannelSlider::MessageReceived(BMessage *message) BChannelSlider::MessageReceived(BMessage *message)
{ {
switch (message->what) { switch (message->what) {
case B_SET_PROPERTY: case B_SET_PROPERTY: {
case B_GET_PROPERTY: case B_GET_PROPERTY:
{
BMessage reply(B_REPLY); BMessage reply(B_REPLY);
int32 index = 0; int32 index = 0;
BMessage specifier; BMessage specifier;
int32 what = 0; int32 what = 0;
const char *property = NULL; const char *property = NULL;
bool handled = false; bool handled = false;
status_t status = message->GetCurrentSpecifier(&index, &specifier, &what, &property); status_t status = message->GetCurrentSpecifier(&index, &specifier,
BPropertyInfo propInfo(sPropertyInfo); &what, &property);
if (status == B_OK BPropertyInfo propInfo(sPropertyInfo);
&& propInfo.FindMatch(message, index, &specifier, what, property) >= 0) { if (status == B_OK
&& propInfo.FindMatch(message, index, &specifier, what, property) >= 0) {
handled = true; handled = true;
if (message->what == B_SET_PROPERTY) { if (message->what == B_SET_PROPERTY) {
orientation orient; orientation orient;
@@ -212,18 +218,19 @@ BChannelSlider::MessageReceived(BMessage *message)
} else if (message->what == B_GET_PROPERTY) } else if (message->what == B_GET_PROPERTY)
reply.AddInt32("result", (int32)Orientation()); reply.AddInt32("result", (int32)Orientation());
else else
status = B_BAD_SCRIPT_SYNTAX; status = B_BAD_SCRIPT_SYNTAX;
} }
if (handled) { if (handled) {
reply.AddInt32("error", status); reply.AddInt32("error", status);
message->SendReply(&reply); message->SendReply(&reply);
} else } else {
inherited::MessageReceived(message); BChannelControl::MessageReceived(message);
break; }
} } break;
default: default:
inherited::MessageReceived(message); BChannelControl::MessageReceived(message);
break; break;
} }
} }
@@ -232,13 +239,13 @@ BChannelSlider::MessageReceived(BMessage *message)
void void
BChannelSlider::Draw(BRect updateRect) BChannelSlider::Draw(BRect updateRect)
{ {
UpdateFontDimens(); _UpdateFontDimens();
DrawThumbs(); _DrawThumbs();
if (Label()) { if (Label()) {
BRect bounds(Bounds()); BRect bounds(Bounds());
float labelWidth = StringWidth(Label()); float labelWidth = StringWidth(Label());
DrawString(Label(), BPoint((bounds.Width() - labelWidth) / 2, fBaseLine)); DrawString(Label(), BPoint((bounds.Width() - labelWidth) / 2, fBaseLine));
} }
} }
@@ -252,15 +259,15 @@ BChannelSlider::MouseDown(BPoint where)
else { else {
fCurrentChannel = -1; fCurrentChannel = -1;
fMinpoint = 0; fMinpoint = 0;
// Search the channel on which the mouse was over // Search the channel on which the mouse was over
int32 numChannels = CountChannels(); int32 numChannels = CountChannels();
for (int32 channel = 0; channel < numChannels; channel++) { for (int32 channel = 0; channel < numChannels; channel++) {
BRect frame = ThumbFrameFor(channel); BRect frame = ThumbFrameFor(channel);
frame.OffsetBy(fClickDelta); frame.OffsetBy(fClickDelta);
float range = ThumbRangeFor(channel); float range = ThumbRangeFor(channel);
if (Vertical()) { if (_Vertical()) {
fMinpoint = frame.top + frame.Height() / 2; fMinpoint = frame.top + frame.Height() / 2;
frame.bottom += range; frame.bottom += range;
} else { } else {
@@ -268,56 +275,57 @@ BChannelSlider::MouseDown(BPoint where)
frame.right += range; frame.right += range;
fMinpoint = frame.Width(); fMinpoint = frame.Width();
} }
// Click was on a slider. // Click was on a slider.
if (frame.Contains(where)) { if (frame.Contains(where)) {
fCurrentChannel = channel; fCurrentChannel = channel;
SetCurrentChannel(channel); SetCurrentChannel(channel);
break; break;
} }
} }
// Click wasn't on a slider. Bail out. // Click wasn't on a slider. Bail out.
if (fCurrentChannel == -1) if (fCurrentChannel == -1)
return; return;
uint32 buttons = 0; uint32 buttons = 0;
BMessage *currentMessage = Window()->CurrentMessage(); BMessage *currentMessage = Window()->CurrentMessage();
if (currentMessage != NULL) if (currentMessage != NULL)
currentMessage->FindInt32("buttons", (int32 *)&buttons); currentMessage->FindInt32("buttons", (int32 *)&buttons);
fAllChannels = (buttons & B_SECONDARY_MOUSE_BUTTON) == 0; fAllChannels = (buttons & B_SECONDARY_MOUSE_BUTTON) == 0;
if (fInitialValues != NULL && fAllChannels) { if (fInitialValues != NULL && fAllChannels) {
delete[] fInitialValues; delete[] fInitialValues;
fInitialValues = NULL; fInitialValues = NULL;
} }
if (fInitialValues == NULL) if (fInitialValues == NULL)
fInitialValues = new int32[numChannels]; fInitialValues = new int32[numChannels];
if (fAllChannels) { if (fAllChannels) {
for (int32 i = 0; i < numChannels; i++) for (int32 i = 0; i < numChannels; i++)
fInitialValues[i] = ValueFor(i); fInitialValues[i] = ValueFor(i);
} else } else
fInitialValues[fCurrentChannel] = ValueFor(fCurrentChannel); fInitialValues[fCurrentChannel] = ValueFor(fCurrentChannel);
if (Window()->Flags() & B_ASYNCHRONOUS_CONTROLS) { if (Window()->Flags() & B_ASYNCHRONOUS_CONTROLS) {
if (!IsTracking()) { if (!IsTracking()) {
SetTracking(true); SetTracking(true);
DrawThumbs(); _DrawThumbs();
Flush(); Flush();
} }
MouseMovedCommon(where, B_ORIGIN); _MouseMovedCommon(where, B_ORIGIN);
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS | B_NO_POINTER_HISTORY); SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS |
B_NO_POINTER_HISTORY);
} else { } else {
do { do {
snooze(30000); snooze(30000);
GetMouse(&where, &buttons); GetMouse(&where, &buttons);
MouseMovedCommon(where, B_ORIGIN); _MouseMovedCommon(where, B_ORIGIN);
} while (buttons != 0); } while (buttons != 0);
FinishChange(); _FinishChange();
fCurrentChannel = -1; fCurrentChannel = -1;
fAllChannels = false; fAllChannels = false;
} }
@@ -329,13 +337,13 @@ void
BChannelSlider::MouseUp(BPoint where) BChannelSlider::MouseUp(BPoint where)
{ {
if (IsEnabled() && IsTracking()) { if (IsEnabled() && IsTracking()) {
FinishChange(); _FinishChange();
SetTracking(false); SetTracking(false);
fAllChannels = false; fAllChannels = false;
fCurrentChannel = -1; fCurrentChannel = -1;
fMinpoint = 0; fMinpoint = 0;
} else } else
BControl::MouseUp(where); BChannelControl::MouseUp(where);
} }
@@ -343,16 +351,16 @@ void
BChannelSlider::MouseMoved(BPoint where, uint32 code, const BMessage *message) BChannelSlider::MouseMoved(BPoint where, uint32 code, const BMessage *message)
{ {
if (IsEnabled() && IsTracking()) if (IsEnabled() && IsTracking())
MouseMovedCommon(where, B_ORIGIN); _MouseMovedCommon(where, B_ORIGIN);
else else
BControl::MouseMoved(where, code, message); BChannelControl::MouseMoved(where, code, message);
} }
void void
BChannelSlider::WindowActivated(bool state) BChannelSlider::WindowActivated(bool state)
{ {
BControl::WindowActivated(state); BChannelControl::WindowActivated(state);
} }
@@ -373,7 +381,7 @@ BChannelSlider::KeyUp(const char *bytes, int32 numBytes)
void void
BChannelSlider::FrameResized(float newWidth, float newHeight) BChannelSlider::FrameResized(float newWidth, float newHeight)
{ {
inherited::FrameResized(newWidth, newHeight); BChannelControl::FrameResized(newWidth, newHeight);
Invalidate(Bounds()); Invalidate(Bounds());
} }
@@ -381,7 +389,7 @@ BChannelSlider::FrameResized(float newWidth, float newHeight)
void void
BChannelSlider::SetFont(const BFont *font, uint32 mask) BChannelSlider::SetFont(const BFont *font, uint32 mask)
{ {
inherited::SetFont(font, mask); BChannelControl::SetFont(font, mask);
} }
@@ -390,14 +398,14 @@ BChannelSlider::MakeFocus(bool focusState)
{ {
if (focusState && !IsFocus()) if (focusState && !IsFocus())
fFocusChannel = -1; fFocusChannel = -1;
BControl::MakeFocus(focusState); BChannelControl::MakeFocus(focusState);
} }
void void
BChannelSlider::SetEnabled(bool on) BChannelSlider::SetEnabled(bool on)
{ {
BControl::SetEnabled(on); BChannelControl::SetEnabled(on);
} }
@@ -406,14 +414,14 @@ BChannelSlider::GetPreferredSize(float *width, float *height)
{ {
if (width) { if (width) {
float _width = (float)ceil(StringWidth(Label())); float _width = (float)ceil(StringWidth(Label()));
if (Vertical()) { if (_Vertical()) {
*width = max_c(_width, 2 + 12 * CountChannels()); *width = max_c(_width, 2 + 12 * CountChannels());
} else { } else {
*width = max_c(_width, 64); *width = max_c(_width, 64);
} }
} }
if (height) { if (height) {
if (Vertical()) if (_Vertical())
*height = 195; *height = 195;
else else
*height = 71; *height = 71;
@@ -423,13 +431,14 @@ BChannelSlider::GetPreferredSize(float *width, float *height)
BHandler * BHandler *
BChannelSlider::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier, BChannelSlider::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier,
int32 form, const char *property) int32 form, const char *property)
{ {
BHandler *target = this; BHandler *target = this;
BPropertyInfo propertyInfo(sPropertyInfo); BPropertyInfo propertyInfo(sPropertyInfo);
if (propertyInfo.FindMatch(msg, index, specifier, form, property) < B_OK) if (propertyInfo.FindMatch(msg, index, specifier, form, property) < B_OK) {
target = BChannelControl::ResolveSpecifier(msg, index, specifier, form, property); target = BChannelControl::ResolveSpecifier(msg, index, specifier, form,
property);
}
return target; return target;
} }
@@ -439,13 +448,13 @@ BChannelSlider::GetSupportedSuites(BMessage *data)
{ {
if (data == NULL) if (data == NULL)
return B_BAD_VALUE; return B_BAD_VALUE;
status_t err = data->AddString("suites", "suite/vnd.Be-channel-slider"); status_t err = data->AddString("suites", "suite/vnd.Be-channel-slider");
BPropertyInfo propInfo(sPropertyInfo); BPropertyInfo propInfo(sPropertyInfo);
if (err == B_OK) if (err == B_OK)
err = data->AddFlat("messages", &propInfo); err = data->AddFlat("messages", &propInfo);
if (err == B_OK) if (err == B_OK)
return BChannelControl::GetSupportedSuites(data); return BChannelControl::GetSupportedSuites(data);
return err; return err;
@@ -457,47 +466,48 @@ BChannelSlider::DrawChannel(BView *into, int32 channel, BRect area, bool pressed
{ {
float hCenter = area.Width() / 2; float hCenter = area.Width() / 2;
float vCenter = area.Height() / 2; float vCenter = area.Height() / 2;
BPoint leftTop; BPoint leftTop;
BPoint bottomRight; BPoint bottomRight;
if (Vertical()) { if (_Vertical()) {
leftTop.Set(area.left + hCenter, area.top + vCenter); leftTop.Set(area.left + hCenter, area.top + vCenter);
bottomRight.Set(leftTop.x, leftTop.y + ThumbRangeFor(channel)); bottomRight.Set(leftTop.x, leftTop.y + ThumbRangeFor(channel));
} else { } else {
leftTop.Set(area.left, area.top + vCenter); leftTop.Set(area.left, area.top + vCenter);
bottomRight.Set(area.left + ThumbRangeFor(channel), leftTop.y); bottomRight.Set(area.left + ThumbRangeFor(channel), leftTop.y);
} }
DrawGroove(into, channel, leftTop, bottomRight); DrawGroove(into, channel, leftTop, bottomRight);
BPoint thumbLocation = leftTop; BPoint thumbLocation = leftTop;
if (Vertical()) if (_Vertical())
thumbLocation.y += ThumbDeltaFor(channel); thumbLocation.y += ThumbDeltaFor(channel);
else else
thumbLocation.x += ThumbDeltaFor(channel); thumbLocation.x += ThumbDeltaFor(channel);
DrawThumb(into, channel, thumbLocation, pressed); DrawThumb(into, channel, thumbLocation, pressed);
} }
void void
BChannelSlider::DrawGroove(BView *into, int32 channel, BPoint topLeft, BPoint bottomRight) BChannelSlider::DrawGroove(BView *into, int32 channel, BPoint leftTop,
BPoint bottomRight)
{ {
ASSERT(into != NULL); ASSERT(into != NULL);
BRect rect(topLeft, bottomRight); BRect rect(leftTop, bottomRight);
DrawThumbFrame(fBackingView, rect.InsetByCopy(-2.5, -2.5)); _DrawGrooveFrame(fBackingView, rect.InsetByCopy(-2.5, -2.5));
rect.InsetBy(-0.5, -0.5); rect.InsetBy(-0.5, -0.5);
into->FillRect(rect, B_SOLID_HIGH); into->FillRect(rect, B_SOLID_HIGH);
} }
void void
BChannelSlider::DrawThumb(BView *into, int32 channel, BPoint where, bool pressed) BChannelSlider::DrawThumb(BView* into, int32 channel, BPoint where, bool pressed)
{ {
ASSERT(into != NULL); ASSERT(into != NULL);
const BBitmap *thumb = ThumbFor(channel, pressed); const BBitmap *thumb = ThumbFor(channel, pressed);
if (thumb == NULL) if (thumb == NULL)
return; return;
@@ -505,26 +515,26 @@ BChannelSlider::DrawThumb(BView *into, int32 channel, BPoint where, bool pressed
BRect bitmapBounds = thumb->Bounds(); BRect bitmapBounds = thumb->Bounds();
where.x -= bitmapBounds.right / 2; where.x -= bitmapBounds.right / 2;
where.y -= bitmapBounds.bottom / 2; where.y -= bitmapBounds.bottom / 2;
into->PushState(); into->PushState();
into->SetDrawingMode(B_OP_OVER); into->SetDrawingMode(B_OP_OVER);
into->DrawBitmapAsync(thumb, where); into->DrawBitmapAsync(thumb, where);
if (pressed) { if (pressed) {
into->SetDrawingMode(B_OP_ALPHA); into->SetDrawingMode(B_OP_ALPHA);
rgb_color color = tint_color(into->ViewColor(), B_DARKEN_4_TINT); rgb_color color = tint_color(into->ViewColor(), B_DARKEN_4_TINT);
color.alpha = 128; color.alpha = 128;
into->SetHighColor(color); into->SetHighColor(color);
BRect destRect(where, where); BRect destRect(where, where);
destRect.right += bitmapBounds.right; destRect.right += bitmapBounds.right;
destRect.bottom += bitmapBounds.bottom; destRect.bottom += bitmapBounds.bottom;
into->FillRect(destRect); into->FillRect(destRect);
} }
into->PopState(); into->PopState();
} }
@@ -534,15 +544,17 @@ BChannelSlider::ThumbFor(int32 channel, bool pressed)
{ {
// TODO: Finish me // TODO: Finish me
if (fLeftKnob == NULL) { if (fLeftKnob == NULL) {
if (Vertical()) { if (_Vertical()) {
fLeftKnob = new BBitmap(BRect(0, 0, 11, 14), B_CMAP8); fLeftKnob = new BBitmap(BRect(0, 0, 11, 14), B_CMAP8);
fLeftKnob->SetBits(kVerticalKnobData, sizeof(kVerticalKnobData), 0, B_CMAP8); fLeftKnob->SetBits(kVerticalKnobData, sizeof(kVerticalKnobData),
0, B_CMAP8);
} else { } else {
fLeftKnob = new BBitmap(BRect(0, 0, 14, 11), B_CMAP8); fLeftKnob = new BBitmap(BRect(0, 0, 14, 11), B_CMAP8);
fLeftKnob->SetBits(kHorizontalKnobData, sizeof(kHorizontalKnobData), 0, B_CMAP8); fLeftKnob->SetBits(kHorizontalKnobData, sizeof(kHorizontalKnobData),
0, B_CMAP8);
} }
} }
return fLeftKnob; return fLeftKnob;
} }
@@ -550,19 +562,19 @@ BChannelSlider::ThumbFor(int32 channel, bool pressed)
BRect BRect
BChannelSlider::ThumbFrameFor(int32 channel) BChannelSlider::ThumbFrameFor(int32 channel)
{ {
UpdateFontDimens(); _UpdateFontDimens();
BRect frame(0, 0, 0, 0); BRect frame(0, 0, 0, 0);
const BBitmap *thumb = ThumbFor(channel, false); const BBitmap *thumb = ThumbFor(channel, false);
if (thumb != NULL) { if (thumb != NULL) {
frame = thumb->Bounds(); frame = thumb->Bounds();
if (Vertical()) if (_Vertical())
frame.OffsetBy(channel * frame.Width(), fLineFeed + kPadding); frame.OffsetBy(channel * frame.Width(), fLineFeed + kPadding);
else else
frame.OffsetBy(kPadding, fLineFeed + channel * frame.Height()); frame.OffsetBy(kPadding, fLineFeed + channel * frame.Height());
} }
return frame; return frame;
} }
@@ -573,38 +585,38 @@ BChannelSlider::ThumbDeltaFor(int32 channel)
if (channel >= 0 && channel < MaxChannelCount()) { if (channel >= 0 && channel < MaxChannelCount()) {
float range = ThumbRangeFor(channel); float range = ThumbRangeFor(channel);
int32 limitRange = MaxLimitList()[channel] - MinLimitList()[channel]; int32 limitRange = MaxLimitList()[channel] - MinLimitList()[channel];
delta = (ValueList()[channel] - MinLimitList()[channel]) * range / limitRange; delta = (ValueList()[channel] - MinLimitList()[channel]) * range / limitRange;
if (Vertical()) if (_Vertical())
delta = range - delta; delta = range - delta;
} }
return delta; return delta;
} }
float float
BChannelSlider::ThumbRangeFor(int32 channel) BChannelSlider::ThumbRangeFor(int32 channel)
{ {
UpdateFontDimens(); _UpdateFontDimens();
float range = 0; float range = 0;
BRect bounds = Bounds(); BRect bounds = Bounds();
BRect frame = ThumbFrameFor(channel); BRect frame = ThumbFrameFor(channel);
if (Vertical()) if (_Vertical())
range = bounds.Height() - frame.Height() - (kPadding + fLineFeed) * 2; range = bounds.Height() - frame.Height() - (kPadding + fLineFeed) * 2;
else else
range = bounds.Width() - frame.Width() - kPadding * 2; range = bounds.Width() - frame.Width() - kPadding * 2;
return range; return range;
} }
void void
BChannelSlider::InitData() BChannelSlider::_InitData()
{ {
UpdateFontDimens(); _UpdateFontDimens();
fLeftKnob = NULL; fLeftKnob = NULL;
fMidKnob = NULL; fMidKnob = NULL;
fRightKnob = NULL; fRightKnob = NULL;
@@ -612,19 +624,19 @@ BChannelSlider::InitData()
fBackingView = NULL; fBackingView = NULL;
fVertical = Bounds().Width() / Bounds().Height() < 1; fVertical = Bounds().Width() / Bounds().Height() < 1;
fClickDelta = B_ORIGIN; fClickDelta = B_ORIGIN;
fCurrentChannel = -1; fCurrentChannel = -1;
fAllChannels = false; fAllChannels = false;
fInitialValues = NULL; fInitialValues = NULL;
fMinpoint = 0; fMinpoint = 0;
fFocusChannel = -1; fFocusChannel = -1;
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
} }
void void
BChannelSlider::FinishChange() BChannelSlider::_FinishChange()
{ {
if (fInitialValues != NULL) { if (fInitialValues != NULL) {
bool *inMask = NULL; bool *inMask = NULL;
@@ -637,14 +649,14 @@ BChannelSlider::FinishChange()
} }
InvokeChannel(NULL, 0, numChannels, inMask); InvokeChannel(NULL, 0, numChannels, inMask);
} }
SetTracking(false); SetTracking(false);
Redraw(); _Redraw();
} }
void void
BChannelSlider::UpdateFontDimens() BChannelSlider::_UpdateFontDimens()
{ {
font_height height; font_height height;
GetFontHeight(&height); GetFontHeight(&height);
@@ -654,44 +666,39 @@ BChannelSlider::UpdateFontDimens()
void void
BChannelSlider::DrawThumbs() BChannelSlider::_DrawThumbs()
{ {
if (fBacking == NULL) { if (fBacking == NULL) {
// This is the idea: we build a bitmap by taking the coordinates // This is the idea: we build a bitmap by taking the coordinates
// of the first and last thumb frames (top/left and bottom/right) // of the first and last thumb frames (top/left and bottom/right)
BRect first = ThumbFrameFor(0); BRect first = ThumbFrameFor(0);
BRect last = ThumbFrameFor(CountChannels() - 1); BRect last = ThumbFrameFor(CountChannels() - 1);
BRect bitmapFrame(first.LeftTop(), last.RightBottom()); BRect bitmapFrame(first.LeftTop(), last.RightBottom());
if (Vertical()) if (_Vertical())
bitmapFrame.top -= ThumbRangeFor(0); bitmapFrame.top -= ThumbRangeFor(0);
else else
bitmapFrame.right += ThumbRangeFor(0); bitmapFrame.right += ThumbRangeFor(0);
fBacking = new BBitmap(bitmapFrame.OffsetToCopy(B_ORIGIN), bitmapFrame.OffsetTo(B_ORIGIN);
#ifdef __HAIKU__ fBacking = new BBitmap(bitmapFrame, B_RGBA32, true, false);
BScreen(Window()).ColorSpace(),
#else
B_RGB32,
#endif
true, false);
if (fBacking->Lock()) { if (fBacking->Lock()) {
fBackingView = new BView(bitmapFrame.OffsetToCopy(B_ORIGIN), "backing view", B_FOLLOW_NONE, B_WILL_DRAW); fBackingView = new BView(bitmapFrame, "", 0, B_WILL_DRAW);
fBacking->AddChild(fBackingView); fBacking->AddChild(fBackingView);
fBackingView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fBackingView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
fBackingView->SetLowColor(fBackingView->ViewColor()); fBackingView->SetLowColor(fBackingView->ViewColor());
fBacking->Unlock(); fBacking->Unlock();
} }
} }
BPoint drawHere; BPoint drawHere;
drawHere.x = (Bounds().Width() - fBacking->Bounds().Width()) / 2; drawHere.x = (Bounds().Width() - fBacking->Bounds().Width()) / 2;
drawHere.y = (Bounds().Height() - fBacking->Bounds().Height() + fLineFeed) / 2; drawHere.y = (Bounds().Height() - fBacking->Bounds().Height() + fLineFeed) / 2;
if (fBacking->Lock()) { if (fBacking->Lock()) {
// Clear the view's background // Clear the view's background
fBackingView->FillRect(fBackingView->Bounds(), B_SOLID_LOW); fBackingView->FillRect(fBackingView->Bounds(), B_SOLID_LOW);
BRect channelArea; BRect channelArea;
int32 channelCount = CountChannels(); int32 channelCount = CountChannels();
for (int32 channel = 0; channel < channelCount; channel++) { for (int32 channel = 0; channel < channelCount; channel++) {
@@ -700,16 +707,16 @@ BChannelSlider::DrawThumbs()
// take into account that the view we draw on is attached to an offscreen // take into account that the view we draw on is attached to an offscreen
// bitmap. Still this doesn't make much sense: // bitmap. Still this doesn't make much sense:
// could be that I'm simply missing something. // could be that I'm simply missing something.
if (Vertical()) if (_Vertical())
channelArea.OffsetBy(0, -channelArea.top); channelArea.OffsetBy(0, -channelArea.top);
else else
channelArea.OffsetBy(0, -channelArea.Height()); channelArea.OffsetBy(0, -channelArea.Height());
bool pressed = fMinpoint != 0 && (channel == fCurrentChannel || fAllChannels); bool pressed = fMinpoint != 0 && (channel == fCurrentChannel || fAllChannels);
DrawChannel(fBackingView, channel, channelArea, pressed); DrawChannel(fBackingView, channel, channelArea, pressed);
} }
#if 1 #if 1
// This part draws the current value over the thumb. // This part draws the current value over the thumb.
// TODO: make it nicer. Simplify the code. // TODO: make it nicer. Simplify the code.
if (fCurrentChannel != -1 && fMinpoint != 0) { if (fCurrentChannel != -1 && fMinpoint != 0) {
@@ -718,7 +725,7 @@ BChannelSlider::DrawThumbs()
float width = fBackingView->StringWidth(valueString); float width = fBackingView->StringWidth(valueString);
BRect valueRect(0, 0, width, 10); BRect valueRect(0, 0, width, 10);
rgb_color oldColor = fBackingView->HighColor(); rgb_color oldColor = fBackingView->HighColor();
if (Vertical()) if (_Vertical())
valueRect.OffsetTo((ThumbFrameFor(fCurrentChannel).Width() - width) / 2 + fCurrentChannel * ThumbFrameFor(fCurrentChannel).Width(), valueRect.OffsetTo((ThumbFrameFor(fCurrentChannel).Width() - width) / 2 + fCurrentChannel * ThumbFrameFor(fCurrentChannel).Width(),
ThumbDeltaFor(fCurrentChannel)); ThumbDeltaFor(fCurrentChannel));
else else
@@ -728,13 +735,13 @@ BChannelSlider::DrawThumbs()
fBackingView->SetHighColor(0, 0, 0); fBackingView->SetHighColor(0, 0, 0);
valueRect.OffsetBy(1 , 9); valueRect.OffsetBy(1 , 9);
fBackingView->DrawString(valueString, valueRect.LeftTop()); fBackingView->DrawString(valueString, valueRect.LeftTop());
fBackingView->SetHighColor(oldColor); fBackingView->SetHighColor(oldColor);
} }
#endif #endif
fBackingView->Sync(); fBackingView->Sync();
fBacking->Unlock(); fBacking->Unlock();
} }
DrawBitmapAsync(fBacking, drawHere); DrawBitmapAsync(fBacking, drawHere);
#if 0 #if 0
@@ -750,10 +757,10 @@ BChannelSlider::DrawThumbs()
stringRect.left -= 10; stringRect.left -= 10;
stringRect.right += StringWidth("100"); stringRect.right += StringWidth("100");
stringRect.top -= fLineFeed; stringRect.top -= fLineFeed;
SetHighColor(ViewColor()); SetHighColor(ViewColor());
FillRect(stringRect); FillRect(stringRect);
SetHighColor(0, 0, 0); SetHighColor(0, 0, 0);
DrawString(valueString, stringPoint); DrawString(valueString, stringPoint);
} }
@@ -761,9 +768,9 @@ BChannelSlider::DrawThumbs()
// fClickDelta is used in MouseMoved() // fClickDelta is used in MouseMoved()
fClickDelta = drawHere; fClickDelta = drawHere;
// TODO: See above // TODO: See above
if (Vertical()) if (_Vertical())
fClickDelta.y -= ThumbFrameFor(0).top; fClickDelta.y -= ThumbFrameFor(0).top;
else else
fClickDelta.y -= ThumbFrameFor(0).Height(); fClickDelta.y -= ThumbFrameFor(0).Height();
@@ -771,10 +778,10 @@ BChannelSlider::DrawThumbs()
void void
BChannelSlider::DrawThumbFrame(BView *into, const BRect &area) BChannelSlider::_DrawGrooveFrame(BView *into, const BRect &area)
{ {
rgb_color oldColor = into->HighColor(); rgb_color oldColor = into->HighColor();
into->SetHighColor(255, 255, 255); into->SetHighColor(255, 255, 255);
into->StrokeRect(area); into->StrokeRect(area);
into->SetHighColor(tint_color(into->ViewColor(), B_DARKEN_1_TINT)); into->SetHighColor(tint_color(into->ViewColor(), B_DARKEN_1_TINT));
@@ -783,20 +790,20 @@ BChannelSlider::DrawThumbFrame(BView *into, const BRect &area)
into->SetHighColor(tint_color(into->ViewColor(), B_DARKEN_2_TINT)); into->SetHighColor(tint_color(into->ViewColor(), B_DARKEN_2_TINT));
into->StrokeLine(BPoint(area.left + 1, area.top + 1), BPoint(area.right - 1, area.top + 1)); into->StrokeLine(BPoint(area.left + 1, area.top + 1), BPoint(area.right - 1, area.top + 1));
into->StrokeLine(BPoint(area.left + 1, area.top + 1), BPoint(area.left + 1, area.bottom - 2)); into->StrokeLine(BPoint(area.left + 1, area.top + 1), BPoint(area.left + 1, area.bottom - 2));
into->SetHighColor(oldColor); into->SetHighColor(oldColor);
} }
bool bool
BChannelSlider::Vertical() const BChannelSlider::_Vertical() const
{ {
return fVertical; return fVertical;
} }
void void
BChannelSlider::Redraw() BChannelSlider::_Redraw()
{ {
Invalidate(Bounds()); Invalidate(Bounds());
Flush(); Flush();
@@ -804,23 +811,25 @@ BChannelSlider::Redraw()
void void
BChannelSlider::MouseMovedCommon(BPoint point, BPoint point2) BChannelSlider::_MouseMovedCommon(BPoint point, BPoint point2)
{ {
float floatValue = 0; float floatValue = 0;
int32 limitRange = MaxLimitList()[fCurrentChannel] - MinLimitList()[fCurrentChannel]; int32 limitRange = MaxLimitList()[fCurrentChannel] -
MinLimitList()[fCurrentChannel];
float range = ThumbRangeFor(fCurrentChannel); float range = ThumbRangeFor(fCurrentChannel);
if (Vertical()) if (_Vertical())
floatValue = range - (point.y - fMinpoint); floatValue = range - (point.y - fMinpoint);
else else
floatValue = range + (point.x - fMinpoint); floatValue = range + (point.x - fMinpoint);
int32 value = (int32)(floatValue / range * limitRange) + MinLimitList()[fCurrentChannel]; int32 value = (int32)(floatValue / range * limitRange) +
MinLimitList()[fCurrentChannel];
if (fAllChannels) if (fAllChannels)
SetAllValue(value); SetAllValue(value);
else else
SetValueFor(fCurrentChannel, value); SetValueFor(fCurrentChannel, value);
DrawThumbs(); _DrawThumbs();
} }