1 /*****************************************************************************
2 * wxwindows.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 */
29 /* Let vlc take care of the i18n stuff */
30 #define WXINTL_NO_GETTEXT_MACRO
34 #include <wx/wxprec.h>
37 #include <wx/listctrl.h>
38 #include <wx/textctrl.h>
39 #include <wx/notebook.h>
40 #include <wx/spinctrl.h>
42 #include <wx/treectrl.h>
45 #include <wx/checkbox.h>
46 #include <wx/wizard.h>
47 #include <wx/taskbar.h>
50 #if (!wxCHECK_VERSION(2,5,0))
51 typedef long wxTreeItemIdValue;
54 DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
55 DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
57 #define SLIDER_MAX_POS 10000
59 /* wxU is used to convert ansi/utf8 strings to unicode strings (wchar_t) */
60 #if defined( ENABLE_NLS ) && defined( ENABLE_UTF8 )
62 # define wxU(utf8) wxString(utf8, wxConvUTF8)
64 # define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
68 #else // ENABLE_NLS && ENABLE_UTF8
70 # define wxU(ansi) wxString(ansi, wxConvLocal)
72 # define wxU(ansi) (ansi)
78 /* wxL2U (locale to unicode) is used to convert ansi strings to unicode
79 * strings (wchar_t) */
80 #define wxL2U(ansi) wxU(ansi)
97 class DialogsProvider;
101 class WindowSettings;
103 /*****************************************************************************
104 * intf_sys_t: description and status of wxwindows interface
105 *****************************************************************************/
108 /* the wx parent window */
109 wxWindow *p_wxwindow;
112 /* window settings */
113 WindowSettings *p_window_settings;
115 /* special actions */
116 vlc_bool_t b_playing;
117 vlc_bool_t b_intf_show; /* interface to be shown */
119 /* The input thread */
120 input_thread_t * p_input;
123 int i_slider_pos; /* slider position */
124 int i_slider_oldpos; /* previous position */
125 vlc_bool_t b_slider_free; /* slider status */
127 /* The messages window */
128 msg_subscription_t* p_sub; /* message bank subscription */
130 /* Playlist management */
131 int i_playing; /* playlist selected item */
132 unsigned i_playlist_usage;
134 /* Send an event to show a dialog */
135 void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
136 intf_dialog_args_t *p_arg );
139 wxMenu *p_popup_menu;
142 int i_first_hotkey_event;
146 VideoWindow *p_video_window;
147 wxBoxSizer *p_video_sizer;
148 vlc_bool_t b_video_autosize;
151 aout_instance_t *p_aout;
154 /*****************************************************************************
156 *****************************************************************************/
157 wxArrayString SeparateEntries( wxString );
158 wxWindow *CreateVideoWindow( intf_thread_t *p_intf, wxWindow *p_parent );
159 void UpdateVideoWindow( intf_thread_t *p_intf, wxWindow *p_window );
160 wxWindow *BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent );
161 wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
168 class SubsFileDialog;
174 class ItemInfoDialog;
176 class ExportPlaylist;
178 /*****************************************************************************
179 * Classes declarations.
180 *****************************************************************************/
182 class Timer: public wxTimer
186 Timer( intf_thread_t *p_intf, Interface *p_main_interface );
189 virtual void Notify();
192 //use wxWindow::IsShown instead
193 //vlc_bool_t b_slider_shown;
194 //vlc_bool_t b_disc_shown;
195 intf_thread_t *p_intf;
196 Interface *p_main_interface;
198 int i_old_playing_status;
204 class ExtraPanel: public wxPanel
208 ExtraPanel( intf_thread_t *p_intf, wxWindow *p_parent );
209 virtual ~ExtraPanel();
211 wxStaticBox *adjust_box;
212 wxButton *restoredefaults_button;
213 wxSlider *brightness_slider;
214 wxSlider *contrast_slider;
215 wxSlider *saturation_slider;
216 wxSlider *hue_slider;
217 wxSlider *gamma_slider;
219 wxStaticBox *other_box;
220 wxComboBox *ratio_combo;
228 wxPanel *VideoPanel( wxWindow * );
229 wxPanel *EqzPanel( wxWindow * );
230 wxPanel *AudioPanel( wxWindow * );
232 wxNotebook *notebook;
234 wxCheckBox *eq_chkbox;
236 wxCheckBox *eq_2p_chkbox;
238 wxButton *eq_restoredefaults_button;
240 wxSlider *smooth_slider;
241 wxStaticText *smooth_text;
243 wxSlider *preamp_slider;
244 wxStaticText * preamp_text;
249 wxSlider *band_sliders[10];
250 wxStaticText *band_texts[10];
256 /* Event handlers (these functions should _not_ be virtual) */
258 void OnEnableAdjust( wxCommandEvent& );
259 void OnEnableEqualizer( wxCommandEvent& );
260 void OnRestoreDefaults( wxCommandEvent& );
261 void OnChangeEqualizer( wxScrollEvent& );
262 void OnAdjustUpdate( wxScrollEvent& );
263 void OnRatio( wxCommandEvent& );
264 void OnFiltersInfo( wxCommandEvent& );
265 void OnSelectFilter( wxCommandEvent& );
267 void OnEqSmooth( wxScrollEvent& );
268 void OnPreamp( wxScrollEvent& );
269 void OnEq2Pass( wxCommandEvent& );
270 void OnEqRestore( wxCommandEvent& );
272 void OnHeadphone( wxCommandEvent& );
273 void OnNormvol( wxCommandEvent& );
274 void OnNormvolSlider( wxScrollEvent& );
276 void OnIdle( wxIdleEvent& );
278 DECLARE_EVENT_TABLE();
280 intf_thread_t *p_intf;
281 vlc_bool_t b_my_update;
285 /* Extended Window */
286 class ExtraWindow: public wxFrame
290 ExtraWindow( intf_thread_t *p_intf, wxWindow *p_parent, wxPanel *panel );
291 virtual ~ExtraWindow();
297 DECLARE_EVENT_TABLE();
299 intf_thread_t *p_intf;
303 /* Systray integration */
304 #ifdef wxHAS_TASK_BAR_ICON
305 class Systray: public wxTaskBarIcon
308 Systray( Interface* p_main_interface, intf_thread_t *p_intf );
309 virtual ~Systray() {};
310 wxMenu* CreatePopupMenu();
311 void UpdateTooltip( const wxChar* tooltip );
314 void OnMenuIconize( wxCommandEvent& event );
315 void OnLeftClick( wxTaskBarIconEvent& event );
316 void OnPlayStream ( wxCommandEvent& event );
317 void OnStopStream ( wxCommandEvent& event );
318 void OnPrevStream ( wxCommandEvent& event );
319 void OnNextStream ( wxCommandEvent& event );
320 void OnExit( wxCommandEvent& event );
321 Interface* p_main_interface;
322 intf_thread_t *p_intf;
323 DECLARE_EVENT_TABLE()
328 class Interface: public wxFrame
332 Interface( intf_thread_t *p_intf, long style = wxDEFAULT_FRAME_STYLE );
333 virtual ~Interface();
335 void TogglePlayButton( int i_playing_status );
342 wxBoxSizer *frame_sizer;
343 wxStatusBar *statusbar;
345 void HideSlider(bool layout = true);
346 void ShowSlider(bool show = true, bool layout = true);
349 wxWindow *slider_frame;
350 wxBoxSizer *slider_sizer;
351 wxPanel *extra_frame;
353 void HideDiscFrame(bool layout = true);
354 void ShowDiscFrame(bool show = true, bool layout = true);
357 wxBoxSizer *disc_sizer;
358 wxBitmapButton *disc_menu_button;
359 wxBitmapButton *disc_prev_button;
360 wxBitmapButton *disc_next_button;
362 wxFrame *extra_window;
369 #ifdef wxHAS_TASK_BAR_ICON
373 wxTimer m_controls_timer;
374 wxTimer m_slider_timer;
378 void CreateOurMenuBar();
379 void CreateOurToolBar();
380 void CreateOurExtendedPanel();
381 void CreateOurSlider();
382 void Open( int i_access_method );
384 /* Event handlers (these functions should _not_ be virtual) */
385 void OnControlsTimer(wxTimerEvent& WXUNUSED(event));
386 void OnSliderTimer(wxTimerEvent& WXUNUSED(event));
388 void OnExit( wxCommandEvent& event );
389 void OnAbout( wxCommandEvent& event );
391 void OnOpenFileSimple( wxCommandEvent& event );
392 void OnOpenDir( wxCommandEvent& event );
393 void OnOpenFile( wxCommandEvent& event );
394 void OnOpenDisc( wxCommandEvent& event );
395 void OnOpenNet( wxCommandEvent& event );
396 void OnOpenSat( wxCommandEvent& event );
398 void OnExtended( wxCommandEvent& event );
399 //void OnUndock( wxCommandEvent& event );
401 void OnBookmarks( wxCommandEvent& event );
402 void OnShowDialog( wxCommandEvent& event );
403 void OnPlayStream( wxCommandEvent& event );
404 void OnStopStream( wxCommandEvent& event );
405 void OnSliderUpdate( wxScrollEvent& event );
406 void OnPrevStream( wxCommandEvent& event );
407 void OnNextStream( wxCommandEvent& event );
408 void OnSlowStream( wxCommandEvent& event );
409 void OnFastStream( wxCommandEvent& event );
411 void OnDiscMenu( wxCommandEvent& event );
412 void OnDiscPrev( wxCommandEvent& event );
413 void OnDiscNext( wxCommandEvent& event );
415 void OnMenuOpen( wxMenuEvent& event );
417 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
418 void OnContextMenu2(wxContextMenuEvent& event);
420 void OnContextMenu(wxMouseEvent& event);
422 void OnControlEvent( wxCommandEvent& event );
424 DECLARE_EVENT_TABLE();
427 intf_thread_t *p_intf;
429 wxWindow *video_window;
431 int i_old_playing_status;
433 /* For auto-generated menus */
434 wxMenu *p_settings_menu;
435 wxMenu *p_audio_menu;
436 wxMenu *p_video_menu;
437 wxMenu *p_navig_menu;
441 WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel);
442 class OpenDialog: public wxDialog
446 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
447 int i_access_method, int i_arg = 0 );
449 /* Extended Contructor */
450 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
451 int i_access_method, int i_arg = 0 , int _i_method = 0 );
452 virtual ~OpenDialog();
455 int Show( int i_access_method, int i_arg = 0 );
458 void UpdateMRL( int i_access_method );
463 wxPanel *FilePanel( wxWindow* parent );
464 wxPanel *DiscPanel( wxWindow* parent );
465 wxPanel *NetPanel( wxWindow* parent );
467 ArrayOfAutoBuiltPanel input_tab_array;
469 /* Event handlers (these functions should _not_ be virtual) */
470 void OnOk( wxCommandEvent& event );
471 void OnCancel( wxCommandEvent& event );
472 void OnClose( wxCloseEvent& event );
474 void OnPageChange( wxNotebookEvent& event );
475 void OnMRLChange( wxCommandEvent& event );
477 /* Event handlers for the file page */
478 void OnFilePanelChange( wxCommandEvent& event );
479 void OnFileBrowse( wxCommandEvent& event );
481 /* Event handlers for the disc page */
482 void OnDiscPanelChangeSpin( wxSpinEvent& event );
483 void OnDiscPanelChange( wxCommandEvent& event );
484 void OnDiscTypeChange( wxCommandEvent& event );
486 void OnDiscProbe( wxCommandEvent& event );
488 void OnDiscDeviceChange( wxCommandEvent& event );
490 /* Event handlers for the net page */
491 void OnNetPanelChangeSpin( wxSpinEvent& event );
492 void OnNetPanelChange( wxCommandEvent& event );
493 void OnNetTypeChange( wxCommandEvent& event );
495 /* Event handlers for the stream output */
496 void OnSubsFileEnable( wxCommandEvent& event );
497 void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
499 /* Event handlers for the stream output */
500 void OnSoutEnable( wxCommandEvent& event );
501 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
503 /* Event handlers for the caching option */
504 void OnCachingEnable( wxCommandEvent& event );
505 void OnCachingChange( wxCommandEvent& event );
506 void OnCachingChangeSpin( wxSpinEvent& event );
508 DECLARE_EVENT_TABLE();
510 intf_thread_t *p_intf;
512 int i_current_access_method;
513 int i_disc_type_selection;
515 int i_method; /* Normal or for the stream dialog ? */
518 wxComboBox *mrl_combo;
519 wxNotebook *notebook;
521 /* Controls for the file panel */
522 wxComboBox *file_combo;
523 wxFileDialog *file_dialog;
525 /* Controls for the disc panel */
526 wxRadioBox *disc_type;
527 wxCheckBox *disc_probe;
528 wxTextCtrl *disc_device;
529 wxSpinCtrl *disc_title; int i_disc_title;
530 wxSpinCtrl *disc_chapter; int i_disc_chapter;
531 wxSpinCtrl *disc_sub; int i_disc_sub;
532 wxSpinCtrl *disc_audio; int i_disc_audio;
534 /* The media equivalent name for a DVD names. For example,
535 * "Title", is "Track" for a CD-DA */
536 wxStaticText *disc_title_label;
537 wxStaticText *disc_chapter_label;
538 wxStaticText *disc_sub_label;
539 wxStaticText *disc_audio_label;
541 /* Indicates if the disc device control was modified */
542 bool b_disc_device_changed;
544 /* Controls for the net panel */
545 wxRadioBox *net_type;
547 wxPanel *net_subpanels[4];
548 wxRadioButton *net_radios[4];
549 wxSpinCtrl *net_ports[4];
551 wxTextCtrl *net_addrs[4];
552 wxCheckBox *net_timeshift;
553 wxCheckBox *net_ipv6;
555 /* Controls for the subtitles file */
556 wxButton *subsfile_button;
557 wxCheckBox *subsfile_checkbox;
558 SubsFileDialog *subsfile_dialog;
559 wxArrayString subsfile_mrl;
561 /* Controls for the stream output */
562 wxButton *sout_button;
563 wxCheckBox *sout_checkbox;
564 SoutDialog *sout_dialog;
565 wxArrayString sout_mrl;
567 /* Controls for the caching options */
568 wxCheckBox *caching_checkbox;
569 wxSpinCtrl *caching_value;
579 /* Auto-built panels */
582 #define MAX_ACCESS CAPTURE_ACCESS
584 /* Stream output Dialog */
597 TS_ENCAPSULATION = 0,
616 class SoutDialog: public wxDialog
620 SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
621 virtual ~SoutDialog();
623 wxArrayString GetOptions();
627 wxPanel *AccessPanel( wxWindow* parent );
628 wxPanel *MiscPanel( wxWindow* parent );
629 wxPanel *EncapsulationPanel( wxWindow* parent );
630 wxPanel *TranscodingPanel( wxWindow* parent );
633 /* Event handlers (these functions should _not_ be virtual) */
634 void OnOk( wxCommandEvent& event );
635 void OnCancel( wxCommandEvent& event );
636 void OnMRLChange( wxCommandEvent& event );
637 void OnAccessTypeChange( wxCommandEvent& event );
639 /* Event handlers for the file access output */
640 void OnFileChange( wxCommandEvent& event );
641 void OnFileBrowse( wxCommandEvent& event );
642 void OnFileDump( wxCommandEvent& event );
644 /* Event handlers for the net access output */
645 void OnNetChange( wxCommandEvent& event );
647 /* Event specific to the announce address */
648 void OnAnnounceGroupChange( wxCommandEvent& event );
649 void OnAnnounceAddrChange( wxCommandEvent& event );
651 /* Event handlers for the encapsulation panel */
652 void OnEncapsulationChange( wxCommandEvent& event );
654 /* Event handlers for the transcoding panel */
655 void OnTranscodingEnable( wxCommandEvent& event );
656 void OnTranscodingChange( wxCommandEvent& event );
658 /* Event handlers for the misc panel */
659 void OnSAPMiscChange( wxCommandEvent& event );
660 void OnSLPMiscChange( wxCommandEvent& event );
662 DECLARE_EVENT_TABLE();
664 intf_thread_t *p_intf;
667 wxComboBox *mrl_combo;
669 /* Controls for the access outputs */
670 wxPanel *access_panel;
671 wxPanel *access_subpanels[ACCESS_OUT_NUM];
672 wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
676 wxComboBox *file_combo;
677 wxCheckBox *dump_checkbox;
678 wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
679 wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
681 /* Controls for the SAP announces */
683 wxPanel *misc_subpanels[MISC_SOUT_NUM];
684 wxCheckBox *sap_checkbox;
685 wxCheckBox *slp_checkbox;
686 wxTextCtrl *announce_group;
687 wxTextCtrl *announce_addr;
689 /* Controls for the encapsulation */
690 wxPanel *encapsulation_panel;
691 wxRadioButton *encapsulation_radios[ENCAPS_NUM];
692 int i_encapsulation_type;
694 /* Controls for transcoding */
695 wxPanel *transcoding_panel;
696 wxCheckBox *video_transc_checkbox;
697 wxComboBox *video_codec_combo;
698 wxComboBox *audio_codec_combo;
699 wxCheckBox *audio_transc_checkbox;
700 wxComboBox *video_bitrate_combo;
701 wxComboBox *audio_bitrate_combo;
702 wxComboBox *audio_channels_combo;
703 wxComboBox *video_scale_combo;
704 wxComboBox *subtitles_codec_combo;
705 wxCheckBox *subtitles_transc_checkbox;
706 wxCheckBox *subtitles_overlay_checkbox;
709 wxCheckBox *sout_all_checkbox;
712 /* Subtitles File Dialog */
713 class SubsFileDialog: public wxDialog
717 SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
718 virtual ~SubsFileDialog();
720 wxComboBox *file_combo;
721 wxComboBox *encoding_combo;
722 wxComboBox *size_combo;
723 wxComboBox *align_combo;
724 wxSpinCtrl *fps_spinctrl;
725 wxSpinCtrl *delay_spinctrl;
728 /* Event handlers (these functions should _not_ be virtual) */
729 void OnOk( wxCommandEvent& event );
730 void OnCancel( wxCommandEvent& event );
731 void OnFileBrowse( wxCommandEvent& event );
733 DECLARE_EVENT_TABLE();
735 intf_thread_t *p_intf;
740 class StreamDialog: public wxFrame
744 StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent );
745 virtual ~StreamDialog();
748 void OnClose( wxCommandEvent& event );
749 void OnOpen( wxCommandEvent& event );
750 void OnSout( wxCommandEvent& event );
751 void OnStart( wxCommandEvent& event );
753 DECLARE_EVENT_TABLE();
755 intf_thread_t *p_intf;
757 wxStaticText *step2_label;
758 wxStaticText *step3_label;
759 wxButton *sout_button;
760 wxButton *start_button;
762 wxArrayString sout_mrl;
763 OpenDialog *p_open_dialog;
764 SoutDialog *p_sout_dialog;
768 class WizardDialog : public wxWizard
772 WizardDialog( intf_thread_t *, wxWindow *p_parent, char *, int, int );
773 virtual ~WizardDialog();
774 void SetTranscode( char const *vcodec, int vb, char const *acodec, int ab);
775 void SetMrl( const char *mrl );
776 void SetTTL( int i_ttl );
777 void SetPartial( int, int );
778 void SetStream( char const *method, char const *address );
779 void SetTranscodeOut( char const *address );
780 void SetAction( int i_action );
782 void SetSAP( bool b_enabled, const char *psz_name );
783 void SetMux( char const *mux );
790 int i_from, i_to, i_ttl;
791 char *vcodec , *acodec , *address , *mrl , *mux ;
794 DECLARE_EVENT_TABLE();
796 intf_thread_t *p_intf;
800 /* Preferences Dialog */
801 class PrefsDialog: public wxFrame
805 PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
806 virtual ~PrefsDialog();
809 wxPanel *PrefsPanel( wxWindow* parent );
811 /* Event handlers (these functions should _not_ be virtual) */
812 void OnOk( wxCommandEvent& event );
813 void OnCancel( wxCommandEvent& event );
814 void OnSave( wxCommandEvent& event );
815 void OnResetAll( wxCommandEvent& event );
816 void OnAdvanced( wxCommandEvent& event );
817 void OnClose( wxCloseEvent& event );
819 DECLARE_EVENT_TABLE();
821 intf_thread_t *p_intf;
823 PrefsTreeCtrl *prefs_tree;
827 class Messages: public wxFrame
831 Messages( intf_thread_t *p_intf, wxWindow *p_parent );
833 bool Show( bool show = TRUE );
837 /* Event handlers (these functions should _not_ be virtual) */
838 void OnButtonClose( wxCommandEvent& event );
839 void OnClose( wxCloseEvent& WXUNUSED(event) );
840 void OnClear( wxCommandEvent& event );
841 void OnSaveLog( wxCommandEvent& event );
843 DECLARE_EVENT_TABLE();
845 intf_thread_t *p_intf;
846 wxTextCtrl *textctrl;
847 wxTextAttr *info_attr;
848 wxTextAttr *err_attr;
849 wxTextAttr *warn_attr;
850 wxTextAttr *dbg_attr;
852 wxFileDialog *save_log_dialog;
854 vlc_bool_t b_verbose;
858 class Playlist: public wxFrame
862 Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
865 void UpdatePlaylist();
866 void ShowPlaylist( bool show );
867 void UpdateItem( int );
868 void AppendItem( wxCommandEvent& );
873 void RemoveItem( int );
874 void DeleteTreeItem( wxTreeItemId );
875 void DeleteItem( int item );
876 void DeleteNode( playlist_item_t *node );
878 void RecursiveDeleteSelection( wxTreeItemId );
880 /* Event handlers (these functions should _not_ be virtual) */
883 void OnAddFile( wxCommandEvent& event );
884 void OnAddDir( wxCommandEvent& event );
885 void OnAddMRL( wxCommandEvent& event );
886 void OnMenuClose( wxCommandEvent& event );
887 void OnClose( wxCloseEvent& WXUNUSED(event) );
889 void OnDeleteSelection( wxCommandEvent& event );
891 void OnOpen( wxCommandEvent& event );
892 void OnSave( wxCommandEvent& event );
895 void OnSearch( wxCommandEvent& event );
896 /*void OnSearchTextChange( wxCommandEvent& event );*/
897 wxTextCtrl *search_text;
898 wxButton *search_button;
899 wxTreeItemId search_current;
901 void OnEnDis( wxCommandEvent& event );
905 void OnSort( wxCommandEvent& event );
908 int i_duration_sorted;
911 void OnMenuEvent( wxCommandEvent& event );
912 void OnMenuOpen( wxMenuEvent& event );
918 void OnUp( wxCommandEvent& event);
919 void OnDown( wxCommandEvent& event);
921 void OnRandom( wxCommandEvent& event );
922 void OnRepeat( wxCommandEvent& event );
923 void OnLoop ( wxCommandEvent& event );
925 void OnActivateItem( wxTreeEvent& event );
926 void OnKeyDown( wxTreeEvent& event );
927 void OnNewGroup( wxCommandEvent& event );
932 wxTreeItemId i_wx_popup_item;
935 void OnPopup( wxContextMenuEvent& event );
936 void OnPopupPlay( wxCommandEvent& event );
937 void OnPopupPreparse( wxCommandEvent& event );
938 void OnPopupSort( wxCommandEvent& event );
939 void OnPopupDel( wxCommandEvent& event );
940 void OnPopupEna( wxCommandEvent& event );
941 void OnPopupInfo( wxCommandEvent& event );
942 void Rebuild( vlc_bool_t );
947 void UpdateNode( playlist_item_t*, wxTreeItemId );
948 void UpdateNodeChildren( playlist_item_t*, wxTreeItemId );
949 void CreateNode( playlist_item_t*, wxTreeItemId );
950 void UpdateTreeItem( wxTreeItemId );
952 /* Search (internal) */
953 int CountItems( wxTreeItemId);
954 wxTreeItemId FindItem( wxTreeItemId, int );
955 wxTreeItemId FindItemByName( wxTreeItemId, wxString,
956 wxTreeItemId, vlc_bool_t *);
958 wxTreeItemId saved_tree_item;
961 playlist_t *p_playlist;
965 void OnPlaylistEvent( wxCommandEvent& event );
967 DECLARE_EVENT_TABLE();
971 wxStatusBar *statusbar;
972 ItemInfoDialog *iteminfo_dialog;
974 int i_update_counter;
976 intf_thread_t *p_intf;
977 wxTreeCtrl *treectrl;
979 vlc_bool_t b_changed_view;
985 /* ItemInfo Dialog */
986 class ItemInfoDialog: public wxDialog
990 ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
991 wxWindow *p_parent );
992 virtual ~ItemInfoDialog();
994 wxArrayString GetOptions();
997 wxPanel *InfoPanel( wxWindow* parent );
998 wxPanel *GroupPanel( wxWindow* parent );
1000 /* Event handlers (these functions should _not_ be virtual) */
1001 void OnOk( wxCommandEvent& event );
1002 void OnCancel( wxCommandEvent& event );
1006 DECLARE_EVENT_TABLE();
1008 intf_thread_t *p_intf;
1009 playlist_item_t *p_item;
1012 /* Controls for the iteminfo dialog box */
1013 wxPanel *info_subpanel;
1014 wxPanel *info_panel;
1016 wxPanel *group_subpanel;
1017 wxPanel *group_panel;
1019 wxTextCtrl *uri_text;
1020 wxTextCtrl *name_text;
1022 wxTreeCtrl *info_tree;
1023 wxTreeItemId info_root;
1029 class FileInfo: public wxFrame
1033 FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
1034 virtual ~FileInfo();
1035 void UpdateFileInfo();
1037 vlc_bool_t b_need_update;
1040 void OnButtonClose( wxCommandEvent& event );
1041 void OnClose( wxCloseEvent& WXUNUSED(event) );
1043 DECLARE_EVENT_TABLE();
1045 intf_thread_t *p_intf;
1046 wxTreeCtrl *fileinfo_tree;
1047 wxTreeItemId fileinfo_root;
1048 wxString fileinfo_root_label;
1053 class UpdateVLC: public wxFrame
1057 UpdateVLC( intf_thread_t *p_intf, wxWindow *p_parent );
1058 virtual ~UpdateVLC();
1061 void OnButtonClose( wxCommandEvent& event );
1062 void OnClose( wxCloseEvent& WXUNUSED(event) );
1064 void OnCheckForUpdate( wxCommandEvent& event );
1065 void OnMirrorChoice( wxCommandEvent& event );
1066 void UpdateUpdatesTree();
1067 void UpdateMirrorsChoice();
1068 void OnUpdatesTreeActivate( wxTreeEvent& event );
1069 void DownloadFile( wxString url, wxString dst );
1071 DECLARE_EVENT_TABLE();
1073 intf_thread_t *p_intf;
1074 wxTreeCtrl *updates_tree;
1075 wxTreeItemId updates_root;
1077 wxChoice *mirrors_choice;
1079 wxString release_type; /* could be "stable", "test", "nightly" ... */
1081 struct update_file_t
1087 wxString description;
1090 struct update_version_t
1097 std::list<update_file_t> m_files;
1100 std::list<update_version_t> m_versions;
1102 struct update_mirror_t
1110 std::list<update_mirror_t> m_mirrors;
1113 #if wxUSE_DRAG_AND_DROP
1114 /* Drag and Drop class */
1115 class DragAndDrop: public wxFileDropTarget
1118 DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE );
1120 virtual bool OnDropFiles( wxCoord x, wxCoord y,
1121 const wxArrayString& filenames );
1124 intf_thread_t *p_intf;
1125 vlc_bool_t b_enqueue;
1128 } // end of wxvlc namespace
1131 class WindowSettings
1134 WindowSettings( intf_thread_t *_p_intf );
1135 virtual ~WindowSettings();
1149 void SetSettings( int id, bool _b_shown,
1150 wxPoint p = wxDefaultPosition, wxSize s = wxDefaultSize );
1151 bool GetSettings( int id, bool& _b_shown, wxPoint& p, wxSize& s );
1153 void SetScreen( int i_screen_w, int i_screen_h );
1156 intf_thread_t *p_intf;
1160 bool b_valid[ID_MAX];
1161 bool b_shown[ID_MAX];
1162 wxPoint position[ID_MAX];
1163 wxSize size[ID_MAX];
1167 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
1168 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1169 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1170 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1171 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
1175 class MenuEvtHandler : public wxEvtHandler
1178 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
1179 virtual ~MenuEvtHandler();
1181 void OnMenuEvent( wxCommandEvent& event );
1182 void OnShowDialog( wxCommandEvent& event );
1186 DECLARE_EVENT_TABLE()
1188 intf_thread_t *p_intf;
1189 Interface *p_main_interface;
1192 } // end of wxvlc namespace
1196 * wxWindows keeps dead locking because the timer tries to lock the playlist
1197 * when it's already locked somewhere else in the very wxWindows interface
1198 * module. Unless someone implements a "vlc_mutex_trylock", we need that.
1200 inline void LockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl )
1202 if( p_sys->i_playlist_usage++ == 0)
1203 vlc_mutex_lock( &p_pl->object_lock );
1206 inline void UnlockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl )
1208 if( --p_sys->i_playlist_usage == 0)
1209 vlc_mutex_unlock( &p_pl->object_lock );
1212 using namespace wxvlc;