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