]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/wxwindows.h
* modules/gui/wxwindows/menus.cpp: release the wxMutexGui lock before triggering...
[vlc] / modules / gui / wxwindows / wxwindows.h
index 214f4967782b24ed3cf276d3467f4c8ed733c307..a9ff131c338cd98bf64896a9ff80e6c68abf3a45 100644 (file)
@@ -2,9 +2,9 @@
  * wxwindows.h: private wxWindows interface description
  *****************************************************************************
  * Copyright (C) 1999-2004 VideoLAN
- * $Id: wxwindows.h,v 1.89 2004/02/16 17:14:39 zorglub Exp $
+ * $Id$
  *
- * Authors: Gildas Bazin <gbazin@netcourrier.com>
+ * Authors: Gildas Bazin <gbazin@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include <wx/gauge.h>
 #include <wx/accel.h>
 #include <wx/checkbox.h>
+#include <wx/wizard.h>
 #include "vlc_keys.h"
 
-DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
+/* Hmmm, work-around for newest wxWin */
+#ifdef wxStaticCastEvent
+#   undef wxStaticCastEvent
+#   define wxStaticCastEvent(type, val) ((type)(val))
+#endif
 
-class OpenDialog;
-class Playlist;
-class Messages;
-class FileInfo;
+DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
+DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
 
 #define SLIDER_MAX_POS 10000
 
 /* wxU is used to convert ansi/utf8 strings to unicode strings (wchar_t) */
-#if defined( ENABLE_NLS ) && defined( HAVE_GETTEXT ) && \
-    defined( WIN32 ) && !defined( HAVE_INCLUDED_GETTEXT )
+#if defined( ENABLE_NLS ) && defined( ENABLE_UTF8 )
 #if wxUSE_UNICODE
 #   define wxU(utf8) wxString(utf8, wxConvUTF8)
 #else
@@ -62,7 +64,7 @@ class FileInfo;
 #endif
 #define ISUTF8 1
 
-#else // ENABLE_NLS && HAVE_GETTEXT && WIN32 && !HAVE_INCLUDED_GETTEXT
+#else // ENABLE_NLS && ENABLE_UTF8
 #if wxUSE_UNICODE
 #   define wxU(ansi) wxString(ansi, *wxConvCurrent)
 #else
@@ -90,7 +92,10 @@ class FileInfo;
 #define MODE_AUTHOR 2
 #define MODE_TITLE 3
 
-wxArrayString SeparateEntries( wxString );
+class DialogsProvider;
+class PrefsTreeCtrl;
+class AutoBuiltPanel;
+class VideoWindow;
 
 /*****************************************************************************
  * intf_sys_t: description and status of wxwindows interface
@@ -125,17 +130,41 @@ struct intf_sys_t
     /* Popup menu */
     wxMenu              *p_popup_menu;
 
