From 859c5ac301e991b9ad23403b2b00a54b1313bdd5 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Thu, 3 Feb 2005 15:50:41 +0000 Subject: [PATCH] Implemented Archive() and unarchiving constructor. Removed bad linefeeds. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11234 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/ChannelControl.cpp | 11 +++++------ src/kits/interface/ChannelSlider.cpp | 26 +++++++++++++++++--------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/kits/interface/ChannelControl.cpp b/src/kits/interface/ChannelControl.cpp index 748a8de753..8b89555b83 100644 --- a/src/kits/interface/ChannelControl.cpp +++ b/src/kits/interface/ChannelControl.cpp @@ -9,7 +9,7 @@ static property_info // TODO: Finish this -sPropertyInfo[] = { +sPropertyInfo[] = { {0} }; @@ -227,7 +227,7 @@ BChannelControl::SetChannelCount(int32 channel_count) { if (channel_count < 0 || channel_count >= MaxChannelCount()) return B_BAD_VALUE; - + // TODO: Currently we only grow the buffer. Test what BeOS does if (channel_count > fChannelCount) { int32 *newMin = new int32[channel_count]; @@ -316,7 +316,6 @@ status_t BChannelControl::SetLimitsFor(int32 fromChannel, int32 channelCount, const int32 *minimum, const int32 *maximum) { - return B_ERROR; } @@ -348,7 +347,7 @@ BChannelControl::SetLimitLabels(const char *minLabel, const char *maxLabel) { if (minLabel != fMinLabel) fMinLabel = minLabel; - + if (maxLabel != fMaxLabel) fMaxLabel = maxLabel; @@ -411,8 +410,8 @@ BChannelControl::StuffValues(int32 fromChannel, int32 channelCount, || fromChannel + channelCount >= fChannelCount) return B_BAD_INDEX; - for (int32 i = 0; i < channelCount; i++) { - if (inValues[i] <= fChannelMax[fromChannel + i] + for (int32 i = 0; i < channelCount; i++) { + if (inValues[i] <= fChannelMax[fromChannel + i] && inValues[i] >= fChannelMin[fromChannel + i]) fChannelValues[fromChannel + i] = inValues[i]; diff --git a/src/kits/interface/ChannelSlider.cpp b/src/kits/interface/ChannelSlider.cpp index 2ced018b68..c45cc61ed4 100644 --- a/src/kits/interface/ChannelSlider.cpp +++ b/src/kits/interface/ChannelSlider.cpp @@ -48,7 +48,11 @@ BChannelSlider::BChannelSlider(BRect area, const char *name, const char *label, BChannelSlider::BChannelSlider(BMessage *archive) : BChannelControl(archive) { - // TODO: Implement + InitData(); + + orientation orient; + if (archive->FindInt32("_orient", (int32 *)&orient) == B_OK) + SetOrientation(orient); } @@ -71,8 +75,11 @@ BChannelSlider::Instantiate(BMessage *archive) status_t BChannelSlider::Archive(BMessage *into, bool deep) const { - // TODO: Implement - return B_ERROR; + status_t status = BChannelControl::Archive(into, deep); + if (status == B_OK) + status = into->AddInt32("_orient", (int32)Orientation()); + + return status; } @@ -166,7 +173,6 @@ BChannelSlider::Draw(BRect updateRect) void BChannelSlider::MouseDown(BPoint where) { - // TODO: Implement } @@ -281,7 +287,9 @@ BChannelSlider::DrawChannel(BView *into, int32 channel, BRect area, bool pressed void BChannelSlider::DrawGroove(BView *into, int32 channel, BPoint topLeft, BPoint bottomRight) { - // TODO: Implement + // TODO: Draw the real thing + ASSERT(into != NULL); + into->StrokeRect(BRect(topLeft, bottomRight), B_SOLID_HIGH); } @@ -289,7 +297,7 @@ void BChannelSlider::DrawThumb(BView *into, int32 channel, BPoint where, bool pressed) { ASSERT(into != NULL); - + const BBitmap *thumb = ThumbFor(channel, pressed); if (thumb == NULL) return; @@ -318,7 +326,6 @@ BChannelSlider::DrawThumb(BView *into, int32 channel, BPoint where, bool pressed const BBitmap * BChannelSlider::ThumbFor(int32 channel, bool pressed) { - // TODO: Implement return NULL; } @@ -438,7 +445,8 @@ BChannelSlider::UpdateFontDimens() void BChannelSlider::DrawThumbs() -{ +{ + } @@ -464,7 +472,7 @@ BChannelSlider::Redraw() void -BChannelSlider::MouseMovedCommon(BPoint , BPoint ) +BChannelSlider::MouseMovedCommon(BPoint point, BPoint point2) { // TODO: Implement }