Commit 02d360bd authored by Eric Petit's avatar Eric Petit

Added a window to see vlc messages.

parent 160a693d
......@@ -2,7 +2,7 @@
* beos.cpp : BeOS plugin for vlc
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: BeOS.cpp,v 1.3 2003/01/25 01:03:44 titer Exp $
* $Id: BeOS.cpp,v 1.4 2003/01/25 20:15:41 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -59,6 +59,7 @@ vlc_module_begin();
add_integer( "beos-playlist-xpos", 0, NULL, "", "" );
add_integer( "beos-playlist-ypos", 0, NULL, "", "" );
add_bool( "beos-playlist-show", 0, NULL, "", "" );
add_bool( "beos-messages-show", 0, NULL, "", "" );
add_submodule();
set_capability( "video output", 100 );
set_callbacks( E_(OpenVideo), E_(CloseVideo) );
......
......@@ -2,7 +2,7 @@
* intf_beos.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: Interface.cpp,v 1.7 2002/12/09 13:37:38 titer Exp $
* $Id: Interface.cpp,v 1.8 2003/01/25 20:15:41 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -55,15 +55,7 @@ static void Run ( intf_thread_t *p_intf );
*****************************************************************************/
int E_(OpenIntf) ( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t*) p_this;
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;
intf_thread_t * p_intf = (intf_thread_t*) p_this;
/* Allocate instance and initialize some members */
p_intf->p_sys = (intf_sys_t*) malloc( sizeof( intf_sys_t ) );
......@@ -73,11 +65,19 @@ int E_(OpenIntf) ( vlc_object_t *p_this )
return( 1 );
}
p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
p_intf->p_sys->p_wrapper = new VlcWrapper( p_intf );
p_intf->pf_run = Run;
/* Create the interface window */
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;
p_intf->p_sys->p_window =
new InterfaceWindow( rect,
VOUT_TITLE " (BeOS interface)", p_intf );
......@@ -105,6 +105,8 @@ void E_(CloseIntf) ( vlc_object_t *p_this )
{
intf_thread_t *p_intf = (intf_thread_t*) p_this;
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
/* Destroy the interface window */
p_intf->p_sys->p_window->Lock();
p_intf->p_sys->p_window->Quit();
......@@ -125,7 +127,7 @@ static void Run( intf_thread_t *p_intf )
if( p_intf->p_sys->p_wrapper->UpdateInputAndAOut() )
{
/* Manage the slider */
p_intf->p_sys->p_window->updateInterface();
p_intf->p_sys->p_window->UpdateInterface();
}
/* Wait a bit */
......
......@@ -2,7 +2,7 @@
* InterfaceWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.cpp,v 1.21 2003/01/25 01:03:44 titer Exp $
* $Id: InterfaceWindow.cpp,v 1.22 2003/01/25 20:15:41 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -48,6 +48,7 @@
#include "MediaControlView.h"
#include "PlayListWindow.h"
#include "PreferencesWindow.h"
#include "MessagesWindow.h"
#include "InterfaceWindow.h"
#define INTERFACE_UPDATE_TIMEOUT 80000 // 2 frames if at 25 fps
......@@ -72,10 +73,6 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
fPlaylistIsEmpty = !( p_wrapper->PlaylistSize() > 0 );
fPlaylistWindow = new PlayListWindow( BRect( 100.0, 100.0, 400.0, 350.0 ),
"Playlist",
this,
p_intf );
BScreen *p_screen = new BScreen();
BRect screen_rect = p_screen->Frame();
delete p_screen;
......@@ -84,9 +81,17 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
( screen_rect.bottom - PREFS_WINDOW_HEIGHT ) / 2,
( screen_rect.right + PREFS_WINDOW_WIDTH ) / 2,
( screen_rect.bottom + PREFS_WINDOW_HEIGHT ) / 2 );
fPreferencesWindow = new PreferencesWindow( window_rect,
"Preferences",
p_intf );
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 );
fPlaylistWindow = new PlayListWindow( window_rect, "Playlist", this, p_intf );
window_rect.Set( screen_rect.right - 500,
screen_rect.top + 300,
screen_rect.right - 150,
screen_rect.top + 600 );
fMessagesWindow = new MessagesWindow( p_intf, window_rect, "Messages" );
// set the title bar
SetName( "interface" );
......@@ -127,10 +132,6 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
fileMenu->AddItem( new BMenuItem( "Load a subtitle file" B_UTF8_ELLIPSIS,
new BMessage( LOAD_SUBFILE ) ) );
fileMenu->AddSeparatorItem();
fileMenu->AddItem( new BMenuItem( "Play List" B_UTF8_ELLIPSIS,
new BMessage( OPEN_PLAYLIST ), 'P') );
fileMenu->AddSeparatorItem();
BMenuItem* item = new BMenuItem( "About" B_UTF8_ELLIPSIS,
new BMessage( B_ABOUT_REQUESTED ), 'A');
......@@ -174,11 +175,15 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
fSpeedMenu->SetTargetForItems( this );
fMenuBar->AddItem( fSpeedMenu );
/* Add the Settings menu */
fSettingsMenu = new BMenu( "Settings" );
fSettingsMenu->AddItem( fPreferencesMI =
new BMenuItem( "Preferences", new BMessage( OPEN_PREFERENCES ) ) );
fMenuBar->AddItem( fSettingsMenu );
/* Add the Show menu */
fShowMenu = new BMenu( "Show" );
fShowMenu->AddItem( new BMenuItem( "Play List" B_UTF8_ELLIPSIS,
new BMessage( OPEN_PLAYLIST ), 'P') );
fShowMenu->AddItem( new BMenuItem( "Messages" B_UTF8_ELLIPSIS,
new BMessage( OPEN_MESSAGES ), 'M' ) );
fShowMenu->AddItem( new BMenuItem( "Settings" B_UTF8_ELLIPSIS,
new BMessage( OPEN_PREFERENCES ), 'S' ) );
fMenuBar->AddItem( fShowMenu );
/* Prepare fow showing */
_SetMenusEnabled( false );
......@@ -214,6 +219,15 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
fPlaylistWindow->Unlock();
}
}
if( config_GetInt( p_intf, "beos-messages-show" ) )
{
/* messages showing */
if( fMessagesWindow->Lock() )
{
fMessagesWindow->Show();
fMessagesWindow->Unlock();
}
}
Show();
}
......@@ -558,6 +572,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
break;
case OPEN_PREFERENCES:
{
if( fPreferencesWindow->Lock() )
{
if (fPreferencesWindow->IsHidden())
......@@ -567,6 +582,20 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
fPreferencesWindow->Unlock();
}
break;
}
case OPEN_MESSAGES:
{
if( fMessagesWindow->Lock() )
{
if (fMessagesWindow->IsHidden())
fMessagesWindow->Show();
else
fMessagesWindow->Activate();
fMessagesWindow->Unlock();
}
break;
}
default:
BWindow::MessageReceived( p_message );
......@@ -599,6 +628,11 @@ bool InterfaceWindow::QuitRequested()
config_PutInt( p_intf, "beos-playlist-show", !fPlaylistWindow->IsHidden() );
fPlaylistWindow->Unlock();
}
if( fMessagesWindow->Lock() )
{
config_PutInt( p_intf, "beos-messages-show", !fMessagesWindow->IsHidden() );
fMessagesWindow->Unlock();
}
config_SaveConfigFile( p_intf, "beos" );
p_intf->b_die = 1;
......@@ -607,9 +641,9 @@ bool InterfaceWindow::QuitRequested()
}
/*****************************************************************************
* InterfaceWindow::updateInterface
* InterfaceWindow::UpdateInterface
*****************************************************************************/
void InterfaceWindow::updateInterface()
void InterfaceWindow::UpdateInterface()
{
if( p_wrapper->HasInput() )
{
......@@ -668,6 +702,8 @@ void InterfaceWindow::updateInterface()
p_wrapper->SetVolume( i_volume );
}
fMessagesWindow->UpdateMessages();
fLastUpdateTime = system_time();
}
......
......@@ -2,7 +2,7 @@
* InterfaceWindow.h: BeOS interface window class prototype
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.h,v 1.9 2003/01/22 01:13:22 titer Exp $
* $Id: InterfaceWindow.h,v 1.10 2003/01/25 20:15:41 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au>
......@@ -35,6 +35,7 @@ class MediaControlView;
class PlayListWindow;
class BFilePanel;
class PreferencesWindow;
class MessagesWindow;
class CDMenu : public BMenu
{
......@@ -102,7 +103,7 @@ class InterfaceWindow : public BWindow
virtual bool QuitRequested();
// InterfaceWindow
void updateInterface();
void UpdateInterface();
bool IsStopped() const;
MediaControlView* p_mediaControl;
......@@ -123,6 +124,7 @@ class InterfaceWindow : public BWindow
BFilePanel* fSubtitlesPanel;
PlayListWindow* fPlaylistWindow;
PreferencesWindow* fPreferencesWindow;
MessagesWindow* fMessagesWindow;
BMenuBar* fMenuBar;
BMenuItem* fNextTitleMI;
BMenuItem* fPrevTitleMI;
......@@ -132,7 +134,6 @@ class InterfaceWindow : public BWindow
BMenuItem* fSlowerMI;
BMenuItem* fNormalMI;
BMenuItem* fFasterMI;
BMenuItem* fPreferencesMI;
BMenu* fAudioMenu;
BMenu* fNavigationMenu;
BMenu* fTitleMenu;
......@@ -140,7 +141,7 @@ class InterfaceWindow : public BWindow
BMenu* fLanguageMenu;
BMenu* fSubtitlesMenu;
BMenu* fSpeedMenu;
BMenu* fSettingsMenu;
BMenu* fShowMenu;
bigtime_t fLastUpdateTime;
VlcWrapper * p_wrapper;
......
/*****************************************************************************
* MessagesWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: MessagesWindow.cpp,v 1.1 2003/01/25 20:15:41 titer Exp $
*
* Authors: Eric Petit <titer@videolan.org>
*
* 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
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* BeOS headers */
#include <InterfaceKit.h>
/* VLC headers */
#include <vlc/vlc.h>
#include <vlc/intf.h>
/* BeOS module headers */
#include "VlcWrapper.h"
#include "MessagesWindow.h"
/*****************************************************************************
* MessagesWindow::MessagesWindow
*****************************************************************************/
MessagesWindow::MessagesWindow( intf_thread_t * p_intf,
BRect frame, const char * name )
: BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_NOT_ZOOMABLE )
{
this->p_intf = p_intf;
p_sub = p_intf->p_sys->p_sub;
BRect rect, rect2;
rect = Bounds();
rect.right -= B_V_SCROLL_BAR_WIDTH;
rect.bottom -= B_H_SCROLL_BAR_HEIGHT;
rect2 = rect;
rect2.InsetBy( 5, 5 );
fMessagesView = new BTextView( rect, "messages", rect2,
B_FOLLOW_ALL, B_WILL_DRAW );
fMessagesView->MakeEditable( false );
fScrollView = new BScrollView( "scrollview", fMessagesView, B_WILL_DRAW,
B_FOLLOW_ALL, true, true );
fScrollBar = fScrollView->ScrollBar( B_VERTICAL );
AddChild( fScrollView );
/* start window thread in hidden state */
Hide();
Show();
}
/*****************************************************************************
* MessagesWindow::~MessagesWindow
*****************************************************************************/
MessagesWindow::~MessagesWindow()
{
}
/*****************************************************************************
* MessagesWindow::QuitRequested
*****************************************************************************/
bool MessagesWindow::QuitRequested()
{
Hide();
return false;
}
/*****************************************************************************
* MessagesWindow::ReallyQuit
*****************************************************************************/
void MessagesWindow::ReallyQuit()
{
Hide();
Quit();
}
/*****************************************************************************
* MessagesWindow::UpdateMessages
*****************************************************************************/
void MessagesWindow::UpdateMessages()
{
int i_start;
vlc_mutex_lock( p_sub->p_lock );
int i_stop = *p_sub->pi_stop;
vlc_mutex_unlock( p_sub->p_lock );
if( p_sub->i_start != i_stop )
{
for( i_start = p_sub->i_start;
i_start != i_stop;
i_start = (i_start+1) % VLC_MSG_QSIZE )
{
/* Append all messages to log window */
/* textctrl->SetDefaultStyle( *dbg_attr );
(*textctrl) << p_sub->p_msg[i_start].psz_module; */
/* switch( p_sub->p_msg[i_start].i_type )
{
case VLC_MSG_INFO:
(*textctrl) << ": ";
textctrl->SetDefaultStyle( *info_attr );
break;
case VLC_MSG_ERR:
(*textctrl) << " error: ";
textctrl->SetDefaultStyle( *err_attr );
break;
case VLC_MSG_WARN:
(*textctrl) << " warning: ";
textctrl->SetDefaultStyle( *warn_attr );
break;
case VLC_MSG_DBG:
default:
(*textctrl) << " debug: ";
break;
} */
/* Add message */
fMessagesView->LockLooper();
fMessagesView->Insert( p_sub->p_msg[i_start].psz_msg );
fMessagesView->Insert( "\n" );
fMessagesView->UnlockLooper();
/* Scroll at the end */
fScrollBar->LockLooper();
float min, max;
fScrollBar->GetRange( &min, &max );
fScrollBar->SetValue( max );
fScrollBar->UnlockLooper();
}
vlc_mutex_lock( p_sub->p_lock );
p_sub->i_start = i_start;
vlc_mutex_unlock( p_sub->p_lock );
}
}
/*****************************************************************************
* MessagesWindow.h
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: MessagesWindow.h,v 1.1 2003/01/25 20:15:41 titer Exp $
*
* Authors: Eric Petit <titer@videolan.org>
*
* 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
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifndef BEOS_MESSAGES_WINDOW_H
#define BEOS_MESSAGES_WINDOW_H
#include <Window.h>
class MessagesWindow : public BWindow
{
public:
MessagesWindow( intf_thread_t * p_intf,
BRect frame, const char * name );
virtual ~MessagesWindow();
virtual bool QuitRequested();
void ReallyQuit();
void UpdateMessages();
private:
intf_thread_t * p_intf;
msg_subscription_t * p_sub;
BView * fBackgroundView;
BTextView * fMessagesView;
BScrollView * fScrollView;
BScrollBar * fScrollBar;
};
#endif // BEOS_PREFERENCES_WINDOW_H
......@@ -15,6 +15,8 @@ SOURCES_beos = \
modules/gui/beos/PlayListWindow.h \
modules/gui/beos/PreferencesWindow.cpp \
modules/gui/beos/PreferencesWindow.h \
modules/gui/beos/MessagesWindow.cpp \
modules/gui/beos/MessagesWindow.h \
modules/gui/beos/MediaControlView.cpp \
modules/gui/beos/MediaControlView.h \
modules/gui/beos/VlcWrapper.cpp \
......
......@@ -2,7 +2,7 @@
* MsgVals.h
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: MsgVals.h,v 1.4 2003/01/14 14:48:55 titer Exp $
* $Id: MsgVals.h,v 1.5 2003/01/25 20:15:41 titer Exp $
*
* Authors: Tony Castley <tcastley@mail.powerup.com.au>
* Stephan Aßmus <stippi@yellowbites.com>
......@@ -55,6 +55,7 @@ const uint32 NEXT_FILE = 'nxfl';
const uint32 NAVIGATE_PREV = 'navp'; // could be chapter, title or file
const uint32 NAVIGATE_NEXT = 'navn'; // could be chapter, title or file
const uint32 OPEN_PREFERENCES = 'pref';
const uint32 OPEN_MESSAGES = 'mess';
const uint32 TOGGLE_ON_TOP = 'ontp';
const uint32 TOGGLE_FULL_SCREEN = 'tgfs';
const uint32 RESIZE_50 = 'rshl';
......
......@@ -2,7 +2,7 @@
* PreferencesWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.cpp,v 1.8 2003/01/17 18:19:43 titer Exp $
* $Id: PreferencesWindow.cpp,v 1.9 2003/01/25 20:15:41 titer Exp $
*
* Authors: Eric Petit <titer@videolan.org>
*
......@@ -37,12 +37,12 @@
/*****************************************************************************
* Preferences::PreferencesWindow
*****************************************************************************/
PreferencesWindow::PreferencesWindow( BRect frame, const char* name,
intf_thread_t *p_interface )
PreferencesWindow::PreferencesWindow( intf_thread_t * p_intf,
BRect frame, const char * name )
: BWindow( frame, name, B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NOT_CLOSABLE )
{
p_intf = p_interface;
this->p_intf = p_intf;
BRect rect;
/* "background" view */
......@@ -132,8 +132,6 @@ PreferencesWindow::PreferencesWindow( BRect frame, const char* name,
rect.top = rect.bottom - 10;
fRestartString = new BStringView( rect, NULL,
"Warning: changing settings after starting playback may have no effect." );
/*rgb_color redColor = {255, 0, 0, 255};
fRestartString->SetHighColor(redColor);*/
fRestartString->SetAlignment( B_ALIGN_CENTER );
fPrefsView->AddChild( fRestartString );
......
......@@ -2,7 +2,7 @@
* PreferencesWindow.h
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: PreferencesWindow.h,v 1.6 2003/01/17 18:19:43 titer Exp $
* $Id: PreferencesWindow.h,v 1.7 2003/01/25 20:15:41 titer Exp $
*
* Authors: Eric Petit <titer@videolan.org>
*
......@@ -38,9 +38,9 @@
class PreferencesWindow : public BWindow
{
public:
PreferencesWindow( BRect frame,
const char* name,
intf_thread_t *p_interface );
PreferencesWindow( intf_thread_t * p_intf,
BRect frame,
const char * name );
virtual ~PreferencesWindow();
virtual void MessageReceived(BMessage *message);
void ReallyQuit();
......
......@@ -2,7 +2,7 @@
* VlcWrapper.h: BeOS plugin for vlc (derived from MacOS X port)
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: VlcWrapper.h,v 1.15 2003/01/22 01:13:22 titer Exp $
* $Id: VlcWrapper.h,v 1.16 2003/01/25 20:15:41 titer Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
......@@ -35,6 +35,8 @@ class VlcWrapper;
*****************************************************************************/
struct intf_sys_t
{
msg_subscription_t * p_sub;
InterfaceWindow * p_window;
vlc_bool_t b_loop;
......
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