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