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