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