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