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