]> git.sesse.net Git - vlc/blobdiff - plugins/beos/intf_beos.cpp
Some heavy changes today:
[vlc] / plugins / beos / intf_beos.cpp
index 27cb3a943c917e566ddca2d0a4f412eb600acb1a..628205dead18cf226f838a890aac4019db1f6a25 100644 (file)
@@ -2,16 +2,18 @@
  * intf_beos.cpp: beos interface
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: intf_beos.cpp,v 1.9 2001/02/19 03:46:27 sam Exp $
+ * $Id: intf_beos.cpp,v 1.35 2001/12/30 07:09:54 sam Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
+ *          Tony Castley <tony@castley.net>
+ *          Richard Shepherd <richard@rshepherd.demon.co.uk>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include "defs.h"
-
 #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 <InterfaceKit.h>
 #include <string.h>
 
 extern "C"
 {
-#include "config.h"
-#include "common.h"
-#include "threads.h"
-#include "mtime.h"
-#include "tests.h"
-#include "modules.h"
-
-#include "intf_msg.h"
-#include "intf_plst.h"
-#include "interface.h"
+#include <videolan/vlc.h>
 
-#include "main.h"
+#include "stream_control.h"
+
+#include "interface.h"
+#include "input_ext-intf.h"
 }
 
-#include "beos_window.h"
+#include "InterfaceWindow.h"
 
 /*****************************************************************************
  * intf_sys_t: description and status of FB interface
@@ -69,74 +53,6 @@ typedef struct intf_sys_s
     char              i_key;
 } intf_sys_t;
 
-/*****************************************************************************
- * InterfaceWindow
- *****************************************************************************/
-InterfaceWindow::InterfaceWindow( BRect frame, const char *name , intf_thread_t  *p_interface )
-    : BWindow(frame, name, B_TITLED_WINDOW, B_NOT_ZOOMABLE)
-{
-    p_intf = p_interface;
-    SetName( "interface" );
-    
-    BView * p_view;
-    
-    p_view = new BView( Bounds(), "", B_FOLLOW_ALL, B_WILL_DRAW );
-    AddChild( p_view );
-    
-    Show();
-}
-
-InterfaceWindow::~InterfaceWindow()
-{
-}
-
-/*****************************************************************************
- * InterfaceWindow::MessageReceived
- *****************************************************************************/
-
-void InterfaceWindow::MessageReceived( BMessage * p_message )
-{
-    char * psz_key;
-    
-    switch( p_message->what )
-    {
-    case B_KEY_DOWN:
-        p_message->FindString( "bytes", (const char **)&psz_key );
-        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;
-    }
-}
-
-/*****************************************************************************
- * InterfaceWindow::QuitRequested
- *****************************************************************************/
-
-bool InterfaceWindow::QuitRequested()
-{
-    p_intf->b_die = 1;
-
-    return( false );
-}
 
 extern "C"
 {
@@ -153,7 +69,7 @@ static void intf_Run       ( intf_thread_t *p_intf );
  * Functions exported as capabilities. They are declared as static so that
  * we don't pollute the namespace too much.
  *****************************************************************************/
-void intf_getfunctions( function_list_t * p_function_list )
+void _M( intf_getfunctions )( function_list_t * p_function_list )
 {
     p_function_list->pf_probe = intf_Probe;
     p_function_list->functions.intf.pf_open  = intf_Open;
@@ -178,10 +94,19 @@ static int intf_Probe( probedata_t *p_data )
 }
 
 /*****************************************************************************
- * intf_Open: initialize dummy interface
+ * intf_Open: initialize interface
  *****************************************************************************/
 static int intf_Open( intf_thread_t *p_intf )
 {
+    BScreen *screen;
+    screen = new BScreen();
+    BRect rect = screen->Frame();
+    rect.top = rect.bottom-100;
+    rect.bottom -= 50;
+    rect.left += 50;
+    rect.right = rect.left + 350;
+    delete screen;
+
     /* Allocate instance and initialize some members */
     p_intf->p_sys = (intf_sys_t*) malloc( sizeof( intf_sys_t ) );
     if( p_intf->p_sys == NULL )
@@ -190,10 +115,10 @@ static int intf_Open( intf_thread_t *p_intf )
         return( 1 );
     }
     p_intf->p_sys->i_key = -1;
-    
+
     /* Create the interface window */
     p_intf->p_sys->p_window =
-        new InterfaceWindow( BRect( 50, 50, 400, 100 ),
+        new InterfaceWindow( rect,
                              VOUT_TITLE " (BeOS interface)", p_intf );
     if( p_intf->p_sys->p_window == 0 )
     {
@@ -201,9 +126,6 @@ static int intf_Open( intf_thread_t *p_intf )
         intf_ErrMsg( "error: cannot allocate memory for InterfaceWindow" );
         return( 1 );
     }
-    
-    /* Bind normal keys. */
-    intf_AssignNormalKeys( p_intf );
 
     return( 0 );
 }
@@ -215,7 +137,7 @@ static void intf_Close( intf_thread_t *p_intf )
 {
     /* Destroy the interface window */
     p_intf->p_sys->p_window->Lock();
-    p_intf->p_sys->p_window->Quit();    
+    p_intf->p_sys->p_window->Quit();
 
     /* Destroy structure */
     free( p_intf->p_sys );
@@ -227,16 +149,16 @@ static void intf_Close( intf_thread_t *p_intf )
  *****************************************************************************/
 static void intf_Run( intf_thread_t *p_intf )
 {
+
     while( !p_intf->b_die )
     {
         /* Manage core vlc functions through the callback */
         p_intf->pf_manage( p_intf );
 
-        /* Manage keys */
-        if( p_intf->p_sys->i_key != -1 )
+        /* Manage the slider */
+        if( p_intf->p_input != NULL && p_intf->p_sys->p_window != NULL)
         {
-            intf_ProcessKey( p_intf, p_intf->p_sys->i_key );
-            p_intf->p_sys->i_key = -1;
+        p_intf->p_sys->p_window->updateInterface();
         }
 
         /* Wait a bit */
@@ -245,3 +167,4 @@ static void intf_Run( intf_thread_t *p_intf )
 }
 
 } /* extern "C" */
+