/*****************************************************************************
- * playlist.cpp : wxWindows plugin for vlc
+ * messages.cpp : wxWindows plugin for vlc
*****************************************************************************
- * Copyright (C) 2000-2001 VideoLAN
- * $Id: messages.cpp,v 1.12 2003/07/12 13:33:10 gbazin Exp $
+ * Copyright (C) 2000-2004 VideoLAN
+ * $Id: messages.cpp,v 1.20 2004/01/25 03:29:01 hartman Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
*
#include <stdio.h>
#include <vlc/vlc.h>
-
-#ifdef WIN32 /* mingw32 hack */
-#undef Yield
-#undef CreateDialog
-#endif
-
-/* Let vlc take care of the i18n stuff */
-#define WXINTL_NO_GETTEXT_MACRO
-
-#include <wx/wxprec.h>
-#include <wx/wx.h>
-#include <wx/textctrl.h>
-
#include <vlc/intf.h>
-#if defined MODULE_NAME_IS_skins
-# include "../skins/src/skin_common.h"
-#endif
-
#include "wxwindows.h"
/*****************************************************************************
enum
{
Close_Event,
- Verbose_Event,
Clear_Event,
Save_Log_Event
};
BEGIN_EVENT_TABLE(Messages, wxFrame)
/* Button events */
EVT_BUTTON(wxID_OK, Messages::OnClose)
- EVT_CHECKBOX(Verbose_Event, Messages::OnVerbose)
EVT_BUTTON(wxID_CLEAR, Messages::OnClear)
EVT_BUTTON(wxID_SAVEAS, Messages::OnSaveLog)
{
/* Initializations */
p_intf = _p_intf;
+ b_verbose = VLC_FALSE;
SetIcon( *p_intf->p_sys->p_icon );
save_log_dialog = NULL;
+ b_verbose = VLC_FALSE;
/* Create a panel to put everything in */
wxPanel *messages_panel = new wxPanel( this, -1 );
wxU(_("Save As...")));
save_log_button->SetDefault();
- /* Create the Verbose checkbox */
- wxCheckBox *verbose_checkbox =
- new wxCheckBox( messages_panel, Verbose_Event, wxU(_("Verbose")) );
- b_verbose = p_intf->p_libvlc->i_verbose > 0;
- verbose_checkbox->SetValue( b_verbose );
-
/* Place everything in sizers */
wxBoxSizer *buttons_sizer = new wxBoxSizer( wxHORIZONTAL );
buttons_sizer->Add( ok_button, 0, wxEXPAND |wxALIGN_LEFT| wxALL, 5 );
buttons_sizer->Add( clear_button, 0, wxEXPAND |wxALIGN_LEFT| wxALL, 5 );
buttons_sizer->Add( save_log_button, 0, wxEXPAND |wxALIGN_LEFT| wxALL, 5 );
buttons_sizer->Add( new wxPanel( this, -1 ), 1, wxALL, 5 );
- buttons_sizer->Add( verbose_checkbox, 0, wxEXPAND|wxALIGN_RIGHT|wxALL, 5 );
buttons_sizer->Layout();
wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer *panel_sizer = new wxBoxSizer( wxVERTICAL );
Messages::~Messages()
{
-/* Clean up */
+ /* Clean up */
if( save_log_dialog ) delete save_log_dialog;
+
+ delete info_attr;
+ delete err_attr;
+ delete warn_attr;
+ delete dbg_attr;
+}
+
+bool Messages::Show( bool show )
+{
+ b_verbose = show;
+ return wxFrame::Show( show );
}
void Messages::UpdateLog()
{
if( !b_verbose &&
- VLC_MSG_ERR != p_sub->p_msg[i_start].i_type &&
- VLC_MSG_INFO != p_sub->p_msg[i_start].i_type )
+ VLC_MSG_ERR != p_sub->p_msg[i_start].i_type )
continue;
/* Append all messages to log window */
textctrl->SetDefaultStyle( *dbg_attr );
- (*textctrl) << wxU(p_sub->p_msg[i_start].psz_module);
+ (*textctrl) << wxL2U(p_sub->p_msg[i_start].psz_module);
switch( p_sub->p_msg[i_start].i_type )
{
}
/* Add message */
- (*textctrl) << wxU(p_sub->p_msg[i_start].psz_msg) << wxT("\n");
+ (*textctrl) << wxL2U(p_sub->p_msg[i_start].psz_msg) << wxT("\n");
}
vlc_mutex_lock( p_sub->p_lock );
{
if( save_log_dialog == NULL )
save_log_dialog = new wxFileDialog( this,
- wxU(_("Save Messages As a file...")),
+ wxU(_("Save Messages As...")),
wxT(""), wxT("messages"), wxT("*"), wxSAVE | wxOVERWRITE_PROMPT );
-
+
if( save_log_dialog && save_log_dialog->ShowModal() == wxID_OK )
{
if( !textctrl->SaveFile( save_log_dialog->GetPath() ) )
}
}
}
-
-void Messages::OnVerbose( wxCommandEvent& event )
-{
- b_verbose = event.IsChecked();
-}