]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/wxwindows.h
* configure.ac.in: bail out with an error message if the x11 skins are enabled and...
[vlc] / modules / gui / wxwindows / wxwindows.h
1 /*****************************************************************************
2  * wxwindows.h: private wxWindows interface description
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  * $Id: wxwindows.h,v 1.34 2003/06/03 22:18:58 gbazin Exp $
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 #include <wx/listctrl.h>
25 #include <wx/textctrl.h>
26 #include <wx/notebook.h>
27 #include <wx/spinctrl.h>
28 #include <wx/dnd.h>
29 #include <wx/treectrl.h>
30
31 class Playlist;
32 class Messages;
33 class FileInfo;
34
35 #define SLIDER_MAX_POS 10000
36
37 /* wxU is used to convert ansi strings to unicode strings (wchar_t) */
38 #if wxUSE_UNICODE
39 #   define wxU(ansi) wxString(ansi, *wxConvCurrent)
40 #else
41 #   define wxU(ansi) ansi
42 #endif
43
44 #if !defined(MODULE_NAME_IS_skins)
45 /*****************************************************************************
46  * intf_sys_t: description and status of wxwindows interface
47  *****************************************************************************/
48 struct intf_sys_t
49 {
50     /* the wx parent window */
51     wxWindow            *p_wxwindow;
52     wxIcon              *p_icon;
53
54     /* secondary windows */
55     Playlist            *p_playlist_window;
56     Messages            *p_messages_window;
57     FileInfo            *p_fileinfo_window;
58
59     /* special actions */
60     vlc_bool_t          b_playing;
61     vlc_bool_t          b_popup_changed;                   /* display menu ? */
62     vlc_bool_t          b_window_changed;        /* window display toggled ? */
63     vlc_bool_t          b_playlist_changed;    /* playlist display toggled ? */
64     vlc_bool_t          b_slider_free;                      /* slider status */
65
66     /* menus handlers */
67     vlc_bool_t          b_program_update;   /* do we need to update programs
68                                                                         menu */
69     vlc_bool_t          b_title_update;  /* do we need to update title menus */
70     vlc_bool_t          b_chapter_update;            /* do we need to update
71                                                                chapter menus */
72     vlc_bool_t          b_audio_update;  /* do we need to update audio menus */
73     vlc_bool_t          b_spu_update;      /* do we need to update spu menus */
74
75     /* windows and widgets */
76
77     /* The input thread */
78     input_thread_t *    p_input;
79
80     /* The slider */
81     int                 i_slider_pos;                     /* slider position */
82     int                 i_slider_oldpos;                /* previous position */
83
84     /* The messages window */
85     msg_subscription_t* p_sub;                  /* message bank subscription */
86
87     /* Playlist management */
88     int                 i_playing;                 /* playlist selected item */
89
90     /* The window labels for DVD mode */
91     unsigned int        i_part;                           /* current chapter */
92 };
93 #endif /* !defined(MODULE_NAME_IS_skins) */
94
95 /*****************************************************************************
96  * Prototypes
97  *****************************************************************************/
98
99 /*****************************************************************************
100  * Classes declarations.
101  *****************************************************************************/
102 class Interface;
103
104 /* Timer */
105 class Timer: public wxTimer
106 {
107 public:
108     /* Constructor */
109     Timer( intf_thread_t *p_intf, Interface *p_main_interface );
110     virtual ~Timer();
111
112     virtual void Notify();
113
114 private:
115     intf_thread_t *p_intf;
116     Interface *p_main_interface;
117     int i_old_playing_status;
118     int i_old_rate;
119 };
120
121 /* Main Interface */
122 class OpenDialog;
123 class Interface: public wxFrame
124 {
125 public:
126     /* Constructor */
127     Interface( intf_thread_t *p_intf );
128     virtual ~Interface();
129     void TogglePlayButton( int i_playing_status );
130
131     wxBoxSizer  *frame_sizer;
132     wxStatusBar *statusbar;
133
134     wxSlider    *slider;
135     wxWindow    *slider_frame;
136     wxStaticBox *slider_box;
137
138     /* So we don't recreate the open dialog box each time
139      * (and keep the last settings) */
140     OpenDialog  *p_open_dialog;
141
142     wxMenu      *p_popup_menu;
143     vlc_bool_t  b_popup_change;
144
145 private:
146     void CreateOurMenuBar();
147     void CreateOurToolBar();
148     void CreateOurSlider();
149     void Open( int i_access_method );
150
151     /* Event handlers (these functions should _not_ be virtual) */
152     void OnExit( wxCommandEvent& event );
153     void OnAbout( wxCommandEvent& event );
154     void OnMessages( wxCommandEvent& event );
155     void OnPlaylist( wxCommandEvent& event );
156     void OnLogs( wxCommandEvent& event );
157     void OnFileInfo( wxCommandEvent& event );
158     void OnPreferences( wxCommandEvent& event );
159
160     void OnOpenFile( wxCommandEvent& event );
161     void OnOpenDisc( wxCommandEvent& event );
162     void OnOpenNet( wxCommandEvent& event );
163     void OnOpenSat( wxCommandEvent& event );
164
165     void OnPlayStream( wxCommandEvent& event );
166     void OnStopStream( wxCommandEvent& event );
167     void OnSliderUpdate( wxScrollEvent& event );
168     void OnPrevStream( wxCommandEvent& event );
169     void OnNextStream( wxCommandEvent& event );
170     void OnSlowStream( wxCommandEvent& event );
171     void OnFastStream( wxCommandEvent& event );
172
173     void OnMenuOpen( wxMenuEvent& event );
174
175 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
176     void OnContextMenu2(wxContextMenuEvent& event);
177 #endif
178     void OnContextMenu(wxMouseEvent& event);
179
180     DECLARE_EVENT_TABLE();
181
182     Timer *timer;
183     intf_thread_t *p_intf;
184
185     wxFrame *p_prefs_dialog;
186
187     int i_old_playing_status;
188
189     /* For auto-generated menus */
190     wxMenu *p_audio_menu;
191     vlc_bool_t b_audio_menu;
192     wxMenu *p_video_menu;
193     vlc_bool_t b_video_menu;
194     wxMenu *p_navig_menu;
195     vlc_bool_t b_navig_menu;
196 };
197
198 /* Open Dialog */
199 class SoutDialog;
200 class SubsFileDialog;
201 class OpenDialog: public wxDialog
202 {
203 public:
204     /* Constructor */
205     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
206                 int i_access_method );
207     virtual ~OpenDialog();
208
209     int ShowModal();
210     int ShowModal( int i_access_method );
211
212     wxArrayString mrl;
213
214 private:
215     wxPanel *FilePanel( wxWindow* parent );
216     wxPanel *DiscPanel( wxWindow* parent );
217     wxPanel *NetPanel( wxWindow* parent );
218     wxPanel *SatPanel( wxWindow* parent );
219
220     void UpdateMRL( int i_access_method );
221     wxArrayString SeparateEntries( wxString );
222
223     /* Event handlers (these functions should _not_ be virtual) */
224     void OnOk( wxCommandEvent& event );
225     void OnCancel( wxCommandEvent& event );
226
227     void OnPageChange( wxNotebookEvent& event );
228     void OnMRLChange( wxCommandEvent& event );
229
230     /* Event handlers for the file page */
231     void OnFilePanelChange( wxCommandEvent& event );
232     void OnFileBrowse( wxCommandEvent& event );
233
234     /* Event handlers for the disc page */
235     void OnDiscPanelChange( wxCommandEvent& event );
236     void OnDiscTypeChange( wxCommandEvent& event );
237
238     /* Event handlers for the net page */
239     void OnNetPanelChange( wxCommandEvent& event );
240     void OnNetTypeChange( wxCommandEvent& event );
241
242     /* Event handlers for the stream output */
243     void OnSubsFileEnable( wxCommandEvent& event );
244     void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
245
246     /* Event handlers for the stream output */
247     void OnSoutEnable( wxCommandEvent& event );
248     void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
249
250     /* Event handlers for the demux dump */
251     void OnDemuxDumpEnable( wxCommandEvent& event );
252     void OnDemuxDumpBrowse( wxCommandEvent& event );
253     void OnDemuxDumpChange( wxCommandEvent& event );
254
255     DECLARE_EVENT_TABLE();
256
257     intf_thread_t *p_intf;
258     wxWindow *p_parent;
259     int i_current_access_method;
260
261     wxComboBox *mrl_combo;
262     wxNotebook *notebook;
263
264     /* Controls for the file panel */
265     wxComboBox *file_combo;
266     wxFileDialog *file_dialog;
267
268     /* Controls for the disc panel */
269     wxRadioBox *disc_type;
270     wxTextCtrl *disc_device;
271     wxSpinCtrl *disc_title;
272     wxSpinCtrl *disc_chapter;
273
274     /* Controls for the net panel */
275     wxRadioBox *net_type;
276     int i_net_type;
277     wxPanel *net_subpanels[4];
278     wxRadioButton *net_radios[4];
279     wxSpinCtrl *net_ports[4];
280     wxTextCtrl *net_addrs[4];
281
282     /* Controls for the subtitles file */
283     wxButton *subsfile_button;
284     wxCheckBox *subsfile_checkbox;
285     SubsFileDialog *subsfile_dialog;
286
287     /* Controls for the stream output */
288     wxButton *sout_button;
289     wxCheckBox *sout_checkbox;
290     SoutDialog *sout_dialog;
291
292     /* Controls for the demux dump */
293     wxTextCtrl *demuxdump_textctrl;
294     wxButton *demuxdump_button;
295     wxCheckBox *demuxdump_checkbox;
296     wxFileDialog *demuxdump_dialog;
297 };
298
299 enum
300 {
301     FILE_ACCESS = 0,
302     DISC_ACCESS,
303     NET_ACCESS,
304     SAT_ACCESS
305 };
306
307 /* Stream output Dialog */
308 class SoutDialog: public wxDialog
309 {
310 public:
311     /* Constructor */
312     SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
313     virtual ~SoutDialog();
314
315     wxString mrl;
316
317 private:
318     void UpdateMRL();
319     wxPanel *AccessPanel( wxWindow* parent );
320     wxPanel *EncapsulationPanel( wxWindow* parent );
321     wxPanel *TranscodingPanel( wxWindow* parent );
322     void    ParseMRL();
323
324     /* Event handlers (these functions should _not_ be virtual) */
325     void OnOk( wxCommandEvent& event );
326     void OnCancel( wxCommandEvent& event );
327     void OnMRLChange( wxCommandEvent& event );
328     void OnAccessTypeChange( wxCommandEvent& event );
329
330     /* Event handlers for the file access output */
331     void OnFileChange( wxCommandEvent& event );
332     void OnFileBrowse( wxCommandEvent& event );
333
334     /* Event handlers for the net access output */
335     void OnNetChange( wxCommandEvent& event );
336
337     /* Event handlers for the encapsulation panel */
338     void OnEncapsulationChange( wxCommandEvent& event );
339
340     /* Event handlers for the transcoding panel */
341     void OnTranscodingEnable( wxCommandEvent& event );
342     void OnTranscodingChange( wxCommandEvent& event );
343
344     DECLARE_EVENT_TABLE();
345
346     intf_thread_t *p_intf;
347     wxWindow *p_parent;
348
349     wxComboBox *mrl_combo;
350
351     /* Controls for the access outputs */
352     wxPanel *access_subpanels[5];
353     wxCheckBox *access_checkboxes[5];
354
355     int i_access_type;
356
357     wxComboBox *file_combo;
358     wxSpinCtrl *net_ports[5];
359     wxTextCtrl *net_addrs[5];
360
361     /* Controls for the encapsulation */
362     wxRadioButton *encapsulation_radios[5];
363     int i_encapsulation_type;
364
365     /* Controls for transcoding */
366     wxCheckBox *video_transc_checkbox;
367     wxComboBox *video_codec_combo;
368     wxComboBox *audio_codec_combo;
369     wxCheckBox *audio_transc_checkbox;
370     wxComboBox *video_bitrate_combo;
371     wxComboBox *audio_bitrate_combo;
372 };
373
374 /* Subtitles File Dialog */
375 class SubsFileDialog: public wxDialog
376 {
377 public:
378     /* Constructor */
379     SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
380     virtual ~SubsFileDialog();
381
382     wxComboBox *file_combo;
383     wxSpinCtrl *delay_spinctrl;
384     wxSpinCtrl *fps_spinctrl;
385
386 private:
387     /* Event handlers (these functions should _not_ be virtual) */
388     void OnOk( wxCommandEvent& event );
389     void OnCancel( wxCommandEvent& event );
390     void OnFileBrowse( wxCommandEvent& event );
391
392     DECLARE_EVENT_TABLE();
393
394     intf_thread_t *p_intf;
395     wxWindow *p_parent;
396 };
397
398 /* Preferences Dialog */
399 class PrefsTreeCtrl;
400 class PrefsDialog: public wxFrame
401 {
402 public:
403     /* Constructor */
404     PrefsDialog( intf_thread_t *p_intf, Interface *p_main_interface );
405     virtual ~PrefsDialog();
406
407 private:
408     wxPanel *PrefsPanel( wxWindow* parent );
409
410     /* Event handlers (these functions should _not_ be virtual) */
411     void OnOk( wxCommandEvent& event );
412     void OnCancel( wxCommandEvent& event );
413     void OnSave( wxCommandEvent& event );
414     void OnResetAll( wxCommandEvent& event );
415
416     DECLARE_EVENT_TABLE();
417
418     intf_thread_t *p_intf;
419     Interface *p_main_interface;
420
421     PrefsTreeCtrl *prefs_tree;
422 };
423
424 /* Messages */
425 class Messages: public wxFrame
426 {
427 public:
428     /* Constructor */
429     Messages( intf_thread_t *p_intf, Interface *_p_main_interface );
430     virtual ~Messages();
431     void UpdateLog();
432
433 private:
434     /* Event handlers (these functions should _not_ be virtual) */
435     void OnClose( wxCommandEvent& event );
436     void OnVerbose( wxCommandEvent& event );
437
438     DECLARE_EVENT_TABLE();
439
440     intf_thread_t *p_intf;
441     Interface *p_main_interface;
442     wxTextCtrl *textctrl;
443     wxTextAttr *info_attr;
444     wxTextAttr *err_attr;
445     wxTextAttr *warn_attr;
446     wxTextAttr *dbg_attr;
447
448     vlc_bool_t b_verbose;
449 };
450
451 /* Playlist */
452 class Playlist: public wxFrame
453 {
454 public:
455     /* Constructor */
456     Playlist( intf_thread_t *p_intf, Interface *p_main_interface );
457     virtual ~Playlist();
458
459     void UpdatePlaylist();
460     void ShowPlaylist( bool show );
461
462     bool b_need_update;
463     vlc_mutex_t lock;
464
465 private:
466     void DeleteItem( int item );
467
468     /* Event handlers (these functions should _not_ be virtual) */
469     void OnAddMRL( wxCommandEvent& event );
470     void OnClose( wxCommandEvent& event );
471     void OnOpen( wxCommandEvent& event );
472     void OnSave( wxCommandEvent& event );
473     void OnInvertSelection( wxCommandEvent& event );
474     void OnDeleteSelection( wxCommandEvent& event );
475     void OnSelectAll( wxCommandEvent& event );
476     void OnActivateItem( wxListEvent& event );
477     void OnKeyDown( wxListEvent& event );
478     void Rebuild();
479
480     DECLARE_EVENT_TABLE();
481
482     intf_thread_t *p_intf;
483     Interface *p_main_interface;
484     wxListView *listview;
485     int i_update_counter;
486 };
487
488 /* File Info */
489 class FileInfo: public wxFrame
490 {
491 public:
492     /* Constructor */
493     FileInfo( intf_thread_t *p_intf, Interface *p_main_interface );
494     virtual ~FileInfo();
495     void UpdateFileInfo();
496
497 private:
498     void OnClose( wxCommandEvent& event );
499
500     DECLARE_EVENT_TABLE();
501    
502     intf_thread_t *p_intf;
503     wxTreeCtrl *fileinfo_tree;
504     wxTreeItemId fileinfo_root;
505     wxString fileinfo_root_label;
506
507 };
508
509 #if !defined(__WXX11__)
510 /* Drag and Drop class */
511 class DragAndDrop: public wxFileDropTarget
512 {
513 public:
514     DragAndDrop( intf_thread_t *_p_intf );
515
516     virtual bool OnDropFiles( wxCoord x, wxCoord y,
517                               const wxArrayString& filenames );
518
519 private:
520     intf_thread_t *p_intf;
521 };
522 #endif
523
524 /* Menus */
525 void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface,
526                 const wxPoint& pos );
527 wxMenu *AudioMenu( intf_thread_t *_p_intf, Interface *_p_main_interface );
528 wxMenu *VideoMenu( intf_thread_t *_p_intf, Interface *_p_main_interface );
529 wxMenu *NavigMenu( intf_thread_t *_p_intf, Interface *_p_main_interface );
530
531 class MenuEvtHandler : public wxEvtHandler
532 {
533 public:
534     MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
535     virtual ~MenuEvtHandler();
536
537     void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event );
538
539 private:
540
541     DECLARE_EVENT_TABLE()
542
543     intf_thread_t *p_intf;
544     Interface *p_main_interface;
545 };
546
547 class Menu: public wxMenu
548 {
549 public:
550     /* Constructor */
551     Menu( intf_thread_t *p_intf, Interface *p_main_interface, int i_count,
552           char **ppsz_names, int *pi_objects, int i_start_id );
553     virtual ~Menu();
554
555 private:
556     /* Event handlers (these functions should _not_ be virtual) */
557     void OnClose( wxCommandEvent& event );
558     void OnEntrySelected( wxCommandEvent& event );
559
560     wxMenu *Menu::CreateDummyMenu();
561     void   Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
562     wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t * );
563
564     DECLARE_EVENT_TABLE();
565
566     intf_thread_t *p_intf;
567     Interface *p_main_interface;
568
569     int  i_item_id;
570 };