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