]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/wxwindows.h
* wx : simplify some code, remove some useless duplications
[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, *wxConvCurrent)
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 *VideoWindow( 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     RTP_ACCESS_OUT,
526     ACCESS_OUT_NUM
527 };
528
529 enum
530 {
531     TS_ENCAPSULATION = 0,
532     PS_ENCAPSULATION,
533     MPEG1_ENCAPSULATION,
534     OGG_ENCAPSULATION,
535     ASF_ENCAPSULATION,
536     MP4_ENCAPSULATION,
537     MOV_ENCAPSULATION,
538     WAV_ENCAPSULATION,
539     RAW_ENCAPSULATION,
540     AVI_ENCAPSULATION,
541     ENCAPS_NUM
542 };
543
544 enum
545 {
546     ANN_MISC_SOUT = 0,
547     MISC_SOUT_NUM
548 };
549
550 class SoutDialog: public wxDialog
551 {
552 public:
553     /* Constructor */
554     SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
555     virtual ~SoutDialog();
556
557     wxArrayString GetOptions();
558
559 private:
560     void UpdateMRL();
561     wxPanel *AccessPanel( wxWindow* parent );
562     wxPanel *MiscPanel( wxWindow* parent );
563     wxPanel *EncapsulationPanel( wxWindow* parent );
564     wxPanel *TranscodingPanel( wxWindow* parent );
565     void    ParseMRL();
566
567     /* Event handlers (these functions should _not_ be virtual) */
568     void OnOk( wxCommandEvent& event );
569     void OnCancel( wxCommandEvent& event );
570     void OnMRLChange( wxCommandEvent& event );
571     void OnAccessTypeChange( wxCommandEvent& event );
572
573     /* Event handlers for the file access output */
574     void OnFileChange( wxCommandEvent& event );
575     void OnFileBrowse( wxCommandEvent& event );
576     void OnFileDump( wxCommandEvent& event );
577
578     /* Event handlers for the net access output */
579     void OnNetChange( wxCommandEvent& event );
580
581     /* Event specific to the announce address */
582     void OnAnnounceGroupChange( wxCommandEvent& event );
583     void OnAnnounceAddrChange( wxCommandEvent& event );
584     
585     /* Event handlers for the encapsulation panel */
586     void OnEncapsulationChange( wxCommandEvent& event );
587
588     /* Event handlers for the transcoding panel */
589     void OnTranscodingEnable( wxCommandEvent& event );
590     void OnTranscodingChange( wxCommandEvent& event );
591
592     /* Event handlers for the misc panel */
593     void OnSAPMiscChange( wxCommandEvent& event );
594     void OnSLPMiscChange( wxCommandEvent& event );
595
596     DECLARE_EVENT_TABLE();
597
598     intf_thread_t *p_intf;
599     wxWindow *p_parent;
600
601     wxComboBox *mrl_combo;
602
603     /* Controls for the access outputs */
604     wxPanel *access_panel;
605     wxPanel *access_subpanels[ACCESS_OUT_NUM];
606     wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
607
608     int i_access_type;
609
610     wxComboBox *file_combo;
611     wxCheckBox *dump_checkbox;
612     wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
613     wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
614
615     /* Controls for the SAP announces */
616     wxPanel *misc_panel;
617     wxPanel *misc_subpanels[MISC_SOUT_NUM];
618     wxCheckBox *sap_checkbox;
619     wxCheckBox *slp_checkbox;
620     wxTextCtrl *announce_group;
621     wxTextCtrl *announce_addr;
622
623     /* Controls for the encapsulation */
624     wxPanel *encapsulation_panel;
625     wxRadioButton *encapsulation_radios[ENCAPS_NUM];
626     int i_encapsulation_type;
627
628     /* Controls for transcoding */
629     wxPanel *transcoding_panel;
630     wxCheckBox *video_transc_checkbox;
631     wxComboBox *video_codec_combo;
632     wxComboBox *audio_codec_combo;
633     wxCheckBox *audio_transc_checkbox;
634     wxComboBox *video_bitrate_combo;
635     wxComboBox *audio_bitrate_combo;
636     wxComboBox *audio_channels_combo;
637     wxComboBox *video_scale_combo;
638 };
639
640 /* Subtitles File Dialog */
641 class SubsFileDialog: public wxDialog
642 {
643 public:
644     /* Constructor */
645     SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
646     virtual ~SubsFileDialog();
647
648     wxComboBox *file_combo;
649     wxComboBox *encoding_combo;
650     wxComboBox *size_combo;
651     wxComboBox *align_combo;
652     wxSpinCtrl *fps_spinctrl;
653     wxSpinCtrl *delay_spinctrl;
654
655 private:
656     /* Event handlers (these functions should _not_ be virtual) */
657     void OnOk( wxCommandEvent& event );
658     void OnCancel( wxCommandEvent& event );
659     void OnFileBrowse( wxCommandEvent& event );
660
661     DECLARE_EVENT_TABLE();
662
663     intf_thread_t *p_intf;
664     wxWindow *p_parent;
665 };
666
667 /* Stream */
668 class StreamDialog: public wxFrame
669 {
670 public:
671     /* Constructor */
672     StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent );
673     virtual ~StreamDialog();
674
675 private:
676     void OnClose( wxCommandEvent& event );
677     void OnOpen( wxCommandEvent& event );
678     void OnSout( wxCommandEvent& event );
679     void OnStart( wxCommandEvent& event );
680
681     DECLARE_EVENT_TABLE();
682
683     intf_thread_t *p_intf;
684
685     wxStaticText *step2_label;
686     wxStaticText *step3_label;
687     wxButton *sout_button;
688     wxButton *start_button;
689     wxArrayString mrl;
690     wxArrayString sout_mrl;
691     OpenDialog *p_open_dialog;
692     SoutDialog *p_sout_dialog;
693 };
694
695 /* Wizard */
696 class WizardDialog : public wxWizard
697 {
698 public:
699     /* Constructor */
700     WizardDialog( intf_thread_t *p_intf, wxWindow *p_parent,char *, int, int );
701     virtual ~WizardDialog();
702     void SetTranscode( char *vcodec, int vb, char *acodec,int ab);
703     void SetMrl( const char *mrl );
704     void SetTTL( int i_ttl );
705     void SetPartial( int, int );
706     void SetStream( char *method, char *address );
707     void SetTranscodeOut( const char *address );
708     void SetAction( int i_action );
709     int  GetAction();
710     void SetSAP( bool b_enabled, const char *psz_name );
711     void SetMux( char *mux );
712     void Run();
713     int i_action;
714     char *method;
715
716 protected:
717     int vb,ab;
718     int i_from, i_to, i_ttl;
719     char *vcodec , *acodec , *address , *mrl , *mux ;
720     char *psz_sap_name;
721     bool b_sap;
722     DECLARE_EVENT_TABLE();
723
724     intf_thread_t *p_intf;
725 };
726
727
728 /* Preferences Dialog */
729 class PrefsDialog: public wxFrame
730 {
731 public:
732     /* Constructor */
733     PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
734     virtual ~PrefsDialog();
735
736 private:
737     wxPanel *PrefsPanel( wxWindow* parent );
738
739     /* Event handlers (these functions should _not_ be virtual) */
740     void OnOk( wxCommandEvent& event );
741     void OnCancel( wxCommandEvent& event );
742     void OnSave( wxCommandEvent& event );
743     void OnResetAll( wxCommandEvent& event );
744     void OnAdvanced( wxCommandEvent& event );
745
746     DECLARE_EVENT_TABLE();
747
748     intf_thread_t *p_intf;
749
750     PrefsTreeCtrl *prefs_tree;
751 };
752
753 /* Messages */
754 class Messages: public wxFrame
755 {
756 public:
757     /* Constructor */
758     Messages( intf_thread_t *p_intf, wxWindow *p_parent );
759     virtual ~Messages();
760     bool Show( bool show = TRUE );
761     void UpdateLog();
762
763 private:
764     /* Event handlers (these functions should _not_ be virtual) */
765     void OnClose( wxCommandEvent& event );
766     void OnClear( wxCommandEvent& event );
767     void OnSaveLog( wxCommandEvent& event );
768
769     DECLARE_EVENT_TABLE();
770
771     intf_thread_t *p_intf;
772     wxTextCtrl *textctrl;
773     wxTextAttr *info_attr;
774     wxTextAttr *err_attr;
775     wxTextAttr *warn_attr;
776     wxTextAttr *dbg_attr;
777
778     wxFileDialog *save_log_dialog;
779
780     vlc_bool_t b_verbose;
781 };
782
783 /* Playlist */
784 class Playlist: public wxFrame
785 {
786 public:
787     /* Constructor */
788     Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
789     virtual ~Playlist();
790
791     void UpdatePlaylist();
792     void ShowPlaylist( bool show );
793     void UpdateItem( int );
794     void AppendItem( wxCommandEvent& );
795
796     bool b_need_update;
797
798 private:
799     void RemoveItem( int );
800     void DeleteItem( int item );
801     void DeleteNode( playlist_item_t *node );
802
803     /* Event handlers (these functions should _not_ be virtual) */
804
805     /* Menu Handlers */
806     void OnAddFile( wxCommandEvent& event );
807     void OnAddDir( wxCommandEvent& event );
808     void OnAddMRL( wxCommandEvent& event );
809     void OnClose( wxCommandEvent& event );
810
811     void OnEnableSelection( wxCommandEvent& event );
812     void OnDisableSelection( wxCommandEvent& event );
813     void OnInvertSelection( wxCommandEvent& event );
814     void OnDeleteSelection( wxCommandEvent& event );
815     void OnSelectAll( wxCommandEvent& event );
816
817     void OnOpen( wxCommandEvent& event );
818     void OnSave( wxCommandEvent& event );
819
820     /* Search (user) */
821     void OnSearch( wxCommandEvent& event );
822     void OnSearchTextChange( wxCommandEvent& event );
823     wxTextCtrl *search_text;
824     wxButton *search_button;
825     wxTreeItemId search_current;
826
827     void OnEnDis( wxCommandEvent& event );
828
829     /* Sort */
830     int i_sort_mode;
831     void OnSort( wxCommandEvent& event );
832     int i_title_sorted;
833     int i_group_sorted;
834     int i_duration_sorted;
835
836     /* Dynamic menus */
837     void OnMenuEvent( wxCommandEvent& event );
838     void OnMenuOpen( wxMenuEvent& event );
839     wxMenu *p_view_menu;
840     wxMenu *p_sd_menu;
841     wxMenu *ViewMenu();
842     wxMenu *SDMenu();
843
844     void OnUp( wxCommandEvent& event);
845     void OnDown( wxCommandEvent& event);
846
847     void OnRandom( wxCommandEvent& event );
848     void OnRepeat( wxCommandEvent& event );
849     void OnLoop ( wxCommandEvent& event );
850
851     void OnActivateItem( wxTreeEvent& event );
852     void OnKeyDown( wxTreeEvent& event );
853     void OnNewGroup( wxCommandEvent& event );
854
855     /* Popup  */
856     wxMenu *item_popup;
857     wxMenu *node_popup;
858     wxTreeItemId i_popup_item;
859     playlist_item_t *p_popup_item;
860     playlist_item_t *p_popup_parent;
861     void OnPopup( wxContextMenuEvent& event );
862     void OnPopupPlay( wxMenuEvent& event );
863     void OnPopupPreparse( wxMenuEvent& event );
864     void OnPopupSort( wxMenuEvent& event );
865     void OnPopupDel( wxMenuEvent& event );
866     void OnPopupEna( wxMenuEvent& event );
867     void OnPopupInfo( wxMenuEvent& event );
868     void Rebuild();
869
870     void Preparse( playlist_t *p_playlist );
871
872     /* Update */
873     void UpdateNode( playlist_t *, playlist_item_t*, wxTreeItemId );
874     void UpdateNodeChildren( playlist_t *, playlist_item_t*, wxTreeItemId );
875     void CreateNode( playlist_t *, playlist_item_t*, wxTreeItemId );
876     void UpdateTreeItem( playlist_t *, wxTreeItemId );
877
878     /* Search (internal) */
879     int CountItems( wxTreeItemId);
880     wxTreeItemId FindItem( wxTreeItemId, playlist_item_t * );
881     wxTreeItemId FindItem( wxTreeItemId, int );
882     wxTreeItemId FindItemByName( wxTreeItemId, wxString,
883                                  wxTreeItemId, vlc_bool_t *);
884
885     wxTreeItemId saved_tree_item;
886     playlist_item_t *p_saved_item;
887
888
889     /* Custom events */
890     void OnPlaylistEvent( wxCommandEvent& event );
891
892     DECLARE_EVENT_TABLE();
893
894
895     /* Global widgets */
896     wxStatusBar *statusbar;
897     ItemInfoDialog *iteminfo_dialog;
898
899     int i_update_counter;
900
901     intf_thread_t *p_intf;
902     wxTreeCtrl *treectrl;
903     int i_current_view;
904     vlc_bool_t b_changed_view;
905     char **pp_sds;
906
907
908 };
909
910 /* ItemInfo Dialog */
911 class ItemInfoDialog: public wxDialog
912 {
913 public:
914     /* Constructor */
915     ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
916                     wxWindow *p_parent );
917     virtual ~ItemInfoDialog();
918
919     wxArrayString GetOptions();
920
921 private:
922     wxPanel *InfoPanel( wxWindow* parent );
923     wxPanel *GroupPanel( wxWindow* parent );
924
925     /* Event handlers (these functions should _not_ be virtual) */
926     void OnOk( wxCommandEvent& event );
927     void OnCancel( wxCommandEvent& event );
928
929     void UpdateInfo();
930
931     DECLARE_EVENT_TABLE();
932
933     intf_thread_t *p_intf;
934     playlist_item_t *p_item;
935     wxWindow *p_parent;
936
937     /* Controls for the iteminfo dialog box */
938     wxPanel *info_subpanel;
939     wxPanel *info_panel;
940
941     wxPanel *group_subpanel;
942     wxPanel *group_panel;
943
944     wxTextCtrl *uri_text;
945     wxTextCtrl *name_text;
946
947     wxTreeCtrl *info_tree;
948     wxTreeItemId info_root;
949
950 };
951
952
953 /* File Info */
954 class FileInfo: public wxFrame
955 {
956 public:
957     /* Constructor */
958     FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
959     virtual ~FileInfo();
960     void UpdateFileInfo();
961
962     vlc_bool_t b_need_update;
963
964 private:
965     void OnClose( wxCommandEvent& event );
966
967     DECLARE_EVENT_TABLE();
968
969     intf_thread_t *p_intf;
970     wxTreeCtrl *fileinfo_tree;
971     wxTreeItemId fileinfo_root;
972     wxString fileinfo_root_label;
973
974
975 };
976
977 #if wxUSE_DRAG_AND_DROP
978 /* Drag and Drop class */
979 class DragAndDrop: public wxFileDropTarget
980 {
981 public:
982     DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE );
983
984     virtual bool OnDropFiles( wxCoord x, wxCoord y,
985                               const wxArrayString& filenames );
986
987 private:
988     intf_thread_t *p_intf;
989     vlc_bool_t b_enqueue;
990 };
991 #endif
992 } // end of wxvlc namespace
993
994 /* Menus */
995 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
996 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
997 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
998 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
999 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1000
1001 namespace wxvlc
1002 {
1003 class MenuEvtHandler : public wxEvtHandler
1004 {
1005 public:
1006     MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
1007     virtual ~MenuEvtHandler();
1008
1009     void OnMenuEvent( wxCommandEvent& event );
1010     void OnShowDialog( wxCommandEvent& event );
1011
1012 private:
1013
1014     DECLARE_EVENT_TABLE()
1015
1016     intf_thread_t *p_intf;
1017     Interface *p_main_interface;
1018 };
1019
1020 } // end of wxvlc namespace
1021 using namespace wxvlc;