Patch by Bryce Groff: Fixed the partition size slider. It had the partition
offset as minimum and the maximum partition size as maximum value. It's now the partition start and end offset. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31459 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
dec28f85e0
commit
eff35b90f2
@ -162,7 +162,8 @@ CreateParamsPanel::Go(off_t& offset, off_t& size, BString& type)
|
||||
type << _type;
|
||||
}
|
||||
// Return the value back as bytes.
|
||||
size = (off_t)fSizeSlider->Value() * kMegaByte;
|
||||
size = (off_t)fSizeSlider->Size() * kMegaByte;
|
||||
offset = (off_t)fSizeSlider->Offset() * kMegaByte;
|
||||
}
|
||||
|
||||
int32 value = fReturnValue;
|
||||
@ -196,7 +197,7 @@ CreateParamsPanel::_CreateViewControls(off_t offset, off_t size)
|
||||
fTypeMenuField = new BMenuField("Partition Type", fTypePopUpMenu, NULL);
|
||||
|
||||
fSizeSlider = new SizeSlider("Slider", "Partition Size", NULL, offset,
|
||||
size);
|
||||
offset + size);
|
||||
fSizeSlider->SetPosition(1.0);
|
||||
|
||||
fOKButton = new BButton("Create", new BMessage(MSG_OK));
|
||||
|
@ -115,18 +115,16 @@ SpaceIDMap::SpaceIDFor(partition_id parentID, off_t spaceOffset)
|
||||
|
||||
SizeSlider::SizeSlider(const char* name, const char* label,
|
||||
BMessage* message, int32 minValue, int32 maxValue)
|
||||
: BSlider(name, label, message, minValue, maxValue, B_HORIZONTAL,
|
||||
B_TRIANGLE_THUMB),
|
||||
fOffset(minValue),
|
||||
fSize(maxValue)
|
||||
: BSlider(name, label, message, minValue, maxValue,
|
||||
B_HORIZONTAL, B_TRIANGLE_THUMB),
|
||||
fStartOffset(minValue),
|
||||
fEndOffset(maxValue)
|
||||
{
|
||||
SetBarColor((rgb_color){ 0, 80, 255, 255 });
|
||||
BString offset, size;
|
||||
offset << fOffset;
|
||||
offset << " MB";
|
||||
size << fSize;
|
||||
size << " MB";
|
||||
SetLimitLabels(offset.String(), size.String());
|
||||
BString startOffset, endOffset;
|
||||
startOffset << "Offset: " << fStartOffset << " MB";
|
||||
endOffset << "End: " << fEndOffset << " MB";
|
||||
SetLimitLabels(startOffset.String(), endOffset.String());
|
||||
}
|
||||
|
||||
|
||||
@ -139,8 +137,24 @@ const char*
|
||||
SizeSlider::UpdateText() const
|
||||
{
|
||||
fStatusLabel.Truncate(0);
|
||||
fStatusLabel << Value();
|
||||
fStatusLabel << Value() - fStartOffset;
|
||||
fStatusLabel << " MB";
|
||||
|
||||
return fStatusLabel.String();
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
SizeSlider::Size()
|
||||
{
|
||||
return Value() - fStartOffset;
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
SizeSlider::Offset()
|
||||
{
|
||||
// TODO: This should be the changed offset once a double
|
||||
// headed slider is implemented.
|
||||
return fStartOffset;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
static const uint32 kMegaByte = 1048576;
|
||||
static const uint32 kMegaByte = 0x100000;
|
||||
|
||||
class SpaceIDMap : public HashMap<HashString, partition_id> {
|
||||
public:
|
||||
@ -50,10 +50,12 @@ public:
|
||||
virtual ~SizeSlider();
|
||||
|
||||
virtual const char* UpdateText() const;
|
||||
int32 Size();
|
||||
int32 Offset();
|
||||
|
||||
private:
|
||||
off_t fOffset;
|
||||
off_t fSize;
|
||||
off_t fStartOffset;
|
||||
off_t fEndOffset;
|
||||
mutable BString fStatusLabel;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user