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