From 6a1d169c52c9378bb186c43b00c7c70e77eb85e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sun, 6 Apr 2008 15:11:31 +0000 Subject: [PATCH] * Removed trailing spaces in ScrollBar.h * It's not a good idea to archive fProportion as int32, seeing it's a float on [0..1]. * Implemented archive constructor for BScrollBar. Untested. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24832 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/interface/ScrollBar.h | 2 +- src/kits/interface/ScrollBar.cpp | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/headers/os/interface/ScrollBar.h b/headers/os/interface/ScrollBar.h index d41a6f7d60..cda8b4e257 100644 --- a/headers/os/interface/ScrollBar.h +++ b/headers/os/interface/ScrollBar.h @@ -112,7 +112,7 @@ class BScrollBar : public BView { float fLargeStep; float fValue; float fProportion; - BView* fTarget; + BView* fTarget; orientation fOrientation; char* fTargetName; diff --git a/src/kits/interface/ScrollBar.cpp b/src/kits/interface/ScrollBar.cpp index eeb5e52732..f3d4a64b00 100644 --- a/src/kits/interface/ScrollBar.cpp +++ b/src/kits/interface/ScrollBar.cpp @@ -199,6 +199,24 @@ BScrollBar::BScrollBar(BRect frame, const char* name, BView *target, BScrollBar::BScrollBar(BMessage *data) : BView(data) { + if (data->FindFloat("_range", 0, &fMin) < B_OK) + fMin = 0.0; + if (data->FindFloat("_range", 1, &fMax) < B_OK) + fMax = 0.0; + if (data->FindFloat("_steps", 0, &fSmallStep) < B_OK) + fSmallStep = 1.0; + if (data->FindFloat("_steps", 1, &fLargeStep) < B_OK) + fSmallStep = 10.0; + if (data->FindFloat("_val", &fValue) < B_OK) + fValue = 0.0; + int32 orientation; + if (data->FindInt32("_orient", &orientation) < B_OK) + fOrientation = B_VERTICAL; + else + fOrientation = (enum orientation)orientation; + + if (data->FindFloat("_prop", &fProportion) < B_OK) + fProportion = 0.0; } @@ -248,7 +266,7 @@ BScrollBar::Archive(BMessage *data, bool deep) const err = data->AddInt32("_orient", (int32)fOrientation); if (err != B_OK) return err; - err = data->AddInt32("_prop", (int32)fProportion); + err = data->AddFloat("_prop", fProportion); return err; }