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