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