Commit 44b45d38 authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwidgets: fixed build when wxWidgets isn't compiled with unicode support.

parent cc631288
......@@ -406,7 +406,7 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
for( size_t i = 0; i < paths.GetCount(); i++ )
{
char *psz_utf8 = FromUTF32( paths[i].wc_str() );
char *psz_utf8 = wxFromLocale( paths[i] );
if( event.GetInt() )
playlist_Add( p_playlist, psz_utf8, psz_utf8,
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO),
......@@ -414,7 +414,7 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
else
playlist_Add( p_playlist, psz_utf8, psz_utf8,
PLAYLIST_APPEND, PLAYLIST_END );
free( psz_utf8 );
wxLocaleFree( psz_utf8 );
}
}
......@@ -437,11 +437,11 @@ void DialogsProvider::OnOpenDirectory( wxCommandEvent& event )
if( p_dir_dialog && p_dir_dialog->ShowModal() == wxID_OK )
{
wxString path = p_dir_dialog->GetPath();
char *psz_utf8 = FromUTF32( path.wc_str() );
char *psz_utf8 = wxFromLocale( path );
playlist_Add( p_playlist, psz_utf8, psz_utf8,
PLAYLIST_APPEND | (event.GetInt() ? PLAYLIST_GO : 0),
PLAYLIST_END );
free( psz_utf8 );
wxLocaleFree( psz_utf8 );
}
vlc_object_release( p_playlist );
......
......@@ -1418,11 +1418,11 @@ bool DragAndDrop::OnDropFiles( wxCoord, wxCoord,
for( size_t i = 0; i < filenames.GetCount(); i++ )
{
char *psz_utf8 = FromUTF32( filenames[i].wc_str() );
char *psz_utf8 = wxFromLocale( filenames[i] );
playlist_Add( p_playlist, psz_utf8, psz_utf8,
PLAYLIST_APPEND | ((i | b_enqueue) ? 0 : PLAYLIST_GO),
PLAYLIST_END );
free( psz_utf8 );
wxLocaleFree( psz_utf8 );
}
vlc_object_release( p_playlist );
......
......@@ -1148,17 +1148,17 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
playlist_item_t *p_item;
char *psz_utf8;
psz_utf8 = FromUTF32( mrl[i].wc_str() );
psz_utf8 = wxFromLocale( mrl[i] );
p_item = playlist_ItemNew( p_intf, psz_utf8, psz_utf8 );
free( psz_utf8 );
wxLocaleFree( psz_utf8 );
/* Insert options */
while( i + 1 < (int)mrl.GetCount() &&
((const char *)mrl[i + 1].wc_str())[0] == ':' )
((const char *)mrl[i + 1].mb_str())[0] == ':' )
{
psz_utf8 = FromUTF32( mrl[i + 1].wc_str() );
psz_utf8 = wxFromLocale( mrl[i + 1] );
playlist_ItemAddOption( p_item, psz_utf8 );
free( psz_utf8 );
wxLocaleFree( psz_utf8 );
i++;
}
......@@ -1167,9 +1167,9 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
{
for( int j = 0; j < (int)subsfile_mrl.GetCount(); j++ )
{
psz_utf8 = FromUTF32( subsfile_mrl[j].wc_str() );
psz_utf8 = wxFromLocale( subsfile_mrl[j] );
playlist_ItemAddOption( p_item, psz_utf8 );
free( psz_utf8 );
wxLocaleFree( psz_utf8 );
}
}
......@@ -1178,9 +1178,9 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
{
for( int j = 0; j < (int)sout_mrl.GetCount(); j++ )
{
psz_utf8 = FromUTF32( sout_mrl[j].wc_str() );
psz_utf8 = wxFromLocale( sout_mrl[j] );
playlist_ItemAddOption( p_item, psz_utf8 );
free( psz_utf8 );
wxLocaleFree( psz_utf8 );
}
}
......
......@@ -36,7 +36,6 @@
#include <list>
#define wxUSE_UNICODE 1
#include <wx/wxprec.h>
#include <wx/wx.h>
......@@ -64,15 +63,31 @@ DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
/* wxU is used to convert ansi/utf8 strings to unicode strings (wchar_t) */
#if defined( ENABLE_NLS )
#if wxUSE_UNICODE
# define wxU(utf8) wxString(utf8, wxConvUTF8)
#else
# define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
#endif
#else // ENABLE_NLS
#if wxUSE_UNICODE
# define wxU(ansi) wxString(ansi, wxConvLocal)
#else
# define wxU(ansi) (ansi)
#endif
#endif
/* wxL2U (locale to unicode) is used to convert ansi strings to unicode
* strings (wchar_t) */
#define wxL2U(ansi) wxU(ansi)
#if wxUSE_UNICODE
# define wxFromLocale(wxstring) FromUTF32(wxstring.wc_str())
# define wxLocaleFree(string) free(string)
#else
# define wxFromLocale(wxstring) FromLocale(wxstring.mb_str())
# define wxLocaleFree(string) LocaleFree(string)
#endif
#define WRAPCOUNT 80
#define OPEN_NORMAL 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment