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