+    /* Hotkeys */
+    int                 i_first_hotkey_event;
+    int                 i_hotkeys;
+
+    /* Embedded vout */
+    VideoWindow         *p_video_window;
+    wxBoxSizer          *p_video_sizer;
 };
 
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
+wxArrayString SeparateEntries( wxString );
+wxWindow *VideoWindow( intf_thread_t *p_intf, wxWindow *p_parent );
+wxWindow *BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent );
+wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
+
+namespace wxvlc
+{
+class Interface;
+class OpenDialog;
+class SoutDialog;
+class SubsFileDialog;
+class Playlist;
+class Messages;
+class FileInfo;
+class StreamDialog;
+class WizardDialog;
+class ItemInfoDialog;
+class NewGroup;
+class ExportPlaylist;
 
 /*****************************************************************************
  * Classes declarations.
  *****************************************************************************/
-class Interface;
-
 /* Timer */
 class Timer: public wxTimer
 {
@@ -151,6 +180,7 @@ private:
     Interface *p_main_interface;
     int i_old_playing_status;
     int i_old_rate;
+    vlc_bool_t b_old_seekable;
 };
 
 /* Main Interface */
@@ -161,19 +191,19 @@ public:
     Interface( intf_thread_t *p_intf );
     virtual ~Interface();
     void TogglePlayButton( int i_playing_status );
+    void Update();
 
-//    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;
+    wxButton *restoredefaults_button;
     wxSlider *brightness_slider;
     wxSlider *contrast_slider;
     wxSlider *saturation_slider;
@@ -186,10 +216,10 @@ public:
     wxGauge     *volctrl;
 
 private:
-    void UpdateAcceleratorTable();
+    void SetupHotkeys();
     void CreateOurMenuBar();
     void CreateOurToolBar();
-    void CreateOurExtraPanel();
+    void CreateOurExtendedPanel();
     void CreateOurSlider();
     void Open( int i_access_method );
 
@@ -202,9 +232,8 @@ private:
     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 OnExtended( wxCommandEvent& event );
+    void OnBookmarks( wxCommandEvent& event );
     void OnShowDialog( wxCommandEvent& event );
     void OnPlayStream( wxCommandEvent& event );
     void OnStopStream( wxCommandEvent& event );
@@ -215,11 +244,8 @@ private:
     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 OnGammaUpdate( wxScrollEvent& event );
+    void OnRestoreDefaults( wxCommandEvent& event);
+    void OnAdjustUpdate( wxScrollEvent& event );
 
     void OnRatio( wxCommandEvent& event );
     void OnEnableVisual( wxCommandEvent& event );
@@ -231,6 +257,8 @@ private:
 #endif
     void OnContextMenu(wxMouseEvent& event);
 
+    void OnControlEvent( wxCommandEvent& event );
+
     DECLARE_EVENT_TABLE();
 
     Timer *timer;
@@ -241,72 +269,14 @@ private:
 
     /* For auto-generated menus */
     wxMenu *p_settings_menu;
-    vlc_bool_t b_settings_menu;
     wxMenu *p_audio_menu;
-    vlc_bool_t b_audio_menu;
     wxMenu *p_video_menu;
-    vlc_bool_t b_video_menu;
     wxMenu *p_navig_menu;
-    vlc_bool_t b_navig_menu;
-};
-
-class StreamDialog;
-
-/* Dialogs Provider */
-class DialogsProvider: public wxFrame
-{
-public:
-    /* Constructor */
-    DialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
-    virtual ~DialogsProvider();
-
-private:
-    void Open( int i_access_method, int i_arg );
-
-    /* Event handlers (these functions should _not_ be virtual) */
-    void OnExit( wxCommandEvent& event );
-    void OnPlaylist( wxCommandEvent& event );
-    void OnMessages( wxCommandEvent& event );
-    void OnFileInfo( wxCommandEvent& event );
-    void OnPreferences( wxCommandEvent& event );
-    void OnStreamDialog( wxCommandEvent& event );
-
-    void OnOpenFileGeneric( wxCommandEvent& event );
-    void OnOpenFileSimple( wxCommandEvent& event );
-    void OnOpenFile( wxCommandEvent& event );
-    void OnOpenDisc( wxCommandEvent& event );
-    void OnOpenNet( wxCommandEvent& event );
-    void OnOpenSat( wxCommandEvent& event );
-
-    void OnPopupMenu( wxCommandEvent& event );
-
-    void OnIdle( wxIdleEvent& event );
-
-    void OnExitThread( wxCommandEvent& event );
-
-    DECLARE_EVENT_TABLE();
-
-    intf_thread_t *p_intf;
-
-public:
-    /* Secondary windows */
-    OpenDialog          *p_open_dialog;
-    wxFileDialog        *p_file_dialog;
-    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 AutoBuiltPanel;
 WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel);
-class V4LDialog;
-class SoutDialog;
-class SubsFileDialog;
-class OpenDialog: public wxFrame
+class OpenDialog: public wxDialog
 {
 public:
     /* Constructor */
@@ -330,7 +300,6 @@ private:
     wxPanel *FilePanel( wxWindow* parent );
     wxPanel *DiscPanel( wxWindow* parent );
     wxPanel *NetPanel( wxWindow* parent );
-    wxPanel *V4LPanel( wxWindow* parent );
 
     ArrayOfAutoBuiltPanel input_tab_array;
 
@@ -354,11 +323,6 @@ 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) );
@@ -408,14 +372,6 @@ private:
     wxTextCtrl *net_addrs[4];
     wxCheckBox *net_ipv6;
 
