1 /*****************************************************************************
2 * wxwindows.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: wxwindows.h,v 1.43 2003/07/17 17:30:40 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 OnIdle( wxIdleEvent& event );
208 DECLARE_EVENT_TABLE();
210 intf_thread_t *p_intf;
213 /* Secondary windows */
214 OpenDialog *p_open_dialog;
215 wxFileDialog *p_file_dialog;
216 Playlist *p_playlist_dialog;
217 Messages *p_messages_dialog;
218 FileInfo *p_fileinfo_dialog;
219 wxFrame *p_prefs_dialog;
224 class SubsFileDialog;
225 class OpenDialog: public wxFrame
229 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
230 int i_access_method, int i_arg = 0 );
231 virtual ~OpenDialog();
234 int Show( int i_access_method, int i_arg = 0 );
239 wxPanel *FilePanel( wxWindow* parent );
240 wxPanel *DiscPanel( wxWindow* parent );
241 wxPanel *NetPanel( wxWindow* parent );
242 wxPanel *SatPanel( wxWindow* parent );
244 void UpdateMRL( int i_access_method );
245 wxArrayString SeparateEntries( wxString );
247 /* Event handlers (these functions should _not_ be virtual) */
248 void OnOk( wxCommandEvent& event );
249 void OnCancel( wxCommandEvent& event );
251 void OnPageChange( wxNotebookEvent& event );
252 void OnMRLChange( wxCommandEvent& event );
254 /* Event handlers for the file page */
255 void OnFilePanelChange( wxCommandEvent& event );
256 void OnFileBrowse( wxCommandEvent& event );
258 /* Event handlers for the disc page */
259 void OnDiscPanelChange( wxCommandEvent& event );
260 void OnDiscTypeChange( wxCommandEvent& event );
262 /* Event handlers for the net page */
263 void OnNetPanelChange( wxCommandEvent& event );
264 void OnNetTypeChange( wxCommandEvent& event );
266 /* Event handlers for the stream output */
267 void OnSubsFileEnable( wxCommandEvent& event );
268 void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
270 /* Event handlers for the stream output */
271 void OnSoutEnable( wxCommandEvent& event );
272 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
274 /* Event handlers for the demux dump */
275 void OnDemuxDumpEnable( wxCommandEvent& event );
276 void OnDemuxDumpBrowse( wxCommandEvent& event );
277 void OnDemuxDumpChange( wxCommandEvent& event );
279 DECLARE_EVENT_TABLE();
281 intf_thread_t *p_intf;
283 int i_current_access_method;
285 wxComboBox *mrl_combo;
286 wxNotebook *notebook;
288 /* Controls for the file panel */
289 wxComboBox *file_combo;
290 wxFileDialog *file_dialog;
292 /* Controls for the disc panel */
293 wxRadioBox *disc_type;
294 wxTextCtrl *disc_device;
295 wxSpinCtrl *disc_title;
296 wxSpinCtrl *disc_chapter;
298 /* Controls for the net panel */
299 wxRadioBox *net_type;
301 wxPanel *net_subpanels[4];
302 wxRadioButton *net_radios[4];
303 wxSpinCtrl *net_ports[4];
304 wxTextCtrl *net_addrs[4];
306 /* Controls for the subtitles file */
307 wxButton *subsfile_button;
308 wxCheckBox *subsfile_checkbox;
309 SubsFileDialog *subsfile_dialog;
311 /* Controls for the stream output */
312 wxButton *sout_button;
313 wxCheckBox *sout_checkbox;
314 SoutDialog *sout_dialog;
316 /* Controls for the demux dump */
317 wxTextCtrl *demuxdump_textctrl;
318 wxButton *demuxdump_button;
319 wxCheckBox *demuxdump_checkbox;
320 wxFileDialog *demuxdump_dialog;
323 /* Stream output Dialog */
324 class SoutDialog: public wxDialog
328 SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
329 virtual ~SoutDialog();
335 wxPanel *AccessPanel( wxWindow* parent );
336 wxPanel *MiscPanel( wxWindow* parent );
337 wxPanel *EncapsulationPanel( wxWindow* parent );
338 wxPanel *TranscodingPanel( wxWindow* parent );
341 /* Event handlers (these functions should _not_ be virtual) */
342 void OnOk( wxCommandEvent& event );
343 void OnCancel( wxCommandEvent& event );
344 void OnMRLChange( wxCommandEvent& event );
345 void OnAccessTypeChange( wxCommandEvent& event );
347 /* Event handlers for the file access output */
348 void OnFileChange( wxCommandEvent& event );
349 void OnFileBrowse( wxCommandEvent& event );
351 /* Event handlers for the net access output */
352 void OnNetChange( wxCommandEvent& event );
354 /* Event specific to the sap address */
355 void OnSAPAddrChange( wxCommandEvent& event );
357 /* Event handlers for the encapsulation panel */
358 void OnEncapsulationChange( wxCommandEvent& event );
360 /* Event handlers for the transcoding panel */
361 void OnTranscodingEnable( wxCommandEvent& event );
362 void OnTranscodingChange( wxCommandEvent& event );
364 /* Event handlers for the misc panel */
365 void OnSAPMiscChange( wxCommandEvent& event );
367 DECLARE_EVENT_TABLE();
369 intf_thread_t *p_intf;
372 wxComboBox *mrl_combo;
374 /* Controls for the access outputs */
375 wxPanel *access_subpanels[5];
376 wxCheckBox *access_checkboxes[5];
380 wxComboBox *file_combo;
381 wxSpinCtrl *net_ports[5];
382 wxTextCtrl *net_addrs[5];
384 /* Controls for the SAP announces */
385 wxPanel *misc_subpanels[1];
386 wxCheckBox *sap_checkbox;
387 wxTextCtrl *sap_addr;
389 /* Controls for the encapsulation */
390 wxRadioButton *encapsulation_radios[5];
391 int i_encapsulation_type;
393 /* Controls for transcoding */
394 wxCheckBox *video_transc_checkbox;
395 wxComboBox *video_codec_combo;
396 wxComboBox *audio_codec_combo;
397 wxCheckBox *audio_transc_checkbox;
398 wxComboBox *video_bitrate_combo;
399 wxComboBox *audio_bitrate_combo;
400 wxComboBox *audio_channels_combo;
403 /* Subtitles File Dialog */
404 class SubsFileDialog: public wxDialog
408 SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
409 virtual ~SubsFileDialog();
411 wxComboBox *file_combo;
412 wxSpinCtrl *delay_spinctrl;
413 wxSpinCtrl *fps_spinctrl;
416 /* Event handlers (these functions should _not_ be virtual) */
417 void OnOk( wxCommandEvent& event );
418 void OnCancel( wxCommandEvent& event );
419 void OnFileBrowse( wxCommandEvent& event );
421 DECLARE_EVENT_TABLE();
423 intf_thread_t *p_intf;
427 /* Preferences Dialog */
429 class PrefsDialog: public wxFrame
433 PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
434 virtual ~PrefsDialog();
437 wxPanel *PrefsPanel( wxWindow* parent );
439 /* Event handlers (these functions should _not_ be virtual) */
440 void OnOk( wxCommandEvent& event );
441 void OnCancel( wxCommandEvent& event );
442 void OnSave( wxCommandEvent& event );
443 void OnResetAll( wxCommandEvent& event );
445 DECLARE_EVENT_TABLE();
447 intf_thread_t *p_intf;
449 PrefsTreeCtrl *prefs_tree;
453 class Messages: public wxFrame
457 Messages( intf_thread_t *p_intf, wxWindow *p_parent );
462 /* Event handlers (these functions should _not_ be virtual) */
463 void OnClose( wxCommandEvent& event );
464 void OnVerbose( wxCommandEvent& event );
465 void OnClear( wxCommandEvent& event );
466 void OnSaveLog( wxCommandEvent& event );
468 DECLARE_EVENT_TABLE();
470 intf_thread_t *p_intf;
471 wxTextCtrl *textctrl;
472 wxTextAttr *info_attr;
473 wxTextAttr *err_attr;
474 wxTextAttr *warn_attr;
475 wxTextAttr *dbg_attr;
477 wxFileDialog *save_log_dialog;
479 vlc_bool_t b_verbose;
483 class Playlist: public wxFrame
487 Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
490 void UpdatePlaylist();
491 void ShowPlaylist( bool show );
497 void DeleteItem( int item );
499 /* Event handlers (these functions should _not_ be virtual) */
500 void OnAddFile( wxCommandEvent& event );
501 void OnAddMRL( wxCommandEvent& event );
502 void OnClose( wxCommandEvent& event );
503 void OnOpen( wxCommandEvent& event );
504 void OnSave( wxCommandEvent& event );
505 void OnInvertSelection( wxCommandEvent& event );
506 void OnDeleteSelection( wxCommandEvent& event );
507 void OnSelectAll( wxCommandEvent& event );
508 void OnActivateItem( wxListEvent& event );
509 void OnKeyDown( wxListEvent& event );
512 DECLARE_EVENT_TABLE();
514 intf_thread_t *p_intf;
515 wxListView *listview;
516 int i_update_counter;
520 class FileInfo: public wxFrame
524 FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
526 void UpdateFileInfo();
529 void OnClose( wxCommandEvent& event );
531 DECLARE_EVENT_TABLE();
533 intf_thread_t *p_intf;
534 wxTreeCtrl *fileinfo_tree;
535 wxTreeItemId fileinfo_root;
536 wxString fileinfo_root_label;
540 #if !defined(__WXX11__)
541 /* Drag and Drop class */
542 class DragAndDrop: public wxFileDropTarget
545 DragAndDrop( intf_thread_t *_p_intf );
547 virtual bool OnDropFiles( wxCoord x, wxCoord y,
548 const wxArrayString& filenames );
551 intf_thread_t *p_intf;
556 void PopupMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
557 const wxPoint& pos );
558 wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
559 wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
560 wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
562 class MenuEvtHandler : public wxEvtHandler
565 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
566 virtual ~MenuEvtHandler();
568 void OnMenuEvent( wxCommandEvent& event );
569 void OnShowDialog( wxCommandEvent& event );
573 DECLARE_EVENT_TABLE()
575 intf_thread_t *p_intf;
576 Interface *p_main_interface;
579 class Menu: public wxMenu
583 Menu( intf_thread_t *p_intf, wxWindow *p_parent, int i_count,
584 char **ppsz_names, int *pi_objects, int i_start_id );
588 /* Event handlers (these functions should _not_ be virtual) */
589 void OnClose( wxCommandEvent& event );
590 void OnShowDialog( wxCommandEvent& event );
591 void OnEntrySelected( wxCommandEvent& event );
593 wxMenu *Menu::CreateDummyMenu();
594 void Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
595 wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t * );
597 DECLARE_EVENT_TABLE();
599 intf_thread_t *p_intf;