1 /*****************************************************************************
2 * wxwindows.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999-2004 VideoLAN
7 * Authors: Gildas Bazin <gbazin@videolan.org>
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 #ifdef WIN32 /* mingw32 hack */
29 /* Let vlc take care of the i18n stuff */
30 #define WXINTL_NO_GETTEXT_MACRO
32 #include <wx/wxprec.h>
35 #include <wx/listctrl.h>
36 #include <wx/textctrl.h>
37 #include <wx/notebook.h>
38 #include <wx/spinctrl.h>
40 #include <wx/treectrl.h>
43 #include <wx/checkbox.h>
44 #include <wx/wizard.h>
47 /* Hmmm, work-around for newest wxWin */
48 #ifdef wxStaticCastEvent
49 # undef wxStaticCastEvent
50 # define wxStaticCastEvent(type, val) ((type)(val))
53 DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
54 DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
56 #define SLIDER_MAX_POS 10000
58 /* wxU is used to convert ansi/utf8 strings to unicode strings (wchar_t) */
59 #if defined( ENABLE_NLS ) && defined( ENABLE_UTF8 )
61 # define wxU(utf8) wxString(utf8, wxConvUTF8)
63 # define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
67 #else // ENABLE_NLS && ENABLE_UTF8
69 # define wxU(ansi) wxString(ansi, *wxConvCurrent)
71 # define wxU(ansi) ansi
77 /* wxL2U (locale to unicode) is used to convert ansi strings to unicode
78 * strings (wchar_t) */
80 # define wxL2U(ansi) wxString(ansi, *wxConvCurrent)
82 # define wxL2U(ansi) ansi
95 class DialogsProvider;
100 /*****************************************************************************
101 * intf_sys_t: description and status of wxwindows interface
102 *****************************************************************************/
105 /* the wx parent window */
106 wxWindow *p_wxwindow;
109 /* special actions */
110 vlc_bool_t b_playing;
112 /* The input thread */
113 input_thread_t * p_input;
116 int i_slider_pos; /* slider position */
117 int i_slider_oldpos; /* previous position */
118 vlc_bool_t b_slider_free; /* slider status */
120 /* The messages window */
121 msg_subscription_t* p_sub; /* message bank subscription */
123 /* Playlist management */
124 int i_playing; /* playlist selected item */
126 /* Send an event to show a dialog */
127 void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
128 intf_dialog_args_t *p_arg );
131 wxMenu *p_popup_menu;
134 int i_first_hotkey_event;
138 VideoWindow *p_video_window;
139 wxBoxSizer *p_video_sizer;
142 /*****************************************************************************
144 *****************************************************************************/
145 wxArrayString SeparateEntries( wxString );
146 wxWindow *VideoWindow( intf_thread_t *p_intf, wxWindow *p_parent );
147 wxWindow *BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent );
148 wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
155 class SubsFileDialog;
161 class ItemInfoDialog;
163 class ExportPlaylist;
165 /*****************************************************************************
166 * Classes declarations.
167 *****************************************************************************/
169 class Timer: public wxTimer
173 Timer( intf_thread_t *p_intf, Interface *p_main_interface );
176 virtual void Notify();
179 intf_thread_t *p_intf;
180 Interface *p_main_interface;
181 int i_old_playing_status;
183 vlc_bool_t b_old_seekable;
187 class Interface: public wxFrame
191 Interface( intf_thread_t *p_intf );
192 virtual ~Interface();
193 void TogglePlayButton( int i_playing_status );
196 wxBoxSizer *frame_sizer;
197 wxStatusBar *statusbar;
200 wxWindow *slider_frame;
201 wxWindow *extra_frame;
205 wxStaticBox *adjust_box;
206 wxButton *restoredefaults_button;
207 wxSlider *brightness_slider;
208 wxSlider *contrast_slider;
209 wxSlider *saturation_slider;
210 wxSlider *hue_slider;
211 wxSlider *gamma_slider;
213 wxStaticBox *other_box;
214 wxComboBox *ratio_combo;
220 void CreateOurMenuBar();
221 void CreateOurToolBar();
222 void CreateOurExtendedPanel();
223 void CreateOurSlider();
224 void Open( int i_access_method );
226 /* Event handlers (these functions should _not_ be virtual) */
227 void OnExit( wxCommandEvent& event );
228 void OnAbout( wxCommandEvent& event );
230 void OnOpenFileSimple( wxCommandEvent& event );
231 void OnOpenFile( wxCommandEvent& event );
232 void OnOpenDisc( wxCommandEvent& event );
233 void OnOpenNet( wxCommandEvent& event );
234 void OnOpenSat( wxCommandEvent& event );
235 void OnExtended( wxCommandEvent& event );
236 void OnBookmarks( wxCommandEvent& event );
237 void OnShowDialog( wxCommandEvent& event );
238 void OnPlayStream( wxCommandEvent& event );
239 void OnStopStream( wxCommandEvent& event );
240 void OnSliderUpdate( wxScrollEvent& event );
241 void OnPrevStream( wxCommandEvent& event );
242 void OnNextStream( wxCommandEvent& event );
243 void OnSlowStream( wxCommandEvent& event );
244 void OnFastStream( wxCommandEvent& event );
246 void OnEnableAdjust( wxCommandEvent& event );
247 void OnRestoreDefaults( wxCommandEvent& event);
248 void OnAdjustUpdate( wxScrollEvent& event );
250 void OnRatio( wxCommandEvent& event );
251 void OnEnableVisual( wxCommandEvent& event );
253 void OnMenuOpen( wxMenuEvent& event );
255 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
256 void OnContextMenu2(wxContextMenuEvent& event);
258 void OnContextMenu(wxMouseEvent& event);
260 void OnControlEvent( wxCommandEvent& event );
262 DECLARE_EVENT_TABLE();
265 intf_thread_t *p_intf;
268 int i_old_playing_status;
270 /* For auto-generated menus */
271 wxMenu *p_settings_menu;
272 wxMenu *p_audio_menu;
273 wxMenu *p_video_menu;
274 wxMenu *p_navig_menu;
278 WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel);
279 class OpenDialog: public wxDialog
283 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
284 int i_access_method, int i_arg = 0 );
286 /* Extended Contructor */
287 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
288 int i_access_method, int i_arg = 0 , int _i_method = 0 );
289 virtual ~OpenDialog();
292 int Show( int i_access_method, int i_arg = 0 );
295 void UpdateMRL( int i_access_method );
300 wxPanel *FilePanel( wxWindow* parent );
301 wxPanel *DiscPanel( wxWindow* parent );
302 wxPanel *NetPanel( wxWindow* parent );
304 ArrayOfAutoBuiltPanel input_tab_array;
306 /* Event handlers (these functions should _not_ be virtual) */
307 void OnOk( wxCommandEvent& event );
308 void OnCancel( wxCommandEvent& event );
310 void OnPageChange( wxNotebookEvent& event );
311 void OnMRLChange( wxCommandEvent& event );
313 /* Event handlers for the file page */
314 void OnFilePanelChange( wxCommandEvent& event );
315 void OnFileBrowse( wxCommandEvent& event );
317 /* Event handlers for the disc page */
318 void OnDiscPanelChange( wxCommandEvent& event );
319 void OnDiscTypeChange( wxCommandEvent& event );
320 void OnDiscDeviceChange( wxCommandEvent& event );
322 /* Event handlers for the net page */
323 void OnNetPanelChange( wxCommandEvent& event );
324 void OnNetTypeChange( wxCommandEvent& event );
326 /* Event handlers for the stream output */
327 void OnSubsFileEnable( wxCommandEvent& event );
328 void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
330 /* Event handlers for the stream output */
331 void OnSoutEnable( wxCommandEvent& event );
332 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
334 DECLARE_EVENT_TABLE();
336 intf_thread_t *p_intf;
338 int i_current_access_method;
339 int i_disc_type_selection;
341 int i_method; /* Normal or for the stream dialog ? */
344 wxComboBox *mrl_combo;
345 wxNotebook *notebook;
347 /* Controls for the file panel */
348 wxComboBox *file_combo;
349 wxFileDialog *file_dialog;
351 /* Controls for the disc panel */
352 wxRadioBox *disc_type;
353 wxTextCtrl *disc_device;
354 wxSpinCtrl *disc_title;
355 wxSpinCtrl *disc_chapter;
357 /* The media equivalent name for a DVD names. For example,
358 "Title", is "Track" for a CD-DA */
359 wxStaticText *disc_title_label;
360 wxStaticText *disc_chapter_label;
362 /* Indicates if the disc device control was modified */
363 bool b_disc_device_changed;
365 /* Controls for the net panel */
366 wxRadioBox *net_type;
368 wxPanel *net_subpanels[4];
369 wxRadioButton *net_radios[4];
370 wxSpinCtrl *net_ports[4];
372 wxTextCtrl *net_addrs[4];
373 wxCheckBox *net_ipv6;
375 /* Controls for the subtitles file */
376 wxButton *subsfile_button;
377 wxCheckBox *subsfile_checkbox;
378 SubsFileDialog *subsfile_dialog;
379 wxArrayString subsfile_mrl;
381 /* Controls for the stream output */
382 wxButton *sout_button;
383 wxCheckBox *sout_checkbox;
384 SoutDialog *sout_dialog;
385 wxArrayString sout_mrl;
394 /* Auto-built panels */
397 #define MAX_ACCESS CAPTURE_ACCESS
399 /* Stream output Dialog */
413 TS_ENCAPSULATION = 0,
431 class SoutDialog: public wxDialog
435 SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
436 virtual ~SoutDialog();
438 wxArrayString GetOptions();
442 wxPanel *AccessPanel( wxWindow* parent );
443 wxPanel *MiscPanel( wxWindow* parent );
444 wxPanel *EncapsulationPanel( wxWindow* parent );
445 wxPanel *TranscodingPanel( wxWindow* parent );
448 /* Event handlers (these functions should _not_ be virtual) */
449 void OnOk( wxCommandEvent& event );
450 void OnCancel( wxCommandEvent& event );
451 void OnMRLChange( wxCommandEvent& event );
452 void OnAccessTypeChange( wxCommandEvent& event );
454 /* Event handlers for the file access output */
455 void OnFileChange( wxCommandEvent& event );
456 void OnFileBrowse( wxCommandEvent& event );
457 void OnFileDump( wxCommandEvent& event );
459 /* Event handlers for the net access output */
460 void OnNetChange( wxCommandEvent& event );
462 /* Event specific to the announce address */
463 void OnAnnounceAddrChange( wxCommandEvent& event );
465 /* Event handlers for the encapsulation panel */
466 void OnEncapsulationChange( wxCommandEvent& event );
468 /* Event handlers for the transcoding panel */
469 void OnTranscodingEnable( wxCommandEvent& event );
470 void OnTranscodingChange( wxCommandEvent& event );
472 /* Event handlers for the misc panel */
473 void OnSAPMiscChange( wxCommandEvent& event );
474 void OnSLPMiscChange( wxCommandEvent& event );
476 DECLARE_EVENT_TABLE();
478 intf_thread_t *p_intf;
481 wxComboBox *mrl_combo;
483 /* Controls for the access outputs */
484 wxPanel *access_panel;
485 wxPanel *access_subpanels[ACCESS_OUT_NUM];
486 wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
490 wxComboBox *file_combo;
491 wxCheckBox *dump_checkbox;
492 wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
493 wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
495 /* Controls for the SAP announces */
497 wxPanel *misc_subpanels[MISC_SOUT_NUM];
498 wxCheckBox *sap_checkbox;
499 wxCheckBox *slp_checkbox;
500 wxTextCtrl *announce_addr;
502 /* Controls for the encapsulation */
503 wxPanel *encapsulation_panel;
504 wxRadioButton *encapsulation_radios[ENCAPS_NUM];
505 int i_encapsulation_type;
507 /* Controls for transcoding */
508 wxPanel *transcoding_panel;
509 wxCheckBox *video_transc_checkbox;
510 wxComboBox *video_codec_combo;
511 wxComboBox *audio_codec_combo;
512 wxCheckBox *audio_transc_checkbox;
513 wxComboBox *video_bitrate_combo;
514 wxComboBox *audio_bitrate_combo;
515 wxComboBox *audio_channels_combo;
516 wxComboBox *video_scale_combo;
519 /* Subtitles File Dialog */
520 class SubsFileDialog: public wxDialog
524 SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
525 virtual ~SubsFileDialog();
527 wxComboBox *file_combo;
528 wxComboBox *encoding_combo;
529 wxSpinCtrl *delay_spinctrl;
530 wxSpinCtrl *fps_spinctrl;
533 /* Event handlers (these functions should _not_ be virtual) */
534 void OnOk( wxCommandEvent& event );
535 void OnCancel( wxCommandEvent& event );
536 void OnFileBrowse( wxCommandEvent& event );
538 DECLARE_EVENT_TABLE();
540 intf_thread_t *p_intf;
545 class StreamDialog: public wxFrame
549 StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent );
550 virtual ~StreamDialog();
553 void OnClose( wxCommandEvent& event );
554 void OnOpen( wxCommandEvent& event );
555 void OnSout( wxCommandEvent& event );
556 void OnStart( wxCommandEvent& event );
558 DECLARE_EVENT_TABLE();
560 intf_thread_t *p_intf;
562 wxStaticText *step2_label;
563 wxStaticText *step3_label;
564 wxButton *sout_button;
565 wxButton *start_button;
567 wxArrayString sout_mrl;
568 OpenDialog *p_open_dialog;
569 SoutDialog *p_sout_dialog;
573 class WizardDialog : public wxWizard
577 WizardDialog( intf_thread_t *p_intf, wxWindow *p_parent );
578 virtual ~WizardDialog();
579 void SetTranscode( char *vcodec, int vb, char *acodec,int ab);
580 void SetMrl( const char *mrl );
581 void SetPartial( int, int );
582 void SetStream( char *method, char *address );
583 void SetTranscodeOut( char *address );
584 void SetAction( int i_action );
586 void SetMux( char *mux );
593 char *vcodec,*acodec,*method,*address,*mrl,*mux;
594 DECLARE_EVENT_TABLE();
596 intf_thread_t *p_intf;
600 /* Preferences Dialog */
601 class PrefsDialog: public wxFrame
605 PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
606 virtual ~PrefsDialog();
609 wxPanel *PrefsPanel( wxWindow* parent );
611 /* Event handlers (these functions should _not_ be virtual) */
612 void OnOk( wxCommandEvent& event );
613 void OnCancel( wxCommandEvent& event );
614 void OnSave( wxCommandEvent& event );
615 void OnResetAll( wxCommandEvent& event );
616 void OnAdvanced( wxCommandEvent& event );
618 DECLARE_EVENT_TABLE();
620 intf_thread_t *p_intf;
622 PrefsTreeCtrl *prefs_tree;
626 class Messages: public wxFrame
630 Messages( intf_thread_t *p_intf, wxWindow *p_parent );
632 bool Show( bool show = TRUE );
636 /* Event handlers (these functions should _not_ be virtual) */
637 void OnClose( wxCommandEvent& event );
638 void OnClear( wxCommandEvent& event );
639 void OnSaveLog( wxCommandEvent& event );
641 DECLARE_EVENT_TABLE();
643 intf_thread_t *p_intf;
644 wxTextCtrl *textctrl;
645 wxTextAttr *info_attr;
646 wxTextAttr *err_attr;
647 wxTextAttr *warn_attr;
648 wxTextAttr *dbg_attr;
650 wxFileDialog *save_log_dialog;
652 vlc_bool_t b_verbose;
656 class Playlist: public wxFrame
660 Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
663 void UpdatePlaylist();
664 void ShowPlaylist( bool show );
665 void UpdateItem( int );
670 void DeleteItem( int item );
671 void ShowInfos( int item );
673 /* Event handlers (these functions should _not_ be virtual) */
674 void OnAddFile( wxCommandEvent& event );
675 void OnAddMRL( wxCommandEvent& event );
676 void OnClose( wxCommandEvent& event );
677 void OnSearch( wxCommandEvent& event );
678 void OnEnDis( wxCommandEvent& event );
679 void OnInfos( wxCommandEvent& event );
680 void OnSearchTextChange( wxCommandEvent& event );
681 void OnOpen( wxCommandEvent& event );
682 void OnSave( wxCommandEvent& event );
684 void OnSort( wxCommandEvent& event );
685 void OnColSelect( wxListEvent& event );
687 void OnUp( wxCommandEvent& event);
688 void OnDown( wxCommandEvent& event);
690 void OnEnableSelection( wxCommandEvent& event );
691 void OnDisableSelection( wxCommandEvent& event );
692 void OnInvertSelection( wxCommandEvent& event );
693 void OnDeleteSelection( wxCommandEvent& event );
694 void OnSelectAll( wxCommandEvent& event );
695 void OnRandom( wxCommandEvent& event );
696 void OnRepeat( wxCommandEvent& event );
697 void OnLoop ( wxCommandEvent& event );
698 void OnActivateItem( wxListEvent& event );
699 void OnKeyDown( wxListEvent& event );
700 void OnNewGroup( wxCommandEvent& event );
702 /* Popup functions */
703 void OnPopup( wxListEvent& event );
704 void OnPopupPlay( wxMenuEvent& event );
705 void OnPopupDel( wxMenuEvent& event );
706 void OnPopupEna( wxMenuEvent& event );
707 void OnPopupInfo( wxMenuEvent& event );
711 void OnPlaylistEvent( wxCommandEvent& event );
713 wxTextCtrl *search_text;
714 wxButton *search_button;
715 DECLARE_EVENT_TABLE();
719 ItemInfoDialog *iteminfo_dialog;
721 intf_thread_t *p_intf;
722 wxListView *listview;
723 wxTreeCtrl *treeview;
724 int i_update_counter;
732 int i_duration_sorted;
735 class NewGroup: public wxDialog
739 NewGroup( intf_thread_t *p_intf, wxWindow *p_parent );
744 /* Event handlers (these functions should _not_ be virtual) */
745 void OnOk( wxCommandEvent& event );
746 void OnCancel( wxCommandEvent& event );
748 DECLARE_EVENT_TABLE();
750 intf_thread_t *p_intf;
751 wxTextCtrl *groupname;
754 friend class Playlist;
755 friend class ItemInfoDialog;
759 /* ItemInfo Dialog */
760 class ItemInfoDialog: public wxDialog
764 ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
765 wxWindow *p_parent );
766 virtual ~ItemInfoDialog();
768 wxArrayString GetOptions();
771 wxPanel *InfoPanel( wxWindow* parent );
772 wxPanel *GroupPanel( wxWindow* parent );
774 /* Event handlers (these functions should _not_ be virtual) */
775 void OnOk( wxCommandEvent& event );
776 void OnCancel( wxCommandEvent& event );
777 void OnNewGroup( wxCommandEvent& event );
781 DECLARE_EVENT_TABLE();
783 intf_thread_t *p_intf;
784 playlist_item_t *p_item;
787 /* Controls for the iteminfo dialog box */
788 wxPanel *info_subpanel;
791 wxPanel *group_subpanel;
792 wxPanel *group_panel;
794 wxTextCtrl *uri_text;
795 wxTextCtrl *name_text;
796 wxTextCtrl *author_text;
798 wxTreeCtrl *info_tree;
799 wxTreeItemId info_root;
801 wxCheckBox *enabled_checkbox;
802 wxComboBox *group_combo;
808 class FileInfo: public wxFrame
812 FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
814 void UpdateFileInfo();
817 void OnClose( wxCommandEvent& event );
819 DECLARE_EVENT_TABLE();
821 intf_thread_t *p_intf;
822 wxTreeCtrl *fileinfo_tree;
823 wxTreeItemId fileinfo_root;
824 wxString fileinfo_root_label;
828 #if wxUSE_DRAG_AND_DROP
829 /* Drag and Drop class */
830 class DragAndDrop: public wxFileDropTarget
833 DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE );
835 virtual bool OnDropFiles( wxCoord x, wxCoord y,
836 const wxArrayString& filenames );
839 intf_thread_t *p_intf;
840 vlc_bool_t b_enqueue;
843 } // end of wxvlc namespace
846 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
847 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
848 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
849 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
850 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
854 class MenuEvtHandler : public wxEvtHandler
857 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
858 virtual ~MenuEvtHandler();
860 void OnMenuEvent( wxCommandEvent& event );
861 void OnShowDialog( wxCommandEvent& event );
865 DECLARE_EVENT_TABLE()
867 intf_thread_t *p_intf;
868 Interface *p_main_interface;
871 } // end of wxvlc namespace
872 using namespace wxvlc;