]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/wxwindows.h
ef11a89c5953cccc17be85b59becc66ebea62f75
[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 SoutDialog;
150 class SubsFileDialog;
151 class Playlist;
152 class Messages;
153 class FileInfo;
154 class StreamDialog;
155 class WizardDialog;
156 class ItemInfoDialog;
157 class NewGroup;
158 class ExportPlaylist;
159
160 /*****************************************************************************
161  * Classes declarations.
162  *****************************************************************************/
163 /* Timer */
164 class Timer: public wxTimer
165 {
166 public:
167     /* Constructor */
168     Timer( intf_thread_t *p_intf, Interface *p_main_interface );
169     virtual ~Timer();
170
171     virtual void Notify();
172
173 private:
174     intf_thread_t *p_intf;
175     Interface *p_main_interface;
176     int i_old_playing_status;
177     int i_old_rate;
178 };
179
180 /* Main Interface */
181 class Interface: public wxFrame
182 {
183 public:
184     /* Constructor */
185     Interface( intf_thread_t *p_intf );
186     virtual ~Interface();
187     void TogglePlayButton( int i_playing_status );
188
189     wxBoxSizer  *frame_sizer;
190     wxStatusBar *statusbar;
191
192     wxSlider    *slider;
193     wxWindow    *slider_frame;
194     wxWindow    *extra_frame;
195
196     vlc_bool_t b_extra;
197
198     wxStaticBox *adjust_box;
199     wxButton *restoredefaults_button;
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 OnExtended( wxCommandEvent& event );
229     void OnBookmarks( wxCommandEvent& event );
230     void OnShowDialog( wxCommandEvent& event );
231     void OnPlayStream( wxCommandEvent& event );
232     void OnStopStream( wxCommandEvent& event );
233     void OnSliderUpdate( wxScrollEvent& event );
234     void OnPrevStream( wxCommandEvent& event );
235     void OnNextStream( wxCommandEvent& event );
236     void OnSlowStream( wxCommandEvent& event );
237     void OnFastStream( wxCommandEvent& event );
238
239     void OnEnableAdjust( wxCommandEvent& event );
240     void OnRestoreDefaults( wxCommandEvent& event);
241     void OnAdjustUpdate( wxScrollEvent& event );
242
243     void OnRatio( wxCommandEvent& event );
244     void OnEnableVisual( wxCommandEvent& event );
245
246     void OnMenuOpen( wxMenuEvent& event );
247
248 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
249     void OnContextMenu2(wxContextMenuEvent& event);
250 #endif
251     void OnContextMenu(wxMouseEvent& event);
252
253     void OnControlEvent( wxCommandEvent& event );
254
255     DECLARE_EVENT_TABLE();
256
257     Timer *timer;
258     intf_thread_t *p_intf;
259
260 private:
261     int i_old_playing_status;
262
263     /* For auto-generated menus */
264     wxMenu *p_settings_menu;
265     wxMenu *p_audio_menu;
266     wxMenu *p_video_menu;
267     wxMenu *p_navig_menu;
268 };
269
270 /* Open Dialog */
271 WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel);
272 class OpenDialog: public wxDialog
273 {
274 public:
275     /* Constructor */
276     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
277                 int i_access_method, int i_arg = 0  );
278
279     /* Extended Contructor */
280     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
281                 int i_access_method, int i_arg = 0 , int _i_method = 0 );
282     virtual ~OpenDialog();
283
284     int Show();
285     int Show( int i_access_method, int i_arg = 0 );
286
287     void UpdateMRL();
288     void UpdateMRL( int i_access_method );
289
290     wxArrayString mrl;
291
292 private:
293     wxPanel *FilePanel( wxWindow* parent );
294     wxPanel *DiscPanel( wxWindow* parent );
295     wxPanel *NetPanel( wxWindow* parent );
296
297     ArrayOfAutoBuiltPanel input_tab_array;
298
299     /* Event handlers (these functions should _not_ be virtual) */
300     void OnOk( wxCommandEvent& event );
301     void OnCancel( wxCommandEvent& event );
302
303     void OnPageChange( wxNotebookEvent& event );
304     void OnMRLChange( wxCommandEvent& event );
305
306     /* Event handlers for the file page */
307     void OnFilePanelChange( wxCommandEvent& event );
308     void OnFileBrowse( wxCommandEvent& event );
309
310     /* Event handlers for the disc page */
311     void OnDiscPanelChange( wxCommandEvent& event );
312     void OnDiscTypeChange( wxCommandEvent& event );
313     void OnDiscDeviceChange( wxCommandEvent& event );
314
315     /* Event handlers for the net page */
316     void OnNetPanelChange( wxCommandEvent& event );
317     void OnNetTypeChange( wxCommandEvent& event );
318
319     /* Event handlers for the stream output */
320     void OnSubsFileEnable( wxCommandEvent& event );
321     void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
322
323     /* Event handlers for the stream output */
324     void OnSoutEnable( wxCommandEvent& event );
325     void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
326
327     DECLARE_EVENT_TABLE();
328
329     intf_thread_t *p_intf;
330     wxWindow *p_parent;
331     int i_current_access_method;
332     int i_disc_type_selection;
333
334     int i_method; /* Normal or for the stream dialog ? */
335     int i_open_arg;
336
337     wxComboBox *mrl_combo;
338     wxNotebook *notebook;
339
340     /* Controls for the file panel */
341     wxComboBox *file_combo;
342     wxFileDialog *file_dialog;
343
344     /* Controls for the disc panel */
345     wxRadioBox *disc_type;
346     wxTextCtrl *disc_device;
347     wxSpinCtrl *disc_title;
348     wxSpinCtrl *disc_chapter;
349
350     /* The media equivalent name for a DVD names. For example,
351        "Title", is "Track" for a CD-DA */
352     wxStaticText *disc_title_label;
353     wxStaticText *disc_chapter_label;
354     
355     /* Indicates if the disc device control was modified */
356     bool b_disc_device_changed;
357     
358     /* Controls for the net panel */
359     wxRadioBox *net_type;
360     int i_net_type;
361     wxPanel *net_subpanels[4];
362     wxRadioButton *net_radios[4];
363     wxSpinCtrl *net_ports[4];
364     int        i_net_ports[4];
365     wxTextCtrl *net_addrs[4];
366     wxCheckBox *net_ipv6;
367
368     /* Controls for the subtitles file */
369     wxButton *subsfile_button;
370     wxCheckBox *subsfile_checkbox;
371     SubsFileDialog *subsfile_dialog;
372     wxArrayString subsfile_mrl;
373
374     /* Controls for the stream output */
375     wxButton *sout_button;
376     wxCheckBox *sout_checkbox;
377     SoutDialog *sout_dialog;
378     wxArrayString sout_mrl;
379 };
380
381 enum
382 {
383     FILE_ACCESS = 0,
384     DISC_ACCESS,
385     NET_ACCESS,
386
387     /* Auto-built panels */
388     CAPTURE_ACCESS
389 };
390 #define MAX_ACCESS CAPTURE_ACCESS
391
392 /* Stream output Dialog */
393 enum
394 {
395     PLAY_ACCESS_OUT = 0,
396     FILE_ACCESS_OUT,
397     HTTP_ACCESS_OUT,
398     MMSH_ACCESS_OUT,
399     UDP_ACCESS_OUT,
400     RTP_ACCESS_OUT,
401     ACCESS_OUT_NUM
402 };
403
404 enum
405 {
406     TS_ENCAPSULATION = 0,
407     PS_ENCAPSULATION,
408     MPEG1_ENCAPSULATION,
409     OGG_ENCAPSULATION,
410     RAW_ENCAPSULATION,
411     ASF_ENCAPSULATION,
412     AVI_ENCAPSULATION,
413     MP4_ENCAPSULATION,
414     MOV_ENCAPSULATION,
415     ENCAPS_NUM
416 };
417
418 enum
419 {
420     ANN_MISC_SOUT = 0,
421     MISC_SOUT_NUM
422 };
423
424 class SoutDialog: public wxDialog
425 {
426 public:
427     /* Constructor */
428     SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
429     virtual ~SoutDialog();
430
431     wxArrayString GetOptions();
432
433 private:
434     void UpdateMRL();
435     wxPanel *AccessPanel( wxWindow* parent );
436     wxPanel *MiscPanel( wxWindow* parent );
437     wxPanel *EncapsulationPanel( wxWindow* parent );
438     wxPanel *TranscodingPanel( wxWindow* parent );
439     void    ParseMRL();
440
441     /* Event handlers (these functions should _not_ be virtual) */
442     void OnOk( wxCommandEvent& event );
443     void OnCancel( wxCommandEvent& event );
444     void OnMRLChange( wxCommandEvent& event );
445     void OnAccessTypeChange( wxCommandEvent& event );
446
447     /* Event handlers for the file access output */
448     void OnFileChange( wxCommandEvent& event );
449     void OnFileBrowse( wxCommandEvent& event );
450     void OnFileDump( wxCommandEvent& event );
451
452     /* Event handlers for the net access output */
453     void OnNetChange( wxCommandEvent& event );
454
455     /* Event specific to the announce address */
456     void OnAnnounceAddrChange( wxCommandEvent& event );
457
458     /* Event handlers for the encapsulation panel */
459     void OnEncapsulationChange( wxCommandEvent& event );
460
461     /* Event handlers for the transcoding panel */
462     void OnTranscodingEnable( wxCommandEvent& event );
463     void OnTranscodingChange( wxCommandEvent& event );
464
465     /* Event handlers for the misc panel */
466     void OnSAPMiscChange( wxCommandEvent& event );
467     void OnSLPMiscChange( wxCommandEvent& event );
468
469     DECLARE_EVENT_TABLE();
470
471     intf_thread_t *p_intf;
472     wxWindow *p_parent;
473
474     wxComboBox *mrl_combo;
475
476     /* Controls for the access outputs */
477     wxPanel *access_panel;
478     wxPanel *access_subpanels[ACCESS_OUT_NUM];
479     wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
480
481     int i_access_type;
482
483     wxComboBox *file_combo;
484     wxCheckBox *dump_checkbox;
485     wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
486     wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
487
488     /* Controls for the SAP announces */
489     wxPanel *misc_panel;
490     wxPanel *misc_subpanels[MISC_SOUT_NUM];
491     wxCheckBox *sap_checkbox;
492     wxCheckBox *slp_checkbox;
493     wxTextCtrl *announce_addr;
494
495     /* Controls for the encapsulation */
496     wxPanel *encapsulation_panel;
497     wxRadioButton *encapsulation_radios[ENCAPS_NUM];
498     int i_encapsulation_type;
499
500     /* Controls for transcoding */
501     wxPanel *transcoding_panel;
502     wxCheckBox *video_transc_checkbox;
503     wxComboBox *video_codec_combo;
504     wxComboBox *audio_codec_combo;
505     wxCheckBox *audio_transc_checkbox;
506     wxComboBox *video_bitrate_combo;
507     wxComboBox *audio_bitrate_combo;
508     wxComboBox *audio_channels_combo;
509     wxComboBox *video_scale_combo;
510 };
511
512 /* Subtitles File Dialog */
513 class SubsFileDialog: public wxDialog
514 {
515 public:
516     /* Constructor */
517     SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
518     virtual ~SubsFileDialog();
519
520     wxComboBox *file_combo;
521     wxComboBox *encoding_combo;
522     wxSpinCtrl *delay_spinctrl;
523     wxSpinCtrl *fps_spinctrl;
524
525 private:
526     /* Event handlers (these functions should _not_ be virtual) */
527     void OnOk( wxCommandEvent& event );
528     void OnCancel( wxCommandEvent& event );
529     void OnFileBrowse( wxCommandEvent& event );
530
531     DECLARE_EVENT_TABLE();
532
533     intf_thread_t *p_intf;
534     wxWindow *p_parent;
535 };
536
537 /* Stream */
538 class StreamDialog: public wxFrame
539 {
540 public:
541     /* Constructor */
542     StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent );
543     virtual ~StreamDialog();
544
545 private:
546     void OnClose( wxCommandEvent& event );
547     void OnOpen( wxCommandEvent& event );
548     void OnSout( wxCommandEvent& event );
549     void OnStart( wxCommandEvent& event );
550
551     DECLARE_EVENT_TABLE();
552
553     intf_thread_t *p_intf;
554
555     wxStaticText *step2_label;
556     wxStaticText *step3_label;
557     wxButton *sout_button;
558     wxButton *start_button;
559     wxArrayString mrl;
560     wxArrayString sout_mrl;
561     OpenDialog *p_open_dialog;
562     SoutDialog *p_sout_dialog;
563 };
564
565 /* Wizard */
566 class WizardDialog : public wxWizard
567 {
568 public:
569     /* Constructor */
570     WizardDialog( intf_thread_t *p_intf, wxWindow *p_parent );
571     virtual ~WizardDialog();
572     void SetTranscode( char *vcodec, int vb, char *acodec,int ab);
573     void SetMrl( const char *mrl );
574     void SetPartial( int, int );
575     void SetStream( char *method, char *address );
576     void SetTranscodeOut( char *address );
577     void SetAction( int i_action );
578     int  GetAction();
579     void SetMux( char *mux );
580     void Run();
581     int i_action;
582
583 private:
584     int vb,ab;
585     int i_from, i_to;
586     char *vcodec,*acodec,*method,*address,*mrl,*mux;
587     DECLARE_EVENT_TABLE();
588
589     intf_thread_t *p_intf;
590 };
591
592
593 /* Preferences Dialog */
594 class PrefsDialog: public wxFrame
595 {
596 public:
597     /* Constructor */
598     PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
599     virtual ~PrefsDialog();
600
601 private:
602     wxPanel *PrefsPanel( wxWindow* parent );
603
604     /* Event handlers (these functions should _not_ be virtual) */
605     void OnOk( wxCommandEvent& event );
606     void OnCancel( wxCommandEvent& event );
607     void OnSave( wxCommandEvent& event );
608     void OnResetAll( wxCommandEvent& event );
609     void OnAdvanced( wxCommandEvent& event );
610
611     DECLARE_EVENT_TABLE();
612
613     intf_thread_t *p_intf;
614
615     PrefsTreeCtrl *prefs_tree;
616 };
617
618 /* Messages */
619 class Messages: public wxFrame
620 {
621 public:
622     /* Constructor */
623     Messages( intf_thread_t *p_intf, wxWindow *p_parent );
624     virtual ~Messages();
625     bool Show( bool show = TRUE );
626     void UpdateLog();
627
628 private:
629     /* Event handlers (these functions should _not_ be virtual) */
630     void OnClose( wxCommandEvent& event );
631     void OnClear( wxCommandEvent& event );
632     void OnSaveLog( wxCommandEvent& event );
633
634     DECLARE_EVENT_TABLE();
635
636     intf_thread_t *p_intf;
637     wxTextCtrl *textctrl;
638     wxTextAttr *info_attr;
639     wxTextAttr *err_attr;
640     wxTextAttr *warn_attr;
641     wxTextAttr *dbg_attr;
642
643     wxFileDialog *save_log_dialog;
644
645     vlc_bool_t b_verbose;
646 };
647
648 /* Playlist */
649 class Playlist: public wxFrame
650 {
651 public:
652     /* Constructor */
653     Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
654     virtual ~Playlist();
655
656     void UpdatePlaylist();
657     void ShowPlaylist( bool show );
658     void UpdateItem( int );
659
660     bool b_need_update;
661
662 private:
663     void DeleteItem( int item );
664     void ShowInfos( int item );
665
666     /* Event handlers (these functions should _not_ be virtual) */
667     void OnAddFile( wxCommandEvent& event );
668     void OnAddMRL( wxCommandEvent& event );
669     void OnClose( wxCommandEvent& event );
670     void OnSearch( wxCommandEvent& event );
671     void OnEnDis( wxCommandEvent& event );
672     void OnInfos( wxCommandEvent& event );
673     void OnSearchTextChange( wxCommandEvent& event );
674     void OnOpen( wxCommandEvent& event );
675     void OnSave( wxCommandEvent& event );
676
677     void OnSort( wxCommandEvent& event );
678     void OnColSelect( wxListEvent& event );
679
680     void OnUp( wxCommandEvent& event);
681     void OnDown( wxCommandEvent& event);
682
683     void OnEnableSelection( wxCommandEvent& event );
684     void OnDisableSelection( wxCommandEvent& event );
685     void OnInvertSelection( wxCommandEvent& event );
686     void OnDeleteSelection( wxCommandEvent& event );
687     void OnSelectAll( wxCommandEvent& event );
688     void OnRandom( wxCommandEvent& event );
689     void OnRepeat( wxCommandEvent& event );
690     void OnLoop ( wxCommandEvent& event );
691     void OnActivateItem( wxListEvent& event );
692     void OnKeyDown( wxListEvent& event );
693     void OnNewGroup( wxCommandEvent& event );
694
695     /* Popup functions */
696     void OnPopup( wxListEvent& event );
697     void OnPopupPlay( wxMenuEvent& event );
698     void OnPopupDel( wxMenuEvent& event );
699     void OnPopupEna( wxMenuEvent& event );
700     void OnPopupInfo( wxMenuEvent& event );
701     void Rebuild();
702
703     /* Custom events */
704     void OnPlaylistEvent( wxCommandEvent& event );
705
706     wxTextCtrl *search_text;
707     wxButton *search_button;
708     DECLARE_EVENT_TABLE();
709
710     wxMenu *popup_menu;
711
712     ItemInfoDialog *iteminfo_dialog;
713
714     intf_thread_t *p_intf;
715     wxListView *listview;
716     wxTreeCtrl *treeview;
717     int i_update_counter;
718     int i_sort_mode;
719
720     int i_popup_item;
721
722     int i_title_sorted;
723     int i_author_sorted;
724     int i_group_sorted;
725     int i_duration_sorted;
726 };
727
728 class NewGroup: public wxDialog
729 {
730 public:
731     /* Constructor */
732     NewGroup( intf_thread_t *p_intf, wxWindow *p_parent );
733     virtual ~NewGroup();
734
735 private:
736
737     /* Event handlers (these functions should _not_ be virtual) */
738     void OnOk( wxCommandEvent& event );
739     void OnCancel( wxCommandEvent& event );
740
741     DECLARE_EVENT_TABLE();
742
743     intf_thread_t *p_intf;
744     wxTextCtrl *groupname;
745
746 protected:
747     friend class Playlist;
748     friend class ItemInfoDialog;
749     char *psz_name;
750 };
751
752 /* ItemInfo Dialog */
753 class ItemInfoDialog: public wxDialog
754 {
755 public:
756     /* Constructor */
757     ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
758                     wxWindow *p_parent );
759     virtual ~ItemInfoDialog();
760
761     wxArrayString GetOptions();
762
763 private:
764     wxPanel *InfoPanel( wxWindow* parent );
765     wxPanel *GroupPanel( wxWindow* parent );
766
767     /* Event handlers (these functions should _not_ be virtual) */
768     void OnOk( wxCommandEvent& event );
769     void OnCancel( wxCommandEvent& event );
770     void OnNewGroup( wxCommandEvent& event );
771
772     void UpdateInfo();
773
774     DECLARE_EVENT_TABLE();
775
776     intf_thread_t *p_intf;
777     playlist_item_t *p_item;
778     wxWindow *p_parent;
779
780     /* Controls for the iteminfo dialog box */
781     wxPanel *info_subpanel;
782     wxPanel *info_panel;
783
784     wxPanel *group_subpanel;
785     wxPanel *group_panel;
786
787     wxTextCtrl *uri_text;
788     wxTextCtrl *name_text;
789     wxTextCtrl *author_text;
790
791     wxTreeCtrl *info_tree;
792     wxTreeItemId info_root;
793
794     wxCheckBox *enabled_checkbox;
795     wxComboBox *group_combo;
796     int ids_array[100];
797 };
798
799
800 /* File Info */
801 class FileInfo: public wxFrame
802 {
803 public:
804     /* Constructor */
805     FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
806     virtual ~FileInfo();
807     void UpdateFileInfo();
808
809 private:
810     void OnClose( wxCommandEvent& event );
811
812     DECLARE_EVENT_TABLE();
813
814     intf_thread_t *p_intf;
815     wxTreeCtrl *fileinfo_tree;
816     wxTreeItemId fileinfo_root;
817     wxString fileinfo_root_label;
818
819 };
820
821
822 #if wxUSE_DRAG_AND_DROP
823 /* Drag and Drop class */
824 class DragAndDrop: public wxFileDropTarget
825 {
826 public:
827     DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE );
828
829     virtual bool OnDropFiles( wxCoord x, wxCoord y,
830                               const wxArrayString& filenames );
831
832 private:
833     intf_thread_t *p_intf;
834     vlc_bool_t b_enqueue;
835 };
836 #endif
837 } // end of wxvlc namespace
838
839 /* Menus */
840 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
841 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
842 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
843 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
844 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
845
846 namespace wxvlc
847 {
848 class MenuEvtHandler : public wxEvtHandler
849 {
850 public:
851     MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
852     virtual ~MenuEvtHandler();
853
854     void OnMenuEvent( wxCommandEvent& event );
855     void OnShowDialog( wxCommandEvent& event );
856
857 private:
858
859     DECLARE_EVENT_TABLE()
860
861     intf_thread_t *p_intf;
862     Interface *p_main_interface;
863 };
864
865 } // end of wxvlc namespace
866 using namespace wxvlc;
867
868 static inline int ConvertHotkeyModifiers( int i_hotkey )
869 {
870     int i_accel_flags = 0;
871     if( i_hotkey & KEY_MODIFIER_ALT ) i_accel_flags |= wxACCEL_ALT;
872     if( i_hotkey & KEY_MODIFIER_CTRL ) i_accel_flags |= wxACCEL_CTRL;
873     if( i_hotkey & KEY_MODIFIER_SHIFT ) i_accel_flags |= wxACCEL_SHIFT;
874     return i_accel_flags;
875 }
876
877 static inline int ConvertHotkey( int i_hotkey )
878 {
879     int i_key = i_hotkey & ~KEY_MODIFIER;
880     if( i_key & KEY_ASCII ) return i_key & KEY_ASCII;
881     else if( i_key & KEY_SPECIAL )
882     {
883         switch ( i_key )
884         {
885         case KEY_LEFT: return WXK_LEFT;
886         case KEY_RIGHT: return WXK_RIGHT;
887         case KEY_UP: return WXK_UP;
888         case KEY_DOWN: return WXK_DOWN;
889         case KEY_SPACE: return WXK_SPACE;
890         case KEY_ENTER: return WXK_RETURN;
891         case KEY_F1: return WXK_F1;
892         case KEY_F2: return WXK_F2;
893         case KEY_F3: return WXK_F3;
894         case KEY_F4: return WXK_F4;
895         case KEY_F5: return WXK_F5;
896         case KEY_F6: return WXK_F6;
897         case KEY_F7: return WXK_F7;
898         case KEY_F8: return WXK_F8;
899         case KEY_F9: return WXK_F9;
900         case KEY_F10: return WXK_F10;
901         case KEY_F11: return WXK_F11;
902         case KEY_F12: return WXK_F12;
903         case KEY_HOME: return WXK_HOME;
904         case KEY_END: return WXK_HOME;
905         case KEY_MENU: return WXK_MENU;
906         case KEY_ESC: return WXK_ESCAPE;
907         case KEY_PAGEUP: return WXK_PRIOR;
908         case KEY_PAGEDOWN: return WXK_NEXT;
909         case KEY_TAB: return WXK_TAB;
910         case KEY_BACKSPACE: return WXK_BACK;
911         }
912     }
913     return 0;
914 }