From 973409adeaaf6b29930cae672c5b54e28ddc22bc Mon Sep 17 00:00:00 2001 From: Gildas Bazin Date: Mon, 22 Dec 2003 14:31:01 +0000 Subject: [PATCH] * modules/gui/wxwindows/*: don't forget to convert the filename/author fields in the playlist to the encoding in use by the wxWindows interface. --- modules/gui/wxwindows/playlist.cpp | 54 +++++++++++------------------- modules/gui/wxwindows/wxwindows.h | 10 +++++- 2 files changed, 28 insertions(+), 36 deletions(-) diff --git a/modules/gui/wxwindows/playlist.cpp b/modules/gui/wxwindows/playlist.cpp index 8833f3777e..b0d8273fae 100644 --- a/modules/gui/wxwindows/playlist.cpp +++ b/modules/gui/wxwindows/playlist.cpp @@ -2,7 +2,7 @@ * playlist.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001, 2003 VideoLAN - * $Id: playlist.cpp,v 1.31 2003/12/22 02:24:52 sam Exp $ + * $Id: playlist.cpp,v 1.32 2003/12/22 14:31:01 gbazin Exp $ * * Authors: Olivier Teulière * @@ -385,12 +385,12 @@ void Playlist::Rebuild() vlc_mutex_lock( &p_playlist->object_lock ); for( int i = 0; i < p_playlist->i_size; i++ ) { - wxString filename = wxU(p_playlist->pp_items[i]->psz_name); + wxString filename = wxL2U(p_playlist->pp_items[i]->psz_name); listview->InsertItem( i, filename ); - listview->SetItem( i, 1, wxU(p_playlist->pp_items[i]->psz_author)); + listview->SetItem( i, 1, wxL2U(p_playlist->pp_items[i]->psz_author) ); listview->SetItem( i, 2, - wxU(playlist_FindGroup(p_playlist,p_playlist-> - pp_items[i]->i_group))); + wxL2U(playlist_FindGroup( p_playlist, + p_playlist->pp_items[i]->i_group )) ); if( p_playlist->pp_items[i]->b_enabled == VLC_FALSE ) { wxListItem listitem; @@ -398,20 +398,12 @@ void Playlist::Rebuild() listitem.SetTextColour( *wxLIGHT_GREY); listview->SetItem(listitem); } - { - char psz_duration[MSTRTIME_MAX_SIZE]; - mtime_t dur = p_playlist->pp_items[i]->i_duration; - if ( dur != -1 ) - { - secstotimestr( psz_duration, dur/1000000 ); - } - else - { - memcpy( psz_duration ,"-:--:--", sizeof("-:--:--")); - } - listview->SetItem( i, 3, wxU(psz_duration) ); - } + char psz_duration[MSTRTIME_MAX_SIZE]; + mtime_t dur = p_playlist->pp_items[i]->i_duration; + if( dur != -1 ) secstotimestr( psz_duration, dur/1000000 ); + else memcpy( psz_duration , "-:--:--", sizeof("-:--:--") ); + listview->SetItem( i, 3, wxU(psz_duration) ); } vlc_mutex_unlock( &p_playlist->object_lock ); @@ -592,10 +584,8 @@ void Playlist::OnUp( wxCommandEvent& event) } /* We use the first selected item, so find it */ - long i_item = -1; - i_item = listview->GetNextItem(i_item, - wxLIST_NEXT_ALL, - wxLIST_STATE_SELECTED); + long i_item = listview->GetNextItem( i_item, wxLIST_NEXT_ALL, + wxLIST_STATE_SELECTED); if( i_item > 0 && i_item < p_playlist->i_size ) { playlist_Move( p_playlist , i_item, i_item - 1); @@ -623,10 +613,8 @@ void Playlist::OnDown( wxCommandEvent& event) } /* We use the first selected item, so find it */ - long i_item = -1; - i_item = listview->GetNextItem(i_item, - wxLIST_NEXT_ALL, - wxLIST_STATE_SELECTED); + long i_item = listview->GetNextItem( i_item, wxLIST_NEXT_ALL, + wxLIST_STATE_SELECTED ); if( i_item >= 0 && i_item < p_playlist->i_size - 1 ) { playlist_Move( p_playlist , i_item, i_item + 2 ); @@ -754,7 +742,7 @@ void Playlist::OnSearch( wxCommandEvent& WXUNUSED(event) ) for( i_current = 0 ; i_current <= listview->GetItemCount() ; i_current++ ) { - if( listview->GetItemState( i_current, wxLIST_STATE_SELECTED) + if( listview->GetItemState( i_current, wxLIST_STATE_SELECTED ) == wxLIST_STATE_SELECTED ) { i_first = i_current; @@ -948,10 +936,8 @@ void Playlist::OnInfos( wxCommandEvent& WXUNUSED(event) ) if( iteminfo_dialog == NULL ) { /* We use the first selected item, so find it */ - long i_item = -1; - i_item = listview->GetNextItem(i_item, - wxLIST_NEXT_ALL, - wxLIST_STATE_SELECTED); + long i_item = listview->GetNextItem( i_item, wxLIST_NEXT_ALL, + wxLIST_STATE_SELECTED ); if( i_item >= 0 && i_item < p_playlist->i_size ) { iteminfo_dialog = new ItemInfoDialog( @@ -975,10 +961,8 @@ void Playlist::OnEnDis( wxCommandEvent& event ) return; } - long i_item = -1; - i_item = listview->GetNextItem(i_item, - wxLIST_NEXT_ALL, - wxLIST_STATE_SELECTED); + long i_item = listview->GetNextItem( i_item, wxLIST_NEXT_ALL, + wxLIST_STATE_SELECTED ); if( i_item >= 0 && i_item < p_playlist->i_size ) { diff --git a/modules/gui/wxwindows/wxwindows.h b/modules/gui/wxwindows/wxwindows.h index 8676ffa2c2..1eee600930 100644 --- a/modules/gui/wxwindows/wxwindows.h +++ b/modules/gui/wxwindows/wxwindows.h @@ -2,7 +2,7 @@ * wxwindows.h: private wxWindows interface description ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: wxwindows.h,v 1.81 2003/12/16 03:21:47 rocky Exp $ + * $Id: wxwindows.h,v 1.82 2003/12/22 14:31:01 gbazin Exp $ * * Authors: Gildas Bazin * @@ -72,6 +72,14 @@ class FileInfo; #endif +/* wxL2U (locale to unicode) is used to convert ansi strings to unicode + * strings (wchar_t) */ +#if wxUSE_UNICODE +# define wxL2U(ansi) wxString(ansi, *wxConvCurrent) +#else +# define wxL2U(ansi) ansi +#endif + #define WRAPCOUNT 80 #define OPEN_NORMAL 0 -- 2.39.5