/*****************************************************************************
* dialogs.cpp : wxWindows plugin for vlc
*****************************************************************************
- * Copyright (C) 2000-2004 VideoLAN
+ * Copyright (C) 2000-2004 the VideoLAN team
* $Id$
*
* Authors: Gildas Bazin <gbazin@videolan.org>
void Open( int i_access_method, int i_arg );
/* Event handlers (these functions should _not_ be virtual) */
+ void OnUpdateVLC( wxCommandEvent& event );
void OnExit( wxCommandEvent& event );
void OnPlaylist( wxCommandEvent& event );
void OnMessages( wxCommandEvent& event );
wxFrame *p_prefs_dialog;
wxWindow *p_bookmarks_dialog;
wxFileDialog *p_file_generic_dialog;
+ UpdateVLC *p_updatevlc_dialog;
};
DEFINE_LOCAL_EVENT_TYPE( wxEVT_DIALOG );
DialogsProvider::OnPopupMenu)
EVT_COMMAND(INTF_DIALOG_EXIT, wxEVT_DIALOG,
DialogsProvider::OnExitThread)
+ EVT_COMMAND(INTF_DIALOG_UPDATEVLC, wxEVT_DIALOG,
+ DialogsProvider::OnUpdateVLC)
END_EVENT_TABLE()
wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent )
p_file_generic_dialog = NULL;
p_wizard_dialog = NULL;
p_bookmarks_dialog = NULL;
+ p_dir_dialog = NULL;
+ p_updatevlc_dialog = NULL;
/* Give our interface a nice little icon */
p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
/* Intercept all menu events in our custom event handler */
PushEventHandler( new MenuEvtHandler( p_intf, NULL ) );
+
+
+ WindowSettings *ws = p_intf->p_sys->p_window_settings;
+ wxPoint p;
+ wxSize s;
+ bool b_shown;
+
+#define INIT( id, w, N, S ) \
+ if( ws->GetSettings( WindowSettings::id, b_shown, p, s ) && b_shown ) \
+ { \
+ if( !w ) \
+ w = N; \
+ w->SetSize( s ); \
+ w->Move( p ); \
+ w->S( true ); \
+ }
+
+ INIT( ID_PLAYLIST, p_playlist_dialog, new Playlist(p_intf,this), ShowPlaylist );
+ INIT( ID_MESSAGES, p_messages_dialog, new Messages(p_intf,this), Show );
+ INIT( ID_FILE_INFO, p_fileinfo_dialog, new FileInfo(p_intf,this), Show );
+ INIT( ID_BOOKMARKS, p_bookmarks_dialog, BookmarksDialog(p_intf,this), Show);
+#undef INIT
}
DialogsProvider::~DialogsProvider()
{
+ WindowSettings *ws = p_intf->p_sys->p_window_settings;
+
+#define UPDATE(id,w) \
+ { \
+ if( w && w->IsShown() ) \
+ ws->SetSettings( WindowSettings::id, true, \
+ w->GetPosition(), w->GetSize() ); \
+ else \
+ ws->SetSettings( WindowSettings::id, false ); \
+ }
+
+ UPDATE( ID_PLAYLIST, p_playlist_dialog );
+ UPDATE( ID_MESSAGES, p_messages_dialog );
+ UPDATE( ID_FILE_INFO, p_fileinfo_dialog );
+ UPDATE( ID_BOOKMARKS, p_bookmarks_dialog );
+
+#undef UPDATE
+
/* Clean up */
if( p_open_dialog ) delete p_open_dialog;
if( p_prefs_dialog ) p_prefs_dialog->Destroy();
if( p_file_generic_dialog ) delete p_file_generic_dialog;
if( p_wizard_dialog ) delete p_wizard_dialog;
if( p_bookmarks_dialog ) delete p_bookmarks_dialog;
+ if( p_updatevlc_dialog ) delete p_updatevlc_dialog;
if( p_intf->p_sys->p_icon ) delete p_intf->p_sys->p_icon;
void DialogsProvider::OnIdle( wxIdleEvent& WXUNUSED(event) )
{
- /* Update the log window */
- if( p_messages_dialog )
- p_messages_dialog->UpdateLog();
+ /* Update the log window */
+ if( p_messages_dialog )
+ p_messages_dialog->UpdateLog();
- /* Update the playlist */
- if( p_playlist_dialog )
- p_playlist_dialog->UpdatePlaylist();
+ /* Update the playlist */
+ if( p_playlist_dialog )
+ p_playlist_dialog->UpdatePlaylist();
- /* Update the fileinfo windows */
- if( p_fileinfo_dialog )
- p_fileinfo_dialog->UpdateFileInfo();
+ /* Update the fileinfo windows */
+ if( p_fileinfo_dialog )
+ p_fileinfo_dialog->UpdateFileInfo();
}
void DialogsProvider::OnPlaylist( wxCommandEvent& WXUNUSED(event) )
if( p_dir_dialog && p_dir_dialog->ShowModal() == wxID_OK )
{
- playlist_item_t *p_item;
wxString path = p_dir_dialog->GetPath();
- int i_id = playlist_Add( p_playlist, (const char *)path.mb_str(),
- (const char *)path.mb_str(),
- PLAYLIST_APPEND, PLAYLIST_END );
- p_item = playlist_ItemGetById( p_playlist, i_id );
- if( p_item )
- {
- input_CreateThread( p_intf, &p_item->input );
- }
+ playlist_Add( p_playlist, (const char *)path.mb_str(),
+ (const char *)path.mb_str(),
+ PLAYLIST_APPEND | (event.GetInt() ? PLAYLIST_GO : 0),
+ PLAYLIST_END );
}
vlc_object_release( p_playlist );
{
wxTheApp->ExitMainLoop();
}
+
+void DialogsProvider::OnUpdateVLC( wxCommandEvent& WXUNUSED(event) )
+{
+ /* Show/hide the file info window */
+ if( !p_updatevlc_dialog )
+ p_updatevlc_dialog = new UpdateVLC( p_intf, this );
+
+ if( p_updatevlc_dialog )
+ {
+ p_updatevlc_dialog->Show( !p_updatevlc_dialog->IsShown() );
+ }
+}