]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwidgets/wxwidgets.hpp
Removes trailing spaces. Removes tabs.
[vlc] / modules / gui / wxwidgets / wxwidgets.hpp
index c6f518e2984975b77206a63c443862605daf7bf5..9bbb38e8f60aece99aebab81ab832efd9b40aade 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * wxwidgets.hpp: Common headers for the wxwidges interface
+ * wxwidgets.hpp: Common headers for the wxwidgets interface
  *****************************************************************************
  * Copyright (C) 1999-2005 the VideoLAN team
  * $Id$
@@ -38,9 +38,9 @@
 #define WXINTL_NO_GETTEXT_MACRO
 
 #include <vlc/vlc.h>
-#include <vlc/intf.h>
-#include "charset.h"
-
+#include <vlc_interface.h>
+#include "vlc_charset.h"
+#include <vlc_playlist.h>
 #include <wx/wx.h>
 #define SLIDER_MAX_POS 10000
 
@@ -88,24 +88,28 @@ DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
 
 /*
  * wxFromLocale() is a replacement for LibVLC FromLocale() that accepts
- * a wxString. It was originally introduced because wxString::mb_str()
- * sucks on Linux with Unicode wxWidgets. It then turned out wxWidgets
- * did not support wc_str() when Unicode was not enabled.
- *
- * But heh, that's wxWidgets; you can't really expect it to actually
- * work, let alone work like its documentation says.
+ * a wxString.
  *
- * Unicode needs to be enabled to catch non-ANSI characters on Windows
- * through wxString::wc_str(); they are lost when using mb_str().
+ * Note that if you want to use non-ANSI code page characters on Windows,
+ * you MUST build WxWidgets in “Unicode” mode. wxConvUTF8
  */
-#if defined( wxUSE_UNICODE ) && defined( WIN32 )
-#   define wxFromLocale(wxstring) FromWide((wxstring).wc_str())
-#   define wxLocaleFree(string) free(string)
+static inline char *wxFromLocale (const wxString& string)
+{
+#if defined( wxUSE_UNICODE )
+# if defined( WIN32 )
+    return FromWide ((const wchar_t *)string.c_str());
+#  define wxLocaleFree free
+# else
+    return FromLocaleDup (string.mb_str());
+#  define wxLocaleFree free
+# endif
 #else
-#   define wxFromLocale(wxstring) FromLocale((wxstring).mb_str())
-#   define wxLocaleFree(string) LocaleFree(string)
+# warning Please use WxWidgets with Unicode.
+    return FromLocale (string.c_str());
+# define wxLocaleFree LocaleFree
 #endif
-       
+}
+    
 /* From Locale functions to use for File Drop targets ... go figure */
 #if defined( wxUSE_UNICODE ) && !defined( WIN32 )
 static inline char *wxDnDFromLocale( const wxChar *stupid )
@@ -134,10 +138,10 @@ static inline char *wxDnDFromLocale( const wxChar *stupid )
 
     return FromLocaleDup( psz_local );
 }
-#   define wxDnDLocaleFree( string ) free( string )
+#   define wxDnDLocaleFree free
 #else
-#   define wxDnDFromLocale( string ) wxFromLocale( string )
-#   define wxDnDLocaleFree( string ) wxLocaleFree( string )
+#   define wxDnDFromLocale wxFromLocale
+#   define wxDnDLocaleFree wxLocaleFree
 #endif
 
 #define WRAPCOUNT 80