]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/wxwindows.h
214f4967782b24ed3cf276d3467f4c8ed733c307
[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.89 2004/02/16 17:14:39 zorglub 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     int i_open_arg;
379
380     wxComboBox *mrl_combo;
381     wxNotebook *notebook;
382
383     /* Controls for the file panel */
384     wxComboBox *file_combo;
385     wxFileDialog *file_dialog;
386
387     /* Controls for the disc panel */
388     wxRadioBox *disc_type;
389     wxTextCtrl *disc_device;
390     wxSpinCtrl *disc_title;
391     wxSpinCtrl *disc_chapter;
392
393     /* The media equivalent name for a DVD names. For example,
394        "Title", is "Track" for a CD-DA */
395     wxStaticText *disc_title_label;
396     wxStaticText *disc_chapter_label;
397     
398     /* Indicates if the disc device control was modified */
399     bool b_disc_device_changed;
400     
401     /* Controls for the net panel */
402     wxRadioBox *net_type;
403     int i_net_type;
404     wxPanel *net_subpanels[4];
405     wxRadioButton *net_radios[4];
406     wxSpinCtrl *net_ports[4];
407     int        i_net_ports[4];
408     wxTextCtrl *net_addrs[4];
409     wxCheckBox *net_ipv6;
410
411     /* Controls for the v4l panel */
412     wxRadioBox *video_type;
413     wxTextCtrl *video_device;
414     wxSpinCtrl *video_channel;
415     wxButton *v4l_button;
416     V4LDialog *v4l_dialog;
417     wxArrayString v4l_mrl;
418
419     /* Controls for the subtitles file */
420     wxButton *subsfile_button;
421     wxCheckBox *subsfile_checkbox;
422     SubsFileDialog *subsfile_dialog;
423     wxArrayString subsfile_mrl;
424
425     /* Controls for the stream output */
426     wxButton *sout_button;
427     wxCheckBox *sout_checkbox;
428     SoutDialog *sout_dialog;
429     wxArrayString sout_mrl;
430 };
431
432 enum
433 {
434     FILE_ACCESS = 0,
435     DISC_ACCESS,
436     NET_ACCESS,
437 #ifndef WIN32
438     V4L_ACCESS,
439 #endif
440     MAX_ACCESS,
441     FILE_SIMPLE_ACCESS
442 };
443
444 /* V4L Dialog */
445 class V4LDialog: public wxDialog
446 {
447 public:
448     /* Constructor */
449     V4LDialog( intf_thread_t *p_intf, wxWindow *p_parent );
450     virtual ~V4LDialog();
451
452     wxArrayString GetOptions();
453
454 private:
455     void UpdateMRL();
456     wxPanel *AudioPanel( wxWindow* parent );
457     wxPanel *CommonPanel( wxWindow* parent );
458     wxPanel *BitratePanel( wxWindow* parent );
459     void    ParseMRL();
460
461     /* Event handlers (these functions should _not_ be virtual) */
462     void OnOk( wxCommandEvent& event );
463     void OnCancel( wxCommandEvent& event );
464     void OnMRLChange( wxCommandEvent& event );
465     void OnAudioEnable( wxCommandEvent& event );
466     void OnAudioChange( wxCommandEvent& event );
467     void OnAudioChannel( wxCommandEvent& event );
468     void OnSizeEnable( wxCommandEvent& event );
469     void OnSize( wxCommandEvent& event );
470     void OnNormEnable( wxCommandEvent& event );
471     void OnNorm( wxCommandEvent& event );
472     void OnFrequencyEnable( wxCommandEvent& event );
473     void OnFrequency( wxCommandEvent& event );
474     void OnBitrateEnable( wxCommandEvent& event );
475     void OnBitrate( wxCommandEvent& event );
476     void OnMaxBitrateEnable( wxCommandEvent& event );
477     void OnMaxBitrate( wxCommandEvent& event );
478
479     DECLARE_EVENT_TABLE();
480
481     intf_thread_t *p_intf;
482     wxWindow *p_parent;
483
484     wxComboBox *mrl_combo;
485
486     int i_access_type;
487
488     /* Controls for the v4l advanced options */
489     wxPanel *common_subpanel;
490     wxPanel *common_panel;
491     wxCheckBox *size_checkbox;
492     wxComboBox *size_combo;
493     wxCheckBox *norm_checkbox;
494     wxComboBox *norm_combo;
495     wxCheckBox *frequency_checkbox;
496     wxSpinCtrl *frequency;
497
498     wxPanel *audio_subpanel;
499     wxPanel *audio_panel;
500     wxCheckBox *audio_checkbox;
501     wxTextCtrl *audio_device;
502     wxSpinCtrl *audio_channel;
503
504     wxPanel *bitrate_subpanel;
505     wxPanel *bitrate_panel;
506     wxCheckBox *bitrate_checkbox;
507     wxSpinCtrl *bitrate;
508     wxCheckBox *maxbitrate_checkbox;
509     wxSpinCtrl *maxbitrate;
510
511 };
512
513 /* Stream output Dialog */
514 enum
515 {
516     PLAY_ACCESS_OUT = 0,
517     FILE_ACCESS_OUT,
518     HTTP_ACCESS_OUT,
519     MMSH_ACCESS_OUT,
520     UDP_ACCESS_OUT,
521     RTP_ACCESS_OUT,
522     ACCESS_OUT_NUM
523 };
524
525 enum
526 {
527     TS_ENCAPSULATION = 0,
528     PS_ENCAPSULATION,
529     MPEG1_ENCAPSULATION,
530     OGG_ENCAPSULATION,
531     RAW_ENCAPSULATION,
532     ASF_ENCAPSULATION,
533     AVI_ENCAPSULATION,
534     MP4_ENCAPSULATION,
535     MOV_ENCAPSULATION,
536     ENCAPS_NUM
537 };
538
539 enum
540 {
541     ANN_MISC_SOUT = 0,
542     MISC_SOUT_NUM
543 };
544
545 class SoutDialog: public wxDialog
546 {
547 public:
548     /* Constructor */
549     SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
550     virtual ~SoutDialog();
551
552     wxArrayString GetOptions();
553
554 private:
555     void UpdateMRL();
556     wxPanel *AccessPanel( wxWindow* parent );
557     wxPanel *MiscPanel( wxWindow* parent );
558     wxPanel *EncapsulationPanel( wxWindow* parent );
559     wxPanel *TranscodingPanel( wxWindow* parent );
560     void    ParseMRL();
561
562     /* Event handlers (these functions should _not_ be virtual) */
563     void OnOk( wxCommandEvent& event );
564     void OnCancel( wxCommandEvent& event );
565     void OnMRLChange( wxCommandEvent& event );
566     void OnAccessTypeChange( wxCommandEvent& event );
567
568     /* Event handlers for the file access output */
569     void OnFileChange( wxCommandEvent& event );
570     void OnFileBrowse( wxCommandEvent& event );
571     void OnFileDump( wxCommandEvent& event );
572
573     /* Event handlers for the net access output */
574     void OnNetChange( wxCommandEvent& event );
575
576     /* Event specific to the announce address */
577     void OnAnnounceAddrChange( wxCommandEvent& event );
578
579     /* Event handlers for the encapsulation panel */
580     void OnEncapsulationChange( wxCommandEvent& event );
581
582     /* Event handlers for the transcoding panel */
583     void OnTranscodingEnable( wxCommandEvent& event );
584     void OnTranscodingChange( wxCommandEvent& event );
585
586     /* Event handlers for the misc panel */
587     void OnSAPMiscChange( wxCommandEvent& event );
588     void OnSLPMiscChange( wxCommandEvent& event );
589
590     DECLARE_EVENT_TABLE();
591
592     intf_thread_t *p_intf;
593     wxWindow *p_parent;
594
595     wxComboBox *mrl_combo;
596
597     /* Controls for the access outputs */
598     wxPanel *access_panel;
599     wxPanel *access_subpanels[ACCESS_OUT_NUM];
600     wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
601
602     int i_access_type;
603
604     wxComboBox *file_combo;
605     wxCheckBox *dump_checkbox;
606     wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
607     wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
608
609     /* Controls for the SAP announces */
610     wxPanel *misc_panel;
611     wxPanel *misc_subpanels[MISC_SOUT_NUM];
612     wxCheckBox *sap_checkbox;
613     wxCheckBox *slp_checkbox;
614     wxTextCtrl *announce_addr;
615
616     /* Controls for the encapsulation */
617     wxPanel *encapsulation_panel;
618     wxRadioButton *encapsulation_radios[ENCAPS_NUM];
619     int i_encapsulation_type;
620
621     /* Controls for transcoding */
622     wxPanel *transcoding_panel;
623     wxCheckBox *video_transc_checkbox;
624     wxComboBox *video_codec_combo;
625     wxComboBox *audio_codec_combo;
626     wxCheckBox *audio_transc_checkbox;
627     wxComboBox *video_bitrate_combo;
628     wxComboBox *audio_bitrate_combo;
629     wxComboBox *audio_channels_combo;
630     wxComboBox *video_scale_combo;
631 };
632
633 /* Subtitles File Dialog */
634 class SubsFileDialog: public wxDialog
635 {
636 public:
637     /* Constructor */
638     SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
639     virtual ~SubsFileDialog();
640
641     wxComboBox *file_combo;
642     wxComboBox *encoding_combo;
643     wxSpinCtrl *delay_spinctrl;
644     wxSpinCtrl *fps_spinctrl;
645
646 private:
647     /* Event handlers (these functions should _not_ be virtual) */
648     void OnOk( wxCommandEvent& event );
649     void OnCancel( wxCommandEvent& event );
650     void OnFileBrowse( wxCommandEvent& event );
651
652     DECLARE_EVENT_TABLE();
653
654     intf_thread_t *p_intf;
655     wxWindow *p_parent;
656 };
657
658 /* Stream */
659 class StreamDialog: public wxFrame
660 {
661 public:
662     /* Constructor */
663     StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent );
664     virtual ~StreamDialog();
665
666 private:
667     void OnClose( wxCommandEvent& event );
668     void OnOpen( wxCommandEvent& event );
669     void OnSout( wxCommandEvent& event );
670     void OnStart( wxCommandEvent& event );
671
672     DECLARE_EVENT_TABLE();
673
674     intf_thread_t *p_intf;
675
676     wxStaticText *step2_label;
677     wxStaticText *step3_label;
678     wxButton *sout_button;
679     wxButton *start_button;
680     wxArrayString mrl;
681     wxArrayString sout_mrl;
682     OpenDialog *p_open_dialog;
683     SoutDialog *p_sout_dialog;
684 };
685
686
687
688 /* Preferences Dialog */
689 class PrefsTreeCtrl;
690 class PrefsDialog: public wxFrame
691 {
692 public:
693     /* Constructor */
694     PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
695     virtual ~PrefsDialog();
696
697 private:
698     wxPanel *PrefsPanel( wxWindow* parent );
699
700     /* Event handlers (these functions should _not_ be virtual) */
701     void OnOk( wxCommandEvent& event );
702     void OnCancel( wxCommandEvent& event );
703     void OnSave( wxCommandEvent& event );
704     void OnResetAll( wxCommandEvent& event );
705     void OnAdvanced( wxCommandEvent& event );
706
707     DECLARE_EVENT_TABLE();
708
709     intf_thread_t *p_intf;
710
711     PrefsTreeCtrl *prefs_tree;
712 };
713
714 /* Messages */
715 class Messages: public wxFrame
716 {
717 public:
718     /* Constructor */
719     Messages( intf_thread_t *p_intf, wxWindow *p_parent );
720     virtual ~Messages();
721     bool Show( bool show = TRUE );
722     void UpdateLog();
723
724 private:
725     /* Event handlers (these functions should _not_ be virtual) */
726     void OnClose( wxCommandEvent& event );
727     void OnClear( wxCommandEvent& event );
728     void OnSaveLog( wxCommandEvent& event );
729
730     DECLARE_EVENT_TABLE();
731
732     intf_thread_t *p_intf;
733     wxTextCtrl *textctrl;
734     wxTextAttr *info_attr;
735     wxTextAttr *err_attr;
736     wxTextAttr *warn_attr;
737     wxTextAttr *dbg_attr;
738
739     wxFileDialog *save_log_dialog;
740
741     vlc_bool_t b_verbose;
742 };
743
744 /* Playlist */
745 class ItemInfoDialog;
746 class NewGroup;
747 class ExportPlaylist;
748 class Playlist: public wxFrame
749 {
750 public:
751     /* Constructor */
752     Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
753     virtual ~Playlist();
754
755     void UpdatePlaylist();
756     void ShowPlaylist( bool show );
757     void UpdateItem( int );
758
759     bool b_need_update;
760     vlc_mutex_t lock;
761
762 private:
763     void DeleteItem( int item );
764     void ShowInfos( int item );
765
766     /* Event handlers (these functions should _not_ be virtual) */
767     void OnAddFile( wxCommandEvent& event );
768     void OnAddMRL( wxCommandEvent& event );
769     void OnClose( wxCommandEvent& event );
770     void OnSearch( wxCommandEvent& event );
771     void OnEnDis( wxCommandEvent& event );
772     void OnInfos( wxCommandEvent& event );
773     void OnSearchTextChange( wxCommandEvent& event );
774     void OnOpen( wxCommandEvent& event );
775     void OnSave( wxCommandEvent& event );
776
777     void OnSort( wxCommandEvent& event );
778     void OnColSelect( wxListEvent& event );
779
780     void OnUp( wxCommandEvent& event);
781     void OnDown( wxCommandEvent& event);
782
783     void OnEnableSelection( wxCommandEvent& event );
784     void OnDisableSelection( wxCommandEvent& event );
785     void OnInvertSelection( wxCommandEvent& event );
786     void OnDeleteSelection( wxCommandEvent& event );
787     void OnSelectAll( wxCommandEvent& event );
788     void OnRandom( wxCommandEvent& event );
789     void OnRepeat( wxCommandEvent& event );
790     void OnLoop ( wxCommandEvent& event );
791     void OnActivateItem( wxListEvent& event );
792     void OnKeyDown( wxListEvent& event );
793     void OnNewGroup( wxCommandEvent& event );
794
795     /* Popup functions */
796     void OnPopup( wxListEvent& event );
797     void OnPopupPlay( wxMenuEvent& event );
798     void OnPopupDel( wxMenuEvent& event );
799     void OnPopupEna( wxMenuEvent& event );
800     void OnPopupInfo( wxMenuEvent& event );
801     void Rebuild();
802
803     wxTextCtrl *search_text;
804     wxButton *search_button;
805     DECLARE_EVENT_TABLE();
806
807     wxMenu *popup_menu;
808
809     ItemInfoDialog *iteminfo_dialog;
810
811     intf_thread_t *p_intf;
812     wxListView *listview;
813     wxTreeCtrl *treeview;
814     int i_update_counter;
815     int i_sort_mode;
816
817     int i_popup_item;
818
819     int i_title_sorted;
820     int i_author_sorted;
821     int i_group_sorted;
822     int i_duration_sorted;
823 };
824
825
826 class NewGroup: public wxDialog
827 {
828 public:
829     /* Constructor */
830     NewGroup( intf_thread_t *p_intf, wxWindow *p_parent );
831     virtual ~NewGroup();
832
833 private:
834
835     /* Event handlers (these functions should _not_ be virtual) */
836     void OnOk( wxCommandEvent& event );
837     void OnCancel( wxCommandEvent& event );
838
839     DECLARE_EVENT_TABLE();
840
841     intf_thread_t *p_intf;
842     wxTextCtrl *groupname;
843
844 protected:
845     friend class Playlist;
846     friend class ItemInfoDialog;
847     char *psz_name;
848 };
849
850 /* ItemInfo Dialog */
851 class ItemInfoDialog: public wxDialog
852 {
853 public:
854     /* Constructor */
855     ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
856                     wxWindow *p_parent );
857     virtual ~ItemInfoDialog();
858
859     wxArrayString GetOptions();
860
861 private:
862     wxPanel *InfoPanel( wxWindow* parent );
863     wxPanel *GroupPanel( wxWindow* parent );
864
865     /* Event handlers (these functions should _not_ be virtual) */
866     void OnOk( wxCommandEvent& event );
867     void OnCancel( wxCommandEvent& event );
868     void OnNewGroup( wxCommandEvent& event );
869
870     void UpdateInfo();
871
872     DECLARE_EVENT_TABLE();
873
874     intf_thread_t *p_intf;
875     playlist_item_t *p_item;
876     wxWindow *p_parent;
877
878     /* Controls for the iteminfo dialog box */
879     wxPanel *info_subpanel;
880     wxPanel *info_panel;
881
882     wxPanel *group_subpanel;
883     wxPanel *group_panel;
884
885     wxTextCtrl *uri_text;
886     wxTextCtrl *name_text;
887     wxTextCtrl *author_text;
888
889     wxTreeCtrl *info_tree;
890     wxTreeItemId info_root;
891
892     wxCheckBox *enabled_checkbox;
893     wxComboBox *group_combo;
894     int ids_array[100];
895 };
896
897
898 /* File Info */
899 class FileInfo: public wxFrame
900 {
901 public:
902     /* Constructor */
903     FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
904     virtual ~FileInfo();
905     void UpdateFileInfo();
906
907 private:
908     void OnClose( wxCommandEvent& event );
909
910     DECLARE_EVENT_TABLE();
911
912     intf_thread_t *p_intf;
913     wxTreeCtrl *fileinfo_tree;
914     wxTreeItemId fileinfo_root;
915     wxString fileinfo_root_label;
916
917 };
918
919
920 #if !defined(__WXX11__)
921 /* Drag and Drop class */
922 class DragAndDrop: public wxFileDropTarget
923 {
924 public:
925     DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE );
926
927     virtual bool OnDropFiles( wxCoord x, wxCoord y,
928                               const wxArrayString& filenames );
929
930 private:
931     intf_thread_t *p_intf;
932     vlc_bool_t b_enqueue;
933 };
934 #endif
935
936 /* Menus */
937 void PopupMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
938                 const wxPoint& pos );
939 wxMenu *SettingsMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
940 wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
941 wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
942 wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
943
944 class MenuEvtHandler : public wxEvtHandler
945 {
946 public:
947     MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
948     virtual ~MenuEvtHandler();
949
950     void OnMenuEvent( wxCommandEvent& event );
951     void OnShowDialog( wxCommandEvent& event );
952
953 private:
954
955     DECLARE_EVENT_TABLE()
956
957     intf_thread_t *p_intf;
958     Interface *p_main_interface;
959 };
960
961 class Menu: public wxMenu
962 {
963 public:
964     /* Constructor */
965     Menu( intf_thread_t *p_intf, wxWindow *p_parent, int i_count,
966           char **ppsz_names, int *pi_objects, int i_start_id );
967     virtual ~Menu();
968
969 private:
970     /* Event handlers (these functions should _not_ be virtual) */
971     void OnClose( wxCommandEvent& event );
972     void OnShowDialog( wxCommandEvent& event );
973     void OnEntrySelected( wxCommandEvent& event );
974
975     wxMenu *Menu::CreateDummyMenu();
976     void   Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
977     wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t * );
978
979     DECLARE_EVENT_TABLE();
980
981     intf_thread_t *p_intf;
982
983     int  i_item_id;
984 };
985
986 static inline int ConvertHotkeyModifiers( int i_hotkey )
987 {
988     int i_accel_flags = 0;
989     if( i_hotkey & KEY_MODIFIER_ALT ) i_accel_flags |= wxACCEL_ALT;
990     if( i_hotkey & KEY_MODIFIER_CTRL ) i_accel_flags |= wxACCEL_CTRL;
991     if( i_hotkey & KEY_MODIFIER_SHIFT ) i_accel_flags |= wxACCEL_SHIFT;
992     return i_accel_flags;
993 }
994
995 static inline int ConvertHotkey( int i_hotkey )
996 {
997     int i_key = i_hotkey & ~KEY_MODIFIER;
998     if( i_key & KEY_ASCII ) return i_key & KEY_ASCII;
999     else if( i_key & KEY_SPECIAL )
1000     {
1001         switch ( i_key )
1002         {
1003         case KEY_LEFT: return WXK_LEFT;
1004         case KEY_RIGHT: return WXK_RIGHT;
1005         case KEY_UP: return WXK_UP;
1006         case KEY_DOWN: return WXK_DOWN;
1007         case KEY_SPACE: return WXK_SPACE;
1008         case KEY_ENTER: return WXK_RETURN;
1009         case KEY_F1: return WXK_F1;
1010         case KEY_F2: return WXK_F2;
1011         case KEY_F3: return WXK_F3;
1012         case KEY_F4: return WXK_F4;
1013         case KEY_F5: return WXK_F5;
1014         case KEY_F6: return WXK_F6;
1015         case KEY_F7: return WXK_F7;
1016         case KEY_F8: return WXK_F8;
1017         case KEY_F9: return WXK_F9;
1018         case KEY_F10: return WXK_F10;
1019         case KEY_F11: return WXK_F11;
1020         case KEY_F12: return WXK_F12;
1021         case KEY_HOME: return WXK_HOME;
1022         case KEY_END: return WXK_HOME;
1023         case KEY_MENU: return WXK_MENU;
1024         case KEY_ESC: return WXK_ESCAPE;
1025         case KEY_PAGEUP: return WXK_PRIOR;
1026         case KEY_PAGEDOWN: return WXK_NEXT;
1027         case KEY_TAB: return WXK_TAB;
1028         case KEY_BACKSPACE: return WXK_BACK;
1029         }
1030     }
1031     return 0;
1032 }