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