]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/wxwindows.h
* src/playlist/* && Makefile.am
[vlc] / modules / gui / wxwindows / wxwindows.h
index 7875907adfbcfbdcb0bd37a4f855733440457e7b..ddecc9c94a580f1b431146d04d43205cc77ea917 100644 (file)
@@ -2,7 +2,7 @@
  * wxwindows.h: private wxWindows interface description
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: wxwindows.h,v 1.51 2003/08/10 09:22:07 gbazin Exp $
+ * $Id: wxwindows.h,v 1.66 2003/10/29 17:32:54 zorglub Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+#ifdef WIN32                                                 /* mingw32 hack */
+#undef Yield
+#undef CreateDialog
+#endif
+
+/* Let vlc take care of the i18n stuff */
+#define WXINTL_NO_GETTEXT_MACRO
+
+#include <wx/wxprec.h>
+#include <wx/wx.h>
+
 #include <wx/listctrl.h>
 #include <wx/textctrl.h>
 #include <wx/notebook.h>
 #include <wx/dnd.h>
 #include <wx/treectrl.h>
 #include <wx/gauge.h>
+#include <wx/accel.h>
+#include "vlc_keys.h"
 
 DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
 
-enum
-{
-    FILE_ACCESS,
-    DISC_ACCESS,
-    NET_ACCESS,
-    SAT_ACCESS,
-    FILE_SIMPLE_ACCESS
-};
-
 class OpenDialog;
 class Playlist;
 class Messages;
@@ -55,6 +59,7 @@ class FileInfo;
 #else
 #   define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
 #endif
+#define ISUTF8 1
 
 #else // ENABLE_NLS && HAVE_GETTEXT && WIN32 && !HAVE_INCLUDED_GETTEXT
 #if wxUSE_UNICODE
@@ -62,9 +67,20 @@ class FileInfo;
 #else
 #   define wxU(ansi) ansi
 #endif
+#define ISUTF8 0
 
 #endif
 
+#define WRAPCOUNT 80
+
+#define OPEN_NORMAL 0
+#define OPEN_STREAM 1
+
+#define MODE_NONE 0
+#define MODE_GROUP 1
+#define MODE_AUTHOR 2
+#define MODE_TITLE 3
+
 wxArrayString SeparateEntries( wxString );
 
 /*****************************************************************************
@@ -137,18 +153,33 @@ public:
     virtual ~Interface();
     void TogglePlayButton( int i_playing_status );
 
+//    wxFlexGridSizer *frame_sizer;
     wxBoxSizer  *frame_sizer;
     wxStatusBar *statusbar;
 
     wxSlider    *slider;
     wxWindow    *slider_frame;
+    wxWindow    *extra_frame;
     wxStaticBox *slider_box;
 
+    vlc_bool_t b_extra;
+
+    wxStaticBox *adjust_box;
+    wxSlider *brightness_slider;
+    wxSlider *contrast_slider;
+    wxSlider *saturation_slider;
+    wxSlider *hue_slider;
+
+    wxStaticBox *other_box;
+    wxComboBox *ratio_combo;
+
     wxGauge     *volctrl;
 
 private:
+    void UpdateAcceleratorTable();
     void CreateOurMenuBar();
     void CreateOurToolBar();
+    void CreateOurExtraPanel();
     void CreateOurSlider();
     void Open( int i_access_method );
 
@@ -156,8 +187,15 @@ private:
     void OnExit( wxCommandEvent& event );
     void OnAbout( wxCommandEvent& event );
 
+    void OnOpenFileSimple( wxCommandEvent& event );
+    void OnOpenFile( wxCommandEvent& event );
+    void OnOpenDisc( wxCommandEvent& event );
+    void OnOpenNet( wxCommandEvent& event );
+    void OnOpenSat( wxCommandEvent& event );
+    void OnOpenV4L( wxCommandEvent& event );
+    void OnStream( wxCommandEvent& event );
+    void OnExtra( wxCommandEvent& event );
     void OnShowDialog( wxCommandEvent& event );
-
     void OnPlayStream( wxCommandEvent& event );
     void OnStopStream( wxCommandEvent& event );
     void OnSliderUpdate( wxScrollEvent& event );
@@ -166,6 +204,15 @@ private:
     void OnSlowStream( wxCommandEvent& event );
     void OnFastStream( wxCommandEvent& event );
 
+    void OnEnableAdjust( wxCommandEvent& event );
+    void OnHueUpdate( wxScrollEvent& event );
+    void OnContrastUpdate( wxScrollEvent& event );
+    void OnBrightnessUpdate( wxScrollEvent& event );
+    void OnSaturationUpdate( wxScrollEvent& event );
+
+    void OnRatio( wxCommandEvent& event );
+    void OnEnableVisual( wxCommandEvent& event );
+
     void OnMenuOpen( wxMenuEvent& event );
 
 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
@@ -188,8 +235,12 @@ private:
     vlc_bool_t b_video_menu;
     wxMenu *p_navig_menu;
     vlc_bool_t b_navig_menu;
+    wxMenu *p_misc_menu;
+    vlc_bool_t b_misc_menu;
 };
 
+class StreamDialog;
+
 /* Dialogs Provider */
 class DialogsProvider: public wxFrame
 {
@@ -207,6 +258,7 @@ private:
     void OnMessages( wxCommandEvent& event );
     void OnFileInfo( wxCommandEvent& event );
     void OnPreferences( wxCommandEvent& event );
+    void OnStreamDialog( wxCommandEvent& event );
 
     void OnOpenFileGeneric( wxCommandEvent& event );
     void OnOpenFileSimple( wxCommandEvent& event );
@@ -232,11 +284,13 @@ public:
     Playlist            *p_playlist_dialog;
     Messages            *p_messages_dialog;
     FileInfo            *p_fileinfo_dialog;
+    StreamDialog        *p_stream_dialog;
     wxFrame             *p_prefs_dialog;
     wxFileDialog        *p_file_generic_dialog;
 };
 
 /* Open Dialog */
