* Finished rewriting the header.
* Cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32667 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,15 +1,7 @@
|
|||||||
/*******************************************************************************
|
/*
|
||||||
/
|
* Copyright 2009, Haiku Inc. All rights reserved.
|
||||||
/ File: ChannelSlider.h
|
* Distributed under the terms of the MIT license.
|
||||||
/
|
*/
|
||||||
/ Description: BChannelSlider implements a slider which can have a number
|
|
||||||
/ of (on-screen) related values. A typical use is for a stereo
|
|
||||||
/ volume control.
|
|
||||||
/
|
|
||||||
/ Copyright 1998-99, Be Incorporated, All Rights Reserved
|
|
||||||
/
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#ifndef _CHANNEL_SLIDER_H
|
#ifndef _CHANNEL_SLIDER_H
|
||||||
#define _CHANNEL_SLIDER_H
|
#define _CHANNEL_SLIDER_H
|
||||||
|
|
||||||
@@ -41,13 +33,8 @@ public:
|
|||||||
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;
|
|
||||||
void SetOrientation(enum orientation orientation);
|
|
||||||
|
|
||||||
virtual int32 MaxChannelCount() const;
|
|
||||||
virtual bool SupportsIndividualLimits() const;
|
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void AllAttached();
|
virtual void AllAttached();
|
||||||
@@ -56,7 +43,7 @@ public:
|
|||||||
|
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
|
||||||
virtual void Draw(BRect area);
|
virtual void Draw(BRect updateRect);
|
||||||
virtual void MouseDown(BPoint where);
|
virtual void MouseDown(BPoint where);
|
||||||
virtual void MouseUp(BPoint where);
|
virtual void MouseUp(BPoint where);
|
||||||
virtual void MouseMoved(BPoint where, uint32 transit,
|
virtual void MouseMoved(BPoint where, uint32 transit,
|
||||||
@@ -70,74 +57,79 @@ public:
|
|||||||
uint32 mask = B_FONT_ALL);
|
uint32 mask = B_FONT_ALL);
|
||||||
virtual void MakeFocus(bool focusState = true);
|
virtual void MakeFocus(bool focusState = true);
|
||||||
|
|
||||||
virtual void SetEnabled(bool on);
|
|
||||||
|
|
||||||
virtual void GetPreferredSize(float* _width, float* _height);
|
virtual void GetPreferredSize(float* _width, float* _height);
|
||||||
|
|
||||||
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
|
virtual BHandler* ResolveSpecifier(BMessage* message,
|
||||||
BMessage* specifier, int32 form,
|
int32 index, BMessage* specifier,
|
||||||
const char* p);
|
int32 form, const char* property);
|
||||||
virtual status_t GetSupportedSuites(BMessage* data);
|
virtual status_t GetSupportedSuites(BMessage* data);
|
||||||
|
|
||||||
// Perform rendering for an entire slider channel.
|
virtual void SetEnabled(bool on);
|
||||||
virtual void DrawChannel(BView* into, int32 channel, BRect area,
|
|
||||||
bool pressed);
|
|
||||||
|
|
||||||
// Draw groove that appears behind a channel's thumb.
|
virtual orientation Orientation() const;
|
||||||
virtual void DrawGroove(BView* into, int32 channel, BPoint lt,
|
void SetOrientation(enum orientation orientation);
|
||||||
BPoint br);
|
|
||||||
|
|
||||||
// Draw the thumb for a single channel.
|
virtual int32 MaxChannelCount() const;
|
||||||
virtual void DrawThumb(BView* into, int32 channel, BPoint where,
|
virtual bool SupportsIndividualLimits() const;
|
||||||
bool pressed);
|
|
||||||
|
|
||||||
virtual const BBitmap* ThumbFor(int32 channel, bool pressed);
|
virtual void DrawChannel(BView* into, int32 channel,
|
||||||
virtual BRect ThumbFrameFor(int32 channel);
|
BRect area, bool pressed);
|
||||||
virtual float ThumbDeltaFor(int32 channel);
|
|
||||||
virtual float ThumbRangeFor(int32 channel);
|
virtual void DrawGroove(BView* into, int32 channel,
|
||||||
|
BPoint leftTop, BPoint rightBottom);
|
||||||
|
|
||||||
|
virtual void DrawThumb(BView* into, int32 channel,
|
||||||
|
BPoint where, bool pressed);
|
||||||
|
|
||||||
|
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:
|
||||||
BChannelSlider(const BChannelSlider &);
|
// FBC padding
|
||||||
BChannelSlider& operator=(const BChannelSlider &);
|
BChannelSlider(const BChannelSlider&);
|
||||||
|
BChannelSlider& operator=(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;
|
private:
|
||||||
float fLineFeed;
|
void _InitData();
|
||||||
BBitmap* fLeftKnob;
|
void _FinishChange(bool update = false);
|
||||||
BBitmap* fMidKnob;
|
void _UpdateFontDimens();
|
||||||
BBitmap* fRightKnob;
|
void _DrawThumbs();
|
||||||
BBitmap* fBacking;
|
void _DrawGrooveFrame(BView* where,
|
||||||
BView* fBackingView;
|
const BRect& area);
|
||||||
bool fVertical;
|
void _MouseMovedCommon(BPoint point, BPoint point2);
|
||||||
bool fPadding[3];
|
|
||||||
BPoint fClickDelta;
|
|
||||||
|
|
||||||
int32 fCurrentChannel;
|
private:
|
||||||
bool fAllChannels;
|
float fBaseLine;
|
||||||
int32* fInitialValues;
|
float fLineFeed;
|
||||||
float fMinpoint;
|
BBitmap* fLeftKnob;
|
||||||
int32 fFocusChannel;
|
BBitmap* fMidKnob;
|
||||||
|
BBitmap* fRightKnob;
|
||||||
|
BBitmap* fBacking;
|
||||||
|
BView* fBackingView;
|
||||||
|
bool fIsVertical;
|
||||||
|
bool _padding_[3];
|
||||||
|
BPoint fClickDelta;
|
||||||
|
|
||||||
uint32 _reserved_[12];
|
int32 fCurrentChannel;
|
||||||
|
bool fAllChannels;
|
||||||
|
int32* fInitialValues;
|
||||||
|
float fMinPoint;
|
||||||
|
int32 fFocusChannel;
|
||||||
|
|
||||||
void _InitData();
|
uint32 _reserved_[12];
|
||||||
void _FinishChange(bool update = false);
|
|
||||||
void _UpdateFontDimens();
|
|
||||||
void _DrawThumbs();
|
|
||||||
void _DrawGrooveFrame(BView* where, const BRect& area);
|
|
||||||
bool _Vertical() const;
|
|
||||||
void _Redraw();
|
|
||||||
void _MouseMovedCommon(BPoint point, BPoint point2);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* _CHANNEL_SLIDER_H */
|
#endif // _CHANNEL_SLIDER_H
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005 - 2008, Haiku Inc. All Rights Reserved.
|
* Copyright 2005-2009, Haiku Inc. All Rights Reserved.
|
||||||
* Author: Stefano Ceccherini ([email protected])
|
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Stefano Ceccherini ([email protected])
|
||||||
|
* Stephan Aßmus <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ChannelSlider.h>
|
#include <ChannelSlider.h>
|
||||||
|
|
||||||
|
#include <new>
|
||||||
|
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <ControlLook.h>
|
#include <ControlLook.h>
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
@@ -14,9 +19,6 @@
|
|||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
|
||||||
#include <new>
|
|
||||||
|
|
||||||
|
|
||||||
const static unsigned char
|
const static unsigned char
|
||||||
kVerticalKnobData[] = {
|
kVerticalKnobData[] = {
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||||
@@ -72,16 +74,16 @@ sPropertyInfo[] = {
|
|||||||
const static float kPadding = 3.0;
|
const static float kPadding = 3.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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BChannelSlider::BChannelSlider(BRect area, const char *name, const char *label,
|
BChannelSlider::BChannelSlider(BRect area, const char* name, const char* label,
|
||||||
BMessage *model, enum orientation orientation, int32 channels,
|
BMessage* model, enum orientation orientation, int32 channels,
|
||||||
uint32 resizeMode, uint32 flags)
|
uint32 resizeMode, uint32 flags)
|
||||||
: BChannelControl(area, name, label, model, channels, resizeMode, flags)
|
: BChannelControl(area, name, label, model, channels, resizeMode, flags)
|
||||||
|
|
||||||
@@ -91,8 +93,8 @@ BChannelSlider::BChannelSlider(BRect area, const char *name, const char *label,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BChannelSlider::BChannelSlider(const char *name, const char *label,
|
BChannelSlider::BChannelSlider(const char* name, const char* label,
|
||||||
BMessage *model, enum orientation orientation, int32 channels,
|
BMessage* model, enum orientation orientation, int32 channels,
|
||||||
uint32 flags)
|
uint32 flags)
|
||||||
: BChannelControl(name, label, model, channels, flags)
|
: BChannelControl(name, label, model, channels, flags)
|
||||||
|
|
||||||
@@ -102,13 +104,13 @@ BChannelSlider::BChannelSlider(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)
|
||||||
SetOrientation(orient);
|
SetOrientation(orient);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,8 +125,8 @@ BChannelSlider::~BChannelSlider()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BArchivable *
|
BArchivable*
|
||||||
BChannelSlider::Instantiate(BMessage *archive)
|
BChannelSlider::Instantiate(BMessage* archive)
|
||||||
{
|
{
|
||||||
if (validate_instantiation(archive, "BChannelSlider"))
|
if (validate_instantiation(archive, "BChannelSlider"))
|
||||||
return new (std::nothrow) BChannelSlider(archive);
|
return new (std::nothrow) BChannelSlider(archive);
|
||||||
@@ -134,7 +136,7 @@ BChannelSlider::Instantiate(BMessage *archive)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BChannelSlider::Archive(BMessage *into, bool deep) const
|
BChannelSlider::Archive(BMessage* into, bool deep) const
|
||||||
{
|
{
|
||||||
status_t status = BChannelControl::Archive(into, deep);
|
status_t status = BChannelControl::Archive(into, deep);
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
@@ -144,42 +146,10 @@ BChannelSlider::Archive(BMessage *into, bool deep) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
orientation
|
|
||||||
BChannelSlider::Orientation() const
|
|
||||||
{
|
|
||||||
return _Vertical() ? B_VERTICAL : B_HORIZONTAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BChannelSlider::SetOrientation(enum orientation orientation)
|
|
||||||
{
|
|
||||||
bool isVertical = orientation == B_VERTICAL;
|
|
||||||
if (isVertical != _Vertical()) {
|
|
||||||
fVertical = isVertical;
|
|
||||||
Invalidate(Bounds());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int32
|
|
||||||
BChannelSlider::MaxChannelCount() const
|
|
||||||
{
|
|
||||||
return 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
BChannelSlider::SupportsIndividualLimits() const
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BChannelSlider::AttachedToWindow()
|
BChannelSlider::AttachedToWindow()
|
||||||
{
|
{
|
||||||
BView *parent = Parent();
|
BView* parent = Parent();
|
||||||
if (parent != NULL)
|
if (parent != NULL)
|
||||||
SetViewColor(parent->ViewColor());
|
SetViewColor(parent->ViewColor());
|
||||||
|
|
||||||
@@ -209,7 +179,7 @@ BChannelSlider::AllDetached()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BChannelSlider::MessageReceived(BMessage *message)
|
BChannelSlider::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case B_SET_PROPERTY: {
|
case B_SET_PROPERTY: {
|
||||||
@@ -218,17 +188,18 @@ BChannelSlider::MessageReceived(BMessage *message)
|
|||||||
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,
|
status_t status = message->GetCurrentSpecifier(&index, &specifier,
|
||||||
&what, &property);
|
&what, &property);
|
||||||
BPropertyInfo propInfo(sPropertyInfo);
|
BPropertyInfo propInfo(sPropertyInfo);
|
||||||
if (status == B_OK
|
if (status == B_OK
|
||||||
&& propInfo.FindMatch(message, index, &specifier, what, property) >= 0) {
|
&& 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;
|
||||||
if (specifier.FindInt32("data", (int32 *)&orient) == B_OK) {
|
if (specifier.FindInt32("data", (int32*)&orient) == B_OK) {
|
||||||
SetOrientation(orient);
|
SetOrientation(orient);
|
||||||
Invalidate(Bounds());
|
Invalidate(Bounds());
|
||||||
}
|
}
|
||||||
@@ -267,27 +238,32 @@ BChannelSlider::Draw(BRect updateRect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (MinLimitLabel()) {
|
if (MinLimitLabel()) {
|
||||||
if (_Vertical()) {
|
if (fIsVertical) {
|
||||||
if (MinLimitLabel()) {
|
if (MinLimitLabel()) {
|
||||||
float x = (bounds.Width() - StringWidth(MinLimitLabel())) / 2.0;
|
float x = (bounds.Width() - StringWidth(MinLimitLabel()))
|
||||||
DrawString(MinLimitLabel(), BPoint(x, bounds.bottom - kPadding));
|
/ 2.0;
|
||||||
|
DrawString(MinLimitLabel(), BPoint(x, bounds.bottom
|
||||||
|
- kPadding));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (MinLimitLabel())
|
if (MinLimitLabel()) {
|
||||||
DrawString(MinLimitLabel(), BPoint(kPadding, bounds.bottom - kPadding));
|
DrawString(MinLimitLabel(), BPoint(kPadding, bounds.bottom
|
||||||
|
- kPadding));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MaxLimitLabel()) {
|
if (MaxLimitLabel()) {
|
||||||
if (_Vertical()) {
|
if (fIsVertical) {
|
||||||
if (MaxLimitLabel()) {
|
if (MaxLimitLabel()) {
|
||||||
float x = (bounds.Width() - StringWidth(MaxLimitLabel())) / 2.0;
|
float x = (bounds.Width() - StringWidth(MaxLimitLabel()))
|
||||||
|
/ 2.0;
|
||||||
DrawString(MaxLimitLabel(), BPoint(x, 2 * fLineFeed));
|
DrawString(MaxLimitLabel(), BPoint(x, 2 * fLineFeed));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (MaxLimitLabel()) {
|
if (MaxLimitLabel()) {
|
||||||
DrawString(MaxLimitLabel(), BPoint(bounds.right - kPadding -
|
DrawString(MaxLimitLabel(), BPoint(bounds.right - kPadding
|
||||||
StringWidth(MaxLimitLabel()), bounds.bottom - kPadding));
|
- StringWidth(MaxLimitLabel()), bounds.bottom - kPadding));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,7 +277,7 @@ BChannelSlider::MouseDown(BPoint where)
|
|||||||
BControl::MouseDown(where);
|
BControl::MouseDown(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();
|
||||||
@@ -310,13 +286,13 @@ BChannelSlider::MouseDown(BPoint where)
|
|||||||
frame.OffsetBy(fClickDelta);
|
frame.OffsetBy(fClickDelta);
|
||||||
|
|
||||||
float range = ThumbRangeFor(channel);
|
float range = ThumbRangeFor(channel);
|
||||||
if (_Vertical()) {
|
if (fIsVertical) {
|
||||||
fMinpoint = frame.top + frame.Height() / 2;
|
fMinPoint = frame.top + frame.Height() / 2;
|
||||||
frame.bottom += range;
|
frame.bottom += range;
|
||||||
} else {
|
} else {
|
||||||
// TODO: Fix this, the clickzone isn't perfect
|
// TODO: Fix this, the clickzone isn't perfect
|
||||||
frame.right += range;
|
frame.right += range;
|
||||||
fMinpoint = frame.Width();
|
fMinPoint = frame.Width();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Click was on a slider.
|
// Click was on a slider.
|
||||||
@@ -332,9 +308,9 @@ BChannelSlider::MouseDown(BPoint where)
|
|||||||
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;
|
||||||
|
|
||||||
@@ -387,7 +363,7 @@ BChannelSlider::MouseUp(BPoint where)
|
|||||||
SetTracking(false);
|
SetTracking(false);
|
||||||
fAllChannels = false;
|
fAllChannels = false;
|
||||||
fCurrentChannel = -1;
|
fCurrentChannel = -1;
|
||||||
fMinpoint = 0;
|
fMinPoint = 0;
|
||||||
} else {
|
} else {
|
||||||
BChannelControl::MouseUp(where);
|
BChannelControl::MouseUp(where);
|
||||||
}
|
}
|
||||||
@@ -395,7 +371,7 @@ BChannelSlider::MouseUp(BPoint where)
|
|||||||
|
|
||||||
|
|
||||||
void
|
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);
|
||||||
@@ -412,14 +388,14 @@ BChannelSlider::WindowActivated(bool state)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BChannelSlider::KeyDown(const char *bytes, int32 numBytes)
|
BChannelSlider::KeyDown(const char* bytes, int32 numBytes)
|
||||||
{
|
{
|
||||||
BControl::KeyDown(bytes, numBytes);
|
BControl::KeyDown(bytes, numBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BChannelSlider::KeyUp(const char *bytes, int32 numBytes)
|
BChannelSlider::KeyUp(const char* bytes, int32 numBytes)
|
||||||
{
|
{
|
||||||
BView::KeyUp(bytes, numBytes);
|
BView::KeyUp(bytes, numBytes);
|
||||||
}
|
}
|
||||||
@@ -438,7 +414,7 @@ BChannelSlider::FrameResized(float newWidth, float newHeight)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BChannelSlider::SetFont(const BFont *font, uint32 mask)
|
BChannelSlider::SetFont(const BFont* font, uint32 mask)
|
||||||
{
|
{
|
||||||
BChannelControl::SetFont(font, mask);
|
BChannelControl::SetFont(font, mask);
|
||||||
}
|
}
|
||||||
@@ -454,18 +430,11 @@ BChannelSlider::MakeFocus(bool focusState)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BChannelSlider::SetEnabled(bool on)
|
BChannelSlider::GetPreferredSize(float* width, float* height)
|
||||||
{
|
|
||||||
BChannelControl::SetEnabled(on);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BChannelSlider::GetPreferredSize(float *width, float *height)
|
|
||||||
{
|
{
|
||||||
_UpdateFontDimens();
|
_UpdateFontDimens();
|
||||||
|
|
||||||
if (_Vertical()) {
|
if (fIsVertical) {
|
||||||
*width = 11.0 * CountChannels();
|
*width = 11.0 * CountChannels();
|
||||||
*width = max_c(*width, ceilf(StringWidth(Label())));
|
*width = max_c(*width, ceilf(StringWidth(Label())));
|
||||||
*width = max_c(*width, ceilf(StringWidth(MinLimitLabel())));
|
*width = max_c(*width, ceilf(StringWidth(MinLimitLabel())));
|
||||||
@@ -475,31 +444,33 @@ BChannelSlider::GetPreferredSize(float *width, float *height)
|
|||||||
*height = (fLineFeed * 3.0) + (kPadding * 2.0) + 147.0;
|
*height = (fLineFeed * 3.0) + (kPadding * 2.0) + 147.0;
|
||||||
} else {
|
} else {
|
||||||
*width = max_c(64.0, ceilf(StringWidth(Label())));
|
*width = max_c(64.0, ceilf(StringWidth(Label())));
|
||||||
*width = max_c(*width, ceilf(StringWidth(MinLimitLabel())) +
|
*width = max_c(*width, ceilf(StringWidth(MinLimitLabel()))
|
||||||
ceilf(StringWidth(MaxLimitLabel())) + 10.0);
|
+ ceilf(StringWidth(MaxLimitLabel())) + 10.0);
|
||||||
*width += kPadding * 2.0;
|
*width += kPadding * 2.0;
|
||||||
|
|
||||||
*height = 11.0 * CountChannels() + (fLineFeed * 2.0) + (kPadding * 2.0);
|
*height = 11.0 * CountChannels() + (fLineFeed * 2.0)
|
||||||
|
+ (kPadding * 2.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BHandler *
|
BHandler*
|
||||||
BChannelSlider::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier,
|
BChannelSlider::ResolveSpecifier(BMessage* message, int32 index,
|
||||||
int32 form, const char *property)
|
BMessage* specifier, 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(message, index, specifier, form,
|
||||||
target = BChannelControl::ResolveSpecifier(msg, index, specifier, form,
|
property) != B_OK) {
|
||||||
property);
|
target = BChannelControl::ResolveSpecifier(message, index, specifier,
|
||||||
|
form, property);
|
||||||
}
|
}
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BChannelSlider::GetSupportedSuites(BMessage *data)
|
BChannelSlider::GetSupportedSuites(BMessage* data)
|
||||||
{
|
{
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -517,14 +488,55 @@ BChannelSlider::GetSupportedSuites(BMessage *data)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BChannelSlider::DrawChannel(BView *into, int32 channel, BRect area, bool pressed)
|
BChannelSlider::SetEnabled(bool on)
|
||||||
|
{
|
||||||
|
BChannelControl::SetEnabled(on);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
orientation
|
||||||
|
BChannelSlider::Orientation() const
|
||||||
|
{
|
||||||
|
return fIsVertical ? B_VERTICAL : B_HORIZONTAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BChannelSlider::SetOrientation(enum orientation orientation)
|
||||||
|
{
|
||||||
|
bool isVertical = orientation == B_VERTICAL;
|
||||||
|
if (isVertical != fIsVertical) {
|
||||||
|
fIsVertical = isVertical;
|
||||||
|
InvalidateLayout();
|
||||||
|
Invalidate(Bounds());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
BChannelSlider::MaxChannelCount() const
|
||||||
|
{
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BChannelSlider::SupportsIndividualLimits() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
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 (fIsVertical) {
|
||||||
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 {
|
||||||
@@ -535,7 +547,7 @@ BChannelSlider::DrawChannel(BView *into, int32 channel, BRect area, bool pressed
|
|||||||
DrawGroove(into, channel, leftTop, bottomRight);
|
DrawGroove(into, channel, leftTop, bottomRight);
|
||||||
|
|
||||||
BPoint thumbLocation = leftTop;
|
BPoint thumbLocation = leftTop;
|
||||||
if (_Vertical())
|
if (fIsVertical)
|
||||||
thumbLocation.y += ThumbDeltaFor(channel);
|
thumbLocation.y += ThumbDeltaFor(channel);
|
||||||
else
|
else
|
||||||
thumbLocation.x += ThumbDeltaFor(channel);
|
thumbLocation.x += ThumbDeltaFor(channel);
|
||||||
@@ -545,7 +557,7 @@ BChannelSlider::DrawChannel(BView *into, int32 channel, BRect area, bool pressed
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BChannelSlider::DrawGroove(BView *into, int32 channel, BPoint leftTop,
|
BChannelSlider::DrawGroove(BView* into, int32 channel, BPoint leftTop,
|
||||||
BPoint bottomRight)
|
BPoint bottomRight)
|
||||||
{
|
{
|
||||||
ASSERT(into != NULL);
|
ASSERT(into != NULL);
|
||||||
@@ -573,11 +585,12 @@ BChannelSlider::DrawGroove(BView *into, int32 channel, BPoint leftTop,
|
|||||||
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
@@ -624,19 +637,21 @@ BChannelSlider::DrawThumb(BView* into, int32 channel, BPoint where, bool pressed
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const BBitmap *
|
const BBitmap*
|
||||||
BChannelSlider::ThumbFor(int32 channel, bool pressed)
|
BChannelSlider::ThumbFor(int32 channel, bool pressed)
|
||||||
{
|
{
|
||||||
// TODO: Finish me
|
// TODO: Finish me (check allocations... etc)
|
||||||
if (fLeftKnob == NULL) {
|
if (fLeftKnob == NULL) {
|
||||||
if (_Vertical()) {
|
if (fIsVertical) {
|
||||||
fLeftKnob = new (std::nothrow) BBitmap(BRect(0, 0, 11, 14), B_CMAP8);
|
fLeftKnob = new (std::nothrow) BBitmap(BRect(0, 0, 11, 14),
|
||||||
|
B_CMAP8);
|
||||||
fLeftKnob->SetBits(kVerticalKnobData, sizeof(kVerticalKnobData), 0,
|
fLeftKnob->SetBits(kVerticalKnobData, sizeof(kVerticalKnobData), 0,
|
||||||
B_CMAP8);
|
B_CMAP8);
|
||||||
} else {
|
} else {
|
||||||
fLeftKnob = new (std::nothrow) BBitmap(BRect(0, 0, 14, 11), B_CMAP8);
|
fLeftKnob = new (std::nothrow) BBitmap(BRect(0, 0, 14, 11),
|
||||||
fLeftKnob->SetBits(kHorizontalKnobData, sizeof(kHorizontalKnobData),
|
B_CMAP8);
|
||||||
0, B_CMAP8);
|
fLeftKnob->SetBits(kHorizontalKnobData,
|
||||||
|
sizeof(kHorizontalKnobData), 0, B_CMAP8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -650,14 +665,15 @@ BChannelSlider::ThumbFrameFor(int32 channel)
|
|||||||
_UpdateFontDimens();
|
_UpdateFontDimens();
|
||||||
|
|
||||||
BRect frame(0.0, 0.0, 0.0, 0.0);
|
BRect frame(0.0, 0.0, 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 (fIsVertical) {
|
||||||
frame.OffsetBy(channel * frame.Width(), (frame.Height() / 2.0) -
|
frame.OffsetBy(channel * frame.Width(), (frame.Height() / 2.0) -
|
||||||
(kPadding * 2.0) - 1.0);
|
(kPadding * 2.0) - 1.0);
|
||||||
} else {
|
} else {
|
||||||
frame.OffsetBy(frame.Width() / 2.0, channel * frame.Height() + 1.0);
|
frame.OffsetBy(frame.Width() / 2.0, channel * frame.Height()
|
||||||
|
+ 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return frame;
|
return frame;
|
||||||
@@ -671,9 +687,10 @@ 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 (fIsVertical)
|
||||||
delta = range - delta;
|
delta = range - delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -689,7 +706,7 @@ BChannelSlider::ThumbRangeFor(int32 channel)
|
|||||||
float range = 0;
|
float range = 0;
|
||||||
BRect bounds = Bounds();
|
BRect bounds = Bounds();
|
||||||
BRect frame = ThumbFrameFor(channel);
|
BRect frame = ThumbFrameFor(channel);
|
||||||
if (_Vertical()) {
|
if (fIsVertical) {
|
||||||
// *height = (fLineFeed * 3.0) + (kPadding * 2.0) + 100.0;
|
// *height = (fLineFeed * 3.0) + (kPadding * 2.0) + 100.0;
|
||||||
range = bounds.Height() - frame.Height() - (fLineFeed * 3.0) -
|
range = bounds.Height() - frame.Height() - (fLineFeed * 3.0) -
|
||||||
(kPadding * 2.0);
|
(kPadding * 2.0);
|
||||||
@@ -701,6 +718,9 @@ BChannelSlider::ThumbRangeFor(int32 channel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BChannelSlider::_InitData()
|
BChannelSlider::_InitData()
|
||||||
{
|
{
|
||||||
@@ -711,13 +731,13 @@ BChannelSlider::_InitData()
|
|||||||
fRightKnob = NULL;
|
fRightKnob = NULL;
|
||||||
fBacking = NULL;
|
fBacking = NULL;
|
||||||
fBackingView = NULL;
|
fBackingView = NULL;
|
||||||
fVertical = Bounds().Width() / Bounds().Height() < 1;
|
fIsVertical = 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));
|
||||||
@@ -728,7 +748,7 @@ void
|
|||||||
BChannelSlider::_FinishChange(bool update)
|
BChannelSlider::_FinishChange(bool update)
|
||||||
{
|
{
|
||||||
if (fInitialValues != NULL) {
|
if (fInitialValues != NULL) {
|
||||||
bool *inMask = NULL;
|
bool* inMask = NULL;
|
||||||
int32 numChannels = CountChannels();
|
int32 numChannels = CountChannels();
|
||||||
if (!fAllChannels) {
|
if (!fAllChannels) {
|
||||||
inMask = new (std::nothrow) bool[CountChannels()];
|
inMask = new (std::nothrow) bool[CountChannels()];
|
||||||
@@ -738,12 +758,13 @@ BChannelSlider::_FinishChange(bool update)
|
|||||||
inMask[fCurrentChannel] = true;
|
inMask[fCurrentChannel] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InvokeChannel(update ? ModificationMessage() : NULL, 0, numChannels, inMask);
|
InvokeChannel(update ? ModificationMessage() : NULL, 0, numChannels,
|
||||||
|
inMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!update) {
|
if (!update) {
|
||||||
SetTracking(false);
|
SetTracking(false);
|
||||||
_Redraw();
|
Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -768,7 +789,7 @@ BChannelSlider::_DrawThumbs()
|
|||||||
BRect last = ThumbFrameFor(CountChannels() - 1);
|
BRect last = ThumbFrameFor(CountChannels() - 1);
|
||||||
BRect rect(first.LeftTop(), last.RightBottom());
|
BRect rect(first.LeftTop(), last.RightBottom());
|
||||||
|
|
||||||
if (_Vertical())
|
if (fIsVertical)
|
||||||
rect.top -= ThumbRangeFor(0);
|
rect.top -= ThumbRangeFor(0);
|
||||||
else
|
else
|
||||||
rect.right += ThumbRangeFor(0);
|
rect.right += ThumbRangeFor(0);
|
||||||
@@ -781,8 +802,10 @@ BChannelSlider::_DrawThumbs()
|
|||||||
if (fBacking->Lock()) {
|
if (fBacking->Lock()) {
|
||||||
fBacking->AddChild(fBackingView);
|
fBacking->AddChild(fBackingView);
|
||||||
fBackingView->SetFontSize(10.0);
|
fBackingView->SetFontSize(10.0);
|
||||||
fBackingView->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
fBackingView->SetLowColor(
|
||||||
fBackingView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
fBackingView->SetViewColor(
|
||||||
|
ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
fBacking->Unlock();
|
fBacking->Unlock();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -812,7 +835,7 @@ BChannelSlider::_DrawThumbs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// draw some kind of current value tool tip
|
// draw some kind of current value tool tip
|
||||||
if (fCurrentChannel != -1 && fMinpoint != 0) {
|
if (fCurrentChannel != -1 && fMinPoint != 0) {
|
||||||
char valueString[32];
|
char valueString[32];
|
||||||
snprintf(valueString, 32, "%ld", ValueFor(fCurrentChannel));
|
snprintf(valueString, 32, "%ld", ValueFor(fCurrentChannel));
|
||||||
float stringWidth = fBackingView->StringWidth(valueString);
|
float stringWidth = fBackingView->StringWidth(valueString);
|
||||||
@@ -822,24 +845,28 @@ BChannelSlider::_DrawThumbs()
|
|||||||
BRect thumbFrame(ThumbFrameFor(fCurrentChannel));
|
BRect thumbFrame(ThumbFrameFor(fCurrentChannel));
|
||||||
float thumbDelta(ThumbDeltaFor(fCurrentChannel));
|
float thumbDelta(ThumbDeltaFor(fCurrentChannel));
|
||||||
|
|
||||||
if (_Vertical()) {
|
if (fIsVertical) {
|
||||||
valueRect.OffsetTo((thumbFrame.Width() - width) / 2.0 +
|
valueRect.OffsetTo((thumbFrame.Width() - width) / 2.0 +
|
||||||
fCurrentChannel * thumbFrame.Width(),
|
fCurrentChannel * thumbFrame.Width(),
|
||||||
thumbDelta + thumbFrame.Height() + 2.0);
|
thumbDelta + thumbFrame.Height() + 2.0);
|
||||||
if (valueRect.bottom > fBackingView->Frame().bottom)
|
if (valueRect.bottom > fBackingView->Frame().bottom)
|
||||||
valueRect.OffsetBy(0.0, -(thumbFrame.Height() + 12.0));
|
valueRect.OffsetBy(0.0, -(thumbFrame.Height() + 12.0));
|
||||||
} else {
|
} else {
|
||||||
valueRect.OffsetTo((thumbDelta - (width + 2.0)), thumbFrame.top);
|
valueRect.OffsetTo((thumbDelta - (width + 2.0)),
|
||||||
if (valueRect.left < fBackingView->Frame().left)
|
thumbFrame.top);
|
||||||
valueRect.OffsetBy(thumbFrame.Width() + width + 2.0, 0.0);
|
if (valueRect.left < fBackingView->Frame().left) {
|
||||||
|
valueRect.OffsetBy(thumbFrame.Width() + width + 2.0,
|
||||||
|
0.0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rgb_color oldColor = fBackingView->HighColor();
|
rgb_color oldColor = fBackingView->HighColor();
|
||||||
fBackingView->SetHighColor(255, 255, 172);
|
fBackingView->SetHighColor(255, 255, 172);
|
||||||
fBackingView->FillRect(valueRect);
|
fBackingView->FillRect(valueRect);
|
||||||
fBackingView->SetHighColor(0, 0, 0);
|
fBackingView->SetHighColor(0, 0, 0);
|
||||||
fBackingView->DrawString(valueString, BPoint(valueRect.left +
|
fBackingView->DrawString(valueString, BPoint(valueRect.left
|
||||||
(valueRect.Width() - stringWidth) / 2.0, valueRect.bottom -1.0));
|
+ (valueRect.Width() - stringWidth) / 2.0, valueRect.bottom
|
||||||
|
- 1.0));
|
||||||
fBackingView->StrokeRect(valueRect.InsetByCopy(-0.5, -0.5));
|
fBackingView->StrokeRect(valueRect.InsetByCopy(-0.5, -0.5));
|
||||||
fBackingView->SetHighColor(oldColor);
|
fBackingView->SetHighColor(oldColor);
|
||||||
}
|
}
|
||||||
@@ -858,7 +885,7 @@ BChannelSlider::_DrawThumbs()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BChannelSlider::_DrawGrooveFrame(BView *into, const BRect &area)
|
BChannelSlider::_DrawGrooveFrame(BView* into, const BRect& area)
|
||||||
{
|
{
|
||||||
if (into) {
|
if (into) {
|
||||||
rgb_color oldColor = into->HighColor();
|
rgb_color oldColor = into->HighColor();
|
||||||
@@ -879,21 +906,6 @@ BChannelSlider::_DrawGrooveFrame(BView *into, const BRect &area)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
BChannelSlider::_Vertical() const
|
|
||||||
{
|
|
||||||
return fVertical;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
BChannelSlider::_Redraw()
|
|
||||||
{
|
|
||||||
Invalidate(Bounds());
|
|
||||||
Flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BChannelSlider::_MouseMovedCommon(BPoint point, BPoint point2)
|
BChannelSlider::_MouseMovedCommon(BPoint point, BPoint point2)
|
||||||
{
|
{
|
||||||
@@ -901,10 +913,10 @@ BChannelSlider::_MouseMovedCommon(BPoint point, BPoint point2)
|
|||||||
int32 limitRange = MaxLimitList()[fCurrentChannel] -
|
int32 limitRange = MaxLimitList()[fCurrentChannel] -
|
||||||
MinLimitList()[fCurrentChannel];
|
MinLimitList()[fCurrentChannel];
|
||||||
float range = ThumbRangeFor(fCurrentChannel);
|
float range = ThumbRangeFor(fCurrentChannel);
|
||||||
if (_Vertical())
|
if (fIsVertical)
|
||||||
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) +
|
int32 value = (int32)(floatValue / range * limitRange) +
|
||||||
MinLimitList()[fCurrentChannel];
|
MinLimitList()[fCurrentChannel];
|
||||||
@@ -920,11 +932,14 @@ BChannelSlider::_MouseMovedCommon(BPoint point, BPoint point2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BChannelSlider::_Reserved_BChannelSlider_0(void *, ...) {}
|
// #pragma mark - FBC padding
|
||||||
void BChannelSlider::_Reserved_BChannelSlider_1(void *, ...) {}
|
|
||||||
void BChannelSlider::_Reserved_BChannelSlider_2(void *, ...) {}
|
|
||||||
void BChannelSlider::_Reserved_BChannelSlider_3(void *, ...) {}
|
void BChannelSlider::_Reserved_BChannelSlider_0(void*, ...) {}
|
||||||
void BChannelSlider::_Reserved_BChannelSlider_4(void *, ...) {}
|
void BChannelSlider::_Reserved_BChannelSlider_1(void*, ...) {}
|
||||||
void BChannelSlider::_Reserved_BChannelSlider_5(void *, ...) {}
|
void BChannelSlider::_Reserved_BChannelSlider_2(void*, ...) {}
|
||||||
void BChannelSlider::_Reserved_BChannelSlider_6(void *, ...) {}
|
void BChannelSlider::_Reserved_BChannelSlider_3(void*, ...) {}
|
||||||
void BChannelSlider::_Reserved_BChannelSlider_7(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*, ...) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user