]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/wxwindows.h
wx: (hopefully) fixed a compilation error, reported by robux
[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 class WindowSettings;
97
98 /*****************************************************************************
99  * intf_sys_t: description and status of wxwindows interface
100  *****************************************************************************/
101 struct intf_sys_t
102 {
103     /* the wx parent window */
104     wxWindow            *p_wxwindow;
105     wxIcon              *p_icon;
106
107     /* window settings */
108     WindowSettings      *p_window_settings;
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     unsigned            i_playlist_usage;
128
129     /* Send an event to show a dialog */
130     void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
131                              intf_dialog_args_t *p_arg );
132
133     /* Popup menu */
134     wxMenu              *p_popup_menu;
135
136     /* Hotkeys */
137     int                 i_first_hotkey_event;
138     int                 i_hotkeys;
139
140     /* Embedded vout */
141     VideoWindow         *p_video_window;
142     wxBoxSizer          *p_video_sizer;
143
144     /* Aout */
145     aout_instance_t     *p_aout;
146 };
147
148 /*****************************************************************************
149  * Prototypes
150  *****************************************************************************/
151 wxArrayString SeparateEntries( wxString );
152 wxWindow *CreateVideoWindow( intf_thread_t *p_intf, wxWindow *p_parent );
153 wxWindow *BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent );
154 wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
155
156 namespace wxvlc
157 {
158 class Interface;
159 class OpenDialog;
160 class SoutDialog;
161 class SubsFileDialog;
162 class Playlist;
163 class Messages;
164 class FileInfo;
165 class StreamDialog;
166 class WizardDialog;
167 class ItemInfoDialog;
168 class NewGroup;
169 class ExportPlaylist;
170
171 /*****************************************************************************
172  * Classes declarations.
173  *****************************************************************************/
174 /* Timer */
175 class Timer: public wxTimer
176 {
177 public:
178     /* Constructor */
179     Timer( intf_thread_t *p_intf, Interface *p_main_interface );
180     virtual ~Timer();
181
182     virtual void Notify();
183
184 private:
185     intf_thread_t *p_intf;
186     Interface *p_main_interface;
187     vlc_bool_t b_init;
188     int i_old_playing_status;
189     int i_old_rate;
190     vlc_bool_t b_old_seekable;
191     vlc_bool_t b_disc_shown;
192 };
193
194
195 /* Extended panel */
196 class ExtraPanel: public wxPanel
197 {
198 public:
199     /* Constructor */
200     ExtraPanel( intf_thread_t *p_intf, wxWindow *p_parent );
201     virtual ~ExtraPanel();
202
203     wxStaticBox *adjust_box;
204     wxButton *restoredefaults_button;
205     wxSlider *brightness_slider;
206     wxSlider *contrast_slider;
207     wxSlider *saturation_slider;
208     wxSlider *hue_slider;
209     wxSlider *gamma_slider;
210
211     wxStaticBox *other_box;
212     wxComboBox *ratio_combo;
213
214     char *psz_bands;
215     float f_preamp;
216     vlc_bool_t b_update;
217
218 private:
219
220     wxPanel *VideoPanel( wxWindow * );
221     wxPanel *EqzPanel( wxWindow * );
222     wxPanel *AudioPanel( wxWindow * );
223
224     wxNotebook *notebook;
225
226     wxCheckBox *eq_chkbox;
227
228     wxCheckBox *eq_2p_chkbox;
229
230     wxSlider *smooth_slider;
231
232     wxSlider *preamp_slider;
233     wxStaticText * preamp_text;
234
235     int i_smooth;
236     wxWindow *p_parent;
237
238     wxSlider *band_sliders[10];
239     wxStaticText *band_texts[10];
240
241     int i_values[10];
242
243     void CheckAout();
244
245     /* Event handlers (these functions should _not_ be virtual) */
246
247     void OnEnableAdjust( wxCommandEvent& );
248     void OnEnableEqualizer( wxCommandEvent& );
249     void OnRestoreDefaults( wxCommandEvent& );
250     void OnChangeEqualizer( wxScrollEvent& );
251     void OnAdjustUpdate( wxScrollEvent& );
252     void OnRatio( wxCommandEvent& );
253     void OnFiltersInfo( wxCommandEvent& );
254     void OnSelectFilter( wxCommandEvent& );
255
256     void OnEqSmooth( wxScrollEvent& );
257     void OnPreamp( wxScrollEvent& );
258     void OnEq2Pass( wxCommandEvent& );
259     void OnEqRestore( wxCommandEvent& );
260
261     void OnHeadphone( wxCommandEvent& );
262     void OnNormvol( wxCommandEvent& );
263     void OnNormvolSlider( wxScrollEvent& );
264
265     void OnIdle( wxIdleEvent& );
266
267     DECLARE_EVENT_TABLE();
268
269     intf_thread_t *p_intf;
270     vlc_bool_t b_my_update;
271 };
272
273 #if 0
274 /* Extended Window  */
275 class ExtraWindow: public wxFrame
276 {
277 public:
278     /* Constructor */
279     ExtraWindow( intf_thread_t *p_intf, wxWindow *p_parent, wxPanel *panel );
280     virtual ~ExtraWindow();
281
282 private:
283
284     wxPanel *panel;
285
286     DECLARE_EVENT_TABLE();
287
288     intf_thread_t *p_intf;
289 };
290 #endif
291
292 /* Systray integration */
293 #ifdef wxHAS_TASK_BAR_ICON
294 class Systray: public wxTaskBarIcon
295 {
296 public:
297     Systray( Interface* p_main_interface );
298     virtual ~Systray() {};
299     wxMenu* CreatePopupMenu();
300     void UpdateTooltip( const wxChar* tooltip );
301
302 private:
303     void OnLeftClick( wxTaskBarIconEvent& event );
304     void OnPlayStream ( wxCommandEvent& event );
305     void OnStopStream ( wxCommandEvent& event );
306     void OnPrevStream ( wxCommandEvent& event );
307     void OnNextStream ( wxCommandEvent& event );
308     void OnExit(  wxCommandEvent& event );
309     Interface* p_main_interface;
310     DECLARE_EVENT_TABLE()
311 };
312 #endif
313
314 /* Main Interface */
315 class Interface: public wxFrame
316 {
317 public:
318     /* Constructor */
319     Interface( intf_thread_t *p_intf, long style = wxDEFAULT_FRAME_STYLE );
320     virtual ~Interface();
321     void Init();
322     void TogglePlayButton( int i_playing_status );
323     void Update();
324     void PlayStream();
325     void StopStream();
326     void PrevStream();
327     void NextStream();
328
329     wxBoxSizer  *frame_sizer;
330     wxStatusBar *statusbar;
331
332     wxSlider    *slider;
333     wxWindow    *slider_frame;
334     wxBoxSizer  *slider_sizer;
335     wxPanel     *extra_frame;
336
337     wxPanel         *disc_frame;
338     wxBoxSizer      *disc_sizer;
339     wxBitmapButton  *disc_menu_button;
340     wxBitmapButton  *disc_prev_button;
341     wxBitmapButton  *disc_next_button;
342
343     wxFrame    *extra_window;
344
345     vlc_bool_t b_extra;
346     vlc_bool_t b_undock;
347
348     wxControl  *volctrl;
349
350 #ifdef wxHAS_TASK_BAR_ICON
351     Systray     *p_systray;
352 #endif
353
354 private:
355     void SetupHotkeys();
356     void CreateOurMenuBar();
357     void CreateOurToolBar();
358     void CreateOurExtendedPanel();
359     void CreateOurSlider();
360     void Open( int i_access_method );
361
362     /* Event handlers (these functions should _not_ be virtual) */
363     void OnExit( wxCommandEvent& event );
364     void OnAbout( wxCommandEvent& event );
365
366     void OnOpenFileSimple( wxCommandEvent& event );
367     void OnOpenDir( wxCommandEvent& event );
368     void OnOpenFile( wxCommandEvent& event );
369     void OnOpenDisc( wxCommandEvent& event );
370     void OnOpenNet( wxCommandEvent& event );
371     void OnOpenSat( wxCommandEvent& event );
372
373     void OnExtended( wxCommandEvent& event );
374     //void OnUndock( wxCommandEvent& event );
375
376     void OnBookmarks( wxCommandEvent& event );
377     void OnShowDialog( wxCommandEvent& event );
378     void OnPlayStream( wxCommandEvent& event );
379     void OnStopStream( wxCommandEvent& event );
380     void OnSliderUpdate( wxScrollEvent& event );
381     void OnPrevStream( wxCommandEvent& event );
382     void OnNextStream( wxCommandEvent& event );
383     void OnSlowStream( wxCommandEvent& event );
384     void OnFastStream( wxCommandEvent& event );
385
386     void OnDiscMenu( wxCommandEvent& event );
387     void OnDiscPrev( wxCommandEvent& event );
388     void OnDiscNext( wxCommandEvent& event );
389
390     void OnMenuOpen( wxMenuEvent& event );
391
392 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
393     void OnContextMenu2(wxContextMenuEvent& event);
394 #endif
395     void OnContextMenu(wxMouseEvent& event);
396
397     void OnControlEvent( wxCommandEvent& event );
398
399     DECLARE_EVENT_TABLE();
400
401     Timer *timer;
402     intf_thread_t *p_intf;
403
404 private:
405     int i_old_playing_status;
406
407     /* For auto-generated menus */
408     wxMenu *p_settings_menu;
409     wxMenu *p_audio_menu;
410     wxMenu *p_video_menu;
411     wxMenu *p_navig_menu;
412 };
413
414 /* Open Dialog */
415 WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel);
416 class OpenDialog: public wxDialog
417 {
418 public:
419     /* Constructor */
420     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
421                 int i_access_method, int i_arg = 0  );
422
423     /* Extended Contructor */
424     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
425                 int i_access_method, int i_arg = 0 , int _i_method = 0 );
426     virtual ~OpenDialog();
427
428     int Show();
429     int Show( int i_access_method, int i_arg = 0 );
430
431     void UpdateMRL();
432     void UpdateMRL( int i_access_method );
433
434     wxArrayString mrl;
435
436 private:
437     wxPanel *FilePanel( wxWindow* parent );
438     wxPanel *DiscPanel( wxWindow* parent );
439     wxPanel *NetPanel( wxWindow* parent );
440
441     ArrayOfAutoBuiltPanel input_tab_array;
442
443     /* Event handlers (these functions should _not_ be virtual) */
444     void OnOk( wxCommandEvent& event );
445     void OnCancel( wxCommandEvent& event );
446
447     void OnPageChange( wxNotebookEvent& event );
448     void OnMRLChange( wxCommandEvent& event );
449
450     /* Event handlers for the file page */
451     void OnFilePanelChange( wxCommandEvent& event );
452     void OnFileBrowse( wxCommandEvent& event );
453
454     /* Event handlers for the disc page */
455     void OnDiscPanelChange( wxCommandEvent& event );
456     void OnDiscTypeChange( wxCommandEvent& event );
457     void OnDiscDeviceChange( wxCommandEvent& event );
458
459     /* Event handlers for the net page */
460     void OnNetPanelChange( wxCommandEvent& event );
461     void OnNetTypeChange( wxCommandEvent& event );
462
463     /* Event handlers for the stream output */
464     void OnSubsFileEnable( wxCommandEvent& event );
465     void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
466
467     /* Event handlers for the stream output */
468     void OnSoutEnable( wxCommandEvent& event );
469     void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
470
471     /* Event handlers for the caching option */
472     void OnCachingEnable( wxCommandEvent& event );
473     void OnCachingChange( wxCommandEvent& event );
474
475     DECLARE_EVENT_TABLE();
476
477     intf_thread_t *p_intf;
478     wxWindow *p_parent;
479     int i_current_access_method;
480     int i_disc_type_selection;
481
482     int i_method; /* Normal or for the stream dialog ? */
483     int i_open_arg;
484
485     wxComboBox *mrl_combo;
486     wxNotebook *notebook;
487
488     /* Controls for the file panel */
489     wxComboBox *file_combo;
490     wxFileDialog *file_dialog;
491
492     /* Controls for the disc panel */
493     wxRadioBox *disc_type;
494     wxTextCtrl *disc_device;
495     wxSpinCtrl *disc_title; int i_disc_title;
496     wxSpinCtrl *disc_chapter; int i_disc_chapter;
497     wxSpinCtrl *disc_sub; int i_disc_sub;
498
499     /* The media equivalent name for a DVD names. For example,
500      * "Title", is "Track" for a CD-DA */
501     wxStaticText *disc_title_label;
502     wxStaticText *disc_chapter_label;
503     wxStaticText *disc_sub_label;
504
505     /* Indicates if the disc device control was modified */
506     bool b_disc_device_changed;
507
508     /* Controls for the net panel */
509     wxRadioBox *net_type;
510     int i_net_type;
511     wxPanel *net_subpanels[4];
512     wxRadioButton *net_radios[4];
513     wxSpinCtrl *net_ports[4];
514     int        i_net_ports[4];
515     wxTextCtrl *net_addrs[4];
516     wxCheckBox *net_timeshift;
517     wxCheckBox *net_ipv6;
518
519     /* Controls for the subtitles file */
520     wxButton *subsfile_button;
521     wxCheckBox *subsfile_checkbox;
522     SubsFileDialog *subsfile_dialog;
523     wxArrayString subsfile_mrl;
524
525     /* Controls for the stream output */
526     wxButton *sout_button;
527     wxCheckBox *sout_checkbox;
528     SoutDialog *sout_dialog;
529     wxArrayString sout_mrl;
530
531     /* Controls for the caching options */
532     wxCheckBox *caching_checkbox;
533     wxSpinCtrl *caching_value;
534     int i_caching;
535 };
536
537 enum
538 {
539     FILE_ACCESS = 0,
540     DISC_ACCESS,
541     NET_ACCESS,
542
543     /* Auto-built panels */
544     CAPTURE_ACCESS
545 };
546 #define MAX_ACCESS CAPTURE_ACCESS
547
548 /* Stream output Dialog */
549 enum
550 {
551     PLAY_ACCESS_OUT = 0,
552     FILE_ACCESS_OUT,
553     HTTP_ACCESS_OUT,
554     MMSH_ACCESS_OUT,
555     UDP_ACCESS_OUT,
556     ACCESS_OUT_NUM
557 };
558
559 enum
560 {
561     TS_ENCAPSULATION = 0,
562     PS_ENCAPSULATION,
563     MPEG1_ENCAPSULATION,
564     OGG_ENCAPSULATION,
565     ASF_ENCAPSULATION,
566     MP4_ENCAPSULATION,
567     MOV_ENCAPSULATION,
568     WAV_ENCAPSULATION,
569     RAW_ENCAPSULATION,
570     AVI_ENCAPSULATION,
571     ENCAPS_NUM
572 };
573
574 enum
575 {
576     ANN_MISC_SOUT = 0,
577     MISC_SOUT_NUM
578 };
579
580 class SoutDialog: public wxDialog
581 {
582 public:
583     /* Constructor */
584     SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
585     virtual ~SoutDialog();
586
587     wxArrayString GetOptions();
588
589 private:
590     void UpdateMRL();
591     wxPanel *AccessPanel( wxWindow* parent );
592     wxPanel *MiscPanel( wxWindow* parent );
593     wxPanel *EncapsulationPanel( wxWindow* parent );
594     wxPanel *TranscodingPanel( wxWindow* parent );
595     void    ParseMRL();
596
597     /* Event handlers (these functions should _not_ be virtual) */
598     void OnOk( wxCommandEvent& event );
599     void OnCancel( wxCommandEvent& event );
600     void OnMRLChange( wxCommandEvent& event );
601     void OnAccessTypeChange( wxCommandEvent& event );
602
603     /* Event handlers for the file access output */
604     void OnFileChange( wxCommandEvent& event );
605     void OnFileBrowse( wxCommandEvent& event );
606     void OnFileDump( wxCommandEvent& event );
607
608     /* Event handlers for the net access output */
609     void OnNetChange( wxCommandEvent& event );
610
611     /* Event specific to the announce address */
612     void OnAnnounceGroupChange( wxCommandEvent& event );
613     void OnAnnounceAddrChange( wxCommandEvent& event );
614
615     /* Event handlers for the encapsulation panel */
616     void OnEncapsulationChange( wxCommandEvent& event );
617
618     /* Event handlers for the transcoding panel */
619     void OnTranscodingEnable( wxCommandEvent& event );
620     void OnTranscodingChange( wxCommandEvent& event );
621
622     /* Event handlers for the misc panel */
623     void OnSAPMiscChange( wxCommandEvent& event );
624     void OnSLPMiscChange( wxCommandEvent& event );
625
626     DECLARE_EVENT_TABLE();
627
628     intf_thread_t *p_intf;
629     wxWindow *p_parent;
630
631     wxComboBox *mrl_combo;
632
633     /* Controls for the access outputs */
634     wxPanel *access_panel;
635     wxPanel *access_subpanels[ACCESS_OUT_NUM];
636     wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
637
638     int i_access_type;
639
640     wxComboBox *file_combo;
641     wxCheckBox *dump_checkbox;
642     wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
643     wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
644
645     /* Controls for the SAP announces */
646     wxPanel *misc_panel;
647     wxPanel *misc_subpanels[MISC_SOUT_NUM];
648     wxCheckBox *sap_checkbox;
649     wxCheckBox *slp_checkbox;
650     wxTextCtrl *announce_group;
651     wxTextCtrl *announce_addr;
652
653     /* Controls for the encapsulation */
654     wxPanel *encapsulation_panel;
655     wxRadioButton *encapsulation_radios[ENCAPS_NUM];
656     int i_encapsulation_type;
657
658     /* Controls for transcoding */
659     wxPanel *transcoding_panel;
660     wxCheckBox *video_transc_checkbox;
661     wxComboBox *video_codec_combo;
662     wxComboBox *audio_codec_combo;
663     wxCheckBox *audio_transc_checkbox;
664     wxComboBox *video_bitrate_combo;
665     wxComboBox *audio_bitrate_combo;
666     wxComboBox *audio_channels_combo;
667     wxComboBox *video_scale_combo;
668     wxComboBox *subtitles_codec_combo;
669     wxCheckBox *subtitles_transc_checkbox;
670     wxCheckBox *subtitles_overlay_checkbox;
671
672     /* Misc controls */
673     wxCheckBox *sout_all_checkbox;
674 };
675
676 /* Subtitles File Dialog */
677 class SubsFileDialog: public wxDialog
678 {
679 public:
680     /* Constructor */
681     SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
682     virtual ~SubsFileDialog();
683
684     wxComboBox *file_combo;
685     wxComboBox *encoding_combo;
686     wxComboBox *size_combo;
687     wxComboBox *align_combo;
688     wxSpinCtrl *fps_spinctrl;
689     wxSpinCtrl *delay_spinctrl;
690
691 private:
692     /* Event handlers (these functions should _not_ be virtual) */
693     void OnOk( wxCommandEvent& event );
694     void OnCancel( wxCommandEvent& event );
695     void OnFileBrowse( wxCommandEvent& event );
696
697     DECLARE_EVENT_TABLE();
698
699     intf_thread_t *p_intf;
700     wxWindow *p_parent;
701 };
702
703 /* Stream */
704 class StreamDialog: public wxFrame
705 {
706 public:
707     /* Constructor */
708     StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent );
709     virtual ~StreamDialog();
710
711 private:
712     void OnClose( wxCommandEvent& event );
713     void OnOpen( wxCommandEvent& event );
714     void OnSout( wxCommandEvent& event );
715     void OnStart( wxCommandEvent& event );
716
717     DECLARE_EVENT_TABLE();
718
719     intf_thread_t *p_intf;
720
721     wxStaticText *step2_label;
722     wxStaticText *step3_label;
723     wxButton *sout_button;
724     wxButton *start_button;
725     wxArrayString mrl;
726     wxArrayString sout_mrl;
727     OpenDialog *p_open_dialog;
728     SoutDialog *p_sout_dialog;
729 };
730
731 /* Wizard */
732 class WizardDialog : public wxWizard
733 {
734 public:
735     /* Constructor */
736     WizardDialog( intf_thread_t *p_intf, wxWindow *p_parent,char *, int, int );
737     virtual ~WizardDialog();
738     void SetTranscode( char *vcodec, int vb, char *acodec,int ab);
739     void SetMrl( const char *mrl );
740     void SetTTL( int i_ttl );
741     void SetPartial( int, int );
742     void SetStream( char *method, char *address );
743     void SetTranscodeOut( const char *address );
744     void SetAction( int i_action );
745     int  GetAction();
746     void SetSAP( bool b_enabled, const char *psz_name );
747     void SetMux( char *mux );
748     void Run();
749     int i_action;
750     char *method;
751
752 protected:
753     int vb,ab;
754     int i_from, i_to, i_ttl;
755     char *vcodec , *acodec , *address , *mrl , *mux ;
756     char *psz_sap_name;
757     bool b_sap;
758     DECLARE_EVENT_TABLE();
759
760     intf_thread_t *p_intf;
761 };
762
763
764 /* Preferences Dialog */
765 class PrefsDialog: public wxFrame
766 {
767 public:
768     /* Constructor */
769     PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
770     virtual ~PrefsDialog();
771
772 private:
773     wxPanel *PrefsPanel( wxWindow* parent );
774
775     /* Event handlers (these functions should _not_ be virtual) */
776     void OnOk( wxCommandEvent& event );
777     void OnCancel( wxCommandEvent& event );
778     void OnSave( wxCommandEvent& event );
779     void OnResetAll( wxCommandEvent& event );
780     void OnAdvanced( wxCommandEvent& event );
781
782     DECLARE_EVENT_TABLE();
783
784     intf_thread_t *p_intf;
785
786     PrefsTreeCtrl *prefs_tree;
787 };
788
789 /* Messages */
790 class Messages: public wxFrame
791 {
792 public:
793     /* Constructor */
794     Messages( intf_thread_t *p_intf, wxWindow *p_parent );
795     virtual ~Messages();
796     bool Show( bool show = TRUE );
797     void UpdateLog();
798
799 private:
800     /* Event handlers (these functions should _not_ be virtual) */
801     void OnClose( wxEvent& event );
802     void OnClear( wxCommandEvent& event );
803     void OnSaveLog( wxCommandEvent& event );
804
805     DECLARE_EVENT_TABLE();
806
807     intf_thread_t *p_intf;
808     wxTextCtrl *textctrl;
809     wxTextAttr *info_attr;
810     wxTextAttr *err_attr;
811     wxTextAttr *warn_attr;
812     wxTextAttr *dbg_attr;
813
814     wxFileDialog *save_log_dialog;
815
816     vlc_bool_t b_verbose;
817 };
818
819 /* Playlist */
820 class Playlist: public wxFrame
821 {
822 public:
823     /* Constructor */
824     Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
825     virtual ~Playlist();
826
827     void UpdatePlaylist();
828     void ShowPlaylist( bool show );
829     void UpdateItem( int );
830     void AppendItem( wxCommandEvent& );
831
832     bool b_need_update;
833
834 private:
835     void RemoveItem( int );
836     void DeleteItem( int item );
837     void DeleteNode( playlist_item_t *node );
838
839     /* Event handlers (these functions should _not_ be virtual) */
840
841     /* Menu Handlers */
842     void OnAddFile( wxCommandEvent& event );
843     void OnAddDir( wxCommandEvent& event );
844     void OnAddMRL( wxCommandEvent& event );
845     void OnClose( wxCommandEvent& event );
846
847     void OnEnableSelection( wxCommandEvent& event );
848     void OnDisableSelection( wxCommandEvent& event );
849     void OnInvertSelection( wxCommandEvent& event );
850     void OnDeleteSelection( wxCommandEvent& event );
851     void OnSelectAll( wxCommandEvent& event );
852
853     void OnOpen( wxCommandEvent& event );
854     void OnSave( wxCommandEvent& event );
855
856     /* Search (user) */
857     void OnSearch( wxCommandEvent& event );
858     void OnSearchTextChange( wxCommandEvent& event );
859     wxTextCtrl *search_text;
860     wxButton *search_button;
861     wxTreeItemId search_current;
862
863     void OnEnDis( wxCommandEvent& event );
864
865     /* Sort */
866     int i_sort_mode;
867     void OnSort( wxCommandEvent& event );
868     int i_title_sorted;
869     int i_group_sorted;
870     int i_duration_sorted;
871
872     /* Dynamic menus */
873     void OnMenuEvent( wxCommandEvent& event );
874     void OnMenuOpen( wxMenuEvent& event );
875     wxMenu *p_view_menu;
876     wxMenu *p_sd_menu;
877     wxMenu *ViewMenu();
878     wxMenu *SDMenu();
879
880     void OnUp( wxCommandEvent& event);
881     void OnDown( wxCommandEvent& event);
882
883     void OnRandom( wxCommandEvent& event );
884     void OnRepeat( wxCommandEvent& event );
885     void OnLoop ( wxCommandEvent& event );
886
887     void OnActivateItem( wxTreeEvent& event );
888     void OnKeyDown( wxTreeEvent& event );
889     void OnNewGroup( wxCommandEvent& event );
890
891     /* Popup  */
892     wxMenu *item_popup;
893     wxMenu *node_popup;
894     wxTreeItemId i_popup_item;
895     playlist_item_t *p_popup_item;
896     playlist_item_t *p_popup_parent;
897     void OnPopup( wxContextMenuEvent& event );
898     void OnPopupPlay( wxMenuEvent& event );
899     void OnPopupPreparse( wxMenuEvent& event );
900     void OnPopupSort( wxMenuEvent& event );
901     void OnPopupDel( wxMenuEvent& event );
902     void OnPopupEna( wxMenuEvent& event );
903     void OnPopupInfo( wxMenuEvent& event );
904     void Rebuild( vlc_bool_t );
905
906     void Preparse( playlist_t *p_playlist );
907
908     /* Update */
909     void UpdateNode( playlist_t *, playlist_item_t*, wxTreeItemId );
910     void UpdateNodeChildren( playlist_t *, playlist_item_t*, wxTreeItemId );
911     void CreateNode( playlist_t *, playlist_item_t*, wxTreeItemId );
912     void UpdateTreeItem( playlist_t *, wxTreeItemId );
913
914     /* Search (internal) */
915     int CountItems( wxTreeItemId);
916     wxTreeItemId FindItem( wxTreeItemId, playlist_item_t * );
917     wxTreeItemId FindItem( wxTreeItemId, int );
918     wxTreeItemId FindItemByName( wxTreeItemId, wxString,
919                                  wxTreeItemId, vlc_bool_t *);
920
921     wxTreeItemId saved_tree_item;
922     playlist_item_t *p_saved_item;
923
924
925     /* Custom events */
926     void OnPlaylistEvent( wxCommandEvent& event );
927
928     DECLARE_EVENT_TABLE();
929
930
931     /* Global widgets */
932     wxStatusBar *statusbar;
933     ItemInfoDialog *iteminfo_dialog;
934
935     int i_update_counter;
936
937     intf_thread_t *p_intf;
938     wxTreeCtrl *treectrl;
939     int i_current_view;
940     vlc_bool_t b_changed_view;
941     char **pp_sds;
942
943
944 };
945
946 /* ItemInfo Dialog */
947 class ItemInfoDialog: public wxDialog
948 {
949 public:
950     /* Constructor */
951     ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
952                     wxWindow *p_parent );
953     virtual ~ItemInfoDialog();
954
955     wxArrayString GetOptions();
956
957 private:
958     wxPanel *InfoPanel( wxWindow* parent );
959     wxPanel *GroupPanel( wxWindow* parent );
960
961     /* Event handlers (these functions should _not_ be virtual) */
962     void OnOk( wxCommandEvent& event );
963     void OnCancel( wxCommandEvent& event );
964
965     void UpdateInfo();
966
967     DECLARE_EVENT_TABLE();
968
969     intf_thread_t *p_intf;
970     playlist_item_t *p_item;
971     wxWindow *p_parent;
972
973     /* Controls for the iteminfo dialog box */
974     wxPanel *info_subpanel;
975     wxPanel *info_panel;
976
977     wxPanel *group_subpanel;
978     wxPanel *group_panel;
979
980     wxTextCtrl *uri_text;
981     wxTextCtrl *name_text;
982
983     wxTreeCtrl *info_tree;
984     wxTreeItemId info_root;
985
986 };
987
988
989 /* File Info */
990 class FileInfo: public wxFrame
991 {
992 public:
993     /* Constructor */
994     FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
995     virtual ~FileInfo();
996     void UpdateFileInfo();
997
998     vlc_bool_t b_need_update;
999
1000 private:
1001     void OnClose( wxCommandEvent& event );
1002
1003     DECLARE_EVENT_TABLE();
1004
1005     intf_thread_t *p_intf;
1006     wxTreeCtrl *fileinfo_tree;
1007     wxTreeItemId fileinfo_root;
1008     wxString fileinfo_root_label;
1009
1010 };
1011
1012 #if wxUSE_DRAG_AND_DROP
1013 /* Drag and Drop class */
1014 class DragAndDrop: public wxFileDropTarget
1015 {
1016 public:
1017     DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE );
1018
1019     virtual bool OnDropFiles( wxCoord x, wxCoord y,
1020                               const wxArrayString& filenames );
1021
1022 private:
1023     intf_thread_t *p_intf;
1024     vlc_bool_t b_enqueue;
1025 };
1026 #endif
1027 } // end of wxvlc namespace
1028
1029 /* */
1030 class WindowSettings
1031 {
1032 public:
1033     WindowSettings( intf_thread_t *_p_intf );
1034     virtual ~WindowSettings();
1035     enum
1036     {
1037         ID_SCREEN = -1,
1038         ID_MAIN,
1039         ID_PLAYLIST,
1040         ID_MESSAGES,
1041         ID_FILE_INFO,
1042         ID_BOOKMARKS,
1043
1044         ID_MAX,
1045     };
1046
1047     void SetSettings( int id, bool _b_shown,
1048                       wxPoint p = wxDefaultPosition, wxSize s = wxDefaultSize );
1049     bool GetSettings( int id, bool& _b_shown, wxPoint& p, wxSize& s );
1050
1051     void SetScreen( int i_screen_w, int i_screen_h );
1052
1053 private:
1054     intf_thread_t *p_intf;
1055
1056     int     i_screen_w;
1057     int     i_screen_h;
1058     bool    b_valid[ID_MAX];
1059     bool    b_shown[ID_MAX];
1060     wxPoint position[ID_MAX];
1061     wxSize  size[ID_MAX];
1062 };
1063
1064 /* Menus */
1065 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
1066 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1067 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1068 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1069 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1070
1071 namespace wxvlc
1072 {
1073 class MenuEvtHandler : public wxEvtHandler
1074 {
1075 public:
1076     MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
1077     virtual ~MenuEvtHandler();
1078
1079     void OnMenuEvent( wxCommandEvent& event );
1080     void OnShowDialog( wxCommandEvent& event );
1081
1082 private:
1083
1084     DECLARE_EVENT_TABLE()
1085
1086     intf_thread_t *p_intf;
1087     Interface *p_main_interface;
1088 };
1089
1090 } // end of wxvlc namespace
1091
1092
1093 /*
1094  * wxWindows keeps dead locking because the timer tries to lock the playlist
1095  * when it's already locked somewhere else in the very wxWindows interface
1096  * module. Unless someone implements a "vlc_mutex_trylock", we need that.
1097  */
1098 inline void LockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl )
1099 {
1100     if( p_sys->i_playlist_usage++ == 0)
1101         vlc_mutex_lock( &p_pl->object_lock );
1102 }
1103
1104 inline void UnlockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl )
1105 {
1106     if( --p_sys->i_playlist_usage == 0)
1107         vlc_mutex_unlock( &p_pl->object_lock );
1108 }
1109
1110 using namespace wxvlc;
1111