+class V4LDialog;
 class SoutDialog;
 class SubsFileDialog;
 class OpenDialog: public wxFrame
@@ -244,7 +298,11 @@ class OpenDialog: public wxFrame
 public:
     /* Constructor */
     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
-                int i_access_method, int i_arg = 0 );
+                int i_access_method, int i_arg = 0  );
+
+    /* Extended Contructor */
+    OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
+                int i_access_method, int i_arg = 0 , int _i_method = 0 );
     virtual ~OpenDialog();
 
     int Show();
@@ -257,6 +315,7 @@ private:
     wxPanel *DiscPanel( wxWindow* parent );
     wxPanel *NetPanel( wxWindow* parent );
     wxPanel *SatPanel( wxWindow* parent );
+    wxPanel *V4LPanel( wxWindow* parent );
 
     void UpdateMRL( int i_access_method );
 
@@ -279,6 +338,11 @@ private:
     void OnNetPanelChange( wxCommandEvent& event );
     void OnNetTypeChange( wxCommandEvent& event );
 
+    /* Event handlers for the v4l page */
+    void OnV4LPanelChange( wxCommandEvent& event );
+    void OnV4LTypeChange( wxCommandEvent& event );
+    void OnV4LSettingsChange( wxCommandEvent& event );
+
     /* Event handlers for the stream output */
     void OnSubsFileEnable( wxCommandEvent& event );
     void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
@@ -298,6 +362,7 @@ private:
     wxWindow *p_parent;
     int i_current_access_method;
 
+    int i_method; /* Normal or for the stream dialog ? */
     wxComboBox *mrl_combo;
     wxNotebook *notebook;
 
@@ -322,6 +387,14 @@ private:
     int        i_net_ports[4];
     wxTextCtrl *net_addrs[4];
 
+    /* Controls for the v4l panel */
+    wxRadioBox *video_type;
+    wxTextCtrl *video_device;
+    wxSpinCtrl *video_channel;
+    wxButton *v4l_button;
+    V4LDialog *v4l_dialog;
+    wxArrayString v4l_mrl;
+
     /* Controls for the subtitles file */
     wxButton *subsfile_button;
     wxCheckBox *subsfile_checkbox;
@@ -341,7 +414,115 @@ private:
     wxFileDialog *demuxdump_dialog;
 };
 
