* intf_beos.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: intf_beos.cpp,v 1.8 2001/02/18 03:32:02 polux Exp $
+ * $Id: intf_beos.cpp,v 1.9 2001/02/19 03:46:27 sam Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
#include <stdio.h>
#include <stdlib.h> /* malloc(), free() */
+
#include <kernel/OS.h>
+#include <storage/Path.h>
#include <View.h>
#include <Application.h>
#include <Message.h>
+#include <NodeInfo.h>
#include <Locker.h>
#include <DirectWindow.h>
+
#include <malloc.h>
#include <string.h>
#include "modules.h"
#include "intf_msg.h"
+#include "intf_plst.h"
#include "interface.h"
#include "main.h"
* InterfaceWindow
*****************************************************************************/
-InterfaceWindow::InterfaceWindow( BRect frame, const char *name , intf_thread_t *p_intf )
- : BWindow(frame, name, B_TITLED_WINDOW, B_NOT_RESIZABLE|B_NOT_ZOOMABLE)
+InterfaceWindow::InterfaceWindow( BRect frame, const char *name , intf_thread_t *p_interface )
+ : BWindow(frame, name, B_TITLED_WINDOW, B_NOT_ZOOMABLE)
{
- p_interface = p_intf;
+ p_intf = p_interface;
SetName( "interface" );
BView * p_view;
{
case B_KEY_DOWN:
p_message->FindString( "bytes", (const char **)&psz_key );
- p_interface->p_sys->i_key = psz_key[0];
+ p_intf->p_sys->i_key = psz_key[0];
break;
+ case B_SIMPLE_DATA:
+ {
+ entry_ref ref;
+ if( p_message->FindRef( "refs", &ref ) == B_OK )
+ {
+ BPath path( &ref );
+ char * psz_name = strdup(path.Path());
+ intf_WarnMsg( 1, "intf: dropped text/uri-list data `%s'",
+ psz_name );
+ intf_PlstAdd( p_main->p_playlist, PLAYLIST_END, psz_name );
+ }
+
+ }
+ break;
+
default:
BWindow::MessageReceived( p_message );
break;
bool InterfaceWindow::QuitRequested()
{
+ p_intf->b_die = 1;
+
return( false );
}
-
extern "C"
{
#define BYTES_PER_PIXEL 2
/*****************************************************************************
- * vout_sys_t: dummy video output method descriptor
+ * vout_sys_t: BeOS video output method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
- * It describes the dummy specific properties of an output thread.
+ * It describes the BeOS specific properties of an output thread.
*****************************************************************************/
typedef struct vout_sys_s
{
VideoWindow * p_window;
-
+
byte_t * pp_buffer[2];
s32 i_width;
s32 i_height;
locker->Unlock();
}
+/*****************************************************************************
+ * VideoWindow::FrameResized
+ *****************************************************************************/
+
+void VideoWindow::FrameResized( float width, float height )
+{
+ b_resized = 1;
+}
+
/*****************************************************************************
* VideoWindow::MessageReceived
*****************************************************************************/
switch( p_message->what )
{
case B_KEY_DOWN:
+ case B_SIMPLE_DATA:
// post the message to the interface window which will handle it
p_win = beos_GetAppWindow( "interface" );
if( p_win != NULL )
bool VideoWindow::QuitRequested()
{
- return( true );
+ /* FIXME: send a message ! */
+ p_main->p_intf->b_die = 1;
+
+ return( false );
}
extern "C"
}
/*****************************************************************************
- * vout_Create: allocates dummy video thread output method
+ * vout_Create: allocates BeOS video thread output method
*****************************************************************************
- * This function allocates and initializes a dummy vout method.
+ * This function allocates and initializes a BeOS vout method.
*****************************************************************************/
int vout_Create( vout_thread_t *p_vout )
{
}
/*****************************************************************************
- * vout_Init: initialize dummy video thread output method
+ * vout_Init: initialize BeOS video thread output method
*****************************************************************************/
int vout_Init( vout_thread_t *p_vout )
{
}
/*****************************************************************************
- * vout_End: terminate dummy video thread output method
+ * vout_End: terminate BeOS video thread output method
*****************************************************************************/
void vout_End( vout_thread_t *p_vout )
{
}
/*****************************************************************************
- * vout_Destroy: destroy dummy video thread output method
+ * vout_Destroy: destroy BeOS video thread output method
*****************************************************************************
* Terminate an output method created by DummyCreateOutputMethod
*****************************************************************************/
}
/*****************************************************************************
- * vout_Manage: handle dummy events
+ * vout_Manage: handle BeOS events
*****************************************************************************
* This function should be called regularly by video output thread. It manages
* console events. It returns a non null value on error.
*****************************************************************************/
int vout_Manage( vout_thread_t *p_vout )
{
+ if( p_vout->p_sys->p_window->b_resized )
+ {
+ p_vout->p_sys->p_window->b_resized = 0;
+ p_vout->i_changes |= VOUT_SIZE_CHANGE;
+ }
+
if( p_vout->i_changes & VOUT_SIZE_CHANGE )
{
- intf_DbgMsg( "resizing window" );
+ intf_WarnMsg( 1, "resizing window" );
p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
/* Resize window */
intf_Msg( "vout: video display resized (%dx%d)",
p_vout->i_width, p_vout->i_height );
}
+
return( 0 );
}
/*****************************************************************************
* vout_Display: displays previously rendered output
*****************************************************************************
- * This function send the currently rendered image to dummy image, waits until
+ * This function send the currently rendered image to BeOS image, waits until
* it is displayed and switch the two rendering buffers, preparing next frame.
*****************************************************************************/
void vout_Display( vout_thread_t *p_vout )
/* following functions are local */
/*****************************************************************************
- * BeosOpenDisplay: open and initialize dummy device
+ * BeosOpenDisplay: open and initialize BeOS device
*****************************************************************************
* XXX?? The framebuffer mode is only provided as a fast and efficient way to
* display video, providing the card is configured and the mode ok. It is
{
/* Create the DirectDraw video window */
p_vout->p_sys->p_window =
- new VideoWindow( BRect( 50, 150, 50+p_vout->i_width-1, 150+p_vout->i_height-1 ), VOUT_TITLE " (BeOS output)", p_vout );
+ new VideoWindow( BRect( 50, 150, 50+p_vout->i_width-1, 150+p_vout->i_height-1 ), VOUT_TITLE " (BeOS output) - drop a file here to play it !", p_vout );
if( p_vout->p_sys->p_window == 0 )
{
free( p_vout->p_sys );
}
/*****************************************************************************
- * BeosDisplay: close and reset dummy device
+ * BeosDisplay: close and reset BeOS device
*****************************************************************************
* Returns all resources allocated by BeosOpenDisplay and restore the original
* state of the device.