Commit f42368fa authored by Tony Castley's avatar Tony Castley

Implemented correct scaling and used new window size variables.

Beta always on top for the interface window.  New cursor handling.
parent db2031b6
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* InterfaceWindow.cpp: beos interface * InterfaceWindow.cpp: beos interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.cpp,v 1.12 2002/02/08 15:57:29 sam Exp $ * $Id: InterfaceWindow.cpp,v 1.13 2002/03/22 13:16:35 tcastley Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -84,6 +84,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name, ...@@ -84,6 +84,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
BMenu *mAudio; BMenu *mAudio;
CDMenu *cd_menu; CDMenu *cd_menu;
BMenu *mNavigation; BMenu *mNavigation;
BMenu *mConfig;
/* Add the file Menu */ /* Add the file Menu */
BMenuItem *mItem; BMenuItem *mItem;
...@@ -124,6 +125,12 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name, ...@@ -124,6 +125,12 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
mNavigation->AddItem( new BMenuItem( "Next Chapter", mNavigation->AddItem( new BMenuItem( "Next Chapter",
new BMessage(NEXT_CHAPTER)) ); new BMessage(NEXT_CHAPTER)) );
/* Add the Config menu */
menu_bar->AddItem( mConfig = new BMenu( "Config" ) );
menu_bar->ResizeToPreferred();
mConfig->AddItem( miOnTop = new BMenuItem( "Always on Top",
new BMessage(TOGGLE_ON_TOP)) );
miOnTop->SetMarked(false);
ResizeTo(260,50 + menu_bar->Bounds().IntegerHeight()+1); ResizeTo(260,50 + menu_bar->Bounds().IntegerHeight()+1);
controlRect = Bounds(); controlRect = Bounds();
...@@ -169,6 +176,20 @@ void InterfaceWindow::MessageReceived( BMessage * p_message ) ...@@ -169,6 +176,20 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
alert->Go(); alert->Go();
break; break;
case TOGGLE_ON_TOP:
miOnTop->SetMarked(! miOnTop->IsMarked() );
if ( miOnTop->IsMarked() )
{
SetFeel(B_FLOATING_APP_WINDOW_FEEL);
SetWorkspaces(B_CURRENT_WORKSPACE);
}
else
{
SetFeel(B_NORMAL_WINDOW_FEEL);
SetWorkspaces(B_CURRENT_WORKSPACE);
}
break;
case OPEN_FILE: case OPEN_FILE:
if( file_panel ) if( file_panel )
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* InterfaceWindow.h: BeOS interface window class prototype * InterfaceWindow.h: BeOS interface window class prototype
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.h,v 1.11 2001/06/15 09:07:10 tcastley Exp $ * $Id: InterfaceWindow.h,v 1.12 2002/03/22 13:16:35 tcastley Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au> * Tony Castley <tcastley@mail.powerup.com.au>
...@@ -65,6 +65,7 @@ private: ...@@ -65,6 +65,7 @@ private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
bool b_empty_playlist; bool b_empty_playlist;
BFilePanel *file_panel; BFilePanel *file_panel;
BMenuItem *miOnTop;
es_descriptor_t * p_audio_es; es_descriptor_t * p_audio_es;
es_descriptor_t * p_spu_es; es_descriptor_t * p_spu_es;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* MsgVals.h * MsgVals.h
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: MsgVals.h,v 1.8 2002/01/04 14:01:34 sam Exp $ * $Id: MsgVals.h,v 1.9 2002/03/22 13:16:35 tcastley Exp $
* *
* Authors: Tony Castley <tcastley@mail.powerup.com.au> * Authors: Tony Castley <tcastley@mail.powerup.com.au>
* *
...@@ -42,3 +42,5 @@ const uint32 PREV_TITLE = 'PRTI'; ...@@ -42,3 +42,5 @@ const uint32 PREV_TITLE = 'PRTI';
const uint32 NEXT_TITLE = 'NXTI'; const uint32 NEXT_TITLE = 'NXTI';
const uint32 PREV_CHAPTER = 'PRCH'; const uint32 PREV_CHAPTER = 'PRCH';
const uint32 NEXT_CHAPTER = 'NXCH'; const uint32 NEXT_CHAPTER = 'NXCH';
const uint32 TOGGLE_ON_TOP = 'ONTP';
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* VideoWindow.h: BeOS video window class prototype * VideoWindow.h: BeOS video window class prototype
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN * Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: VideoWindow.h,v 1.12 2002/03/20 10:33:42 tcastley Exp $ * $Id: VideoWindow.h,v 1.13 2002/03/22 13:16:35 tcastley Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au> * Tony Castley <tcastley@mail.powerup.com.au>
...@@ -42,8 +42,8 @@ class VideoWindow ...@@ -42,8 +42,8 @@ class VideoWindow
{ {
public: public:
// standard constructor and destructor // standard constructor and destructor
VideoWindow( int width, int height, VideoWindow( int v_width, int v_height,
struct vout_thread_s *p_video_output); int w_width, int w_height);
~VideoWindow(); ~VideoWindow();
void Zoom(BPoint origin, float width, float height); void Zoom(BPoint origin, float width, float height);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_beos.cpp: beos video output display method * vout_beos.cpp: beos video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: vout_beos.cpp,v 1.47 2002/03/20 10:33:42 tcastley Exp $ * $Id: vout_beos.cpp,v 1.48 2002/03/22 13:16:35 tcastley Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -225,19 +225,20 @@ void directWindow::drawBuffer(int bufferIndex) ...@@ -225,19 +225,20 @@ void directWindow::drawBuffer(int bufferIndex)
/***************************************************************************** /*****************************************************************************
* VideoWindow constructor and destructor * VideoWindow constructor and destructor
*****************************************************************************/ *****************************************************************************/
VideoWindow::VideoWindow( int width, int height, VideoWindow::VideoWindow( int v_width, int v_height,
vout_thread_t *p_video_output ) int w_width, int w_height )
{ {
// need to centre the window on the screeen.
if ( BDirectWindow::SupportsWindowMode() ) if ( BDirectWindow::SupportsWindowMode() )
{ {
voutWindow = new directWindow( BRect( 80, 50, voutWindow = new directWindow( BRect( 20, 50,
80 + width, 50 + height ), this ); 20 + w_width, 50 + w_height ), this );
mode = DIRECT; mode = DIRECT;
} }
else else
{ {
voutWindow = new bitmapWindow( BRect( 80, 50, voutWindow = new bitmapWindow( BRect( 20, 50,
80 + width, 50 + height ), this ); 20 + w_width, 50 + w_height ), this );
mode = BITMAP; mode = BITMAP;
} }
...@@ -245,6 +246,7 @@ VideoWindow::VideoWindow( int width, int height, ...@@ -245,6 +246,7 @@ VideoWindow::VideoWindow( int width, int height,
teardownwindow = false; teardownwindow = false;
is_zoomed = false; is_zoomed = false;
resized = true; resized = true;
/* call ScreenChanged to set vsync correctly */ /* call ScreenChanged to set vsync correctly */
BScreen *screen; BScreen *screen;
screen = new BScreen(voutWindow); screen = new BScreen(voutWindow);
...@@ -257,23 +259,15 @@ VideoWindow::VideoWindow( int width, int height, ...@@ -257,23 +259,15 @@ VideoWindow::VideoWindow( int width, int height,
/* Bitmap mode overlay not available, set the system to 32bits /* Bitmap mode overlay not available, set the system to 32bits
* and let BeOS do all the work */ * and let BeOS do all the work */
bitmap[0] = new BBitmap( voutWindow->Bounds(), B_RGB32); bitmap[0] = new BBitmap( BRect( 0, 0, v_width, v_height ), B_RGB32);
bitmap[1] = new BBitmap( voutWindow->Bounds(), B_RGB32); bitmap[1] = new BBitmap( BRect( 0, 0, v_width, v_height ), B_RGB32);
memset(bitmap[0]->Bits(), 0, bitmap[0]->BitsLength()); memset(bitmap[0]->Bits(), 0, bitmap[0]->BitsLength());
memset(bitmap[1]->Bits(), 0, bitmap[1]->BitsLength()); memset(bitmap[1]->Bits(), 0, bitmap[1]->BitsLength());
i_width = bitmap[0]->Bounds().IntegerWidth(); // remember current settings
i_height = bitmap[0]->Bounds().IntegerHeight(); i_width = w_width;
i_height = w_height;
winSize = voutWindow->Frame(); FrameResized(w_width, w_height);
out_top = 0;
out_left = 0;
out_height = winSize.Height();
out_width = winSize.Width();
width_scale = out_width / i_width;
height_scale = out_height / i_height;
voutWindow->Show(); voutWindow->Show();
} }
...@@ -333,7 +327,7 @@ void VideoWindow::Zoom(BPoint origin, float width, float height ) ...@@ -333,7 +327,7 @@ void VideoWindow::Zoom(BPoint origin, float width, float height )
voutWindow->ResizeTo(rect.IntegerWidth(), rect.IntegerHeight()); voutWindow->ResizeTo(rect.IntegerWidth(), rect.IntegerHeight());
width_scale = rect.IntegerWidth() / i_width; width_scale = rect.IntegerWidth() / i_width;
height_scale = rect.IntegerHeight() / i_height; height_scale = rect.IntegerHeight() / i_height;
be_app->HideCursor(); be_app->ObscureCursor();
} }
resized = true; resized = true;
} }
...@@ -495,10 +489,13 @@ int vout_Init( vout_thread_t *p_vout ) ...@@ -495,10 +489,13 @@ int vout_Init( vout_thread_t *p_vout )
p_vout->p_sys->pp_buffer[0] = (u8*)p_vout->p_sys->p_window->bitmap[0]->Bits(); p_vout->p_sys->pp_buffer[0] = (u8*)p_vout->p_sys->p_window->bitmap[0]->Bits();
p_vout->p_sys->pp_buffer[1] = (u8*)p_vout->p_sys->p_window->bitmap[1]->Bits(); p_vout->p_sys->pp_buffer[1] = (u8*)p_vout->p_sys->p_window->bitmap[1]->Bits();
p_vout->output.i_width = p_vout->p_sys->i_width; p_vout->output.i_width = p_vout->render.i_width;
p_vout->output.i_height = p_vout->p_sys->i_height; p_vout->output.i_height = p_vout->render.i_height;
/* Assume we have square pixels */
p_vout->output.i_aspect = p_vout->p_sys->i_width p_vout->output.i_aspect = p_vout->p_sys->i_width
* VOUT_ASPECT_FACTOR / p_vout->p_sys->i_height; * VOUT_ASPECT_FACTOR / p_vout->p_sys->i_height;
p_vout->output.i_chroma = FOURCC_RV32; p_vout->output.i_chroma = FOURCC_RV32;
p_vout->output.i_rmask = 0x00ff0000; p_vout->output.i_rmask = 0x00ff0000;
...@@ -606,9 +603,11 @@ void vout_Display( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -606,9 +603,11 @@ void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
*****************************************************************************/ *****************************************************************************/
static int BeosOpenDisplay( vout_thread_t *p_vout ) static int BeosOpenDisplay( vout_thread_t *p_vout )
{ {
p_vout->p_sys->p_window = new VideoWindow( p_vout->p_sys->i_width - 1, p_vout->p_sys->p_window = new VideoWindow( p_vout->p_sys->i_width - 1,
p_vout->p_sys->i_height - 1, p_vout->p_sys->i_height - 1,
p_vout ); p_vout->i_window_width,
p_vout->i_window_height);
if( p_vout->p_sys->p_window == NULL ) if( p_vout->p_sys->p_window == NULL )
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment