1 /*****************************************************************************
2 * wxwindows.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: wxwindows.h,v 1.24 2003/05/13 22:33:33 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>
35 #define SLIDER_MAX_POS 10000
37 /* wxU is used to convert ansi strings to unicode strings (wchar_t) */
39 # define wxU(ansi) wxString(ansi, *wxConvCurrent)
41 # define wxU(ansi) ansi
44 #if !defined(MODULE_NAME_IS_skins)
45 /*****************************************************************************
46 * intf_sys_t: description and status of wxwindows interface
47 *****************************************************************************/
50 /* the wx parent window */
54 /* secondary windows */
55 Playlist *p_playlist_window;
56 Messages *p_messages_window;
57 FileInfo *p_fileinfo_window;
61 vlc_bool_t b_popup_changed; /* display menu ? */
62 vlc_bool_t b_window_changed; /* window display toggled ? */
63 vlc_bool_t b_playlist_changed; /* playlist display toggled ? */
64 vlc_bool_t b_slider_free; /* slider status */
67 vlc_bool_t b_program_update; /* do we need to update programs
69 vlc_bool_t b_title_update; /* do we need to update title menus */
70 vlc_bool_t b_chapter_update; /* do we need to update
72 vlc_bool_t b_audio_update; /* do we need to update audio menus */
73 vlc_bool_t b_spu_update; /* do we need to update spu menus */
75 /* windows and widgets */
77 /* The input thread */
78 input_thread_t * p_input;
81 int i_slider_pos; /* slider position */
82 int i_slider_oldpos; /* previous position */
84 /* The messages window */
85 msg_subscription_t* p_sub; /* message bank subscription */
87 /* Playlist management */
88 int i_playing; /* playlist selected item */
90 /* The window labels for DVD mode */
91 unsigned int i_part; /* current chapter */
93 #endif /* !defined(MODULE_NAME_IS_skins) */
95 /*****************************************************************************
97 *****************************************************************************/
99 /*****************************************************************************
100 * Classes declarations.
101 *****************************************************************************/
105 class Timer: public wxTimer
109 Timer( intf_thread_t *p_intf, Interface *p_main_interface );
112 virtual void Notify();
115 intf_thread_t *p_intf;
116 Interface *p_main_interface;
117 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;
136 wxMenu *p_popup_menu;
138 wxArrayString mrl_history;
141 void CreateOurMenuBar();
142 void CreateOurToolBar();
143 void CreateOurSlider();
144 void Open( int i_access_method );
146 /* Event handlers (these functions should _not_ be virtual) */
147 void OnExit( wxCommandEvent& event );
148 void OnAbout( wxCommandEvent& event );
149 void OnMessages( wxCommandEvent& event );
150 void OnPlaylist( wxCommandEvent& event );
151 void OnLogs( wxCommandEvent& event );
152 void OnFileInfo( wxCommandEvent& event );
153 void OnPreferences( wxCommandEvent& event );
155 void OnOpenFile( wxCommandEvent& event );
156 void OnOpenDisc( wxCommandEvent& event );
157 void OnOpenNet( wxCommandEvent& event );
158 void OnOpenSat( 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 );
166 void OnMenuOpen( wxMenuEvent& event );
168 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
169 void OnContextMenu(wxContextMenuEvent& event);
171 void OnContextMenu(wxMouseEvent& event);
174 DECLARE_EVENT_TABLE();
177 intf_thread_t *p_intf;
179 wxFrame *p_prefs_dialog;
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;
191 class OpenDialog: public wxDialog
195 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
196 int i_access_method );
197 virtual ~OpenDialog();
202 wxPanel *FilePanel( wxWindow* parent );
203 wxPanel *DiscPanel( wxWindow* parent );
204 wxPanel *NetPanel( wxWindow* parent );
205 wxPanel *SatPanel( wxWindow* parent );
207 void UpdateMRL( int i_access_method );
209 /* Event handlers (these functions should _not_ be virtual) */
210 void OnOk( wxCommandEvent& event );
211 void OnCancel( wxCommandEvent& event );
213 void OnPageChange( wxNotebookEvent& event );
214 void OnMRLChange( wxCommandEvent& event );
216 /* Event handlers for the file page */
217 void OnFilePanelChange( wxCommandEvent& event );
218 void OnFileBrowse( wxCommandEvent& event );
220 /* Event handlers for the disc page */
221 void OnDiscPanelChange( wxCommandEvent& event );
222 void OnDiscTypeChange( wxCommandEvent& event );
224 /* Event handlers for the net page */
225 void OnNetPanelChange( wxCommandEvent& event );
226 void OnNetTypeChange( wxCommandEvent& event );
228 /* Event handlers for the stream output */
229 void OnSubsFileEnable( wxCommandEvent& event );
230 void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
232 /* Event handlers for the stream output */
233 void OnSoutEnable( wxCommandEvent& event );
234 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
236 /* Event handlers for the demux dump */
237 void OnDemuxDumpEnable( wxCommandEvent& event );
238 void OnDemuxDumpBrowse( wxCommandEvent& event );
239 void OnDemuxDumpChange( wxCommandEvent& event );
241 DECLARE_EVENT_TABLE();
243 intf_thread_t *p_intf;
245 int i_current_access_method;
247 wxComboBox *mrl_combo;
249 /* Controls for the file panel */
250 wxComboBox *file_combo;
252 /* Controls for the disc panel */
253 wxRadioBox *disc_type;
254 wxTextCtrl *disc_device;
255 wxSpinCtrl *disc_title;
256 wxSpinCtrl *disc_chapter;
258 /* Controls for the net panel */
259 wxRadioBox *net_type;
261 wxPanel *net_subpanels[4];
262 wxRadioButton *net_radios[4];
263 wxSpinCtrl *net_ports[4];
264 wxTextCtrl *net_addrs[4];
266 /* Controls for the subtitles file */
267 wxButton *subsfile_button;
268 wxCheckBox *subsfile_checkbox;
270 /* Controls for the stream output */
271 wxButton *sout_button;
272 wxCheckBox *sout_checkbox;
274 /* Controls for the demux dump */
275 wxTextCtrl *demuxdump_textctrl;
276 wxButton *demuxdump_button;
277 wxCheckBox *demuxdump_checkbox;
288 /* Stream output Dialog */
289 class SoutDialog: public wxDialog
293 SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
294 virtual ~SoutDialog();
300 wxPanel *AccessPanel( wxWindow* parent );
301 wxPanel *EncapsulationPanel( wxWindow* parent );
304 /* Event handlers (these functions should _not_ be virtual) */
305 void OnOk( wxCommandEvent& event );
306 void OnCancel( wxCommandEvent& event );
307 void OnMRLChange( wxCommandEvent& event );
308 void OnAccessTypeChange( wxCommandEvent& event );
310 /* Event handlers for the file access output */
311 void OnFileChange( wxCommandEvent& event );
312 void OnFileBrowse( wxCommandEvent& event );
314 /* Event handlers for the net access output */
315 void OnNetChange( wxCommandEvent& event );
317 /* Event handlers for the encapsulation panel */
318 void OnEncapsulationChange( wxCommandEvent& event );
320 DECLARE_EVENT_TABLE();
322 intf_thread_t *p_intf;
325 wxComboBox *mrl_combo;
326 wxPanel *access_panel;
327 wxPanel *encapsulation_panel;
329 /* Controls for the access outputs */
330 wxPanel *access_subpanels[4];
331 wxRadioButton *access_radios[4];
335 wxComboBox *file_combo;
336 wxSpinCtrl *net_port;
337 wxTextCtrl *net_addr;
339 /* Controls for the encapsulation */
340 wxRadioButton *encapsulation_radios[4];
341 int i_encapsulation_type;
345 /* Subtitles File Dialog */
346 class SubsFileDialog: public wxDialog
350 SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
351 virtual ~SubsFileDialog();
353 wxComboBox *file_combo;
354 wxSpinCtrl *delay_spinctrl;
355 wxSpinCtrl *fps_spinctrl;
358 /* Event handlers (these functions should _not_ be virtual) */
359 void OnOk( wxCommandEvent& event );
360 void OnCancel( wxCommandEvent& event );
361 void OnFileBrowse( wxCommandEvent& event );
363 DECLARE_EVENT_TABLE();
365 intf_thread_t *p_intf;
369 /* Preferences Dialog */
371 class PrefsDialog: public wxFrame
375 PrefsDialog( intf_thread_t *p_intf, Interface *p_main_interface );
376 virtual ~PrefsDialog();
379 wxPanel *PrefsPanel( wxWindow* parent );
381 /* Event handlers (these functions should _not_ be virtual) */
382 void OnOk( wxCommandEvent& event );
383 void OnCancel( wxCommandEvent& event );
384 void OnSave( wxCommandEvent& event );
385 void OnResetAll( wxCommandEvent& event );
387 DECLARE_EVENT_TABLE();
389 intf_thread_t *p_intf;
390 Interface *p_main_interface;
392 PrefsTreeCtrl *prefs_tree;
396 class Messages: public wxFrame
400 Messages( intf_thread_t *p_intf, Interface *_p_main_interface );
405 /* Event handlers (these functions should _not_ be virtual) */
406 void OnClose( wxCommandEvent& event );
407 void OnVerbose( wxCommandEvent& event );
409 DECLARE_EVENT_TABLE();
411 intf_thread_t *p_intf;
412 Interface *p_main_interface;
413 wxTextCtrl *textctrl;
414 wxTextAttr *info_attr;
415 wxTextAttr *err_attr;
416 wxTextAttr *warn_attr;
417 wxTextAttr *dbg_attr;
419 vlc_bool_t b_verbose;
423 class Playlist: public wxFrame
427 Playlist( intf_thread_t *p_intf, Interface *p_main_interface );
430 void UpdatePlaylist();
431 void ShowPlaylist( bool show );
437 void DeleteItem( int item );
439 /* Event handlers (these functions should _not_ be virtual) */
440 void OnAddMRL( wxCommandEvent& event );
441 void OnClose( wxCommandEvent& event );
442 void OnOpen( wxCommandEvent& event );
443 void OnSave( wxCommandEvent& event );
444 void OnInvertSelection( wxCommandEvent& event );
445 void OnDeleteSelection( wxCommandEvent& event );
446 void OnSelectAll( wxCommandEvent& event );
447 void OnActivateItem( wxListEvent& event );
448 void OnKeyDown( wxListEvent& event );
451 DECLARE_EVENT_TABLE();
453 intf_thread_t *p_intf;
454 Interface *p_main_interface;
455 wxListView *listview;
456 int i_update_counter;
460 class FileInfo: public wxFrame
464 FileInfo( intf_thread_t *p_intf, Interface *p_main_interface );
466 void UpdateFileInfo();
469 void OnClose( wxCommandEvent& event );
471 DECLARE_EVENT_TABLE();
473 intf_thread_t *p_intf;
474 wxTreeCtrl *fileinfo_tree;
475 wxTreeItemId fileinfo_root;
476 wxString fileinfo_root_label;
480 #if !defined(__WXX11__)
481 /* Drag and Drop class */
482 class DragAndDrop: public wxFileDropTarget
485 DragAndDrop( intf_thread_t *_p_intf );
487 virtual bool OnDropFiles( wxCoord x, wxCoord y,
488 const wxArrayString& filenames );
491 intf_thread_t *p_intf;
496 void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface,
497 const wxPoint& pos );
498 wxMenu *AudioMenu( intf_thread_t *_p_intf, Interface *_p_main_interface );
499 wxMenu *VideoMenu( intf_thread_t *_p_intf, Interface *_p_main_interface );
501 class MenuEvtHandler : public wxEvtHandler
504 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
505 virtual ~MenuEvtHandler();
507 void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event );
511 DECLARE_EVENT_TABLE()
513 intf_thread_t *p_intf;
514 Interface *p_main_interface;
517 class Menu: public wxMenu
521 Menu( intf_thread_t *p_intf, Interface *p_main_interface, int i_count,
522 char **ppsz_names, int *pi_objects, int i_start_id );
526 /* Event handlers (these functions should _not_ be virtual) */
527 void OnClose( wxCommandEvent& event );
528 void OnEntrySelected( wxCommandEvent& event );
530 wxMenu *Menu::CreateDummyMenu();
531 void Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
532 wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t * );
534 DECLARE_EVENT_TABLE();
536 intf_thread_t *p_intf;
537 Interface *p_main_interface;