-    /* 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;
@@ -434,81 +390,11 @@ enum
     FILE_ACCESS = 0,
     DISC_ACCESS,
     NET_ACCESS,
-#ifndef WIN32
-    V4L_ACCESS,
-#endif
-    MAX_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 OnAudioChange( 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;
 
+    /* Auto-built panels */
+    CAPTURE_ACCESS
 };
+#define MAX_ACCESS CAPTURE_ACCESS
 
 /* Stream output Dialog */
 enum
@@ -683,10 +569,35 @@ private:
     SoutDialog *p_sout_dialog;
 };
 
+/* Wizard */
+class WizardDialog : public wxWizard
+{
+public:
+    /* Constructor */
+    WizardDialog( intf_thread_t *p_intf, wxWindow *p_parent );
+    virtual ~WizardDialog();
+    void SetTranscode( char *vcodec, int vb, char *acodec,int ab);
+    void SetMrl( const char *mrl );
+    void SetPartial( int, int );
+    void SetStream( char *method, char *address );
+    void SetTranscodeOut( char *address );
+    void SetAction( int i_action );
+    int  GetAction();
+    void SetMux( char *mux );
+    void Run();
+    int i_action;
+
+private:
+    int vb,ab;
+    int i_from, i_to;
+    char *vcodec,*acodec,*method,*address,*mrl,*mux;
+    DECLARE_EVENT_TABLE();
+
+    intf_thread_t *p_intf;
+};
 
 
 /* Preferences Dialog */
-class PrefsTreeCtrl;
 class PrefsDialog: public wxFrame
 {
 public:
@@ -742,9 +653,6 @@ private:
 };
 
 /* Playlist */
-class ItemInfoDialog;
-class NewGroup;
-class ExportPlaylist;
 class Playlist: public wxFrame
 {
 public:
@@ -757,7 +665,6 @@ public:
     void UpdateItem( int );
 
     bool b_need_update;
-    vlc_mutex_t lock;
 
 private:
     void DeleteItem( int item );
@@ -800,6 +707,9 @@ private:
     void OnPopupInfo( wxMenuEvent& event );
     void Rebuild();
 
+    /* Custom events */
+    void OnPlaylistEvent( wxCommandEvent& event );
+
     wxTextCtrl *search_text;
     wxButton *search_button;
     DECLARE_EVENT_TABLE();
@@ -822,7 +732,6 @@ private:
     int i_duration_sorted;
 };
 
-
 class NewGroup: public wxDialog
 {
 public:
@@ -916,8 +825,7 @@ private:
 
 };
 
-
-#if !defined(__WXX11__)
+#if wxUSE_DRAG_AND_DROP
 /* Drag and Drop class */
 class DragAndDrop: public wxFileDropTarget
 {
@@ -932,15 +840,17 @@ private:
     vlc_bool_t b_enqueue;
 };
 #endif
+} // end of wxvlc namespace
 
 /* Menus */
-void PopupMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
-                const wxPoint& pos );
-wxMenu *SettingsMenu( 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 );
+void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
+wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
+wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
+wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
+wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
 
+namespace wxvlc
+{
 class MenuEvtHandler : public wxEvtHandler
 {
 public:
@@ -958,75 +868,5 @@ private:
     Interface *p_main_interface;
 };
 
-class Menu: public wxMenu
-{
-public:
-    /* Constructor */
-    Menu( intf_thread_t *p_intf, wxWindow *p_parent, int i_count,
-          char **ppsz_names, int *pi_objects, int i_start_id );
-    virtual ~Menu();
-
-private:
-    /* Event handlers (these functions should _not_ be virtual) */
-    void OnClose( wxCommandEvent& event );
-    void OnShowDialog( wxCommandEvent& event );
-    void OnEntrySelected( wxCommandEvent& event );
-
-    wxMenu *Menu::CreateDummyMenu();
-    void   Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
-    wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t * );
-
-    DECLARE_EVENT_TABLE();
-
-    intf_thread_t *p_intf;
-
-    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;
-}
+} // end of wxvlc namespace
+using namespace wxvlc;