]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwidgets/wxwidgets.cpp
WxWidgets: use wraptext in UTF-8 mode as that is the codeset for gettext
[vlc] / modules / gui / wxwidgets / wxwidgets.cpp
index 2b07df7166b487b55b682b5e2d869854b7953d5c..31c2e8b290e2b5f62bca4e076e03c090842562fa 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * wxwindows.cpp : wxWidgets plugin for vlc
+ * wxwidgets.cpp : wxWidgets plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2005 the VideoLAN team
  * $Id$
@@ -18,7 +18,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
 #   include <locale.h>
 #endif
 
-#include "wxwidgets.h"
+#include "interface.hpp"
 
 /* Temporary hack */
 #if defined(WIN32) && defined(_WX_INIT_H_)
 #if (wxMAJOR_VERSION <= 2) && (wxMINOR_VERSION <= 5) && (wxRELEASE_NUMBER < 3)
-/* Hack to detect wxWindows 2.5 which has a different wxEntry() prototype */
+/* Hack to detect wxWidgets 2.5 which has a different wxEntry() prototype */
 extern int wxEntry( HINSTANCE hInstance, HINSTANCE hPrevInstance = NULL,
                     char *pCmdLine = NULL, int nCmdShow = SW_NORMAL );
 #endif
 #endif
 
-#ifdef SYS_DARWIN
-int wxEntry( int argc, char *argv[] , bool enterLoop = TRUE );
-#endif
-
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
@@ -93,6 +89,8 @@ private:
 #define BOOKMARKS_TEXT N_("Show bookmarks dialog")
 #define BOOKMARKS_LONGTEXT N_("Show bookmarks dialog when the interface " \
     "starts.")
+#define EXTENDED_TEXT N_("Show extended GUI")
+#define EXTENDED_LONGTEXT N_("Show extended GUI")
 #define TASKBAR_TEXT N_("Show taskbar entry")
 #define TASKBAR_LONGTEXT N_("Show taskbar entry")
 #define MINIMAL_TEXT N_("Minimal interface")
@@ -120,23 +118,35 @@ vlc_module_begin();
     add_shortcut( "wxwidgets" );
     set_program( "wxvlc" );
 
