1 /*****************************************************************************
2 * wxwindows.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: wxwindows.h,v 1.44 2003/07/17 18:58:23 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>
32 DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
48 #define SLIDER_MAX_POS 10000
50 /* wxU is used to convert ansi strings to unicode strings (wchar_t) */
52 # define wxU(ansi) wxString(ansi, *wxConvCurrent)
54 # define wxU(ansi) ansi
57 #if !defined(MODULE_NAME_IS_skins)
58 /*****************************************************************************
59 * intf_sys_t: description and status of wxwindows interface
60 *****************************************************************************/
63 /* the wx parent window */
70 /* The input thread */
71 input_thread_t * p_input;
74 int i_slider_pos; /* slider position */
75 int i_slider_oldpos; /* previous position */
76 vlc_bool_t b_slider_free; /* slider status */
78 /* The messages window */
79 msg_subscription_t* p_sub; /* message bank subscription */
81 /* Playlist management */
82 int i_playing; /* playlist selected item */
84 /* Send an event to show a dialog */
85 void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg );
89 vlc_bool_t b_popup_change;
92 #endif /* !defined(MODULE_NAME_IS_skins) */
94 /*****************************************************************************
96 *****************************************************************************/
98 /*****************************************************************************
99 * Classes declarations.
100 *****************************************************************************/
104 class Timer: public wxTimer
108 Timer( intf_thread_t *p_intf, Interface *p_main_interface );
111 virtual void Notify();
114 intf_thread_t *p_intf;
115 Interface *p_main_interface;
116 int i_old_playing_status;
121 class Interface: public wxFrame
125 Interface( intf_thread_t *p_intf );
126 virtual ~Interface();
127 void TogglePlayButton( int i_playing_status );
129 wxBoxSizer *frame_sizer;
130 wxStatusBar *statusbar;
133 wxWindow *slider_frame;
134 wxStaticBox *slider_box;
139 void CreateOurMenuBar();
140 void CreateOurToolBar();
141 void CreateOurSlider();
142 void Open( int i_access_method );
144 /* Event handlers (these functions should _not_ be virtual) */
145 void OnExit( wxCommandEvent& event );
146 void OnAbout( wxCommandEvent& event );
148 void OnShowDialog( wxCommandEvent& event );
150 void OnPlayStream( wxCommandEvent& event );
151 void OnStopStream( wxCommandEvent& event );
152 void OnSliderUpdate( wxScrollEvent& event );
153 void OnPrevStream( wxCommandEvent& event );
154 void OnNextStream( wxCommandEvent& event );
155 void OnSlowStream( wxCommandEvent& event );
156 void OnFastStream( wxCommandEvent& event );
158 void OnMenuOpen( wxMenuEvent& event );
160 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
161 void OnContextMenu2(wxContextMenuEvent& event);
163 void OnContextMenu(wxMouseEvent& event);
165 DECLARE_EVENT_TABLE();
168 intf_thread_t *p_intf;
171 int i_old_playing_status;
173 /* For auto-generated menus */
174 wxMenu *p_audio_menu;
175 vlc_bool_t b_audio_menu;
176 wxMenu *p_video_menu;
177 vlc_bool_t b_video_menu;
178 wxMenu *p_navig_menu;
179 vlc_bool_t b_navig_menu;
182 /* Dialogs Provider */
183 class DialogsProvider: public wxFrame
187 DialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
188 virtual ~DialogsProvider();
191 void Open( int i_access_method, int i_arg );
193 /* Event handlers (these functions should _not_ be virtual) */
194 void OnExit( wxCommandEvent& event );
195 void OnPlaylist( wxCommandEvent& event );
196 void OnMessages( wxCommandEvent& event );
197 void OnFileInfo( wxCommandEvent& event );
198 void OnPreferences( wxCommandEvent& event );
200 void OnOpenFileSimple( wxCommandEvent& event );
201 void OnOpenFile( wxCommandEvent& event );
202 void OnOpenDisc( wxCommandEvent& event );
203 void OnOpenNet( wxCommandEvent& event );
204 void OnOpenSat( wxCommandEvent& event );
206 void OnPopupMenu( wxCommandEvent& event );
208 void OnIdle( wxIdleEvent& event );
210 DECLARE_EVENT_TABLE();
212 intf_thread_t *p_intf;
215 /* Secondary windows */
216 OpenDialog *p_open_dialog;
217 wxFileDialog *p_file_dialog;
218 Playlist *p_playlist_dialog;
219 Messages *p_messages_dialog;
220 FileInfo *p_fileinfo_dialog;
221 wxFrame *p_prefs_dialog;
226 class SubsFileDialog;
227 class OpenDialog: public wxFrame
231 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
232 int i_access_method, int i_arg = 0 );
233 virtual ~OpenDialog();
236 int Show( int i_access_method, int i_arg = 0 );
241 wxPanel *FilePanel( wxWindow* parent );
242 wxPanel *DiscPanel( wxWindow* parent );
243 wxPanel *NetPanel( wxWindow* parent );
244 wxPanel *SatPanel( wxWindow* parent );
246 void UpdateMRL( int i_access_method );
247 wxArrayString SeparateEntries( wxString );
249 /* Event handlers (these functions should _not_ be virtual) */
250 void OnOk( wxCommandEvent& event );
251 void OnCancel( wxCommandEvent& event );
253 void OnPageChange( wxNotebookEvent& event );
254 void OnMRLChange( wxCommandEvent& event );
256 /* Event handlers for the file page */
257 void OnFilePanelChange( wxCommandEvent& event );
258 void OnFileBrowse( wxCommandEvent& event );
260 /* Event handlers for the disc page */
261 void OnDiscPanelChange( wxCommandEvent& event );
262 void OnDiscTypeChange( wxCommandEvent& event );
264 /* Event handlers for the net page */
265 void OnNetPanelChange( wxCommandEvent& event );
266 void OnNetTypeChange( wxCommandEvent& event );
268 /* Event handlers for the stream output */
269 void OnSubsFileEnable( wxCommandEvent& event );
270 void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
272 /* Event handlers for the stream output */
273 void OnSoutEnable( wxCommandEvent& event );
274 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
276 /* Event handlers for the demux dump */
277 void OnDemuxDumpEnable( wxCommandEvent& event );
278 void OnDemuxDumpBrowse( wxCommandEvent& event );
279 void OnDemuxDumpChange( wxCommandEvent& event );
281 DECLARE_EVENT_TABLE();
283 intf_thread_t *p_intf;
285 int i_current_access_method;
287 wxComboBox *mrl_combo;
288 wxNotebook *notebook;
290 /* Controls for the file panel */
291 wxComboBox *file_combo;
292 wxFileDialog *file_dialog;
294 /* Controls for the disc panel */
295 wxRadioBox *disc_type;
296 wxTextCtrl *disc_device;
297 wxSpinCtrl *disc_title;
298 wxSpinCtrl *disc_chapter;
300 /* Controls for the net panel */
301 wxRadioBox *net_type;
303 wxPanel *net_subpanels[4];
304 wxRadioButton *net_radios[4];
305 wxSpinCtrl *net_ports[4];
306 wxTextCtrl *net_addrs[4];
308 /* Controls for the subtitles file */
309 wxButton *subsfile_button;
310 wxCheckBox *subsfile_checkbox;
311 SubsFileDialog *subsfile_dialog;
313 /* Controls for the stream output */
314 wxButton *sout_button;
315 wxCheckBox *sout_checkbox;
316 SoutDialog *sout_dialog;
318 /* Controls for the demux dump */
319 wxTextCtrl *demuxdump_textctrl;
320 wxButton *demuxdump_button;
321 wxCheckBox *demuxdump_checkbox;
322 wxFileDialog *demuxdump_dialog;
325 /* Stream output Dialog */
326 class SoutDialog: public wxDialog
330 SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
331 virtual ~SoutDialog();
337 wxPanel *AccessPanel( wxWindow* parent );
338 wxPanel *MiscPanel( wxWindow* parent );
339 wxPanel *EncapsulationPanel( wxWindow* parent );
340 wxPanel *TranscodingPanel( wxWindow* parent );
343 /* Event handlers (these functions should _not_ be virtual) */
344 void OnOk( wxCommandEvent& event );
345 void OnCancel( wxCommandEvent& event );
346 void OnMRLChange( wxCommandEvent& event );
347 void OnAccessTypeChange( wxCommandEvent& event );
349 /* Event handlers for the file access output */
350 void OnFileChange( wxCommandEvent& event );
351 void OnFileBrowse( wxCommandEvent& event );
353 /* Event handlers for the net access output */
354 void OnNetChange( wxCommandEvent& event );
356 /* Event specific to the sap address */
357 void OnSAPAddrChange( wxCommandEvent& event );
359 /* Event handlers for the encapsulation panel */
360 void OnEncapsulationChange( wxCommandEvent& event );
362 /* Event handlers for the transcoding panel */
363 void OnTranscodingEnable( wxCommandEvent& event );
364 void OnTranscodingChange( wxCommandEvent& event );
366 /* Event handlers for the misc panel */
367 void OnSAPMiscChange( wxCommandEvent& event );
369 DECLARE_EVENT_TABLE();
371 intf_thread_t *p_intf;
374 wxComboBox *mrl_combo;
376 /* Controls for the access outputs */
377 wxPanel *access_subpanels[5];
378 wxCheckBox *access_checkboxes[5];
382 wxComboBox *file_combo;
383 wxSpinCtrl *net_ports[5];
384 wxTextCtrl *net_addrs[5];
386 /* Controls for the SAP announces */
387 wxPanel *misc_subpanels[1];
388 wxCheckBox *sap_checkbox;
389 wxTextCtrl *sap_addr;
391 /* Controls for the encapsulation */
392 wxRadioButton *encapsulation_radios[5];
393 int i_encapsulation_type;
395 /* Controls for transcoding */
396 wxCheckBox *video_transc_checkbox;
397 wxComboBox *video_codec_combo;
398 wxComboBox *audio_codec_combo;
399 wxCheckBox *audio_transc_checkbox;
400 wxComboBox *video_bitrate_combo;
401 wxComboBox *audio_bitrate_combo;
402 wxComboBox *audio_channels_combo;
405 /* Subtitles File Dialog */
406 class SubsFileDialog: public wxDialog
410 SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
411 virtual ~SubsFileDialog();
413 wxComboBox *file_combo;
414 wxSpinCtrl *delay_spinctrl;
415 wxSpinCtrl *fps_spinctrl;
418 /* Event handlers (these functions should _not_ be virtual) */
419 void OnOk( wxCommandEvent& event );
420 void OnCancel( wxCommandEvent& event );
421 void OnFileBrowse( wxCommandEvent& event );
423 DECLARE_EVENT_TABLE();
425 intf_thread_t *p_intf;
429 /* Preferences Dialog */
431 class PrefsDialog: public wxFrame
435 PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
436 virtual ~PrefsDialog();
439 wxPanel *PrefsPanel( wxWindow* parent );
441 /* Event handlers (these functions should _not_ be virtual) */
442 void OnOk( wxCommandEvent& event );
443 void OnCancel( wxCommandEvent& event );
444 void OnSave( wxCommandEvent& event );
445 void OnResetAll( wxCommandEvent& event );
447 DECLARE_EVENT_TABLE();
449 intf_thread_t *p_intf;
451 PrefsTreeCtrl *prefs_tree;
455 class Messages: public wxFrame
459 Messages( intf_thread_t *p_intf, wxWindow *p_parent );
464 /* Event handlers (these functions should _not_ be virtual) */
465 void OnClose( wxCommandEvent& event );
466 void OnVerbose( wxCommandEvent& event );
467 void OnClear( wxCommandEvent& event );
468 void OnSaveLog( wxCommandEvent& event );
470 DECLARE_EVENT_TABLE();
472 intf_thread_t *p_intf;
473 wxTextCtrl *textctrl;
474 wxTextAttr *info_attr;
475 wxTextAttr *err_attr;
476 wxTextAttr *warn_attr;
477 wxTextAttr *dbg_attr;
479 wxFileDialog *save_log_dialog;
481 vlc_bool_t b_verbose;
485 class Playlist: public wxFrame
489 Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
492 void UpdatePlaylist();
493 void ShowPlaylist( bool show );
499 void DeleteItem( int item );
501 /* Event handlers (these functions should _not_ be virtual) */
502 void OnAddFile( wxCommandEvent& event );
503 void OnAddMRL( wxCommandEvent& event );
504 void OnClose( wxCommandEvent& event );
505 void OnOpen( wxCommandEvent& event );
506 void OnSave( wxCommandEvent& event );
507 void OnInvertSelection( wxCommandEvent& event );
508 void OnDeleteSelection( wxCommandEvent& event );
509 void OnSelectAll( wxCommandEvent& event );
510 void OnActivateItem( wxListEvent& event );
511 void OnKeyDown( wxListEvent& event );
514 DECLARE_EVENT_TABLE();
516 intf_thread_t *p_intf;
517 wxListView *listview;
518 int i_update_counter;
522 class FileInfo: public wxFrame
526 FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
528 void UpdateFileInfo();
531 void OnClose( wxCommandEvent& event );
533 DECLARE_EVENT_TABLE();
535 intf_thread_t *p_intf;
536 wxTreeCtrl *fileinfo_tree;
537 wxTreeItemId fileinfo_root;
538 wxString fileinfo_root_label;
542 #if !defined(__WXX11__)
543 /* Drag and Drop class */
544 class DragAndDrop: public wxFileDropTarget
547 DragAndDrop( intf_thread_t *_p_intf );
549 virtual bool OnDropFiles( wxCoord x, wxCoord y,
550 const wxArrayString& filenames );
553 intf_thread_t *p_intf;
558 void PopupMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
559 const wxPoint& pos );
560 wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
561 wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
562 wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
564 class MenuEvtHandler : public wxEvtHandler
567 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
568 virtual ~MenuEvtHandler();
570 void OnMenuEvent( wxCommandEvent& event );
571 void OnShowDialog( wxCommandEvent& event );
575 DECLARE_EVENT_TABLE()
577 intf_thread_t *p_intf;
578 Interface *p_main_interface;
581 class Menu: public wxMenu
585 Menu( intf_thread_t *p_intf, wxWindow *p_parent, int i_count,
586 char **ppsz_names, int *pi_objects, int i_start_id );
590 /* Event handlers (these functions should _not_ be virtual) */
591 void OnClose( wxCommandEvent& event );
592 void OnShowDialog( wxCommandEvent& event );
593 void OnEntrySelected( wxCommandEvent& event );
595 wxMenu *Menu::CreateDummyMenu();
596 void Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
597 wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t * );
599 DECLARE_EVENT_TABLE();
601 intf_thread_t *p_intf;