diff --git a/src/apps/mediaplayer/MainWin.cpp b/src/apps/mediaplayer/MainWin.cpp
index 986e5c6f7d..e662d75da5 100644
--- a/src/apps/mediaplayer/MainWin.cpp
+++ b/src/apps/mediaplayer/MainWin.cpp
@@ -932,6 +932,7 @@ MainWin::MessageReceived(BMessage* msg)
float offset;
if (msg->FindFloat("offset", &offset) == B_OK) {
fControls->MoveBy(0, offset);
+ fVideoView->SetSubTitleMaxBottom(fControls->Frame().top - 1);
UpdateIfNeeded();
snooze(15000);
}
@@ -943,9 +944,12 @@ MainWin::MessageReceived(BMessage* msg)
bool show;
if (msg->FindFloat("offset", &offset) == B_OK
&& msg->FindBool("show", &show) == B_OK) {
- if (show)
+ if (show) {
fControls->MoveTo(fControls->Frame().left, offset);
- else {
+ fVideoView->SetSubTitleMaxBottom(offset - 1);
+ } else {
+ fVideoView->SetSubTitleMaxBottom(
+ fVideoView->Bounds().bottom);
fControls->RemoveSelf();
fControls->MoveTo(fVideoView->Frame().left,
fVideoView->Frame().bottom + 1);
@@ -1850,6 +1854,7 @@ MainWin::_ResizeVideoView(int x, int y, int width, int height)
xOffset + renderWidth - 1, yOffset + renderHeight - 1);
fVideoView->SetVideoFrame(videoFrame);
+ fVideoView->SetSubTitleMaxBottom(height - 1);
}
@@ -1990,8 +1995,8 @@ MainWin::_ShowContextMenu(const BPoint& screenPoint)
menu->AddItem(item = new BMenuItem(aspectSubMenu));
item->SetEnabled(fHasVideo);
- menu->AddItem(item = new BMenuItem("No interface",
- new BMessage(M_TOGGLE_NO_INTERFACE), 'B'));
+ menu->AddItem(item = new BMenuItem("Hide interface",
+ new BMessage(M_TOGGLE_NO_INTERFACE), 'H'));
item->SetMarked(fNoInterface);
item->SetEnabled(fHasVideo);
diff --git a/src/apps/mediaplayer/VideoView.cpp b/src/apps/mediaplayer/VideoView.cpp
index 29fc26c969..402dc922eb 100644
--- a/src/apps/mediaplayer/VideoView.cpp
+++ b/src/apps/mediaplayer/VideoView.cpp
@@ -18,6 +18,11 @@
#include "SubtitleBitmap.h"
+enum {
+ MSG_INVALIDATE = 'ivdt'
+};
+
+
VideoView::VideoView(BRect frame, const char* name, uint32 resizeMask)
:
BView(frame, name, resizeMask, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE
@@ -27,9 +32,14 @@ VideoView::VideoView(BRect frame, const char* name, uint32 resizeMask)
fIsPlaying(false),
fIsFullscreen(false),
fLastMouseMove(system_time()),
- fGlobalSettingsListener(this),
+
fSubtitleBitmap(new SubtitleBitmap),
- fHasSubtitle(false)
+ fSubtitleFrame(),
+ fSubtitleMaxButtom(Bounds().bottom),
+ fHasSubtitle(false),
+ fSubtitleChanged(false),
+
+ fGlobalSettingsListener(this)
{
SetViewColor(B_TRANSPARENT_COLOR);
SetHighColor(0, 0, 0);
@@ -44,7 +54,7 @@ VideoView::VideoView(BRect frame, const char* name, uint32 resizeMask)
Settings::Default()->AddListener(&fGlobalSettingsListener);
_AdoptGlobalSettings();
-//SetSubtitle("This is a test!"
+//SetSubTitle("This is a test!"
// "\nWith a short line and a long line.");
}
@@ -74,6 +84,9 @@ VideoView::Draw(BRect updateRect)
if (outSideVideoRegion.CountRects() > 0)
FillRegion(&outSideVideoRegion);
+
+ if (fHasSubtitle)
+ _DrawSubtitle();
}
@@ -87,6 +100,13 @@ VideoView::MessageReceived(BMessage* message)
// the global settings instance...
_AdoptGlobalSettings();
break;
+ case MSG_INVALIDATE:
+ {
+ BRect dirty;
+ if (message->FindRect("dirty", &dirty) == B_OK)
+ Invalidate(dirty);
+ break;
+ }
default:
BView::MessageReceived(message);
}
@@ -185,9 +205,13 @@ VideoView::SetBitmap(const BBitmap* bitmap)
SetViewColor(B_TRANSPARENT_COLOR);
}
if (!fOverlayMode) {
- if (fHasSubtitle)
+ if (fSubtitleChanged) {
+ _LayoutSubtitle();
+ Invalidate(fVideoFrame | fSubtitleFrame);
+ } else if (fHasSubtitle
+ && fVideoFrame.Intersects(fSubtitleFrame)) {
Invalidate(fVideoFrame);
- else
+ } else
_DrawBitmap(bitmap);
}
@@ -286,27 +310,55 @@ VideoView::SetVideoFrame(const BRect& frame)
fVideoFrame = frame;
fSubtitleBitmap->SetVideoBounds(fVideoFrame.OffsetToCopy(B_ORIGIN));
+ _LayoutSubtitle();
}
void
VideoView::SetSubTitle(const char* text)
{
+ BRect oldSubtitleFrame = fSubtitleFrame;
+
if (text == NULL || text[0] == '\0') {
fHasSubtitle = false;
+ fSubtitleChanged = true;
} else {
fHasSubtitle = true;
- fSubtitleBitmap->SetText(text);
+ // If the subtitle frame still needs to be invalidated during
+ // normal playback, make sure we don't unset the fSubtitleChanged
+ // flag. It will be reset after drawing the subtitle once.
+ fSubtitleChanged = fSubtitleBitmap->SetText(text) || fSubtitleChanged;
+ if (fSubtitleChanged)
+ _LayoutSubtitle();
}
- // TODO: Make smarter and invalidate only previous subtitle bitmap
- // region. Fix locking, too...
- if (!fIsPlaying && LockLooperWithTimeout(1000) == B_OK) {
- Invalidate();
- UnlockLooper();
+
+ if (!fIsPlaying && Window() != NULL) {
+ // If we are playing, the new subtitle will be displayed,
+ // or the old one removed from screen, as soon as the next
+ // frame is shown. Otherwise we need to invalidate manually.
+ // But we are not in the window thread and we shall not lock
+ // it or we may dead-locks.
+ BMessage message(MSG_INVALIDATE);
+ message.AddRect("dirty", oldSubtitleFrame | fSubtitleFrame);
+ Window()->PostMessage(&message);
}
}
+void
+VideoView::SetSubTitleMaxBottom(float bottom)
+{
+ if (bottom == fSubtitleMaxButtom)
+ return;
+
+ fSubtitleMaxButtom = bottom;
+
+ BRect oldSubtitleFrame = fSubtitleFrame;
+ _LayoutSubtitle();
+ Invalidate(fSubtitleFrame | oldSubtitleFrame);
+}
+
+
// #pragma mark -
@@ -316,18 +368,20 @@ VideoView::_DrawBitmap(const BBitmap* bitmap)
SetDrawingMode(B_OP_COPY);
uint32 options = fUseBilinearScaling ? B_FILTER_BITMAP_BILINEAR : 0;
DrawBitmapAsync(bitmap, bitmap->Bounds(), fVideoFrame, options);
+}
- if (fHasSubtitle) {
- SetDrawingMode(B_OP_ALPHA);
- SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
-
- const BBitmap* subtitleBitmap = fSubtitleBitmap->Bitmap();
- BPoint offset;
- offset.x = (fVideoFrame.left + fVideoFrame.right
- - subtitleBitmap->Bounds().Width()) / 2;
- offset.y = fVideoFrame.bottom - subtitleBitmap->Bounds().Height();
- DrawBitmapAsync(subtitleBitmap, offset);
- }
+
+void
+VideoView::_DrawSubtitle()
+{
+ SetDrawingMode(B_OP_ALPHA);
+ SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
+
+ DrawBitmapAsync(fSubtitleBitmap->Bitmap(), fSubtitleFrame.LeftTop());
+
+ // Unless the subtitle frame intersects the video frame, we don't have
+ // to draw the subtitle again.
+ fSubtitleChanged = false;
}
@@ -340,8 +394,22 @@ VideoView::_AdoptGlobalSettings()
fUseOverlays = settings.useOverlays;
fUseBilinearScaling = settings.scaleBilinear;
- if (!fIsPlaying && !fOverlayMode)
- Invalidate();
+ switch (settings.subtitleSize) {
+ case mpSettings::SUBTITLE_SIZE_SMALL:
+ fSubtitleBitmap->SetCharsPerLine(45.0);
+ break;
+ case mpSettings::SUBTITLE_SIZE_MEDIUM:
+ fSubtitleBitmap->SetCharsPerLine(36.0);
+ break;
+ case mpSettings::SUBTITLE_SIZE_LARGE:
+ fSubtitleBitmap->SetCharsPerLine(32.0);
+ break;
+ }
+
+ fSubtitlePlacement = settings.subtitlePlacement;
+
+ _LayoutSubtitle();
+ Invalidate();
}
@@ -353,3 +421,39 @@ VideoView::_SetOverlayMode(bool overlayMode)
}
+void
+VideoView::_LayoutSubtitle()
+{
+ if (!fHasSubtitle)
+ return;
+
+ const BBitmap* subtitleBitmap = fSubtitleBitmap->Bitmap();
+ if (subtitleBitmap == NULL)
+ return;
+
+ fSubtitleFrame = subtitleBitmap->Bounds();
+
+ BPoint offset;
+ offset.x = (fVideoFrame.left + fVideoFrame.right
+ - fSubtitleFrame.Width()) / 2;
+ switch (fSubtitlePlacement) {
+ default:
+ case mpSettings::SUBTITLE_PLACEMENT_BOTTOM_OF_VIDEO:
+ offset.y = fVideoFrame.bottom - fSubtitleFrame.Height();
+ break;
+ case mpSettings::SUBTITLE_PLACEMENT_BOTTOM_OF_SCREEN:
+ {
+ // Center between video and screen bottom, if there is still
+ // enough room.
+ float centeredOffset = (fVideoFrame.bottom + fSubtitleMaxButtom
+ - fSubtitleFrame.Height()) / 2;
+ float maxOffset = fSubtitleMaxButtom - fSubtitleFrame.Height();
+ offset.y = min_c(centeredOffset, maxOffset);
+ break;
+ }
+ }
+
+ fSubtitleFrame.OffsetTo(offset);
+}
+
+
diff --git a/src/apps/mediaplayer/VideoView.h b/src/apps/mediaplayer/VideoView.h
index fc7222ec44..4eb7372c79 100644
--- a/src/apps/mediaplayer/VideoView.h
+++ b/src/apps/mediaplayer/VideoView.h
@@ -52,11 +52,14 @@ public:
void SetVideoFrame(const BRect& frame);
void SetSubTitle(const char* text);
+ void SetSubTitleMaxBottom(float bottom);
private:
void _DrawBitmap(const BBitmap* bitmap);
+ void _DrawSubtitle();
void _AdoptGlobalSettings();
void _SetOverlayMode(bool overlayMode);
+ void _LayoutSubtitle();
private:
BRect fVideoFrame;
@@ -67,12 +70,17 @@ private:
bool fIsFullscreen;
bigtime_t fLastMouseMove;
+ SubtitleBitmap* fSubtitleBitmap;
+ BRect fSubtitleFrame;
+ float fSubtitleMaxButtom;
+ bool fHasSubtitle;
+ bool fSubtitleChanged;
+
+ // Settings values:
ListenerAdapter fGlobalSettingsListener;
bool fUseOverlays;
bool fUseBilinearScaling;
-
- SubtitleBitmap* fSubtitleBitmap;
- bool fHasSubtitle;
+ uint32 fSubtitlePlacement;
};
#endif // VIDEO_VIEW_H
diff --git a/src/apps/mediaplayer/interface/SubtitleBitmap.cpp b/src/apps/mediaplayer/interface/SubtitleBitmap.cpp
index 42384f09fd..4d9af3998d 100644
--- a/src/apps/mediaplayer/interface/SubtitleBitmap.cpp
+++ b/src/apps/mediaplayer/interface/SubtitleBitmap.cpp
@@ -19,6 +19,7 @@ SubtitleBitmap::SubtitleBitmap()
fBitmap(NULL),
fTextView(new BTextView("offscreen text")),
fShadowTextView(new BTextView("offscreen text shadow")),
+ fCharsPerLine(36),
fUseSoftShadow(true),
fOverlayMode(false)
{
@@ -42,15 +43,16 @@ SubtitleBitmap::~SubtitleBitmap()
}
-void
+bool
SubtitleBitmap::SetText(const char* text)
{
if (text == fText)
- return;
+ return false;
fText = text;
_GenerateBitmap();
+ return true;
}
@@ -79,6 +81,19 @@ SubtitleBitmap::SetOverlayMode(bool overlayMode)
}
+void
+SubtitleBitmap::SetCharsPerLine(float charsPerLine)
+{
+ if (charsPerLine == fCharsPerLine)
+ return;
+
+ fCharsPerLine = charsPerLine;
+
+ fUseSoftShadow = true;
+ _GenerateBitmap();
+}
+
+
const BBitmap*
SubtitleBitmap::Bitmap() const
{
@@ -313,7 +328,7 @@ SubtitleBitmap::_InsertText(BRect& textRect, float& outlineRadius,
bool overlayMode)
{
BFont font(be_plain_font);
- float fontSize = ceilf((fVideoBounds.Width() * 0.9) / 36);
+ float fontSize = ceilf((fVideoBounds.Width() * 0.9) / fCharsPerLine);
outlineRadius = ceilf(fontSize / 28.0);
font.SetSize(fontSize);
diff --git a/src/apps/mediaplayer/interface/SubtitleBitmap.h b/src/apps/mediaplayer/interface/SubtitleBitmap.h
index 12645e3609..aee2b97157 100644
--- a/src/apps/mediaplayer/interface/SubtitleBitmap.h
+++ b/src/apps/mediaplayer/interface/SubtitleBitmap.h
@@ -19,9 +19,10 @@ public:
SubtitleBitmap();
virtual ~SubtitleBitmap();
- void SetText(const char* text);
+ bool SetText(const char* text);
void SetVideoBounds(BRect bounds);
void SetOverlayMode(bool overlayMode);
+ void SetCharsPerLine(float charsPerLine);
const BBitmap* Bitmap() const;
@@ -37,6 +38,7 @@ private:
BString fText;
BRect fVideoBounds;
+ float fCharsPerLine;
bool fUseSoftShadow;
bool fOverlayMode;
};
diff --git a/src/apps/mediaplayer/settings/Settings.cpp b/src/apps/mediaplayer/settings/Settings.cpp
index da90e510dd..043302d1a0 100644
--- a/src/apps/mediaplayer/settings/Settings.cpp
+++ b/src/apps/mediaplayer/settings/Settings.cpp
@@ -22,6 +22,8 @@ mpSettings::operator!=(const mpSettings& other) const
|| useOverlays != other.useOverlays
|| scaleBilinear != other.scaleBilinear
|| scaleFullscreenControls != other.scaleFullscreenControls
+ || subtitleSize != other.subtitleSize
+ || subtitlePlacement != other.subtitlePlacement
|| backgroundMovieVolumeMode != other.backgroundMovieVolumeMode
|| filePanelFolder != other.filePanelFolder
|| audioPlayerWindowFrame != other.audioPlayerWindowFrame;
@@ -29,8 +31,9 @@ mpSettings::operator!=(const mpSettings& other) const
Settings::Settings(const char* filename)
- : BLocker("settings lock"),
- fSettingsMessage(B_USER_SETTINGS_DIRECTORY, filename)
+ :
+ BLocker("settings lock"),
+ fSettingsMessage(B_USER_SETTINGS_DIRECTORY, filename)
{
// The settings are loaded from disk in the SettingsMessage constructor.
}
@@ -54,6 +57,13 @@ Settings::LoadSettings(mpSettings& settings) const
settings.scaleFullscreenControls
= fSettingsMessage.GetValue("scaleFullscreenControls", true);
+ settings.subtitleSize
+ = fSettingsMessage.GetValue("subtitleSize",
+ (uint32)mpSettings::SUBTITLE_SIZE_MEDIUM);
+ settings.subtitlePlacement
+ = fSettingsMessage.GetValue("subtitlePlacement",
+ (uint32)mpSettings::SUBTITLE_PLACEMENT_BOTTOM_OF_VIDEO);
+
settings.backgroundMovieVolumeMode
= fSettingsMessage.GetValue("bgMovieVolumeMode",
(uint32)mpSettings::BG_MOVIES_FULL_VOLUME);
@@ -86,6 +96,9 @@ Settings::SaveSettings(const mpSettings& settings)
fSettingsMessage.SetValue("scaleFullscreenControls",
settings.scaleFullscreenControls);
+ fSettingsMessage.SetValue("subtitleSize", settings.subtitleSize);
+ fSettingsMessage.SetValue("subtitlePlacement", settings.subtitlePlacement);
+
fSettingsMessage.SetValue("bgMovieVolumeMode",
settings.backgroundMovieVolumeMode);
diff --git a/src/apps/mediaplayer/settings/Settings.h b/src/apps/mediaplayer/settings/Settings.h
index 3f76c2a60b..3ddf8a161d 100644
--- a/src/apps/mediaplayer/settings/Settings.h
+++ b/src/apps/mediaplayer/settings/Settings.h
@@ -16,6 +16,21 @@
#include "SettingsMessage.h"
struct mpSettings {
+ enum {
+ SUBTITLE_SIZE_SMALL = 0,
+ SUBTITLE_SIZE_MEDIUM = 1,
+ SUBTITLE_SIZE_LARGE = 2
+ };
+ enum {
+ SUBTITLE_PLACEMENT_BOTTOM_OF_VIDEO = 0,
+ SUBTITLE_PLACEMENT_BOTTOM_OF_SCREEN = 1
+ };
+ enum {
+ BG_MOVIES_FULL_VOLUME = 0,
+ BG_MOVIES_HALF_VLUME = 1,
+ BG_MOVIES_MUTED = 2
+ };
+
bool autostart;
bool closeWhenDonePlayingMovie;
bool closeWhenDonePlayingSound;
@@ -24,11 +39,8 @@ struct mpSettings {
bool useOverlays;
bool scaleBilinear;
bool scaleFullscreenControls;
- enum {
- BG_MOVIES_FULL_VOLUME = 0,
- BG_MOVIES_HALF_VLUME = 1,
- BG_MOVIES_MUTED = 2
- };
+ uint32 subtitleSize;
+ uint32 subtitlePlacement;
uint32 backgroundMovieVolumeMode;
entry_ref filePanelFolder;
diff --git a/src/apps/mediaplayer/settings/SettingsWindow.cpp b/src/apps/mediaplayer/settings/SettingsWindow.cpp
index f942d6f8c3..2aa4233868 100644
--- a/src/apps/mediaplayer/settings/SettingsWindow.cpp
+++ b/src/apps/mediaplayer/settings/SettingsWindow.cpp
@@ -6,7 +6,8 @@
* Fredrik Modéen
* Stephan Aßmus
*/
-
+
+
#include "SettingsWindow.h"
#include
@@ -16,36 +17,31 @@
#include
#include
#include
+#include
#include
#include
#include
#include
#include
+
enum {
- M_AUTOSTART = 0x3000,
- M_CLOSE_WINDOW_MOVIE,
- M_CLOSE_WINDOW_SOUNDS,
- M_LOOP_MOVIE,
- M_LOOP_SOUND,
- M_USE_OVERLAYS,
- M_SCALE_BILINEAR,
- M_SCALE_CONTROLS,
- M_START_FULL_VOLUME,
- M_START_HALF_VOLUME,
- M_START_MUTE_VOLUME,
+ M_SETTINGS_CHANGED = 0x3000,
M_SETTINGS_SAVE,
M_SETTINGS_CANCEL,
M_SETTINGS_REVERT
};
+
#define SPACE 10
#define SPACEING 7
#define BUTTONHEIGHT 20
+
SettingsWindow::SettingsWindow(BRect frame)
- : BWindow(frame, "MediaPlayer settings", B_FLOATING_WINDOW_LOOK,
+ :
+ BWindow(frame, "MediaPlayer settings", B_FLOATING_WINDOW_LOOK,
B_FLOATING_APP_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
| B_AUTO_UPDATE_SIZE_LIMITS)
@@ -72,39 +68,52 @@ SettingsWindow::SettingsWindow(BRect frame)
bgMoviesModeLabel->SetFont(be_bold_font);
fAutostartCB = new BCheckBox("chkboxAutostart",
- "Automatically start playing", new BMessage(M_AUTOSTART));
+ "Automatically start playing", new BMessage(M_SETTINGS_CHANGED));
fCloseWindowMoviesCB = new BCheckBox("chkBoxCloseWindowMovies",
"Close window when done playing movies",
- new BMessage(M_CLOSE_WINDOW_MOVIE));
+ new BMessage(M_SETTINGS_CHANGED));
fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds",
"Close window when done playing sounds",
- new BMessage(M_CLOSE_WINDOW_SOUNDS));
+ new BMessage(M_SETTINGS_CHANGED));
fLoopMoviesCB = new BCheckBox("chkBoxLoopMovie",
- "Loop movies by default", new BMessage(M_LOOP_MOVIE));
+ "Loop movies by default", new BMessage(M_SETTINGS_CHANGED));
fLoopSoundsCB = new BCheckBox("chkBoxLoopSounds",
- "Loop sounds by default", new BMessage(M_LOOP_SOUND));
+ "Loop sounds by default", new BMessage(M_SETTINGS_CHANGED));
fUseOverlaysCB = new BCheckBox("chkBoxUseOverlays",
"Use hardware video overlays if available",
- new BMessage(M_USE_OVERLAYS));
+ new BMessage(M_SETTINGS_CHANGED));
fScaleBilinearCB = new BCheckBox("chkBoxScaleBilinear",
"Scale movies smoothly (non-overlay mode)",
- new BMessage(M_SCALE_BILINEAR));
+ new BMessage(M_SETTINGS_CHANGED));
fScaleFullscreenControlsCB = new BCheckBox("chkBoxScaleControls",
"Scale controls in full-screen mode",
- new BMessage(M_SCALE_CONTROLS));
+ new BMessage(M_SETTINGS_CHANGED));
+
+ fSubtitleSizeOP = new BOptionPopUp("subtitleSize",
+ "Subtitle size", new BMessage(M_SETTINGS_CHANGED));
+ fSubtitleSizeOP->AddOption("Small", mpSettings::SUBTITLE_SIZE_SMALL);
+ fSubtitleSizeOP->AddOption("Medium", mpSettings::SUBTITLE_SIZE_MEDIUM);
+ fSubtitleSizeOP->AddOption("Large", mpSettings::SUBTITLE_SIZE_LARGE);
+
+ fSubtitlePlacementOP = new BOptionPopUp("subtitlePlacement",
+ "Subtitle placement", new BMessage(M_SETTINGS_CHANGED));
+ fSubtitlePlacementOP->AddOption("Bottom of video",
+ mpSettings::SUBTITLE_PLACEMENT_BOTTOM_OF_VIDEO);
+ fSubtitlePlacementOP->AddOption("Bottom of screen",
+ mpSettings::SUBTITLE_PLACEMENT_BOTTOM_OF_SCREEN);
fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
- "Full volume", new BMessage(M_START_FULL_VOLUME));
+ "Full volume", new BMessage(M_SETTINGS_CHANGED));
fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume",
- "Low volume", new BMessage(M_START_HALF_VOLUME));
+ "Low volume", new BMessage(M_SETTINGS_CHANGED));
fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
- "Muted", new BMessage(M_START_MUTE_VOLUME));
+ "Muted", new BMessage(M_SETTINGS_CHANGED));
fRevertB = new BButton("revert", "Revert",
new BMessage(M_SETTINGS_REVERT));
@@ -146,6 +155,8 @@ SettingsWindow::SettingsWindow(BRect frame)
.Add(fUseOverlaysCB)
.Add(fScaleBilinearCB)
.Add(fScaleFullscreenControlsCB)
+ .Add(fSubtitleSizeOP)
+ .Add(fSubtitlePlacementOP)
)
)
.Add(BSpaceLayoutItem::CreateVerticalStrut(5))
@@ -205,17 +216,7 @@ void
SettingsWindow::MessageReceived(BMessage* message)
{
switch (message->what) {
- case M_AUTOSTART:
- case M_CLOSE_WINDOW_MOVIE:
- case M_CLOSE_WINDOW_SOUNDS:
- case M_LOOP_MOVIE:
- 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:
+ case M_SETTINGS_CHANGED:
ApplySettings();
break;
@@ -256,6 +257,9 @@ SettingsWindow::AdoptSettings()
fScaleBilinearCB->SetValue(fSettings.scaleBilinear);
fScaleFullscreenControlsCB->SetValue(fSettings.scaleFullscreenControls);
+ fSubtitleSizeOP->SetValue(fSettings.subtitleSize);
+ fSubtitlePlacementOP->SetValue(fSettings.subtitlePlacement);
+
fFullVolumeBGMoviesRB->SetValue(fSettings.backgroundMovieVolumeMode
== mpSettings::BG_MOVIES_FULL_VOLUME);
fHalfVolumeBGMoviesRB->SetValue(fSettings.backgroundMovieVolumeMode
@@ -283,6 +287,9 @@ SettingsWindow::ApplySettings()
fSettings.scaleFullscreenControls
= fScaleFullscreenControlsCB->Value() == B_CONTROL_ON;
+ fSettings.subtitleSize = fSubtitleSizeOP->Value();
+ fSettings.subtitlePlacement = fSubtitlePlacementOP->Value();
+
if (fFullVolumeBGMoviesRB->Value() == B_CONTROL_ON) {
fSettings.backgroundMovieVolumeMode
= mpSettings::BG_MOVIES_FULL_VOLUME;
diff --git a/src/apps/mediaplayer/settings/SettingsWindow.h b/src/apps/mediaplayer/settings/SettingsWindow.h
index c527ff5049..6285620e29 100644
--- a/src/apps/mediaplayer/settings/SettingsWindow.h
+++ b/src/apps/mediaplayer/settings/SettingsWindow.h
@@ -5,16 +5,20 @@
* Authors:
* Fredrik Modéen
*/
-
-#ifndef _SETTINGS_WINDOW_H
-#define _SETTINGS_WINDOW_H
+#ifndef SETTINGS_WINDOW_H
+#define SETTINGS_WINDOW_H
+
#include
-#include
-#include
#include "Settings.h"
+
+class BCheckBox;
+class BOptionPopUp;
+class BRadioButton;
+
+
class SettingsWindow : public BWindow {
public:
SettingsWindow(BRect frame);
@@ -43,6 +47,9 @@ private:
BCheckBox* fScaleBilinearCB;
BCheckBox* fScaleFullscreenControlsCB;
+ BOptionPopUp* fSubtitleSizeOP;
+ BOptionPopUp* fSubtitlePlacementOP;
+
BRadioButton* fFullVolumeBGMoviesRB;
BRadioButton* fHalfVolumeBGMoviesRB;
BRadioButton* fMutedVolumeBGMoviesRB;
@@ -50,4 +57,5 @@ private:
BButton* fRevertB;
};
-#endif
+
+#endif // SETTINGS_WINDOW_H