* Implemented decreasing the volume of inactive player windows according to
the global settings. This is only done though if there are multiple players open at the time. (It doesn't consider their "playing" state, though.) * The SettingsWindow is now maintained by the MainApp, and there is only a single instance, those settings are application wide. Also used the "application floating" window look&feel. * Small code cleanups. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27210 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -327,6 +327,31 @@ Controller::SetTo(const entry_ref &ref)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Controller::PlayerActivated(bool active)
|
||||||
|
{
|
||||||
|
BAutolock _(this);
|
||||||
|
|
||||||
|
if (active) {
|
||||||
|
if (fActiveVolume != fVolume)
|
||||||
|
SetVolume(fActiveVolume);
|
||||||
|
} else {
|
||||||
|
fActiveVolume = fVolume;
|
||||||
|
switch (fBackgroundMovieVolumeMode) {
|
||||||
|
case mpSettings::BG_MOVIES_MUTED:
|
||||||
|
SetVolume(0.0);
|
||||||
|
break;
|
||||||
|
case mpSettings::BG_MOVIES_HALF_VLUME:
|
||||||
|
SetVolume(fVolume * 0.25);
|
||||||
|
break;
|
||||||
|
case mpSettings::BG_MOVIES_FULL_VOLUME:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Controller::GetSize(int *width, int *height)
|
Controller::GetSize(int *width, int *height)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ public:
|
|||||||
|
|
||||||
// Controller
|
// Controller
|
||||||
status_t SetTo(const entry_ref &ref);
|
status_t SetTo(const entry_ref &ref);
|
||||||
|
void PlayerActivated(bool active);
|
||||||
|
|
||||||
void GetSize(int *width, int *height);
|
void GetSize(int *width, int *height);
|
||||||
|
|
||||||
int AudioTrackCount();
|
int AudioTrackCount();
|
||||||
@@ -99,7 +101,7 @@ public:
|
|||||||
bigtime_t TimeDuration();
|
bigtime_t TimeDuration();
|
||||||
bigtime_t TimePosition();
|
bigtime_t TimePosition();
|
||||||
|
|
||||||
virtual void SetVolume(float percent);
|
virtual void SetVolume(float factor);
|
||||||
float Volume();
|
float Volume();
|
||||||
void VolumeUp();
|
void VolumeUp();
|
||||||
void VolumeDown();
|
void VolumeDown();
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "EventQueue.h"
|
#include "EventQueue.h"
|
||||||
|
#include "SettingsWindow.h"
|
||||||
|
|
||||||
|
|
||||||
MainApp *gMainApp;
|
MainApp *gMainApp;
|
||||||
@@ -45,6 +46,7 @@ MainApp::MainApp()
|
|||||||
: BApplication(kAppSig),
|
: BApplication(kAppSig),
|
||||||
fPlayerCount(0),
|
fPlayerCount(0),
|
||||||
fFirstWindow(NewWindow()),
|
fFirstWindow(NewWindow()),
|
||||||
|
fSettingsWindow(NULL),
|
||||||
|
|
||||||
fMediaServerRunning(false),
|
fMediaServerRunning(false),
|
||||||
fMediaAddOnServerRunning(false)
|
fMediaAddOnServerRunning(false)
|
||||||
@@ -57,7 +59,21 @@ MainApp::~MainApp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BWindow *
|
bool
|
||||||
|
MainApp::QuitRequested()
|
||||||
|
{
|
||||||
|
// TODO: When doing this in the destructor, the MainApp does not
|
||||||
|
// quit properly. Is this a Haiku bug? (SettingsWindow::QuitRequested()
|
||||||
|
// returns "false" always.)
|
||||||
|
if (fSettingsWindow && fSettingsWindow->Lock())
|
||||||
|
fSettingsWindow->Quit();
|
||||||
|
fSettingsWindow = NULL;
|
||||||
|
|
||||||
|
return BApplication::QuitRequested();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BWindow*
|
||||||
MainApp::NewWindow()
|
MainApp::NewWindow()
|
||||||
{
|
{
|
||||||
BAutolock _(this);
|
BAutolock _(this);
|
||||||
@@ -66,9 +82,25 @@ MainApp::NewWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
MainApp::PlayerCount() const
|
||||||
|
{
|
||||||
|
BAutolock _(const_cast<MainApp*>(this));
|
||||||
|
return fPlayerCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MainApp::ReadyToRun()
|
MainApp::ReadyToRun()
|
||||||
{
|
{
|
||||||
|
// setup the settings window now, we need to have it
|
||||||
|
fSettingsWindow = new SettingsWindow(BRect(150, 150, 450, 520));
|
||||||
|
fSettingsWindow->Hide();
|
||||||
|
fSettingsWindow->Show();
|
||||||
|
|
||||||
// Now tell the application roster, that we're interested
|
// Now tell the application roster, that we're interested
|
||||||
// in getting notifications of apps being launched or quit.
|
// in getting notifications of apps being launched or quit.
|
||||||
// In this way we are going to detect a media_server restart.
|
// In this way we are going to detect a media_server restart.
|
||||||
@@ -193,6 +225,9 @@ MainApp::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case M_SETTINGS:
|
||||||
|
_ShowSettingsWindow();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BApplication::MessageReceived(message);
|
BApplication::MessageReceived(message);
|
||||||
@@ -218,6 +253,19 @@ MainApp::_BroadcastMessage(const BMessage& _message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
MainApp::_ShowSettingsWindow()
|
||||||
|
{
|
||||||
|
if (fSettingsWindow->Lock()) {
|
||||||
|
if (fSettingsWindow->IsHidden())
|
||||||
|
fSettingsWindow->Show();
|
||||||
|
else
|
||||||
|
fSettingsWindow->Activate();
|
||||||
|
fSettingsWindow->Unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,30 +26,37 @@
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
M_PLAYER_QUIT = 'plqt',
|
M_PLAYER_QUIT = 'plqt',
|
||||||
|
M_SETTINGS = 'stng',
|
||||||
|
|
||||||
M_MEDIA_SERVER_STARTED = 'msst',
|
M_MEDIA_SERVER_STARTED = 'msst',
|
||||||
M_MEDIA_SERVER_QUIT = 'msqt'
|
M_MEDIA_SERVER_QUIT = 'msqt'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SettingsWindow;
|
||||||
|
|
||||||
class MainApp : public BApplication {
|
class MainApp : public BApplication {
|
||||||
public:
|
public:
|
||||||
MainApp();
|
MainApp();
|
||||||
virtual ~MainApp();
|
virtual ~MainApp();
|
||||||
|
|
||||||
BWindow* NewWindow();
|
BWindow* NewWindow();
|
||||||
|
int32 PlayerCount() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
virtual bool QuitRequested();
|
||||||
virtual void ReadyToRun();
|
virtual void ReadyToRun();
|
||||||
virtual void RefsReceived(BMessage* message);
|
virtual void RefsReceived(BMessage* message);
|
||||||
virtual void ArgvReceived(int32 argc, char** argv);
|
virtual void ArgvReceived(int32 argc, char** argv);
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
virtual void AboutRequested();
|
virtual void AboutRequested();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void _ShowSettingsWindow();
|
||||||
void _BroadcastMessage(const BMessage& message);
|
void _BroadcastMessage(const BMessage& message);
|
||||||
|
|
||||||
private:
|
|
||||||
int32 fPlayerCount;
|
int32 fPlayerCount;
|
||||||
BWindow* fFirstWindow;
|
BWindow* fFirstWindow;
|
||||||
|
SettingsWindow* fSettingsWindow;
|
||||||
|
|
||||||
bool fMediaServerRunning;
|
bool fMediaServerRunning;
|
||||||
bool fMediaAddOnServerRunning;
|
bool fMediaAddOnServerRunning;
|
||||||
|
|||||||
@@ -48,7 +48,6 @@
|
|||||||
#include "PlaylistObserver.h"
|
#include "PlaylistObserver.h"
|
||||||
#include "PlaylistWindow.h"
|
#include "PlaylistWindow.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "SettingsWindow.h"
|
|
||||||
|
|
||||||
#define NAME "MediaPlayer"
|
#define NAME "MediaPlayer"
|
||||||
#define MIN_WIDTH 250
|
#define MIN_WIDTH 250
|
||||||
@@ -77,7 +76,6 @@ enum {
|
|||||||
M_TOGGLE_NO_BORDER_NO_MENU_NO_CONTROLS,
|
M_TOGGLE_NO_BORDER_NO_MENU_NO_CONTROLS,
|
||||||
M_TOGGLE_ALWAYS_ON_TOP,
|
M_TOGGLE_ALWAYS_ON_TOP,
|
||||||
M_TOGGLE_KEEP_ASPECT_RATIO,
|
M_TOGGLE_KEEP_ASPECT_RATIO,
|
||||||
M_SETTINGS,
|
|
||||||
M_VOLUME_UP,
|
M_VOLUME_UP,
|
||||||
M_VOLUME_DOWN,
|
M_VOLUME_DOWN,
|
||||||
M_SKIP_NEXT,
|
M_SKIP_NEXT,
|
||||||
@@ -106,7 +104,6 @@ MainWin::MainWin()
|
|||||||
fFilePanel(NULL),
|
fFilePanel(NULL),
|
||||||
fInfoWin(NULL),
|
fInfoWin(NULL),
|
||||||
fPlaylistWindow(NULL),
|
fPlaylistWindow(NULL),
|
||||||
fSettingsWindow(NULL),
|
|
||||||
fHasFile(false),
|
fHasFile(false),
|
||||||
fHasVideo(false),
|
fHasVideo(false),
|
||||||
fHasAudio(false),
|
fHasAudio(false),
|
||||||
@@ -184,11 +181,6 @@ MainWin::MainWin()
|
|||||||
|
|
||||||
_SetupWindow();
|
_SetupWindow();
|
||||||
|
|
||||||
// setup the settings window now, we need to have it
|
|
||||||
fSettingsWindow = new SettingsWindow(BRect(150, 150, 450, 520));
|
|
||||||
fSettingsWindow->Hide();
|
|
||||||
fSettingsWindow->Show();
|
|
||||||
|
|
||||||
// setup the playlist window now, we need to have it
|
// setup the playlist window now, we need to have it
|
||||||
// running for the undo/redo playlist editing
|
// running for the undo/redo playlist editing
|
||||||
fPlaylistWindow = new PlaylistWindow(BRect(150, 150, 500, 600), fPlaylist,
|
fPlaylistWindow = new PlaylistWindow(BRect(150, 150, 500, 600), fPlaylist,
|
||||||
@@ -209,6 +201,7 @@ MainWin::~MainWin()
|
|||||||
{
|
{
|
||||||
printf("MainWin::~MainWin\n");
|
printf("MainWin::~MainWin\n");
|
||||||
|
|
||||||
|
Settings::Default()->RemoveListener(&fGlobalSettingsListener);
|
||||||
fPlaylist->RemoveListener(fPlaylistObserver);
|
fPlaylist->RemoveListener(fPlaylistObserver);
|
||||||
fController->RemoveListener(fControllerObserver);
|
fController->RemoveListener(fControllerObserver);
|
||||||
fController->SetPeakListener(NULL);
|
fController->SetPeakListener(NULL);
|
||||||
@@ -218,20 +211,12 @@ MainWin::~MainWin()
|
|||||||
fBackground->RemoveSelf();
|
fBackground->RemoveSelf();
|
||||||
delete fBackground;
|
delete fBackground;
|
||||||
|
|
||||||
if (fInfoWin) {
|
if (fInfoWin && fInfoWin->Lock())
|
||||||
fInfoWin->Lock();
|
|
||||||
fInfoWin->Quit();
|
fInfoWin->Quit();
|
||||||
}
|
|
||||||
if (fPlaylistWindow) {
|
|
||||||
fPlaylistWindow->Lock();
|
|
||||||
fPlaylistWindow->Quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fSettingsWindow) {
|
|
||||||
fSettingsWindow->Lock();
|
|
||||||
fSettingsWindow->Quit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (fPlaylistWindow && fPlaylistWindow->Lock())
|
||||||
|
fPlaylistWindow->Quit();
|
||||||
|
|
||||||
delete fPlaylist;
|
delete fPlaylist;
|
||||||
delete fFilePanel;
|
delete fFilePanel;
|
||||||
|
|
||||||
@@ -247,56 +232,56 @@ MainWin::~MainWin()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWin::FrameResized(float new_width, float new_height)
|
MainWin::FrameResized(float newWidth, float newHeight)
|
||||||
{
|
{
|
||||||
if (new_width != Bounds().Width() || new_height != Bounds().Height()) {
|
if (newWidth != Bounds().Width() || newHeight != Bounds().Height()) {
|
||||||
debugger("size wrong\n");
|
debugger("size wrong\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool no_menu = fNoMenu || fIsFullscreen;
|
|
||||||
bool no_controls = fNoControls || fIsFullscreen;
|
|
||||||
|
|
||||||
printf("FrameResized enter: new_width %.0f, new_height %.0f\n",
|
|
||||||
new_width, new_height);
|
|
||||||
|
|
||||||
int max_video_width = int(new_width) + 1;
|
|
||||||
int max_video_height = int(new_height) + 1
|
|
||||||
- (no_menu ? 0 : fMenuBarHeight)
|
|
||||||
- (no_controls ? 0 : fControlsHeight);
|
|
||||||
|
|
||||||
ASSERT(max_video_height >= 0);
|
bool noMenu = fNoMenu || fIsFullscreen;
|
||||||
|
bool noControls = fNoControls || fIsFullscreen;
|
||||||
|
|
||||||
|
printf("FrameResized enter: newWidth %.0f, newHeight %.0f\n",
|
||||||
|
newWidth, newHeight);
|
||||||
|
|
||||||
|
int maxVideoWidth = int(newWidth) + 1;
|
||||||
|
int maxVideoHeight = int(newHeight) + 1
|
||||||
|
- (noMenu ? 0 : fMenuBarHeight)
|
||||||
|
- (noControls ? 0 : fControlsHeight);
|
||||||
|
|
||||||
|
ASSERT(maxVideoHeight >= 0);
|
||||||
|
|
||||||
int y = 0;
|
int y = 0;
|
||||||
|
|
||||||
if (no_menu) {
|
if (noMenu) {
|
||||||
if (!fMenuBar->IsHidden())
|
if (!fMenuBar->IsHidden())
|
||||||
fMenuBar->Hide();
|
fMenuBar->Hide();
|
||||||
} else {
|
} else {
|
||||||
// fMenuBar->MoveTo(0, y);
|
// fMenuBar->MoveTo(0, y);
|
||||||
fMenuBar->ResizeTo(new_width, fMenuBarHeight - 1);
|
fMenuBar->ResizeTo(newWidth, fMenuBarHeight - 1);
|
||||||
if (fMenuBar->IsHidden())
|
if (fMenuBar->IsHidden())
|
||||||
fMenuBar->Show();
|
fMenuBar->Show();
|
||||||
y += fMenuBarHeight;
|
y += fMenuBarHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_video_height == 0) {
|
if (maxVideoHeight == 0) {
|
||||||
if (!fVideoView->IsHidden())
|
bool hidden = fVideoView->IsHidden();
|
||||||
|
printf(" video view hidden: %d\n", hidden);
|
||||||
|
if (!hidden)
|
||||||
fVideoView->Hide();
|
fVideoView->Hide();
|
||||||
} else {
|
} else {
|
||||||
// fVideoView->MoveTo(0, y);
|
_ResizeVideoView(0, y, maxVideoWidth, maxVideoHeight);
|
||||||
// fVideoView->ResizeTo(max_video_width - 1, max_video_height - 1);
|
|
||||||
_ResizeVideoView(0, y, max_video_width, max_video_height);
|
|
||||||
if (fVideoView->IsHidden())
|
if (fVideoView->IsHidden())
|
||||||
fVideoView->Show();
|
fVideoView->Show();
|
||||||
y += max_video_height;
|
y += maxVideoHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (no_controls) {
|
if (noControls) {
|
||||||
if (!fControls->IsHidden())
|
if (!fControls->IsHidden())
|
||||||
fControls->Hide();
|
fControls->Hide();
|
||||||
} else {
|
} else {
|
||||||
fControls->MoveTo(0, y);
|
fControls->MoveTo(0, y);
|
||||||
fControls->ResizeTo(new_width, fControlsHeight - 1);
|
fControls->ResizeTo(newWidth, fControlsHeight - 1);
|
||||||
if (fControls->IsHidden())
|
if (fControls->IsHidden())
|
||||||
fControls->Show();
|
fControls->Show();
|
||||||
// y += fControlsHeight;
|
// y += fControlsHeight;
|
||||||
@@ -654,9 +639,6 @@ MainWin::MessageReceived(BMessage *msg)
|
|||||||
VideoFormatChange(544, 576, 1.41176, 1.0);
|
VideoFormatChange(544, 576, 1.41176, 1.0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_SETTINGS:
|
|
||||||
ShowSettingsWindow();
|
|
||||||
break;
|
|
||||||
/*
|
/*
|
||||||
default:
|
default:
|
||||||
if (msg->what >= M_SELECT_CHANNEL
|
if (msg->what >= M_SELECT_CHANNEL
|
||||||
@@ -701,23 +683,25 @@ MainWin::WindowActivated(bool active)
|
|||||||
float diffX = 0.0;
|
float diffX = 0.0;
|
||||||
float diffY = 0.0;
|
float diffY = 0.0;
|
||||||
|
|
||||||
// If the frame if off the edge of the screen at all
|
// If the frame is off the edge of the screen at all
|
||||||
// we will move it so all the window is on the screen.
|
// we will move it so all the window is on the screen.
|
||||||
if (frame.left < screenFrame.left)
|
|
||||||
// Move right
|
|
||||||
diffX = screenFrame.left - frame.left;
|
|
||||||
if (frame.top < screenFrame.top)
|
|
||||||
// Move down
|
|
||||||
diffY = screenFrame.top - frame.top;
|
|
||||||
if (frame.right > screenFrame.right)
|
if (frame.right > screenFrame.right)
|
||||||
// Move left
|
// Move left
|
||||||
diffX = screenFrame.right - frame.right;
|
diffX = screenFrame.right - frame.right;
|
||||||
if (frame.bottom > screenFrame.bottom)
|
if (frame.bottom > screenFrame.bottom)
|
||||||
// Move up
|
// Move up
|
||||||
diffY = screenFrame.bottom - frame.bottom;
|
diffY = screenFrame.bottom - frame.bottom;
|
||||||
|
if (frame.left < screenFrame.left)
|
||||||
|
// Move right
|
||||||
|
diffX = screenFrame.left - frame.left;
|
||||||
|
if (frame.top < screenFrame.top)
|
||||||
|
// Move down
|
||||||
|
diffY = screenFrame.top - frame.top;
|
||||||
|
|
||||||
MoveBy(diffX, diffY);
|
MoveBy(diffX, diffY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fController->PlayerActivated(active || gMainApp->PlayerCount() <= 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -803,19 +787,6 @@ MainWin::ShowPlaylistWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
MainWin::ShowSettingsWindow()
|
|
||||||
{
|
|
||||||
if (fSettingsWindow->Lock()) {
|
|
||||||
if (fSettingsWindow->IsHidden())
|
|
||||||
fSettingsWindow->Show();
|
|
||||||
else
|
|
||||||
fSettingsWindow->Activate();
|
|
||||||
fSettingsWindow->Unlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MainWin::VideoFormatChange(int width, int height, float width_scale,
|
MainWin::VideoFormatChange(int width, int height, float width_scale,
|
||||||
float height_scale)
|
float height_scale)
|
||||||
@@ -976,8 +947,10 @@ MainWin::_CreateMenu()
|
|||||||
fSettingsMenu->AddItem(new BMenuItem("Always on Top",
|
fSettingsMenu->AddItem(new BMenuItem("Always on Top",
|
||||||
new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'T'));
|
new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'T'));
|
||||||
fSettingsMenu->AddSeparatorItem();
|
fSettingsMenu->AddSeparatorItem();
|
||||||
fSettingsMenu->AddItem(new BMenuItem("Settings"B_UTF8_ELLIPSIS,
|
item = new BMenuItem("Settings"B_UTF8_ELLIPSIS,
|
||||||
new BMessage(M_SETTINGS), 'S'));
|
new BMessage(M_SETTINGS), 'S');
|
||||||
|
fSettingsMenu->AddItem(item);
|
||||||
|
item->SetTarget(be_app);
|
||||||
|
|
||||||
// fDebugMenu->AddItem(new BMenuItem("pixel aspect ratio 1.00000:1",
|
// fDebugMenu->AddItem(new BMenuItem("pixel aspect ratio 1.00000:1",
|
||||||
// new BMessage(M_ASPECT_100000_1)));
|
// new BMessage(M_ASPECT_100000_1)));
|
||||||
@@ -1056,15 +1029,15 @@ void
|
|||||||
MainWin::_ResizeWindow(int percent)
|
MainWin::_ResizeWindow(int percent)
|
||||||
{
|
{
|
||||||
// Get required window size
|
// Get required window size
|
||||||
int video_width = lround(fSourceWidth * fWidthScale);
|
int videoWidth = lround(fSourceWidth * fWidthScale);
|
||||||
int video_height = lround(fSourceHeight * fHeightScale);
|
int videoHeight = lround(fSourceHeight * fHeightScale);
|
||||||
|
|
||||||
video_width = (video_width * percent) / 100;
|
videoWidth = (videoWidth * percent) / 100;
|
||||||
video_height = (video_height * percent) / 100;
|
videoHeight = (videoHeight * percent) / 100;
|
||||||
|
|
||||||
// Calculate and set the initial window size
|
// Calculate and set the initial window size
|
||||||
int width = max_c(fControlsWidth, video_width);
|
int width = max_c(fControlsWidth, videoWidth);
|
||||||
int height = (fNoControls ? 0 : fControlsHeight) + video_height;
|
int height = (fNoControls ? 0 : fControlsHeight) + videoHeight;
|
||||||
if (!fNoMenu) {
|
if (!fNoMenu) {
|
||||||
width = max_c(width, fMenuBarWidth);
|
width = max_c(width, fMenuBarWidth);
|
||||||
height += fMenuBarHeight;
|
height += fMenuBarHeight;
|
||||||
@@ -1083,21 +1056,21 @@ MainWin::_ResizeVideoView(int x, int y, int width, int height)
|
|||||||
if (fKeepAspectRatio) {
|
if (fKeepAspectRatio) {
|
||||||
// Keep aspect ratio, place video view inside
|
// Keep aspect ratio, place video view inside
|
||||||
// the background area (may create black bars).
|
// the background area (may create black bars).
|
||||||
float scaled_width = fSourceWidth * fWidthScale;
|
float scaledWidth = fSourceWidth * fWidthScale;
|
||||||
float scaled_height = fSourceHeight * fHeightScale;
|
float scaledHeight = fSourceHeight * fHeightScale;
|
||||||
float factor = min_c(width / scaled_width, height / scaled_height);
|
float factor = min_c(width / scaledWidth, height / scaledHeight);
|
||||||
int render_width = lround(scaled_width * factor);
|
int renderWidth = lround(scaledWidth * factor);
|
||||||
int render_height = lround(scaled_height * factor);
|
int renderHeight = lround(scaledHeight * factor);
|
||||||
if (render_width > width)
|
if (renderWidth > width)
|
||||||
render_width = width;
|
renderWidth = width;
|
||||||
if (render_height > height)
|
if (renderHeight > height)
|
||||||
render_height = height;
|
renderHeight = height;
|
||||||
|
|
||||||
int x_ofs = x + (width - render_width) / 2;
|
int xOffset = x + (width - renderWidth) / 2;
|
||||||
int y_ofs = y + (height - render_height) / 2;
|
int yOffset = y + (height - renderHeight) / 2;
|
||||||
|
|
||||||
fVideoView->MoveTo(x_ofs, y_ofs);
|
fVideoView->MoveTo(xOffset, yOffset);
|
||||||
fVideoView->ResizeTo(render_width - 1, render_height - 1);
|
fVideoView->ResizeTo(renderWidth - 1, renderHeight - 1);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fVideoView->MoveTo(x, y);
|
fVideoView->MoveTo(x, y);
|
||||||
|
|||||||
@@ -37,7 +37,6 @@
|
|||||||
class ControllerObserver;
|
class ControllerObserver;
|
||||||
class PlaylistObserver;
|
class PlaylistObserver;
|
||||||
class PlaylistWindow;
|
class PlaylistWindow;
|
||||||
class SettingsWindow;
|
|
||||||
|
|
||||||
class MainWin : public BWindow {
|
class MainWin : public BWindow {
|
||||||
public:
|
public:
|
||||||
@@ -106,7 +105,6 @@ private:
|
|||||||
ControllerView* fControls;
|
ControllerView* fControls;
|
||||||
InfoWin* fInfoWin;
|
InfoWin* fInfoWin;
|
||||||
PlaylistWindow* fPlaylistWindow;
|
PlaylistWindow* fPlaylistWindow;
|
||||||
SettingsWindow* fSettingsWindow;
|
|
||||||
|
|
||||||
BMenu* fFileMenu;
|
BMenu* fFileMenu;
|
||||||
BMenu* fAudioMenu;
|
BMenu* fAudioMenu;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007, Haiku. All rights reserved.
|
* Copyright 2007-2008, Haiku. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -140,7 +140,7 @@ PlaylistItem::Draw(BView* owner, BRect frame, const font_height& fh,
|
|||||||
#else
|
#else
|
||||||
rgb_color lightGreen = tint_color(green, B_LIGHTEN_2_TINT);
|
rgb_color lightGreen = tint_color(green, B_LIGHTEN_2_TINT);
|
||||||
rgb_color darkGreen = tint_color(green, B_DARKEN_2_TINT);
|
rgb_color darkGreen = tint_color(green, B_DARKEN_2_TINT);
|
||||||
owner->BeginLineArray( 6 );
|
owner->BeginLineArray(6);
|
||||||
// black outline
|
// black outline
|
||||||
owner->AddLine(arrow[0], arrow[1], black);
|
owner->AddLine(arrow[0], arrow[1], black);
|
||||||
owner->AddLine(BPoint(arrow[1].x + 1.0, arrow[1].y - 1.0),
|
owner->AddLine(BPoint(arrow[1].x + 1.0, arrow[1].y - 1.0),
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ enum {
|
|||||||
#define BUTTONHEIGHT 20
|
#define BUTTONHEIGHT 20
|
||||||
|
|
||||||
SettingsWindow::SettingsWindow(BRect frame)
|
SettingsWindow::SettingsWindow(BRect frame)
|
||||||
: BWindow(frame, "MediaPlayer Settings", B_TITLED_WINDOW_LOOK,
|
: BWindow(frame, "MediaPlayer Settings", B_FLOATING_WINDOW_LOOK,
|
||||||
B_NORMAL_WINDOW_FEEL,
|
B_FLOATING_APP_WINDOW_FEEL,
|
||||||
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
|
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
|
||||||
#ifdef __HAIKU__
|
#ifdef __HAIKU__
|
||||||
| B_AUTO_UPDATE_SIZE_LIMITS)
|
| B_AUTO_UPDATE_SIZE_LIMITS)
|
||||||
@@ -70,7 +70,7 @@ SettingsWindow::SettingsWindow(BRect frame)
|
|||||||
BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions",
|
BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions",
|
||||||
"View options");
|
"View options");
|
||||||
BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg",
|
BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg",
|
||||||
"Play background movies at");
|
"Play background clips at");
|
||||||
BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER);
|
BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER);
|
||||||
playModeLabel->SetExplicitAlignment(alignment);
|
playModeLabel->SetExplicitAlignment(alignment);
|
||||||
playModeLabel->SetFont(be_bold_font);
|
playModeLabel->SetFont(be_bold_font);
|
||||||
@@ -105,7 +105,7 @@ SettingsWindow::SettingsWindow(BRect frame)
|
|||||||
"Full volume", new BMessage(M_START_FULL_VOLUME));
|
"Full volume", new BMessage(M_START_FULL_VOLUME));
|
||||||
|
|
||||||
fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume",
|
fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume",
|
||||||
"Half volume", new BMessage(M_START_HALF_VOLUME));
|
"Low volume", new BMessage(M_START_HALF_VOLUME));
|
||||||
|
|
||||||
fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
|
fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
|
||||||
"Muted", new BMessage(M_START_MUTE_VOLUME));
|
"Muted", new BMessage(M_START_MUTE_VOLUME));
|
||||||
@@ -228,7 +228,7 @@ SettingsWindow::SettingsWindow(BRect frame)
|
|||||||
|
|
||||||
rect.OffsetBy(0, rect.Height() + SPACE + SPACEING);
|
rect.OffsetBy(0, rect.Height() + SPACE + SPACEING);
|
||||||
bbox->AddChild(new BStringView(rect, "stringViewPlayBackg",
|
bbox->AddChild(new BStringView(rect, "stringViewPlayBackg",
|
||||||
"Play backgrounds movies at:"));
|
"Play backgrounds clips at:"));
|
||||||
|
|
||||||
rect.OffsetBy(SPACE, rect.Height() + SPACEING);
|
rect.OffsetBy(SPACE, rect.Height() + SPACEING);
|
||||||
fFullVolumeBGMoviesRB = new BRadioButton(rect, "rdbtnfullvolume",
|
fFullVolumeBGMoviesRB = new BRadioButton(rect, "rdbtnfullvolume",
|
||||||
@@ -237,7 +237,7 @@ SettingsWindow::SettingsWindow(BRect frame)
|
|||||||
|
|
||||||
rect.OffsetBy(0, rect.Height() + SPACEING);
|
rect.OffsetBy(0, rect.Height() + SPACEING);
|
||||||
fHalfVolumeBGMoviesRB = new BRadioButton(rect, "rdbtnhalfvolume",
|
fHalfVolumeBGMoviesRB = new BRadioButton(rect, "rdbtnhalfvolume",
|
||||||
"Half Volume", new BMessage(M_START_HALF_VOLUME));
|
"Low Volume", new BMessage(M_START_HALF_VOLUME));
|
||||||
bbox->AddChild(fHalfVolumeBGMoviesRB);
|
bbox->AddChild(fHalfVolumeBGMoviesRB);
|
||||||
|
|
||||||
rect.OffsetBy(0, rect.Height() + SPACEING);
|
rect.OffsetBy(0, rect.Height() + SPACEING);
|
||||||
@@ -252,10 +252,6 @@ SettingsWindow::SettingsWindow(BRect frame)
|
|||||||
// disable currently unsupported features
|
// disable currently unsupported features
|
||||||
fLoopMoviesCB->SetEnabled(false);
|
fLoopMoviesCB->SetEnabled(false);
|
||||||
fLoopSoundsCB->SetEnabled(false);
|
fLoopSoundsCB->SetEnabled(false);
|
||||||
|
|
||||||
fFullVolumeBGMoviesRB->SetEnabled(false);
|
|
||||||
fHalfVolumeBGMoviesRB->SetEnabled(false);
|
|
||||||
fMutedVolumeBGMoviesRB->SetEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user