1 /*****************************************************************************
2 * wxwindows.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: wxwindows.h,v 1.46 2003/07/19 16:33:55 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(ut8 ) wxString(wxConvUTF8.cMB2WC(ut8), *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 );
102 #endif /* !defined(MODULE_NAME_IS_skins) */
104 /*****************************************************************************
106 *****************************************************************************/
108 /*****************************************************************************
109 * Classes declarations.
110 *****************************************************************************/
114 class Timer: public wxTimer
118 Timer( intf_thread_t *p_intf, Interface *p_main_interface );
121 virtual void Notify();
124 intf_thread_t *p_intf;
125 Interface *p_main_interface;
126 int i_old_playing_status;
131 class Interface: public wxFrame
135 Interface( intf_thread_t *p_intf );
136 virtual ~Interface();
137 void TogglePlayButton( int i_playing_status );
139 wxBoxSizer *frame_sizer;
140 wxStatusBar *statusbar;
143 wxWindow *slider_frame;
144 wxStaticBox *slider_box;
149 void CreateOurMenuBar();
150 void CreateOurToolBar();
151 void CreateOurSlider();
152 void Open( int i_access_method );
154 /* Event handlers (these functions should _not_ be virtual) */
155 void OnExit( wxCommandEvent& event );
156 void OnAbout( wxCommandEvent& event );
158 void OnShowDialog( wxCommandEvent& event );
160 void OnPlayStream( wxCommandEvent& event );
161 void OnStopStream( wxCommandEvent& event );
162 void OnSliderUpdate( wxScrollEvent& event );
163 void OnPrevStream( wxCommandEvent& event );
164 void OnNextStream( wxCommandEvent& event );
165 void OnSlowStream( wxCommandEvent& event );
166 void OnFastStream( wxCommandEvent& event );
168 void OnMenuOpen( wxMenuEvent& event );
170 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
171 void OnContextMenu2(wxContextMenuEvent& event);
173 void OnContextMenu(wxMouseEvent& event);
175 DECLARE_EVENT_TABLE();
178 intf_thread_t *p_intf;
181 int i_old_playing_status;
183 /* For auto-generated menus */
184 wxMenu *p_audio_menu;
185 vlc_bool_t b_audio_menu;
186 wxMenu *p_video_menu;
187 vlc_bool_t b_video_menu;
188 wxMenu *p_navig_menu;
189 vlc_bool_t b_navig_menu;
192 /* Dialogs Provider */
193 class DialogsProvider: public wxFrame
197 DialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
198 virtual ~DialogsProvider();
201 void Open( int i_access_method, int i_arg );
203 /* Event handlers (these functions should _not_ be virtual) */
204 void OnExit( wxCommandEvent& event );
205 void OnPlaylist( wxCommandEvent& event );
206 void OnMessages( wxCommandEvent& event );
207 void OnFileInfo( wxCommandEvent& event );
208 void OnPreferences( wxCommandEvent& event );
210 void OnOpenFileSimple( wxCommandEvent& event );
211 void OnOpenFile( wxCommandEvent& event );
212 void OnOpenDisc( wxCommandEvent& event );
213 void OnOpenNet( wxCommandEvent& event );
214 void OnOpenSat( wxCommandEvent& event );
216 void OnPopupMenu( wxCommandEvent& event );
218 void OnIdle( wxIdleEvent& event );
220 DECLARE_EVENT_TABLE();
222 intf_thread_t *p_intf;
225 /* Secondary windows */
226 OpenDialog *p_open_dialog;
227 wxFileDialog *p_file_dialog;
228 Playlist *p_playlist_dialog;
229 Messages *p_messages_dialog;
230 FileInfo *p_fileinfo_dialog;
231 wxFrame *p_prefs_dialog;
236 class SubsFileDialog;
237 class OpenDialog: public wxFrame
241 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
242 int i_access_method, int i_arg = 0 );
243 virtual ~OpenDialog();
246 int Show( int i_access_method, int i_arg = 0 );
251 wxPanel *FilePanel( wxWindow* parent );
252 wxPanel *DiscPanel( wxWindow* parent );
253 wxPanel *NetPanel( wxWindow* parent );
254 wxPanel *SatPanel( wxWindow* parent );
256 void UpdateMRL( int i_access_method );
257 wxArrayString SeparateEntries( wxString );
259 /* Event handlers (these functions should _not_ be virtual) */
260 void OnOk( wxCommandEvent& event );
261 void OnCancel( wxCommandEvent& event );
263 void OnPageChange( wxNotebookEvent& event );
264 void OnMRLChange( wxCommandEvent& event );
266 /* Event handlers for the file page */
267 void OnFilePanelChange( wxCommandEvent& event );
268 void OnFileBrowse( wxCommandEvent& event );
270 /* Event handlers for the disc page */
271 void OnDiscPanelChange( wxCommandEvent& event );
272 void OnDiscTypeChange( wxCommandEvent& event );
274 /* Event handlers for the net page */
275 void OnNetPanelChange( wxCommandEvent& event );
276 void OnNetTypeChange( wxCommandEvent& event );
278 /* Event handlers for the stream output */
279 void OnSubsFileEnable( wxCommandEvent& event );
280 void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
282 /* Event handlers for the stream output */
283 void OnSoutEnable( wxCommandEvent& event );
284 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
286 /* Event handlers for the demux dump */
287 void OnDemuxDumpEnable( wxCommandEvent& event );
288 void OnDemuxDumpBrowse( wxCommandEvent& event );
289 void OnDemuxDumpChange( wxCommandEvent& event );
291 DECLARE_EVENT_TABLE();
293 intf_thread_t *p_intf;
295 int i_current_access_method;
297 wxComboBox *mrl_combo;
298 wxNotebook *notebook;
300 /* Controls for the file panel */
301 wxComboBox *file_combo;
302 wxFileDialog *file_dialog;
304 /* Controls for the disc panel */
305 wxRadioBox *disc_type;
306 wxTextCtrl *disc_device;
307 wxSpinCtrl *disc_title;
308 wxSpinCtrl *disc_chapter;
310 /* Controls for the net panel */
311 wxRadioBox *net_type;
313 wxPanel *net_subpanels[4];
314 wxRadioButton *net_radios[4];
315 wxSpinCtrl *net_ports[4];
316 wxTextCtrl *net_addrs[4];
318 /* Controls for the subtitles file */
319 wxButton *subsfile_button;
320 wxCheckBox *subsfile_checkbox;
321 SubsFileDialog *subsfile_dialog;
323 /* Controls for the stream output */
324 wxButton *sout_button;
325 wxCheckBox *sout_checkbox;
326 SoutDialog *sout_dialog;
328 /* Controls for the demux dump */
329 wxTextCtrl *demuxdump_textctrl;
330 wxButton *demuxdump_button;
331 wxCheckBox *demuxdump_checkbox;
332 wxFileDialog *demuxdump_dialog;
335 /* Stream output Dialog */
336 class SoutDialog: public wxDialog
340 SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
341 virtual ~SoutDialog();
347 wxPanel *AccessPanel( wxWindow* parent );
348 wxPanel *MiscPanel( wxWindow* parent );
349 wxPanel *EncapsulationPanel( wxWindow* parent );
350 wxPanel *TranscodingPanel( wxWindow* parent );
353 /* Event handlers (these functions should _not_ be virtual) */
354 void OnOk( wxCommandEvent& event );
355 void OnCancel( wxCommandEvent& event );
356 void OnMRLChange( wxCommandEvent& event );
357 void OnAccessTypeChange( wxCommandEvent& event );
359 /* Event handlers for the file access output */
360 void OnFileChange( wxCommandEvent& event );
361 void OnFileBrowse( wxCommandEvent& event );
363 /* Event handlers for the net access output */
364 void OnNetChange( wxCommandEvent& event );
366 /* Event specific to the sap address */
367 void OnSAPAddrChange( wxCommandEvent& event );
369 /* Event handlers for the encapsulation panel */
370 void OnEncapsulationChange( wxCommandEvent& event );
372 /* Event handlers for the transcoding panel */
373 void OnTranscodingEnable( wxCommandEvent& event );
374 void OnTranscodingChange( wxCommandEvent& event );
376 /* Event handlers for the misc panel */
377 void OnSAPMiscChange( wxCommandEvent& event );
379 DECLARE_EVENT_TABLE();
381 intf_thread_t *p_intf;
384 wxComboBox *mrl_combo;
386 /* Controls for the access outputs */
387 wxPanel *access_subpanels[5];
388 wxCheckBox *access_checkboxes[5];
392 wxComboBox *file_combo;
393 wxSpinCtrl *net_ports[5];
394 wxTextCtrl *net_addrs[5];
396 /* Controls for the SAP announces */
397 wxPanel *misc_subpanels[1];
398 wxCheckBox *sap_checkbox;
399 wxTextCtrl *sap_addr;
401 /* Controls for the encapsulation */
402 wxRadioButton *encapsulation_radios[5];
403 int i_encapsulation_type;
405 /* Controls for transcoding */
406 wxCheckBox *video_transc_checkbox;
407 wxComboBox *video_codec_combo;
408 wxComboBox *audio_codec_combo;
409 wxCheckBox *audio_transc_checkbox;
410 wxComboBox *video_bitrate_combo;
411 wxComboBox *audio_bitrate_combo;
412 wxComboBox *audio_channels_combo;
415 /* Subtitles File Dialog */
416 class SubsFileDialog: public wxDialog
420 SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
421 virtual ~SubsFileDialog();
423 wxComboBox *file_combo;
424 wxSpinCtrl *delay_spinctrl;
425 wxSpinCtrl *fps_spinctrl;
428 /* Event handlers (these functions should _not_ be virtual) */
429 void OnOk( wxCommandEvent& event );
430 void OnCancel( wxCommandEvent& event );
431 void OnFileBrowse( wxCommandEvent& event );
433 DECLARE_EVENT_TABLE();
435 intf_thread_t *p_intf;
439 /* Preferences Dialog */
441 class PrefsDialog: public wxFrame
445 PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
446 virtual ~PrefsDialog();
449 wxPanel *PrefsPanel( wxWindow* parent );
451 /* Event handlers (these functions should _not_ be virtual) */
452 void OnOk( wxCommandEvent& event );
453 void OnCancel( wxCommandEvent& event );
454 void OnSave( wxCommandEvent& event );
455 void OnResetAll( wxCommandEvent& event );
457 DECLARE_EVENT_TABLE();
459 intf_thread_t *p_intf;
461 PrefsTreeCtrl *prefs_tree;
465 class Messages: public wxFrame
469 Messages( intf_thread_t *p_intf, wxWindow *p_parent );
474 /* Event handlers (these functions should _not_ be virtual) */
475 void OnClose( wxCommandEvent& event );
476 void OnVerbose( wxCommandEvent& event );
477 void OnClear( wxCommandEvent& event );
478 void OnSaveLog( wxCommandEvent& event );
480 DECLARE_EVENT_TABLE();
482 intf_thread_t *p_intf;
483 wxTextCtrl *textctrl;
484 wxTextAttr *info_attr;
485 wxTextAttr *err_attr;
486 wxTextAttr *warn_attr;
487 wxTextAttr *dbg_attr;
489 wxFileDialog *save_log_dialog;
491 vlc_bool_t b_verbose;
495 class Playlist: public wxFrame
499 Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
502 void UpdatePlaylist();
503 void ShowPlaylist( bool show );
509 void DeleteItem( int item );
511 /* Event handlers (these functions should _not_ be virtual) */
512 void OnAddFile( wxCommandEvent& event );
513 void OnAddMRL( wxCommandEvent& event );
514 void OnClose( wxCommandEvent& event );
515 void OnOpen( wxCommandEvent& event );
516 void OnSave( wxCommandEvent& event );
517 void OnInvertSelection( wxCommandEvent& event );
518 void OnDeleteSelection( wxCommandEvent& event );
519 void OnSelectAll( wxCommandEvent& event );
520 void OnActivateItem( wxListEvent& event );
521 void OnKeyDown( wxListEvent& event );
524 DECLARE_EVENT_TABLE();
526 intf_thread_t *p_intf;
527 wxListView *listview;
528 int i_update_counter;
532 class FileInfo: public wxFrame
536 FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
538 void UpdateFileInfo();
541 void OnClose( wxCommandEvent& event );
543 DECLARE_EVENT_TABLE();
545 intf_thread_t *p_intf;
546 wxTreeCtrl *fileinfo_tree;
547 wxTreeItemId fileinfo_root;
548 wxString fileinfo_root_label;
552 #if !defined(__WXX11__)
553 /* Drag and Drop class */
554 class DragAndDrop: public wxFileDropTarget
557 DragAndDrop( intf_thread_t *_p_intf );
559 virtual bool OnDropFiles( wxCoord x, wxCoord y,
560 const wxArrayString& filenames );
563 intf_thread_t *p_intf;
568 void PopupMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
569 const wxPoint& pos );
570 wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
571 wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
572 wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
574 class MenuEvtHandler : public wxEvtHandler
577 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
578 virtual ~MenuEvtHandler();
580 void OnMenuEvent( wxCommandEvent& event );
581 void OnShowDialog( wxCommandEvent& event );
585 DECLARE_EVENT_TABLE()
587 intf_thread_t *p_intf;
588 Interface *p_main_interface;
591 class Menu: public wxMenu
595 Menu( intf_thread_t *p_intf, wxWindow *p_parent, int i_count,
596 char **ppsz_names, int *pi_objects, int i_start_id );
600 /* Event handlers (these functions should _not_ be virtual) */
601 void OnClose( wxCommandEvent& event );
602 void OnShowDialog( wxCommandEvent& event );
603 void OnEntrySelected( wxCommandEvent& event );
605 wxMenu *Menu::CreateDummyMenu();
606 void Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
607 wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t * );
609 DECLARE_EVENT_TABLE();
611 intf_thread_t *p_intf;