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