1 /*****************************************************************************
2 * wxwidgets.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999-2005 the VideoLAN team
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 */
30 // turn off 'identifier was truncated to '255' characters in the debug info'
31 # pragma warning( disable:4786 )
34 /* Let vlc take care of the i18n stuff */
35 #define WXINTL_NO_GETTEXT_MACRO
39 #include <wx/wxprec.h>
42 #include <wx/listctrl.h>
43 #include <wx/textctrl.h>
44 #include <wx/notebook.h>
45 #include <wx/spinctrl.h>
47 #include <wx/treectrl.h>
50 #include <wx/checkbox.h>
51 #include <wx/wizard.h>
52 #include <wx/taskbar.h>
55 #if (!wxCHECK_VERSION(2,5,0))
56 typedef long wxTreeItemIdValue;
59 DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
60 DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
62 #define SLIDER_MAX_POS 10000
64 /* wxU is used to convert ansi/utf8 strings to unicode strings (wchar_t) */
65 #if defined( ENABLE_NLS )
67 # define wxU(utf8) wxString(utf8, wxConvUTF8)
69 # define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
73 # define wxU(ansi) wxString(ansi, wxConvLocal)
75 # define wxU(ansi) (ansi)
79 /* wxL2U (locale to unicode) is used to convert ansi strings to unicode
80 * strings (wchar_t) */
81 #define wxL2U(ansi) wxU(ansi)
84 # define wxFromLocale(wxstring) FromUTF32(wxstring.wc_str())
85 # define wxLocaleFree(string) free(string)
87 # define wxFromLocale(wxstring) FromLocale(wxstring.mb_str())
88 # define wxLocaleFree(string) LocaleFree(string)
106 class DialogsProvider;
108 class AutoBuiltPanel;
110 class WindowSettings;
112 /*****************************************************************************
113 * intf_sys_t: description and status of wxwindows interface
114 *****************************************************************************/
117 /* the wx parent window */
118 wxWindow *p_wxwindow;
121 /* window settings */
122 WindowSettings *p_window_settings;
124 /* special actions */
125 vlc_bool_t b_playing;
126 vlc_bool_t b_intf_show; /* interface to be shown */
128 /* The input thread */
129 input_thread_t * p_input;
132 int i_slider_pos; /* slider position */
133 int i_slider_oldpos; /* previous position */
134 vlc_bool_t b_slider_free; /* slider status */
136 /* The messages window */
137 msg_subscription_t* p_sub; /* message bank subscription */
139 /* Playlist management */
140 int i_playing; /* playlist selected item */
141 unsigned i_playlist_usage;
143 /* Send an event to show a dialog */
144 void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
145 intf_dialog_args_t *p_arg );
148 wxMenu *p_popup_menu;
151 int i_first_hotkey_event;
155 VideoWindow *p_video_window;
156 wxBoxSizer *p_video_sizer;
157 vlc_bool_t b_video_autosize;
160 aout_instance_t *p_aout;
163 /*****************************************************************************
165 *****************************************************************************/
166 wxArrayString SeparateEntries( wxString );
167 wxWindow *CreateVideoWindow( intf_thread_t *p_intf, wxWindow *p_parent );
168 void UpdateVideoWindow( intf_thread_t *p_intf, wxWindow *p_window );
169 wxFrame *BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent );
170 wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
177 class SubsFileDialog;
183 class ItemInfoDialog;
185 class ExportPlaylist;
187 /*****************************************************************************
188 * Classes declarations.
189 *****************************************************************************/
191 class Timer: public wxTimer
195 Timer( intf_thread_t *p_intf, Interface *p_main_interface );
198 virtual void Notify();
201 //use wxWindow::IsShown instead
202 //vlc_bool_t b_slider_shown;
203 //vlc_bool_t b_disc_shown;
204 intf_thread_t *p_intf;
205 Interface *p_main_interface;
207 int i_old_playing_status;
213 class ExtraPanel: public wxPanel
217 ExtraPanel( intf_thread_t *p_intf, wxWindow *p_parent );
218 virtual ~ExtraPanel();
220 wxStaticBox *adjust_box;
221 wxButton *restoredefaults_button;
222 wxSlider *brightness_slider;
223 wxSlider *contrast_slider;
224 wxSlider *saturation_slider;
225 wxSlider *hue_slider;
226 wxSlider *gamma_slider;
228 wxStaticBox *other_box;
229 wxComboBox *ratio_combo;
237 wxPanel *VideoPanel( wxWindow * );
238 wxPanel *EqzPanel( wxWindow * );
239 wxPanel *AudioPanel( wxWindow * );
241 wxNotebook *notebook;
243 wxCheckBox *eq_chkbox;
245 wxCheckBox *eq_2p_chkbox;
247 wxButton *eq_restoredefaults_button;
249 wxSlider *smooth_slider;
250 wxStaticText *smooth_text;
252 wxSlider *preamp_slider;
253 wxStaticText * preamp_text;
258 wxSlider *band_sliders[10];
259 wxStaticText *band_texts[10];
265 /* Event handlers (these functions should _not_ be virtual) */
267 void OnEnableAdjust( wxCommandEvent& );
268 void OnEnableEqualizer( wxCommandEvent& );
269 void OnRestoreDefaults( wxCommandEvent& );
270 void OnChangeEqualizer( wxScrollEvent& );
271 void OnAdjustUpdate( wxScrollEvent& );
272 void OnRatio( wxCommandEvent& );
273 void OnFiltersInfo( wxCommandEvent& );
274 void OnSelectFilter( wxCommandEvent& );
276 void OnEqSmooth( wxScrollEvent& );
277 void OnPreamp( wxScrollEvent& );
278 void OnEq2Pass( wxCommandEvent& );
279 void OnEqRestore( wxCommandEvent& );
281 void OnHeadphone( wxCommandEvent& );
282 void OnNormvol( wxCommandEvent& );
283 void OnNormvolSlider( wxScrollEvent& );
285 void OnIdle( wxIdleEvent& );
287 DECLARE_EVENT_TABLE();
289 intf_thread_t *p_intf;
290 vlc_bool_t b_my_update;
294 /* Extended Window */
295 class ExtraWindow: public wxFrame
299 ExtraWindow( intf_thread_t *p_intf, wxWindow *p_parent, wxPanel *panel );
300 virtual ~ExtraWindow();
306 DECLARE_EVENT_TABLE();
308 intf_thread_t *p_intf;
312 /* Systray integration */
313 #ifdef wxHAS_TASK_BAR_ICON
314 class Systray: public wxTaskBarIcon
317 Systray( Interface* p_main_interface, intf_thread_t *p_intf );
318 virtual ~Systray() {};
319 wxMenu* CreatePopupMenu();
320 void UpdateTooltip( const wxChar* tooltip );
323 void OnMenuIconize( wxCommandEvent& event );
324 void OnLeftClick( wxTaskBarIconEvent& event );
325 void OnPlayStream ( wxCommandEvent& event );
326 void OnStopStream ( wxCommandEvent& event );
327 void OnPrevStream ( wxCommandEvent& event );
328 void OnNextStream ( wxCommandEvent& event );
329 void OnExit( wxCommandEvent& event );
330 Interface* p_main_interface;
331 intf_thread_t *p_intf;
332 DECLARE_EVENT_TABLE()
337 class Interface: public wxFrame
341 Interface( intf_thread_t *p_intf, long style = wxDEFAULT_FRAME_STYLE );
342 virtual ~Interface();
344 void TogglePlayButton( int i_playing_status );
351 wxBoxSizer *frame_sizer;
352 wxStatusBar *statusbar;
354 void HideSlider(bool layout = true);
355 void ShowSlider(bool show = true, bool layout = true);
358 wxWindow *slider_frame;
359 wxBoxSizer *slider_sizer;
360 wxPanel *extra_frame;
362 void HideDiscFrame(bool layout = true);
363 void ShowDiscFrame(bool show = true, bool layout = true);
366 wxBoxSizer *disc_sizer;
367 wxBitmapButton *disc_menu_button;
368 wxBitmapButton *disc_prev_button;
369 wxBitmapButton *disc_next_button;
371 wxFrame *extra_window;
378 #ifdef wxHAS_TASK_BAR_ICON
382 wxTimer m_controls_timer;
383 wxTimer m_slider_timer;
387 void CreateOurMenuBar();
388 void CreateOurToolBar();
389 void CreateOurExtendedPanel();
390 void CreateOurSlider();
391 void Open( int i_access_method );
393 /* Event handlers (these functions should _not_ be virtual) */
394 void OnControlsTimer(wxTimerEvent& WXUNUSED(event));
395 void OnSliderTimer(wxTimerEvent& WXUNUSED(event));
397 void OnExit( wxCommandEvent& event );
398 void OnAbout( wxCommandEvent& event );
400 void OnOpenFileSimple( wxCommandEvent& event );
401 void OnOpenDir( wxCommandEvent& event );
402 void OnOpenFile( wxCommandEvent& event );
403 void OnOpenDisc( wxCommandEvent& event );
404 void OnOpenNet( wxCommandEvent& event );
405 void OnOpenSat( wxCommandEvent& event );
407 void OnExtended( wxCommandEvent& event );
408 //void OnUndock( wxCommandEvent& event );
410 void OnBookmarks( wxCommandEvent& event );
411 void OnShowDialog( wxCommandEvent& event );
412 void OnPlayStream( wxCommandEvent& event );
413 void OnStopStream( wxCommandEvent& event );
414 void OnSliderUpdate( wxScrollEvent& event );
415 void OnPrevStream( wxCommandEvent& event );
416 void OnNextStream( wxCommandEvent& event );
417 void OnSlowStream( wxCommandEvent& event );
418 void OnFastStream( wxCommandEvent& event );
420 void OnDiscMenu( wxCommandEvent& event );
421 void OnDiscPrev( wxCommandEvent& event );
422 void OnDiscNext( wxCommandEvent& event );
424 void OnMenuOpen( wxMenuEvent& event );
426 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
427 void OnContextMenu2(wxContextMenuEvent& event);
429 void OnContextMenu(wxMouseEvent& event);
431 void OnControlEvent( wxCommandEvent& event );
433 DECLARE_EVENT_TABLE();
436 intf_thread_t *p_intf;
438 wxWindow *video_window;
440 int i_old_playing_status;
442 /* For auto-generated menus */
443 wxMenu *p_settings_menu;
444 wxMenu *p_audio_menu;
445 wxMenu *p_video_menu;
446 wxMenu *p_navig_menu;
450 WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel);
451 class OpenDialog: public wxDialog
455 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
456 int i_access_method, int i_arg = 0 );
458 /* Extended Contructor */
459 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
460 int i_access_method, int i_arg = 0 , int _i_method = 0 );
461 virtual ~OpenDialog();
464 int Show( int i_access_method, int i_arg = 0 );
467 void UpdateMRL( int i_access_method );
472 wxPanel *FilePanel( wxWindow* parent );
473 wxPanel *DiscPanel( wxWindow* parent );
474 wxPanel *NetPanel( wxWindow* parent );
476 ArrayOfAutoBuiltPanel input_tab_array;
478 /* Event handlers (these functions should _not_ be virtual) */
479 void OnOk( wxCommandEvent& event );
480 void OnCancel( wxCommandEvent& event );
481 void OnClose( wxCloseEvent& event );
483 void OnPageChange( wxNotebookEvent& event );
484 void OnMRLChange( wxCommandEvent& event );
486 /* Event handlers for the file page */
487 void OnFilePanelChange( wxCommandEvent& event );
488 void OnFileBrowse( wxCommandEvent& event );
490 /* Event handlers for the disc page */
491 void OnDiscPanelChangeSpin( wxSpinEvent& event );
492 void OnDiscPanelChange( wxCommandEvent& event );
493 void OnDiscTypeChange( wxCommandEvent& event );
495 void OnDiscProbe( wxCommandEvent& event );
497 void OnDiscDeviceChange( wxCommandEvent& event );
499 /* Event handlers for the net page */
500 void OnNetPanelChangeSpin( wxSpinEvent& event );
501 void OnNetPanelChange( wxCommandEvent& event );
502 void OnNetTypeChange( wxCommandEvent& event );
504 /* Event handlers for the stream output */
505 void OnSubsFileEnable( wxCommandEvent& event );
506 void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
508 /* Event handlers for the stream output */
509 void OnSoutEnable( wxCommandEvent& event );
510 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
512 /* Event handlers for the caching option */
513 void OnCachingEnable( wxCommandEvent& event );
514 void OnCachingChange( wxCommandEvent& event );
515 void OnCachingChangeSpin( wxSpinEvent& event );
517 DECLARE_EVENT_TABLE();
519 intf_thread_t *p_intf;
521 int i_current_access_method;
522 int i_disc_type_selection;
524 int i_method; /* Normal or for the stream dialog ? */
527 wxComboBox *mrl_combo;
528 wxNotebook *notebook;
530 /* Controls for the file panel */
531 wxComboBox *file_combo;
532 wxFileDialog *file_dialog;
534 /* Controls for the disc panel */
535 wxRadioBox *disc_type;
536 wxCheckBox *disc_probe;
537 wxTextCtrl *disc_device;
538 wxSpinCtrl *disc_title; int i_disc_title;
539 wxSpinCtrl *disc_chapter; int i_disc_chapter;
540 wxSpinCtrl *disc_sub; int i_disc_sub;
541 wxSpinCtrl *disc_audio; int i_disc_audio;
543 /* The media equivalent name for a DVD names. For example,
544 * "Title", is "Track" for a CD-DA */
545 wxStaticText *disc_title_label;
546 wxStaticText *disc_chapter_label;
547 wxStaticText *disc_sub_label;
548 wxStaticText *disc_audio_label;
550 /* Indicates if the disc device control was modified */
551 bool b_disc_device_changed;
553 /* Controls for the net panel */
554 wxRadioBox *net_type;
556 wxPanel *net_subpanels[4];
557 wxRadioButton *net_radios[4];
558 wxSpinCtrl *net_ports[4];
560 wxTextCtrl *net_addrs[4];
561 wxCheckBox *net_timeshift;
562 wxCheckBox *net_ipv6;
564 /* Controls for the subtitles file */
565 wxButton *subsfile_button;
566 wxCheckBox *subsfile_checkbox;
567 SubsFileDialog *subsfile_dialog;
568 wxArrayString subsfile_mrl;
570 /* Controls for the stream output */
571 wxButton *sout_button;
572 wxCheckBox *sout_checkbox;
573 SoutDialog *sout_dialog;
574 wxArrayString sout_mrl;
576 /* Controls for the caching options */
577 wxCheckBox *caching_checkbox;
578 wxSpinCtrl *caching_value;
588 /* Auto-built panels */
591 #define MAX_ACCESS CAPTURE_ACCESS
593 /* Stream output Dialog */
607 TS_ENCAPSULATION = 0,
627 class SoutDialog: public wxDialog
631 SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
632 virtual ~SoutDialog();
634 wxArrayString GetOptions();
638 wxPanel *AccessPanel( wxWindow* parent );
639 wxPanel *MiscPanel( wxWindow* parent );
640 wxPanel *EncapsulationPanel( wxWindow* parent );
641 wxPanel *TranscodingPanel( wxWindow* parent );
644 /* Event handlers (these functions should _not_ be virtual) */
645 void OnOk( wxCommandEvent& event );
646 void OnCancel( wxCommandEvent& event );
647 void OnMRLChange( wxCommandEvent& event );
648 void OnAccessTypeChange( wxCommandEvent& event );
650 /* Event handlers for the file access output */
651 void OnFileChange( wxCommandEvent& event );
652 void OnFileBrowse( wxCommandEvent& event );
653 void OnFileDump( wxCommandEvent& event );
655 /* Event handlers for the net access output */
656 void OnNetChange( wxCommandEvent& event );
658 /* Event specific to the announce address */
659 void OnAnnounceGroupChange( wxCommandEvent& event );
660 void OnAnnounceAddrChange( wxCommandEvent& event );
662 /* Event handlers for the encapsulation panel */
663 void OnEncapsulationChange( wxCommandEvent& event );
665 /* Event handlers for the transcoding panel */
666 void OnTranscodingEnable( wxCommandEvent& event );
667 void OnTranscodingChange( wxCommandEvent& event );
669 /* Event handlers for the misc panel */
670 void OnSAPMiscChange( wxCommandEvent& event );
672 DECLARE_EVENT_TABLE();
674 intf_thread_t *p_intf;
677 wxComboBox *mrl_combo;
679 /* Controls for the access outputs */
680 wxPanel *access_panel;
681 wxPanel *access_subpanels[ACCESS_OUT_NUM];
682 wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
686 wxComboBox *file_combo;
687 wxCheckBox *dump_checkbox;
688 wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
689 wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
691 /* Controls for the SAP announces and TTL setting */
693 wxPanel *misc_subpanels[MISC_SOUT_NUM];
694 wxCheckBox *sap_checkbox;
695 wxTextCtrl *announce_group;
696 wxTextCtrl *announce_addr;
697 wxSpinCtrl *ttl_spin;
699 /* Controls for the encapsulation */
700 wxPanel *encapsulation_panel;
701 wxRadioButton *encapsulation_radios[ENCAPS_NUM];
702 int i_encapsulation_type;
704 /* Controls for transcoding */
705 wxPanel *transcoding_panel;
706 wxCheckBox *video_transc_checkbox;
707 wxComboBox *video_codec_combo;
708 wxComboBox *audio_codec_combo;
709 wxCheckBox *audio_transc_checkbox;
710 wxComboBox *video_bitrate_combo;
711 wxComboBox *audio_bitrate_combo;
712 wxComboBox *audio_channels_combo;
713 wxComboBox *video_scale_combo;
714 wxComboBox *subtitles_codec_combo;
715 wxCheckBox *subtitles_transc_checkbox;
716 wxCheckBox *subtitles_overlay_checkbox;
719 wxCheckBox *sout_all_checkbox;
722 /* Subtitles File Dialog */
723 class SubsFileDialog: public wxDialog
727 SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
728 virtual ~SubsFileDialog();
730 wxComboBox *file_combo;
731 wxComboBox *encoding_combo;
732 wxComboBox *size_combo;
733 wxComboBox *align_combo;
734 wxSpinCtrl *fps_spinctrl;
735 wxSpinCtrl *delay_spinctrl;
738 /* Event handlers (these functions should _not_ be virtual) */
739 void OnOk( wxCommandEvent& event );
740 void OnCancel( wxCommandEvent& event );
741 void OnFileBrowse( wxCommandEvent& event );
743 DECLARE_EVENT_TABLE();
745 intf_thread_t *p_intf;
750 class StreamDialog: public wxFrame
754 StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent );
755 virtual ~StreamDialog();
758 void OnClose( wxCommandEvent& event );
759 void OnOpen( wxCommandEvent& event );
760 void OnSout( wxCommandEvent& event );
761 void OnStart( wxCommandEvent& event );
763 DECLARE_EVENT_TABLE();
765 intf_thread_t *p_intf;
767 wxStaticText *step2_label;
768 wxStaticText *step3_label;
769 wxButton *sout_button;
770 wxButton *start_button;
772 wxArrayString sout_mrl;
773 OpenDialog *p_open_dialog;
774 SoutDialog *p_sout_dialog;
778 class WizardDialog : public wxWizard
782 WizardDialog( intf_thread_t *, wxWindow *p_parent, char *, int, int );
783 virtual ~WizardDialog();
784 void SetTranscode( char const *vcodec, int vb, char const *acodec, int ab);
785 void SetMrl( const char *mrl );
786 void SetTTL( int i_ttl );
787 void SetPartial( int, int );
788 void SetStream( char const *method, char const *address );
789 void SetTranscodeOut( char const *address );
790 void SetAction( int i_action );
792 void SetSAP( bool b_enabled, const char *psz_name );
793 void SetMux( char const *mux );
800 int i_from, i_to, i_ttl;
801 char *vcodec , *acodec , *address , *mrl , *mux ;
804 DECLARE_EVENT_TABLE();
806 intf_thread_t *p_intf;
810 /* Preferences Dialog */
811 class PrefsDialog: public wxFrame
815 PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
816 virtual ~PrefsDialog();
819 wxPanel *PrefsPanel( wxWindow* parent );
821 /* Event handlers (these functions should _not_ be virtual) */
822 void OnOk( wxCommandEvent& event );
823 void OnCancel( wxCommandEvent& event );
824 void OnSave( wxCommandEvent& event );
825 void OnResetAll( wxCommandEvent& event );
826 void OnAdvanced( wxCommandEvent& event );
827 void OnClose( wxCloseEvent& event );
829 DECLARE_EVENT_TABLE();
831 intf_thread_t *p_intf;
833 PrefsTreeCtrl *prefs_tree;
837 class Messages: public wxFrame
841 Messages( intf_thread_t *p_intf, wxWindow *p_parent );
843 bool Show( bool show = TRUE );
847 /* Event handlers (these functions should _not_ be virtual) */
848 void OnButtonClose( wxCommandEvent& event );
849 void OnClose( wxCloseEvent& WXUNUSED(event) );
850 void OnClear( wxCommandEvent& event );
851 void OnSaveLog( wxCommandEvent& event );
853 DECLARE_EVENT_TABLE();
855 intf_thread_t *p_intf;
856 wxTextCtrl *textctrl;
857 wxTextAttr *info_attr;
858 wxTextAttr *err_attr;
859 wxTextAttr *warn_attr;
860 wxTextAttr *dbg_attr;
862 wxFileDialog *save_log_dialog;
864 vlc_bool_t b_verbose;
868 class Playlist: public wxFrame
872 Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
875 void UpdatePlaylist();
876 void ShowPlaylist( bool show );
877 void UpdateItem( int );
878 void AppendItem( wxCommandEvent& );
881 int i_items_to_append;
884 void RemoveItem( int );
885 void DeleteTreeItem( wxTreeItemId );
886 void DeleteItem( int item );
887 void DeleteNode( playlist_item_t *node );
889 void RecursiveDeleteSelection( wxTreeItemId );
891 /* Event handlers (these functions should _not_ be virtual) */
894 void OnAddFile( wxCommandEvent& event );
895 void OnAddDir( wxCommandEvent& event );
896 void OnAddMRL( wxCommandEvent& event );
897 void OnMenuClose( wxCommandEvent& event );
898 void OnClose( wxCloseEvent& WXUNUSED(event) );
900 void OnDeleteSelection( wxCommandEvent& event );
902 void OnOpen( wxCommandEvent& event );
903 void OnSave( wxCommandEvent& event );
906 void OnSearch( wxCommandEvent& event );
907 /*void OnSearchTextChange( wxCommandEvent& event );*/
908 wxTextCtrl *search_text;
909 wxButton *search_button;
910 wxTreeItemId search_current;
912 void OnEnDis( wxCommandEvent& event );
916 void OnSort( wxCommandEvent& event );
919 int i_duration_sorted;
922 void OnMenuEvent( wxCommandEvent& event );
923 void OnMenuOpen( wxMenuEvent& event );
929 void OnUp( wxCommandEvent& event);
930 void OnDown( wxCommandEvent& event);
932 void OnRandom( wxCommandEvent& event );
933 void OnRepeat( wxCommandEvent& event );
934 void OnLoop ( wxCommandEvent& event );
936 void OnActivateItem( wxTreeEvent& event );
937 void OnKeyDown( wxTreeEvent& event );
938 void OnNewGroup( wxCommandEvent& event );
943 wxTreeItemId i_wx_popup_item;
946 void OnPopup( wxContextMenuEvent& event );
947 void OnPopupPlay( wxCommandEvent& event );
948 void OnPopupPreparse( wxCommandEvent& event );
949 void OnPopupSort( wxCommandEvent& event );
950 void OnPopupDel( wxCommandEvent& event );
951 void OnPopupEna( wxCommandEvent& event );
952 void OnPopupInfo( wxCommandEvent& event );
953 void Rebuild( vlc_bool_t );
958 void UpdateNode( playlist_item_t*, wxTreeItemId );
959 void UpdateNodeChildren( playlist_item_t*, wxTreeItemId );
960 void CreateNode( playlist_item_t*, wxTreeItemId );
961 void UpdateTreeItem( wxTreeItemId );
963 /* Search (internal) */
964 int CountItems( wxTreeItemId);
965 wxTreeItemId FindItem( wxTreeItemId, int );
966 wxTreeItemId FindItemByName( wxTreeItemId, wxString,
967 wxTreeItemId, vlc_bool_t *);
969 wxTreeItemId saved_tree_item;
972 playlist_t *p_playlist;
976 void OnPlaylistEvent( wxCommandEvent& event );
978 DECLARE_EVENT_TABLE();
982 wxStatusBar *statusbar;
983 ItemInfoDialog *iteminfo_dialog;
985 int i_update_counter;
987 intf_thread_t *p_intf;
988 wxTreeCtrl *treectrl;
990 vlc_bool_t b_changed_view;
996 /* ItemInfo Dialog */
997 class ItemInfoDialog: public wxDialog
1001 ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
1002 wxWindow *p_parent );
1003 virtual ~ItemInfoDialog();
1005 wxArrayString GetOptions();
1008 wxPanel *InfoPanel( wxWindow* parent );
1009 wxPanel *GroupPanel( wxWindow* parent );
1011 /* Event handlers (these functions should _not_ be virtual) */
1012 void OnOk( wxCommandEvent& event );
1013 void OnCancel( wxCommandEvent& event );
1017 DECLARE_EVENT_TABLE();
1019 intf_thread_t *p_intf;
1020 playlist_item_t *p_item;
1023 /* Controls for the iteminfo dialog box */
1024 wxPanel *info_subpanel;
1025 wxPanel *info_panel;
1027 wxPanel *group_subpanel;
1028 wxPanel *group_panel;
1030 wxTextCtrl *uri_text;
1031 wxTextCtrl *name_text;
1033 wxTreeCtrl *info_tree;
1034 wxTreeItemId info_root;
1040 class FileInfo: public wxFrame
1044 FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
1045 virtual ~FileInfo();
1046 void UpdateFileInfo();
1048 vlc_bool_t b_need_update;
1051 void OnButtonClose( wxCommandEvent& event );
1052 void OnClose( wxCloseEvent& WXUNUSED(event) );
1054 DECLARE_EVENT_TABLE();
1056 intf_thread_t *p_intf;
1057 wxTreeCtrl *fileinfo_tree;
1058 wxTreeItemId fileinfo_root;
1059 wxString fileinfo_root_label;
1064 class UpdateVLC: public wxFrame
1068 UpdateVLC( intf_thread_t *p_intf, wxWindow *p_parent );
1069 virtual ~UpdateVLC();
1072 void OnButtonClose( wxCommandEvent& event );
1073 void OnClose( wxCloseEvent& WXUNUSED(event) );
1075 void OnCheckForUpdate( wxCommandEvent& event );
1076 void OnMirrorChoice( wxCommandEvent& event );
1077 void UpdateUpdatesTree();
1078 void UpdateMirrorsChoice();
1079 void OnUpdatesTreeActivate( wxTreeEvent& event );
1080 void DownloadFile( wxString url, wxString dst );
1082 DECLARE_EVENT_TABLE();
1084 intf_thread_t *p_intf;
1085 wxTreeCtrl *updates_tree;
1086 wxTreeItemId updates_root;
1088 wxChoice *mirrors_choice;
1090 wxString release_type; /* could be "stable", "test", "nightly" ... */
1092 struct update_file_t
1098 wxString description;
1101 struct update_version_t
1108 std::list<update_file_t> m_files;
1111 std::list<update_version_t> m_versions;
1113 struct update_mirror_t
1121 std::list<update_mirror_t> m_mirrors;
1124 #if wxUSE_DRAG_AND_DROP
1125 /* Drag and Drop class */
1126 class DragAndDrop: public wxFileDropTarget
1129 DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE );
1131 virtual bool OnDropFiles( wxCoord x, wxCoord y,
1132 const wxArrayString& filenames );
1135 intf_thread_t *p_intf;
1136 vlc_bool_t b_enqueue;
1139 } // end of wxvlc namespace
1142 class WindowSettings
1145 WindowSettings( intf_thread_t *_p_intf );
1146 virtual ~WindowSettings();
1160 void SetSettings( int id, bool _b_shown,
1161 wxPoint p = wxDefaultPosition, wxSize s = wxDefaultSize );
1162 bool GetSettings( int id, bool& _b_shown, wxPoint& p, wxSize& s );
1164 void SetScreen( int i_screen_w, int i_screen_h );
1167 intf_thread_t *p_intf;
1171 bool b_valid[ID_MAX];
1172 bool b_shown[ID_MAX];
1173 wxPoint position[ID_MAX];
1174 wxSize size[ID_MAX];
1178 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
1179 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1180 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1181 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1182 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1186 class MenuEvtHandler : public wxEvtHandler
1189 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
1190 virtual ~MenuEvtHandler();
1192 void OnMenuEvent( wxCommandEvent& event );
1193 void OnShowDialog( wxCommandEvent& event );
1197 DECLARE_EVENT_TABLE()
1199 intf_thread_t *p_intf;
1200 Interface *p_main_interface;
1203 } // end of wxvlc namespace
1207 * wxWindows keeps dead locking because the timer tries to lock the playlist
1208 * when it's already locked somewhere else in the very wxWindows interface
1209 * module. Unless someone implements a "vlc_mutex_trylock", we need that.
1211 inline void LockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl )
1213 if( p_sys->i_playlist_usage++ == 0)
1214 vlc_mutex_lock( &p_pl->object_lock );
1217 inline void UnlockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl )
1219 if( --p_sys->i_playlist_usage == 0)
1220 vlc_mutex_unlock( &p_pl->object_lock );
1223 using namespace wxvlc;