]> git.sesse.net Git - vlc/blob - modules/gui/beos/Interface.cpp
Remove E_()
[vlc] / modules / gui / beos / Interface.cpp
1 /*****************************************************************************
2  * intf_beos.cpp: beos interface
3  *****************************************************************************
4  * Copyright (C) 1999, 2000, 2001 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
8  *          Samuel Hocevar <sam@zoy.org>
9  *          Tony Castley <tony@castley.net>
10  *          Richard Shepherd <richard@rshepherd.demon.co.uk>
11  *          Stephan Aßmus <stippi@yellowbites.com>
12  *          Eric Petit <titer@videolan.org>
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
27  *****************************************************************************/
28
29 /*****************************************************************************
30  * Preamble
31  *****************************************************************************/
32 #include <InterfaceKit.h>
33 #include <Application.h>
34 #include <Message.h>
35
36 #ifdef HAVE_CONFIG_H
37 # include "config.h"
38 #endif
39
40 #include <vlc/vlc.h>
41 #include <vlc_interface.h>
42 #include <vlc_aout.h>
43 #include <aout_internal.h>
44
45 #include "InterfaceWindow.h"
46 #include "MsgVals.h"
47
48 /*****************************************************************************
49  * intf_sys_t: internal variables of the BeOS interface
50  *****************************************************************************/
51 struct intf_sys_t
52 {
53     InterfaceWindow * p_window;
54 };
55
56 /*****************************************************************************
57  * Local prototype
58  *****************************************************************************/
59 static void Run       ( intf_thread_t *p_intf );
60
61 /*****************************************************************************
62  * intf_Open: initialize interface
63  *****************************************************************************/
64 int OpenIntf ( vlc_object_t *p_this )
65 {
66     intf_thread_t * p_intf = (intf_thread_t*) p_this;
67
68     /* Allocate instance and initialize some members */
69     p_intf->p_sys = (intf_sys_t*) malloc( sizeof( intf_sys_t ) );
70     if( !p_intf->p_sys )
71     {
72         msg_Err( p_intf, "out of memory" );
73         return VLC_EGENERIC;
74     }
75  
76     p_intf->pf_run = Run;
77
78     /* Create the interface window */
79     BScreen screen( B_MAIN_SCREEN_ID );
80     BRect rect   = screen.Frame();
81     rect.top     = rect.bottom - 100;
82     rect.bottom -= 50;
83     rect.left   += 50;
84     rect.right   = rect.left + 350;
85     p_intf->p_sys->p_window =
86         new InterfaceWindow( p_intf, rect, "VLC " VERSION );
87     if( !p_intf->p_sys->p_window )
88     {
89         free( p_intf->p_sys );
90         msg_Err( p_intf, "cannot allocate InterfaceWindow" );
91         return VLC_EGENERIC;
92     }
93
94     /* Make the be_app aware the interface has been created */
95     BMessage message( INTERFACE_CREATED );
96     message.AddPointer( "window", p_intf->p_sys->p_window );
97     be_app->PostMessage( &message );
98
99     return VLC_SUCCESS;
100 }
101
102 /*****************************************************************************
103  * intf_Close: destroy dummy interface
104  *****************************************************************************/
105 void CloseIntf ( vlc_object_t *p_this )
106 {
107     intf_thread_t *p_intf = (intf_thread_t*) p_this;
108
109     /* Destroy the interface window */
110     if( p_intf->p_sys->p_window->Lock() )
111         p_intf->p_sys->p_window->Quit();
112
113     /* Destroy structure */
114     free( p_intf->p_sys );
115 }
116
117
118 /*****************************************************************************
119  * intf_Run: event loop
120  *****************************************************************************/
121 static void Run( intf_thread_t *p_intf )
122 {
123     while( !intf_ShouldDie( p_intf ) )
124     {
125         p_intf->p_sys->p_window->UpdateInterface();
126         msleep( INTF_IDLE_SLEEP );
127     }
128 }