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:
Stephan Aßmus
2010-09-12 09:59:35 +00:00
parent c1a1df8d83
commit 341ea11eb3
16 changed files with 283 additions and 94 deletions
+7 -1
View File
@@ -913,6 +913,7 @@ MainWin::MessageReceived(BMessage* msg)
fControls->MoveTo(fVideoView->Frame().left, fControls->MoveTo(fVideoView->Frame().left,
fVideoView->Frame().bottom + 1); fVideoView->Frame().bottom + 1);
fBackground->AddChild(fControls); fBackground->AddChild(fControls);
fControls->SetSymbolScale(1.0f);
while (!fControls->IsHidden()) while (!fControls->IsHidden())
fControls->Hide(); fControls->Hide();
} }
@@ -2236,6 +2237,8 @@ MainWin::_ShowFullscreenControls(bool show, bool animate)
fControls->MoveTo(fVideoView->Bounds().left, fControls->MoveTo(fVideoView->Bounds().left,
fVideoView->Bounds().bottom + 1); fVideoView->Bounds().bottom + 1);
fVideoView->AddChild(fControls); fVideoView->AddChild(fControls);
if (fScaleFullscreenControls)
fControls->SetSymbolScale(1.5f);
while (fControls->IsHidden()) while (fControls->IsHidden())
fControls->Show(); fControls->Show();
} }
@@ -2246,7 +2249,8 @@ MainWin::_ShowFullscreenControls(bool show, bool animate)
// time of the animation. // time of the animation.
const float kAnimationOffsets[] = { 0.05, 0.2, 0.5, 0.2, 0.05 }; const float kAnimationOffsets[] = { 0.05, 0.2, 0.5, 0.2, 0.05 };
const int32 steps = sizeof(kAnimationOffsets) / sizeof(float); 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; float originalY = fControls->Frame().top;
for (int32 i = 0; i < steps; i++) { for (int32 i = 0; i < steps; i++) {
BMessage message(M_SLIDE_CONTROLS); BMessage message(M_SLIDE_CONTROLS);
@@ -2264,6 +2268,7 @@ MainWin::_ShowFullscreenControls(bool show, bool animate)
fControls->MoveTo(fVideoView->Frame().left, fControls->MoveTo(fVideoView->Frame().left,
fVideoView->Frame().bottom + 1); fVideoView->Frame().bottom + 1);
fBackground->AddChild(fControls); fBackground->AddChild(fControls);
fControls->SetSymbolScale(1.0f);
while (!fControls->IsHidden()) while (!fControls->IsHidden())
fControls->Hide(); fControls->Hide();
} }
@@ -2476,6 +2481,7 @@ MainWin::_AdoptGlobalSettings()
fCloseWhenDonePlayingSound = settings.closeWhenDonePlayingSound; fCloseWhenDonePlayingSound = settings.closeWhenDonePlayingSound;
fLoopMovies = settings.loopMovie; fLoopMovies = settings.loopMovie;
fLoopSounds = settings.loopSound; fLoopSounds = settings.loopSound;
fScaleFullscreenControls = settings.scaleFullscreenControls;
} }
+1
View File
@@ -194,6 +194,7 @@ private:
bool fCloseWhenDonePlayingSound; bool fCloseWhenDonePlayingSound;
bool fLoopMovies; bool fLoopMovies;
bool fLoopSounds; bool fLoopSounds;
bool fScaleFullscreenControls;
bigtime_t fInitialSeekPosition; bigtime_t fInitialSeekPosition;
bool fAllowWinding; bool fAllowWinding;
@@ -20,9 +20,7 @@ DurationView::DurationView(const char* name)
fDuration(0), fDuration(0),
fDisplayDuration(0) fDisplayDuration(0)
{ {
BFont font(be_bold_font); SetSymbolScale(1.0f);
font.SetSize(font.Size() * 1.2);
SetFont(&font);
SetAlignment(B_ALIGN_RIGHT); 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 void
DurationView::_Update() DurationView::_Update()
{ {
@@ -35,6 +35,8 @@ public:
uint32 Mode() const uint32 Mode() const
{ return fMode; } { return fMode; }
void SetSymbolScale(float scale);
private: private:
void _Update(); void _Update();
void _GenerateString(bigtime_t duration); void _GenerateString(bigtime_t duration);
@@ -167,10 +167,17 @@ PlayPauseButton::SetStopped()
void void
PlayPauseButton::SetSymbols(BShape* playSymbolShape, BShape* pauseSymbolShape) PlayPauseButton::SetSymbols(BShape* playSymbolShape, BShape* pauseSymbolShape)
{ {
BSize oldSize = MinSize();
delete fPlaySymbol; delete fPlaySymbol;
fPlaySymbol = playSymbolShape; fPlaySymbol = playSymbolShape;
delete fPauseSymbol; delete fPauseSymbol;
fPauseSymbol = pauseSymbolShape; fPauseSymbol = pauseSymbolShape;
if (MinSize() != oldSize)
InvalidateLayout();
Invalidate();
} }
+68 -2
View File
@@ -26,12 +26,13 @@ SeekSlider::SeekSlider(const char* name, BMessage* message, int32 minValue,
B_TRIANGLE_THUMB), B_TRIANGLE_THUMB),
fTracking(false), fTracking(false),
fLastTrackTime(0), fLastTrackTime(0),
fDisabledString(kDisabledSeekMessage) fDisabledString(kDisabledSeekMessage),
fScale(0.0f)
{ {
BFont font(be_plain_font); BFont font(be_plain_font);
font.SetSize(9.0); font.SetSize(9.0);
SetFont(&font); SetFont(&font);
SetBarThickness(15.0); SetSymbolScale(1.0);
rgb_color fillColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), rgb_color fillColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
B_DARKEN_3_TINT); B_DARKEN_3_TINT);
UseFillColor(true, &fillColor); 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 void
SeekSlider::DrawBar() SeekSlider::DrawBar()
{ {
@@ -112,6 +130,41 @@ SeekSlider::GetPreferredSize(float* _width, float* _height)
float minWidth = 15.0 + StringWidth(fDisabledString.String()) + 15.0; float minWidth = 15.0 + StringWidth(fDisabledString.String()) + 15.0;
*_width = max_c(*_width, minWidth); *_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 // BSlider interface
virtual status_t Invoke(BMessage* message); virtual status_t Invoke(BMessage* message);
virtual BRect ThumbFrame() const;
virtual void DrawBar(); virtual void DrawBar();
virtual void DrawThumb(); virtual void DrawThumb();
virtual void MouseDown(BPoint where); virtual void MouseDown(BPoint where);
virtual void MouseUp(BPoint where); virtual void MouseUp(BPoint where);
virtual void GetPreferredSize(float* _width, virtual void GetPreferredSize(float* _width,
float* _height); float* _height);
virtual BSize MinSize();
virtual BSize MaxSize();
// SeekSlider // SeekSlider
bool IsTracking() const; bool IsTracking() const;
void SetDisabledString(const char* string); void SetDisabledString(const char* string);
void SetSymbolScale(float scale);
private: private:
bool fTracking; bool fTracking;
bigtime_t fLastTrackTime; bigtime_t fLastTrackTime;
BString fDisabledString; BString fDisabledString;
float fScale;
}; };
@@ -86,9 +86,11 @@ SymbolButton::MinSize()
if (fSymbol == NULL) if (fSymbol == NULL)
return BButton::MinSize(); return BButton::MinSize();
float scale = fBorders != 0 ? 2.5f : 1.0f;
BSize size; BSize size;
size.width = ceilf(fSymbol->Bounds().Width() * 2.5f); size.width = ceilf(fSymbol->Bounds().Width() * scale);
size.height = ceilf(fSymbol->Bounds().Height() * 2.5f); size.height = ceilf(fSymbol->Bounds().Height() * scale);
return BLayoutUtils::ComposeSize(ExplicitMinSize(), size); return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
} }
@@ -97,7 +99,8 @@ BSize
SymbolButton::MaxSize() SymbolButton::MaxSize()
{ {
BSize size(MinSize()); 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); return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size);
} }
@@ -105,7 +108,14 @@ SymbolButton::MaxSize()
void void
SymbolButton::SetSymbol(BShape* symbolShape) SymbolButton::SetSymbol(BShape* symbolShape)
{ {
BSize oldSize = MinSize();
delete fSymbol; delete fSymbol;
fSymbol = symbolShape; fSymbol = symbolShape;
if (MinSize() != oldSize)
InvalidateLayout();
Invalidate();
} }
@@ -59,7 +59,20 @@ enum {
TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons, TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons,
bool usePeakView, bool useWindButtons) 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 // 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 // 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; float symbolHeight = int(be_plain_font->Size() / 1.33) | 1;
BGroupView* seekGroup = new BGroupView(B_HORIZONTAL, 0); BGroupView* seekGroup = new BGroupView(B_HORIZONTAL, 0);
BGroupLayout* seekLayout = seekGroup->GroupLayout(); fSeekLayout = seekGroup->GroupLayout();
GroupLayout()->AddView(seekGroup); GroupLayout()->AddView(seekGroup);
// Seek slider // Seek slider
fSeekSlider = new SeekSlider("seek slider", new BMessage(MSG_SEEK), fSeekSlider = new SeekSlider("seek slider", new BMessage(MSG_SEEK),
0, kPositionFactor); 0, kPositionFactor);
seekLayout->AddView(fSeekSlider); fSeekLayout->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);
fPositionToolTip = new PositionToolTip(); fPositionToolTip = new PositionToolTip();
fSeekSlider->SetToolTip(fPositionToolTip); fSeekSlider->SetToolTip(fPositionToolTip);
// Duration view // Duration view
fDurationView = new DurationView("duration view"); fDurationView = new DurationView("duration view");
seekLayout->AddView(fDurationView); fSeekLayout->AddView(fDurationView);
seekLayout->AddItem(BSpaceLayoutItem::CreateHorizontalStrut(5));
// Buttons // 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 uint32 topBottomBorder = BControlLook::B_TOP_BORDER
| BControlLook::B_BOTTOM_BORDER; | BControlLook::B_BOTTOM_BORDER;
@@ -113,9 +106,12 @@ TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons,
_CreateSkipBackwardsShape(symbolHeight), _CreateSkipBackwardsShape(symbolHeight),
new BMessage(MSG_SKIP_BACKWARDS), new BMessage(MSG_SKIP_BACKWARDS),
BControlLook::B_LEFT_BORDER | topBottomBorder); BControlLook::B_LEFT_BORDER | topBottomBorder);
buttonLayout->AddView(fSkipBack); // Skip Foward
} else fSkipForward = new SymbolButton(B_EMPTY_STRING,
fSkipBack = NULL; _CreateSkipForwardShape(symbolHeight),
new BMessage(MSG_SKIP_FORWARD),
BControlLook::B_RIGHT_BORDER | topBottomBorder);
}
if (useWindButtons) { if (useWindButtons) {
// Rewind // Rewind
@@ -123,52 +119,30 @@ TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons,
_CreateRewindShape(symbolHeight), new BMessage(MSG_REWIND), _CreateRewindShape(symbolHeight), new BMessage(MSG_REWIND),
useSkipButtons ? topBottomBorder useSkipButtons ? topBottomBorder
: BControlLook::B_LEFT_BORDER | 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 // Forward
fForward = new SymbolButton(B_EMPTY_STRING, fForward = new SymbolButton(B_EMPTY_STRING,
_CreateForwardShape(symbolHeight), new BMessage(MSG_FORWARD), _CreateForwardShape(symbolHeight), new BMessage(MSG_FORWARD),
useSkipButtons ? topBottomBorder useSkipButtons ? topBottomBorder
: BControlLook::B_RIGHT_BORDER | topBottomBorder); : BControlLook::B_RIGHT_BORDER | topBottomBorder);
buttonLayout->AddView(fForward); }
} else
fForward = NULL;
if (useSkipButtons) { // Play Pause
// Skip Foward fPlayPause = new PlayPauseButton(B_EMPTY_STRING,
fSkipForward = new SymbolButton(B_EMPTY_STRING, _CreatePlayShape(symbolHeight), _CreatePauseShape(symbolHeight),
_CreateSkipForwardShape(symbolHeight), new BMessage(MSG_PLAY), useWindButtons || useSkipButtons
new BMessage(MSG_SKIP_FORWARD), ? topBottomBorder
BControlLook::B_RIGHT_BORDER | topBottomBorder); : topBottomBorder | BControlLook::B_LEFT_BORDER);
buttonLayout->AddView(fSkipForward);
} else
fSkipForward = NULL;
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 // Mute
BShape* speakerShape = _CreateSpeakerShape(8); fMute = new SymbolButton(B_EMPTY_STRING,
fMute = new SymbolButton(B_EMPTY_STRING, speakerShape, _CreateSpeakerShape(floorf(symbolHeight * 0.9)),
new BMessage(MSG_SET_MUTE), 0); new BMessage(MSG_SET_MUTE), 0);
fMute->SetExplicitMinSize(BSize(speakerShape->Bounds().Width(),
speakerShape->Bounds().Height()));
controlLayout->AddView(fMute);
// Volume Slider // Volume Slider
fVolumeSlider = new VolumeSlider("volume slider", fVolumeSlider = new VolumeSlider("volume slider",
@@ -177,19 +151,52 @@ TransportControlGroup::TransportControlGroup(BRect frame, bool useSkipButtons,
kVolumeFactor, new BMessage(MSG_SET_VOLUME)); kVolumeFactor, new BMessage(MSG_SET_VOLUME));
fVolumeSlider->SetValue(_DbToGain(_ExponentialToLinear(0.0)) fVolumeSlider->SetValue(_DbToGain(_ExponentialToLinear(0.0))
* kVolumeFactor); * kVolumeFactor);
controlLayout->AddView(fVolumeSlider);
// Peak view // Peak view
if (usePeakView) { if (usePeakView)
fPeakView = new PeakView("peak view", false, false); 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; size.width *= 3;
controlLayout->SetExplicitMaxSize(size); size.height = B_SIZE_UNSET;
controlLayout->SetExplicitAlignment(BAlignment(B_ALIGN_CENTER, fControlLayout->SetExplicitMaxSize(size);
fControlLayout->SetExplicitAlignment(BAlignment(B_ALIGN_CENTER,
B_ALIGN_TOP)); B_ALIGN_TOP));
} }
@@ -223,13 +230,6 @@ TransportControlGroup::AttachedToWindow()
} }
void
TransportControlGroup::FrameResized(float width, float height)
{
DoLayout();
}
void void
TransportControlGroup::GetPreferredSize(float* _width, float* _height) 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 - // #pragma mark -
@@ -43,7 +43,6 @@ public:
// BView interface // BView interface
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void FrameResized(float width, float height);
virtual void GetPreferredSize(float* width, float* height); virtual void GetPreferredSize(float* width, float* height);
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
@@ -77,6 +76,7 @@ public:
{ return fPeakView; } { return fPeakView; }
void SetDisabledString(const char* string); void SetDisabledString(const char* string);
void SetSymbolScale(float scale);
private: private:
void _TogglePlaying(); void _TogglePlaying();
@@ -117,6 +117,11 @@ private:
PlayPauseButton* fPlayPause; PlayPauseButton* fPlayPause;
SymbolButton* fStop; SymbolButton* fStop;
SymbolButton* fMute; SymbolButton* fMute;
BGroupLayout* fSeekLayout;
BGroupLayout* fControlLayout;
float fSymbolScale;
}; };
#endif // TRANSPORT_CONTROL_GROUP_H #endif // TRANSPORT_CONTROL_GROUP_H
@@ -29,11 +29,7 @@ VolumeSlider::VolumeSlider(const char* name, int32 minValue, int32 maxValue,
{ {
SetModificationMessage(message); SetModificationMessage(message);
UseFillColor(true, &kGreen); UseFillColor(true, &kGreen);
#if KNOB_EMBEDDED SetBarThickness(PreferredBarThickness());
SetBarThickness(10);
#else
SetBarThickness(8);
#endif
} }
@@ -223,6 +219,17 @@ VolumeSlider::SetMuted(bool mute)
} }
float
VolumeSlider::PreferredBarThickness() const
{
#if KNOB_EMBEDDED
return 10.0f;
#else
return 8.0f;
#endif
}
float float
VolumeSlider::_PointForValue(int32 value) const VolumeSlider::_PointForValue(int32 value) const
{ {
@@ -32,6 +32,8 @@ public:
bool IsMuted() const bool IsMuted() const
{ return fMuted; } { return fMuted; }
float PreferredBarThickness() const;
private: private:
float _PointForValue(int32 value) const; float _PointForValue(int32 value) const;
+6 -1
View File
@@ -21,6 +21,7 @@ mpSettings::operator!=(const mpSettings& other) const
|| loopSound != other.loopSound || loopSound != other.loopSound
|| useOverlays != other.useOverlays || useOverlays != other.useOverlays
|| scaleBilinear != other.scaleBilinear || scaleBilinear != other.scaleBilinear
|| scaleFullscreenControls != other.scaleFullscreenControls
|| backgroundMovieVolumeMode != other.backgroundMovieVolumeMode || backgroundMovieVolumeMode != other.backgroundMovieVolumeMode
|| filePanelFolder != other.filePanelFolder || filePanelFolder != other.filePanelFolder
|| audioPlayerWindowFrame != other.audioPlayerWindowFrame; || audioPlayerWindowFrame != other.audioPlayerWindowFrame;
@@ -49,7 +50,9 @@ Settings::LoadSettings(mpSettings& settings) const
settings.loopSound = fSettingsMessage.GetValue("loopSound", false); settings.loopSound = fSettingsMessage.GetValue("loopSound", false);
settings.useOverlays = fSettingsMessage.GetValue("useOverlays", true); 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 settings.backgroundMovieVolumeMode
= fSettingsMessage.GetValue("bgMovieVolumeMode", = fSettingsMessage.GetValue("bgMovieVolumeMode",
@@ -80,6 +83,8 @@ Settings::SaveSettings(const mpSettings& settings)
fSettingsMessage.SetValue("useOverlays", settings.useOverlays); fSettingsMessage.SetValue("useOverlays", settings.useOverlays);
fSettingsMessage.SetValue("scaleBilinear", settings.scaleBilinear); fSettingsMessage.SetValue("scaleBilinear", settings.scaleBilinear);
fSettingsMessage.SetValue("scaleFullscreenControls",
settings.scaleFullscreenControls);
fSettingsMessage.SetValue("bgMovieVolumeMode", fSettingsMessage.SetValue("bgMovieVolumeMode",
settings.backgroundMovieVolumeMode); settings.backgroundMovieVolumeMode);
+1
View File
@@ -23,6 +23,7 @@ struct mpSettings {
bool loopSound; bool loopSound;
bool useOverlays; bool useOverlays;
bool scaleBilinear; bool scaleBilinear;
bool scaleFullscreenControls;
enum { enum {
BG_MOVIES_FULL_VOLUME = 0, BG_MOVIES_FULL_VOLUME = 0,
BG_MOVIES_HALF_VLUME = 1, BG_MOVIES_HALF_VLUME = 1,
@@ -33,6 +33,7 @@ enum {
M_LOOP_SOUND, M_LOOP_SOUND,
M_USE_OVERLAYS, M_USE_OVERLAYS,
M_SCALE_BILINEAR, M_SCALE_BILINEAR,
M_SCALE_CONTROLS,
M_START_FULL_VOLUME, M_START_FULL_VOLUME,
M_START_HALF_VOLUME, M_START_HALF_VOLUME,
M_START_MUTE_VOLUME, M_START_MUTE_VOLUME,
@@ -101,6 +102,10 @@ SettingsWindow::SettingsWindow(BRect frame)
"Scale movies smoothly (non-overlay mode)", "Scale movies smoothly (non-overlay mode)",
new BMessage(M_SCALE_BILINEAR)); new BMessage(M_SCALE_BILINEAR));
fScaleFullscreenControlsCB = new BCheckBox("chkBoxScaleControls",
"Scale controls in full-screen mode",
new BMessage(M_SCALE_CONTROLS));
fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume", fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
"Full volume", new BMessage(M_START_FULL_VOLUME)); "Full volume", new BMessage(M_START_FULL_VOLUME));
@@ -149,6 +154,7 @@ SettingsWindow::SettingsWindow(BRect frame)
.Add(BGroupLayoutBuilder(B_VERTICAL, 0) .Add(BGroupLayoutBuilder(B_VERTICAL, 0)
.Add(fUseOverlaysCB) .Add(fUseOverlaysCB)
.Add(fScaleBilinearCB) .Add(fScaleBilinearCB)
.Add(fScaleFullscreenControlsCB)
) )
) )
.Add(BSpaceLayoutItem::CreateVerticalStrut(5)) .Add(BSpaceLayoutItem::CreateVerticalStrut(5))
@@ -303,6 +309,7 @@ SettingsWindow::MessageReceived(BMessage* message)
case M_LOOP_SOUND: case M_LOOP_SOUND:
case M_USE_OVERLAYS: case M_USE_OVERLAYS:
case M_SCALE_BILINEAR: case M_SCALE_BILINEAR:
case M_SCALE_CONTROLS:
case M_START_FULL_VOLUME: case M_START_FULL_VOLUME:
case M_START_HALF_VOLUME: case M_START_HALF_VOLUME:
case M_START_MUTE_VOLUME: case M_START_MUTE_VOLUME:
@@ -344,6 +351,7 @@ SettingsWindow::AdoptSettings()
fUseOverlaysCB->SetValue(fSettings.useOverlays); fUseOverlaysCB->SetValue(fSettings.useOverlays);
fScaleBilinearCB->SetValue(fSettings.scaleBilinear); fScaleBilinearCB->SetValue(fSettings.scaleBilinear);
fScaleFullscreenControlsCB->SetValue(fSettings.scaleFullscreenControls);
fFullVolumeBGMoviesRB->SetValue(fSettings.backgroundMovieVolumeMode fFullVolumeBGMoviesRB->SetValue(fSettings.backgroundMovieVolumeMode
== mpSettings::BG_MOVIES_FULL_VOLUME); == mpSettings::BG_MOVIES_FULL_VOLUME);
@@ -369,6 +377,8 @@ SettingsWindow::ApplySettings()
fSettings.useOverlays = fUseOverlaysCB->Value() == B_CONTROL_ON; fSettings.useOverlays = fUseOverlaysCB->Value() == B_CONTROL_ON;
fSettings.scaleBilinear = fScaleBilinearCB->Value() == B_CONTROL_ON; fSettings.scaleBilinear = fScaleBilinearCB->Value() == B_CONTROL_ON;
fSettings.scaleFullscreenControls
= fScaleFullscreenControlsCB->Value() == B_CONTROL_ON;
if (fFullVolumeBGMoviesRB->Value() == B_CONTROL_ON) { if (fFullVolumeBGMoviesRB->Value() == B_CONTROL_ON) {
fSettings.backgroundMovieVolumeMode fSettings.backgroundMovieVolumeMode
@@ -41,6 +41,7 @@ private:
BCheckBox* fUseOverlaysCB; BCheckBox* fUseOverlaysCB;
BCheckBox* fScaleBilinearCB; BCheckBox* fScaleBilinearCB;
BCheckBox* fScaleFullscreenControlsCB;
BRadioButton* fFullVolumeBGMoviesRB; BRadioButton* fFullVolumeBGMoviesRB;
BRadioButton* fHalfVolumeBGMoviesRB; BRadioButton* fHalfVolumeBGMoviesRB;