]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/wxwindows.h
change the speaker into a mute/unmute button
[vlc] / modules / gui / wxwindows / wxwindows.h
1 /*****************************************************************************
2  * wxwindows.h: private wxWindows interface description
3  *****************************************************************************
4  * Copyright (C) 1999-2005 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 <wx/taskbar.h>
46 #include "vlc_keys.h"
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, wxConvLocal)
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 #define wxL2U(ansi) wxU(ansi)
81
82 #define WRAPCOUNT 80
83
84 #define OPEN_NORMAL 0
85 #define OPEN_STREAM 1
86
87 #define MODE_NONE 0
88 #define MODE_GROUP 1
89 #define MODE_AUTHOR 2
90 #define MODE_TITLE 3
91
92 class DialogsProvider;
93 class PrefsTreeCtrl;
94 class AutoBuiltPanel;
95 class VideoWindow;
96
97 /*****************************************************************************
98  * intf_sys_t: description and status of wxwindows interface
99  *****************************************************************************/
100 struct intf_sys_t
101 {
102     /* the wx parent window */
103     wxWindow            *p_wxwindow;
104     wxIcon              *p_icon;
105
106     /* special actions */
107     vlc_bool_t          b_playing;
108     vlc_bool_t          b_intf_show;                /* interface to be shown */
109
110     /* The input thread */
111     input_thread_t *    p_input;
112
113     /* The slider */
114     int                 i_slider_pos;                     /* slider position */
115     int                 i_slider_oldpos;                /* previous position */
116     vlc_bool_t          b_slider_free;                      /* slider status */
117
118     /* The messages window */
119     msg_subscription_t* p_sub;                  /* message bank subscription */
120
121     /* Playlist management */
122     int                 i_playing;                 /* playlist selected item */
123
124     /* Send an event to show a dialog */
125     void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
126                              intf_dialog_args_t *p_arg );
127
128     /* Popup menu */
129     wxMenu              *p_popup_menu;
130
131     /* Hotkeys */
132     int                 i_first_hotkey_event;
133     int                 i_hotkeys;
134
135     /* Embedded vout */
136     VideoWindow         *p_video_window;
137     wxBoxSizer          *p_video_sizer;
138
139     /* Aout */
140     aout_instance_t     *p_aout;
141 };
142
143 /*****************************************************************************
144  * Prototypes
145  *****************************************************************************/
146 wxArrayString SeparateEntries( wxString );
147 wxWindow *CreateVideoWindow( intf_thread_t *p_intf, wxWindow *p_parent );
148 wxWindow *BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent );
149 wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
150
151 namespace wxvlc
152 {
153 class Interface;
154 class OpenDialog;
155 class SoutDialog;
156 class SubsFileDialog;
157 class Playlist;
158 class Messages;
159 class FileInfo;
160 class StreamDialog;
161 class WizardDialog;
162 class ItemInfoDialog;
163 class NewGroup;
164 class ExportPlaylist;
165
166 /*****************************************************************************
167  * Classes declarations.
168  *****************************************************************************/
169 /* Timer */
170 class Timer: public wxTimer
171 {
172 public:
173     /* Constructor */
174     Timer( intf_thread_t *p_intf, Interface *p_main_interface );
175     virtual ~Timer();
176
177     virtual void Notify();
178
179 private:
180     intf_thread_t *p_intf;
181     Interface *p_main_interface;
182     vlc_bool_t b_init;
183     int i_old_playing_status;
184     int i_old_rate;
185     vlc_bool_t b_old_seekable;
186     vlc_bool_t b_disc_shown;
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 /* Systray integration */
288 #ifdef wxHAS_TASK_BAR_ICON
289 class Systray: public wxTaskBarIcon
290 {
291 public:
292     Systray( Interface* p_main_interface );
293     virtual ~Systray() {};
294     wxMenu* CreatePopupMenu();
295     void UpdateTooltip( const wxChar* tooltip );
296
297 private:
298     void OnLeftClick( wxTaskBarIconEvent& event );
299     void OnPlayStream ( wxCommandEvent& event );
300     void OnStopStream ( wxCommandEvent& event );
301     void OnPrevStream ( wxCommandEvent& event );
302     void OnNextStream ( wxCommandEvent& event );
303     void OnExit(  wxCommandEvent& event );
304     Interface* p_main_interface;
305     DECLARE_EVENT_TABLE()
306 };
307 #endif
308
309 /* Main Interface */
310 class Interface: public wxFrame
311 {
312 public:
313     /* Constructor */
314     Interface( intf_thread_t *p_intf, long style = wxDEFAULT_FRAME_STYLE );
315     virtual ~Interface();
316     void Init();
317     void TogglePlayButton( int i_playing_status );
318     void Update();
319     void PlayStream();
320     void StopStream();
321     void PrevStream();
322     void NextStream();
323
324     wxBoxSizer  *frame_sizer;
325     wxStatusBar *statusbar;
326
327     wxSlider    *slider;
328     wxWindow    *slider_frame;
329     wxBoxSizer  *slider_sizer;
330     wxPanel     *extra_frame;
331
332     wxPanel         *disc_frame;
333     wxBoxSizer      *disc_sizer;
334     wxBitmapButton  *disc_menu_button;
335     wxBitmapButton  *disc_prev_button;
336     wxBitmapButton  *disc_next_button;
337
338     wxFrame    *extra_window;
339
340     vlc_bool_t b_extra;
341     vlc_bool_t b_undock;
342
343     wxGauge     *volctrl;
344 #ifdef wxHAS_TASK_BAR_ICON
345     Systray     *p_systray;
346 #endif
347
348 private:
349     void SetupHotkeys();
350     void CreateOurMenuBar();
351     void CreateOurToolBar();
352     void CreateOurExtendedPanel();
353     void CreateOurSlider();
354     void Open( int i_access_method );
355
356     /* Event handlers (these functions should _not_ be virtual) */
357     void OnExit( wxCommandEvent& event );
358     void OnAbout( wxCommandEvent& event );
359
360     void OnOpenFileSimple( wxCommandEvent& event );
361     void OnOpenDir( wxCommandEvent& event );
362     void OnOpenFile( wxCommandEvent& event );
363     void OnOpenDisc( wxCommandEvent& event );
364     void OnOpenNet( wxCommandEvent& event );
365     void OnOpenSat( wxCommandEvent& event );
366
367     void OnExtended( wxCommandEvent& event );
368     //void OnUndock( wxCommandEvent& event );
369
370     void OnBookmarks( wxCommandEvent& event );
371     void OnShowDialog( wxCommandEvent& event );
372     void OnPlayStream( wxCommandEvent& event );
373     void OnStopStream( wxCommandEvent& event );
374     void OnSliderUpdate( wxScrollEvent& event );
375     void OnPrevStream( wxCommandEvent& event );
376     void OnNextStream( wxCommandEvent& event );
377     void OnSlowStream( wxCommandEvent& event );
378     void OnFastStream( wxCommandEvent& event );
379     void OnMute( wxCommandEvent& event );
380
381     void OnDiscMenu( wxCommandEvent& event );
382     void OnDiscPrev( wxCommandEvent& event );
383     void OnDiscNext( wxCommandEvent& event );
384
385     void OnMenuOpen( wxMenuEvent& event );
386
387 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
388     void OnContextMenu2(wxContextMenuEvent& event);
389 #endif
390     void OnContextMenu(wxMouseEvent& event);
391
392     void OnControlEvent( wxCommandEvent& event );
393
394     DECLARE_EVENT_TABLE();
395
396     Timer *timer;
397     intf_thread_t *p_intf;
398
399 private:
400     int i_old_playing_status;
401
402     /* For auto-generated menus */
403     wxMenu *p_settings_menu;
404     wxMenu *p_audio_menu;
405     wxMenu *p_video_menu;
406     wxMenu *p_navig_menu;
407 };
408
409 /* Open Dialog */
410 WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel);
411 class OpenDialog: public wxDialog
412 {
413 public:
414     /* Constructor */
415     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
416                 int i_access_method, int i_arg = 0  );
417
418     /* Extended Contructor */
419     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
420                 int i_access_method, int i_arg = 0 , int _i_method = 0 );
421     virtual ~OpenDialog();
422
423     int Show();
424     int Show( int i_access_method, int i_arg = 0 );
425
426     void UpdateMRL();
427     void UpdateMRL( int i_access_method );
428
429     wxArrayString mrl;
430
431 private:
432     wxPanel *FilePanel( wxWindow* parent );
433     wxPanel *DiscPanel( wxWindow* parent );
434     wxPanel *NetPanel( wxWindow* parent );
435
436     ArrayOfAutoBuiltPanel input_tab_array;
437
438     /* Event handlers (these functions should _not_ be virtual) */
439     void OnOk( wxCommandEvent& event );
440     void OnCancel( wxCommandEvent& event );
441
442     void OnPageChange( wxNotebookEvent& event );
443     void OnMRLChange( wxCommandEvent& event );
444
445     /* Event handlers for the file page */
446     void OnFilePanelChange( wxCommandEvent& event );
447     void OnFileBrowse( wxCommandEvent& event );
448
449     /* Event handlers for the disc page */
450     void OnDiscPanelChange( wxCommandEvent& event );
451     void OnDiscTypeChange( wxCommandEvent& event );
452     void OnDiscDeviceChange( wxCommandEvent& event );
453
454     /* Event handlers for the net page */
455     void OnNetPanelChange( wxCommandEvent& event );
456     void OnNetTypeChange( wxCommandEvent& event );
457
458     /* Event handlers for the stream output */
459     void OnSubsFileEnable( wxCommandEvent& event );
460     void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
461
462     /* Event handlers for the stream output */
463     void OnSoutEnable( wxCommandEvent& event );
464     void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
465
466     /* Event handlers for the caching option */
467     void OnCachingEnable( wxCommandEvent& event );
468     void OnCachingChange( wxCommandEvent& event );
469
470     DECLARE_EVENT_TABLE();
471
472     intf_thread_t *p_intf;
473     wxWindow *p_parent;
474     int i_current_access_method;
475     int i_disc_type_selection;
476
477     int i_method; /* Normal or for the stream dialog ? */
478     int i_open_arg;
479
480     wxComboBox *mrl_combo;
481     wxNotebook *notebook;
482
483     /* Controls for the file panel */
484     wxComboBox *file_combo;
485     wxFileDialog *file_dialog;
486
487     /* Controls for the disc panel */
488     wxRadioBox *disc_type;
489     wxTextCtrl *disc_device;
490     wxSpinCtrl *disc_title; int i_disc_title;
491     wxSpinCtrl *disc_chapter; int i_disc_chapter;
492     wxSpinCtrl *disc_sub; int i_disc_sub;
493
494     /* The media equivalent name for a DVD names. For example,
495      * "Title", is "Track" for a CD-DA */
496     wxStaticText *disc_title_label;
497     wxStaticText *disc_chapter_label;
498     wxStaticText *disc_sub_label;
499
500     /* Indicates if the disc device control was modified */
501     bool b_disc_device_changed;
502
503     /* Controls for the net panel */
504     wxRadioBox *net_type;
505     int i_net_type;
506     wxPanel *net_subpanels[4];
507     wxRadioButton *net_radios[4];
508     wxSpinCtrl *net_ports[4];
509     int        i_net_ports[4];
510     wxTextCtrl *net_addrs[4];
511     wxCheckBox *net_ipv6;
512
513     /* Controls for the subtitles file */
514     wxButton *subsfile_button;
515     wxCheckBox *subsfile_checkbox;
516     SubsFileDialog *subsfile_dialog;
517     wxArrayString subsfile_mrl;
518
519     /* Controls for the stream output */
520     wxButton *sout_button;
521     wxCheckBox *sout_checkbox;
522     SoutDialog *sout_dialog;
523     wxArrayString sout_mrl;
524
525     /* Controls for the caching options */
526     wxCheckBox *caching_checkbox;
527     wxSpinCtrl *caching_value;
528     int i_caching;
529 };
530
531 enum
532 {
533     FILE_ACCESS = 0,
534     DISC_ACCESS,
535     NET_ACCESS,
536
537     /* Auto-built panels */
538     CAPTURE_ACCESS
539 };
540 #define MAX_ACCESS CAPTURE_ACCESS
541
542 /* Stream output Dialog */
543 enum
544 {
545     PLAY_ACCESS_OUT = 0,
546     FILE_ACCESS_OUT,
547     HTTP_ACCESS_OUT,
548     MMSH_ACCESS_OUT,
549     UDP_ACCESS_OUT,
550     ACCESS_OUT_NUM
551 };
552
553 enum
554 {
555     TS_ENCAPSULATION = 0,
556     PS_ENCAPSULATION,
557     MPEG1_ENCAPSULATION,
558     OGG_ENCAPSULATION,
559     ASF_ENCAPSULATION,
560     MP4_ENCAPSULATION,
561     MOV_ENCAPSULATION,
562     WAV_ENCAPSULATION,
563     RAW_ENCAPSULATION,
564     AVI_ENCAPSULATION,
565     ENCAPS_NUM
566 };
567
568 enum
569 {
570     ANN_MISC_SOUT = 0,
571     MISC_SOUT_NUM
572 };
573
574 class SoutDialog: public wxDialog
575 {
576 public:
577     /* Constructor */
578     SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
579     virtual ~SoutDialog();
580
581     wxArrayString GetOptions();
582
583 private:
584     void UpdateMRL();
585     wxPanel *AccessPanel( wxWindow* parent );
586     wxPanel *MiscPanel( wxWindow* parent );
587     wxPanel *EncapsulationPanel( wxWindow* parent );
588     wxPanel *TranscodingPanel( wxWindow* parent );
589     void    ParseMRL();
590
591     /* Event handlers (these functions should _not_ be virtual) */
592     void OnOk( wxCommandEvent& event );
593     void OnCancel( wxCommandEvent& event );
594     void OnMRLChange( wxCommandEvent& event );
595     void OnAccessTypeChange( wxCommandEvent& event );
596
597     /* Event handlers for the file access output */
598     void OnFileChange( wxCommandEvent& event );
599     void OnFileBrowse( wxCommandEvent& event );
600     void OnFileDump( wxCommandEvent& event );
601
602     /* Event handlers for the net access output */
603     void OnNetChange( wxCommandEvent& event );
604
605     /* Event specific to the announce address */
606     void OnAnnounceGroupChange( wxCommandEvent& event );
607     void OnAnnounceAddrChange( wxCommandEvent& event );
608
609     /* Event handlers for the encapsulation panel */
610     void OnEncapsulationChange( wxCommandEvent& event );
611
612     /* Event handlers for the transcoding panel */
613     void OnTranscodingEnable( wxCommandEvent& event );
614     void OnTranscodingChange( wxCommandEvent& event );
615
616     /* Event handlers for the misc panel */
617     void OnSAPMiscChange( wxCommandEvent& event );
618     void OnSLPMiscChange( wxCommandEvent& event );
619
620     DECLARE_EVENT_TABLE();
621
622     intf_thread_t *p_intf;
623     wxWindow *p_parent;
624
625     wxComboBox *mrl_combo;
626
627     /* Controls for the access outputs */
628     wxPanel *access_panel;
629     wxPanel *access_subpanels[ACCESS_OUT_NUM];
630     wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
631
632     int i_access_type;
633
634     wxComboBox *file_combo;
635     wxCheckBox *dump_checkbox;
636     wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
637     wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
638
639     /* Controls for the SAP announces */
640     wxPanel *misc_panel;
641     wxPanel *misc_subpanels[MISC_SOUT_NUM];
642     wxCheckBox *sap_checkbox;
643     wxCheckBox *slp_checkbox;
644     wxTextCtrl *announce_group;
645     wxTextCtrl *announce_addr;
646
647     /* Controls for the encapsulation */
648     wxPanel *encapsulation_panel;
649     wxRadioButton *encapsulation_radios[ENCAPS_NUM];
650     int i_encapsulation_type;
651
652     /* Controls for transcoding */
653     wxPanel *transcoding_panel;
654     wxCheckBox *video_transc_checkbox;
655     wxComboBox *video_codec_combo;
656     wxComboBox *audio_codec_combo;
657     wxCheckBox *audio_transc_checkbox;
658     wxComboBox *video_bitrate_combo;
659     wxComboBox *audio_bitrate_combo;
660     wxComboBox *audio_channels_combo;
661     wxComboBox *video_scale_combo;
662
663     /* Misc controls */
664     wxCheckBox *sout_all_checkbox;
665 };
666
667 /* Subtitles File Dialog */
668 class SubsFileDialog: public wxDialog
669 {
670 public:
671     /* Constructor */
672     SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
673     virtual ~SubsFileDialog();
674
675     wxComboBox *file_combo;
676     wxComboBox *encoding_combo;
677     wxComboBox *size_combo;
678     wxComboBox *align_combo;
679     wxSpinCtrl *fps_spinctrl;
680     wxSpinCtrl *delay_spinctrl;
681
682 private:
683     /* Event handlers (these functions should _not_ be virtual) */
684     void OnOk( wxCommandEvent& event );
685     void OnCancel( wxCommandEvent& event );
686     void OnFileBrowse( wxCommandEvent& event );
687
688     DECLARE_EVENT_TABLE();
689
690     intf_thread_t *p_intf;
691     wxWindow *p_parent;
692 };
693
694 /* Stream */
695 class StreamDialog: public wxFrame
696 {
697 public:
698     /* Constructor */
699     StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent );
700     virtual ~StreamDialog();
701
702 private:
703     void OnClose( wxCommandEvent& event );
704     void OnOpen( wxCommandEvent& event );
705     void OnSout( wxCommandEvent& event );
706     void OnStart( wxCommandEvent& event );
707
708     DECLARE_EVENT_TABLE();
709
710     intf_thread_t *p_intf;
711
712     wxStaticText *step2_label;
713     wxStaticText *step3_label;
714     wxButton *sout_button;
715     wxButton *start_button;
716     wxArrayString mrl;
717     wxArrayString sout_mrl;
718     OpenDialog *p_open_dialog;
719     SoutDialog *p_sout_dialog;
720 };
721
722 /* Wizard */
723 class WizardDialog : public wxWizard
724 {
725 public:
726     /* Constructor */
727     WizardDialog( intf_thread_t *p_intf, wxWindow *p_parent,char *, int, int );
728     virtual ~WizardDialog();
729     void SetTranscode( char *vcodec, int vb, char *acodec,int ab);
730     void SetMrl( const char *mrl );
731     void SetTTL( int i_ttl );
732     void SetPartial( int, int );
733     void SetStream( char *method, char *address );
734     void SetTranscodeOut( const char *address );
735     void SetAction( int i_action );
736     int  GetAction();
737     void SetSAP( bool b_enabled, const char *psz_name );
738     void SetMux( char *mux );
739     void Run();
740     int i_action;
741     char *method;
742
743 protected:
744     int vb,ab;
745     int i_from, i_to, i_ttl;
746     char *vcodec , *acodec , *address , *mrl , *mux ;
747     char *psz_sap_name;
748     bool b_sap;
749     DECLARE_EVENT_TABLE();
750
751     intf_thread_t *p_intf;
752 };
753
754
755 /* Preferences Dialog */
756 class PrefsDialog: public wxFrame
757 {
758 public:
759     /* Constructor */
760     PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
761     virtual ~PrefsDialog();
762
763 private:
764     wxPanel *PrefsPanel( wxWindow* parent );
765
766     /* Event handlers (these functions should _not_ be virtual) */
767     void OnOk( wxCommandEvent& event );
768     void OnCancel( wxCommandEvent& event );
769     void OnSave( wxCommandEvent& event );
770     void OnResetAll( wxCommandEvent& event );
771     void OnAdvanced( wxCommandEvent& event );
772
773     DECLARE_EVENT_TABLE();
774
775     intf_thread_t *p_intf;
776
777     PrefsTreeCtrl *prefs_tree;
778 };
779
780 /* Messages */
781 class Messages: public wxFrame
782 {
783 public:
784     /* Constructor */
785     Messages( intf_thread_t *p_intf, wxWindow *p_parent );
786     virtual ~Messages();
787     bool Show( bool show = TRUE );
788     void UpdateLog();
789
790 private:
791     /* Event handlers (these functions should _not_ be virtual) */
792     void OnClose( wxCommandEvent& event );
793     void OnClear( wxCommandEvent& event );
794     void OnSaveLog( wxCommandEvent& event );
795
796     DECLARE_EVENT_TABLE();
797
798     intf_thread_t *p_intf;
799     wxTextCtrl *textctrl;
800     wxTextAttr *info_attr;
801     wxTextAttr *err_attr;
802     wxTextAttr *warn_attr;
803     wxTextAttr *dbg_attr;
804
805     wxFileDialog *save_log_dialog;
806
807     vlc_bool_t b_verbose;
808 };
809
810 /* Playlist */
811 class Playlist: public wxFrame
812 {
813 public:
814     /* Constructor */
815     Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
816     virtual ~Playlist();
817
818     void UpdatePlaylist();
819     void ShowPlaylist( bool show );
820     void UpdateItem( int );
821     void AppendItem( wxCommandEvent& );
822
823     bool b_need_update;
824
825 private:
826     void RemoveItem( int );
827     void DeleteItem( int item );
828     void DeleteNode( playlist_item_t *node );
829
830     /* Event handlers (these functions should _not_ be virtual) */
831
832     /* Menu Handlers */
833     void OnAddFile( wxCommandEvent& event );
834     void OnAddDir( wxCommandEvent& event );
835     void OnAddMRL( wxCommandEvent& event );
836     void OnClose( wxCommandEvent& event );
837
838     void OnEnableSelection( wxCommandEvent& event );
839     void OnDisableSelection( wxCommandEvent& event );
840     void OnInvertSelection( wxCommandEvent& event );
841     void OnDeleteSelection( wxCommandEvent& event );
842     void OnSelectAll( wxCommandEvent& event );
843
844     void OnOpen( wxCommandEvent& event );
845     void OnSave( wxCommandEvent& event );
846
847     /* Search (user) */
848     void OnSearch( wxCommandEvent& event );
849     void OnSearchTextChange( wxCommandEvent& event );
850     wxTextCtrl *search_text;
851     wxButton *search_button;
852     wxTreeItemId search_current;
853
854     void OnEnDis( wxCommandEvent& event );
855
856     /* Sort */
857     int i_sort_mode;
858     void OnSort( wxCommandEvent& event );
859     int i_title_sorted;
860     int i_group_sorted;
861     int i_duration_sorted;
862
863     /* Dynamic menus */
864     void OnMenuEvent( wxCommandEvent& event );
865     void OnMenuOpen( wxMenuEvent& event );
866     wxMenu *p_view_menu;
867     wxMenu *p_sd_menu;
868     wxMenu *ViewMenu();
869     wxMenu *SDMenu();
870
871     void OnUp( wxCommandEvent& event);
872     void OnDown( wxCommandEvent& event);
873
874     void OnRandom( wxCommandEvent& event );
875     void OnRepeat( wxCommandEvent& event );
876     void OnLoop ( wxCommandEvent& event );
877
878     void OnActivateItem( wxTreeEvent& event );
879     void OnKeyDown( wxTreeEvent& event );
880     void OnNewGroup( wxCommandEvent& event );
881
882     /* Popup  */
883     wxMenu *item_popup;
884     wxMenu *node_popup;
885     wxTreeItemId i_popup_item;
886     playlist_item_t *p_popup_item;
887     playlist_item_t *p_popup_parent;
888     void OnPopup( wxContextMenuEvent& event );
889     void OnPopupPlay( wxMenuEvent& event );
890     void OnPopupPreparse( wxMenuEvent& event );
891     void OnPopupSort( wxMenuEvent& event );
892     void OnPopupDel( wxMenuEvent& event );
893     void OnPopupEna( wxMenuEvent& event );
894     void OnPopupInfo( wxMenuEvent& event );
895     void Rebuild( vlc_bool_t );
896
897     void Preparse( playlist_t *p_playlist );
898
899     /* Update */
900     void UpdateNode( playlist_t *, playlist_item_t*, wxTreeItemId );
901     void UpdateNodeChildren( playlist_t *, playlist_item_t*, wxTreeItemId );
902     void CreateNode( playlist_t *, playlist_item_t*, wxTreeItemId );
903     void UpdateTreeItem( playlist_t *, wxTreeItemId );
904
905     /* Search (internal) */
906     int CountItems( wxTreeItemId);
907     wxTreeItemId FindItem( wxTreeItemId, playlist_item_t * );
908     wxTreeItemId FindItem( wxTreeItemId, int );
909     wxTreeItemId FindItemByName( wxTreeItemId, wxString,
910                                  wxTreeItemId, vlc_bool_t *);
911
912     wxTreeItemId saved_tree_item;
913     playlist_item_t *p_saved_item;
914
915
916     /* Custom events */
917     void OnPlaylistEvent( wxCommandEvent& event );
918
919     DECLARE_EVENT_TABLE();
920
921
922     /* Global widgets */
923     wxStatusBar *statusbar;
924     ItemInfoDialog *iteminfo_dialog;
925
926     int i_update_counter;
927
928     intf_thread_t *p_intf;
929     wxTreeCtrl *treectrl;
930     int i_current_view;
931     vlc_bool_t b_changed_view;
932     char **pp_sds;
933
934
935 };
936
937 /* ItemInfo Dialog */
938 class ItemInfoDialog: public wxDialog
939 {
940 public:
941     /* Constructor */
942     ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
943                     wxWindow *p_parent );
944     virtual ~ItemInfoDialog();
945
946     wxArrayString GetOptions();
947
948 private:
949     wxPanel *InfoPanel( wxWindow* parent );
950     wxPanel *GroupPanel( wxWindow* parent );
951
952     /* Event handlers (these functions should _not_ be virtual) */
953     void OnOk( wxCommandEvent& event );
954     void OnCancel( wxCommandEvent& event );
955
956     void UpdateInfo();
957
958     DECLARE_EVENT_TABLE();
959
960     intf_thread_t *p_intf;
961     playlist_item_t *p_item;
962     wxWindow *p_parent;
963
964     /* Controls for the iteminfo dialog box */
965     wxPanel *info_subpanel;
966     wxPanel *info_panel;
967
968     wxPanel *group_subpanel;
969     wxPanel *group_panel;
970
971     wxTextCtrl *uri_text;
972     wxTextCtrl *name_text;
973
974     wxTreeCtrl *info_tree;
975     wxTreeItemId info_root;
976
977 };
978
979
980 /* File Info */
981 class FileInfo: public wxFrame
982 {
983 public:
984     /* Constructor */
985     FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
986     virtual ~FileInfo();
987     void UpdateFileInfo();
988
989     vlc_bool_t b_need_update;
990
991 private:
992     void OnClose( wxCommandEvent& event );
993
994     DECLARE_EVENT_TABLE();
995
996     intf_thread_t *p_intf;
997     wxTreeCtrl *fileinfo_tree;
998     wxTreeItemId fileinfo_root;
999     wxString fileinfo_root_label;
1000
1001 };
1002
1003 #if wxUSE_DRAG_AND_DROP
1004 /* Drag and Drop class */
1005 class DragAndDrop: public wxFileDropTarget
1006 {
1007 public:
1008     DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE );
1009
1010     virtual bool OnDropFiles( wxCoord x, wxCoord y,
1011                               const wxArrayString& filenames );
1012
1013 private:
1014     intf_thread_t *p_intf;
1015     vlc_bool_t b_enqueue;
1016 };
1017 #endif
1018 } // end of wxvlc namespace
1019
1020 /* Menus */
1021 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
1022 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1023 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1024 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1025 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1026
1027 namespace wxvlc
1028 {
1029 class MenuEvtHandler : public wxEvtHandler
1030 {
1031 public:
1032     MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
1033     virtual ~MenuEvtHandler();
1034
1035     void OnMenuEvent( wxCommandEvent& event );
1036     void OnShowDialog( wxCommandEvent& event );
1037
1038 private:
1039
1040     DECLARE_EVENT_TABLE()
1041
1042     intf_thread_t *p_intf;
1043     Interface *p_main_interface;
1044 };
1045
1046 } // end of wxvlc namespace
1047 using namespace wxvlc;
1048