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