+enum
+{
+    FILE_ACCESS = 0,
+    DISC_ACCESS,
+    NET_ACCESS,
+    SAT_ACCESS,
+    V4L_ACCESS,
+    FILE_SIMPLE_ACCESS
+};
+
+/* V4L Dialog */
+class V4LDialog: public wxDialog
+{
+public:
+    /* Constructor */
+    V4LDialog( intf_thread_t *p_intf, wxWindow *p_parent );
+    virtual ~V4LDialog();
+
+    wxArrayString GetOptions();
+
+private:
+    void UpdateMRL();
+    wxPanel *AudioPanel( wxWindow* parent );
+    wxPanel *CommonPanel( wxWindow* parent );
+    wxPanel *BitratePanel( wxWindow* parent );
+    void    ParseMRL();
+
+    /* Event handlers (these functions should _not_ be virtual) */
+    void OnOk( wxCommandEvent& event );
+    void OnCancel( wxCommandEvent& event );
+    void OnMRLChange( wxCommandEvent& event );
+    void OnAudioEnable( wxCommandEvent& event );
+    void OnAudioChannel( wxCommandEvent& event );
+    void OnSizeEnable( wxCommandEvent& event );
+    void OnSize( wxCommandEvent& event );
+    void OnNormEnable( wxCommandEvent& event );
+    void OnNorm( wxCommandEvent& event );
+    void OnFrequencyEnable( wxCommandEvent& event );
+    void OnFrequency( wxCommandEvent& event );
+    void OnBitrateEnable( wxCommandEvent& event );
+    void OnBitrate( wxCommandEvent& event );
+    void OnMaxBitrateEnable( wxCommandEvent& event );
+    void OnMaxBitrate( wxCommandEvent& event );
+
+    DECLARE_EVENT_TABLE();
+
+    intf_thread_t *p_intf;
+    wxWindow *p_parent;
+
+    wxComboBox *mrl_combo;
+
+    int i_access_type;
+
+    /* Controls for the v4l advanced options */
+    wxPanel *common_subpanel;
+    wxPanel *common_panel;
+    wxCheckBox *size_checkbox;
+    wxComboBox *size_combo;
+    wxCheckBox *norm_checkbox;
+    wxComboBox *norm_combo;
+    wxCheckBox *frequency_checkbox;
+    wxSpinCtrl *frequency;
+
+    wxPanel *audio_subpanel;
+    wxPanel *audio_panel;
+    wxCheckBox *audio_checkbox;
+    wxTextCtrl *audio_device;
+    wxSpinCtrl *audio_channel;
+
+    wxPanel *bitrate_subpanel;
+    wxPanel *bitrate_panel;
+    wxCheckBox *bitrate_checkbox;
+    wxSpinCtrl *bitrate;
+    wxCheckBox *maxbitrate_checkbox;
+    wxSpinCtrl *maxbitrate;
+
+};
+
 /* Stream output Dialog */
+enum
+{
+    PLAY_ACCESS_OUT = 0,
+    FILE_ACCESS_OUT,
+    HTTP_ACCESS_OUT,
+    MMSH_ACCESS_OUT,
+    UDP_ACCESS_OUT,
+    RTP_ACCESS_OUT,
+    ACCESS_OUT_NUM
+};
+
+enum
+{
+    TS_ENCAPSULATION = 0,
+    PS_ENCAPSULATION,
+    MPEG1_ENCAPSULATION,
+    OGG_ENCAPSULATION,
+    ASF_ENCAPSULATION,
+    AVI_ENCAPSULATION,
+    MP4_ENCAPSULATION,
+    MOV_ENCAPSULATION,
+    ENCAPS_NUM
+};
+
+enum
+{
+    ANN_MISC_SOUT = 0,
+    MISC_SOUT_NUM
+};
+
 class SoutDialog: public wxDialog
 {
 public:
@@ -372,9 +553,9 @@ private:
     /* Event handlers for the net access output */
     void OnNetChange( wxCommandEvent& event );
 
-    /* Event specific to the sap address */
-    void OnSAPAddrChange( wxCommandEvent& event );
-    
+    /* Event specific to the announce address */
+    void OnAnnounceAddrChange( wxCommandEvent& event );
+
     /* Event handlers for the encapsulation panel */
     void OnEncapsulationChange( wxCommandEvent& event );
 
@@ -384,6 +565,7 @@ private:
 
     /* Event handlers for the misc panel */
     void OnSAPMiscChange( wxCommandEvent& event );
+    void OnSLPMiscChange( wxCommandEvent& event );
 
     DECLARE_EVENT_TABLE();
 
@@ -393,22 +575,23 @@ private:
     wxComboBox *mrl_combo;
 
     /* Controls for the access outputs */
-    wxPanel *access_subpanels[5];
-    wxCheckBox *access_checkboxes[5];
+    wxPanel *access_subpanels[ACCESS_OUT_NUM];
+    wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
 
     int i_access_type;
 
     wxComboBox *file_combo;
-    wxSpinCtrl *net_ports[5];
-    wxTextCtrl *net_addrs[5];
+    wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
+    wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
 
     /* Controls for the SAP announces */
-    wxPanel *misc_subpanels[1];
+    wxPanel *misc_subpanels[MISC_SOUT_NUM];
     wxCheckBox *sap_checkbox;
-    wxTextCtrl *sap_addr;
-                            
+    wxCheckBox *slp_checkbox;
+    wxTextCtrl *announce_addr;
+
     /* Controls for the encapsulation */
-    wxRadioButton *encapsulation_radios[5];
+    wxRadioButton *encapsulation_radios[ENCAPS_NUM];
     int i_encapsulation_type;
 
     /* Controls for transcoding */
@@ -446,6 +629,36 @@ private:
     wxWindow *p_parent;
 };
 
