]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/wxwindows.h
Beginning of an improved streaming wizard. Do not use at the moment
[vlc] / modules / gui / wxwindows / wxwindows.h
1 /*****************************************************************************
2  * wxwindows.h: private wxWindows interface description
3  *****************************************************************************
4  * Copyright (C) 1999-2004 VideoLAN
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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 #ifdef WIN32                                                 /* mingw32 hack */
25 #undef Yield
26 #undef CreateDialog
27 #endif
28
29 /* Let vlc take care of the i18n stuff */
30 #define WXINTL_NO_GETTEXT_MACRO
31
32 #include <wx/wxprec.h>
33 #include <wx/wx.h>
34
35 #include <wx/listctrl.h>
36 #include <wx/textctrl.h>
37 #include <wx/notebook.h>
38 #include <wx/spinctrl.h>
39 #include <wx/dnd.h>
40 #include <wx/treectrl.h>
41 #include <wx/gauge.h>
42 #include <wx/accel.h>
43 #include <wx/checkbox.h>
44 #include <wx/wizard.h>
45 #include "vlc_keys.h"
46
47 /* Hmmm, work-around for newest wxWin */
48 #ifdef wxStaticCastEvent
49 #   undef wxStaticCastEvent
50 #   define wxStaticCastEvent(type, val) ((type)(val))
51 #endif
52
53 DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
54 DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
55
56 #define SLIDER_MAX_POS 10000
57
58 /* wxU is used to convert ansi/utf8 strings to unicode strings (wchar_t) */
59 #if defined( ENABLE_NLS ) && defined( ENABLE_UTF8 )
60 #if wxUSE_UNICODE
61 #   define wxU(utf8) wxString(utf8, wxConvUTF8)
62 #else
63 #   define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
64 #endif
65 #define ISUTF8 1
66
67 #else // ENABLE_NLS && ENABLE_UTF8
68 #if wxUSE_UNICODE
69 #   define wxU(ansi) wxString(ansi, *wxConvCurrent)
70 #else
71 #   define wxU(ansi) ansi
72 #endif
73 #define ISUTF8 0
74
75 #endif
76
77 /* wxL2U (locale to unicode) is used to convert ansi strings to unicode
78  * strings (wchar_t) */
79 #if wxUSE_UNICODE
80 #   define wxL2U(ansi) wxString(ansi, *wxConvCurrent)
81 #else
82 #   define wxL2U(ansi) ansi
83 #endif
84
85 #define WRAPCOUNT 80
86
87 #define OPEN_NORMAL 0
88 #define OPEN_STREAM 1
89
90 #define MODE_NONE 0
91 #define MODE_GROUP 1
92 #define MODE_AUTHOR 2
93 #define MODE_TITLE 3
94
95 class PrefsTreeCtrl;
96 class AutoBuiltPanel;
97 class VideoWindow;
98
99 /*****************************************************************************
100  * intf_sys_t: description and status of wxwindows interface
101  *****************************************************************************/
102 struct intf_sys_t
103 {
104     /* the wx parent window */
105     wxWindow            *p_wxwindow;
106     wxIcon              *p_icon;
107
108     /* special actions */
109     vlc_bool_t          b_playing;
110
111     /* The input thread */
112     input_thread_t *    p_input;
113
114     /* The slider */
115     int                 i_slider_pos;                     /* slider position */
116     int                 i_slider_oldpos;                /* previous position */
117     vlc_bool_t          b_slider_free;                      /* slider status */
118
119     /* The messages window */
120     msg_subscription_t* p_sub;                  /* message bank subscription */
121
122     /* Playlist management */
123     int                 i_playing;                 /* playlist selected item */
124
125     /* Send an event to show a dialog */
126     void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
127                              intf_dialog_args_t *p_arg );
128
129     /* Popup menu */
130     wxMenu              *p_popup_menu;
131
132     VideoWindow         *p_video_window;
133     wxBoxSizer          *p_video_sizer;
134 };
135
136 /*****************************************************************************
137  * Prototypes
138  *****************************************************************************/
139 wxArrayString SeparateEntries( wxString );
140 wxWindow *VideoWindow( intf_thread_t *p_intf, wxWindow *p_parent );
141 wxWindow *BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent );
142
143 namespace wxvlc
144 {
145 class Interface;
146 class OpenDialog;
147 class V4LDialog;
148 class SoutDialog;
149 class SubsFileDialog;
150 class Playlist;
151 class Messages;
152 class FileInfo;
153 class StreamDialog;
154 class WizardDialog;
155 class ItemInfoDialog;
156 class NewGroup;
157 class ExportPlaylist;
158
159 /*****************************************************************************
160  * Classes declarations.
161  *****************************************************************************/
162 /* Timer */
163 class Timer: public wxTimer
164 {
165 public:
166     /* Constructor */
167     Timer( intf_thread_t *p_intf, Interface *p_main_interface );
168     virtual ~Timer();
169
170     virtual void Notify();
171
172 private:
173     intf_thread_t *p_intf;
174     Interface *p_main_interface;
175     int i_old_playing_status;
176     int i_old_rate;
177 };
178
179 /* Main Interface */
180 class Interface: public wxFrame
181 {
182 public:
183     /* Constructor */
184     Interface( intf_thread_t *p_intf );
185     virtual ~Interface();
186     void TogglePlayButton( int i_playing_status );
187
188     wxBoxSizer  *frame_sizer;
189     wxStatusBar *statusbar;
190
191     wxSlider    *slider;
192     wxWindow    *slider_frame;
193     wxWindow    *extra_frame;
194
195     vlc_bool_t b_extra;
196
197     wxStaticBox *adjust_box;
198     wxSlider *brightness_slider;
199     wxSlider *contrast_slider;
200     wxSlider *saturation_slider;
201     wxSlider *hue_slider;
202     wxSlider *gamma_slider;
203
204     wxStaticBox *other_box;
205     wxComboBox *ratio_combo;
206
207     wxGauge     *volctrl;
208
209 private:
210     void UpdateAcceleratorTable();
211     void CreateOurMenuBar();
212     void CreateOurToolBar();
213     void CreateOurExtendedPanel();
214     void CreateOurSlider();
215     void Open( int i_access_method );
216
217     /* Event handlers (these functions should _not_ be virtual) */
218     void OnExit( wxCommandEvent& event );
219     void OnAbout( wxCommandEvent& event );
220
221     void OnOpenFileSimple( wxCommandEvent& event );
222     void OnOpenFile( wxCommandEvent& event );
223     void OnOpenDisc( wxCommandEvent& event );
224     void OnOpenNet( wxCommandEvent& event );
225     void OnOpenSat( wxCommandEvent& event );
226     void OnOpenV4L( wxCommandEvent& event );
227     void OnExtended( wxCommandEvent& event );
228     void OnBookmarks( wxCommandEvent& event );
229     void OnShowDialog( wxCommandEvent& event );
230     void OnPlayStream( wxCommandEvent& event );
231     void OnStopStream( wxCommandEvent& event );
232     void OnSliderUpdate( wxScrollEvent& event );
233     void OnPrevStream( wxCommandEvent& event );
234     void OnNextStream( wxCommandEvent& event );
235     void OnSlowStream( wxCommandEvent& event );
236     void OnFastStream( wxCommandEvent& event );
237
238     void OnEnableAdjust( wxCommandEvent& event );
239     void OnHueUpdate( wxScrollEvent& event );
240     void OnContrastUpdate( wxScrollEvent& event );
241     void OnBrightnessUpdate( wxScrollEvent& event );
242     void OnSaturationUpdate( wxScrollEvent& event );
243     void OnGammaUpdate( wxScrollEvent& event );
244
245     void OnRatio( wxCommandEvent& event );
246     void OnEnableVisual( wxCommandEvent& event );
247
248     void OnMenuOpen( wxMenuEvent& event );
249
250 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
251     void OnContextMenu2(wxContextMenuEvent& event);
252 #endif
253     void OnContextMenu(wxMouseEvent& event);
254
255     void OnControlEvent( wxCommandEvent& event );
256
257     DECLARE_EVENT_TABLE();
258
259     Timer *timer;
260     intf_thread_t *p_intf;
261
262 private:
263     int i_old_playing_status;
264
265     /* For auto-generated menus */
266     wxMenu *p_settings_menu;
267     wxMenu *p_audio_menu;
268     wxMenu *p_video_menu;
269     wxMenu *p_navig_menu;
270 };
271
272 /*class BookmarksDialog;
273 */
274 /* Dialogs Provider */
275 class DialogsProvider: public wxFrame
276 {
277 public:
278     /* Constructor */
279     DialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
280     virtual ~DialogsProvider();
281
282 private:
283     void Open( int i_access_method, int i_arg );
284
285     /* Event handlers (these functions should _not_ be virtual) */
286     void OnExit( wxCommandEvent& event );
287     void OnPlaylist( wxCommandEvent& event );
288     void OnMessages( wxCommandEvent& event );
289     void OnFileInfo( wxCommandEvent& event );
290     void OnPreferences( wxCommandEvent& event );
291     void OnStreamWizardDialog( wxCommandEvent& event );
292     void OnWizardDialog( wxCommandEvent& event );
293     void OnBookmarks( wxCommandEvent& event );
294
295     void OnOpenFileGeneric( wxCommandEvent& event );
296     void OnOpenFileSimple( wxCommandEvent& event );
297     void OnOpenFile( wxCommandEvent& event );
298     void OnOpenDisc( wxCommandEvent& event );
299     void OnOpenNet( wxCommandEvent& event );
300     void OnOpenSat( wxCommandEvent& event );
301
302     void OnPopupMenu( wxCommandEvent& event );
303
304     void OnIdle( wxIdleEvent& event );
305
306     void OnExitThread( wxCommandEvent& event );
307
308     DECLARE_EVENT_TABLE();
309
310     intf_thread_t *p_intf;
311
312 public:
313     /* Secondary windows */
314     OpenDialog          *p_open_dialog;
315     wxFileDialog        *p_file_dialog;
316     Playlist            *p_playlist_dialog;
317     Messages            *p_messages_dialog;
318     FileInfo            *p_fileinfo_dialog;
319     StreamDialog        *p_streamwizard_dialog;
320     WizardDialog        *p_wizard_dialog;
321     wxFrame             *p_prefs_dialog;
322     wxWindow            *p_bookmarks_dialog;
323     wxFileDialog        *p_file_generic_dialog;
324 };
325
326 /* Open Dialog */
327 WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel);
328 class OpenDialog: public wxFrame
329 {
330 public:
331     /* Constructor */
332     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
333                 int i_access_method, int i_arg = 0  );
334
335     /* Extended Contructor */
336     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
337                 int i_access_method, int i_arg = 0 , int _i_method = 0 );
338     virtual ~OpenDialog();
339
340     int Show();
341     int Show( int i_access_method, int i_arg = 0 );
342
343     void UpdateMRL();
344     void UpdateMRL( int i_access_method );
345
346     wxArrayString mrl;
347
348 private:
349     wxPanel *FilePanel( wxWindow* parent );
350     wxPanel *DiscPanel( wxWindow* parent );
351     wxPanel *NetPanel( wxWindow* parent );
352     wxPanel *V4LPanel( wxWindow* parent );
353
354     ArrayOfAutoBuiltPanel input_tab_array;
355
356     /* Event handlers (these functions should _not_ be virtual) */
357     void OnOk( wxCommandEvent& event );
358     void OnCancel( wxCommandEvent& event );
359
360     void OnPageChange( wxNotebookEvent& event );
361     void OnMRLChange( wxCommandEvent& event );
362
363     /* Event handlers for the file page */
364     void OnFilePanelChange( wxCommandEvent& event );
365     void OnFileBrowse( wxCommandEvent& event );
366
367     /* Event handlers for the disc page */
368     void OnDiscPanelChange( wxCommandEvent& event );
369     void OnDiscTypeChange( wxCommandEvent& event );
370     void OnDiscDeviceChange( wxCommandEvent& event );
371
372     /* Event handlers for the net page */
373     void OnNetPanelChange( wxCommandEvent& event );
374     void OnNetTypeChange( wxCommandEvent& event );
375
376     /* Event handlers for the v4l page */
377     void OnV4LPanelChange( wxCommandEvent& event );
378     void OnV4LTypeChange( wxCommandEvent& event );
379     void OnV4LSettingsChange( wxCommandEvent& event );
380
381     /* Event handlers for the stream output */
382     void OnSubsFileEnable( wxCommandEvent& event );
383     void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
384
385     /* Event handlers for the stream output */
386     void OnSoutEnable( wxCommandEvent& event );
387     void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
388
389     DECLARE_EVENT_TABLE();
390
391     intf_thread_t *p_intf;
392     wxWindow *p_parent;
393     int i_current_access_method;
394     int i_disc_type_selection;
395
396     int i_method; /* Normal or for the stream dialog ? */
397     int i_open_arg;
398
399     wxComboBox *mrl_combo;
400     wxNotebook *notebook;
401
402     /* Controls for the file panel */
403     wxComboBox *file_combo;
404     wxFileDialog *file_dialog;
405
406     /* Controls for the disc panel */
407     wxRadioBox *disc_type;
408     wxTextCtrl *disc_device;
409     wxSpinCtrl *disc_title;
410     wxSpinCtrl *disc_chapter;
411
412     /* The media equivalent name for a DVD names. For example,
413        "Title", is "Track" for a CD-DA */
414     wxStaticText *disc_title_label;
415     wxStaticText *disc_chapter_label;
416     
417     /* Indicates if the disc device control was modified */
418     bool b_disc_device_changed;
419     
420     /* Controls for the net panel */
421     wxRadioBox *net_type;
422     int i_net_type;
423     wxPanel *net_subpanels[4];
424     wxRadioButton *net_radios[4];
425     wxSpinCtrl *net_ports[4];
426     int        i_net_ports[4];
427     wxTextCtrl *net_addrs[4];
428     wxCheckBox *net_ipv6;
429
430     /* Controls for the v4l panel */
431     wxRadioBox *video_type;
432     wxTextCtrl *video_device;
433     wxSpinCtrl *video_channel;
434     wxButton *v4l_button;
435     V4LDialog *v4l_dialog;
436     wxArrayString v4l_mrl;
437
438     /* Controls for the subtitles file */
439     wxButton *subsfile_button;
440     wxCheckBox *subsfile_checkbox;
441     SubsFileDialog *subsfile_dialog;
442     wxArrayString subsfile_mrl;
443
444     /* Controls for the stream output */
445     wxButton *sout_button;
446     wxCheckBox *sout_checkbox;
447     SoutDialog *sout_dialog;
448     wxArrayString sout_mrl;
449 };
450
451 enum
452 {
453     FILE_ACCESS = 0,
454     DISC_ACCESS,
455     NET_ACCESS,
456 #ifndef WIN32
457     V4L_ACCESS,
458 #endif
459     MAX_ACCESS,
460     FILE_SIMPLE_ACCESS
461 };
462
463 /* V4L Dialog */
464 class V4LDialog: public wxDialog
465 {
466 public:
467     /* Constructor */
468     V4LDialog( intf_thread_t *p_intf, wxWindow *p_parent );
469     virtual ~V4LDialog();
470
471     wxArrayString GetOptions();
472
473 private:
474     void UpdateMRL();
475     wxPanel *AudioPanel( wxWindow* parent );
476     wxPanel *CommonPanel( wxWindow* parent );
477     wxPanel *BitratePanel( wxWindow* parent );
478     void    ParseMRL();
479
480     /* Event handlers (these functions should _not_ be virtual) */
481     void OnOk( wxCommandEvent& event );
482     void OnCancel( wxCommandEvent& event );
483     void OnMRLChange( wxCommandEvent& event );
484     void OnAudioEnable( wxCommandEvent& event );
485     void OnAudioChange( wxCommandEvent& event );
486     void OnAudioChannel( wxCommandEvent& event );
487     void OnSizeEnable( wxCommandEvent& event );
488     void OnSize( wxCommandEvent& event );
489     void OnNormEnable( wxCommandEvent& event );
490     void OnNorm( wxCommandEvent& event );
491     void OnFrequencyEnable( wxCommandEvent& event );
492     void OnFrequency( wxCommandEvent& event );
493     void OnBitrateEnable( wxCommandEvent& event );
494     void OnBitrate( wxCommandEvent& event );
495     void OnMaxBitrateEnable( wxCommandEvent& event );
496     void OnMaxBitrate( wxCommandEvent& event );
497
498     DECLARE_EVENT_TABLE();
499
500     intf_thread_t *p_intf;
501     wxWindow *p_parent;
502
503     wxComboBox *mrl_combo;
504
505     int i_access_type;
506
507     /* Controls for the v4l advanced options */
508     wxPanel *common_subpanel;
509     wxPanel *common_panel;
510     wxCheckBox *size_checkbox;
511     wxComboBox *size_combo;
512     wxCheckBox *norm_checkbox;
513     wxComboBox *norm_combo;
514     wxCheckBox *frequency_checkbox;
515     wxSpinCtrl *frequency;
516
517     wxPanel *audio_subpanel;
518     wxPanel *audio_panel;
519     wxCheckBox *audio_checkbox;
520     wxTextCtrl *audio_device;
521     wxSpinCtrl *audio_channel;
522
523     wxPanel *bitrate_subpanel;
524     wxPanel *bitrate_panel;
525     wxCheckBox *bitrate_checkbox;
526     wxSpinCtrl *bitrate;
527     wxCheckBox *maxbitrate_checkbox;
528     wxSpinCtrl *maxbitrate;
529
530 };
531
532 /* Stream output Dialog */
533 enum
534 {
535     PLAY_ACCESS_OUT = 0,
536     FILE_ACCESS_OUT,
537     HTTP_ACCESS_OUT,
538     MMSH_ACCESS_OUT,
539     UDP_ACCESS_OUT,
540     RTP_ACCESS_OUT,
541     ACCESS_OUT_NUM
542 };
543
544 enum
545 {
546     TS_ENCAPSULATION = 0,
547     PS_ENCAPSULATION,
548     MPEG1_ENCAPSULATION,
549     OGG_ENCAPSULATION,
550     RAW_ENCAPSULATION,
551     ASF_ENCAPSULATION,
552     AVI_ENCAPSULATION,
553     MP4_ENCAPSULATION,
554     MOV_ENCAPSULATION,
555     ENCAPS_NUM
556 };
557
558 enum
559 {
560     ANN_MISC_SOUT = 0,
561     MISC_SOUT_NUM
562 };
563
564 class SoutDialog: public wxDialog
565 {
566 public:
567     /* Constructor */
568     SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
569     virtual ~SoutDialog();
570
571     wxArrayString GetOptions();
572
573 private:
574     void UpdateMRL();
575     wxPanel *AccessPanel( wxWindow* parent );
576     wxPanel *MiscPanel( wxWindow* parent );
577     wxPanel *EncapsulationPanel( wxWindow* parent );
578     wxPanel *TranscodingPanel( wxWindow* parent );
579     void    ParseMRL();
580
581     /* Event handlers (these functions should _not_ be virtual) */
582     void OnOk( wxCommandEvent& event );
583     void OnCancel( wxCommandEvent& event );
584     void OnMRLChange( wxCommandEvent& event );
585     void OnAccessTypeChange( wxCommandEvent& event );
586
587     /* Event handlers for the file access output */
588     void OnFileChange( wxCommandEvent& event );
589     void OnFileBrowse( wxCommandEvent& event );
590     void OnFileDump( wxCommandEvent& event );
591
592     /* Event handlers for the net access output */
593     void OnNetChange( wxCommandEvent& event );
594
595     /* Event specific to the announce address */
596     void OnAnnounceAddrChange( wxCommandEvent& event );
597
598     /* Event handlers for the encapsulation panel */
599     void OnEncapsulationChange( wxCommandEvent& event );
600
601     /* Event handlers for the transcoding panel */
602     void OnTranscodingEnable( wxCommandEvent& event );
603     void OnTranscodingChange( wxCommandEvent& event );
604
605     /* Event handlers for the misc panel */
606     void OnSAPMiscChange( wxCommandEvent& event );
607     void OnSLPMiscChange( wxCommandEvent& event );
608
609     DECLARE_EVENT_TABLE();
610
611     intf_thread_t *p_intf;
612     wxWindow *p_parent;
613
614     wxComboBox *mrl_combo;
615
616     /* Controls for the access outputs */
617     wxPanel *access_panel;
618     wxPanel *access_subpanels[ACCESS_OUT_NUM];
619     wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
620
621     int i_access_type;
622
623     wxComboBox *file_combo;
624     wxCheckBox *dump_checkbox;
625     wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
626     wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
627
628     /* Controls for the SAP announces */
629     wxPanel *misc_panel;
630     wxPanel *misc_subpanels[MISC_SOUT_NUM];
631     wxCheckBox *sap_checkbox;
632     wxCheckBox *slp_checkbox;
633     wxTextCtrl *announce_addr;
634
635     /* Controls for the encapsulation */
636     wxPanel *encapsulation_panel;
637     wxRadioButton *encapsulation_radios[ENCAPS_NUM];
638     int i_encapsulation_type;
639
640     /* Controls for transcoding */
641     wxPanel *transcoding_panel;
642     wxCheckBox *video_transc_checkbox;
643     wxComboBox *video_codec_combo;
644     wxComboBox *audio_codec_combo;
645     wxCheckBox *audio_transc_checkbox;
646     wxComboBox *video_bitrate_combo;
647     wxComboBox *audio_bitrate_combo;
648     wxComboBox *audio_channels_combo;
649     wxComboBox *video_scale_combo;
650 };
651
652 /* Subtitles File Dialog */
653 class SubsFileDialog: public wxDialog
654 {
655 public:
656     /* Constructor */
657     SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
658     virtual ~SubsFileDialog();
659
660     wxComboBox *file_combo;
661     wxComboBox *encoding_combo;
662     wxSpinCtrl *delay_spinctrl;
663     wxSpinCtrl *fps_spinctrl;
664
665 private:
666     /* Event handlers (these functions should _not_ be virtual) */
667     void OnOk( wxCommandEvent& event );
668     void OnCancel( wxCommandEvent& event );
669     void OnFileBrowse( wxCommandEvent& event );
670
671     DECLARE_EVENT_TABLE();
672
673     intf_thread_t *p_intf;
674     wxWindow *p_parent;
675 };
676
677 /* Stream */
678 class StreamDialog: public wxFrame
679 {
680 public:
681     /* Constructor */
682     StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent );
683     virtual ~StreamDialog();
684
685 private:
686     void OnClose( wxCommandEvent& event );
687     void OnOpen( wxCommandEvent& event );
688     void OnSout( wxCommandEvent& event );
689     void OnStart( wxCommandEvent& event );
690
691     DECLARE_EVENT_TABLE();
692
693     intf_thread_t *p_intf;
694
695     wxStaticText *step2_label;
696     wxStaticText *step3_label;
697     wxButton *sout_button;
698     wxButton *start_button;
699     wxArrayString mrl;
700     wxArrayString sout_mrl;
701     OpenDialog *p_open_dialog;
702     SoutDialog *p_sout_dialog;
703 };
704
705 /* Wizard */
706 class WizardDialog : public wxWizard
707 {
708 public:
709     /* Constructor */
710     WizardDialog( intf_thread_t *p_intf, wxWindow *p_parent );
711     virtual ~WizardDialog();
712     void SetTranscode( char *vcodec, int vb, char *acodec,int ab);
713     void SetMrl( const char *mrl );
714     void SetStream( char *method, char *address );
715     void SetTranscodeOut( char *address );
716     void SetAction( int i_action );
717     int  GetAction();
718     void SetMux( char *mux );
719     void Run();
720     int i_action;
721
722 private:
723     int vb,ab;
724     char *vcodec,*acodec,*method,*address,*mrl,*mux;
725     DECLARE_EVENT_TABLE();
726
727     intf_thread_t *p_intf;
728 };
729
730
731 /* Preferences Dialog */
732 class PrefsDialog: public wxFrame
733 {
734 public:
735     /* Constructor */
736     PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
737     virtual ~PrefsDialog();
738
739 private:
740     wxPanel *PrefsPanel( wxWindow* parent );
741
742     /* Event handlers (these functions should _not_ be virtual) */
743     void OnOk( wxCommandEvent& event );
744     void OnCancel( wxCommandEvent& event );
745     void OnSave( wxCommandEvent& event );
746     void OnResetAll( wxCommandEvent& event );
747     void OnAdvanced( wxCommandEvent& event );
748
749     DECLARE_EVENT_TABLE();
750
751     intf_thread_t *p_intf;
752
753     PrefsTreeCtrl *prefs_tree;
754 };
755
756 /* Messages */
757 class Messages: public wxFrame
758 {
759 public:
760     /* Constructor */
761     Messages( intf_thread_t *p_intf, wxWindow *p_parent );
762     virtual ~Messages();
763     bool Show( bool show = TRUE );
764     void UpdateLog();
765
766 private:
767     /* Event handlers (these functions should _not_ be virtual) */
768     void OnClose( wxCommandEvent& event );
769     void OnClear( wxCommandEvent& event );
770     void OnSaveLog( wxCommandEvent& event );
771
772     DECLARE_EVENT_TABLE();
773
774     intf_thread_t *p_intf;
775     wxTextCtrl *textctrl;
776     wxTextAttr *info_attr;
777     wxTextAttr *err_attr;
778     wxTextAttr *warn_attr;
779     wxTextAttr *dbg_attr;
780
781     wxFileDialog *save_log_dialog;
782
783     vlc_bool_t b_verbose;
784 };
785
786 /* Playlist */
787 class Playlist: public wxFrame
788 {
789 public:
790     /* Constructor */
791     Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
792     virtual ~Playlist();
793
794     void UpdatePlaylist();
795     void ShowPlaylist( bool show );
796     void UpdateItem( int );
797
798     bool b_need_update;
799
800 private:
801     void DeleteItem( int item );
802     void ShowInfos( int item );
803
804     /* Event handlers (these functions should _not_ be virtual) */
805     void OnAddFile( wxCommandEvent& event );
806     void OnAddMRL( wxCommandEvent& event );
807     void OnClose( wxCommandEvent& event );
808     void OnSearch( wxCommandEvent& event );
809     void OnEnDis( wxCommandEvent& event );
810     void OnInfos( wxCommandEvent& event );
811     void OnSearchTextChange( wxCommandEvent& event );
812     void OnOpen( wxCommandEvent& event );
813     void OnSave( wxCommandEvent& event );
814
815     void OnSort( wxCommandEvent& event );
816     void OnColSelect( wxListEvent& event );
817
818     void OnUp( wxCommandEvent& event);
819     void OnDown( wxCommandEvent& event);
820
821     void OnEnableSelection( wxCommandEvent& event );
822     void OnDisableSelection( wxCommandEvent& event );
823     void OnInvertSelection( wxCommandEvent& event );
824     void OnDeleteSelection( wxCommandEvent& event );
825     void OnSelectAll( wxCommandEvent& event );
826     void OnRandom( wxCommandEvent& event );
827     void OnRepeat( wxCommandEvent& event );
828     void OnLoop ( wxCommandEvent& event );
829     void OnActivateItem( wxListEvent& event );
830     void OnKeyDown( wxListEvent& event );
831     void OnNewGroup( wxCommandEvent& event );
832
833     /* Popup functions */
834     void OnPopup( wxListEvent& event );
835     void OnPopupPlay( wxMenuEvent& event );
836     void OnPopupDel( wxMenuEvent& event );
837     void OnPopupEna( wxMenuEvent& event );
838     void OnPopupInfo( wxMenuEvent& event );
839     void Rebuild();
840
841     /* Custom events */
842     void OnPlaylistEvent( wxCommandEvent& event );
843
844     wxTextCtrl *search_text;
845     wxButton *search_button;
846     DECLARE_EVENT_TABLE();
847
848     wxMenu *popup_menu;
849
850     ItemInfoDialog *iteminfo_dialog;
851
852     intf_thread_t *p_intf;
853     wxListView *listview;
854     wxTreeCtrl *treeview;
855     int i_update_counter;
856     int i_sort_mode;
857
858     int i_popup_item;
859
860     int i_title_sorted;
861     int i_author_sorted;
862     int i_group_sorted;
863     int i_duration_sorted;
864 };
865
866 class NewGroup: public wxDialog
867 {
868 public:
869     /* Constructor */
870     NewGroup( intf_thread_t *p_intf, wxWindow *p_parent );
871     virtual ~NewGroup();
872
873 private:
874
875     /* Event handlers (these functions should _not_ be virtual) */
876     void OnOk( wxCommandEvent& event );
877     void OnCancel( wxCommandEvent& event );
878
879     DECLARE_EVENT_TABLE();
880
881     intf_thread_t *p_intf;
882     wxTextCtrl *groupname;
883
884 protected:
885     friend class Playlist;
886     friend class ItemInfoDialog;
887     char *psz_name;
888 };
889
890 /* ItemInfo Dialog */
891 class ItemInfoDialog: public wxDialog
892 {
893 public:
894     /* Constructor */
895     ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
896                     wxWindow *p_parent );
897     virtual ~ItemInfoDialog();
898
899     wxArrayString GetOptions();
900
901 private:
902     wxPanel *InfoPanel( wxWindow* parent );
903     wxPanel *GroupPanel( wxWindow* parent );
904
905     /* Event handlers (these functions should _not_ be virtual) */
906     void OnOk( wxCommandEvent& event );
907     void OnCancel( wxCommandEvent& event );
908     void OnNewGroup( wxCommandEvent& event );
909
910     void UpdateInfo();
911
912     DECLARE_EVENT_TABLE();
913
914     intf_thread_t *p_intf;
915     playlist_item_t *p_item;
916     wxWindow *p_parent;
917
918     /* Controls for the iteminfo dialog box */
919     wxPanel *info_subpanel;
920     wxPanel *info_panel;
921
922     wxPanel *group_subpanel;
923     wxPanel *group_panel;
924
925     wxTextCtrl *uri_text;
926     wxTextCtrl *name_text;
927     wxTextCtrl *author_text;
928
929     wxTreeCtrl *info_tree;
930     wxTreeItemId info_root;
931
932     wxCheckBox *enabled_checkbox;
933     wxComboBox *group_combo;
934     int ids_array[100];
935 };
936
937
938 /* File Info */
939 class FileInfo: public wxFrame
940 {
941 public:
942     /* Constructor */
943     FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
944     virtual ~FileInfo();
945     void UpdateFileInfo();
946
947 private:
948     void OnClose( wxCommandEvent& event );
949
950     DECLARE_EVENT_TABLE();
951
952     intf_thread_t *p_intf;
953     wxTreeCtrl *fileinfo_tree;
954     wxTreeItemId fileinfo_root;
955     wxString fileinfo_root_label;
956
957 };
958
959
960 #if !defined(__WXX11__)
961 /* Drag and Drop class */
962 class DragAndDrop: public wxFileDropTarget
963 {
964 public:
965     DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE );
966
967     virtual bool OnDropFiles( wxCoord x, wxCoord y,
968                               const wxArrayString& filenames );
969
970 private:
971     intf_thread_t *p_intf;
972     vlc_bool_t b_enqueue;
973 };
974 #endif
975 } // end of wxvlc namespace
976
977 /* Menus */
978 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
979 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
980 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
981 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
982 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
983
984 namespace wxvlc
985 {
986 class MenuEvtHandler : public wxEvtHandler
987 {
988 public:
989     MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
990     virtual ~MenuEvtHandler();
991
992     void OnMenuEvent( wxCommandEvent& event );
993     void OnShowDialog( wxCommandEvent& event );
994
995 private:
996
997     DECLARE_EVENT_TABLE()
998
999     intf_thread_t *p_intf;
1000     Interface *p_main_interface;
1001 };
1002
1003 } // end of wxvlc namespace
1004 using namespace wxvlc;
1005
1006 static inline int ConvertHotkeyModifiers( int i_hotkey )
1007 {
1008     int i_accel_flags = 0;
1009     if( i_hotkey & KEY_MODIFIER_ALT ) i_accel_flags |= wxACCEL_ALT;
1010     if( i_hotkey & KEY_MODIFIER_CTRL ) i_accel_flags |= wxACCEL_CTRL;
1011     if( i_hotkey & KEY_MODIFIER_SHIFT ) i_accel_flags |= wxACCEL_SHIFT;
1012     return i_accel_flags;
1013 }
1014
1015 static inline int ConvertHotkey( int i_hotkey )
1016 {
1017     int i_key = i_hotkey & ~KEY_MODIFIER;
1018     if( i_key & KEY_ASCII ) return i_key & KEY_ASCII;
1019     else if( i_key & KEY_SPECIAL )
1020     {
1021         switch ( i_key )
1022         {
1023         case KEY_LEFT: return WXK_LEFT;
1024         case KEY_RIGHT: return WXK_RIGHT;
1025         case KEY_UP: return WXK_UP;
1026         case KEY_DOWN: return WXK_DOWN;
1027         case KEY_SPACE: return WXK_SPACE;
1028         case KEY_ENTER: return WXK_RETURN;
1029         case KEY_F1: return WXK_F1;
1030         case KEY_F2: return WXK_F2;
1031         case KEY_F3: return WXK_F3;
1032         case KEY_F4: return WXK_F4;
1033         case KEY_F5: return WXK_F5;
1034         case KEY_F6: return WXK_F6;
1035         case KEY_F7: return WXK_F7;
1036         case KEY_F8: return WXK_F8;
1037         case KEY_F9: return WXK_F9;
1038         case KEY_F10: return WXK_F10;
1039         case KEY_F11: return WXK_F11;
1040         case KEY_F12: return WXK_F12;
1041         case KEY_HOME: return WXK_HOME;
1042         case KEY_END: return WXK_HOME;
1043         case KEY_MENU: return WXK_MENU;
1044         case KEY_ESC: return WXK_ESCAPE;
1045         case KEY_PAGEUP: return WXK_PRIOR;
1046         case KEY_PAGEDOWN: return WXK_NEXT;
1047         case KEY_TAB: return WXK_TAB;
1048         case KEY_BACKSPACE: return WXK_BACK;
1049         }
1050     }
1051     return 0;
1052 }