1 /*****************************************************************************
2 * wxwindows.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: wxwindows.h,v 1.31 2003/05/24 17:52:49 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();
210 int ShowModal( int i_access_method );
215 wxPanel *FilePanel( wxWindow* parent );
216 wxPanel *DiscPanel( wxWindow* parent );
217 wxPanel *NetPanel( wxWindow* parent );
218 wxPanel *SatPanel( wxWindow* parent );
220 void UpdateMRL( int i_access_method );
221 wxArrayString SeparateEntries( wxString );
223 /* Event handlers (these functions should _not_ be virtual) */
224 void OnOk( wxCommandEvent& event );
225 void OnCancel( wxCommandEvent& event );
227 void OnPageChange( wxNotebookEvent& event );
228 void OnMRLChange( wxCommandEvent& event );
230 /* Event handlers for the file page */
231 void OnFilePanelChange( wxCommandEvent& event );
232 void OnFileBrowse( wxCommandEvent& event );
234 /* Event handlers for the disc page */
235 void OnDiscPanelChange( wxCommandEvent& event );
236 void OnDiscTypeChange( wxCommandEvent& event );
238 /* Event handlers for the net page */
239 void OnNetPanelChange( wxCommandEvent& event );
240 void OnNetTypeChange( wxCommandEvent& event );
242 /* Event handlers for the stream output */
243 void OnSubsFileEnable( wxCommandEvent& event );
244 void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
246 /* Event handlers for the stream output */
247 void OnSoutEnable( wxCommandEvent& event );
248 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
250 /* Event handlers for the demux dump */
251 void OnDemuxDumpEnable( wxCommandEvent& event );
252 void OnDemuxDumpBrowse( wxCommandEvent& event );
253 void OnDemuxDumpChange( wxCommandEvent& event );
255 DECLARE_EVENT_TABLE();
257 intf_thread_t *p_intf;
259 int i_current_access_method;
261 wxComboBox *mrl_combo;
262 wxNotebook *notebook;
264 /* Controls for the file panel */
265 wxComboBox *file_combo;
266 wxFileDialog *file_dialog;
268 /* Controls for the disc panel */
269 wxRadioBox *disc_type;
270 wxTextCtrl *disc_device;
271 wxSpinCtrl *disc_title;
272 wxSpinCtrl *disc_chapter;
274 /* Controls for the net panel */
275 wxRadioBox *net_type;
277 wxPanel *net_subpanels[4];
278 wxRadioButton *net_radios[4];
279 wxSpinCtrl *net_ports[4];
280 wxTextCtrl *net_addrs[4];
282 /* Controls for the subtitles file */
283 wxButton *subsfile_button;
284 wxCheckBox *subsfile_checkbox;
285 SubsFileDialog *subsfile_dialog;
287 /* Controls for the stream output */
288 wxButton *sout_button;
289 wxCheckBox *sout_checkbox;
290 SoutDialog *sout_dialog;
292 /* Controls for the demux dump */
293 wxTextCtrl *demuxdump_textctrl;
294 wxButton *demuxdump_button;
295 wxCheckBox *demuxdump_checkbox;
296 wxFileDialog *demuxdump_dialog;
307 /* Stream output Dialog */
308 class SoutDialog: public wxDialog
312 SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
313 virtual ~SoutDialog();
319 wxPanel *AccessPanel( wxWindow* parent );
320 wxPanel *EncapsulationPanel( wxWindow* parent );
321 wxPanel *TranscodingPanel( wxWindow* parent );
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 );
330 /* Event handlers for the file access output */
331 void OnFileChange( wxCommandEvent& event );
332 void OnFileBrowse( wxCommandEvent& event );
334 /* Event handlers for the net access output */
335 void OnNetChange( wxCommandEvent& event );
337 /* Event handlers for the encapsulation panel */
338 void OnEncapsulationChange( wxCommandEvent& event );
340 /* Event handlers for the transcoding panel */
341 void OnTranscodingEnable( wxCommandEvent& event );
342 void OnTranscodingChange( wxCommandEvent& event );
344 DECLARE_EVENT_TABLE();
346 intf_thread_t *p_intf;
349 wxComboBox *mrl_combo;
351 /* Controls for the access outputs */
352 wxPanel *access_subpanels[5];
353 wxCheckBox *access_checkboxes[5];
357 wxComboBox *file_combo;
358 wxSpinCtrl *net_port;
359 wxTextCtrl *net_addr;
361 /* Controls for the encapsulation */
362 wxRadioButton *encapsulation_radios[5];
363 int i_encapsulation_type;
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;
374 /* Subtitles File Dialog */
375 class SubsFileDialog: public wxDialog
379 SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
380 virtual ~SubsFileDialog();
382 wxComboBox *file_combo;
383 wxSpinCtrl *delay_spinctrl;
384 wxSpinCtrl *fps_spinctrl;
387 /* Event handlers (these functions should _not_ be virtual) */
388 void OnOk( wxCommandEvent& event );
389 void OnCancel( wxCommandEvent& event );
390 void OnFileBrowse( wxCommandEvent& event );
392 DECLARE_EVENT_TABLE();
394 intf_thread_t *p_intf;
398 /* Preferences Dialog */
400 class PrefsDialog: public wxFrame
404 PrefsDialog( intf_thread_t *p_intf, Interface *p_main_interface );
405 virtual ~PrefsDialog();
408 wxPanel *PrefsPanel( wxWindow* parent );
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 );
416 DECLARE_EVENT_TABLE();
418 intf_thread_t *p_intf;
419 Interface *p_main_interface;
421 PrefsTreeCtrl *prefs_tree;
425 class Messages: public wxFrame
429 Messages( intf_thread_t *p_intf, Interface *_p_main_interface );
434 /* Event handlers (these functions should _not_ be virtual) */
435 void OnClose( wxCommandEvent& event );
436 void OnVerbose( wxCommandEvent& event );
438 DECLARE_EVENT_TABLE();
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;
448 vlc_bool_t b_verbose;
452 class Playlist: public wxFrame
456 Playlist( intf_thread_t *p_intf, Interface *p_main_interface );
459 void UpdatePlaylist();
460 void ShowPlaylist( bool show );
466 void DeleteItem( int item );
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 );
480 DECLARE_EVENT_TABLE();
482 intf_thread_t *p_intf;
483 Interface *p_main_interface;
484 wxListView *listview;
485 int i_update_counter;
489 class FileInfo: public wxFrame
493 FileInfo( intf_thread_t *p_intf, Interface *p_main_interface );
495 void UpdateFileInfo();
498 void OnClose( wxCommandEvent& event );
500 DECLARE_EVENT_TABLE();
502 intf_thread_t *p_intf;
503 wxTreeCtrl *fileinfo_tree;
504 wxTreeItemId fileinfo_root;
505 wxString fileinfo_root_label;
509 #if !defined(__WXX11__)
510 /* Drag and Drop class */
511 class DragAndDrop: public wxFileDropTarget
514 DragAndDrop( intf_thread_t *_p_intf );
516 virtual bool OnDropFiles( wxCoord x, wxCoord y,
517 const wxArrayString& filenames );
520 intf_thread_t *p_intf;
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 );
531 class MenuEvtHandler : public wxEvtHandler
534 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
535 virtual ~MenuEvtHandler();
537 void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event );
541 DECLARE_EVENT_TABLE()
543 intf_thread_t *p_intf;
544 Interface *p_main_interface;
547 class Menu: public wxMenu
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 );
556 /* Event handlers (these functions should _not_ be virtual) */
557 void OnClose( wxCommandEvent& event );
558 void OnEntrySelected( wxCommandEvent& event );
560 wxMenu *Menu::CreateDummyMenu();
561 void Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
562 wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t * );
564 DECLARE_EVENT_TABLE();
566 intf_thread_t *p_intf;
567 Interface *p_main_interface;