1 /*****************************************************************************
2 * wxwindows.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: wxwindows.h,v 1.47 2003/07/20 10:38: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>
32 DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
48 #define SLIDER_MAX_POS 10000
50 /* wxU is used to convert ansi/utf8 strings to unicode strings (wchar_t) */
51 #if defined( ENABLE_NLS ) && defined( HAVE_GETTEXT ) && \
52 defined( WIN32 ) && !defined( HAVE_INCLUDED_GETTEXT )
54 # define wxU(utf8) wxString(utf8, wxConvUTF8)
56 # define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
59 #else // ENABLE_NLS && HAVE_GETTEXT && WIN32 && !HAVE_INCLUDED_GETTEXT
61 # define wxU(ansi) wxString(ansi, *wxConvCurrent)
63 # define wxU(ansi) ansi
68 #if !defined(MODULE_NAME_IS_skins)
69 /*****************************************************************************
70 * intf_sys_t: description and status of wxwindows interface
71 *****************************************************************************/
74 /* the wx parent window */
81 /* The input thread */
82 input_thread_t * p_input;
85 int i_slider_pos; /* slider position */
86 int i_slider_oldpos; /* previous position */
87 vlc_bool_t b_slider_free; /* slider status */
89 /* The messages window */
90 msg_subscription_t* p_sub; /* message bank subscription */
92 /* Playlist management */
93 int i_playing; /* playlist selected item */
95 /* Send an event to show a dialog */
96 void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
97 intf_dialog_args_t *p_arg );
100 wxMenu *p_popup_menu;
103 #endif /* !defined(MODULE_NAME_IS_skins) */
105 /*****************************************************************************
107 *****************************************************************************/
109 /*****************************************************************************
110 * Classes declarations.
111 *****************************************************************************/
115 class Timer: public wxTimer
119 Timer( intf_thread_t *p_intf, Interface *p_main_interface );
122 virtual void Notify();
125 intf_thread_t *p_intf;
126 Interface *p_main_interface;
127 int i_old_playing_status;
132 class Interface: public wxFrame
136 Interface( intf_thread_t *p_intf );
137 virtual ~Interface();
138 void TogglePlayButton( int i_playing_status );
140 wxBoxSizer *frame_sizer;
141 wxStatusBar *statusbar;
144 wxWindow *slider_frame;
145 wxStaticBox *slider_box;
150 void CreateOurMenuBar();
151 void CreateOurToolBar();
152 void CreateOurSlider();
153 void Open( int i_access_method );
155 /* Event handlers (these functions should _not_ be virtual) */
156 void OnExit( wxCommandEvent& event );
157 void OnAbout( wxCommandEvent& event );
159 void OnShowDialog( wxCommandEvent& event );
161 void OnPlayStream( wxCommandEvent& event );
162 void OnStopStream( wxCommandEvent& event );
163 void OnSliderUpdate( wxScrollEvent& event );
164 void OnPrevStream( wxCommandEvent& event );
165 void OnNextStream( wxCommandEvent& event );
166 void OnSlowStream( wxCommandEvent& event );
167 void OnFastStream( wxCommandEvent& event );
169 void OnMenuOpen( wxMenuEvent& event );
171 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
172 void OnContextMenu2(wxContextMenuEvent& event);
174 void OnContextMenu(wxMouseEvent& event);
176 DECLARE_EVENT_TABLE();
179 intf_thread_t *p_intf;
182 int i_old_playing_status;
184 /* For auto-generated menus */
185 wxMenu *p_audio_menu;
186 vlc_bool_t b_audio_menu;
187 wxMenu *p_video_menu;
188 vlc_bool_t b_video_menu;
189 wxMenu *p_navig_menu;
190 vlc_bool_t b_navig_menu;
193 /* Dialogs Provider */
194 class DialogsProvider: public wxFrame
198 DialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
199 virtual ~DialogsProvider();
202 void Open( int i_access_method, int i_arg );
204 /* Event handlers (these functions should _not_ be virtual) */
205 void OnExit( wxCommandEvent& event );
206 void OnPlaylist( wxCommandEvent& event );
207 void OnMessages( wxCommandEvent& event );
208 void OnFileInfo( wxCommandEvent& event );
209 void OnPreferences( wxCommandEvent& event );
211 void OnOpenFileGeneric( wxCommandEvent& event );
212 void OnOpenFileSimple( wxCommandEvent& event );
213 void OnOpenFile( wxCommandEvent& event );
214 void OnOpenDisc( wxCommandEvent& event );
215 void OnOpenNet( wxCommandEvent& event );
216 void OnOpenSat( wxCommandEvent& event );
218 void OnPopupMenu( wxCommandEvent& event );
220 void OnIdle( wxIdleEvent& event );
222 void OnExitThread( wxCommandEvent& event );
224 DECLARE_EVENT_TABLE();
226 intf_thread_t *p_intf;
229 /* Secondary windows */
230 OpenDialog *p_open_dialog;
231 wxFileDialog *p_file_dialog;
232 Playlist *p_playlist_dialog;
233 Messages *p_messages_dialog;
234 FileInfo *p_fileinfo_dialog;
235 wxFrame *p_prefs_dialog;
236 wxFileDialog *p_file_generic_dialog;
241 class SubsFileDialog;
242 class OpenDialog: public wxFrame
246 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
247 int i_access_method, int i_arg = 0 );
248 virtual ~OpenDialog();
251 int Show( int i_access_method, int i_arg = 0 );
256 wxPanel *FilePanel( wxWindow* parent );
257 wxPanel *DiscPanel( wxWindow* parent );
258 wxPanel *NetPanel( wxWindow* parent );
259 wxPanel *SatPanel( wxWindow* parent );
261 void UpdateMRL( int i_access_method );
262 wxArrayString SeparateEntries( wxString );
264 /* Event handlers (these functions should _not_ be virtual) */
265 void OnOk( wxCommandEvent& event );
266 void OnCancel( wxCommandEvent& event );
268 void OnPageChange( wxNotebookEvent& event );
269 void OnMRLChange( wxCommandEvent& event );
271 /* Event handlers for the file page */
272 void OnFilePanelChange( wxCommandEvent& event );
273 void OnFileBrowse( wxCommandEvent& event );
275 /* Event handlers for the disc page */
276 void OnDiscPanelChange( wxCommandEvent& event );
277 void OnDiscTypeChange( wxCommandEvent& event );
279 /* Event handlers for the net page */
280 void OnNetPanelChange( wxCommandEvent& event );
281 void OnNetTypeChange( wxCommandEvent& event );
283 /* Event handlers for the stream output */
284 void OnSubsFileEnable( wxCommandEvent& event );
285 void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
287 /* Event handlers for the stream output */
288 void OnSoutEnable( wxCommandEvent& event );
289 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
291 /* Event handlers for the demux dump */
292 void OnDemuxDumpEnable( wxCommandEvent& event );
293 void OnDemuxDumpBrowse( wxCommandEvent& event );
294 void OnDemuxDumpChange( wxCommandEvent& event );
296 DECLARE_EVENT_TABLE();
298 intf_thread_t *p_intf;
300 int i_current_access_method;
302 wxComboBox *mrl_combo;
303 wxNotebook *notebook;
305 /* Controls for the file panel */
306 wxComboBox *file_combo;
307 wxFileDialog *file_dialog;
309 /* Controls for the disc panel */
310 wxRadioBox *disc_type;
311 wxTextCtrl *disc_device;
312 wxSpinCtrl *disc_title;
313 wxSpinCtrl *disc_chapter;
315 /* Controls for the net panel */
316 wxRadioBox *net_type;
318 wxPanel *net_subpanels[4];
319 wxRadioButton *net_radios[4];
320 wxSpinCtrl *net_ports[4];
321 wxTextCtrl *net_addrs[4];
323 /* Controls for the subtitles file */
324 wxButton *subsfile_button;
325 wxCheckBox *subsfile_checkbox;
326 SubsFileDialog *subsfile_dialog;
328 /* Controls for the stream output */
329 wxButton *sout_button;
330 wxCheckBox *sout_checkbox;
331 SoutDialog *sout_dialog;
333 /* Controls for the demux dump */
334 wxTextCtrl *demuxdump_textctrl;
335 wxButton *demuxdump_button;
336 wxCheckBox *demuxdump_checkbox;
337 wxFileDialog *demuxdump_dialog;
340 /* Stream output Dialog */
341 class SoutDialog: public wxDialog
345 SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
346 virtual ~SoutDialog();
352 wxPanel *AccessPanel( wxWindow* parent );
353 wxPanel *MiscPanel( wxWindow* parent );
354 wxPanel *EncapsulationPanel( wxWindow* parent );
355 wxPanel *TranscodingPanel( wxWindow* parent );
358 /* Event handlers (these functions should _not_ be virtual) */
359 void OnOk( wxCommandEvent& event );
360 void OnCancel( wxCommandEvent& event );
361 void OnMRLChange( wxCommandEvent& event );
362 void OnAccessTypeChange( wxCommandEvent& event );
364 /* Event handlers for the file access output */
365 void OnFileChange( wxCommandEvent& event );
366 void OnFileBrowse( wxCommandEvent& event );
368 /* Event handlers for the net access output */
369 void OnNetChange( wxCommandEvent& event );
371 /* Event specific to the sap address */
372 void OnSAPAddrChange( wxCommandEvent& event );
374 /* Event handlers for the encapsulation panel */
375 void OnEncapsulationChange( wxCommandEvent& event );
377 /* Event handlers for the transcoding panel */
378 void OnTranscodingEnable( wxCommandEvent& event );
379 void OnTranscodingChange( wxCommandEvent& event );
381 /* Event handlers for the misc panel */
382 void OnSAPMiscChange( wxCommandEvent& event );
384 DECLARE_EVENT_TABLE();
386 intf_thread_t *p_intf;
389 wxComboBox *mrl_combo;
391 /* Controls for the access outputs */
392 wxPanel *access_subpanels[5];
393 wxCheckBox *access_checkboxes[5];
397 wxComboBox *file_combo;
398 wxSpinCtrl *net_ports[5];
399 wxTextCtrl *net_addrs[5];
401 /* Controls for the SAP announces */
402 wxPanel *misc_subpanels[1];
403 wxCheckBox *sap_checkbox;
404 wxTextCtrl *sap_addr;
406 /* Controls for the encapsulation */
407 wxRadioButton *encapsulation_radios[5];
408 int i_encapsulation_type;
410 /* Controls for transcoding */
411 wxCheckBox *video_transc_checkbox;
412 wxComboBox *video_codec_combo;
413 wxComboBox *audio_codec_combo;
414 wxCheckBox *audio_transc_checkbox;
415 wxComboBox *video_bitrate_combo;
416 wxComboBox *audio_bitrate_combo;
417 wxComboBox *audio_channels_combo;
420 /* Subtitles File Dialog */
421 class SubsFileDialog: public wxDialog
425 SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
426 virtual ~SubsFileDialog();
428 wxComboBox *file_combo;
429 wxSpinCtrl *delay_spinctrl;
430 wxSpinCtrl *fps_spinctrl;
433 /* Event handlers (these functions should _not_ be virtual) */
434 void OnOk( wxCommandEvent& event );
435 void OnCancel( wxCommandEvent& event );
436 void OnFileBrowse( wxCommandEvent& event );
438 DECLARE_EVENT_TABLE();
440 intf_thread_t *p_intf;
444 /* Preferences Dialog */
446 class PrefsDialog: public wxFrame
450 PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
451 virtual ~PrefsDialog();
454 wxPanel *PrefsPanel( wxWindow* parent );
456 /* Event handlers (these functions should _not_ be virtual) */
457 void OnOk( wxCommandEvent& event );
458 void OnCancel( wxCommandEvent& event );
459 void OnSave( wxCommandEvent& event );
460 void OnResetAll( wxCommandEvent& event );
462 DECLARE_EVENT_TABLE();
464 intf_thread_t *p_intf;
466 PrefsTreeCtrl *prefs_tree;
470 class Messages: public wxFrame
474 Messages( intf_thread_t *p_intf, wxWindow *p_parent );
479 /* Event handlers (these functions should _not_ be virtual) */
480 void OnClose( wxCommandEvent& event );
481 void OnVerbose( wxCommandEvent& event );
482 void OnClear( wxCommandEvent& event );
483 void OnSaveLog( wxCommandEvent& event );
485 DECLARE_EVENT_TABLE();
487 intf_thread_t *p_intf;
488 wxTextCtrl *textctrl;
489 wxTextAttr *info_attr;
490 wxTextAttr *err_attr;
491 wxTextAttr *warn_attr;
492 wxTextAttr *dbg_attr;
494 wxFileDialog *save_log_dialog;
496 vlc_bool_t b_verbose;
500 class Playlist: public wxFrame
504 Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
507 void UpdatePlaylist();
508 void ShowPlaylist( bool show );
514 void DeleteItem( int item );
516 /* Event handlers (these functions should _not_ be virtual) */
517 void OnAddFile( wxCommandEvent& event );
518 void OnAddMRL( wxCommandEvent& event );
519 void OnClose( wxCommandEvent& event );
520 void OnOpen( wxCommandEvent& event );
521 void OnSave( wxCommandEvent& event );
522 void OnInvertSelection( wxCommandEvent& event );
523 void OnDeleteSelection( wxCommandEvent& event );
524 void OnSelectAll( wxCommandEvent& event );
525 void OnActivateItem( wxListEvent& event );
526 void OnKeyDown( wxListEvent& event );
529 DECLARE_EVENT_TABLE();
531 intf_thread_t *p_intf;
532 wxListView *listview;
533 int i_update_counter;
537 class FileInfo: public wxFrame
541 FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
543 void UpdateFileInfo();
546 void OnClose( wxCommandEvent& event );
548 DECLARE_EVENT_TABLE();
550 intf_thread_t *p_intf;
551 wxTreeCtrl *fileinfo_tree;
552 wxTreeItemId fileinfo_root;
553 wxString fileinfo_root_label;
557 #if !defined(__WXX11__)
558 /* Drag and Drop class */
559 class DragAndDrop: public wxFileDropTarget
562 DragAndDrop( intf_thread_t *_p_intf );
564 virtual bool OnDropFiles( wxCoord x, wxCoord y,
565 const wxArrayString& filenames );
568 intf_thread_t *p_intf;
573 void PopupMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
574 const wxPoint& pos );
575 wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
576 wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
577 wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
579 class MenuEvtHandler : public wxEvtHandler
582 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
583 virtual ~MenuEvtHandler();
585 void OnMenuEvent( wxCommandEvent& event );
586 void OnShowDialog( wxCommandEvent& event );
590 DECLARE_EVENT_TABLE()
592 intf_thread_t *p_intf;
593 Interface *p_main_interface;
596 class Menu: public wxMenu
600 Menu( intf_thread_t *p_intf, wxWindow *p_parent, int i_count,
601 char **ppsz_names, int *pi_objects, int i_start_id );
605 /* Event handlers (these functions should _not_ be virtual) */
606 void OnClose( wxCommandEvent& event );
607 void OnShowDialog( wxCommandEvent& event );
608 void OnEntrySelected( wxCommandEvent& event );
610 wxMenu *Menu::CreateDummyMenu();
611 void Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
612 wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t * );
614 DECLARE_EVENT_TABLE();
616 intf_thread_t *p_intf;