VolumeView: Fix unarchiving
This commit is contained in:
parent
5e8a753ef3
commit
bf02ce442e
|
@ -20,18 +20,10 @@ static const uint32 VOLUME_CHANGED = 'vvch';
|
||||||
|
|
||||||
VolumeView::VolumeView(BRect frame)
|
VolumeView::VolumeView(BRect frame)
|
||||||
:
|
:
|
||||||
ReplicantView(frame, "Volume", B_FOLLOW_RIGHT, B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW)
|
ReplicantView(frame, "Volume", B_FOLLOW_RIGHT, B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW | B_NAVIGABLE | B_FRAME_EVENTS)
|
||||||
{
|
{
|
||||||
SetViewColor(B_TRANSPARENT_COLOR);
|
_InitInterface();
|
||||||
|
Pulse();
|
||||||
fSlider = new BSlider(frame, "volumeSlider", NULL, NULL, 0, 1000, B_HORIZONTAL, B_BLOCK_THUMB,
|
|
||||||
B_FOLLOW_LEFT_RIGHT);
|
|
||||||
fSlider->SetModificationMessage(new BMessage(VOLUME_CHANGED));
|
|
||||||
fSlider->UseFillColor(true, &kVolumeGreen);
|
|
||||||
fSlider->SetViewColor(B_TRANSPARENT_COLOR);
|
|
||||||
AddChild(fSlider);
|
|
||||||
|
|
||||||
_Init();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,10 +31,12 @@ VolumeView::VolumeView(BMessage* data)
|
||||||
:
|
:
|
||||||
ReplicantView(data)
|
ReplicantView(data)
|
||||||
{
|
{
|
||||||
|
// For some reason, the BSlider gets archived with a wacko frame― better to just nuke it.
|
||||||
fSlider = dynamic_cast<BSlider*>(FindView("volumeSlider"));
|
fSlider = dynamic_cast<BSlider*>(FindView("volumeSlider"));
|
||||||
if (fSlider->IsHidden())
|
delete fSlider;
|
||||||
fSlider->Show();
|
|
||||||
_Init();
|
_InitInterface();
|
||||||
|
Pulse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,13 +116,21 @@ VolumeView::SetInactive(bool inactive)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VolumeView::_Init()
|
VolumeView::_InitInterface()
|
||||||
{
|
{
|
||||||
|
SetViewColor(B_TRANSPARENT_COLOR);
|
||||||
|
|
||||||
|
fSlider = new BSlider(BRect(), "volumeSlider", NULL, NULL, 0, 1000, B_HORIZONTAL, B_BLOCK_THUMB,
|
||||||
|
B_FOLLOW_LEFT_RIGHT);
|
||||||
|
fSlider->SetModificationMessage(new BMessage(VOLUME_CHANGED));
|
||||||
|
fSlider->UseFillColor(true, &kVolumeGreen);
|
||||||
|
fSlider->SetViewColor(B_TRANSPARENT_COLOR);
|
||||||
|
AddChild(fSlider);
|
||||||
|
|
||||||
float height = 20.0;
|
float height = 20.0;
|
||||||
fSlider->GetPreferredSize(NULL, &height);
|
fSlider->GetPreferredSize(NULL, &height);
|
||||||
SetExplicitMaxSize(BSize(B_SIZE_UNSET, height + 16));
|
SetExplicitMaxSize(BSize(B_SIZE_UNSET, height + 16));
|
||||||
|
fSlider->ResizeTo(Frame().Size());
|
||||||
Pulse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,7 @@ public:
|
||||||
virtual void SetInactive(bool inactive);
|
virtual void SetInactive(bool inactive);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _Init();
|
void _InitInterface();
|
||||||
|
|
||||||
float _VolumeToPosition(float volume);
|
float _VolumeToPosition(float volume);
|
||||||
float _PositionToVolume(float position);
|
float _PositionToVolume(float position);
|
||||||
|
|
||||||
|
|
Ŝarĝante…
Reference in New Issue