+/* Stream */
+class StreamDialog: public wxFrame
+{
+public:
+    /* Constructor */
+    StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent );
+    virtual ~StreamDialog();
+
+private:
+    void OnClose( wxCommandEvent& event );
+    void OnOpen( wxCommandEvent& event );
+    void OnSout( wxCommandEvent& event );
+    void OnStart( wxCommandEvent& event );
+
+    DECLARE_EVENT_TABLE();
+
+    intf_thread_t *p_intf;
+
+    wxStaticText *step2_label;
+    wxStaticText *step3_label;
+    wxButton *sout_button;
+    wxButton *start_button;
+    wxArrayString mrl;
+    wxArrayString sout_mrl;
+    OpenDialog *p_open_dialog;
+    SoutDialog *p_sout_dialog;
+};
+
+
+
 /* Preferences Dialog */
 class PrefsTreeCtrl;
 class PrefsDialog: public wxFrame
@@ -463,6 +676,7 @@ private:
     void OnCancel( wxCommandEvent& event );
     void OnSave( wxCommandEvent& event );
     void OnResetAll( wxCommandEvent& event );
+    void OnAdvanced( wxCommandEvent& event );
 
     DECLARE_EVENT_TABLE();
 
@@ -478,12 +692,12 @@ public:
     /* Constructor */
     Messages( intf_thread_t *p_intf, wxWindow *p_parent );
     virtual ~Messages();
+    bool Show( bool show = TRUE );
     void UpdateLog();
 
 private:
     /* Event handlers (these functions should _not_ be virtual) */
     void OnClose( wxCommandEvent& event );
-    void OnVerbose( wxCommandEvent& event );
     void OnClear( wxCommandEvent& event );
     void OnSaveLog( wxCommandEvent& event );
 
@@ -497,11 +711,13 @@ private:
     wxTextAttr *dbg_attr;
 
     wxFileDialog *save_log_dialog;
-    
+
     vlc_bool_t b_verbose;
 };
 
 /* Playlist */
+class ItemInfoDialog;
+class NewGroup;
 class Playlist: public wxFrame
 {
 public:
@@ -522,22 +738,115 @@ private:
     void OnAddFile( wxCommandEvent& event );
     void OnAddMRL( wxCommandEvent& event );
     void OnClose( wxCommandEvent& event );
+    void OnSearch( wxCommandEvent& event );
+    void OnEnDis( wxCommandEvent& event );
+    void OnInfos( wxCommandEvent& event );
+    void OnSearchTextChange( wxCommandEvent& event );
     void OnOpen( wxCommandEvent& event );
     void OnSave( wxCommandEvent& event );
+
+    void OnSort( wxCommandEvent& event );
+
+    void OnUp( wxCommandEvent& event);
+    void OnDown( wxCommandEvent& event);
+
+    void OnEnableSelection( wxCommandEvent& event );
+    void OnDisableSelection( wxCommandEvent& event );
     void OnInvertSelection( wxCommandEvent& event );
     void OnDeleteSelection( wxCommandEvent& event );
     void OnSelectAll( wxCommandEvent& event );
+    void OnRandom( wxCommandEvent& event );
+    void OnRepeat( wxCommandEvent& event );
+    void OnLoop ( wxCommandEvent& event );
     void OnActivateItem( wxListEvent& event );
     void OnKeyDown( wxListEvent& event );
+    void OnNewGroup( wxCommandEvent& event );
+
     void Rebuild();
 
+    wxTextCtrl *search_text;
+    wxButton *search_button;
     DECLARE_EVENT_TABLE();
 
+
+    ItemInfoDialog *iteminfo_dialog;
+
     intf_thread_t *p_intf;
     wxListView *listview;
+    wxTreeCtrl *treeview;
     int i_update_counter;
+    int i_sort_mode;
+};
+
+
+class NewGroup: public wxDialog
+{
+public:
+    /* Constructor */
+    NewGroup( intf_thread_t *p_intf, wxWindow *p_parent );
+    virtual ~NewGroup();
+
+private:
+
+    /* Event handlers (these functions should _not_ be virtual) */
+    void OnOk( wxCommandEvent& event );
+    void OnCancel( wxCommandEvent& event );
+
+    DECLARE_EVENT_TABLE();
+
+    intf_thread_t *p_intf;
+    wxTextCtrl *groupname;
+
+protected:
+    friend class Playlist;
+    friend class ItemInfoDialog;
+    char *psz_name;
+};
+
+
+/* ItemInfo Dialog */
+class ItemInfoDialog: public wxDialog
+{
+public:
+    /* Constructor */
+    ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
+                    wxWindow *p_parent );
+    virtual ~ItemInfoDialog();
+
+    wxArrayString GetOptions();
+
+private:
+    wxPanel *InfoPanel( wxWindow* parent );
+    wxPanel *GroupPanel( wxWindow* parent );
+
+    /* Event handlers (these functions should _not_ be virtual) */
+    void OnOk( wxCommandEvent& event );
+    void OnCancel( wxCommandEvent& event );
+    void OnNewGroup( wxCommandEvent& event );
+
+    DECLARE_EVENT_TABLE();
+
+    intf_thread_t *p_intf;
+    playlist_item_t *p_item;
+    wxWindow *p_parent;
+
+    /* Controls for the iteminfo dialog box */
+    wxPanel *info_subpanel;
+    wxPanel *info_panel;
+
+    wxPanel *group_subpanel;
+    wxPanel *group_panel;
+
+    wxTextCtrl *uri_text;
+    wxTextCtrl *name_text;
+    wxTextCtrl *author_text;
+
+    wxCheckBox *enabled_checkbox;
+    wxComboBox *group_combo;
+    int ids_array[100];
 };
 
