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