-InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
- intf_thread_t *p_interface )
- : BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
- B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK
- | B_ASYNCHRONOUS_CONTROLS )
-{
- file_panel = NULL;
- playlist_window = NULL;
- p_intf = p_interface;
- p_vlc_wrapper = Intf_VLCWrapper::getVLCWrapper(p_intf);
- BRect controlRect(0,0,0,0);
-
- playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
- FIND_ANYWHERE );
- b_empty_playlist = (p_playlist->i_size < 0);
- b_mute = false;
-
- /* set the title bar */
- SetName( "interface" );
- SetTitle(VOUT_TITLE);
-
- /* set up the main menu */
- BMenuBar *menu_bar;
- menu_bar = new BMenuBar(controlRect, "main menu");
- AddChild( menu_bar );
-
- BMenu *mFile;
- BMenu *mAudio;
- CDMenu *cd_menu;
- BMenu *mNavigation;
-
- /* Add the file Menu */
- BMenuItem *mItem;
- menu_bar->AddItem( mFile = new BMenu( "File" ) );
- menu_bar->ResizeToPreferred();
- mFile->AddItem( mItem = new BMenuItem( "Open File" B_UTF8_ELLIPSIS,
- new BMessage(OPEN_FILE), 'O') );
-
- cd_menu = new CDMenu( "Open Disc" );
- mFile->AddItem( cd_menu );
-
- mFile->AddSeparatorItem();
- mFile->AddItem( mItem = new BMenuItem( "Play List" B_UTF8_ELLIPSIS,
- new BMessage(OPEN_PLAYLIST), 'P') );
-
- mFile->AddSeparatorItem();
- mFile->AddItem( mItem = new BMenuItem( "About" B_UTF8_ELLIPSIS,
- new BMessage(B_ABOUT_REQUESTED), 'A') );
- mItem->SetTarget( be_app );
- mFile->AddItem(mItem = new BMenuItem( "Quit",
- new BMessage(B_QUIT_REQUESTED), 'Q') );
+InterfaceWindow::InterfaceWindow( intf_thread_t * _p_intf, BRect frame,
+ const char * name )
+ : BWindow( frame, name, B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
+ B_NOT_ZOOMABLE | B_WILL_ACCEPT_FIRST_CLICK | B_ASYNCHRONOUS_CONTROLS ),
+
+ /* Initializations */
+ p_intf( _p_intf ),
+ p_input( NULL ),
+ p_playlist( NULL ),
+
+ fFilePanel( NULL ),
+ fLastUpdateTime( system_time() ),
+ fSettings( new BMessage( 'sett' ) )
+{
+ p_playlist = pl_Yield( p_intf );
+
+ var_AddCallback( p_playlist, "intf-change", PlaylistChanged, this );
+ var_AddCallback( p_playlist, "item-change", PlaylistChanged, this );
+ var_AddCallback( p_playlist, "item-append", PlaylistChanged, this );
+ var_AddCallback( p_playlist, "item-deleted", PlaylistChanged, this );
+ var_AddCallback( p_playlist, "playlist-current", PlaylistChanged, this );
+
+ char psz_tmp[1024];
+#define ADD_ELLIPSIS( a ) \
+ memset( psz_tmp, 0, 1024 ); \
+ snprintf( psz_tmp, 1024, "%s%s", a, B_UTF8_ELLIPSIS );
+
+ BScreen screen;
+ BRect screen_rect = screen.Frame();
+ BRect window_rect;
+ window_rect.Set( ( screen_rect.right - PREFS_WINDOW_WIDTH ) / 2,
+ ( screen_rect.bottom - PREFS_WINDOW_HEIGHT ) / 2,
+ ( screen_rect.right + PREFS_WINDOW_WIDTH ) / 2,
+ ( screen_rect.bottom + PREFS_WINDOW_HEIGHT ) / 2 );
+ fPreferencesWindow = new PreferencesWindow( p_intf, window_rect, _("Preferences") );
+ window_rect.Set( screen_rect.right - 500,
+ screen_rect.top + 50,
+ screen_rect.right - 150,
+ screen_rect.top + 250 );
+#if 0
+ fPlaylistWindow = new PlayListWindow( window_rect, _("Playlist"), this, p_intf );
+ window_rect.Set( screen_rect.right - 550,
+ screen_rect.top + 300,
+ screen_rect.right - 150,
+ screen_rect.top + 500 );
+#endif
+ fMessagesWindow = new MessagesWindow( p_intf, window_rect, _("Messages") );
+
+ // the media control view
+ p_mediaControl = new MediaControlView( p_intf, BRect( 0.0, 0.0, 250.0, 50.0 ) );
+ p_mediaControl->SetViewColor( ui_color( B_PANEL_BACKGROUND_COLOR ) );
+
+ float width, height;
+ p_mediaControl->GetPreferredSize( &width, &height );
+
+ // set up the main menu
+ fMenuBar = new BMenuBar( BRect(0.0, 0.0, width, 15.0), "main menu",
+ B_FOLLOW_NONE, B_ITEMS_IN_ROW, false );
+
+ // make menu bar resize to correct height
+ float menuWidth, menuHeight;
+ fMenuBar->GetPreferredSize( &menuWidth, &menuHeight );
+ fMenuBar->ResizeTo( width, menuHeight ); // don't change! it's a workarround!
+ // take care of proper size for ourself
+ height += fMenuBar->Bounds().Height();
+ ResizeTo( width, height );
+
+ p_mediaControl->MoveTo( fMenuBar->Bounds().LeftBottom() + BPoint(0.0, 1.0) );
+ AddChild( fMenuBar );
+
+
+ // Add the file Menu
+ BMenu* fileMenu = new BMenu( _("File") );
+ fMenuBar->AddItem( fileMenu );
+ ADD_ELLIPSIS( _("Open File") );
+ fileMenu->AddItem( new BMenuItem( psz_tmp, new BMessage( OPEN_FILE ), 'O') );
+ fileMenu->AddItem( new CDMenu( _("Open Disc") ) );
+ ADD_ELLIPSIS( _("Open Subtitles") );
+ fileMenu->AddItem( new BMenuItem( psz_tmp, new BMessage( LOAD_SUBFILE ) ) );
+
+ fileMenu->AddSeparatorItem();
+ ADD_ELLIPSIS( _("About") );
+ BMenuItem* item = new BMenuItem( psz_tmp, new BMessage( B_ABOUT_REQUESTED ), 'A');
+ item->SetTarget( be_app );
+ fileMenu->AddItem( item );
+ fileMenu->AddItem( new BMenuItem( _("Quit"), new BMessage( B_QUIT_REQUESTED ), 'Q') );
+
+ fLanguageMenu = new LanguageMenu( p_intf, _("Language"), "audio-es" );
+ fSubtitlesMenu = new LanguageMenu( p_intf, _("Subtitles"), "spu-es" );