now messages can be saved to a file

parent d812e05e
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.cpp : wxWindows plugin for vlc * playlist.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: messages.cpp,v 1.9 2003/07/09 10:59:11 adn Exp $ * $Id: messages.cpp,v 1.10 2003/07/10 11:15:18 adn Exp $
* *
* Authors: Olivier Teulire <ipkiss@via.ecp.fr> * Authors: Olivier Teulire <ipkiss@via.ecp.fr>
* *
...@@ -59,7 +59,9 @@ ...@@ -59,7 +59,9 @@
enum enum
{ {
Close_Event, Close_Event,
Verbose_Event Verbose_Event,
Clear_Event,
Save_Log_Event
}; };
BEGIN_EVENT_TABLE(Messages, wxFrame) BEGIN_EVENT_TABLE(Messages, wxFrame)
...@@ -67,6 +69,7 @@ BEGIN_EVENT_TABLE(Messages, wxFrame) ...@@ -67,6 +69,7 @@ BEGIN_EVENT_TABLE(Messages, wxFrame)
EVT_BUTTON(wxID_OK, Messages::OnClose) EVT_BUTTON(wxID_OK, Messages::OnClose)
EVT_CHECKBOX(Verbose_Event, Messages::OnVerbose) EVT_CHECKBOX(Verbose_Event, Messages::OnVerbose)
EVT_BUTTON(wxID_CLEAR, Messages::OnClear) EVT_BUTTON(wxID_CLEAR, Messages::OnClear)
EVT_BUTTON(wxID_SAVEAS, Messages::OnSaveLog)
/* Special events : we don't want to destroy the window when the user /* Special events : we don't want to destroy the window when the user
* clicks on (X) */ * clicks on (X) */
...@@ -84,6 +87,7 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ): ...@@ -84,6 +87,7 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ):
p_intf = _p_intf; p_intf = _p_intf;
b_verbose = VLC_FALSE; b_verbose = VLC_FALSE;
SetIcon( *p_intf->p_sys->p_icon ); SetIcon( *p_intf->p_sys->p_icon );
save_log_dialog = NULL;
/* Create a panel to put everything in */ /* Create a panel to put everything in */
wxPanel *messages_panel = new wxPanel( this, -1 ); wxPanel *messages_panel = new wxPanel( this, -1 );
...@@ -106,6 +110,10 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ): ...@@ -106,6 +110,10 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ):
wxButton *clear_button = new wxButton( messages_panel, wxID_CLEAR, wxU(_("Clear"))); wxButton *clear_button = new wxButton( messages_panel, wxID_CLEAR, wxU(_("Clear")));
clear_button->SetDefault(); clear_button->SetDefault();
/* Create the Save Log button */
wxButton *save_log_button = new wxButton( messages_panel, wxID_SAVEAS, wxU(_("Save As...")));
save_log_button->SetDefault();
/* Create the Verbose checkbox */ /* Create the Verbose checkbox */
wxCheckBox *verbose_checkbox = wxCheckBox *verbose_checkbox =
new wxCheckBox( messages_panel, Verbose_Event, wxU(_("Verbose")) ); new wxCheckBox( messages_panel, Verbose_Event, wxU(_("Verbose")) );
...@@ -114,6 +122,7 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ): ...@@ -114,6 +122,7 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ):
wxBoxSizer *buttons_sizer = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *buttons_sizer = new wxBoxSizer( wxHORIZONTAL );
buttons_sizer->Add( ok_button, 0, wxEXPAND |wxALIGN_LEFT| wxALL, 5 ); 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( 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( new wxPanel( this, -1 ), 1, wxALL, 5 );
buttons_sizer->Add( verbose_checkbox, 0, wxEXPAND |wxALIGN_RIGHT | wxALL, 5 ); buttons_sizer->Add( verbose_checkbox, 0, wxEXPAND |wxALIGN_RIGHT | wxALL, 5 );
buttons_sizer->Layout(); buttons_sizer->Layout();
...@@ -130,6 +139,8 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ): ...@@ -130,6 +139,8 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ):
Messages::~Messages() Messages::~Messages()
{ {
/* Clean up */
if( save_log_dialog ) delete save_log_dialog;
} }
void Messages::UpdateLog() void Messages::UpdateLog()
...@@ -200,6 +211,21 @@ void Messages::OnClear( wxCommandEvent& WXUNUSED(event) ) ...@@ -200,6 +211,21 @@ void Messages::OnClear( wxCommandEvent& WXUNUSED(event) )
textctrl->Clear(); textctrl->Clear();
} }
void Messages::OnSaveLog( wxCommandEvent& WXUNUSED(event) )
{
if( save_log_dialog == NULL )
save_log_dialog = new wxFileDialog( this, wxU(_("Save Messages As a file...")),
wxT(""), wxT("messages"), wxT("*"), wxSAVE | wxOVERWRITE_PROMPT );
if( save_log_dialog && save_log_dialog->ShowModal() == wxID_OK )
{
if( !textctrl->SaveFile( save_log_dialog->GetPath() ) )
{
// [FIX ME] should print an error message
}
}
}
void Messages::OnVerbose( wxCommandEvent& event ) void Messages::OnVerbose( wxCommandEvent& event )
{ {
b_verbose = event.IsChecked(); b_verbose = event.IsChecked();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description * wxwindows.h: private wxWindows interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: wxwindows.h,v 1.39 2003/07/09 09:30:23 adn Exp $ * $Id: wxwindows.h,v 1.40 2003/07/10 11:15:18 adn Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -434,6 +434,7 @@ private: ...@@ -434,6 +434,7 @@ private:
void OnClose( wxCommandEvent& event ); void OnClose( wxCommandEvent& event );
void OnVerbose( wxCommandEvent& event ); void OnVerbose( wxCommandEvent& event );
void OnClear( wxCommandEvent& event ); void OnClear( wxCommandEvent& event );
void OnSaveLog( wxCommandEvent& event );
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
...@@ -444,6 +445,8 @@ private: ...@@ -444,6 +445,8 @@ private:
wxTextAttr *warn_attr; wxTextAttr *warn_attr;
wxTextAttr *dbg_attr; wxTextAttr *dbg_attr;
wxFileDialog *save_log_dialog;
vlc_bool_t b_verbose; vlc_bool_t b_verbose;
}; };
......
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