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