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