Removed incomplete Media Player GUI.
A new player is beeing developed. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8587 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
28a06094b2
commit
bd5c21f44a
@ -1,28 +0,0 @@
|
||||
#ifndef CONSTANTS_H
|
||||
#define CONSTANTS_H
|
||||
|
||||
#include <GraphicsDefs.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#define APP_SIGNATURE "application/x-vnd.obos.media-player"
|
||||
|
||||
// File menu
|
||||
const uint32 MENU_OPEN_FILE ='MFof';
|
||||
const uint32 MENU_OPEN_URL ='MFou';
|
||||
const uint32 MENU_FILE_INFO ='MFfi';
|
||||
const uint32 MENU_CLOSE ='MFcl';
|
||||
const uint32 MENU_QUIT ='MFqu';
|
||||
|
||||
// View menu
|
||||
const uint32 MENU_MINI_MODE ='MVmm';
|
||||
const uint32 MENU_HALF_SCALE ='MVhs';
|
||||
const uint32 MENU_NORMAL_SCALE ='MVns';
|
||||
const uint32 MENU_DOUBLE_SCALE ='MVds';
|
||||
const uint32 MENU_FULL_SCREEN ='MVfs';
|
||||
|
||||
// Settings menu
|
||||
const uint32 MENU_PREFERENCES ='MSpr';
|
||||
const uint32 MENU_LOOP ='MSlp';
|
||||
const uint32 MENU_PRESERVE_VIDEO_TIMING ='MSvt';
|
||||
|
||||
#endif // CONSTANTS_H
|
@ -1,13 +0,0 @@
|
||||
SubDir OBOS_TOP src apps mediaplayer ;
|
||||
|
||||
AddResources MediaPlayer :
|
||||
MediaPlayer.rdef MediaPlayer.icons.rdef MediaPlayer.version.rdef
|
||||
;
|
||||
|
||||
App MediaPlayer :
|
||||
MediaPlayerApp.cpp
|
||||
MediaPlayerView.cpp
|
||||
MediaPlayerWindow.cpp
|
||||
;
|
||||
|
||||
LinkSharedOSLibs MediaPlayer : be media tracker ;
|
@ -1,112 +0,0 @@
|
||||
/*
|
||||
** MediaPlayer.icons.rdef
|
||||
**
|
||||
*/
|
||||
|
||||
resource(0, "BEOS:L:application/ogg") #'ICON' array {
|
||||
$"ffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffffff"
|
||||
$"ffffffffffffffff0006060000ffffffffffffffffffffffffffffffffffffff"
|
||||
$"ffffffffffffff00060c0b07060000ffffffffffffffffffffffffffffffffff"
|
||||
$"ffffffffffff00060607060c0c06060000ffffffffffffffffffffffffffffff"
|
||||
$"ffffffffff00060607060607060c0c06060000ffffffffffffffffffffffffff"
|
||||
$"ffffffff000606070b0c0c060706060c0c06070000ffffffffffffffffffffff"
|
||||
$"ffffff00060607001b1c1c0b07060607060c0c06060000ffffffffffffffffff"
|
||||
$"ffff00060607001b1c1c0b07063f3f070606070c0b07060000ffffffffffffff"
|
||||
$"ff000606070606001c0c06073f19193f3f060607060c0c06060000ffffffffff"
|
||||
$"001b1c06070606070006063f193f3f19193f3f070607060c0b07060000ffffff"
|
||||
$"000b0c1c1b0706060706193f3f19193f3f19193f07060706060c0c06070000ff"
|
||||
$"000b3f0c0b1c1c0606070619193f3f19193f3f07060006070606070c0b070600"
|
||||
$"000c3f3f3f0b0c1c1b0706070619193f3f190607001b1c0c06070606070b1c00"
|
||||
$"000c0c3f3f3f3f0c0c1b1c0607060619190606001c1c1b1c06070606071b0700"
|
||||
$"ff00000b0c3f3f3f3f0b0c1c1b0706060706001c1b1c1c0b070607061c000600"
|
||||
$"ffffff00000b0c3f3f3f3f0b0c1c1b0706060700000000060706061c00000000"
|
||||
$"ffffffffff00000b0c3f3f3f3f0b0c1c1b0706060706070606071b0000000000"
|
||||
$"ffffffffffffff00000b0c3f3f3f3f0b0c1c1b0706060706071b0000000000ff"
|
||||
$"ffffffffffffffffff00000b0c3f3f3f3f0b0c1c1b0706061c0000000000ffff"
|
||||
$"ffffffffffffffffffffff00000b0c3f3f3f3f0b0c1c1b1c0000000000ffffff"
|
||||
$"ffffffffffffffffffffffffff00000b0c3f3f3f3f0b0c0000000000ffffffff"
|
||||
$"ffffffffffffffffffffffffffffff00000b0c3f3f3f0c00000000ffffffffff"
|
||||
$"ffffffffffffffffffffffffffffffffff00000b0c3f0b000000ffffffffffff"
|
||||
$"ffffffffffffffffffffffffffff000000000000000000000000000000000000"
|
||||
$"ffffffffffffffffffffffffffff000000000000000000000000000000000000"
|
||||
$"ffffffffffffffffffffffffffff0000003f3f0000003f3f0000003f3f000000"
|
||||
$"ffffffffffffffffffffffffffff00003f00003f003f000000003f0000000000"
|
||||
$"ffffffffffffffffffffffffffff00003f00003f003f003f3f003f003f3f0000"
|
||||
$"ffffffffffffffffffffffffffff00003f00003f003f00003f003f00003f0000"
|
||||
$"ffffffffffffffffffffffffffff0000003f3f0000003f3f0000003f3f000000"
|
||||
$"ffffffffffffffffffffffffffff000000000000000000000000000000000000"
|
||||
$"ffffffffffffffffffffffffffff000000000000000000000000000000000000"
|
||||
};
|
||||
|
||||
resource large_icon array {
|
||||
$"ffffffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffff"
|
||||
$"ffffffffffffffffffffff001b1c000000000000ffffffffffffffffffffffff"
|
||||
$"ffffffffffffffffffff003f1b1c1b1c0b0a1c1c0000ffffffffffffffffffff"
|
||||
$"ffffffffffffffffffff00153f3f1b1c1b1c0b0a1c190000ffffffffffffffff"
|
||||
$"ffffffffffffffffffff001515153f3f1b1c1b1c0b0a1a190000ffffffffffff"
|
||||
$"ffffffffffffffffffff0015151516153f3f1b1c1b1c0b0a1a1900ffffffffff"
|
||||
$"ffffffffffffffffffff00150b15151516153f3f1b1c1b1a0b0a00ffffffffff"
|
||||
$"ffffffffffffffffffff00150b0a0b15151615153f3f1b1c1b1100ffffffffff"
|
||||
$"ffffffffffffffffffff00150b86860b0b15151516153f1b0f0f00ffffffffff"
|
||||
$"ffffffffffffffffffff00150a868686860c0a151615150f0f0f00ffffffffff"
|
||||
$"ffffffffffffffffffff00150b8686868686860d0d15160e0f0f00ffffffffff"
|
||||
$"ffffffffffffffffffff00150b86868686868686863f150f0f0e00ffffffffff"
|
||||
$"ffffffffffffffffffff00160a86868686868686863f150f0f0e00ffffffffff"
|
||||
$"ffffffffffffffffffff00160a86868686868686863f150f0f0e00ffffffffff"
|
||||
$"ffffffffffffffffffff00160a3f868686868686863f150f0f0e00ffffffffff"
|
||||
$"ffffffffffffffffffff001615153f3f86868686863f150f0f0e00111111ffff"
|
||||
$"ffffffffffffffffffffff000a1516153f3f8686863f150f0f0e0011111111ff"
|
||||
$"ffffffffffffffffffff003f3f0a0b1515163f3f863f150f0f0e0000111111ff"
|
||||
$"ffffffffffffffffffff0015153f3f0a0b1515163f3f150f0f0e0b0b001111ff"
|
||||
$"ffffffffffffffffffff00151515163f3f0a0b15202a150f0f0e0b0f001111ff"
|
||||
$"ffffffffffffffffffff001515150b0b153f3f0a0b15150f0f0b0f0e001111ff"
|
||||
$"ffffffffffffffffffffff00001515150b0b153f3f0a0b0a0b0f0f0f001111ff"
|
||||
$"ffffffff000000ffffffffffff00001515150b15153f3f0e0f0f0f001111ffff"
|
||||
$"ffffff000a0b0a0000ffffffffffff00001515152d16150f0f0e001111ffffff"
|
||||
$"ffff000a07060b0a0b0000ffffffffffff0000151515160e0f001111ffffffff"
|
||||
$"ffff000a0b0afa060b0a0700ffffffffffffff000015150f001111ffffffffff"
|
||||
$"ffff0013130a0b0b0a070600ffffffffffffffffff0000001111ffffffffffff"
|
||||
$"ffffff000013130a070600ffffffffffffffffffffffffffffffffffffffffff"
|
||||
$"ffffffffff0000130600ffffffffffffffffffffffffffffffffffffffffffff"
|
||||
$"ffffffffffffff0000ffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
$"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
$"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||
};
|
||||
|
||||
resource(0, "BEOS:M:application/ogg") #'MICN' array {
|
||||
$"ffffffff0200ffffffffffffffffffff"
|
||||
$"ffffff0400080003ffffffffffffffff"
|
||||
$"ffff0500080a06040003ffffffffffff"
|
||||
$"ff01000a3f0a080d03040003ffffffff"
|
||||
$"010803020a081d1d180a09070003ffff"
|
||||
$"003f120a000f1d1d1d1d000309080009"
|
||||
$"001b3f181305040f1d001e3f01011707"
|
||||
$"ff00051a3f180f070004160d00120a00"
|
||||
$"ffffff00051a3f1813090000140a0007"
|
||||
$"ffffffffff00051a3f18000000000000"
|
||||
$"ffffffffffffff00051b00003f3f0000"
|
||||
$"ffffffffffffffffff00003f00003f00"
|
||||
$"ffffffffffffffffffff003f00003f00"
|
||||
$"ffffffffffffffffffff003f00003f00"
|
||||
$"ffffffffffffffffffff00003f3f0000"
|
||||
$"ffffffffffffffffffff000000000000"
|
||||
};
|
||||
|
||||
resource mini_icon array {
|
||||
$"ffffffff0b0b0c0fffffffffffffffff"
|
||||
$"ffffffff011b3f120b0a07ffffffffff"
|
||||
$"ffffffff010f1c3f3f1a0f0709ffffff"
|
||||
$"ffffffff00100c89193f3f1d00ffffff"
|
||||
$"ffffffff011186ae0c89191602ffffff"
|
||||
$"ffffffff0011861786ae180d03ffffff"
|
||||
$"ffffffff0111868686861e0e03ffffff"
|
||||
$"ffffff05000e1f6086acfe0e040effff"
|
||||
$"ffffff0012140f0e1f1a1d0f03d60eff"
|
||||
$"ffffff0512161e130f0e1a0f06020eff"
|
||||
$"ffffffff04020c1419160e0612040eff"
|
||||
$"ff06000effff04050beb3f11d606ffff"
|
||||
$"0a00120600ffffff0404040305ffffff"
|
||||
$"0d030d0c000dffffffffffffffffffff"
|
||||
$"ffff0d000dffffffffffffffffffffff"
|
||||
$"ffffffffffffffffffffffffffffffff"
|
||||
};
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
** MediaPlayer.rdef
|
||||
**
|
||||
*/
|
||||
|
||||
/* BEOS:APP_SIG :
|
||||
application:/x-vnd.obos.app-name
|
||||
*/
|
||||
|
||||
resource app_signature "application/x-vnd.obos.media-player";
|
||||
|
||||
/* BEOS:APP_FLAGS :
|
||||
00000000 = SINGLE LAUNCH
|
||||
00000001 = MULTIPLE LAUNCH
|
||||
00000002 = EXCLUSIVE LAUNCH
|
||||
00000004 = BACKGROUND APP + SINGLE LAUNCH
|
||||
00000005 = BACKGROUND APP + MULTIPLE LAUNCH
|
||||
00000006 = BACKGROUND APP + EXCLUSIVE LAUNCH
|
||||
00000008 = ARGV_ONLY + SINGLE LAUNCH
|
||||
00000009 = ARGV_ONLY + MULTIPLE LAUNCH
|
||||
0000000A = ARGV_ONLY + EXCLUSIVE LAUNCH
|
||||
0000000C = ARGV_ONLY + BACKGROUND APP + SINGLE LAUNCH
|
||||
0000000D = ARGV_ONLY + BACKGROUND APP + MULTIPLE LAUNCH
|
||||
0000000E = ARGV_ONLY + BACKGROUND APP + EXCLUSIVE LAUNCH
|
||||
*/
|
||||
|
||||
resource app_flags B_SINGLE_LAUNCH;
|
||||
|
||||
/* BEOS:FILE_TYPES :
|
||||
"types" = "text/plain",
|
||||
"types" = ....
|
||||
*/
|
||||
|
||||
// all these are official:
|
||||
// http://www.iana.org/assignments/media-types/
|
||||
|
||||
resource file_types message {
|
||||
"types" = "application/ogg",
|
||||
"types" = "audio",
|
||||
"types" = "audio/32kadpcm",
|
||||
"types" = "audio/basic",
|
||||
"types" = "audio/mpeg",
|
||||
"types" = "audio/x-aiff",
|
||||
"types" = "audio/x-riff",
|
||||
"types" = "audio/x-wav",
|
||||
"types" = "video",
|
||||
"types" = "video/mpeg",
|
||||
"types" = "video/quicktime",
|
||||
"types" = "video/x-msvideo"
|
||||
};
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
** MediaPlayer.version.rdef
|
||||
**
|
||||
*/
|
||||
|
||||
/*
|
||||
BEOS:APP_VERSION resources have a specific format, see also
|
||||
<be/storage/AppFileInfo.h:26>
|
||||
|
||||
But thanks to the rc resource compiler, you don't have to worry
|
||||
about any of that ;-)
|
||||
*/
|
||||
|
||||
resource app_version {
|
||||
|
||||
major = 1,
|
||||
middle = 0,
|
||||
minor = 0,
|
||||
|
||||
/* 0 = development 1 = alpha 2 = beta
|
||||
3 = gamma 4 = golden master 5 = final */
|
||||
variety = 0,
|
||||
|
||||
internal = 1,
|
||||
|
||||
short_info = "R1.0.0d1",
|
||||
long_info = "OpenBeOS 1.0.0d1 ©2003 OpenBeOS Project"
|
||||
};
|
@ -1,189 +0,0 @@
|
||||
|
||||
#include <Autolock.h>
|
||||
#include <Path.h>
|
||||
#include <Roster.h>
|
||||
#include <Screen.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Constants.h"
|
||||
#include "MediaPlayerApp.h"
|
||||
#include "MediaPlayerWindow.h"
|
||||
|
||||
using namespace BPrivate;
|
||||
|
||||
const int cascade_left = 50;
|
||||
const int cascade_top = 50;
|
||||
const int cascade_step = 10;
|
||||
|
||||
BRect windowRect(cascade_left-cascade_step,cascade_top-cascade_step,310,120);
|
||||
|
||||
void cascade() {
|
||||
BScreen screen(NULL);
|
||||
BRect screenBorder = screen.Frame();
|
||||
float left = windowRect.left + cascade_step;
|
||||
if (left + windowRect.Width() > screenBorder.right) {
|
||||
left = cascade_left;
|
||||
}
|
||||
float top = windowRect.top + cascade_step;
|
||||
if (top + windowRect.Height() > screenBorder.bottom) {
|
||||
top = cascade_top;
|
||||
}
|
||||
windowRect.OffsetTo(BPoint(left,top));
|
||||
}
|
||||
|
||||
void uncascade() {
|
||||
BScreen screen(NULL);
|
||||
BRect screenBorder = screen.Frame();
|
||||
float left = windowRect.left - cascade_step;
|
||||
if (left < cascade_left) {
|
||||
left = screenBorder.right - windowRect.Width() - cascade_left;
|
||||
left = left - ((int)left % cascade_step) + cascade_left;
|
||||
}
|
||||
float top = windowRect.top - cascade_step;
|
||||
if (top < cascade_top) {
|
||||
top = screenBorder.bottom - windowRect.Height() - cascade_top;
|
||||
top = top - ((int)left % cascade_step) + cascade_top;
|
||||
}
|
||||
windowRect.OffsetTo(BPoint(left,top));
|
||||
}
|
||||
|
||||
MediaPlayerApp * media_player_app;
|
||||
|
||||
MediaPlayerApp::MediaPlayerApp()
|
||||
: BApplication(APP_SIGNATURE)
|
||||
{
|
||||
fOpenPanel = new BFilePanel();
|
||||
|
||||
fWindowCount = 0;
|
||||
media_player_app = this;
|
||||
}
|
||||
|
||||
void MediaPlayerApp::DispatchMessage(BMessage *msg, BHandler *handler)
|
||||
{
|
||||
if ( msg->what == B_ARGV_RECEIVED ) {
|
||||
int32 argc;
|
||||
if (msg->FindInt32("argc",&argc) != B_OK) {
|
||||
argc = 0;
|
||||
}
|
||||
const char ** argv = new (const char*)[argc];
|
||||
for (int arg = 0; (arg < argc) ; arg++) {
|
||||
if (msg->FindString("argv",arg,&argv[arg]) != B_OK) {
|
||||
argv[arg] = "";
|
||||
}
|
||||
}
|
||||
const char * cwd;
|
||||
if (msg->FindString("cwd",&cwd) != B_OK) {
|
||||
cwd = "";
|
||||
}
|
||||
ArgvReceived(argc, argv, cwd);
|
||||
} else {
|
||||
BApplication::DispatchMessage(msg,handler);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaPlayerApp::MessageReceived(BMessage *message)
|
||||
{
|
||||
switch(message->what) {
|
||||
case B_SILENT_RELAUNCH:
|
||||
be_roster->ActivateApp(Team());
|
||||
break;
|
||||
default:
|
||||
BApplication::MessageReceived(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaPlayerApp::OpenDocument()
|
||||
{
|
||||
cascade();
|
||||
new MediaPlayerWindow(windowRect);
|
||||
fWindowCount++;
|
||||
}
|
||||
|
||||
void
|
||||
MediaPlayerApp::OpenDocument(entry_ref * ref)
|
||||
{
|
||||
cascade();
|
||||
new MediaPlayerWindow(windowRect,ref);
|
||||
fWindowCount++;
|
||||
}
|
||||
|
||||
void
|
||||
MediaPlayerApp::CloseDocument()
|
||||
{
|
||||
uncascade();
|
||||
fWindowCount--;
|
||||
if (fWindowCount == 0) {
|
||||
BAutolock lock(this);
|
||||
Quit();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaPlayerApp::RefsReceived(BMessage *message)
|
||||
{
|
||||
int32 refNum;
|
||||
entry_ref ref;
|
||||
|
||||
refNum = 0;
|
||||
while (message->FindRef("refs", refNum, &ref) == B_OK) {
|
||||
OpenDocument(&ref);
|
||||
refNum++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaPlayerApp::ArgvReceived(int32 argc, const char *argv[], const char * cwd)
|
||||
{
|
||||
for (int i = 1 ; (i < argc) ; i++) {
|
||||
BPath path;
|
||||
if (argv[i][0] == '/') {
|
||||
path.SetTo(argv[i]);
|
||||
} else {
|
||||
path.SetTo(cwd,argv[i]);
|
||||
}
|
||||
if (path.InitCheck() != B_OK) {
|
||||
printf("path.InitCheck failed: \"");
|
||||
if (argv[i][0] == '/') {
|
||||
printf("%s",argv[i]);
|
||||
} else {
|
||||
printf("%s/%s",cwd,argv[i]);
|
||||
}
|
||||
printf("\".\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
entry_ref ref;
|
||||
if (get_ref_for_path(path.Path(), &ref) != B_OK) {
|
||||
printf("get_ref_for_path failed: \"");
|
||||
printf("%s",path.Path());
|
||||
printf("\".\n");
|
||||
continue;
|
||||
}
|
||||
OpenDocument(&ref);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaPlayerApp::ReadyToRun()
|
||||
{
|
||||
if (fWindowCount == 0) {
|
||||
OpenDocument();
|
||||
}
|
||||
}
|
||||
|
||||
int32
|
||||
MediaPlayerApp::NumberOfWindows()
|
||||
{
|
||||
return fWindowCount;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
MediaPlayerApp mediaPlayer;
|
||||
mediaPlayer.Run();
|
||||
return 0;
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
#ifndef MEDIA_PLAYER_APP
|
||||
#define MEDIA_PLAYER_APP
|
||||
|
||||
#include <Application.h>
|
||||
#include <Message.h>
|
||||
#include <FilePanel.h>
|
||||
|
||||
class MediaPlayerApp
|
||||
: public BApplication
|
||||
{
|
||||
public:
|
||||
MediaPlayerApp();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
void ArgvReceived(int32 argc, const char *argv[], const char * cwd);
|
||||
virtual void RefsReceived(BMessage *message);
|
||||
virtual void ReadyToRun();
|
||||
|
||||
virtual void DispatchMessage(BMessage *an_event, BHandler *handler);
|
||||
|
||||
int32 NumberOfWindows();
|
||||
void OpenDocument();
|
||||
void OpenDocument(entry_ref * ref);
|
||||
void CloseDocument();
|
||||
|
||||
private:
|
||||
BFilePanel *fOpenPanel;
|
||||
int32 fWindowCount;
|
||||
|
||||
};
|
||||
|
||||
extern MediaPlayerApp * media_player_app;
|
||||
|
||||
#endif // MEDIA_PLAYER_APP
|
@ -1,28 +0,0 @@
|
||||
#include <Message.h>
|
||||
#include <Messenger.h>
|
||||
#include <Rect.h>
|
||||
#include <Node.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Constants.h"
|
||||
#include "MediaPlayerView.h"
|
||||
|
||||
using namespace BPrivate;
|
||||
|
||||
MediaPlayerView::MediaPlayerView(BRect viewFrame, BHandler *handler)
|
||||
: BView(viewFrame, "mediaview", B_FOLLOW_ALL, B_FRAME_EVENTS|B_WILL_DRAW)
|
||||
{
|
||||
fHandler = handler;
|
||||
fMessenger = new BMessenger(handler);
|
||||
}
|
||||
|
||||
MediaPlayerView::~MediaPlayerView()
|
||||
{
|
||||
delete fMessenger;
|
||||
}
|
||||
|
||||
void
|
||||
MediaPlayerView::FrameResized(float width, float height)
|
||||
{
|
||||
BView::FrameResized(width, height);
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
#ifndef MEDIA_PLAYER_VIEW_H
|
||||
#define MEDIA_PLAYER_VIEW_H
|
||||
|
||||
#include <File.h>
|
||||
#include <View.h>
|
||||
|
||||
class MediaPlayerView : public BView {
|
||||
public:
|
||||
MediaPlayerView(BRect viewframe, BHandler *handler);
|
||||
virtual ~MediaPlayerView();
|
||||
|
||||
virtual void FrameResized(float width, float height);
|
||||
|
||||
private:
|
||||
BHandler *fHandler;
|
||||
BMessenger *fMessenger;
|
||||
};
|
||||
|
||||
#endif // MEDIA_PLAYER_VIEW_H
|
@ -1,180 +0,0 @@
|
||||
#include <Autolock.h>
|
||||
#include <File.h>
|
||||
#include <Menu.h>
|
||||
#include <MenuItem.h>
|
||||
#include <Roster.h>
|
||||
#include <Window.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "Constants.h"
|
||||
#include "MediaPlayerApp.h"
|
||||
#include "MediaPlayerView.h"
|
||||
#include "MediaPlayerWindow.h"
|
||||
|
||||
using namespace BPrivate;
|
||||
|
||||
MediaPlayerWindow::MediaPlayerWindow(BRect frame)
|
||||
: BWindow(frame,"Media Player",B_TITLED_WINDOW,0)
|
||||
{
|
||||
InitWindow();
|
||||
Show();
|
||||
}
|
||||
|
||||
MediaPlayerWindow::MediaPlayerWindow(BRect frame, entry_ref *ref)
|
||||
: BWindow(frame,"Media Player",B_TITLED_WINDOW,0)
|
||||
{
|
||||
InitWindow();
|
||||
OpenFile(ref);
|
||||
Show();
|
||||
}
|
||||
|
||||
MediaPlayerWindow::~MediaPlayerWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
MediaPlayerWindow::InitWindow()
|
||||
{
|
||||
fMenuBar = new BMenuBar(BRect(0,0,0,0),"menubar");
|
||||
AddChild(fMenuBar);
|
||||
|
||||
BRect viewFrame;
|
||||
viewFrame = Bounds();
|
||||
viewFrame.top = fMenuBar->Bounds().Height()+1; // 021021
|
||||
viewFrame.left = 0; // 021021
|
||||
|
||||
fPlaverView = new MediaPlayerView(viewFrame, this);
|
||||
fPlaverView->MakeFocus(true);
|
||||
|
||||
BMenu * menu;
|
||||
BMenuItem * menuItem;
|
||||
|
||||
// File menu
|
||||
fMenuBar->AddItem(menu = new BMenu("File"));
|
||||
|
||||
fOpenFileMenu = new BMenu("Open File...");
|
||||
menu->AddItem(menuItem = new BMenuItem(fOpenFileMenu, new BMessage(MENU_OPEN_FILE)));
|
||||
menuItem->SetShortcut('O',0);
|
||||
fOpenURLMenu = new BMenu("Open URL...");
|
||||
menu->AddItem(menuItem = new BMenuItem(fOpenURLMenu, new BMessage(MENU_OPEN_URL)));
|
||||
menuItem->SetShortcut('U',0);
|
||||
menu->AddItem(fFileInfoItem = new BMenuItem("File Info...", new BMessage(MENU_FILE_INFO), 'I'));
|
||||
fFileInfoItem->SetEnabled(false);
|
||||
menu->AddSeparatorItem();
|
||||
|
||||
menu->AddItem(fCloseItem = new BMenuItem("Close", new BMessage(MENU_CLOSE), 'W'));
|
||||
menu->AddItem(fQuitItem = new BMenuItem("Quit", new BMessage(MENU_QUIT), 'Q'));
|
||||
|
||||
// View menu
|
||||
fMenuBar->AddItem(menu = new BMenu("View"));
|
||||
|
||||
menu->AddItem(fMiniModeItem = new BMenuItem("Mini mode", new BMessage(MENU_MINI_MODE), 'T'));
|
||||
menu->AddItem(fHalfScaleItem = new BMenuItem("50% scale", new BMessage(MENU_HALF_SCALE), '0'));
|
||||
fHalfScaleItem->SetEnabled(false);
|
||||
menu->AddItem(fNormalScaleItem = new BMenuItem("100% scale", new BMessage(MENU_NORMAL_SCALE), '1'));
|
||||
fNormalScaleItem->SetEnabled(false);
|
||||
menu->AddItem(fDoubleScaleItem = new BMenuItem("200% scale", new BMessage(MENU_DOUBLE_SCALE), '2'));
|
||||
fDoubleScaleItem->SetEnabled(false);
|
||||
menu->AddItem(fFullScreenItem = new BMenuItem("Full screen", new BMessage(MENU_FULL_SCREEN), 'F'));
|
||||
fFullScreenItem->SetEnabled(false);
|
||||
|
||||
// Settings menu
|
||||
fMenuBar->AddItem(menu = new BMenu("Settings"));
|
||||
menu->AddItem(fApplicationPreferencesItem = new BMenuItem("Application Preferences...",
|
||||
new BMessage(MENU_PREFERENCES)));
|
||||
menu->AddItem(fLoopItem = new BMenuItem("Loop", new BMessage(MENU_LOOP), 'L'));
|
||||
fLoopItem->SetEnabled(false);
|
||||
menu->AddItem(fPreserveVideoTimingItem = new BMenuItem("Preserve Video Timing",
|
||||
new BMessage(MENU_PRESERVE_VIDEO_TIMING)));
|
||||
fPreserveVideoTimingItem->SetEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
MediaPlayerWindow::MessageReceived(BMessage *message)
|
||||
{
|
||||
if(message->WasDropped()) {
|
||||
entry_ref ref;
|
||||
if(message->FindRef("refs",0,&ref)==B_OK) {
|
||||
message->what = B_REFS_RECEIVED;
|
||||
be_app->PostMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
switch(message->what){
|
||||
case MENU_CLOSE: {
|
||||
if(this->QuitRequested()) {
|
||||
BAutolock lock(this);
|
||||
Quit();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MENU_QUIT:
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
break;
|
||||
default:
|
||||
BWindow::MessageReceived(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaPlayerWindow::MenusBeginning()
|
||||
{
|
||||
// set up the recent documents menu
|
||||
BMessage documents;
|
||||
be_roster->GetRecentDocuments(&documents,9,NULL,APP_SIGNATURE);
|
||||
|
||||
// delete old items..
|
||||
// shatty: it would be preferable to keep the old
|
||||
// menu around instead of continuously thrashing
|
||||
// the menu, but unfortunately there does not
|
||||
// seem to be a straightforward way to update it
|
||||
// going backwards may simplify memory management
|
||||
for (int i = fOpenFileMenu->CountItems()-1 ; (i >= 0) ; i--) {
|
||||
delete fOpenFileMenu->RemoveItem(i);
|
||||
}
|
||||
// add new items
|
||||
int count = 0;
|
||||
entry_ref ref;
|
||||
while (documents.FindRef("refs",count++,&ref) == B_OK) {
|
||||
if ((ref.device != -1) && (ref.directory != -1)) {
|
||||
// sanity check passed
|
||||
BMessage * openRecent = new BMessage(B_REFS_RECEIVED);
|
||||
openRecent->AddRef("refs",&ref);
|
||||
BMenuItem * item = new BMenuItem(ref.name,openRecent);
|
||||
item->SetTarget(be_app);
|
||||
fOpenFileMenu->AddItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MediaPlayerWindow::Quit()
|
||||
{
|
||||
media_player_app->CloseDocument();
|
||||
BWindow::Quit();
|
||||
}
|
||||
|
||||
bool
|
||||
MediaPlayerWindow::QuitRequested()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
MediaPlayerWindow::OpenFile(entry_ref *ref)
|
||||
{
|
||||
BFile file;
|
||||
status_t fileinit;
|
||||
|
||||
fileinit = file.SetTo(ref, B_READ_ONLY);
|
||||
|
||||
if (fileinit == B_OK) {
|
||||
// allocate media file etc.
|
||||
} else {
|
||||
// complain
|
||||
}
|
||||
|
||||
be_roster->AddToRecentDocuments(ref,APP_SIGNATURE);
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
#ifndef MEDIA_PLAYER_WINDOW_H
|
||||
#define MEDIA_PLAYER_WINDOW_H
|
||||
|
||||
#include <FilePanel.h>
|
||||
#include <MenuBar.h>
|
||||
#include <Message.h>
|
||||
#include <Rect.h>
|
||||
#include <Window.h>
|
||||
|
||||
class MediaPlayerView;
|
||||
|
||||
class MediaPlayerWindow
|
||||
: public BWindow
|
||||
{
|
||||
public:
|
||||
MediaPlayerWindow(BRect frame);
|
||||
MediaPlayerWindow(BRect frame, entry_ref *ref);
|
||||
virtual ~MediaPlayerWindow();
|
||||
|
||||
virtual void Quit();
|
||||
virtual bool QuitRequested();
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void MenusBeginning();
|
||||
|
||||
void OpenFile(entry_ref *ref);
|
||||
|
||||
private:
|
||||
void InitWindow();
|
||||
|
||||
BMenuBar *fMenuBar;
|
||||
BMenu *fOpenFileMenu;
|
||||
BMenu *fOpenURLMenu;
|
||||
BMenuItem *fFileInfoItem;
|
||||
BMenuItem *fCloseItem;
|
||||
BMenuItem *fQuitItem;
|
||||
|
||||
BMenuItem *fMiniModeItem;
|
||||
BMenuItem *fHalfScaleItem;
|
||||
BMenuItem *fNormalScaleItem;
|
||||
BMenuItem *fDoubleScaleItem;
|
||||
BMenuItem *fFullScreenItem;
|
||||
|
||||
BMenuItem *fApplicationPreferencesItem;
|
||||
BMenuItem *fLoopItem;
|
||||
BMenuItem *fPreserveVideoTimingItem;
|
||||
|
||||
MediaPlayerView *fPlaverView;
|
||||
};
|
||||
|
||||
#endif // MEDIA_PLAYER_WINDOW_H
|
Loading…
Reference in New Issue
Block a user