-    add_bool( "wxwin-embed", 1, NULL,
+    add_bool( "wx-embed", 1, NULL,
               EMBED_TEXT, EMBED_LONGTEXT, VLC_FALSE );
-    add_bool( "wxwin-bookmarks", 0, NULL,
+    add_deprecated( "wxwin-enbed", VLC_FALSE); /*Deprecated since 0.8.4*/
+    add_bool( "wx-bookmarks", 0, NULL,
               BOOKMARKS_TEXT, BOOKMARKS_LONGTEXT, VLC_FALSE );
-    add_bool( "wxwin-taskbar", 1, NULL,
+    add_deprecated( "wxwin-bookmarks", VLC_FALSE); /*Deprecated since 0.8.4*/
+    add_bool( "wx-taskbar", 1, NULL,
               TASKBAR_TEXT, TASKBAR_LONGTEXT, VLC_FALSE );
-    add_bool( "wxwin-minimal", 0, NULL,
+    add_deprecated( "wxwin-taskbar", VLC_FALSE); /*Deprecated since 0.8.4*/
+    add_bool( "wx-extended", 0, NULL,
+              EXTENDED_TEXT, EXTENDED_LONGTEXT, VLC_FALSE );
+    add_bool( "wx-minimal", 0, NULL,
               MINIMAL_TEXT, MINIMAL_LONGTEXT, VLC_TRUE );
-    add_bool( "wxwin-autosize", 1, NULL,
+    add_deprecated( "wxwin-minimal", VLC_FALSE); /*Deprecated since 0.8.4*/
+    add_bool( "wx-autosize", 1, NULL,
               SIZE_TO_VIDEO_TEXT, SIZE_TO_VIDEO_LONGTEXT, VLC_TRUE );
+    add_deprecated( "wxwin-autosize", VLC_FALSE); /*Deprecated since 0.8.4*/
+/* wxCocoa pretends to support this, but at least 2.6.x doesn't */
+#ifndef __APPLE__
 #ifdef wxHAS_TASK_BAR_ICON
-    add_bool( "wxwin-systray", 0, NULL,
+    add_bool( "wx-systray", 0, NULL,
               SYSTRAY_TEXT, SYSTRAY_LONGTEXT, VLC_FALSE );
+    add_deprecated( "wxwin-systray", VLC_FALSE); /*Deprecated since 0.8.4*/
+#endif
 #endif
-    add_string( "wxwin-config-last", NULL, NULL,
+    add_string( "wx-config-last", NULL, NULL,
                 "last config", "last config", VLC_TRUE );
         change_autosave();
+    add_deprecated( "wxwin-config-last", VLC_FALSE); /*Deprecated since 0.8.4*/
 
     add_submodule();
     set_description( _("wxWidgets dialogs provider") );
@@ -166,15 +176,13 @@ static int Open( vlc_object_t *p_this )
 
     p_intf->pf_run = Run;
 
-    p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
+    p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL );
 
-    /* Initialize wxWindows thread */
+    /* Initialize wxWidgets thread */
     p_intf->p_sys->b_playing = 0;
 
     p_intf->p_sys->p_input = NULL;
     p_intf->p_sys->i_playing = -1;
-    p_intf->p_sys->b_slider_free = 1;
-    p_intf->p_sys->i_slider_pos = p_intf->p_sys->i_slider_oldpos = 0;
 
     p_intf->p_sys->p_popup_menu = NULL;
     p_intf->p_sys->p_video_window = NULL;
@@ -185,7 +193,7 @@ static int Open( vlc_object_t *p_this )
     p_intf->b_play = VLC_TRUE;
 
     p_intf->p_sys->b_video_autosize =
-        config_GetInt( p_intf, "wxwin-autosize" );
+        config_GetInt( p_intf, "wx-autosize" );
 
     return VLC_SUCCESS;
 }
@@ -233,7 +241,7 @@ static void Close( vlc_object_t *p_this )
 }
 
 /*****************************************************************************
- * Run: wxWindows thread
+ * Run: wxWidgets thread
  *****************************************************************************/
 
 //when is this called?
@@ -253,7 +261,7 @@ static void Run( intf_thread_t *p_intf )
     {
         /* The module is used in dialog provider mode */
 
-        /* Create a new thread for wxWindows */
+        /* Create a new thread for wxWidgets */
         if( vlc_thread_create( p_intf, "Skins Dialogs Thread",
                                Init, 0, VLC_TRUE ) )
         {
@@ -275,7 +283,7 @@ static void Init( intf_thread_t *p_intf )
     int i_args = 1;
 #endif
 
-    /* Hack to pass the p_intf pointer to the new wxWindow Instance object */
+    /* Hack to pass the p_intf pointer to the new wxWidgets Instance object */
 #ifdef wxTheApp
     wxApp::SetInstance( new Instance( p_intf ) );
 #else
@@ -296,6 +304,7 @@ static void Init( intf_thread_t *p_intf )
 #else
     wxEntry( i_args, p_args );
 #endif
+    setlocale( LC_NUMERIC, "C" );
 }
 
 /* following functions are local */
@@ -324,12 +333,9 @@ IMPLEMENT_APP_NO_MAIN(Instance)
 bool Instance::OnInit()
 {
     /* Initialization of i18n stuff.
-     * Usefull for things we don't have any control over, like wxWindows
+     * Usefull for things we don't have any control over, like wxWidgets
      * provided facilities (eg. open file dialog) */
-    locale.Init( wxLANGUAGE_DEFAULT );
-
-    /* FIXME: The stream output mrl parsing uses ',' already so we want to
-     * keep the default '.' for floating point numbers. */
+    locale.Init( wxLANGUAGE_DEFAULT, wxLOCALE_LOAD_DEFAULT );
     setlocale( LC_NUMERIC, "C" );
 
     /* Load saved window settings */
@@ -343,7 +349,7 @@ bool Instance::OnInit()
     {
         /* The module is used in interface mode */
         long style = wxDEFAULT_FRAME_STYLE;
-        if ( ! config_GetInt( p_intf, "wxwin-taskbar" ) )
+        if ( ! config_GetInt( p_intf, "wx-taskbar" ) )
         {
             style = wxDEFAULT_FRAME_STYLE|wxFRAME_NO_TASKBAR;
         }
@@ -450,7 +456,7 @@ WindowSettings::WindowSettings( intf_thread_t *_p_intf )
     if( p_intf->pf_show_dialog ) return;
 
     /* Parse the configuration */
-    psz_org = psz = config_GetPsz( p_intf, "wxwin-config-last" );
+    psz_org = psz = config_GetPsz( p_intf, "wx-config-last" );
     if( !psz || *psz == '\0' ) return;
 
     msg_Dbg( p_intf, "Using last windows config '%s'", psz );
@@ -557,7 +563,7 @@ WindowSettings::~WindowSettings( )
                                      size[i].x, size[i].y );
     }
 
-    config_PutPsz( p_intf, "wxwin-config-last", sCfg.mb_str() );
+    config_PutPsz( p_intf, "wx-config-last", sCfg.mb_str() );
 }
 
 void WindowSettings::SetScreen( int i_screen_w, int i_screen_h )