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;
186 class Interface: public wxFrame
190 Interface( intf_thread_t *p_intf );
191 virtual ~Interface();
192 void TogglePlayButton( int i_playing_status );
195 wxBoxSizer *frame_sizer;
196 wxStatusBar *statusbar;
199 wxWindow *slider_frame;
200 wxWindow *extra_frame;
204 wxStaticBox *adjust_box;
205 wxButton *restoredefaults_button;
206 wxSlider *brightness_slider;
207 wxSlider *contrast_slider;
208 wxSlider *saturation_slider;
209 wxSlider *hue_slider;
210 wxSlider *gamma_slider;
212 wxStaticBox *other_box;
213 wxComboBox *ratio_combo;
219 void CreateOurMenuBar();
220 void CreateOurToolBar();
221 void CreateOurExtendedPanel();
222 void CreateOurSlider();
223 void Open( int i_access_method );
225 /* Event handlers (these functions should _not_ be virtual) */
226 void OnExit( wxCommandEvent& event );
227 void OnAbout( wxCommandEvent& event );
229 void OnOpenFileSimple( wxCommandEvent& event );
230 void OnOpenFile( wxCommandEvent& event );
231 void OnOpenDisc( wxCommandEvent& event );
232 void OnOpenNet( wxCommandEvent& event );
233 void OnOpenSat( wxCommandEvent& event );
234 void OnExtended( wxCommandEvent& event );
235 void OnBookmarks( wxCommandEvent& event );
236 void OnShowDialog( wxCommandEvent& event );
237 void OnPlayStream( wxCommandEvent& event );
238 void OnStopStream( wxCommandEvent& event );
239 void OnSliderUpdate( wxScrollEvent& event );
240 void OnPrevStream( wxCommandEvent& event );
241 void OnNextStream( wxCommandEvent& event );
242 void OnSlowStream( wxCommandEvent& event );
243 void OnFastStream( wxCommandEvent& event );
245 void OnEnableAdjust( wxCommandEvent& event );
246 void OnRestoreDefaults( wxCommandEvent& event);
247 void OnAdjustUpdate( wxScrollEvent& event );
249 void OnRatio( wxCommandEvent& event );
250 void OnEnableVisual( wxCommandEvent& event );
252 void OnMenuOpen( wxMenuEvent& event );
254 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
255 void OnContextMenu2(wxContextMenuEvent& event);
257 void OnContextMenu(wxMouseEvent& event);
259 void OnControlEvent( wxCommandEvent& event );
261 DECLARE_EVENT_TABLE();
264 intf_thread_t *p_intf;
267 int i_old_playing_status;
269 /* For auto-generated menus */
270 wxMenu *p_settings_menu;
271 wxMenu *p_audio_menu;
272 wxMenu *p_video_menu;
273 wxMenu *p_navig_menu;
277 WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel);
278 class OpenDialog: public wxDialog
282 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
283 int i_access_method, int i_arg = 0 );
285 /* Extended Contructor */
286 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
287 int i_access_method, int i_arg = 0 , int _i_method = 0 );
288 virtual ~OpenDialog();
291 int Show( int i_access_method, int i_arg = 0 );
294 void UpdateMRL( int i_access_method );
299 wxPanel *FilePanel( wxWindow* parent );
300 wxPanel *DiscPanel( wxWindow* parent );
301 wxPanel *NetPanel( wxWindow* parent );
303 ArrayOfAutoBuiltPanel input_tab_array;
305 /* Event handlers (these functions should _not_ be virtual) */
306 void OnOk( wxCommandEvent& event );
307 void OnCancel( wxCommandEvent& event );
309 void OnPageChange( wxNotebookEvent& event );
310 void OnMRLChange( wxCommandEvent& event );
312 /* Event handlers for the file page */
313 void OnFilePanelChange( wxCommandEvent& event );
314 void OnFileBrowse( wxCommandEvent& event );
316 /* Event handlers for the disc page */
317 void OnDiscPanelChange( wxCommandEvent& event );
318 void OnDiscTypeChange( wxCommandEvent& event );
319 void OnDiscDeviceChange( wxCommandEvent& event );
321 /* Event handlers for the net page */
322 void OnNetPanelChange( wxCommandEvent& event );
323 void OnNetTypeChange( wxCommandEvent& event );
325 /* Event handlers for the stream output */
326 void OnSubsFileEnable( wxCommandEvent& event );
327 void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
329 /* Event handlers for the stream output */
330 void OnSoutEnable( wxCommandEvent& event );
331 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
333 DECLARE_EVENT_TABLE();
335 intf_thread_t *p_intf;
337 int i_current_access_method;
338 int i_disc_type_selection;
340 int i_method; /* Normal or for the stream dialog ? */
343 wxComboBox *mrl_combo;
344 wxNotebook *notebook;
346 /* Controls for the file panel */
347 wxComboBox *file_combo;
348 wxFileDialog *file_dialog;
350 /* Controls for the disc panel */
351 wxRadioBox *disc_type;
352 wxTextCtrl *disc_device;
353 wxSpinCtrl *disc_title;
354 wxSpinCtrl *disc_chapter;
356 /* The media equivalent name for a DVD names. For example,
357 "Title", is "Track" for a CD-DA */
358 wxStaticText *disc_title_label;
359 wxStaticText *disc_chapter_label;
361 /* Indicates if the disc device control was modified */
362 bool b_disc_device_changed;
364 /* Controls for the net panel */
365 wxRadioBox *net_type;
367 wxPanel *net_subpanels[4];
368 wxRadioButton *net_radios[4];
369 wxSpinCtrl *net_ports[4];
371 wxTextCtrl *net_addrs[4];
372 wxCheckBox *net_ipv6;
374 /* Controls for the subtitles file */
375 wxButton *subsfile_button;
376 wxCheckBox *subsfile_checkbox;
377 SubsFileDialog *subsfile_dialog;
378 wxArrayString subsfile_mrl;
380 /* Controls for the stream output */
381 wxButton *sout_button;
382 wxCheckBox *sout_checkbox;
383 SoutDialog *sout_dialog;
384 wxArrayString sout_mrl;
393 /* Auto-built panels */
396 #define MAX_ACCESS CAPTURE_ACCESS
398 /* Stream output Dialog */
412 TS_ENCAPSULATION = 0,
430 class SoutDialog: public wxDialog
434 SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
435 virtual ~SoutDialog();
437 wxArrayString GetOptions();
441 wxPanel *AccessPanel( wxWindow* parent );
442 wxPanel *MiscPanel( wxWindow* parent );
443 wxPanel *EncapsulationPanel( wxWindow* parent );
444 wxPanel *TranscodingPanel( wxWindow* parent );
447 /* Event handlers (these functions should _not_ be virtual) */
448 void OnOk( wxCommandEvent& event );
449 void OnCancel( wxCommandEvent& event );
450 void OnMRLChange( wxCommandEvent& event );
451 void OnAccessTypeChange( wxCommandEvent& event );
453 /* Event handlers for the file access output */
454 void OnFileChange( wxCommandEvent& event );
455 void OnFileBrowse( wxCommandEvent& event );
456 void OnFileDump( wxCommandEvent& event );
458 /* Event handlers for the net access output */
459 void OnNetChange( wxCommandEvent& event );
461 /* Event specific to the announce address */
462 void OnAnnounceAddrChange( wxCommandEvent& event );
464 /* Event handlers for the encapsulation panel */
465 void OnEncapsulationChange( wxCommandEvent& event );
467 /* Event handlers for the transcoding panel */
468 void OnTranscodingEnable( wxCommandEvent& event );
469 void OnTranscodingChange( wxCommandEvent& event );
471 /* Event handlers for the misc panel */
472 void OnSAPMiscChange( wxCommandEvent& event );
473 void OnSLPMiscChange( wxCommandEvent& event );
475 DECLARE_EVENT_TABLE();
477 intf_thread_t *p_intf;
480 wxComboBox *mrl_combo;
482 /* Controls for the access outputs */
483 wxPanel *access_panel;
484 wxPanel *access_subpanels[ACCESS_OUT_NUM];
485 wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
489 wxComboBox *file_combo;
490 wxCheckBox *dump_checkbox;
491 wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
492 wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
494 /* Controls for the SAP announces */
496 wxPanel *misc_subpanels[MISC_SOUT_NUM];
497 wxCheckBox *sap_checkbox;
498 wxCheckBox *slp_checkbox;
499 wxTextCtrl *announce_addr;
501 /* Controls for the encapsulation */
502 wxPanel *encapsulation_panel;
503 wxRadioButton *encapsulation_radios[ENCAPS_NUM];
504 int i_encapsulation_type;
506 /* Controls for transcoding */
507 wxPanel *transcoding_panel;
508 wxCheckBox *video_transc_checkbox;
509 wxComboBox *video_codec_combo;
510 wxComboBox *audio_codec_combo;
511 wxCheckBox *audio_transc_checkbox;
512 wxComboBox *video_bitrate_combo;
513 wxComboBox *audio_bitrate_combo;
514 wxComboBox *audio_channels_combo;
515 wxComboBox *video_scale_combo;
518 /* Subtitles File Dialog */
519 class SubsFileDialog: public wxDialog
523 SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
524 virtual ~SubsFileDialog();
526 wxComboBox *file_combo;
527 wxComboBox *encoding_combo;
528 wxSpinCtrl *delay_spinctrl;
529 wxSpinCtrl *fps_spinctrl;
532 /* Event handlers (these functions should _not_ be virtual) */
533 void OnOk( wxCommandEvent& event );
534 void OnCancel( wxCommandEvent& event );
535 void OnFileBrowse( wxCommandEvent& event );
537 DECLARE_EVENT_TABLE();
539 intf_thread_t *p_intf;
544 class StreamDialog: public wxFrame
548 StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent );
549 virtual ~StreamDialog();
552 void OnClose( wxCommandEvent& event );
553 void OnOpen( wxCommandEvent& event );
554 void OnSout( wxCommandEvent& event );
555 void OnStart( wxCommandEvent& event );
557 DECLARE_EVENT_TABLE();
559 intf_thread_t *p_intf;
561 wxStaticText *step2_label;
562 wxStaticText *step3_label;
563 wxButton *sout_button;
564 wxButton *start_button;
566 wxArrayString sout_mrl;
567 OpenDialog *p_open_dialog;
568 SoutDialog *p_sout_dialog;
572 class WizardDialog : public wxWizard
576 WizardDialog( intf_thread_t *p_intf, wxWindow *p_parent );
577 virtual ~WizardDialog();
578 void SetTranscode( char *vcodec, int vb, char *acodec,int ab);
579 void SetMrl( const char *mrl );
580 void SetPartial( int, int );
581 void SetStream( char *method, char *address );
582 void SetTranscodeOut( char *address );
583 void SetAction( int i_action );
585 void SetMux( char *mux );
592 char *vcodec,*acodec,*method,*address,*mrl,*mux;
593 DECLARE_EVENT_TABLE();
595 intf_thread_t *p_intf;
599 /* Preferences Dialog */
600 class PrefsDialog: public wxFrame
604 PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
605 virtual ~PrefsDialog();
608 wxPanel *PrefsPanel( wxWindow* parent );
610 /* Event handlers (these functions should _not_ be virtual) */
611 void OnOk( wxCommandEvent& event );
612 void OnCancel( wxCommandEvent& event );
613 void OnSave( wxCommandEvent& event );
614 void OnResetAll( wxCommandEvent& event );
615 void OnAdvanced( wxCommandEvent& event );
617 DECLARE_EVENT_TABLE();
619 intf_thread_t *p_intf;
621 PrefsTreeCtrl *prefs_tree;
625 class Messages: public wxFrame
629 Messages( intf_thread_t *p_intf, wxWindow *p_parent );
631 bool Show( bool show = TRUE );
635 /* Event handlers (these functions should _not_ be virtual) */
636 void OnClose( wxCommandEvent& event );
637 void OnClear( wxCommandEvent& event );
638 void OnSaveLog( wxCommandEvent& event );
640 DECLARE_EVENT_TABLE();
642 intf_thread_t *p_intf;
643 wxTextCtrl *textctrl;
644 wxTextAttr *info_attr;
645 wxTextAttr *err_attr;
646 wxTextAttr *warn_attr;
647 wxTextAttr *dbg_attr;
649 wxFileDialog *save_log_dialog;
651 vlc_bool_t b_verbose;
655 class Playlist: public wxFrame
659 Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
662 void UpdatePlaylist();
663 void ShowPlaylist( bool show );
664 void UpdateItem( int );
669 void DeleteItem( int item );
670 void ShowInfos( int item );
672 /* Event handlers (these functions should _not_ be virtual) */
673 void OnAddFile( wxCommandEvent& event );
674 void OnAddMRL( wxCommandEvent& event );
675 void OnClose( wxCommandEvent& event );
676 void OnSearch( wxCommandEvent& event );
677 void OnEnDis( wxCommandEvent& event );
678 void OnInfos( wxCommandEvent& event );
679 void OnSearchTextChange( wxCommandEvent& event );
680 void OnOpen( wxCommandEvent& event );
681 void OnSave( wxCommandEvent& event );
683 void OnSort( wxCommandEvent& event );
684 void OnColSelect( wxListEvent& event );
686 void OnUp( wxCommandEvent& event);
687 void OnDown( wxCommandEvent& event);
689 void OnEnableSelection( wxCommandEvent& event );
690 void OnDisableSelection( wxCommandEvent& event );
691 void OnInvertSelection( wxCommandEvent& event );
692 void OnDeleteSelection( wxCommandEvent& event );
693 void OnSelectAll( wxCommandEvent& event );
694 void OnRandom( wxCommandEvent& event );
695 void OnRepeat( wxCommandEvent& event );
696 void OnLoop ( wxCommandEvent& event );
697 void OnActivateItem( wxListEvent& event );
698 void OnKeyDown( wxListEvent& event );
699 void OnNewGroup( wxCommandEvent& event );
701 /* Popup functions */
702 void OnPopup( wxListEvent& event );
703 void OnPopupPlay( wxMenuEvent& event );
704 void OnPopupDel( wxMenuEvent& event );
705 void OnPopupEna( wxMenuEvent& event );
706 void OnPopupInfo( wxMenuEvent& event );
710 void OnPlaylistEvent( wxCommandEvent& event );
712 wxTextCtrl *search_text;
713 wxButton *search_button;
714 DECLARE_EVENT_TABLE();
718 ItemInfoDialog *iteminfo_dialog;
720 intf_thread_t *p_intf;
721 wxListView *listview;
722 wxTreeCtrl *treeview;
723 int i_update_counter;
731 int i_duration_sorted;
734 class NewGroup: public wxDialog
738 NewGroup( intf_thread_t *p_intf, wxWindow *p_parent );
743 /* Event handlers (these functions should _not_ be virtual) */
744 void OnOk( wxCommandEvent& event );
745 void OnCancel( wxCommandEvent& event );
747 DECLARE_EVENT_TABLE();
749 intf_thread_t *p_intf;
750 wxTextCtrl *groupname;
753 friend class Playlist;
754 friend class ItemInfoDialog;
758 /* ItemInfo Dialog */
759 class ItemInfoDialog: public wxDialog
763 ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
764 wxWindow *p_parent );
765 virtual ~ItemInfoDialog();
767 wxArrayString GetOptions();
770 wxPanel *InfoPanel( wxWindow* parent );
771 wxPanel *GroupPanel( wxWindow* parent );
773 /* Event handlers (these functions should _not_ be virtual) */
774 void OnOk( wxCommandEvent& event );
775 void OnCancel( wxCommandEvent& event );
776 void OnNewGroup( wxCommandEvent& event );
780 DECLARE_EVENT_TABLE();
782 intf_thread_t *p_intf;
783 playlist_item_t *p_item;
786 /* Controls for the iteminfo dialog box */
787 wxPanel *info_subpanel;
790 wxPanel *group_subpanel;
791 wxPanel *group_panel;
793 wxTextCtrl *uri_text;
794 wxTextCtrl *name_text;
795 wxTextCtrl *author_text;
797 wxTreeCtrl *info_tree;
798 wxTreeItemId info_root;
800 wxCheckBox *enabled_checkbox;
801 wxComboBox *group_combo;
807 class FileInfo: public wxFrame
811 FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
813 void UpdateFileInfo();
816 void OnClose( wxCommandEvent& event );
818 DECLARE_EVENT_TABLE();
820 intf_thread_t *p_intf;
821 wxTreeCtrl *fileinfo_tree;
822 wxTreeItemId fileinfo_root;
823 wxString fileinfo_root_label;
827 #if wxUSE_DRAG_AND_DROP
828 /* Drag and Drop class */
829 class DragAndDrop: public wxFileDropTarget
832 DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE );
834 virtual bool OnDropFiles( wxCoord x, wxCoord y,
835 const wxArrayString& filenames );
838 intf_thread_t *p_intf;
839 vlc_bool_t b_enqueue;
842 } // end of wxvlc namespace
845 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
846 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
847 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
848 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
849 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
853 class MenuEvtHandler : public wxEvtHandler
856 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
857 virtual ~MenuEvtHandler();
859 void OnMenuEvent( wxCommandEvent& event );
860 void OnShowDialog( wxCommandEvent& event );
864 DECLARE_EVENT_TABLE()
866 intf_thread_t *p_intf;
867 Interface *p_main_interface;
870 } // end of wxvlc namespace
871 using namespace wxvlc;