Implemented enlarging controls in full-screen mode, it's optional
and the setting defaults to "on". git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38610 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
c1a1df8d83
commit
341ea11eb3
@ -913,6 +913,7 @@ MainWin::MessageReceived(BMessage* msg)
|
||||
fControls->MoveTo(fVideoView->Frame().left,
|
||||
fVideoView->Frame().bottom + 1);
|
||||
fBackground->AddChild(fControls);
|
||||
fControls->SetSymbolScale(1.0f);
|
||||
while (!fControls->IsHidden())
|
||||
fControls->Hide();
|
||||
}
|
||||
@ -2236,6 +2237,8 @@ MainWin::_ShowFullscreenControls(bool show, bool animate)
|
||||
fControls->MoveTo(fVideoView->Bounds().left,
|
||||
fVideoView->Bounds().bottom + 1);
|
||||
fVideoView->AddChild(fControls);
|
||||
if (fScaleFullscreenControls)
|
||||
fControls->SetSymbolScale(1.5f);
|
||||
while (fControls->IsHidden())
|
||||
fControls->Show();
|
||||
}
|
||||
@ -2246,7 +2249,8 @@ MainWin::_ShowFullscreenControls(bool show, bool animate)
|
||||
// time of the animation.
|
||||
const float kAnimationOffsets[] = { 0.05, 0.2, 0.5, 0.2, 0.05 };
|
||||
const int32 steps = sizeof(kAnimationOffsets) / sizeof(float);
|
||||
float moveDist = show ? -fControlsHeight : fControlsHeight;
|
||||
float height = fControls->Bounds().Height();
|
||||
float moveDist = show ? -height : height;
|
||||
float originalY = fControls->Frame().top;
|
||||
for (int32 i = 0; i < steps; i++) {
|
||||
BMessage message(M_SLIDE_CONTROLS);
|
||||
@ -2264,6 +2268,7 @@ MainWin::_ShowFullscreenControls(bool show, bool animate)
|
||||
fControls->MoveTo(fVideoView->Frame().left,
|
||||
fVideoView->Frame().bottom + 1);
|
||||
fBackground->AddChild(fControls);
|
||||
fControls->SetSymbolScale(1.0f);
|
||||
while (!fControls->IsHidden())
|
||||
fControls->Hide();
|
||||
}
|
||||
@ -2476,6 +2481,7 @@ MainWin::_AdoptGlobalSettings()
|
||||
fCloseWhenDonePlayingSound = settings.closeWhenDonePlayingSound;
|
||||
fLoopMovies = settings.loopMovie;
|
||||
fLoopSounds = settings.loopSound;
|
||||
fScaleFullscreenControls = settings.scaleFullscreenControls;
|
||||
}
|
||||
|
||||
|
||||
|
@ -194,6 +194,7 @@ private:
|
||||
bool fCloseWhenDonePlayingSound;
|
||||
bool fLoopMovies;
|
||||
bool fLoopSounds;
|
||||
bool fScaleFullscreenControls;
|
||||
bigtime_t fInitialSeekPosition;
|
||||
bool fAllowWinding;
|
||||
|
||||
|
@ -20,9 +20,7 @@ DurationView::DurationView(const char* name)
|
||||
fDuration(0),
|
||||
fDisplayDuration(0)
|
||||
{
|
||||
BFont font(be_bold_font);
|
||||
font.SetSize(font.Size() * 1.2);
|
||||
SetFont(&font);
|
||||
SetSymbolScale(1.0f);
|
||||
|
||||
SetAlignment(B_ALIGN_RIGHT);
|
||||
|
||||
@ -99,6 +97,16 @@ DurationView::SetMode(uint32 mode)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DurationView::SetSymbolScale(float scale)
|
||||
{
|
||||
BFont font(be_bold_font);
|
||||
font.SetSize(font.Size() * scale * 1.2);
|
||||
SetFont(&font);
|
||||
InvalidateLayout();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DurationView::_Update()
|
||||
{
|
||||
|
@ -35,6 +35,8 @@ public:
|
||||
uint32 Mode() const
|
||||
{ return fMode; }
|
||||
|
||||
void SetSymbolScale(float scale);
|
||||
|
||||
private:
|
||||
void _Update();
|
||||
void _GenerateString(bigtime_t duration);
|
||||
|
@ -167,10 +167,17 @@ PlayPauseButton::SetStopped()
|
||||
void
|
||||
PlayPauseButton::SetSymbols(BShape* playSymbolShape, BShape* pauseSymbolShape)
|
||||
{
|
||||
BSize oldSize = MinSize();
|
||||
|
||||
delete fPlaySymbol;
|
||||
fPlaySymbol = playSymbolShape;
|
||||
delete fPauseSymbol;
|
||||
fPauseSymbol = pauseSymbolShape;
|
||||
|
||||
if (MinSize() != oldSize)
|
||||
InvalidateLayout();
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,12 +26,13 @@ SeekSlider::SeekSlider(const char* name, BMessage* message, int32 minValue,
|
||||
B_TRIANGLE_THUMB),
|
||||
fTracking(false),
|
||||
fLastTrackTime(0),
|
||||
fDisabledString(kDisabledSeekMessage)
|
||||
fDisabledString(kDisabledSeekMessage),
|
||||
fScale(0.0f)
|
||||
{
|
||||
BFont font(be_plain_font);
|
||||
font.SetSize(9.0);
|
||||
SetFont(&font);
|
||||
SetBarThickness(15.0);
|
||||
SetSymbolScale(1.0);
|
||||
rgb_color fillColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||
B_DARKEN_3_TINT);
|
||||
UseFillColor(true, &fillColor);
|
||||
@ -52,6 +53,23 @@ SeekSlider::Invoke(BMessage* message)
|
||||
}
|
||||
|
||||
|
||||
BRect
|
||||
SeekSlider::ThumbFrame() const
|
||||
{
|
||||
BRect frame = BSlider::ThumbFrame();
|
||||
|
||||
float center = (frame.left + frame.right) / 2.0f;
|
||||
float height = ceilf(frame.Height() * fScale);
|
||||
float width = ceilf(frame.Width() * fScale);
|
||||
|
||||
frame.left = floorf(center - width / 2) + 1;
|
||||
frame.right = frame.left + width;
|
||||
frame.bottom = frame.top + height;
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SeekSlider::DrawBar()
|
||||
{
|
||||
@ -112,6 +130,41 @@ SeekSlider::GetPreferredSize(float* _width, float* _height)
|
||||
float minWidth = 15.0 + StringWidth(fDisabledString.String()) + 15.0;
|
||||
*_width = max_c(*_width, minWidth);
|
||||
}
|
||||
if (_height != NULL) {
|
||||
BRect unscaledThumbFrame = BSlider::ThumbFrame();
|
||||
BRect scaledThumbFrame = ThumbFrame();
|
||||
*_height += scaledThumbFrame.Height() - unscaledThumbFrame.Height();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BSize
|
||||
SeekSlider::MinSize()
|
||||
{
|
||||
printf("SeekSlider::MinSize()\n");
|
||||
BSize size = BSlider::MinSize();
|
||||
|
||||
BRect unscaledThumbFrame = BSlider::ThumbFrame();
|
||||
BRect scaledThumbFrame = ThumbFrame();
|
||||
printf("height: %.1f/%.1f\n", unscaledThumbFrame.Height(), scaledThumbFrame.Height());
|
||||
size.height += scaledThumbFrame.Height() - unscaledThumbFrame.Height();
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
BSize
|
||||
SeekSlider::MaxSize()
|
||||
{
|
||||
printf("SeekSlider::MaxSize()\n");
|
||||
BSize size = BSlider::MaxSize();
|
||||
|
||||
BRect unscaledThumbFrame = BSlider::ThumbFrame();
|
||||
BRect scaledThumbFrame = ThumbFrame();
|
||||
printf("height: %.1f/%.1f\n", unscaledThumbFrame.Height(), scaledThumbFrame.Height());
|
||||
size.height += scaledThumbFrame.Height() - unscaledThumbFrame.Height();
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
@ -140,3 +193,16 @@ SeekSlider::SetDisabledString(const char* string)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SeekSlider::SetSymbolScale(float scale)
|
||||
{
|
||||
if (scale == fScale)
|
||||
return;
|
||||
printf("SeekSlider::SetSymbolScale(%.1f)\n", scale);
|
||||
|
||||
fScale = scale;
|
||||
SetBarThickness(fScale * 15.0);
|
||||
InvalidateLayout();
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,22 +19,28 @@ public:
|
||||
|
||||
// BSlider interface
|
||||
virtual status_t Invoke(BMessage* message);
|
||||
virtual BRect ThumbFrame() const;
|
||||
virtual void DrawBar();
|
||||
virtual void DrawThumb();
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void MouseUp(BPoint where);
|
||||
virtual void GetPreferredSize(float* _width,
|
||||
float* _height);
|
||||
virtual BSize MinSize();
|
||||
virtual BSize MaxSize();
|
||||
|
||||
// SeekSlider
|
||||
bool IsTracking() const;
|
||||
void SetDisabledString(const char* string);
|
||||
|
||||
void SetSymbolScale(float scale);
|
||||
|
||||
private:
|
||||
bool fTracking;
|
||||
bigtime_t fLastTrackTime;
|
||||
|
||||
BString fDisabledString;
|
||||
float fScale;
|
||||
};
|
||||
|
||||
|
||||
|
@ -86,9 +86,11 @@ SymbolButton::MinSize()
|
||||
if (fSymbol == NULL)
|
||||
return BButton::MinSize();
|
||||
|
||||
float scale = fBorders != 0 ? 2.5f : 1.0f;
|
||||
|
||||
BSize size;
|
||||
size.width = ceilf(fSymbol->Bounds().Width() * 2.5f);
|
||||
size.height = ceilf(fSymbol->Bounds().Height() * 2.5f);
|
||||
size.width = ceilf(fSymbol->Bounds().Width() * scale);
|
||||
size.height = ceilf(fSymbol->Bounds().Height() * scale);
|
||||
return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
|
||||
}
|
||||
|
||||
@ -97,7 +99,8 @@ BSize
|
||||
SymbolButton::MaxSize()
|
||||
{
|
||||
BSize size(MinSize());
|
||||
size.width = ceilf(size.width * 1.5f);
|
||||
if (fBorders != 0)
|
||||
size.width = ceilf(size.width * 1.5f);
|
||||
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size);
|
||||
}
|
||||
|
||||
@ -105,7 +108,14 @@ SymbolButton::MaxSize()
|
||||
void
|
||||
SymbolButton::SetSymbol(BShape* symbolShape)
|
||||
{
|
||||
BSize oldSize = MinSize();
|
||||
|
||||
delete fSymbol;
|
||||
fSymbol = symbolShape;
|
||||
|
||||
if (MinSize() != oldSize)
|
||||
InvalidateLayout();
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,20 @@ enum {
|
||||
TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons,
|
||||
bool usePeakView, bool useWindButtons)
|
||||
:
|
||||
BGroupView(B_VERTICAL, 0)
|
||||
BGroupView(B_VERTICAL, 0),
|
||||
fSeekSlider(NULL),
|
||||
fDurationView(NULL),
|
||||
fPositionToolTip(NULL),
|
||||
fPeakView(NULL),
|
||||
fVolumeSlider(NULL),
|
||||
fSkipBack(NULL),
|
||||
fSkipForward(NULL),
|
||||
fRewind(NULL),
|
||||
fForward(NULL),
|
||||
fPlayPause(NULL),
|
||||
fStop(NULL),
|
||||
fMute(NULL),
|
||||
fSymbolScale(1.0f)
|
||||
{
|
||||
// Pick a symbol size based on the current system font size, but make
|
||||
// sure the size is uneven, so the pointy shapes have their middle on
|
||||
@ -67,43 +80,23 @@ TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons,
|
||||
float symbolHeight = int(be_plain_font->Size() / 1.33) | 1;
|
||||
|
||||
BGroupView* seekGroup = new BGroupView(B_HORIZONTAL, 0);
|
||||
BGroupLayout* seekLayout = seekGroup->GroupLayout();
|
||||
fSeekLayout = seekGroup->GroupLayout();
|
||||
GroupLayout()->AddView(seekGroup);
|
||||
|
||||
// Seek slider
|
||||
fSeekSlider = new SeekSlider("seek slider", new BMessage(MSG_SEEK),
|
||||
0, kPositionFactor);
|
||||
seekLayout->AddView(fSeekSlider);
|
||||
|
||||
// Figure out the visual insets of the slider bounds towards the slider
|
||||
// bar, and use that as insets for the rest of the layout.
|
||||
float inset = fSeekSlider->BarFrame().left;
|
||||
float hInset = inset - fSeekSlider->BarFrame().top;
|
||||
if (hInset < 0.0f)
|
||||
hInset = 0.0f;
|
||||
|
||||
seekLayout->SetInsets(0, hInset, 0, 0);
|
||||
fSeekLayout->AddView(fSeekSlider);
|
||||
|
||||
fPositionToolTip = new PositionToolTip();
|
||||
fSeekSlider->SetToolTip(fPositionToolTip);
|
||||
|
||||
// Duration view
|
||||
fDurationView = new DurationView("duration view");
|
||||
seekLayout->AddView(fDurationView);
|
||||
|
||||
seekLayout->AddItem(BSpaceLayoutItem::CreateHorizontalStrut(5));
|
||||
fSeekLayout->AddView(fDurationView);
|
||||
|
||||
// Buttons
|
||||
|
||||
BGroupView* controlGroup = new BGroupView(B_HORIZONTAL, 0);
|
||||
controlGroup->GroupLayout()->SetInsets(inset, hInset, inset, inset);
|
||||
GroupLayout()->AddView(controlGroup);
|
||||
BGroupLayout* controlLayout = controlGroup->GroupLayout();
|
||||
|
||||
BGroupView* buttonGroup = new BGroupView(B_HORIZONTAL, 0);
|
||||
BGroupLayout* buttonLayout = buttonGroup->GroupLayout();
|
||||
controlLayout->AddView(buttonGroup, 0.6f);
|
||||
|
||||
uint32 topBottomBorder = BControlLook::B_TOP_BORDER
|
||||
| BControlLook::B_BOTTOM_BORDER;
|
||||
|
||||
@ -113,9 +106,12 @@ TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons,
|
||||
_CreateSkipBackwardsShape(symbolHeight),
|
||||
new BMessage(MSG_SKIP_BACKWARDS),
|
||||
BControlLook::B_LEFT_BORDER | topBottomBorder);
|
||||
buttonLayout->AddView(fSkipBack);
|
||||
} else
|
||||
fSkipBack = NULL;
|
||||
// Skip Foward
|
||||
fSkipForward = new SymbolButton(B_EMPTY_STRING,
|
||||
_CreateSkipForwardShape(symbolHeight),
|
||||
new BMessage(MSG_SKIP_FORWARD),
|
||||
BControlLook::B_RIGHT_BORDER | topBottomBorder);
|
||||
}
|
||||
|
||||
if (useWindButtons) {
|
||||
// Rewind
|
||||
@ -123,52 +119,30 @@ TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons,
|
||||
_CreateRewindShape(symbolHeight), new BMessage(MSG_REWIND),
|
||||
useSkipButtons ? topBottomBorder
|
||||
: BControlLook::B_LEFT_BORDER | topBottomBorder);
|
||||
buttonLayout->AddView(fRewind);
|
||||
} else
|
||||
fRewind = NULL;
|
||||
|
||||
// Play Pause
|
||||
fPlayPause = new PlayPauseButton(B_EMPTY_STRING,
|
||||
_CreatePlayShape(symbolHeight), _CreatePauseShape(symbolHeight),
|
||||
new BMessage(MSG_PLAY), topBottomBorder);
|
||||
|
||||
buttonLayout->AddView(fPlayPause);
|
||||
|
||||
// Stop
|
||||
fStop = new SymbolButton(B_EMPTY_STRING,
|
||||
_CreateStopShape(symbolHeight), new BMessage(MSG_STOP),
|
||||
topBottomBorder);
|
||||
buttonLayout->AddView(fStop);
|
||||
|
||||
if (useWindButtons) {
|
||||
// Forward
|
||||
fForward = new SymbolButton(B_EMPTY_STRING,
|
||||
_CreateForwardShape(symbolHeight), new BMessage(MSG_FORWARD),
|
||||
useSkipButtons ? topBottomBorder
|
||||
: BControlLook::B_RIGHT_BORDER | topBottomBorder);
|
||||
buttonLayout->AddView(fForward);
|
||||
} else
|
||||
fForward = NULL;
|
||||
}
|
||||
|
||||
if (useSkipButtons) {
|
||||
// Skip Foward
|
||||
fSkipForward = new SymbolButton(B_EMPTY_STRING,
|
||||
_CreateSkipForwardShape(symbolHeight),
|
||||
new BMessage(MSG_SKIP_FORWARD),
|
||||
BControlLook::B_RIGHT_BORDER | topBottomBorder);
|
||||
buttonLayout->AddView(fSkipForward);
|
||||
} else
|
||||
fSkipForward = NULL;
|
||||
// Play Pause
|
||||
fPlayPause = new PlayPauseButton(B_EMPTY_STRING,
|
||||
_CreatePlayShape(symbolHeight), _CreatePauseShape(symbolHeight),
|
||||
new BMessage(MSG_PLAY), useWindButtons || useSkipButtons
|
||||
? topBottomBorder
|
||||
: topBottomBorder | BControlLook::B_LEFT_BORDER);
|
||||
|
||||
controlLayout->AddItem(BSpaceLayoutItem::CreateHorizontalStrut(5));
|
||||
// Stop
|
||||
fStop = new SymbolButton(B_EMPTY_STRING,
|
||||
_CreateStopShape(symbolHeight), new BMessage(MSG_STOP),
|
||||
useWindButtons || useSkipButtons ? topBottomBorder
|
||||
: topBottomBorder | BControlLook::B_RIGHT_BORDER);
|
||||
|
||||
// Mute
|
||||
BShape* speakerShape = _CreateSpeakerShape(8);
|
||||
fMute = new SymbolButton(B_EMPTY_STRING, speakerShape,
|
||||
fMute = new SymbolButton(B_EMPTY_STRING,
|
||||
_CreateSpeakerShape(floorf(symbolHeight * 0.9)),
|
||||
new BMessage(MSG_SET_MUTE), 0);
|
||||
fMute->SetExplicitMinSize(BSize(speakerShape->Bounds().Width(),
|
||||
speakerShape->Bounds().Height()));
|
||||
controlLayout->AddView(fMute);
|
||||
|
||||
// Volume Slider
|
||||
fVolumeSlider = new VolumeSlider("volume slider",
|
||||
@ -177,19 +151,52 @@ TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons,
|
||||
kVolumeFactor, new BMessage(MSG_SET_VOLUME));
|
||||
fVolumeSlider->SetValue(_DbToGain(_ExponentialToLinear(0.0))
|
||||
* kVolumeFactor);
|
||||
controlLayout->AddView(fVolumeSlider);
|
||||
|
||||
// Peak view
|
||||
if (usePeakView) {
|
||||
if (usePeakView)
|
||||
fPeakView = new PeakView("peak view", false, false);
|
||||
controlLayout->AddView(fPeakView, 0.6f);
|
||||
} else
|
||||
fPeakView = NULL;
|
||||
|
||||
BSize size = controlLayout->MinSize();
|
||||
// Layout the controls
|
||||
|
||||
BGroupView* buttonGroup = new BGroupView(B_HORIZONTAL, 0);
|
||||
BGroupLayout* buttonLayout = buttonGroup->GroupLayout();
|
||||
|
||||
if (fSkipBack != NULL)
|
||||
buttonLayout->AddView(fSkipBack);
|
||||
if (fRewind != NULL)
|
||||
buttonLayout->AddView(fRewind);
|
||||
buttonLayout->AddView(fPlayPause);
|
||||
buttonLayout->AddView(fStop);
|
||||
if (fForward != NULL)
|
||||
buttonLayout->AddView(fForward);
|
||||
if (fSkipForward != NULL)
|
||||
buttonLayout->AddView(fSkipForward);
|
||||
|
||||
BGroupView* controlGroup = new BGroupView(B_HORIZONTAL, 0);
|
||||
GroupLayout()->AddView(controlGroup);
|
||||
fControlLayout = controlGroup->GroupLayout();
|
||||
fControlLayout->AddView(buttonGroup, 0.6f);
|
||||
fControlLayout->AddItem(BSpaceLayoutItem::CreateHorizontalStrut(5));
|
||||
fControlLayout->AddView(fMute);
|
||||
fControlLayout->AddView(fVolumeSlider);
|
||||
if (fPeakView != NULL)
|
||||
fControlLayout->AddView(fPeakView, 0.6f);
|
||||
|
||||
// Figure out the visual insets of the slider bounds towards the slider
|
||||
// bar, and use that as insets for the rest of the layout.
|
||||
float inset = fSeekSlider->BarFrame().left;
|
||||
float hInset = inset - fSeekSlider->BarFrame().top;
|
||||
if (hInset < 0.0f)
|
||||
hInset = 0.0f;
|
||||
|
||||
fSeekLayout->SetInsets(0, hInset, 5, 0);
|
||||
fControlLayout->SetInsets(inset, hInset, inset, inset);
|
||||
|
||||
BSize size = fControlLayout->MinSize();
|
||||
size.width *= 3;
|
||||
controlLayout->SetExplicitMaxSize(size);
|
||||
controlLayout->SetExplicitAlignment(BAlignment(B_ALIGN_CENTER,
|
||||
size.height = B_SIZE_UNSET;
|
||||
fControlLayout->SetExplicitMaxSize(size);
|
||||
fControlLayout->SetExplicitAlignment(BAlignment(B_ALIGN_CENTER,
|
||||
B_ALIGN_TOP));
|
||||
}
|
||||
|
||||
@ -223,13 +230,6 @@ TransportControlGroup::AttachedToWindow()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TransportControlGroup::FrameResized(float width, float height)
|
||||
{
|
||||
DoLayout();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TransportControlGroup::GetPreferredSize(float* _width, float* _height)
|
||||
{
|
||||
@ -507,6 +507,58 @@ TransportControlGroup::SetDisabledString(const char* string)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TransportControlGroup::SetSymbolScale(float scale)
|
||||
{
|
||||
if (scale == fSymbolScale)
|
||||
return;
|
||||
|
||||
fSymbolScale = scale;
|
||||
|
||||
if (fSeekSlider != NULL)
|
||||
fSeekSlider->SetSymbolScale(scale);
|
||||
if (fVolumeSlider != NULL) {
|
||||
fVolumeSlider->SetBarThickness(fVolumeSlider->PreferredBarThickness()
|
||||
* scale);
|
||||
}
|
||||
if (fDurationView != NULL)
|
||||
fDurationView->SetSymbolScale(scale);
|
||||
|
||||
float symbolHeight = int(scale * be_plain_font->Size() / 1.33) | 1;
|
||||
|
||||
if (fSkipBack != NULL)
|
||||
fSkipBack->SetSymbol(_CreateSkipBackwardsShape(symbolHeight));
|
||||
if (fSkipForward != NULL)
|
||||
fSkipForward->SetSymbol(_CreateSkipForwardShape(symbolHeight));
|
||||
if (fRewind != NULL)
|
||||
fRewind->SetSymbol(_CreateRewindShape(symbolHeight));
|
||||
if (fForward != NULL)
|
||||
fForward->SetSymbol(_CreateForwardShape(symbolHeight));
|
||||
if (fPlayPause != NULL) {
|
||||
fPlayPause->SetSymbols(_CreatePlayShape(symbolHeight),
|
||||
_CreatePauseShape(symbolHeight));
|
||||
}
|
||||
if (fStop != NULL)
|
||||
fStop->SetSymbol(_CreateStopShape(symbolHeight));
|
||||
if (fMute != NULL)
|
||||
fMute->SetSymbol(_CreateSpeakerShape(floorf(symbolHeight * 0.9)));
|
||||
|
||||
// Figure out the visual insets of the slider bounds towards the slider
|
||||
// bar, and use that as insets for the rest of the layout.
|
||||
float barInset = fSeekSlider->BarFrame().left;
|
||||
float inset = barInset * scale;
|
||||
float hInset = inset - fSeekSlider->BarFrame().top;
|
||||
if (hInset < 0.0f)
|
||||
hInset = 0.0f;
|
||||
|
||||
fSeekLayout->SetInsets(inset - barInset, hInset, inset, 0);
|
||||
fSeekLayout->SetSpacing(inset - barInset);
|
||||
fControlLayout->SetInsets(inset, hInset, inset, inset);
|
||||
fControlLayout->SetSpacing(inset - barInset);
|
||||
|
||||
ResizeTo(Bounds().Width(), GroupLayout()->MinSize().height);
|
||||
}
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
|
@ -43,7 +43,6 @@ public:
|
||||
|
||||
// BView interface
|
||||
virtual void AttachedToWindow();
|
||||
virtual void FrameResized(float width, float height);
|
||||
virtual void GetPreferredSize(float* width, float* height);
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
|
||||
@ -77,6 +76,7 @@ public:
|
||||
{ return fPeakView; }
|
||||
|
||||
void SetDisabledString(const char* string);
|
||||
void SetSymbolScale(float scale);
|
||||
|
||||
private:
|
||||
void _TogglePlaying();
|
||||
@ -117,6 +117,11 @@ private:
|
||||
PlayPauseButton* fPlayPause;
|
||||
SymbolButton* fStop;
|
||||
SymbolButton* fMute;
|
||||
|
||||
BGroupLayout* fSeekLayout;
|
||||
BGroupLayout* fControlLayout;
|
||||
|
||||
float fSymbolScale;
|
||||
};
|
||||
|
||||
#endif // TRANSPORT_CONTROL_GROUP_H
|
||||
|
@ -29,11 +29,7 @@ VolumeSlider::VolumeSlider(const char* name, int32 minValue, int32 maxValue,
|
||||
{
|
||||
SetModificationMessage(message);
|
||||
UseFillColor(true, &kGreen);
|
||||
#if KNOB_EMBEDDED
|
||||
SetBarThickness(10);
|
||||
#else
|
||||
SetBarThickness(8);
|
||||
#endif
|
||||
SetBarThickness(PreferredBarThickness());
|
||||
}
|
||||
|
||||
|
||||
@ -223,6 +219,17 @@ VolumeSlider::SetMuted(bool mute)
|
||||
}
|
||||
|
||||
|
||||
float
|
||||
VolumeSlider::PreferredBarThickness() const
|
||||
{
|
||||
#if KNOB_EMBEDDED
|
||||
return 10.0f;
|
||||
#else
|
||||
return 8.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
float
|
||||
VolumeSlider::_PointForValue(int32 value) const
|
||||
{
|
||||
|
@ -32,6 +32,8 @@ public:
|
||||
bool IsMuted() const
|
||||
{ return fMuted; }
|
||||
|
||||
float PreferredBarThickness() const;
|
||||
|
||||
private:
|
||||
float _PointForValue(int32 value) const;
|
||||
|
||||
|
@ -21,6 +21,7 @@ mpSettings::operator!=(const mpSettings& other) const
|
||||
|| loopSound != other.loopSound
|
||||
|| useOverlays != other.useOverlays
|
||||
|| scaleBilinear != other.scaleBilinear
|
||||
|| scaleFullscreenControls != other.scaleFullscreenControls
|
||||
|| backgroundMovieVolumeMode != other.backgroundMovieVolumeMode
|
||||
|| filePanelFolder != other.filePanelFolder
|
||||
|| audioPlayerWindowFrame != other.audioPlayerWindowFrame;
|
||||
@ -49,7 +50,9 @@ Settings::LoadSettings(mpSettings& settings) const
|
||||
settings.loopSound = fSettingsMessage.GetValue("loopSound", false);
|
||||
|
||||
settings.useOverlays = fSettingsMessage.GetValue("useOverlays", true);
|
||||
settings.scaleBilinear = fSettingsMessage.GetValue("scaleBilinear", false);
|
||||
settings.scaleBilinear = fSettingsMessage.GetValue("scaleBilinear", true);
|
||||
settings.scaleFullscreenControls
|
||||
= fSettingsMessage.GetValue("scaleFullscreenControls", true);
|
||||
|
||||
settings.backgroundMovieVolumeMode
|
||||
= fSettingsMessage.GetValue("bgMovieVolumeMode",
|
||||
@ -80,6 +83,8 @@ Settings::SaveSettings(const mpSettings& settings)
|
||||
|
||||
fSettingsMessage.SetValue("useOverlays", settings.useOverlays);
|
||||
fSettingsMessage.SetValue("scaleBilinear", settings.scaleBilinear);
|
||||
fSettingsMessage.SetValue("scaleFullscreenControls",
|
||||
settings.scaleFullscreenControls);
|
||||
|
||||
fSettingsMessage.SetValue("bgMovieVolumeMode",
|
||||
settings.backgroundMovieVolumeMode);
|
||||
|
@ -23,6 +23,7 @@ struct mpSettings {
|
||||
bool loopSound;
|
||||
bool useOverlays;
|
||||
bool scaleBilinear;
|
||||
bool scaleFullscreenControls;
|
||||
enum {
|
||||
BG_MOVIES_FULL_VOLUME = 0,
|
||||
BG_MOVIES_HALF_VLUME = 1,
|
||||
|
@ -33,6 +33,7 @@ enum {
|
||||
M_LOOP_SOUND,
|
||||
M_USE_OVERLAYS,
|
||||
M_SCALE_BILINEAR,
|
||||
M_SCALE_CONTROLS,
|
||||
M_START_FULL_VOLUME,
|
||||
M_START_HALF_VOLUME,
|
||||
M_START_MUTE_VOLUME,
|
||||
@ -101,6 +102,10 @@ SettingsWindow::SettingsWindow(BRect frame)
|
||||
"Scale movies smoothly (non-overlay mode)",
|
||||
new BMessage(M_SCALE_BILINEAR));
|
||||
|
||||
fScaleFullscreenControlsCB = new BCheckBox("chkBoxScaleControls",
|
||||
"Scale controls in full-screen mode",
|
||||
new BMessage(M_SCALE_CONTROLS));
|
||||
|
||||
fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
|
||||
"Full volume", new BMessage(M_START_FULL_VOLUME));
|
||||
|
||||
@ -149,6 +154,7 @@ SettingsWindow::SettingsWindow(BRect frame)
|
||||
.Add(BGroupLayoutBuilder(B_VERTICAL, 0)
|
||||
.Add(fUseOverlaysCB)
|
||||
.Add(fScaleBilinearCB)
|
||||
.Add(fScaleFullscreenControlsCB)
|
||||
)
|
||||
)
|
||||
.Add(BSpaceLayoutItem::CreateVerticalStrut(5))
|
||||
@ -303,6 +309,7 @@ SettingsWindow::MessageReceived(BMessage* message)
|
||||
case M_LOOP_SOUND:
|
||||
case M_USE_OVERLAYS:
|
||||
case M_SCALE_BILINEAR:
|
||||
case M_SCALE_CONTROLS:
|
||||
case M_START_FULL_VOLUME:
|
||||
case M_START_HALF_VOLUME:
|
||||
case M_START_MUTE_VOLUME:
|
||||
@ -344,6 +351,7 @@ SettingsWindow::AdoptSettings()
|
||||
|
||||
fUseOverlaysCB->SetValue(fSettings.useOverlays);
|
||||
fScaleBilinearCB->SetValue(fSettings.scaleBilinear);
|
||||
fScaleFullscreenControlsCB->SetValue(fSettings.scaleFullscreenControls);
|
||||
|
||||
fFullVolumeBGMoviesRB->SetValue(fSettings.backgroundMovieVolumeMode
|
||||
== mpSettings::BG_MOVIES_FULL_VOLUME);
|
||||
@ -369,6 +377,8 @@ SettingsWindow::ApplySettings()
|
||||
|
||||
fSettings.useOverlays = fUseOverlaysCB->Value() == B_CONTROL_ON;
|
||||
fSettings.scaleBilinear = fScaleBilinearCB->Value() == B_CONTROL_ON;
|
||||
fSettings.scaleFullscreenControls
|
||||
= fScaleFullscreenControlsCB->Value() == B_CONTROL_ON;
|
||||
|
||||
if (fFullVolumeBGMoviesRB->Value() == B_CONTROL_ON) {
|
||||
fSettings.backgroundMovieVolumeMode
|
||||
|
@ -41,6 +41,7 @@ private:
|
||||
|
||||
BCheckBox* fUseOverlaysCB;
|
||||
BCheckBox* fScaleBilinearCB;
|
||||
BCheckBox* fScaleFullscreenControlsCB;
|
||||
|
||||
BRadioButton* fFullVolumeBGMoviesRB;
|
||||
BRadioButton* fHalfVolumeBGMoviesRB;
|
||||
|
Loading…
x
Reference in New Issue
Block a user