+
 /* File Info */
 class FileInfo: public wxFrame
 {
@@ -551,7 +860,7 @@ private:
     void OnClose( wxCommandEvent& event );
 
     DECLARE_EVENT_TABLE();
-   
+
     intf_thread_t *p_intf;
     wxTreeCtrl *fileinfo_tree;
     wxTreeItemId fileinfo_root;
@@ -559,6 +868,7 @@ private:
 
 };
 
+
 #if !defined(__WXX11__)
 /* Drag and Drop class */
 class DragAndDrop: public wxFileDropTarget
@@ -580,6 +890,7 @@ void PopupMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
 wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
 wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
 wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
+wxMenu *MiscMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
 
 class MenuEvtHandler : public wxEvtHandler
 {
@@ -622,3 +933,51 @@ private:
 
     int  i_item_id;
 };
+
+static inline int ConvertHotkeyModifiers( int i_hotkey )
+{
+    int i_accel_flags = 0;
+    if( i_hotkey & KEY_MODIFIER_ALT ) i_accel_flags |= wxACCEL_ALT;
+    if( i_hotkey & KEY_MODIFIER_CTRL ) i_accel_flags |= wxACCEL_CTRL;
+    if( i_hotkey & KEY_MODIFIER_SHIFT ) i_accel_flags |= wxACCEL_SHIFT;
+    return i_accel_flags;
+}
+
+static inline int ConvertHotkey( int i_hotkey )
+{
+    int i_key = i_hotkey & ~KEY_MODIFIER;
+    if( i_key & KEY_ASCII ) return i_key & KEY_ASCII;
+    else if( i_key & KEY_SPECIAL )
+    {
+        switch ( i_key )
+        {
+        case KEY_LEFT: return WXK_LEFT;
+        case KEY_RIGHT: return WXK_RIGHT;
+        case KEY_UP: return WXK_UP;
+        case KEY_DOWN: return WXK_DOWN;
+        case KEY_SPACE: return WXK_SPACE;
+        case KEY_ENTER: return WXK_RETURN;
+        case KEY_F1: return WXK_F1;
+        case KEY_F2: return WXK_F2;
+        case KEY_F3: return WXK_F3;
+        case KEY_F4: return WXK_F4;
+        case KEY_F5: return WXK_F5;
+        case KEY_F6: return WXK_F6;
+        case KEY_F7: return WXK_F7;
+        case KEY_F8: return WXK_F8;
+        case KEY_F9: return WXK_F9;
+        case KEY_F10: return WXK_F10;
+        case KEY_F11: return WXK_F11;
+        case KEY_F12: return WXK_F12;
+        case KEY_HOME: return WXK_HOME;
+        case KEY_END: return WXK_HOME;
+        case KEY_MENU: return WXK_MENU;
+        case KEY_ESC: return WXK_ESCAPE;
+        case KEY_PAGEUP: return WXK_PRIOR;
+        case KEY_PAGEDOWN: return WXK_NEXT;
+        case KEY_TAB: return WXK_TAB;
+        case KEY_BACKSPACE: return WXK_BACK;
+        }
+    }
+    return 0;
+}