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