]> git.sesse.net Git - vlc/blob - modules/gui/wxwidgets/dialogs.cpp
* modules/gui/wxwidgets: fix breakage introduced by changeset 23581 and 23579. Breaki...
[vlc] / modules / gui / wxwidgets / dialogs.cpp
1 /*****************************************************************************
2  * dialogs.cpp : wxWidgets plugin for vlc
3  *****************************************************************************
4  * Copyright (C) 2000-2004 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Gildas Bazin <gbazin@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include <errno.h>                                                 /* ENOMEM */
28
29 #include <vlc/vlc.h>
30 #include <vlc_aout.h>
31 #include <vlc_interface.h>
32
33 #include "vlc_charset.h"
34
35 //#include "dialogs/vlm/vlm_panel.hpp"
36 #include "dialogs/bookmarks.hpp"
37 #include "dialogs/wizard.hpp"
38 #include "dialogs/playlist.hpp"
39 #include "dialogs/open.hpp"
40 #include "dialogs/updatevlc.hpp"
41 #include "dialogs/fileinfo.hpp"
42 #include "dialogs/iteminfo.hpp"
43 #include "dialogs/preferences.hpp"
44 #include "dialogs/messages.hpp"
45 #include "dialogs/interaction.hpp"
46 #include "interface.hpp"
47
48 /* include the icon graphic */
49 #include "../../../share/vlc32x32.xpm"
50
51
52 /* Dialogs Provider */
53 namespace wxvlc
54 {
55 class DialogsProvider: public wxFrame
56 {
57 public:
58     /* Constructor */
59     DialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
60     virtual ~DialogsProvider();
61
62 private:
63     void Open( int i_access_method, int i_arg );
64
65     /* Event handlers (these functions should _not_ be virtual) */
66 #ifdef UPDATE_CHECK
67     void OnUpdateVLC( wxCommandEvent& event );
68 #endif
69     //void OnVLM( wxCommandEvent& event );
70     void OnInteraction( wxCommandEvent& event );
71     void OnExit( wxCommandEvent& event );
72     void OnPlaylist( wxCommandEvent& event );
73     void OnMessages( wxCommandEvent& event );
74     void OnFileInfo( wxCommandEvent& event );
75     void OnPreferences( wxCommandEvent& event );
76     void OnWizardDialog( wxCommandEvent& event );
77     void OnBookmarks( wxCommandEvent& event );
78
79     void OnOpenFileGeneric( wxCommandEvent& event );
80     void OnOpenFileSimple( wxCommandEvent& event );
81     void OnOpenDirectory( wxCommandEvent& event );
82     void OnOpenFile( wxCommandEvent& event );
83     void OnOpenDisc( wxCommandEvent& event );
84     void OnOpenNet( wxCommandEvent& event );
85     void OnOpenCapture( wxCommandEvent& event );
86     void OnOpenSat( wxCommandEvent& event );
87
88     void OnPopupMenu( wxCommandEvent& event );
89     void OnAudioPopupMenu( wxCommandEvent& event );
90     void OnVideoPopupMenu( wxCommandEvent& event );
91     void OnMiscPopupMenu( wxCommandEvent& event );
92
93     void OnIdle( wxIdleEvent& event );
94
95     void OnExitThread( wxCommandEvent& event );
96
97     DECLARE_EVENT_TABLE();
98
99     intf_thread_t *p_intf;
100
101 public:
102     /* Secondary windows */
103     OpenDialog          *p_open_dialog;
104     wxFileDialog        *p_file_dialog;
105     wxDirDialog         *p_dir_dialog;
106     Playlist            *p_playlist_dialog;
107     Messages            *p_messages_dialog;
108     FileInfo            *p_fileinfo_dialog;
109     WizardDialog        *p_wizard_dialog;
110     wxFrame             *p_prefs_dialog;
111     wxFrame             *p_bookmarks_dialog;
112     wxFileDialog        *p_file_generic_dialog;
113 #ifdef UPDATE_CHECK
114     UpdateVLC           *p_updatevlc_dialog;
115 #endif
116     //VLMFrame            *p_vlm_dialog;
117 };
118 }
119
120 DEFINE_LOCAL_EVENT_TYPE( wxEVT_DIALOG );
121
122 BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
123     /* Idle loop used to update some of the dialogs */
124     EVT_IDLE(DialogsProvider::OnIdle)
125
126     /* Custom wxDialog events */
127     EVT_COMMAND(INTF_DIALOG_FILE, wxEVT_DIALOG, DialogsProvider::OnOpenFile)
128     EVT_COMMAND(INTF_DIALOG_DISC, wxEVT_DIALOG, DialogsProvider::OnOpenDisc)
129     EVT_COMMAND(INTF_DIALOG_NET, wxEVT_DIALOG, DialogsProvider::OnOpenNet)
130     EVT_COMMAND(INTF_DIALOG_CAPTURE, wxEVT_DIALOG,
131                 DialogsProvider::OnOpenCapture)
132     EVT_COMMAND(INTF_DIALOG_FILE_SIMPLE, wxEVT_DIALOG,
133                 DialogsProvider::OnOpenFileSimple)
134     EVT_COMMAND(INTF_DIALOG_FILE_GENERIC, wxEVT_DIALOG,
135                 DialogsProvider::OnOpenFileGeneric)
136     EVT_COMMAND(INTF_DIALOG_DIRECTORY, wxEVT_DIALOG,
137                 DialogsProvider::OnOpenDirectory)
138
139     EVT_COMMAND(INTF_DIALOG_PLAYLIST, wxEVT_DIALOG,
140                 DialogsProvider::OnPlaylist)
141     EVT_COMMAND(INTF_DIALOG_MESSAGES, wxEVT_DIALOG,
142                 DialogsProvider::OnMessages)
143     EVT_COMMAND(INTF_DIALOG_PREFS, wxEVT_DIALOG,
144                 DialogsProvider::OnPreferences)
145     EVT_COMMAND(INTF_DIALOG_WIZARD, wxEVT_DIALOG,
146                 DialogsProvider::OnWizardDialog)
147     EVT_COMMAND(INTF_DIALOG_FILEINFO, wxEVT_DIALOG,
148                 DialogsProvider::OnFileInfo)
149     EVT_COMMAND(INTF_DIALOG_BOOKMARKS, wxEVT_DIALOG,
150                 DialogsProvider::OnBookmarks)
151
152     EVT_COMMAND(INTF_DIALOG_POPUPMENU, wxEVT_DIALOG,
153                 DialogsProvider::OnPopupMenu)
154     EVT_COMMAND(INTF_DIALOG_AUDIOPOPUPMENU, wxEVT_DIALOG,
155                 DialogsProvider::OnAudioPopupMenu)
156     EVT_COMMAND(INTF_DIALOG_VIDEOPOPUPMENU, wxEVT_DIALOG,
157                 DialogsProvider::OnVideoPopupMenu)
158     EVT_COMMAND(INTF_DIALOG_MISCPOPUPMENU, wxEVT_DIALOG,
159                 DialogsProvider::OnMiscPopupMenu)
160
161     EVT_COMMAND(INTF_DIALOG_EXIT, wxEVT_DIALOG,
162                 DialogsProvider::OnExitThread)
163 #ifdef UPDATE_CHECK
164     EVT_COMMAND(INTF_DIALOG_UPDATEVLC, wxEVT_DIALOG,
165                 DialogsProvider::OnUpdateVLC)
166 #endif
167 #if 0
168     EVT_COMMAND(INTF_DIALOG_VLM, wxEVT_DIALOG,
169                 DialogsProvider::OnVLM)
170 #endif
171     EVT_COMMAND( INTF_DIALOG_INTERACTION, wxEVT_DIALOG,
172                 DialogsProvider::OnInteraction )
173 END_EVENT_TABLE()
174
175 wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent )
176 {
177     return new DialogsProvider( p_intf, p_parent );
178 }
179
180 /*****************************************************************************
181  * Constructor.
182  *****************************************************************************/
183 DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent )
184   :  wxFrame( p_parent, -1, wxT("") )
185 {
186     /* Initializations */
187     p_intf = _p_intf;
188     p_open_dialog = NULL;
189     p_file_dialog = NULL;
190     p_playlist_dialog = NULL;
191     p_messages_dialog = NULL;
192     p_fileinfo_dialog = NULL;
193     p_prefs_dialog = NULL;
194     p_file_generic_dialog = NULL;
195     p_wizard_dialog = NULL;
196     p_bookmarks_dialog = NULL;
197     p_dir_dialog = NULL;
198 #ifdef UPDATE_CHECK
199     p_updatevlc_dialog = NULL;
200 #endif
201     //p_vlm_dialog = NULL;
202
203     /* Give our interface a nice little icon */
204     p_intf->p_sys->p_icon = new wxIcon( (const char**) vlc_xpm );
205
206     /* Create the messages dialog so it can begin storing logs */
207     p_messages_dialog = new Messages( p_intf, p_parent ? p_parent : this );
208
209     /* Check if user wants to show the bookmarks dialog by default */
210     wxCommandEvent dummy_event;
211     if( config_GetInt( p_intf, "wx-bookmarks" ) )
212         OnBookmarks( dummy_event );
213
214     /* Intercept all menu events in our custom event handler */
215     PushEventHandler( new MenuEvtHandler( p_intf, NULL ) );
216
217
218     WindowSettings *ws = p_intf->p_sys->p_window_settings;
219     wxPoint p;
220     wxSize  s;
221     bool    b_shown;
222
223 #define INIT( id, w, N, S ) \
224     if( ws->GetSettings( WindowSettings::id, b_shown, p, s ) && b_shown ) \
225     {                           \
226         if( !w )                \
227             w = N;              \
228         w->SetSize( s );        \
229         w->Move( p );           \
230         w->S( true );           \
231     }
232
233     INIT( ID_PLAYLIST, p_playlist_dialog, new Playlist(p_intf,this), ShowPlaylist );
234     INIT( ID_MESSAGES, p_messages_dialog, new Messages(p_intf,this), Show );
235     INIT( ID_FILE_INFO, p_fileinfo_dialog, new FileInfo(p_intf,this), Show );
236     INIT( ID_BOOKMARKS, p_bookmarks_dialog, new BookmarksDialog(p_intf,this), Show);
237 #undef INIT
238 }
239
240 DialogsProvider::~DialogsProvider()
241 {
242     WindowSettings *ws = p_intf->p_sys->p_window_settings;
243
244 #define UPDATE(id,w)                                        \
245   {                                                         \
246     if( w && w->IsShown() && !w->IsIconized() )             \
247         ws->SetSettings(  WindowSettings::id, true,         \
248                           w->GetPosition(), w->GetSize() ); \
249     else                                                    \
250         ws->SetSettings(  WindowSettings::id, false );      \
251   }
252
253     UPDATE( ID_PLAYLIST,  p_playlist_dialog );
254     UPDATE( ID_MESSAGES,  p_messages_dialog );
255     UPDATE( ID_FILE_INFO, p_fileinfo_dialog );
256     UPDATE( ID_BOOKMARKS, p_bookmarks_dialog );
257
258 #undef UPDATE
259
260     PopEventHandler(true);
261
262     /* Clean up */
263     if( p_open_dialog )     delete p_open_dialog;
264     if( p_prefs_dialog )    p_prefs_dialog->Destroy();
265     if( p_file_dialog )     delete p_file_dialog;
266     if( p_playlist_dialog ) delete p_playlist_dialog;
267     if( p_messages_dialog ) delete p_messages_dialog;
268     if( p_fileinfo_dialog ) delete p_fileinfo_dialog;
269     if( p_file_generic_dialog ) delete p_file_generic_dialog;
270     if( p_wizard_dialog ) delete p_wizard_dialog;
271     if( p_bookmarks_dialog ) delete p_bookmarks_dialog;
272 #ifdef UPDATE_CHECK
273     if( p_updatevlc_dialog ) delete p_updatevlc_dialog;
274 #endif
275     //if( p_vlm_dialog ) delete p_vlm_dialog;
276
277
278     if( p_intf->p_sys->p_icon ) delete p_intf->p_sys->p_icon;
279
280     /* We must set this here because on win32 this destructor will be
281      * automatically called so we must not call it again on wxApp->OnExit().
282      * There shouldn't be any race conditions as all this should be done
283      * from the same thread. */
284     p_intf->p_sys->p_wxwindow = NULL;
285 }
286
287 void DialogsProvider::OnIdle( wxIdleEvent& WXUNUSED(event) )
288 {
289     /* Update the log window */
290     if( p_messages_dialog )
291         p_messages_dialog->UpdateLog();
292
293     /* Update the playlist */
294     if( p_playlist_dialog )
295         p_playlist_dialog->UpdatePlaylist();
296
297     /* Update the fileinfo windows */
298     if( p_fileinfo_dialog )
299         p_fileinfo_dialog->Update();
300 }
301
302 void DialogsProvider::OnPlaylist( wxCommandEvent& WXUNUSED(event) )
303 {
304     /* Show/hide the playlist window */
305     if( !p_playlist_dialog )
306         p_playlist_dialog = new Playlist( p_intf, this );
307
308     if( p_playlist_dialog )
309     {
310         p_playlist_dialog->ShowPlaylist( !p_playlist_dialog->IsShown() );
311     }
312 }
313
314 void DialogsProvider::OnMessages( wxCommandEvent& WXUNUSED(event) )
315 {
316     /* Show/hide the log window */
317     if( !p_messages_dialog )
318         p_messages_dialog = new Messages( p_intf, this );
319
320     if( p_messages_dialog )
321     {
322         p_messages_dialog->Show( !p_messages_dialog->IsShown() );
323     }
324 }
325
326 void DialogsProvider::OnFileInfo( wxCommandEvent& WXUNUSED(event) )
327 {
328     /* Show/hide the file info window */
329     if( !p_fileinfo_dialog )
330         p_fileinfo_dialog = new FileInfo( p_intf, this );
331
332     if( p_fileinfo_dialog )
333     {
334         p_fileinfo_dialog->Show( !p_fileinfo_dialog->IsShown() );
335     }
336 }
337
338 void DialogsProvider::OnPreferences( wxCommandEvent& WXUNUSED(event) )
339 {
340     /* Show/hide the open dialog */
341     if( !p_prefs_dialog )
342         p_prefs_dialog = new PrefsDialog( p_intf, this );
343
344     if( p_prefs_dialog )
345     {
346         p_prefs_dialog->Show( !p_prefs_dialog->IsShown() );
347     }
348 }
349
350 void DialogsProvider::OnWizardDialog( wxCommandEvent& WXUNUSED(event) )
351 {
352     p_wizard_dialog = new WizardDialog( p_intf, this, NULL, 0, 0 );
353
354     if( p_wizard_dialog )
355     {
356         p_wizard_dialog->Run();
357         delete p_wizard_dialog;
358     }
359
360     p_wizard_dialog = NULL;
361 }
362
363 void DialogsProvider::OnBookmarks( wxCommandEvent& WXUNUSED(event) )
364 {
365     /* Show/hide the open dialog */
366     if( !p_bookmarks_dialog )
367         p_bookmarks_dialog = new BookmarksDialog( p_intf, this );
368
369     if( p_bookmarks_dialog )
370     {
371         p_bookmarks_dialog->Show( !p_bookmarks_dialog->IsShown() );
372     }
373 }
374
375 void DialogsProvider::OnOpenFileGeneric( wxCommandEvent& event )
376 {
377     intf_dialog_args_t *p_arg = (intf_dialog_args_t *)event.GetClientData();
378
379     if( p_arg == NULL )
380     {
381         msg_Dbg( p_intf, "OnOpenFileGeneric() called with NULL arg" );
382         return;
383     }
384
385     if( p_file_generic_dialog == NULL )
386         p_file_generic_dialog = new wxFileDialog( NULL );
387
388     if( p_file_generic_dialog )
389     {
390         p_file_generic_dialog->SetMessage( wxU(p_arg->psz_title) );
391         p_file_generic_dialog->SetWildcard( wxU(p_arg->psz_extensions) );
392         p_file_generic_dialog->SetWindowStyle( (p_arg->b_save ? wxSAVE : wxOPEN) |
393                                                (p_arg->b_multiple ? wxMULTIPLE:0) );
394     }
395
396     if( p_file_generic_dialog &&
397         p_file_generic_dialog->ShowModal() == wxID_OK )
398     {
399         wxArrayString paths;
400
401         p_file_generic_dialog->GetPaths( paths );
402
403         p_arg->i_results = paths.GetCount();
404         p_arg->psz_results = (char **)malloc( p_arg->i_results *
405                                               sizeof(char *) );
406         for( size_t i = 0; i < paths.GetCount(); i++ )
407         {
408             p_arg->psz_results[i] = strdup( paths[i].mb_str(wxConvUTF8) );
409         }
410     }
411
412     /* Callback */
413     if( p_arg->pf_callback )
414     {
415         p_arg->pf_callback( p_arg );
416     }
417
418     if( p_arg->psz_results )
419     {
420         for( int i = 0; i < p_arg->i_results; i++ )
421         {
422             free( p_arg->psz_results[i] );
423         }
424         free( p_arg->psz_results );
425     }
426     if( p_arg->psz_title ) free( p_arg->psz_title );
427     if( p_arg->psz_extensions ) free( p_arg->psz_extensions );
428
429     free( p_arg );
430 }
431
432 void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
433 {
434     playlist_t *p_playlist =
435         (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
436                                        FIND_ANYWHERE );
437     if( p_playlist == NULL )
438     {
439         return;
440     }
441
442     if( p_file_dialog == NULL )
443         p_file_dialog = new wxFileDialog( NULL, wxU(_("Open File")),
444             wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE );
445
446     p_file_dialog->SetWildcard(wxU(_("All Files (*.*)|*"
447         "|Sound Files (*.mp3, *.ogg, etc.)|" EXTENSIONS_AUDIO
448         "|Video Files (*.avi, *.mpg, etc.)|" EXTENSIONS_VIDEO
449         "|Playlist Files (*.m3u, *.pls, etc.)|" EXTENSIONS_PLAYLIST
450         "|Subtitle Files (*.srt, *.sub, etc.)|" EXTENSIONS_SUBTITLE)));
451
452     if( p_file_dialog && p_file_dialog->ShowModal() == wxID_OK )
453     {
454         wxArrayString paths;
455
456         p_file_dialog->GetPaths( paths );
457
458         for( size_t i = 0; i < paths.GetCount(); i++ )
459         {
460             char *psz_utf8 = wxFromLocale( paths[i] );
461             if( event.GetInt() )
462                 playlist_Add( p_playlist, psz_utf8, NULL,
463                               PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
464                               (i ? PLAYLIST_PREPARSE : 0 ),
465                               PLAYLIST_END, VLC_TRUE, VLC_FALSE );
466             else
467                 playlist_Add( p_playlist, psz_utf8, NULL,
468                               PLAYLIST_APPEND | PLAYLIST_PREPARSE , PLAYLIST_END , VLC_TRUE, VLC_FALSE );
469             wxLocaleFree( psz_utf8 );
470         }
471     }
472
473     vlc_object_release( p_playlist );
474 }
475
476 void DialogsProvider::OnOpenDirectory( wxCommandEvent& event )
477 {
478     playlist_t *p_playlist =
479         (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
480                                        FIND_ANYWHERE );
481     if( p_playlist == NULL )
482     {
483         return;
484     }
485
486     if( p_dir_dialog == NULL )
487         p_dir_dialog = new wxDirDialog( NULL, wxU(_("Select a directory")) );
488
489     if( p_dir_dialog && p_dir_dialog->ShowModal() == wxID_OK )
490     {
491         wxString path = p_dir_dialog->GetPath();
492         char *psz_utf8 = wxFromLocale( path );
493         playlist_Add( p_playlist, psz_utf8, NULL,
494                       PLAYLIST_APPEND | (event.GetInt() ? PLAYLIST_GO : 0),
495                       PLAYLIST_END, VLC_TRUE, VLC_FALSE );
496         wxLocaleFree( psz_utf8 );
497     }
498
499     vlc_object_release( p_playlist );
500 }
501
502 void DialogsProvider::OnOpenFile( wxCommandEvent& event )
503 {
504     Open( FILE_ACCESS, event.GetInt() );
505 }
506
507 void DialogsProvider::OnOpenDisc( wxCommandEvent& event )
508 {
509     Open( DISC_ACCESS, event.GetInt() );
510 }
511
512 void DialogsProvider::OnOpenNet( wxCommandEvent& event )
513 {
514     Open( NET_ACCESS, event.GetInt() );
515 }
516
517 void DialogsProvider::OnOpenCapture( wxCommandEvent& event )
518 {
519     Open( CAPTURE_ACCESS, event.GetInt() );
520 }
521
522 void DialogsProvider::Open( int i_access_method, int i_arg )
523 {
524     /* Show/hide the open dialog */
525     if( !p_open_dialog )
526         p_open_dialog = new OpenDialog( p_intf, this, i_access_method, i_arg,
527                                         OPEN_NORMAL );
528
529     if( p_open_dialog )
530     {
531         p_open_dialog->Show( i_access_method, i_arg );
532     }
533 }
534
535 void DialogsProvider::OnPopupMenu( wxCommandEvent& event )
536 {
537     wxPoint mousepos = ScreenToClient( wxGetMousePosition() );
538     ::PopupMenu( p_intf, this, mousepos );
539 }
540
541 void DialogsProvider::OnAudioPopupMenu( wxCommandEvent& event )
542 {
543     wxPoint mousepos = ScreenToClient( wxGetMousePosition() );
544     ::AudioPopupMenu( p_intf, this, mousepos );
545 }
546 void DialogsProvider::OnVideoPopupMenu( wxCommandEvent& event )
547 {
548     wxPoint mousepos = ScreenToClient( wxGetMousePosition() );
549     ::VideoPopupMenu( p_intf, this, mousepos );
550 }
551 void DialogsProvider::OnMiscPopupMenu( wxCommandEvent& event )
552 {
553     wxPoint mousepos = ScreenToClient( wxGetMousePosition() );
554     ::MiscPopupMenu( p_intf, this, mousepos );
555 }
556
557 void DialogsProvider::OnExitThread( wxCommandEvent& WXUNUSED(event) )
558 {
559     wxTheApp->ExitMainLoop();
560 }
561
562 #ifdef UPDATE_CHECK
563 void DialogsProvider::OnUpdateVLC( wxCommandEvent& WXUNUSED(event) )
564 {
565     /* Show/hide the file info window */
566     if( !p_updatevlc_dialog )
567         p_updatevlc_dialog = new UpdateVLC( p_intf, this );
568
569     if( p_updatevlc_dialog )
570     {
571         p_updatevlc_dialog->Show( !p_updatevlc_dialog->IsShown() );
572     }
573 }
574 #endif
575
576 #if 0
577 void DialogsProvider::OnVLM( wxCommandEvent& WXUNUSED(event) )
578 {
579     /* Show/hide the file info window */
580     if( !p_vlm_dialog )
581         p_vlm_dialog = new VLMFrame( p_intf, this );
582
583     if( p_vlm_dialog )
584     {
585         p_vlm_dialog->Show( !p_vlm_dialog->IsShown() );
586     }
587 }
588 #endif
589
590 void DialogsProvider::OnInteraction( wxCommandEvent& event )
591 {
592     intf_dialog_args_t *p_arg = (intf_dialog_args_t *)event.GetClientData();
593     interaction_dialog_t *p_dialog;
594     InteractionDialog *p_wxdialog;
595
596     return;
597
598     if( p_arg == NULL )
599     {
600         msg_Dbg( p_intf, "OnInteraction() called with NULL arg" );
601         return;
602     }
603     p_dialog = p_arg->p_dialog;
604
605     /** \bug We store the interface object for the dialog in the p_private
606      * field of the core dialog object. This is not safe if we change
607      * interface while a dialog is loaded */
608
609     switch( p_dialog->i_action )
610     {
611     case INTERACT_NEW:
612         p_wxdialog = new InteractionDialog( p_intf, this, p_dialog );
613         p_dialog->p_private = (void*)p_wxdialog;
614         p_wxdialog->Show();
615         break;
616     case INTERACT_UPDATE:
617         p_wxdialog = (InteractionDialog*)(p_dialog->p_private);
618         if( p_wxdialog)
619             p_wxdialog->Update();
620         break;
621     case INTERACT_HIDE:
622         p_wxdialog = (InteractionDialog*)(p_dialog->p_private);
623         if( p_wxdialog )
624             p_wxdialog->Hide();
625         p_dialog->i_status = HIDDEN_DIALOG;
626         break;
627     case INTERACT_DESTROY:
628         p_wxdialog = (InteractionDialog*)(p_dialog->p_private);
629         /// \todo
630         p_dialog->i_status = DESTROYED_DIALOG;
631         break;
632     }
633 }