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