1 /*****************************************************************************
2 * wxwindows.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: wxwindows.h,v 1.39 2003/07/09 09:30:23 adn 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;
134 void CreateOurMenuBar();
135 void CreateOurToolBar();
136 void CreateOurSlider();
137 void Open( int i_access_method );
139 /* Event handlers (these functions should _not_ be virtual) */
140 void OnExit( wxCommandEvent& event );
141 void OnAbout( wxCommandEvent& event );
142 void OnMessages( wxCommandEvent& event );
143 void OnPlaylist( wxCommandEvent& event );
144 void OnLogs( wxCommandEvent& event );
145 void OnFileInfo( wxCommandEvent& event );
146 void OnPreferences( wxCommandEvent& event );
148 void OnOpenFile( wxCommandEvent& event );
149 void OnOpenDisc( wxCommandEvent& event );
150 void OnOpenNet( wxCommandEvent& event );
151 void OnOpenSat( wxCommandEvent& event );
153 void OnPlayStream( wxCommandEvent& event );
154 void OnStopStream( wxCommandEvent& event );
155 void OnSliderUpdate( wxScrollEvent& event );
156 void OnPrevStream( wxCommandEvent& event );
157 void OnNextStream( wxCommandEvent& event );
158 void OnSlowStream( wxCommandEvent& event );
159 void OnFastStream( wxCommandEvent& event );
161 void OnMenuOpen( wxMenuEvent& event );
163 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
164 void OnContextMenu2(wxContextMenuEvent& event);
166 void OnContextMenu(wxMouseEvent& event);
168 DECLARE_EVENT_TABLE();
171 intf_thread_t *p_intf;
173 wxFrame *p_prefs_dialog;
175 int i_old_playing_status;
177 /* For auto-generated menus */
178 wxMenu *p_audio_menu;
179 vlc_bool_t b_audio_menu;
180 wxMenu *p_video_menu;
181 vlc_bool_t b_video_menu;
182 wxMenu *p_navig_menu;
183 vlc_bool_t b_navig_menu;
188 class SubsFileDialog;
189 class OpenDialog: public wxDialog
193 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
194 int i_access_method );
195 virtual ~OpenDialog();
198 int ShowModal( int i_access_method );
203 wxPanel *FilePanel( wxWindow* parent );
204 wxPanel *DiscPanel( wxWindow* parent );
205 wxPanel *NetPanel( wxWindow* parent );
206 wxPanel *SatPanel( wxWindow* parent );
208 void UpdateMRL( int i_access_method );
209 wxArrayString SeparateEntries( wxString );
211 /* Event handlers (these functions should _not_ be virtual) */
212 void OnOk( wxCommandEvent& event );
213 void OnCancel( wxCommandEvent& event );
215 void OnPageChange( wxNotebookEvent& event );
216 void OnMRLChange( wxCommandEvent& event );
218 /* Event handlers for the file page */
219 void OnFilePanelChange( wxCommandEvent& event );
220 void OnFileBrowse( wxCommandEvent& event );
222 /* Event handlers for the disc page */
223 void OnDiscPanelChange( wxCommandEvent& event );
224 void OnDiscTypeChange( wxCommandEvent& event );
226 /* Event handlers for the net page */
227 void OnNetPanelChange( wxCommandEvent& event );
228 void OnNetTypeChange( wxCommandEvent& event );
230 /* Event handlers for the stream output */
231 void OnSubsFileEnable( wxCommandEvent& event );
232 void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
234 /* Event handlers for the stream output */
235 void OnSoutEnable( wxCommandEvent& event );
236 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
238 /* Event handlers for the demux dump */
239 void OnDemuxDumpEnable( wxCommandEvent& event );
240 void OnDemuxDumpBrowse( wxCommandEvent& event );
241 void OnDemuxDumpChange( wxCommandEvent& event );
243 DECLARE_EVENT_TABLE();
245 intf_thread_t *p_intf;
247 int i_current_access_method;
249 wxComboBox *mrl_combo;
250 wxNotebook *notebook;
252 /* Controls for the file panel */
253 wxComboBox *file_combo;
254 wxFileDialog *file_dialog;
256 /* Controls for the disc panel */
257 wxRadioBox *disc_type;
258 wxTextCtrl *disc_device;
259 wxSpinCtrl *disc_title;
260 wxSpinCtrl *disc_chapter;
262 /* Controls for the net panel */
263 wxRadioBox *net_type;
265 wxPanel *net_subpanels[4];
266 wxRadioButton *net_radios[4];
267 wxSpinCtrl *net_ports[4];
268 wxTextCtrl *net_addrs[4];
270 /* Controls for the subtitles file */
271 wxButton *subsfile_button;
272 wxCheckBox *subsfile_checkbox;
273 SubsFileDialog *subsfile_dialog;
275 /* Controls for the stream output */
276 wxButton *sout_button;
277 wxCheckBox *sout_checkbox;
278 SoutDialog *sout_dialog;
280 /* Controls for the demux dump */
281 wxTextCtrl *demuxdump_textctrl;
282 wxButton *demuxdump_button;
283 wxCheckBox *demuxdump_checkbox;
284 wxFileDialog *demuxdump_dialog;
295 /* Stream output Dialog */
296 class SoutDialog: public wxDialog
300 SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
301 virtual ~SoutDialog();
307 wxPanel *AccessPanel( wxWindow* parent );
308 wxPanel *MiscPanel( wxWindow* parent );
309 wxPanel *EncapsulationPanel( wxWindow* parent );
310 wxPanel *TranscodingPanel( wxWindow* parent );
313 /* Event handlers (these functions should _not_ be virtual) */
314 void OnOk( wxCommandEvent& event );
315 void OnCancel( wxCommandEvent& event );
316 void OnMRLChange( wxCommandEvent& event );
317 void OnAccessTypeChange( wxCommandEvent& event );
319 /* Event handlers for the file access output */
320 void OnFileChange( wxCommandEvent& event );
321 void OnFileBrowse( wxCommandEvent& event );
323 /* Event handlers for the net access output */
324 void OnNetChange( wxCommandEvent& event );
326 /* Event specific to the sap address */
327 void OnSAPAddrChange( wxCommandEvent& event );
329 /* Event handlers for the encapsulation panel */
330 void OnEncapsulationChange( wxCommandEvent& event );
332 /* Event handlers for the transcoding panel */
333 void OnTranscodingEnable( wxCommandEvent& event );
334 void OnTranscodingChange( wxCommandEvent& event );
336 /* Event handlers for the misc panel */
337 void OnSAPMiscChange( wxCommandEvent& event );
339 DECLARE_EVENT_TABLE();
341 intf_thread_t *p_intf;
344 wxComboBox *mrl_combo;
346 /* Controls for the access outputs */
347 wxPanel *access_subpanels[5];
348 wxCheckBox *access_checkboxes[5];
352 wxComboBox *file_combo;
353 wxSpinCtrl *net_ports[5];
354 wxTextCtrl *net_addrs[5];
356 /* Controls for the SAP announces */
357 wxPanel *misc_subpanels[1];
358 wxCheckBox *sap_checkbox;
359 wxTextCtrl *sap_addr;
361 /* Controls for the encapsulation */
362 wxRadioButton *encapsulation_radios[5];
363 int i_encapsulation_type;
365 /* Controls for transcoding */
366 wxCheckBox *video_transc_checkbox;
367 wxComboBox *video_codec_combo;
368 wxComboBox *audio_codec_combo;
369 wxCheckBox *audio_transc_checkbox;
370 wxComboBox *video_bitrate_combo;
371 wxComboBox *audio_bitrate_combo;
374 /* Subtitles File Dialog */
375 class SubsFileDialog: public wxDialog
379 SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
380 virtual ~SubsFileDialog();
382 wxComboBox *file_combo;
383 wxSpinCtrl *delay_spinctrl;
384 wxSpinCtrl *fps_spinctrl;
387 /* Event handlers (these functions should _not_ be virtual) */
388 void OnOk( wxCommandEvent& event );
389 void OnCancel( wxCommandEvent& event );
390 void OnFileBrowse( wxCommandEvent& event );
392 DECLARE_EVENT_TABLE();
394 intf_thread_t *p_intf;
398 /* Preferences Dialog */
400 class PrefsDialog: public wxFrame
404 PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
405 virtual ~PrefsDialog();
408 wxPanel *PrefsPanel( wxWindow* parent );
410 /* Event handlers (these functions should _not_ be virtual) */
411 void OnOk( wxCommandEvent& event );
412 void OnCancel( wxCommandEvent& event );
413 void OnSave( wxCommandEvent& event );
414 void OnResetAll( wxCommandEvent& event );
416 DECLARE_EVENT_TABLE();
418 intf_thread_t *p_intf;
420 PrefsTreeCtrl *prefs_tree;
424 class Messages: public wxFrame
428 Messages( intf_thread_t *p_intf, wxWindow *p_parent );
433 /* Event handlers (these functions should _not_ be virtual) */
434 void OnClose( wxCommandEvent& event );
435 void OnVerbose( wxCommandEvent& event );
436 void OnClear( wxCommandEvent& event );
438 DECLARE_EVENT_TABLE();
440 intf_thread_t *p_intf;
441 wxTextCtrl *textctrl;
442 wxTextAttr *info_attr;
443 wxTextAttr *err_attr;
444 wxTextAttr *warn_attr;
445 wxTextAttr *dbg_attr;
447 vlc_bool_t b_verbose;
451 class Playlist: public wxFrame
455 Playlist( intf_thread_t *p_intf, Interface *p_main_interface );
458 void UpdatePlaylist();
459 void ShowPlaylist( bool show );
465 void DeleteItem( int item );
467 /* Event handlers (these functions should _not_ be virtual) */
468 void OnAddMRL( wxCommandEvent& event );
469 void OnClose( wxCommandEvent& event );
470 void OnOpen( wxCommandEvent& event );
471 void OnSave( wxCommandEvent& event );
472 void OnInvertSelection( wxCommandEvent& event );
473 void OnDeleteSelection( wxCommandEvent& event );
474 void OnSelectAll( wxCommandEvent& event );
475 void OnActivateItem( wxListEvent& event );
476 void OnKeyDown( wxListEvent& event );
479 DECLARE_EVENT_TABLE();
481 intf_thread_t *p_intf;
482 Interface *p_main_interface;
483 wxListView *listview;
484 int i_update_counter;
488 class FileInfo: public wxFrame
492 FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
494 void UpdateFileInfo();
497 void OnClose( wxCommandEvent& event );
499 DECLARE_EVENT_TABLE();
501 intf_thread_t *p_intf;
502 wxTreeCtrl *fileinfo_tree;
503 wxTreeItemId fileinfo_root;
504 wxString fileinfo_root_label;
508 #if !defined(__WXX11__)
509 /* Drag and Drop class */
510 class DragAndDrop: public wxFileDropTarget
513 DragAndDrop( intf_thread_t *_p_intf );
515 virtual bool OnDropFiles( wxCoord x, wxCoord y,
516 const wxArrayString& filenames );
519 intf_thread_t *p_intf;
524 void PopupMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
525 const wxPoint& pos );
526 wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
527 wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
528 wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
530 class MenuEvtHandler : public wxEvtHandler
533 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
534 virtual ~MenuEvtHandler();
536 void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event );
540 DECLARE_EVENT_TABLE()
542 intf_thread_t *p_intf;
543 Interface *p_main_interface;
546 class Menu: public wxMenu
550 Menu( intf_thread_t *p_intf, wxWindow *p_parent, int i_count,
551 char **ppsz_names, int *pi_objects, int i_start_id );
555 /* Event handlers (these functions should _not_ be virtual) */
556 void OnClose( wxCommandEvent& event );
557 void OnEntrySelected( wxCommandEvent& event );
559 wxMenu *Menu::CreateDummyMenu();
560 void Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
561 wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t * );
563 DECLARE_EVENT_TABLE();
565 intf_thread_t *p_intf;