]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/wxwindows.h
* modules/gui/wxwindows/*:
[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@netcourrier.com>
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 "vlc_keys.h"
45
46 /* Hmmm, work-around for newest wxWin */
47 #ifdef wxStaticCastEvent
48 #   undef wxStaticCastEvent
49 #   define wxStaticCastEvent(type, val) ((type)(val))
50 #endif
51
52 DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
53 DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
54
55 class OpenDialog;
56 class Playlist;
57 class Messages;
58 class FileInfo;
59 class VideoWindow;
60
61 #define SLIDER_MAX_POS 10000
62
63 /* wxU is used to convert ansi/utf8 strings to unicode strings (wchar_t) */
64 #if defined( ENABLE_NLS ) && defined( ENABLE_UTF8 )
65 #if wxUSE_UNICODE
66 #   define wxU(utf8) wxString(utf8, wxConvUTF8)
67 #else
68 #   define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
69 #endif
70 #define ISUTF8 1
71
72 #else // ENABLE_NLS && ENABLE_UTF8
73 #if wxUSE_UNICODE
74 #   define wxU(ansi) wxString(ansi, *wxConvCurrent)
75 #else
76 #   define wxU(ansi) ansi
77 #endif
78 #define ISUTF8 0
79
80 #endif
81
82 /* wxL2U (locale to unicode) is used to convert ansi strings to unicode
83  * strings (wchar_t) */
84 #if wxUSE_UNICODE
85 #   define wxL2U(ansi) wxString(ansi, *wxConvCurrent)
86 #else
87 #   define wxL2U(ansi) ansi
88 #endif
89
90 #define WRAPCOUNT 80
91
92 #define OPEN_NORMAL 0
93 #define OPEN_STREAM 1
94
95 #define MODE_NONE 0
96 #define MODE_GROUP 1
97 #define MODE_AUTHOR 2
98 #define MODE_TITLE 3
99
100 wxArrayString SeparateEntries( wxString );
101
102 /*****************************************************************************
103  * intf_sys_t: description and status of wxwindows interface
104  *****************************************************************************/
105 struct intf_sys_t
106 {
107     /* the wx parent window */
108     wxWindow            *p_wxwindow;
109     wxIcon              *p_icon;
110
111     /* special actions */
112     vlc_bool_t          b_playing;
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     VideoWindow         *p_video_window;
136     wxBoxSizer          *p_video_sizer;
137 };
138
139 /*****************************************************************************
140  * Prototypes
141  *****************************************************************************/
142
143 /*****************************************************************************
144  * Classes declarations.
145  *****************************************************************************/
146 class Interface;
147
148 /* Timer */
149 class Timer: public wxTimer
150 {
151 public:
152     /* Constructor */
153     Timer( intf_thread_t *p_intf, Interface *p_main_interface );
154     virtual ~Timer();
155
156     virtual void Notify();
157
158 private:
159     intf_thread_t *p_intf;
160     Interface *p_main_interface;
161     int i_old_playing_status;
162     int i_old_rate;
163 };
164
165 /* Main Interface */
166 class Interface: public wxFrame
167 {
168 public:
169     /* Constructor */
170     Interface( intf_thread_t *p_intf );
171     virtual ~Interface();
172     void TogglePlayButton( int i_playing_status );
173
174 //    wxFlexGridSizer *frame_sizer;
175     wxBoxSizer  *frame_sizer;
176     wxStatusBar *statusbar;
177
178     wxSlider    *slider;
179     wxWindow    *slider_frame;
180     wxWindow    *extra_frame;
181     wxStaticBox *slider_box;
182
183     vlc_bool_t b_extra;
184
185     wxStaticBox *adjust_box;
186     wxSlider *brightness_slider;
187     wxSlider *contrast_slider;
188     wxSlider *saturation_slider;
189     wxSlider *hue_slider;
190     wxSlider *gamma_slider;
191
192     wxStaticBox *other_box;
193     wxComboBox *ratio_combo;
194
195     wxGauge     *volctrl;
196
197 private:
198     void UpdateAcceleratorTable();
199     void CreateOurMenuBar();
200     void CreateOurToolBar();
201     void CreateOurExtendedPanel();
202     void CreateOurSlider();
203     void Open( int i_access_method );
204
205     /* Event handlers (these functions should _not_ be virtual) */
206     void OnExit( wxCommandEvent& event );
207     void OnAbout( wxCommandEvent& event );
208
209     void OnOpenFileSimple( wxCommandEvent& event );
210     void OnOpenFile( wxCommandEvent& event );
211     void OnOpenDisc( wxCommandEvent& event );
212     void OnOpenNet( wxCommandEvent& event );
213     void OnOpenSat( wxCommandEvent& event );
214     void OnOpenV4L( wxCommandEvent& event );
215     void OnExtended( wxCommandEvent& event );
216     void OnBookmarks( wxCommandEvent& event );
217     void OnShowDialog( wxCommandEvent& event );
218     void OnPlayStream( wxCommandEvent& event );
219     void OnStopStream( wxCommandEvent& event );
220     void OnSliderUpdate( wxScrollEvent& event );
221     void OnPrevStream( wxCommandEvent& event );
222     void OnNextStream( wxCommandEvent& event );
223     void OnSlowStream( wxCommandEvent& event );
224     void OnFastStream( wxCommandEvent& event );
225
226     void OnEnableAdjust( wxCommandEvent& event );
227     void OnHueUpdate( wxScrollEvent& event );
228     void OnContrastUpdate( wxScrollEvent& event );
229     void OnBrightnessUpdate( wxScrollEvent& event );
230     void OnSaturationUpdate( wxScrollEvent& event );
231     void OnGammaUpdate( wxScrollEvent& event );
232
233     void OnRatio( wxCommandEvent& event );
234     void OnEnableVisual( wxCommandEvent& event );
235
236     void OnMenuOpen( wxMenuEvent& event );
237
238 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
239     void OnContextMenu2(wxContextMenuEvent& event);
240 #endif
241     void OnContextMenu(wxMouseEvent& event);
242
243     void UpdateSizeEvent( wxCommandEvent& event );
244
245     DECLARE_EVENT_TABLE();
246
247     Timer *timer;
248     intf_thread_t *p_intf;
249
250 private:
251     int i_old_playing_status;
252
253     /* For auto-generated menus */
254     wxMenu *p_settings_menu;
255     vlc_bool_t b_settings_menu;
256     wxMenu *p_audio_menu;
257     vlc_bool_t b_audio_menu;
258     wxMenu *p_video_menu;
259     vlc_bool_t b_video_menu;
260     wxMenu *p_navig_menu;
261     vlc_bool_t b_navig_menu;
262 };
263
264 class StreamDialog;
265 class BookmarksDialog;
266
267 /* Dialogs Provider */
268 class DialogsProvider: public wxFrame
269 {
270 public:
271     /* Constructor */
272     DialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
273     virtual ~DialogsProvider();
274
275 private:
276     void Open( int i_access_method, int i_arg );
277
278     /* Event handlers (these functions should _not_ be virtual) */
279     void OnExit( wxCommandEvent& event );
280     void OnPlaylist( wxCommandEvent& event );
281     void OnMessages( wxCommandEvent& event );
282     void OnFileInfo( wxCommandEvent& event );
283     void OnPreferences( wxCommandEvent& event );
284     void OnStreamWizardDialog( wxCommandEvent& event );
285     void OnBookmarks( wxCommandEvent& event );
286
287     void OnOpenFileGeneric( wxCommandEvent& event );
288     void OnOpenFileSimple( wxCommandEvent& event );
289     void OnOpenFile( wxCommandEvent& event );
290     void OnOpenDisc( wxCommandEvent& event );
291     void OnOpenNet( wxCommandEvent& event );
292     void OnOpenSat( wxCommandEvent& event );
293
294     void OnPopupMenu( wxCommandEvent& event );
295
296     void OnIdle( wxIdleEvent& event );
297
298     void OnExitThread( wxCommandEvent& event );
299
300     DECLARE_EVENT_TABLE();
301
302     intf_thread_t *p_intf;
303
304 public:
305     /* Secondary windows */
306     OpenDialog          *p_open_dialog;
307     wxFileDialog        *p_file_dialog;
308     Playlist            *p_playlist_dialog;
309     Messages            *p_messages_dialog;
310     FileInfo            *p_fileinfo_dialog;
311     StreamDialog        *p_streamwizard_dialog;
312     wxFrame             *p_prefs_dialog;
313     BookmarksDialog     *p_bookmarks_dialog;
314     wxFileDialog        *p_file_generic_dialog;
315 };
316
317 /* Open Dialog */
318 class AutoBuiltPanel;
319 WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel);
320 class V4LDialog;
321 class SoutDialog;
322 class SubsFileDialog;
323 class OpenDialog: public wxFrame
324 {
325 public:
326     /* Constructor */
327     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
328                 int i_access_method, int i_arg = 0  );
329
330     /* Extended Contructor */
331     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
332                 int i_access_method, int i_arg = 0 , int _i_method = 0 );
333     virtual ~OpenDialog();
334
335     int Show();
336     int Show( int i_access_method, int i_arg = 0 );
337
338     void UpdateMRL();
339     void UpdateMRL( int i_access_method );
340
341     wxArrayString mrl;
342
343 private:
344     wxPanel *FilePanel( wxWindow* parent );
345     wxPanel *DiscPanel( wxWindow* parent );
346     wxPanel *NetPanel( wxWindow* parent );
347     wxPanel *V4LPanel( wxWindow* parent );
348
349     ArrayOfAutoBuiltPanel input_tab_array;
350
351     /* Event handlers (these functions should _not_ be virtual) */
352     void OnOk( wxCommandEvent& event );
353     void OnCancel( wxCommandEvent& event );
354
355     void OnPageChange( wxNotebookEvent& event );
356     void OnMRLChange( wxCommandEvent& event );
357
358     /* Event handlers for the file page */
359     void OnFilePanelChange( wxCommandEvent& event );
360     void OnFileBrowse( wxCommandEvent& event );
361
362     /* Event handlers for the disc page */
363     void OnDiscPanelChange( wxCommandEvent& event );
364     void OnDiscTypeChange( wxCommandEvent& event );
365     void OnDiscDeviceChange( wxCommandEvent& event );
366
367     /* Event handlers for the net page */
368     void OnNetPanelChange( wxCommandEvent& event );
369     void OnNetTypeChange( wxCommandEvent& event );
370
371     /* Event handlers for the v4l page */
372     void OnV4LPanelChange( wxCommandEvent& event );
373     void OnV4LTypeChange( wxCommandEvent& event );
374     void OnV4LSettingsChange( wxCommandEvent& event );
375
376     /* Event handlers for the stream output */
377     void OnSubsFileEnable( wxCommandEvent& event );
378     void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
379
380     /* Event handlers for the stream output */
381     void OnSoutEnable( wxCommandEvent& event );
382     void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
383
384     DECLARE_EVENT_TABLE();
385
386     intf_thread_t *p_intf;
387     wxWindow *p_parent;
388     int i_current_access_method;
389     int i_disc_type_selection;
390
391     int i_method; /* Normal or for the stream dialog ? */
392     int i_open_arg;
393
394     wxComboBox *mrl_combo;
395     wxNotebook *notebook;
396
397     /* Controls for the file panel */
398     wxComboBox *file_combo;
399     wxFileDialog *file_dialog;
400
401     /* Controls for the disc panel */
402     wxRadioBox *disc_type;
403     wxTextCtrl *disc_device;
404     wxSpinCtrl *disc_title;
405     wxSpinCtrl *disc_chapter;
406
407     /* The media equivalent name for a DVD names. For example,
408        "Title", is "Track" for a CD-DA */
409     wxStaticText *disc_title_label;
410     wxStaticText *disc_chapter_label;
411     
412     /* Indicates if the disc device control was modified */
413     bool b_disc_device_changed;
414     
415     /* Controls for the net panel */
416     wxRadioBox *net_type;
417     int i_net_type;
418     wxPanel *net_subpanels[4];
419     wxRadioButton *net_radios[4];
420     wxSpinCtrl *net_ports[4];
421     int        i_net_ports[4];
422     wxTextCtrl *net_addrs[4];
423     wxCheckBox *net_ipv6;
424
425     /* Controls for the v4l panel */
426     wxRadioBox *video_type;
427     wxTextCtrl *video_device;
428     wxSpinCtrl *video_channel;
429     wxButton *v4l_button;
430     V4LDialog *v4l_dialog;
431     wxArrayString v4l_mrl;
432
433     /* Controls for the subtitles file */
434     wxButton *subsfile_button;
435     wxCheckBox *subsfile_checkbox;
436     SubsFileDialog *subsfile_dialog;
437     wxArrayString subsfile_mrl;
438
439     /* Controls for the stream output */
440     wxButton *sout_button;
441     wxCheckBox *sout_checkbox;
442     SoutDialog *sout_dialog;
443     wxArrayString sout_mrl;
444 };
445
446 enum
447 {
448     FILE_ACCESS = 0,
449     DISC_ACCESS,
450     NET_ACCESS,
451 #ifndef WIN32
452     V4L_ACCESS,
453 #endif
454     MAX_ACCESS,
455     FILE_SIMPLE_ACCESS
456 };
457
458 /* V4L Dialog */
459 class V4LDialog: public wxDialog
460 {
461 public:
462     /* Constructor */
463     V4LDialog( intf_thread_t *p_intf, wxWindow *p_parent );
464     virtual ~V4LDialog();
465
466     wxArrayString GetOptions();
467
468 private:
469     void UpdateMRL();
470     wxPanel *AudioPanel( wxWindow* parent );
471     wxPanel *CommonPanel( wxWindow* parent );
472     wxPanel *BitratePanel( wxWindow* parent );
473     void    ParseMRL();
474
475     /* Event handlers (these functions should _not_ be virtual) */
476     void OnOk( wxCommandEvent& event );
477     void OnCancel( wxCommandEvent& event );
478     void OnMRLChange( wxCommandEvent& event );
479     void OnAudioEnable( wxCommandEvent& event );
480     void OnAudioChange( wxCommandEvent& event );
481     void OnAudioChannel( wxCommandEvent& event );
482     void OnSizeEnable( wxCommandEvent& event );
483     void OnSize( wxCommandEvent& event );
484     void OnNormEnable( wxCommandEvent& event );
485     void OnNorm( wxCommandEvent& event );
486     void OnFrequencyEnable( wxCommandEvent& event );
487     void OnFrequency( wxCommandEvent& event );
488     void OnBitrateEnable( wxCommandEvent& event );
489     void OnBitrate( wxCommandEvent& event );
490     void OnMaxBitrateEnable( wxCommandEvent& event );
491     void OnMaxBitrate( wxCommandEvent& event );
492
493     DECLARE_EVENT_TABLE();
494
495     intf_thread_t *p_intf;
496     wxWindow *p_parent;
497
498     wxComboBox *mrl_combo;
499
500     int i_access_type;
501
502     /* Controls for the v4l advanced options */
503     wxPanel *common_subpanel;
504     wxPanel *common_panel;
505     wxCheckBox *size_checkbox;
506     wxComboBox *size_combo;
507     wxCheckBox *norm_checkbox;
508     wxComboBox *norm_combo;
509     wxCheckBox *frequency_checkbox;
510     wxSpinCtrl *frequency;
511
512     wxPanel *audio_subpanel;
513     wxPanel *audio_panel;
514     wxCheckBox *audio_checkbox;
515     wxTextCtrl *audio_device;
516     wxSpinCtrl *audio_channel;
517
518     wxPanel *bitrate_subpanel;
519     wxPanel *bitrate_panel;
520     wxCheckBox *bitrate_checkbox;
521     wxSpinCtrl *bitrate;
522     wxCheckBox *maxbitrate_checkbox;
523     wxSpinCtrl *maxbitrate;
524
525 };
526
527 /* Stream output Dialog */
528 enum
529 {
530     PLAY_ACCESS_OUT = 0,
531     FILE_ACCESS_OUT,
532     HTTP_ACCESS_OUT,
533     MMSH_ACCESS_OUT,
534     UDP_ACCESS_OUT,
535     RTP_ACCESS_OUT,
536     ACCESS_OUT_NUM
537 };
538
539 enum
540 {
541     TS_ENCAPSULATION = 0,
542     PS_ENCAPSULATION,
543     MPEG1_ENCAPSULATION,
544     OGG_ENCAPSULATION,
545     RAW_ENCAPSULATION,
546     ASF_ENCAPSULATION,
547     AVI_ENCAPSULATION,
548     MP4_ENCAPSULATION,
549     MOV_ENCAPSULATION,
550     ENCAPS_NUM
551 };
552
553 enum
554 {
555     ANN_MISC_SOUT = 0,
556     MISC_SOUT_NUM
557 };
558
559 class SoutDialog: public wxDialog
560 {
561 public:
562     /* Constructor */
563     SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
564     virtual ~SoutDialog();
565
566     wxArrayString GetOptions();
567
568 private:
569     void UpdateMRL();
570     wxPanel *AccessPanel( wxWindow* parent );
571     wxPanel *MiscPanel( wxWindow* parent );
572     wxPanel *EncapsulationPanel( wxWindow* parent );
573     wxPanel *TranscodingPanel( wxWindow* parent );
574     void    ParseMRL();
575
576     /* Event handlers (these functions should _not_ be virtual) */
577     void OnOk( wxCommandEvent& event );
578     void OnCancel( wxCommandEvent& event );
579     void OnMRLChange( wxCommandEvent& event );
580     void OnAccessTypeChange( wxCommandEvent& event );
581
582     /* Event handlers for the file access output */
583     void OnFileChange( wxCommandEvent& event );
584     void OnFileBrowse( wxCommandEvent& event );
585     void OnFileDump( wxCommandEvent& event );
586
587     /* Event handlers for the net access output */
588     void OnNetChange( wxCommandEvent& event );
589
590     /* Event specific to the announce address */
591     void OnAnnounceAddrChange( wxCommandEvent& event );
592
593     /* Event handlers for the encapsulation panel */
594     void OnEncapsulationChange( wxCommandEvent& event );
595
596     /* Event handlers for the transcoding panel */
597     void OnTranscodingEnable( wxCommandEvent& event );
598     void OnTranscodingChange( wxCommandEvent& event );
599
600     /* Event handlers for the misc panel */
601     void OnSAPMiscChange( wxCommandEvent& event );
602     void OnSLPMiscChange( wxCommandEvent& event );
603
604     DECLARE_EVENT_TABLE();
605
606     intf_thread_t *p_intf;
607     wxWindow *p_parent;
608
609     wxComboBox *mrl_combo;
610
611     /* Controls for the access outputs */
612     wxPanel *access_panel;
613     wxPanel *access_subpanels[ACCESS_OUT_NUM];
614     wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
615
616     int i_access_type;
617
618     wxComboBox *file_combo;
619     wxCheckBox *dump_checkbox;
620     wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
621     wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
622
623     /* Controls for the SAP announces */
624     wxPanel *misc_panel;
625     wxPanel *misc_subpanels[MISC_SOUT_NUM];
626     wxCheckBox *sap_checkbox;
627     wxCheckBox *slp_checkbox;
628     wxTextCtrl *announce_addr;
629
630     /* Controls for the encapsulation */
631     wxPanel *encapsulation_panel;
632     wxRadioButton *encapsulation_radios[ENCAPS_NUM];
633     int i_encapsulation_type;
634
635     /* Controls for transcoding */
636     wxPanel *transcoding_panel;
637     wxCheckBox *video_transc_checkbox;
638     wxComboBox *video_codec_combo;
639     wxComboBox *audio_codec_combo;
640     wxCheckBox *audio_transc_checkbox;
641     wxComboBox *video_bitrate_combo;
642     wxComboBox *audio_bitrate_combo;
643     wxComboBox *audio_channels_combo;
644     wxComboBox *video_scale_combo;
645 };
646
647 /* Subtitles File Dialog */
648 class SubsFileDialog: public wxDialog
649 {
650 public:
651     /* Constructor */
652     SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
653     virtual ~SubsFileDialog();
654
655     wxComboBox *file_combo;
656     wxComboBox *encoding_combo;
657     wxSpinCtrl *delay_spinctrl;
658     wxSpinCtrl *fps_spinctrl;
659
660 private:
661     /* Event handlers (these functions should _not_ be virtual) */
662     void OnOk( wxCommandEvent& event );
663     void OnCancel( wxCommandEvent& event );
664     void OnFileBrowse( wxCommandEvent& event );
665
666     DECLARE_EVENT_TABLE();
667
668     intf_thread_t *p_intf;
669     wxWindow *p_parent;
670 };
671
672 /* Stream */
673 class StreamDialog: public wxFrame
674 {
675 public:
676     /* Constructor */
677     StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent );
678     virtual ~StreamDialog();
679
680 private:
681     void OnClose( wxCommandEvent& event );
682     void OnOpen( wxCommandEvent& event );
683     void OnSout( wxCommandEvent& event );
684     void OnStart( wxCommandEvent& event );
685
686     DECLARE_EVENT_TABLE();
687
688     intf_thread_t *p_intf;
689
690     wxStaticText *step2_label;
691     wxStaticText *step3_label;
692     wxButton *sout_button;
693     wxButton *start_button;
694     wxArrayString mrl;
695     wxArrayString sout_mrl;
696     OpenDialog *p_open_dialog;
697     SoutDialog *p_sout_dialog;
698 };
699
700
701
702 /* Preferences Dialog */
703 class PrefsTreeCtrl;
704 class PrefsDialog: public wxFrame
705 {
706 public:
707     /* Constructor */
708     PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
709     virtual ~PrefsDialog();
710
711 private:
712     wxPanel *PrefsPanel( wxWindow* parent );
713
714     /* Event handlers (these functions should _not_ be virtual) */
715     void OnOk( wxCommandEvent& event );
716     void OnCancel( wxCommandEvent& event );
717     void OnSave( wxCommandEvent& event );
718     void OnResetAll( wxCommandEvent& event );
719     void OnAdvanced( wxCommandEvent& event );
720
721     DECLARE_EVENT_TABLE();
722
723     intf_thread_t *p_intf;
724
725     PrefsTreeCtrl *prefs_tree;
726 };
727
728 /* Messages */
729 class Messages: public wxFrame
730 {
731 public:
732     /* Constructor */
733     Messages( intf_thread_t *p_intf, wxWindow *p_parent );
734     virtual ~Messages();
735     bool Show( bool show = TRUE );
736     void UpdateLog();
737
738 private:
739     /* Event handlers (these functions should _not_ be virtual) */
740     void OnClose( wxCommandEvent& event );
741     void OnClear( wxCommandEvent& event );
742     void OnSaveLog( wxCommandEvent& event );
743
744     DECLARE_EVENT_TABLE();
745
746     intf_thread_t *p_intf;
747     wxTextCtrl *textctrl;
748     wxTextAttr *info_attr;
749     wxTextAttr *err_attr;
750     wxTextAttr *warn_attr;
751     wxTextAttr *dbg_attr;
752
753     wxFileDialog *save_log_dialog;
754
755     vlc_bool_t b_verbose;
756 };
757
758 /* Playlist */
759 class ItemInfoDialog;
760 class NewGroup;
761 class ExportPlaylist;
762 class Playlist: public wxFrame
763 {
764 public:
765     /* Constructor */
766     Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
767     virtual ~Playlist();
768
769     void UpdatePlaylist();
770     void ShowPlaylist( bool show );
771     void UpdateItem( int );
772
773     bool b_need_update;
774
775 private:
776     void DeleteItem( int item );
777     void ShowInfos( int item );
778
779     /* Event handlers (these functions should _not_ be virtual) */
780     void OnAddFile( wxCommandEvent& event );
781     void OnAddMRL( wxCommandEvent& event );
782     void OnClose( wxCommandEvent& event );
783     void OnSearch( wxCommandEvent& event );
784     void OnEnDis( wxCommandEvent& event );
785     void OnInfos( wxCommandEvent& event );
786     void OnSearchTextChange( wxCommandEvent& event );
787     void OnOpen( wxCommandEvent& event );
788     void OnSave( wxCommandEvent& event );
789
790     void OnSort( wxCommandEvent& event );
791     void OnColSelect( wxListEvent& event );
792
793     void OnUp( wxCommandEvent& event);
794     void OnDown( wxCommandEvent& event);
795
796     void OnEnableSelection( wxCommandEvent& event );
797     void OnDisableSelection( wxCommandEvent& event );
798     void OnInvertSelection( wxCommandEvent& event );
799     void OnDeleteSelection( wxCommandEvent& event );
800     void OnSelectAll( wxCommandEvent& event );
801     void OnRandom( wxCommandEvent& event );
802     void OnRepeat( wxCommandEvent& event );
803     void OnLoop ( wxCommandEvent& event );
804     void OnActivateItem( wxListEvent& event );
805     void OnKeyDown( wxListEvent& event );
806     void OnNewGroup( wxCommandEvent& event );
807
808     /* Popup functions */
809     void OnPopup( wxListEvent& event );
810     void OnPopupPlay( wxMenuEvent& event );
811     void OnPopupDel( wxMenuEvent& event );
812     void OnPopupEna( wxMenuEvent& event );
813     void OnPopupInfo( wxMenuEvent& event );
814     void Rebuild();
815
816     /* Custom events */
817     void OnPlaylistEvent( wxCommandEvent& event );
818
819     wxTextCtrl *search_text;
820     wxButton *search_button;
821     DECLARE_EVENT_TABLE();
822
823     wxMenu *popup_menu;
824
825     ItemInfoDialog *iteminfo_dialog;
826
827     intf_thread_t *p_intf;
828     wxListView *listview;
829     wxTreeCtrl *treeview;
830     int i_update_counter;
831     int i_sort_mode;
832
833     int i_popup_item;
834
835     int i_title_sorted;
836     int i_author_sorted;
837     int i_group_sorted;
838     int i_duration_sorted;
839 };
840
841
842 class NewGroup: public wxDialog
843 {
844 public:
845     /* Constructor */
846     NewGroup( intf_thread_t *p_intf, wxWindow *p_parent );
847     virtual ~NewGroup();
848
849 private:
850
851     /* Event handlers (these functions should _not_ be virtual) */
852     void OnOk( wxCommandEvent& event );
853     void OnCancel( wxCommandEvent& event );
854
855     DECLARE_EVENT_TABLE();
856
857     intf_thread_t *p_intf;
858     wxTextCtrl *groupname;
859
860 protected:
861     friend class Playlist;
862     friend class ItemInfoDialog;
863     char *psz_name;
864 };
865
866 /* ItemInfo Dialog */
867 class ItemInfoDialog: public wxDialog
868 {
869 public:
870     /* Constructor */
871     ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
872                     wxWindow *p_parent );
873     virtual ~ItemInfoDialog();
874
875     wxArrayString GetOptions();
876
877 private:
878     wxPanel *InfoPanel( wxWindow* parent );
879     wxPanel *GroupPanel( wxWindow* parent );
880
881     /* Event handlers (these functions should _not_ be virtual) */
882     void OnOk( wxCommandEvent& event );
883     void OnCancel( wxCommandEvent& event );
884     void OnNewGroup( wxCommandEvent& event );
885
886     void UpdateInfo();
887
888     DECLARE_EVENT_TABLE();
889
890     intf_thread_t *p_intf;
891     playlist_item_t *p_item;
892     wxWindow *p_parent;
893
894     /* Controls for the iteminfo dialog box */
895     wxPanel *info_subpanel;
896     wxPanel *info_panel;
897
898     wxPanel *group_subpanel;
899     wxPanel *group_panel;
900
901     wxTextCtrl *uri_text;
902     wxTextCtrl *name_text;
903     wxTextCtrl *author_text;
904
905     wxTreeCtrl *info_tree;
906     wxTreeItemId info_root;
907
908     wxCheckBox *enabled_checkbox;
909     wxComboBox *group_combo;
910     int ids_array[100];
911 };
912
913
914 /* File Info */
915 class FileInfo: public wxFrame
916 {
917 public:
918     /* Constructor */
919     FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
920     virtual ~FileInfo();
921     void UpdateFileInfo();
922
923 private:
924     void OnClose( wxCommandEvent& event );
925
926     DECLARE_EVENT_TABLE();
927
928     intf_thread_t *p_intf;
929     wxTreeCtrl *fileinfo_tree;
930     wxTreeItemId fileinfo_root;
931     wxString fileinfo_root_label;
932
933 };
934
935
936 #if !defined(__WXX11__)
937 /* Drag and Drop class */
938 class DragAndDrop: public wxFileDropTarget
939 {
940 public:
941     DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE );
942
943     virtual bool OnDropFiles( wxCoord x, wxCoord y,
944                               const wxArrayString& filenames );
945
946 private:
947     intf_thread_t *p_intf;
948     vlc_bool_t b_enqueue;
949 };
950 #endif
951
952 /* Menus */
953 void PopupMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
954                 const wxPoint& pos );
955 wxMenu *SettingsMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
956 wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
957 wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
958 wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
959
960 class MenuEvtHandler : public wxEvtHandler
961 {
962 public:
963     MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
964     virtual ~MenuEvtHandler();
965
966     void OnMenuEvent( wxCommandEvent& event );
967     void OnShowDialog( wxCommandEvent& event );
968
969 private:
970
971     DECLARE_EVENT_TABLE()
972
973     intf_thread_t *p_intf;
974     Interface *p_main_interface;
975 };
976
977 class Menu: public wxMenu
978 {
979 public:
980     /* Constructor */
981     Menu( intf_thread_t *p_intf, wxWindow *p_parent, int i_count,
982           char **ppsz_names, int *pi_objects, int i_start_id );
983     virtual ~Menu();
984
985 private:
986     /* Event handlers (these functions should _not_ be virtual) */
987     void OnClose( wxCommandEvent& event );
988     void OnShowDialog( wxCommandEvent& event );
989     void OnEntrySelected( wxCommandEvent& event );
990
991     wxMenu *Menu::CreateDummyMenu();
992     void   Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
993     wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t *, bool );
994
995     DECLARE_EVENT_TABLE();
996
997     intf_thread_t *p_intf;
998
999     int  i_item_id;
1000 };
1001
1002 wxWindow *VideoWindow( intf_thread_t *p_intf, wxWindow *p_parent );
1003
1004 class BookmarksDialog: public wxFrame
1005 {
1006 public:
1007     /* Constructor */
1008     BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent );
1009     virtual ~BookmarksDialog();
1010
1011     bool Show( bool );
1012
1013 private:
1014
1015     void Update();
1016
1017     /* Event handlers (these functions should _not_ be virtual) */
1018     void OnClose( wxCommandEvent& event );
1019     void OnAdd( wxCommandEvent& event );
1020     void OnDel( wxCommandEvent& event );
1021     void OnActivateItem( wxListEvent& event );
1022
1023     DECLARE_EVENT_TABLE();
1024
1025     intf_thread_t *p_intf;
1026     wxWindow *p_parent;
1027
1028     wxListView *list_ctrl;
1029 };
1030
1031 static inline int ConvertHotkeyModifiers( int i_hotkey )
1032 {
1033     int i_accel_flags = 0;
1034     if( i_hotkey & KEY_MODIFIER_ALT ) i_accel_flags |= wxACCEL_ALT;
1035     if( i_hotkey & KEY_MODIFIER_CTRL ) i_accel_flags |= wxACCEL_CTRL;
1036     if( i_hotkey & KEY_MODIFIER_SHIFT ) i_accel_flags |= wxACCEL_SHIFT;
1037     return i_accel_flags;
1038 }
1039
1040 static inline int ConvertHotkey( int i_hotkey )
1041 {
1042     int i_key = i_hotkey & ~KEY_MODIFIER;
1043     if( i_key & KEY_ASCII ) return i_key & KEY_ASCII;
1044     else if( i_key & KEY_SPECIAL )
1045     {
1046         switch ( i_key )
1047         {
1048         case KEY_LEFT: return WXK_LEFT;
1049         case KEY_RIGHT: return WXK_RIGHT;
1050         case KEY_UP: return WXK_UP;
1051         case KEY_DOWN: return WXK_DOWN;
1052         case KEY_SPACE: return WXK_SPACE;
1053         case KEY_ENTER: return WXK_RETURN;
1054         case KEY_F1: return WXK_F1;
1055         case KEY_F2: return WXK_F2;
1056         case KEY_F3: return WXK_F3;
1057         case KEY_F4: return WXK_F4;
1058         case KEY_F5: return WXK_F5;
1059         case KEY_F6: return WXK_F6;
1060         case KEY_F7: return WXK_F7;
1061         case KEY_F8: return WXK_F8;
1062         case KEY_F9: return WXK_F9;
1063         case KEY_F10: return WXK_F10;
1064         case KEY_F11: return WXK_F11;
1065         case KEY_F12: return WXK_F12;
1066         case KEY_HOME: return WXK_HOME;
1067         case KEY_END: return WXK_HOME;
1068         case KEY_MENU: return WXK_MENU;
1069         case KEY_ESC: return WXK_ESCAPE;
1070         case KEY_PAGEUP: return WXK_PRIOR;
1071         case KEY_PAGEDOWN: return WXK_NEXT;
1072         case KEY_TAB: return WXK_TAB;
1073         case KEY_BACKSPACE: return WXK_BACK;
1074         }
1075     }
1076     return 0;
1077 }