1 /*****************************************************************************
2 * wxwindows.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: wxwindows.h,v 1.42 2003/07/12 13:33:10 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>
36 #define SLIDER_MAX_POS 10000
38 /* wxU is used to convert ansi strings to unicode strings (wchar_t) */
40 # define wxU(ansi) wxString(ansi, *wxConvCurrent)
42 # define wxU(ansi) ansi
45 #if !defined(MODULE_NAME_IS_skins)
46 /*****************************************************************************
47 * intf_sys_t: description and status of wxwindows interface
48 *****************************************************************************/
51 /* the wx parent window */
55 /* secondary windows */
56 Playlist *p_playlist_window;
57 Messages *p_messages_window;
58 FileInfo *p_fileinfo_window;
63 /* The input thread */
64 input_thread_t * p_input;
67 int i_slider_pos; /* slider position */
68 int i_slider_oldpos; /* previous position */
69 vlc_bool_t b_slider_free; /* slider status */
71 /* The messages window */
72 msg_subscription_t* p_sub; /* message bank subscription */
74 /* Playlist management */
75 int i_playing; /* playlist selected item */
79 vlc_bool_t b_popup_change;
82 #endif /* !defined(MODULE_NAME_IS_skins) */
84 /*****************************************************************************
86 *****************************************************************************/
88 /*****************************************************************************
89 * Classes declarations.
90 *****************************************************************************/
94 class Timer: public wxTimer
98 Timer( intf_thread_t *p_intf, Interface *p_main_interface );
101 virtual void Notify();
104 intf_thread_t *p_intf;
105 Interface *p_main_interface;
106 int i_old_playing_status;
112 class Interface: public wxFrame
116 Interface( intf_thread_t *p_intf );
117 virtual ~Interface();
118 void TogglePlayButton( int i_playing_status );
120 wxBoxSizer *frame_sizer;
121 wxStatusBar *statusbar;
124 wxWindow *slider_frame;
125 wxStaticBox *slider_box;
129 /* So we don't recreate the open dialog box each time
130 * (and keep the last settings) */
131 OpenDialog *p_open_dialog;
133 /* idem for the simple open file dialog */
134 wxFileDialog *p_file_dialog;
137 void CreateOurMenuBar();
138 void CreateOurToolBar();
139 void CreateOurSlider();
140 void Open( int i_access_method );
142 /* Event handlers (these functions should _not_ be virtual) */
143 void OnExit( wxCommandEvent& event );
144 void OnAbout( wxCommandEvent& event );
145 void OnMessages( wxCommandEvent& event );
146 void OnPlaylist( wxCommandEvent& event );
147 void OnLogs( wxCommandEvent& event );
148 void OnFileInfo( wxCommandEvent& event );
149 void OnPreferences( wxCommandEvent& event );
151 void OnOpenFileSimple( wxCommandEvent& event );
152 void OnOpenFile( wxCommandEvent& event );
153 void OnOpenDisc( wxCommandEvent& event );
154 void OnOpenNet( wxCommandEvent& event );
155 void OnOpenSat( wxCommandEvent& event );
157 void OnPlayStream( wxCommandEvent& event );
158 void OnStopStream( wxCommandEvent& event );
159 void OnSliderUpdate( wxScrollEvent& event );
160 void OnPrevStream( wxCommandEvent& event );
161 void OnNextStream( wxCommandEvent& event );
162 void OnSlowStream( wxCommandEvent& event );
163 void OnFastStream( wxCommandEvent& event );
165 void OnMenuOpen( wxMenuEvent& event );
167 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
168 void OnContextMenu2(wxContextMenuEvent& event);
170 void OnContextMenu(wxMouseEvent& event);
172 DECLARE_EVENT_TABLE();
175 intf_thread_t *p_intf;
177 wxFrame *p_prefs_dialog;
179 int i_old_playing_status;
181 /* For auto-generated menus */
182 wxMenu *p_audio_menu;
183 vlc_bool_t b_audio_menu;
184 wxMenu *p_video_menu;
185 vlc_bool_t b_video_menu;
186 wxMenu *p_navig_menu;
187 vlc_bool_t b_navig_menu;
192 class SubsFileDialog;
193 class OpenDialog: public wxDialog
197 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
198 int i_access_method );
199 virtual ~OpenDialog();
202 int ShowModal( int i_access_method );
207 wxPanel *FilePanel( wxWindow* parent );
208 wxPanel *DiscPanel( wxWindow* parent );
209 wxPanel *NetPanel( wxWindow* parent );
210 wxPanel *SatPanel( wxWindow* parent );
212 void UpdateMRL( int i_access_method );
213 wxArrayString SeparateEntries( wxString );
215 /* Event handlers (these functions should _not_ be virtual) */
216 void OnOk( wxCommandEvent& event );
217 void OnCancel( wxCommandEvent& event );
219 void OnPageChange( wxNotebookEvent& event );
220 void OnMRLChange( wxCommandEvent& event );
222 /* Event handlers for the file page */
223 void OnFilePanelChange( wxCommandEvent& event );
224 void OnFileBrowse( wxCommandEvent& event );
226 /* Event handlers for the disc page */
227 void OnDiscPanelChange( wxCommandEvent& event );
228 void OnDiscTypeChange( wxCommandEvent& event );
230 /* Event handlers for the net page */
231 void OnNetPanelChange( wxCommandEvent& event );
232 void OnNetTypeChange( wxCommandEvent& event );
234 /* Event handlers for the stream output */
235 void OnSubsFileEnable( wxCommandEvent& event );
236 void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
238 /* Event handlers for the stream output */
239 void OnSoutEnable( wxCommandEvent& event );
240 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
242 /* Event handlers for the demux dump */
243 void OnDemuxDumpEnable( wxCommandEvent& event );
244 void OnDemuxDumpBrowse( wxCommandEvent& event );
245 void OnDemuxDumpChange( wxCommandEvent& event );
247 DECLARE_EVENT_TABLE();
249 intf_thread_t *p_intf;
251 int i_current_access_method;
253 wxComboBox *mrl_combo;
254 wxNotebook *notebook;
256 /* Controls for the file panel */
257 wxComboBox *file_combo;
258 wxFileDialog *file_dialog;
260 /* Controls for the disc panel */
261 wxRadioBox *disc_type;
262 wxTextCtrl *disc_device;
263 wxSpinCtrl *disc_title;
264 wxSpinCtrl *disc_chapter;
266 /* Controls for the net panel */
267 wxRadioBox *net_type;
269 wxPanel *net_subpanels[4];
270 wxRadioButton *net_radios[4];
271 wxSpinCtrl *net_ports[4];
272 wxTextCtrl *net_addrs[4];
274 /* Controls for the subtitles file */
275 wxButton *subsfile_button;
276 wxCheckBox *subsfile_checkbox;
277 SubsFileDialog *subsfile_dialog;
279 /* Controls for the stream output */
280 wxButton *sout_button;
281 wxCheckBox *sout_checkbox;
282 SoutDialog *sout_dialog;
284 /* Controls for the demux dump */
285 wxTextCtrl *demuxdump_textctrl;
286 wxButton *demuxdump_button;
287 wxCheckBox *demuxdump_checkbox;
288 wxFileDialog *demuxdump_dialog;
300 /* Stream output Dialog */
301 class SoutDialog: public wxDialog
305 SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
306 virtual ~SoutDialog();
312 wxPanel *AccessPanel( wxWindow* parent );
313 wxPanel *MiscPanel( wxWindow* parent );
314 wxPanel *EncapsulationPanel( wxWindow* parent );
315 wxPanel *TranscodingPanel( wxWindow* parent );
318 /* Event handlers (these functions should _not_ be virtual) */
319 void OnOk( wxCommandEvent& event );
320 void OnCancel( wxCommandEvent& event );
321 void OnMRLChange( wxCommandEvent& event );
322 void OnAccessTypeChange( wxCommandEvent& event );
324 /* Event handlers for the file access output */
325 void OnFileChange( wxCommandEvent& event );
326 void OnFileBrowse( wxCommandEvent& event );
328 /* Event handlers for the net access output */
329 void OnNetChange( wxCommandEvent& event );
331 /* Event specific to the sap address */
332 void OnSAPAddrChange( wxCommandEvent& event );
334 /* Event handlers for the encapsulation panel */
335 void OnEncapsulationChange( wxCommandEvent& event );
337 /* Event handlers for the transcoding panel */
338 void OnTranscodingEnable( wxCommandEvent& event );
339 void OnTranscodingChange( wxCommandEvent& event );
341 /* Event handlers for the misc panel */
342 void OnSAPMiscChange( 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_ports[5];
359 wxTextCtrl *net_addrs[5];
361 /* Controls for the SAP announces */
362 wxPanel *misc_subpanels[1];
363 wxCheckBox *sap_checkbox;
364 wxTextCtrl *sap_addr;
366 /* Controls for the encapsulation */
367 wxRadioButton *encapsulation_radios[5];
368 int i_encapsulation_type;
370 /* Controls for transcoding */
371 wxCheckBox *video_transc_checkbox;
372 wxComboBox *video_codec_combo;
373 wxComboBox *audio_codec_combo;
374 wxCheckBox *audio_transc_checkbox;
375 wxComboBox *video_bitrate_combo;
376 wxComboBox *audio_bitrate_combo;
377 wxComboBox *audio_channels_combo;
380 /* Subtitles File Dialog */
381 class SubsFileDialog: public wxDialog
385 SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
386 virtual ~SubsFileDialog();
388 wxComboBox *file_combo;
389 wxSpinCtrl *delay_spinctrl;
390 wxSpinCtrl *fps_spinctrl;
393 /* Event handlers (these functions should _not_ be virtual) */
394 void OnOk( wxCommandEvent& event );
395 void OnCancel( wxCommandEvent& event );
396 void OnFileBrowse( wxCommandEvent& event );
398 DECLARE_EVENT_TABLE();
400 intf_thread_t *p_intf;
404 /* Preferences Dialog */
406 class PrefsDialog: public wxFrame
410 PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
411 virtual ~PrefsDialog();
414 wxPanel *PrefsPanel( wxWindow* parent );
416 /* Event handlers (these functions should _not_ be virtual) */
417 void OnOk( wxCommandEvent& event );
418 void OnCancel( wxCommandEvent& event );
419 void OnSave( wxCommandEvent& event );
420 void OnResetAll( wxCommandEvent& event );
422 DECLARE_EVENT_TABLE();
424 intf_thread_t *p_intf;
426 PrefsTreeCtrl *prefs_tree;
430 class Messages: public wxFrame
434 Messages( intf_thread_t *p_intf, wxWindow *p_parent );
439 /* Event handlers (these functions should _not_ be virtual) */
440 void OnClose( wxCommandEvent& event );
441 void OnVerbose( wxCommandEvent& event );
442 void OnClear( wxCommandEvent& event );
443 void OnSaveLog( wxCommandEvent& event );
445 DECLARE_EVENT_TABLE();
447 intf_thread_t *p_intf;
448 wxTextCtrl *textctrl;
449 wxTextAttr *info_attr;
450 wxTextAttr *err_attr;
451 wxTextAttr *warn_attr;
452 wxTextAttr *dbg_attr;
454 wxFileDialog *save_log_dialog;
456 vlc_bool_t b_verbose;
460 class Playlist: public wxFrame
464 Playlist( intf_thread_t *p_intf, Interface *p_main_interface );
467 void UpdatePlaylist();
468 void ShowPlaylist( bool show );
474 void DeleteItem( int item );
476 /* Event handlers (these functions should _not_ be virtual) */
477 void OnAddFile( wxCommandEvent& event );
478 void OnAddMRL( wxCommandEvent& event );
479 void OnClose( wxCommandEvent& event );
480 void OnOpen( wxCommandEvent& event );
481 void OnSave( wxCommandEvent& event );
482 void OnInvertSelection( wxCommandEvent& event );
483 void OnDeleteSelection( wxCommandEvent& event );
484 void OnSelectAll( wxCommandEvent& event );
485 void OnActivateItem( wxListEvent& event );
486 void OnKeyDown( wxListEvent& event );
489 DECLARE_EVENT_TABLE();
491 intf_thread_t *p_intf;
492 Interface *p_main_interface;
493 wxListView *listview;
494 int i_update_counter;
498 class FileInfo: public wxFrame
502 FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
504 void UpdateFileInfo();
507 void OnClose( wxCommandEvent& event );
509 DECLARE_EVENT_TABLE();
511 intf_thread_t *p_intf;
512 wxTreeCtrl *fileinfo_tree;
513 wxTreeItemId fileinfo_root;
514 wxString fileinfo_root_label;
518 #if !defined(__WXX11__)
519 /* Drag and Drop class */
520 class DragAndDrop: public wxFileDropTarget
523 DragAndDrop( intf_thread_t *_p_intf );
525 virtual bool OnDropFiles( wxCoord x, wxCoord y,
526 const wxArrayString& filenames );
529 intf_thread_t *p_intf;
534 void PopupMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
535 const wxPoint& pos );
536 wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
537 wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
538 wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
540 class MenuEvtHandler : public wxEvtHandler
543 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
544 virtual ~MenuEvtHandler();
546 void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event );
550 DECLARE_EVENT_TABLE()
552 intf_thread_t *p_intf;
553 Interface *p_main_interface;
556 class Menu: public wxMenu
560 Menu( intf_thread_t *p_intf, wxWindow *p_parent, int i_count,
561 char **ppsz_names, int *pi_objects, int i_start_id );
565 /* Event handlers (these functions should _not_ be virtual) */
566 void OnClose( wxCommandEvent& event );
567 void OnEntrySelected( wxCommandEvent& event );
569 wxMenu *Menu::CreateDummyMenu();
570 void Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
571 wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t * );
573 DECLARE_EVENT_TABLE();
575 intf_thread_t *p_intf;