1 /*****************************************************************************
2 * wxwindows.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: wxwindows.h,v 1.30 2003/05/20 23:17:59 gbazin Exp $
7 * Authors: Gildas Bazin <gbazin@netcourrier.com>
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.
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.
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 *****************************************************************************/
24 #include <wx/listctrl.h>
25 #include <wx/textctrl.h>
26 #include <wx/notebook.h>
27 #include <wx/spinctrl.h>
29 #include <wx/treectrl.h>
35 #define SLIDER_MAX_POS 10000
37 /* wxU is used to convert ansi strings to unicode strings (wchar_t) */
39 # define wxU(ansi) wxString(ansi, *wxConvCurrent)
41 # define wxU(ansi) ansi
44 #if !defined(MODULE_NAME_IS_skins)
45 /*****************************************************************************
46 * intf_sys_t: description and status of wxwindows interface
47 *****************************************************************************/
50 /* the wx parent window */
54 /* secondary windows */
55 Playlist *p_playlist_window;
56 Messages *p_messages_window;
57 FileInfo *p_fileinfo_window;
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 */
67 vlc_bool_t b_program_update; /* do we need to update programs
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
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 */
75 /* windows and widgets */
77 /* The input thread */
78 input_thread_t * p_input;
81 int i_slider_pos; /* slider position */
82 int i_slider_oldpos; /* previous position */
84 /* The messages window */
85 msg_subscription_t* p_sub; /* message bank subscription */
87 /* Playlist management */
88 int i_playing; /* playlist selected item */
90 /* The window labels for DVD mode */
91 unsigned int i_part; /* current chapter */
93 #endif /* !defined(MODULE_NAME_IS_skins) */
95 /*****************************************************************************
97 *****************************************************************************/
99 /*****************************************************************************
100 * Classes declarations.
101 *****************************************************************************/
105 class Timer: public wxTimer
109 Timer( intf_thread_t *p_intf, Interface *p_main_interface );
112 virtual void Notify();
115 intf_thread_t *p_intf;
116 Interface *p_main_interface;
117 int i_old_playing_status;
123 class Interface: public wxFrame
127 Interface( intf_thread_t *p_intf );
128 virtual ~Interface();
129 void TogglePlayButton( int i_playing_status );
131 wxBoxSizer *frame_sizer;
132 wxStatusBar *statusbar;
135 wxWindow *slider_frame;
136 wxStaticBox *slider_box;
138 /* So we don't recreate the open dialog box each time
139 * (and keep the last settings) */
140 OpenDialog *p_open_dialog;
142 wxMenu *p_popup_menu;
145 void CreateOurMenuBar();
146 void CreateOurToolBar();
147 void CreateOurSlider();
148 void Open( int i_access_method );
150 /* Event handlers (these functions should _not_ be virtual) */
151 void OnExit( wxCommandEvent& event );
152 void OnAbout( wxCommandEvent& event );
153 void OnMessages( wxCommandEvent& event );
154 void OnPlaylist( wxCommandEvent& event );
155 void OnLogs( wxCommandEvent& event );
156 void OnFileInfo( wxCommandEvent& event );
157 void OnPreferences( wxCommandEvent& event );
159 void OnOpenFile( wxCommandEvent& event );
160 void OnOpenDisc( wxCommandEvent& event );
161 void OnOpenNet( wxCommandEvent& event );
162 void OnOpenSat( wxCommandEvent& event );
164 void OnPlayStream( wxCommandEvent& event );
165 void OnStopStream( wxCommandEvent& event );
166 void OnSliderUpdate( wxScrollEvent& event );
167 void OnPrevStream( wxCommandEvent& event );
168 void OnNextStream( wxCommandEvent& event );
169 void OnSlowStream( wxCommandEvent& event );
170 void OnFastStream( wxCommandEvent& event );
172 void OnMenuOpen( wxMenuEvent& event );
174 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
175 void OnContextMenu(wxContextMenuEvent& event);
177 void OnContextMenu(wxMouseEvent& event);
180 DECLARE_EVENT_TABLE();
183 intf_thread_t *p_intf;
185 wxFrame *p_prefs_dialog;
187 int i_old_playing_status;
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;
200 class SubsFileDialog;
201 class OpenDialog: public wxDialog
205 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
206 int i_access_method );
207 virtual ~OpenDialog();
212 wxPanel *FilePanel( wxWindow* parent );
213 wxPanel *DiscPanel( wxWindow* parent );
214 wxPanel *NetPanel( wxWindow* parent );
215 wxPanel *SatPanel( wxWindow* parent );
217 void UpdateMRL( int i_access_method );
218 wxArrayString SeparateEntries( wxString );
220 /* Event handlers (these functions should _not_ be virtual) */
221 void OnOk( wxCommandEvent& event );
222 void OnCancel( wxCommandEvent& event );
224 void OnPageChange( wxNotebookEvent& event );
225 void OnMRLChange( wxCommandEvent& event );
227 /* Event handlers for the file page */
228 void OnFilePanelChange( wxCommandEvent& event );
229 void OnFileBrowse( wxCommandEvent& event );
231 /* Event handlers for the disc page */
232 void OnDiscPanelChange( wxCommandEvent& event );
233 void OnDiscTypeChange( wxCommandEvent& event );
235 /* Event handlers for the net page */
236 void OnNetPanelChange( wxCommandEvent& event );
237 void OnNetTypeChange( wxCommandEvent& event );
239 /* Event handlers for the stream output */
240 void OnSubsFileEnable( wxCommandEvent& event );
241 void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
243 /* Event handlers for the stream output */
244 void OnSoutEnable( wxCommandEvent& event );
245 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
247 /* Event handlers for the demux dump */
248 void OnDemuxDumpEnable( wxCommandEvent& event );
249 void OnDemuxDumpBrowse( wxCommandEvent& event );
250 void OnDemuxDumpChange( wxCommandEvent& event );
252 DECLARE_EVENT_TABLE();
254 intf_thread_t *p_intf;
256 int i_current_access_method;
258 wxComboBox *mrl_combo;
260 /* Controls for the file panel */
261 wxComboBox *file_combo;
262 wxFileDialog *file_dialog;
264 /* Controls for the disc panel */
265 wxRadioBox *disc_type;
266 wxTextCtrl *disc_device;
267 wxSpinCtrl *disc_title;
268 wxSpinCtrl *disc_chapter;
270 /* Controls for the net panel */
271 wxRadioBox *net_type;
273 wxPanel *net_subpanels[4];
274 wxRadioButton *net_radios[4];
275 wxSpinCtrl *net_ports[4];
276 wxTextCtrl *net_addrs[4];
278 /* Controls for the subtitles file */
279 wxButton *subsfile_button;
280 wxCheckBox *subsfile_checkbox;
281 SubsFileDialog *subsfile_dialog;
283 /* Controls for the stream output */
284 wxButton *sout_button;
285 wxCheckBox *sout_checkbox;
286 SoutDialog *sout_dialog;
288 /* Controls for the demux dump */
289 wxTextCtrl *demuxdump_textctrl;
290 wxButton *demuxdump_button;
291 wxCheckBox *demuxdump_checkbox;
292 wxFileDialog *demuxdump_dialog;
303 /* Stream output Dialog */
304 class SoutDialog: public wxDialog
308 SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
309 virtual ~SoutDialog();
315 wxPanel *AccessPanel( wxWindow* parent );
316 wxPanel *EncapsulationPanel( wxWindow* parent );
317 wxPanel *TranscodingPanel( wxWindow* parent );
320 /* Event handlers (these functions should _not_ be virtual) */
321 void OnOk( wxCommandEvent& event );
322 void OnCancel( wxCommandEvent& event );
323 void OnMRLChange( wxCommandEvent& event );
324 void OnAccessTypeChange( wxCommandEvent& event );
326 /* Event handlers for the file access output */
327 void OnFileChange( wxCommandEvent& event );
328 void OnFileBrowse( wxCommandEvent& event );
330 /* Event handlers for the net access output */
331 void OnNetChange( wxCommandEvent& event );
333 /* Event handlers for the encapsulation panel */
334 void OnEncapsulationChange( wxCommandEvent& event );
336 /* Event handlers for the transcoding panel */
337 void OnTranscodingEnable( wxCommandEvent& event );
338 void OnTranscodingChange( wxCommandEvent& event );
340 DECLARE_EVENT_TABLE();
342 intf_thread_t *p_intf;
345 wxComboBox *mrl_combo;
347 /* Controls for the access outputs */
348 wxPanel *access_subpanels[5];
349 wxCheckBox *access_checkboxes[5];
353 wxComboBox *file_combo;
354 wxSpinCtrl *net_port;
355 wxTextCtrl *net_addr;
357 /* Controls for the encapsulation */
358 wxRadioButton *encapsulation_radios[5];
359 int i_encapsulation_type;
361 /* Controls for transcoding */
362 wxCheckBox *video_transc_checkbox;
363 wxComboBox *video_codec_combo;
364 wxComboBox *audio_codec_combo;
365 wxCheckBox *audio_transc_checkbox;
366 wxComboBox *video_bitrate_combo;
367 wxComboBox *audio_bitrate_combo;
370 /* Subtitles File Dialog */
371 class SubsFileDialog: public wxDialog
375 SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
376 virtual ~SubsFileDialog();
378 wxComboBox *file_combo;
379 wxSpinCtrl *delay_spinctrl;
380 wxSpinCtrl *fps_spinctrl;
383 /* Event handlers (these functions should _not_ be virtual) */
384 void OnOk( wxCommandEvent& event );
385 void OnCancel( wxCommandEvent& event );
386 void OnFileBrowse( wxCommandEvent& event );
388 DECLARE_EVENT_TABLE();
390 intf_thread_t *p_intf;
394 /* Preferences Dialog */
396 class PrefsDialog: public wxFrame
400 PrefsDialog( intf_thread_t *p_intf, Interface *p_main_interface );
401 virtual ~PrefsDialog();
404 wxPanel *PrefsPanel( wxWindow* parent );
406 /* Event handlers (these functions should _not_ be virtual) */
407 void OnOk( wxCommandEvent& event );
408 void OnCancel( wxCommandEvent& event );
409 void OnSave( wxCommandEvent& event );
410 void OnResetAll( wxCommandEvent& event );
412 DECLARE_EVENT_TABLE();
414 intf_thread_t *p_intf;
415 Interface *p_main_interface;
417 PrefsTreeCtrl *prefs_tree;
421 class Messages: public wxFrame
425 Messages( intf_thread_t *p_intf, Interface *_p_main_interface );
430 /* Event handlers (these functions should _not_ be virtual) */
431 void OnClose( wxCommandEvent& event );
432 void OnVerbose( wxCommandEvent& event );
434 DECLARE_EVENT_TABLE();
436 intf_thread_t *p_intf;
437 Interface *p_main_interface;
438 wxTextCtrl *textctrl;
439 wxTextAttr *info_attr;
440 wxTextAttr *err_attr;
441 wxTextAttr *warn_attr;
442 wxTextAttr *dbg_attr;
444 vlc_bool_t b_verbose;
448 class Playlist: public wxFrame
452 Playlist( intf_thread_t *p_intf, Interface *p_main_interface );
455 void UpdatePlaylist();
456 void ShowPlaylist( bool show );
462 void DeleteItem( int item );
464 /* Event handlers (these functions should _not_ be virtual) */
465 void OnAddMRL( wxCommandEvent& event );
466 void OnClose( wxCommandEvent& event );
467 void OnOpen( wxCommandEvent& event );
468 void OnSave( wxCommandEvent& event );
469 void OnInvertSelection( wxCommandEvent& event );
470 void OnDeleteSelection( wxCommandEvent& event );
471 void OnSelectAll( wxCommandEvent& event );
472 void OnActivateItem( wxListEvent& event );
473 void OnKeyDown( wxListEvent& event );
476 DECLARE_EVENT_TABLE();
478 intf_thread_t *p_intf;
479 Interface *p_main_interface;
480 wxListView *listview;
481 int i_update_counter;
485 class FileInfo: public wxFrame
489 FileInfo( intf_thread_t *p_intf, Interface *p_main_interface );
491 void UpdateFileInfo();
494 void OnClose( wxCommandEvent& event );
496 DECLARE_EVENT_TABLE();
498 intf_thread_t *p_intf;
499 wxTreeCtrl *fileinfo_tree;
500 wxTreeItemId fileinfo_root;
501 wxString fileinfo_root_label;
505 #if !defined(__WXX11__)
506 /* Drag and Drop class */
507 class DragAndDrop: public wxFileDropTarget
510 DragAndDrop( intf_thread_t *_p_intf );
512 virtual bool OnDropFiles( wxCoord x, wxCoord y,
513 const wxArrayString& filenames );
516 intf_thread_t *p_intf;
521 void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface,
522 const wxPoint& pos );
523 wxMenu *AudioMenu( intf_thread_t *_p_intf, Interface *_p_main_interface );
524 wxMenu *VideoMenu( intf_thread_t *_p_intf, Interface *_p_main_interface );
525 wxMenu *NavigMenu( intf_thread_t *_p_intf, Interface *_p_main_interface );
527 class MenuEvtHandler : public wxEvtHandler
530 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
531 virtual ~MenuEvtHandler();
533 void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event );
537 DECLARE_EVENT_TABLE()
539 intf_thread_t *p_intf;
540 Interface *p_main_interface;
543 class Menu: public wxMenu
547 Menu( intf_thread_t *p_intf, Interface *p_main_interface, int i_count,
548 char **ppsz_names, int *pi_objects, int i_start_id );
552 /* Event handlers (these functions should _not_ be virtual) */
553 void OnClose( wxCommandEvent& event );
554 void OnEntrySelected( wxCommandEvent& event );
556 wxMenu *Menu::CreateDummyMenu();
557 void Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
558 wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t * );
560 DECLARE_EVENT_TABLE();
562 intf_thread_t *p_intf;
563 Interface *p_main_interface;