Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

wxwidgets.h

00001 /*****************************************************************************
00002  * wxwidgets.h: private wxWindows interface description
00003  *****************************************************************************
00004  * Copyright (C) 1999-2005 the VideoLAN team
00005  * $Id: wxwidgets.h 13235 2005-11-14 00:08:06Z dionoea $
00006  *
00007  * Authors: Gildas Bazin <[email protected]>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00022  *****************************************************************************/
00023 
00024 #ifdef WIN32                                                 /* mingw32 hack */
00025 #undef Yield
00026 #undef CreateDialog
00027 #endif
00028 
00029 #ifdef _MSC_VER
00030 // turn off 'identifier was truncated to '255' characters in the debug info'
00031 #   pragma warning( disable:4786 )
00032 #endif
00033 
00034 /* Let vlc take care of the i18n stuff */
00035 #define WXINTL_NO_GETTEXT_MACRO
00036 
00037 #include <list>
00038 
00039 #include <wx/wxprec.h>
00040 #include <wx/wx.h>
00041 
00042 #include <wx/listctrl.h>
00043 #include <wx/textctrl.h>
00044 #include <wx/notebook.h>
00045 #include <wx/spinctrl.h>
00046 #include <wx/dnd.h>
00047 #include <wx/treectrl.h>
00048 #include <wx/gauge.h>
00049 #include <wx/accel.h>
00050 #include <wx/checkbox.h>
00051 #include <wx/wizard.h>
00052 #include <wx/taskbar.h>
00053 #include "vlc_keys.h"
00054 
00055 #if (!wxCHECK_VERSION(2,5,0))
00056 typedef long wxTreeItemIdValue;
00057 #endif
00058 
00059 DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
00060 DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
00061 
00062 #define SLIDER_MAX_POS 10000
00063 
00064 /* wxU is used to convert ansi/utf8 strings to unicode strings (wchar_t) */
00065 #if defined( ENABLE_NLS )
00066 #if wxUSE_UNICODE
00067 #   define wxU(utf8) wxString(utf8, wxConvUTF8)
00068 #else
00069 #   define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
00070 #endif
00071 #else // ENABLE_NLS
00072 #if wxUSE_UNICODE
00073 #   define wxU(ansi) wxString(ansi, wxConvLocal)
00074 #else
00075 #   define wxU(ansi) (ansi)
00076 #endif
00077 #endif
00078 
00079 /* wxL2U (locale to unicode) is used to convert ansi strings to unicode
00080  * strings (wchar_t) */
00081 #define wxL2U(ansi) wxU(ansi)
00082 
00083 #if wxUSE_UNICODE
00084 #   define wxFromLocale(wxstring) FromUTF32(wxstring.wc_str())
00085 #   define wxLocaleFree(string) free(string)
00086 #else
00087 #   define wxFromLocale(wxstring) FromLocale(wxstring.mb_str())
00088 #   define wxLocaleFree(string) LocaleFree(string)
00089 #endif
00090 
00091 #define WRAPCOUNT 80
00092 
00093 #define OPEN_NORMAL 0
00094 #define OPEN_STREAM 1
00095 
00096 #define MODE_NONE 0
00097 #define MODE_GROUP 1
00098 #define MODE_AUTHOR 2
00099 #define MODE_TITLE 3
00100 
00101 enum{
00102   ID_CONTROLS_TIMER,
00103   ID_SLIDER_TIMER,
00104 };
00105 
00106 class DialogsProvider;
00107 class PrefsTreeCtrl;
00108 class AutoBuiltPanel;
00109 class VideoWindow;
00110 class WindowSettings;
00111 
00112 /*****************************************************************************
00113  * intf_sys_t: description and status of wxwindows interface
00114  *****************************************************************************/
00115 struct intf_sys_t
00116 {
00117     /* the wx parent window */
00118     wxWindow            *p_wxwindow;
00119     wxIcon              *p_icon;
00120 
00121     /* window settings */
00122     WindowSettings      *p_window_settings;
00123 
00124     /* special actions */
00125     vlc_bool_t          b_playing;
00126     vlc_bool_t          b_intf_show;                /* interface to be shown */
00127 
00128     /* The input thread */
00129     input_thread_t *    p_input;
00130 
00131     /* The slider */
00132     int                 i_slider_pos;                     /* slider position */
00133     int                 i_slider_oldpos;                /* previous position */
00134     vlc_bool_t          b_slider_free;                      /* slider status */
00135 
00136     /* The messages window */
00137     msg_subscription_t* p_sub;                  /* message bank subscription */
00138 
00139     /* Playlist management */
00140     int                 i_playing;                 /* playlist selected item */
00141     unsigned            i_playlist_usage;
00142 
00143     /* Send an event to show a dialog */
00144     void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
00145                              intf_dialog_args_t *p_arg );
00146 
00147     /* Popup menu */
00148     wxMenu              *p_popup_menu;
00149 
00150     /* Hotkeys */
00151     int                 i_first_hotkey_event;
00152     int                 i_hotkeys;
00153 
00154     /* Embedded vout */
00155     VideoWindow         *p_video_window;
00156     wxBoxSizer          *p_video_sizer;
00157     vlc_bool_t          b_video_autosize;
00158 
00159     /* Aout */
00160     aout_instance_t     *p_aout;
00161 };
00162 
00163 /*****************************************************************************
00164  * Prototypes
00165  *****************************************************************************/
00166 wxArrayString SeparateEntries( wxString );
00167 wxWindow *CreateVideoWindow( intf_thread_t *p_intf, wxWindow *p_parent );
00168 void UpdateVideoWindow( intf_thread_t *p_intf, wxWindow *p_window );
00169 wxFrame *BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent );
00170 wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
00171 
00172 namespace wxvlc
00173 {
00174 class Interface;
00175 class OpenDialog;
00176 class SoutDialog;
00177 class SubsFileDialog;
00178 class Playlist;
00179 class Messages;
00180 class FileInfo;
00181 class StreamDialog;
00182 class WizardDialog;
00183 class ItemInfoDialog;
00184 class NewGroup;
00185 class ExportPlaylist;
00186 
00187 /*****************************************************************************
00188  * Classes declarations.
00189  *****************************************************************************/
00190 /* Timer */
00191 class Timer: public wxTimer
00192 {
00193 public:
00194     /* Constructor */
00195     Timer( intf_thread_t *p_intf, Interface *p_main_interface );
00196     virtual ~Timer();
00197 
00198     virtual void Notify();
00199 
00200 private:
00201     //use wxWindow::IsShown instead
00202     //vlc_bool_t b_slider_shown;
00203     //vlc_bool_t b_disc_shown;
00204     intf_thread_t *p_intf;
00205     Interface *p_main_interface;
00206     vlc_bool_t b_init;
00207     int i_old_playing_status;
00208     int i_old_rate;
00209 };
00210 
00211 
00212 /* Extended panel */
00213 class ExtraPanel: public wxPanel
00214 {
00215 public:
00216     /* Constructor */
00217     ExtraPanel( intf_thread_t *p_intf, wxWindow *p_parent );
00218     virtual ~ExtraPanel();
00219 
00220     wxStaticBox *adjust_box;
00221     wxButton *restoredefaults_button;
00222     wxSlider *brightness_slider;
00223     wxSlider *contrast_slider;
00224     wxSlider *saturation_slider;
00225     wxSlider *hue_slider;
00226     wxSlider *gamma_slider;
00227 
00228     wxStaticBox *other_box;
00229     wxComboBox *ratio_combo;
00230 
00231     char *psz_bands;
00232     float f_preamp;
00233     vlc_bool_t b_update;
00234 
00235 private:
00236 
00237     wxPanel *VideoPanel( wxWindow * );
00238     wxPanel *EqzPanel( wxWindow * );
00239     wxPanel *AudioPanel( wxWindow * );
00240 
00241     wxNotebook *notebook;
00242 
00243     wxCheckBox *eq_chkbox;
00244 
00245     wxCheckBox *eq_2p_chkbox;
00246 
00247     wxButton *eq_restoredefaults_button;
00248 
00249     wxSlider *smooth_slider;
00250     wxStaticText *smooth_text;
00251 
00252     wxSlider *preamp_slider;
00253     wxStaticText * preamp_text;
00254 
00255     int i_smooth;
00256     wxWindow *p_parent;
00257 
00258     wxSlider *band_sliders[10];
00259     wxStaticText *band_texts[10];
00260 
00261     int i_values[10];
00262 
00263     void CheckAout();
00264 
00265     /* Event handlers (these functions should _not_ be virtual) */
00266 
00267     void OnEnableAdjust( wxCommandEvent& );
00268     void OnEnableEqualizer( wxCommandEvent& );
00269     void OnRestoreDefaults( wxCommandEvent& );
00270     void OnChangeEqualizer( wxScrollEvent& );
00271     void OnAdjustUpdate( wxScrollEvent& );
00272     void OnRatio( wxCommandEvent& );
00273     void OnFiltersInfo( wxCommandEvent& );
00274     void OnSelectFilter( wxCommandEvent& );
00275 
00276     void OnEqSmooth( wxScrollEvent& );
00277     void OnPreamp( wxScrollEvent& );
00278     void OnEq2Pass( wxCommandEvent& );
00279     void OnEqRestore( wxCommandEvent& );
00280 
00281     void OnHeadphone( wxCommandEvent& );
00282     void OnNormvol( wxCommandEvent& );
00283     void OnNormvolSlider( wxScrollEvent& );
00284 
00285     void OnIdle( wxIdleEvent& );
00286 
00287     DECLARE_EVENT_TABLE();
00288 
00289     intf_thread_t *p_intf;
00290     vlc_bool_t b_my_update;
00291 };
00292 
00293 #if 0
00294 /* Extended Window  */
00295 class ExtraWindow: public wxFrame
00296 {
00297 public:
00298     /* Constructor */
00299     ExtraWindow( intf_thread_t *p_intf, wxWindow *p_parent, wxPanel *panel );
00300     virtual ~ExtraWindow();
00301 
00302 private:
00303 
00304     wxPanel *panel;
00305 
00306     DECLARE_EVENT_TABLE();
00307 
00308     intf_thread_t *p_intf;
00309 };
00310 #endif
00311 
00312 /* Systray integration */
00313 #ifdef wxHAS_TASK_BAR_ICON
00314 class Systray: public wxTaskBarIcon
00315 {
00316 public:
00317     Systray( Interface* p_main_interface, intf_thread_t *p_intf );
00318     virtual ~Systray() {};
00319     wxMenu* CreatePopupMenu();
00320     void UpdateTooltip( const wxChar* tooltip );
00321 
00322 private:
00323     void OnMenuIconize( wxCommandEvent& event );
00324     void OnLeftClick( wxTaskBarIconEvent& event );
00325     void OnPlayStream ( wxCommandEvent& event );
00326     void OnStopStream ( wxCommandEvent& event );
00327     void OnPrevStream ( wxCommandEvent& event );
00328     void OnNextStream ( wxCommandEvent& event );
00329     void OnExit(  wxCommandEvent& event );
00330     Interface* p_main_interface;
00331     intf_thread_t *p_intf;
00332     DECLARE_EVENT_TABLE()
00333 };
00334 #endif
00335 
00336 /* Main Interface */
00337 class Interface: public wxFrame
00338 {
00339 public:
00340     /* Constructor */
00341     Interface( intf_thread_t *p_intf, long style = wxDEFAULT_FRAME_STYLE );
00342     virtual ~Interface();
00343     void Init();
00344     void TogglePlayButton( int i_playing_status );
00345     void Update();
00346     void PlayStream();
00347     void StopStream();
00348     void PrevStream();
00349     void NextStream();
00350 
00351     wxBoxSizer  *frame_sizer;
00352     wxStatusBar *statusbar;
00353 
00354     void HideSlider(bool layout = true);
00355     void ShowSlider(bool show = true, bool layout = true);
00356 
00357     wxSlider    *slider;
00358     wxWindow    *slider_frame;
00359     wxBoxSizer  *slider_sizer;
00360     wxPanel     *extra_frame;
00361 
00362     void HideDiscFrame(bool layout = true);
00363     void ShowDiscFrame(bool show = true, bool layout = true);
00364 
00365     wxPanel         *disc_frame;
00366     wxBoxSizer      *disc_sizer;
00367     wxBitmapButton  *disc_menu_button;
00368     wxBitmapButton  *disc_prev_button;
00369     wxBitmapButton  *disc_next_button;
00370 
00371     wxFrame    *extra_window;
00372 
00373     vlc_bool_t b_extra;
00374     vlc_bool_t b_undock;
00375 
00376     wxControl  *volctrl;
00377 
00378 #ifdef wxHAS_TASK_BAR_ICON
00379     Systray     *p_systray;
00380 #endif
00381 
00382     wxTimer m_controls_timer;
00383     wxTimer m_slider_timer;
00384 
00385 private:
00386     void SetupHotkeys();
00387     void CreateOurMenuBar();
00388     void CreateOurToolBar();
00389     void CreateOurExtendedPanel();
00390     void CreateOurSlider();
00391     void Open( int i_access_method );
00392 
00393     /* Event handlers (these functions should _not_ be virtual) */
00394     void OnControlsTimer(wxTimerEvent& WXUNUSED(event));
00395     void OnSliderTimer(wxTimerEvent& WXUNUSED(event));
00396 
00397     void OnExit( wxCommandEvent& event );
00398     void OnAbout( wxCommandEvent& event );
00399 
00400     void OnOpenFileSimple( wxCommandEvent& event );
00401     void OnOpenDir( wxCommandEvent& event );
00402     void OnOpenFile( wxCommandEvent& event );
00403     void OnOpenDisc( wxCommandEvent& event );
00404     void OnOpenNet( wxCommandEvent& event );
00405     void OnOpenSat( wxCommandEvent& event );
00406 
00407     void OnExtended( wxCommandEvent& event );
00408     //void OnUndock( wxCommandEvent& event );
00409 
00410     void OnBookmarks( wxCommandEvent& event );
00411     void OnShowDialog( wxCommandEvent& event );
00412     void OnPlayStream( wxCommandEvent& event );
00413     void OnStopStream( wxCommandEvent& event );
00414     void OnSliderUpdate( wxScrollEvent& event );
00415     void OnPrevStream( wxCommandEvent& event );
00416     void OnNextStream( wxCommandEvent& event );
00417     void OnSlowStream( wxCommandEvent& event );
00418     void OnFastStream( wxCommandEvent& event );
00419 
00420     void OnDiscMenu( wxCommandEvent& event );
00421     void OnDiscPrev( wxCommandEvent& event );
00422     void OnDiscNext( wxCommandEvent& event );
00423 
00424     void OnMenuOpen( wxMenuEvent& event );
00425 
00426 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
00427     void OnContextMenu2(wxContextMenuEvent& event);
00428 #endif
00429     void OnContextMenu(wxMouseEvent& event);
00430 
00431     void OnControlEvent( wxCommandEvent& event );
00432 
00433     DECLARE_EVENT_TABLE();
00434 
00435     Timer *timer;
00436     intf_thread_t *p_intf;
00437 
00438     wxWindow *video_window;
00439 
00440     int i_old_playing_status;
00441 
00442     /* For auto-generated menus */
00443     wxMenu *p_settings_menu;
00444     wxMenu *p_audio_menu;
00445     wxMenu *p_video_menu;
00446     wxMenu *p_navig_menu;
00447 };
00448 
00449 /* Open Dialog */
00450 WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel);
00451 class OpenDialog: public wxDialog
00452 {
00453 public:
00454     /* Constructor */
00455     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
00456                 int i_access_method, int i_arg = 0  );
00457 
00458     /* Extended Contructor */
00459     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
00460                 int i_access_method, int i_arg = 0 , int _i_method = 0 );
00461     virtual ~OpenDialog();
00462 
00463     int Show();
00464     int Show( int i_access_method, int i_arg = 0 );
00465 
00466     void UpdateMRL();
00467     void UpdateMRL( int i_access_method );
00468 
00469     wxArrayString mrl;
00470 
00471 private:
00472     wxPanel *FilePanel( wxWindow* parent );
00473     wxPanel *DiscPanel( wxWindow* parent );
00474     wxPanel *NetPanel( wxWindow* parent );
00475 
00476     ArrayOfAutoBuiltPanel input_tab_array;
00477 
00478     /* Event handlers (these functions should _not_ be virtual) */
00479     void OnOk( wxCommandEvent& event );
00480     void OnCancel( wxCommandEvent& event );
00481     void OnClose( wxCloseEvent& event );
00482 
00483     void OnPageChange( wxNotebookEvent& event );
00484     void OnMRLChange( wxCommandEvent& event );
00485 
00486     /* Event handlers for the file page */
00487     void OnFilePanelChange( wxCommandEvent& event );
00488     void OnFileBrowse( wxCommandEvent& event );
00489 
00490     /* Event handlers for the disc page */
00491     void OnDiscPanelChangeSpin( wxSpinEvent& event );
00492     void OnDiscPanelChange( wxCommandEvent& event );
00493     void OnDiscTypeChange( wxCommandEvent& event );
00494 #ifdef HAVE_LIBCDIO
00495     void OnDiscProbe( wxCommandEvent& event );
00496 #endif
00497     void OnDiscDeviceChange( wxCommandEvent& event );
00498 
00499     /* Event handlers for the net page */
00500     void OnNetPanelChangeSpin( wxSpinEvent& event );
00501     void OnNetPanelChange( wxCommandEvent& event );
00502     void OnNetTypeChange( wxCommandEvent& event );
00503 
00504     /* Event handlers for the stream output */
00505     void OnSubsFileEnable( wxCommandEvent& event );
00506     void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
00507 
00508     /* Event handlers for the stream output */
00509     void OnSoutEnable( wxCommandEvent& event );
00510     void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
00511 
00512     /* Event handlers for the caching option */
00513     void OnCachingEnable( wxCommandEvent& event );
00514     void OnCachingChange( wxCommandEvent& event );
00515     void OnCachingChangeSpin( wxSpinEvent& event );
00516 
00517     DECLARE_EVENT_TABLE();
00518 
00519     intf_thread_t *p_intf;
00520     wxWindow *p_parent;
00521     int i_current_access_method;
00522     int i_disc_type_selection;
00523 
00524     int i_method; /* Normal or for the stream dialog ? */
00525     int i_open_arg;
00526 
00527     wxComboBox *mrl_combo;
00528     wxNotebook *notebook;
00529 
00530     /* Controls for the file panel */
00531     wxComboBox *file_combo;
00532     wxFileDialog *file_dialog;
00533 
00534     /* Controls for the disc panel */
00535     wxRadioBox *disc_type;
00536     wxCheckBox *disc_probe;
00537     wxTextCtrl *disc_device;
00538     wxSpinCtrl *disc_title; int i_disc_title;
00539     wxSpinCtrl *disc_chapter; int i_disc_chapter;
00540     wxSpinCtrl *disc_sub; int i_disc_sub;
00541     wxSpinCtrl *disc_audio; int i_disc_audio;
00542 
00543     /* The media equivalent name for a DVD names. For example,
00544      * "Title", is "Track" for a CD-DA */
00545     wxStaticText *disc_title_label;
00546     wxStaticText *disc_chapter_label;
00547     wxStaticText *disc_sub_label;
00548     wxStaticText *disc_audio_label;
00549 
00550     /* Indicates if the disc device control was modified */
00551     bool b_disc_device_changed;
00552 
00553     /* Controls for the net panel */
00554     wxRadioBox *net_type;
00555     int i_net_type;
00556     wxPanel *net_subpanels[4];
00557     wxRadioButton *net_radios[4];
00558     wxSpinCtrl *net_ports[4];
00559     int        i_net_ports[4];
00560     wxTextCtrl *net_addrs[4];
00561     wxCheckBox *net_timeshift;
00562     wxCheckBox *net_ipv6;
00563 
00564     /* Controls for the subtitles file */
00565     wxButton *subsfile_button;
00566     wxCheckBox *subsfile_checkbox;
00567     SubsFileDialog *subsfile_dialog;
00568     wxArrayString subsfile_mrl;
00569 
00570     /* Controls for the stream output */
00571     wxButton *sout_button;
00572     wxCheckBox *sout_checkbox;
00573     SoutDialog *sout_dialog;
00574     wxArrayString sout_mrl;
00575 
00576     /* Controls for the caching options */
00577     wxCheckBox *caching_checkbox;
00578     wxSpinCtrl *caching_value;
00579     int i_caching;
00580 };
00581 
00582 enum
00583 {
00584     FILE_ACCESS = 0,
00585     DISC_ACCESS,
00586     NET_ACCESS,
00587 
00588     /* Auto-built panels */
00589     CAPTURE_ACCESS
00590 };
00591 #define MAX_ACCESS CAPTURE_ACCESS
00592 
00593 /* Stream output Dialog */
00594 enum
00595 {
00596     PLAY_ACCESS_OUT = 0,
00597     FILE_ACCESS_OUT,
00598     HTTP_ACCESS_OUT,
00599     MMSH_ACCESS_OUT,
00600     RTP_ACCESS_OUT,
00601     UDP_ACCESS_OUT,
00602     ACCESS_OUT_NUM
00603 };
00604 
00605 enum
00606 {
00607     TS_ENCAPSULATION = 0,
00608     PS_ENCAPSULATION,
00609     MPEG1_ENCAPSULATION,
00610     OGG_ENCAPSULATION,
00611     ASF_ENCAPSULATION,
00612     MP4_ENCAPSULATION,
00613     MOV_ENCAPSULATION,
00614     WAV_ENCAPSULATION,
00615     RAW_ENCAPSULATION,
00616     AVI_ENCAPSULATION,
00617     ENCAPS_NUM
00618 };
00619 
00620 enum
00621 {
00622     ANN_MISC_SOUT = 0,
00623     TTL_MISC_SOUT,
00624     MISC_SOUT_NUM
00625 };
00626 
00627 class SoutDialog: public wxDialog
00628 {
00629 public:
00630     /* Constructor */
00631     SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
00632     virtual ~SoutDialog();
00633 
00634     wxArrayString GetOptions();
00635 
00636 private:
00637     void UpdateMRL();
00638     wxPanel *AccessPanel( wxWindow* parent );
00639     wxPanel *MiscPanel( wxWindow* parent );
00640     wxPanel *EncapsulationPanel( wxWindow* parent );
00641     wxPanel *TranscodingPanel( wxWindow* parent );
00642     void    ParseMRL();
00643 
00644     /* Event handlers (these functions should _not_ be virtual) */
00645     void OnOk( wxCommandEvent& event );
00646     void OnCancel( wxCommandEvent& event );
00647     void OnMRLChange( wxCommandEvent& event );
00648     void OnAccessTypeChange( wxCommandEvent& event );
00649 
00650     /* Event handlers for the file access output */
00651     void OnFileChange( wxCommandEvent& event );
00652     void OnFileBrowse( wxCommandEvent& event );
00653     void OnFileDump( wxCommandEvent& event );
00654 
00655     /* Event handlers for the net access output */
00656     void OnNetChange( wxCommandEvent& event );
00657 
00658     /* Event specific to the announce address */
00659     void OnAnnounceGroupChange( wxCommandEvent& event );
00660     void OnAnnounceAddrChange( wxCommandEvent& event );
00661 
00662     /* Event handlers for the encapsulation panel */
00663     void OnEncapsulationChange( wxCommandEvent& event );
00664 
00665     /* Event handlers for the transcoding panel */
00666     void OnTranscodingEnable( wxCommandEvent& event );
00667     void OnTranscodingChange( wxCommandEvent& event );
00668 
00669     /* Event handlers for the misc panel */
00670     void OnSAPMiscChange( wxCommandEvent& event );
00671 
00672     DECLARE_EVENT_TABLE();
00673 
00674     intf_thread_t *p_intf;
00675     wxWindow *p_parent;
00676 
00677     wxComboBox *mrl_combo;
00678 
00679     /* Controls for the access outputs */
00680     wxPanel *access_panel;
00681     wxPanel *access_subpanels[ACCESS_OUT_NUM];
00682     wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
00683 
00684     int i_access_type;
00685 
00686     wxComboBox *file_combo;
00687     wxCheckBox *dump_checkbox;
00688     wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
00689     wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
00690 
00691     /* Controls for the SAP announces and TTL setting */
00692     wxPanel *misc_panel;
00693     wxPanel *misc_subpanels[MISC_SOUT_NUM];
00694     wxCheckBox *sap_checkbox;
00695     wxTextCtrl *announce_group;
00696     wxTextCtrl *announce_addr;
00697     wxSpinCtrl *ttl_spin;
00698 
00699     /* Controls for the encapsulation */
00700     wxPanel *encapsulation_panel;
00701     wxRadioButton *encapsulation_radios[ENCAPS_NUM];
00702     int i_encapsulation_type;
00703 
00704     /* Controls for transcoding */
00705     wxPanel *transcoding_panel;
00706     wxCheckBox *video_transc_checkbox;
00707     wxComboBox *video_codec_combo;
00708     wxComboBox *audio_codec_combo;
00709     wxCheckBox *audio_transc_checkbox;
00710     wxComboBox *video_bitrate_combo;
00711     wxComboBox *audio_bitrate_combo;
00712     wxComboBox *audio_channels_combo;
00713     wxComboBox *video_scale_combo;
00714     wxComboBox *subtitles_codec_combo;
00715     wxCheckBox *subtitles_transc_checkbox;
00716     wxCheckBox *subtitles_overlay_checkbox;
00717 
00718     /* Misc controls */
00719     wxCheckBox *sout_all_checkbox;
00720 };
00721 
00722 /* Subtitles File Dialog */
00723 class SubsFileDialog: public wxDialog
00724 {
00725 public:
00726     /* Constructor */
00727     SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
00728     virtual ~SubsFileDialog();
00729 
00730     wxComboBox *file_combo;
00731     wxComboBox *encoding_combo;
00732     wxComboBox *size_combo;
00733     wxComboBox *align_combo;
00734     wxSpinCtrl *fps_spinctrl;
00735     wxSpinCtrl *delay_spinctrl;
00736 
00737 private:
00738     /* Event handlers (these functions should _not_ be virtual) */
00739     void OnOk( wxCommandEvent& event );
00740     void OnCancel( wxCommandEvent& event );
00741     void OnFileBrowse( wxCommandEvent& event );
00742 
00743     DECLARE_EVENT_TABLE();
00744 
00745     intf_thread_t *p_intf;
00746     wxWindow *p_parent;
00747 };
00748 
00749 /* Stream */
00750 class StreamDialog: public wxFrame
00751 {
00752 public:
00753     /* Constructor */
00754     StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent );
00755     virtual ~StreamDialog();
00756 
00757 private:
00758     void OnClose( wxCommandEvent& event );
00759     void OnOpen( wxCommandEvent& event );
00760     void OnSout( wxCommandEvent& event );
00761     void OnStart( wxCommandEvent& event );
00762 
00763     DECLARE_EVENT_TABLE();
00764 
00765     intf_thread_t *p_intf;
00766 
00767     wxStaticText *step2_label;
00768     wxStaticText *step3_label;
00769     wxButton *sout_button;
00770     wxButton *start_button;
00771     wxArrayString mrl;
00772     wxArrayString sout_mrl;
00773     OpenDialog *p_open_dialog;
00774     SoutDialog *p_sout_dialog;
00775 };
00776 
00777 /* Wizard */
00778 class WizardDialog : public wxWizard
00779 {
00780 public:
00781     /* Constructor */
00782     WizardDialog( intf_thread_t *, wxWindow *p_parent, char *, int, int );
00783     virtual ~WizardDialog();
00784     void SetTranscode( char const *vcodec, int vb, char const *acodec, int ab);
00785     void SetMrl( const char *mrl );
00786     void SetTTL( int i_ttl );
00787     void SetPartial( int, int );
00788     void SetStream( char const *method, char const *address );
00789     void SetTranscodeOut( char const *address );
00790     void SetAction( int i_action );
00791     int  GetAction();
00792     void SetSAP( bool b_enabled, const char *psz_name );
00793     void SetMux( char const *mux );
00794     void Run();
00795     int i_action;
00796     char *method;
00797 
00798 protected:
00799     int vb,ab;
00800     int i_from, i_to, i_ttl;
00801     char *vcodec , *acodec , *address , *mrl , *mux ;
00802     char *psz_sap_name;
00803     bool b_sap;
00804     DECLARE_EVENT_TABLE();
00805 
00806     intf_thread_t *p_intf;
00807 };
00808 
00809 
00810 /* Preferences Dialog */
00811 class PrefsDialog: public wxFrame
00812 {
00813 public:
00814     /* Constructor */
00815     PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
00816     virtual ~PrefsDialog();
00817 
00818 private:
00819     wxPanel *PrefsPanel( wxWindow* parent );
00820 
00821     /* Event handlers (these functions should _not_ be virtual) */
00822     void OnOk( wxCommandEvent& event );
00823     void OnCancel( wxCommandEvent& event );
00824     void OnSave( wxCommandEvent& event );
00825     void OnResetAll( wxCommandEvent& event );
00826     void OnAdvanced( wxCommandEvent& event );
00827     void OnClose( wxCloseEvent& event );
00828 
00829     DECLARE_EVENT_TABLE();
00830 
00831     intf_thread_t *p_intf;
00832 
00833     PrefsTreeCtrl *prefs_tree;
00834 };
00835 
00836 /* Messages */
00837 class Messages: public wxFrame
00838 {
00839 public:
00840     /* Constructor */
00841     Messages( intf_thread_t *p_intf, wxWindow *p_parent );
00842     virtual ~Messages();
00843     bool Show( bool show = TRUE );
00844     void UpdateLog();
00845 
00846 private:
00847     /* Event handlers (these functions should _not_ be virtual) */
00848     void OnButtonClose( wxCommandEvent& event );
00849     void OnClose( wxCloseEvent& WXUNUSED(event) );
00850     void OnClear( wxCommandEvent& event );
00851     void OnSaveLog( wxCommandEvent& event );
00852 
00853     DECLARE_EVENT_TABLE();
00854 
00855     intf_thread_t *p_intf;
00856     wxTextCtrl *textctrl;
00857     wxTextAttr *info_attr;
00858     wxTextAttr *err_attr;
00859     wxTextAttr *warn_attr;
00860     wxTextAttr *dbg_attr;
00861 
00862     wxFileDialog *save_log_dialog;
00863 
00864     vlc_bool_t b_verbose;
00865 };
00866 
00867 /* Playlist */
00868 class Playlist: public wxFrame
00869 {
00870 public:
00871     /* Constructor */
00872     Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
00873     virtual ~Playlist();
00874 
00875     void UpdatePlaylist();
00876     void ShowPlaylist( bool show );
00877     void UpdateItem( int );
00878     void AppendItem( wxCommandEvent& );
00879 
00880     bool b_need_update;
00881     int  i_items_to_append;
00882 
00883 private:
00884     void RemoveItem( int );
00885     void DeleteTreeItem( wxTreeItemId );
00886     void DeleteItem( int item );
00887     void DeleteNode( playlist_item_t *node );
00888 
00889     void RecursiveDeleteSelection( wxTreeItemId );
00890 
00891     /* Event handlers (these functions should _not_ be virtual) */
00892 
00893     /* Menu Handlers */
00894     void OnAddFile( wxCommandEvent& event );
00895     void OnAddDir( wxCommandEvent& event );
00896     void OnAddMRL( wxCommandEvent& event );
00897     void OnMenuClose( wxCommandEvent& event );
00898     void OnClose( wxCloseEvent& WXUNUSED(event) );
00899 
00900     void OnDeleteSelection( wxCommandEvent& event );
00901 
00902     void OnOpen( wxCommandEvent& event );
00903     void OnSave( wxCommandEvent& event );
00904 
00905     /* Search (user) */
00906     void OnSearch( wxCommandEvent& event );
00907     /*void OnSearchTextChange( wxCommandEvent& event );*/
00908     wxTextCtrl *search_text;
00909     wxButton *search_button;
00910     wxTreeItemId search_current;
00911 
00912     void OnEnDis( wxCommandEvent& event );
00913 
00914     /* Sort */
00915     int i_sort_mode;
00916     void OnSort( wxCommandEvent& event );
00917     int i_title_sorted;
00918     int i_group_sorted;
00919     int i_duration_sorted;
00920 
00921     /* Dynamic menus */
00922     void OnMenuEvent( wxCommandEvent& event );
00923     void OnMenuOpen( wxMenuEvent& event );
00924     wxMenu *p_view_menu;
00925     wxMenu *p_sd_menu;
00926     wxMenu *ViewMenu();
00927     wxMenu *SDMenu();
00928 
00929     void OnUp( wxCommandEvent& event);
00930     void OnDown( wxCommandEvent& event);
00931 
00932     void OnRandom( wxCommandEvent& event );
00933     void OnRepeat( wxCommandEvent& event );
00934     void OnLoop ( wxCommandEvent& event );
00935 
00936     void OnActivateItem( wxTreeEvent& event );
00937     void OnKeyDown( wxTreeEvent& event );
00938     void OnNewGroup( wxCommandEvent& event );
00939 
00940     /* Popup  */
00941     wxMenu *item_popup;
00942     wxMenu *node_popup;
00943     wxTreeItemId i_wx_popup_item;
00944     int i_popup_item;
00945     int i_popup_parent;
00946     void OnPopup( wxContextMenuEvent& event );
00947     void OnPopupPlay( wxCommandEvent& event );
00948     void OnPopupPreparse( wxCommandEvent& event );
00949     void OnPopupSort( wxCommandEvent& event );
00950     void OnPopupDel( wxCommandEvent& event );
00951     void OnPopupEna( wxCommandEvent& event );
00952     void OnPopupInfo( wxCommandEvent& event );
00953     void Rebuild( vlc_bool_t );
00954 
00955     void Preparse();
00956 
00957     /* Update */
00958     void UpdateNode( playlist_item_t*, wxTreeItemId );
00959     void UpdateNodeChildren( playlist_item_t*, wxTreeItemId );
00960     void CreateNode( playlist_item_t*, wxTreeItemId );
00961     void UpdateTreeItem( wxTreeItemId );
00962 
00963     /* Search (internal) */
00964     int CountItems( wxTreeItemId);
00965     wxTreeItemId FindItem( wxTreeItemId, int );
00966     wxTreeItemId FindItemByName( wxTreeItemId, wxString,
00967                                  wxTreeItemId, vlc_bool_t *);
00968 
00969     wxTreeItemId saved_tree_item;
00970     int i_saved_id;
00971 
00972     playlist_t *p_playlist;
00973 
00974 
00975     /* Custom events */
00976     void OnPlaylistEvent( wxCommandEvent& event );
00977 
00978     DECLARE_EVENT_TABLE();
00979 
00980 
00981     /* Global widgets */
00982     wxStatusBar *statusbar;
00983     ItemInfoDialog *iteminfo_dialog;
00984 
00985     int i_update_counter;
00986 
00987     intf_thread_t *p_intf;
00988     wxTreeCtrl *treectrl;
00989     int i_current_view;
00990     vlc_bool_t b_changed_view;
00991     char **pp_sds;
00992 
00993 
00994 };
00995 
00996 /* ItemInfo Dialog */
00997 class ItemInfoDialog: public wxDialog
00998 {
00999 public:
01000     /* Constructor */
01001     ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
01002                     wxWindow *p_parent );
01003     virtual ~ItemInfoDialog();
01004 
01005     wxArrayString GetOptions();
01006 
01007 private:
01008     wxPanel *InfoPanel( wxWindow* parent );
01009     wxPanel *GroupPanel( wxWindow* parent );
01010 
01011     /* Event handlers (these functions should _not_ be virtual) */
01012     void OnOk( wxCommandEvent& event );
01013     void OnCancel( wxCommandEvent& event );
01014 
01015     void UpdateInfo();
01016 
01017     DECLARE_EVENT_TABLE();
01018 
01019     intf_thread_t *p_intf;
01020     playlist_item_t *p_item;
01021     wxWindow *p_parent;
01022 
01023     /* Controls for the iteminfo dialog box */
01024     wxPanel *info_subpanel;
01025     wxPanel *info_panel;
01026 
01027     wxPanel *group_subpanel;
01028     wxPanel *group_panel;
01029 
01030     wxTextCtrl *uri_text;
01031     wxTextCtrl *name_text;
01032 
01033     wxTreeCtrl *info_tree;
01034     wxTreeItemId info_root;
01035 
01036 };
01037 
01038 
01039 /* File Info */
01040 class FileInfo: public wxFrame
01041 {
01042 public:
01043     /* Constructor */
01044     FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
01045     virtual ~FileInfo();
01046     void UpdateFileInfo();
01047 
01048     vlc_bool_t b_need_update;
01049 
01050 private:
01051     void OnButtonClose( wxCommandEvent& event );
01052     void OnClose( wxCloseEvent& WXUNUSED(event) );
01053 
01054     DECLARE_EVENT_TABLE();
01055 
01056     intf_thread_t *p_intf;
01057     wxTreeCtrl *fileinfo_tree;
01058     wxTreeItemId fileinfo_root;
01059     wxString fileinfo_root_label;
01060 
01061 };
01062 
01063 #if wxUSE_DRAG_AND_DROP
01064 /* Drag and Drop class */
01065 class DragAndDrop: public wxFileDropTarget
01066 {
01067 public:
01068     DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE );
01069 
01070     virtual bool OnDropFiles( wxCoord x, wxCoord y,
01071                               const wxArrayString& filenames );
01072 
01073 private:
01074     intf_thread_t *p_intf;
01075     vlc_bool_t b_enqueue;
01076 };
01077 #endif
01078 } // end of wxvlc namespace
01079 
01080 /* */
01081 class WindowSettings
01082 {
01083 public:
01084     WindowSettings( intf_thread_t *_p_intf );
01085     virtual ~WindowSettings();
01086     enum
01087     {
01088         ID_SCREEN = -1,
01089         ID_MAIN,
01090         ID_PLAYLIST,
01091         ID_MESSAGES,
01092         ID_FILE_INFO,
01093         ID_BOOKMARKS,
01094         ID_VIDEO,
01095 
01096         ID_MAX,
01097     };
01098 
01099     void SetSettings( int id, bool _b_shown,
01100                       wxPoint p = wxDefaultPosition, wxSize s = wxDefaultSize );
01101     bool GetSettings( int id, bool& _b_shown, wxPoint& p, wxSize& s );
01102 
01103     void SetScreen( int i_screen_w, int i_screen_h );
01104 
01105 private:
01106     intf_thread_t *p_intf;
01107 
01108     int     i_screen_w;
01109     int     i_screen_h;
01110     bool    b_valid[ID_MAX];
01111     bool    b_shown[ID_MAX];
01112     wxPoint position[ID_MAX];
01113     wxSize  size[ID_MAX];
01114 };
01115 
01116 /* Menus */
01117 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
01118 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
01119 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
01120 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
01121 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
01122 
01123 namespace wxvlc
01124 {
01125 class MenuEvtHandler : public wxEvtHandler
01126 {
01127 public:
01128     MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
01129     virtual ~MenuEvtHandler();
01130 
01131     void OnMenuEvent( wxCommandEvent& event );
01132     void OnShowDialog( wxCommandEvent& event );
01133 
01134 private:
01135 
01136     DECLARE_EVENT_TABLE()
01137 
01138     intf_thread_t *p_intf;
01139     Interface *p_main_interface;
01140 };
01141 
01142 } // end of wxvlc namespace
01143 
01144 
01145 /*
01146  * wxWindows keeps dead locking because the timer tries to lock the playlist
01147  * when it's already locked somewhere else in the very wxWindows interface
01148  * module. Unless someone implements a "vlc_mutex_trylock", we need that.
01149  */
01150 inline void LockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl )
01151 {
01152     if( p_sys->i_playlist_usage++ == 0)
01153         vlc_mutex_lock( &p_pl->object_lock );
01154 }
01155 
01156 inline void UnlockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl )
01157 {
01158     if( --p_sys->i_playlist_usage == 0)
01159         vlc_mutex_unlock( &p_pl->object_lock );
01160 }
01161 
01162 using namespace wxvlc;
01163 

Generated on Tue Dec 20 10:14:48 2005 for vlc-0.8.4a by  doxygen 1.4.2