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