From d5f52eba6699b9d4fe72a1cf3c8560dedd61cef8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Teuli=C3=A8re?= Date: Sun, 15 Dec 2002 18:37:39 +0000 Subject: [PATCH] * ./modules/gui/wxwindows: added a log window --- modules/gui/wxwindows/Modules.am | 1 + modules/gui/wxwindows/interface.cpp | 17 ++++++++++--- modules/gui/wxwindows/timer.cpp | 13 +++------- modules/gui/wxwindows/wxwindows.cpp | 11 +++++--- modules/gui/wxwindows/wxwindows.h | 39 ++++++++++++++++++++++++++--- 5 files changed, 60 insertions(+), 21 deletions(-) diff --git a/modules/gui/wxwindows/Modules.am b/modules/gui/wxwindows/Modules.am index bb070aacf8..81f03320f9 100644 --- a/modules/gui/wxwindows/Modules.am +++ b/modules/gui/wxwindows/Modules.am @@ -2,6 +2,7 @@ SOURCES_wxwindows = \ modules/gui/wxwindows/wxwindows.cpp \ modules/gui/wxwindows/wxwindows.h \ modules/gui/wxwindows/interface.cpp \ + modules/gui/wxwindows/messages.cpp \ modules/gui/wxwindows/playlist.cpp \ modules/gui/wxwindows/popup.cpp \ modules/gui/wxwindows/timer.cpp \ diff --git a/modules/gui/wxwindows/interface.cpp b/modules/gui/wxwindows/interface.cpp index 2b0b4fa87a..bd3856f3b0 100644 --- a/modules/gui/wxwindows/interface.cpp +++ b/modules/gui/wxwindows/interface.cpp @@ -2,7 +2,7 @@ * interface.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: interface.cpp,v 1.10 2002/12/08 19:56:04 gbazin Exp $ + * $Id: interface.cpp,v 1.11 2002/12/15 18:37:39 ipkiss Exp $ * * Authors: Gildas Bazin * @@ -10,7 +10,7 @@ * 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 @@ -109,6 +109,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame) EVT_MENU(Exit_Event, Interface::OnExit) EVT_MENU(About_Event, Interface::OnAbout) EVT_MENU(Playlist_Event, Interface::OnPlaylist) + EVT_MENU(Logs_Event, Interface::OnLogs) EVT_MENU(OpenFile_Event, Interface::OnOpenFile) /* Toolbar events */ EVT_MENU(OpenFile_Event, Interface::OnOpenFile) @@ -147,7 +148,7 @@ Interface::Interface( intf_thread_t *_p_intf ): /* Creation of the slider sub-window */ CreateOurSlider(); - /* Creation of the status bar + /* Creation of the status bar * Helptext for menu items and toolbar tools will automatically get * displayed here. */ int i_status_width[2] = {-2,-3}; @@ -347,6 +348,16 @@ void Interface::OnPlaylist( wxCommandEvent& WXUNUSED(event) ) } } +void Interface::OnLogs( wxCommandEvent& WXUNUSED(event) ) +{ + /* Show/hide the log window */ + wxFrame *p_messages_window = p_intf->p_sys->p_messages_window; + if( p_messages_window ) + { + p_messages_window->Show( ! p_messages_window->IsShown() ); + } +} + void Interface::OnOpenFile( wxCommandEvent& WXUNUSED(event) ) { wxFileDialog dialog( this, _("Open file"), _(""), _(""), _("*.*") ); diff --git a/modules/gui/wxwindows/timer.cpp b/modules/gui/wxwindows/timer.cpp index bda95c99bf..ae3f4331eb 100644 --- a/modules/gui/wxwindows/timer.cpp +++ b/modules/gui/wxwindows/timer.cpp @@ -2,7 +2,7 @@ * timer.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: timer.cpp,v 1.6 2002/12/13 01:50:32 gbazin Exp $ + * $Id: timer.cpp,v 1.7 2002/12/15 18:37:39 ipkiss Exp $ * * Authors: Gildas Bazin * @@ -10,7 +10,7 @@ * 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 @@ -109,14 +109,7 @@ void Timer::Notify() } /* Update the log window */ - vlc_mutex_lock( p_intf->p_sys->p_sub->p_lock ); - i_stop = *p_intf->p_sys->p_sub->pi_stop; - vlc_mutex_unlock( p_intf->p_sys->p_sub->p_lock ); - - if( p_intf->p_sys->p_sub->i_start != i_stop ) - { - /* Append all messages to log window */ - } + p_intf->p_sys->p_messages_window->UpdateLog(); /* Update the playlist */ p_intf->p_sys->p_playlist_window->Manage(); diff --git a/modules/gui/wxwindows/wxwindows.cpp b/modules/gui/wxwindows/wxwindows.cpp index ed2d351fc7..950d8e9297 100644 --- a/modules/gui/wxwindows/wxwindows.cpp +++ b/modules/gui/wxwindows/wxwindows.cpp @@ -2,7 +2,7 @@ * wxwindows.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: wxwindows.cpp,v 1.8 2002/12/13 01:50:32 gbazin Exp $ + * $Id: wxwindows.cpp,v 1.9 2002/12/15 18:37:39 ipkiss Exp $ * * Authors: Gildas Bazin * @@ -10,7 +10,7 @@ * 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 @@ -198,10 +198,13 @@ bool Instance::OnInit() /* Create the playlist window */ p_intf->p_sys->p_playlist_window = new Playlist( p_intf, MainInterface ); + /* Create the log window */ + p_intf->p_sys->p_messages_window = new Messages( p_intf, MainInterface ); + /* Show the interface */ - MainInterface->Show(TRUE); + MainInterface->Show( TRUE ); - SetTopWindow(MainInterface); + SetTopWindow( MainInterface ); /* Start timer */ new Timer( p_intf, MainInterface ); diff --git a/modules/gui/wxwindows/wxwindows.h b/modules/gui/wxwindows/wxwindows.h index 73d9ba8c50..54a54eda4d 100644 --- a/modules/gui/wxwindows/wxwindows.h +++ b/modules/gui/wxwindows/wxwindows.h @@ -2,7 +2,7 @@ * wxwindows.h: private wxWindows interface description ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: wxwindows.h,v 1.5 2002/12/13 01:50:32 gbazin Exp $ + * $Id: wxwindows.h,v 1.6 2002/12/15 18:37:39 ipkiss Exp $ * * Authors: Gildas Bazin * @@ -10,7 +10,7 @@ * 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 @@ -22,9 +22,11 @@ *****************************************************************************/ #include +#include #include class Playlist; +class Messages; #define SLIDER_MAX_POS 10000 @@ -38,6 +40,7 @@ struct intf_sys_t /* secondary windows */ Playlist *p_playlist_window; + Messages *p_messages_window; /* special actions */ vlc_bool_t b_playing; @@ -47,7 +50,7 @@ struct intf_sys_t vlc_bool_t b_slider_free; /* slider status */ /* menus handlers */ - vlc_bool_t b_program_update; /* do we need to update programs + vlc_bool_t b_program_update; /* do we need to update programs menu */ vlc_bool_t b_title_update; /* do we need to update title menus */ vlc_bool_t b_chapter_update; /* do we need to update @@ -121,7 +124,9 @@ private: /* Event handlers (these functions should _not_ be virtual) */ void OnExit( wxCommandEvent& event ); void OnAbout( wxCommandEvent& event ); + void OnMessages( wxCommandEvent& event ); void OnPlaylist( wxCommandEvent& event ); + void OnLogs( wxCommandEvent& event ); void OnOpenFile( wxCommandEvent& event ); void OnPlayStream( wxCommandEvent& event ); void OnStopStream( wxCommandEvent& event ); @@ -136,6 +141,31 @@ private: intf_thread_t *p_intf; }; +/* Messages */ +class Messages: public wxFrame +{ +public: + /* Constructor */ + Messages( intf_thread_t *p_intf, Interface *_p_main_interface ); + virtual ~Messages(); + void UpdateLog(); + +private: + /* Event handlers (these functions should _not_ be virtual) */ + void OnClose( wxCommandEvent& event ); + + DECLARE_EVENT_TABLE(); + + intf_thread_t *p_intf; + Interface *p_main_interface; + wxButton *ok_button; + wxTextCtrl *textctrl; + wxTextAttr *info_attr; + wxTextAttr *err_attr; + wxTextAttr *warn_attr; + wxTextAttr *dbg_attr; +}; + /* Playlist */ class Playlist: public wxFrame { @@ -147,6 +177,8 @@ public: void Manage(); private: + void DeleteItem( int item ); + /* Event handlers (these functions should _not_ be virtual) */ void OnAddUrl( wxCommandEvent& event ); void OnAddDirectory( wxCommandEvent& event ); @@ -159,7 +191,6 @@ private: DECLARE_EVENT_TABLE(); - void DeleteItem( int item ); intf_thread_t *p_intf; Interface *p_main_interface; wxListView *listview; -- 2.39.5