Commit cc516205 authored by Geoffroy Couprie's avatar Geoffroy Couprie

WinCE: update the interface module

parent 90d15c42
...@@ -23,6 +23,7 @@ SOURCES_wince = \ ...@@ -23,6 +23,7 @@ SOURCES_wince = \
$(NULL) $(NULL)
EXTRA_DIST += \ EXTRA_DIST += \
wince_rc.rc \
bitmaps/vlc16x16.ico \ bitmaps/vlc16x16.ico \
bitmaps/toolbar1.bmp \ bitmaps/toolbar1.bmp \
bitmaps/toolbar2.bmp \ bitmaps/toolbar2.bmp \
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_aout.h> #include <vlc_aout.h>
#include <vlc_interface.h> #include <vlc_interface.h>
#include <vlc_playlist.h>
#include "wince.h" #include "wince.h"
...@@ -330,7 +331,7 @@ void DialogsProvider::OnOpenFileSimple( int i_arg ) ...@@ -330,7 +331,7 @@ void DialogsProvider::OnOpenFileSimple( int i_arg )
{ {
OPENFILENAME ofn; OPENFILENAME ofn;
TCHAR szFile[MAX_PATH] = _T("\0"); TCHAR szFile[MAX_PATH] = _T("\0");
static TCHAR szFilter[] = _T("All (*.*)\0*.*\0"); static TCHAR szFilter[] = _T("wav (*.wav)\0*.wav\0mp3 (*.mp3 *.mpga)\0*.mp3;*.mpga\0All (*.*)\0*.*\0");
playlist_t *p_playlist = pl_Yield( p_intf ); playlist_t *p_playlist = pl_Yield( p_intf );
if( p_playlist == NULL ) return; if( p_playlist == NULL ) return;
...@@ -363,7 +364,8 @@ void DialogsProvider::OnOpenFileSimple( int i_arg ) ...@@ -363,7 +364,8 @@ void DialogsProvider::OnOpenFileSimple( int i_arg )
{ {
char *psz_filename = _TOMB(ofn.lpstrFile); char *psz_filename = _TOMB(ofn.lpstrFile);
playlist_Add( p_playlist, psz_filename, psz_filename, playlist_Add( p_playlist, psz_filename, psz_filename,
PLAYLIST_APPEND | (i_arg?PLAYLIST_GO:0), PLAYLIST_END ); PLAYLIST_APPEND | (i_arg?PLAYLIST_GO:0), PLAYLIST_END,
TRUE, FALSE );
} }
pl_Release( p_intf ); pl_Release( p_intf );
...@@ -423,7 +425,7 @@ void DialogsProvider::OnOpenDirectory( int i_arg ) ...@@ -423,7 +425,7 @@ void DialogsProvider::OnOpenDirectory( int i_arg )
char *psz_filename = _TOMB(psz_result); char *psz_filename = _TOMB(psz_result);
playlist_Add( p_playlist, psz_filename, psz_filename, playlist_Add( p_playlist, psz_filename, psz_filename,
PLAYLIST_APPEND | (i_arg ? PLAYLIST_GO : 0), PLAYLIST_APPEND | (i_arg ? PLAYLIST_GO : 0),
PLAYLIST_END ); PLAYLIST_END, TRUE, FALSE );
} }
p_malloc->Free( pidl ); p_malloc->Free( pidl );
} }
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_interface.h> #include <vlc_interface.h>
#include <vlc_input.h>
#include "wince.h" #include "wince.h"
...@@ -119,8 +120,10 @@ void FileInfo::UpdateFileInfo() ...@@ -119,8 +120,10 @@ void FileInfo::UpdateFileInfo()
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
// Set the text of the item. // Set the text of the item. Not right, but I don't know yet how to handle this
tvi.pszText = _FROMMB( p_input->input.p_item->psz_name ); //tvi.pszText = _FROMMB( p_input->input.p_item->psz_name ); <- old line
input_item_t * inp_item = input_item_GetById( p_input, 1 );
tvi.pszText = _FROMMB( input_item_GetName( inp_item ) );
tvi.cchTextMax = _tcslen( tvi.pszText ); tvi.cchTextMax = _tcslen( tvi.pszText );
// Save the heading level in the item's application-defined data area // Save the heading level in the item's application-defined data area
...@@ -135,13 +138,13 @@ void FileInfo::UpdateFileInfo() ...@@ -135,13 +138,13 @@ void FileInfo::UpdateFileInfo()
hPrevRootItem = hPrev; hPrevRootItem = hPrev;
vlc_mutex_lock( &p_input->input.p_item->lock ); vlc_mutex_lock( &inp_item->lock );
for( int i = 0; i < p_input->input.p_item->i_categories; i++ ) for( int i = 0; i < inp_item->i_categories; i++ )
{ {
info_category_t *p_cat = p_input->input.p_item->pp_categories[i]; info_category_t *p_cat = inp_item->pp_categories[i];
// Set the text of the item. // Set the text of the item.
tvi.pszText = _FROMMB( p_input->input.p_item->psz_name ); tvi.pszText = _FROMMB( inp_item->psz_name );
tvi.cchTextMax = _tcslen( tvi.pszText ); tvi.cchTextMax = _tcslen( tvi.pszText );
// Save the heading level in the item's application-defined data area // Save the heading level in the item's application-defined data area
...@@ -176,7 +179,7 @@ void FileInfo::UpdateFileInfo() ...@@ -176,7 +179,7 @@ void FileInfo::UpdateFileInfo()
TreeView_Expand( hwndTV, hPrevLev2Item, TVE_EXPANDPARTIAL|TVE_EXPAND ); TreeView_Expand( hwndTV, hPrevLev2Item, TVE_EXPANDPARTIAL|TVE_EXPAND );
} }
vlc_mutex_unlock( &p_input->input.p_item->lock ); vlc_mutex_unlock( &inp_item->lock );
TreeView_Expand( hwndTV, hPrevRootItem, TVE_EXPANDPARTIAL|TVE_EXPAND ); TreeView_Expand( hwndTV, hPrevRootItem, TVE_EXPANDPARTIAL|TVE_EXPAND );
......
...@@ -37,8 +37,11 @@ ...@@ -37,8 +37,11 @@
#include <vlc_aout.h> #include <vlc_aout.h>
#include <vlc_vout.h> #include <vlc_vout.h>
#include <vlc_interface.h> #include <vlc_interface.h>
#include <vlc_input.h>
#include <vlc_playlist.h>
#include "wince.h" #include "wince.h"
#define INT64_C(val) val##LL
#include <windowsx.h> #include <windowsx.h>
#include <commctrl.h> #include <commctrl.h>
...@@ -501,7 +504,7 @@ LRESULT Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) ...@@ -501,7 +504,7 @@ LRESULT Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
{ {
string about = (string)"VLC media player " PACKAGE_VERSION + string about = (string)"VLC media player " PACKAGE_VERSION +
_("\n(WinCE interface)\n\n") + _("\n(WinCE interface)\n\n") +
_("(c) 1996-2006 - the VideoLAN Team\n\n") + _("(c) 1996-2008 - the VideoLAN Team\n\n") +
_("Compiled by ") + VLC_CompileBy() + "@" + _("Compiled by ") + VLC_CompileBy() + "@" +
VLC_CompileHost() + "." + VLC_CompileDomain() + ".\n" + VLC_CompileHost() + "." + VLC_CompileDomain() + ".\n" +
_("Compiler: ") + VLC_Compiler() + ".\n" + _("Compiler: ") + VLC_Compiler() + ".\n" +
...@@ -640,7 +643,7 @@ void Interface::OnPlayStream( void ) ...@@ -640,7 +643,7 @@ void Interface::OnPlayStream( void )
playlist_t *p_playlist = pl_Yield( p_intf ); playlist_t *p_playlist = pl_Yield( p_intf );
if( p_playlist == NULL ) return; if( p_playlist == NULL ) return;
if( p_playlist->i_size ) if( !playlist_IsEmpty(p_playlist) )
{ {
vlc_value_t state; vlc_value_t state;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_interface.h> #include <vlc_interface.h>
#include <vlc_playlist.h>
#include "wince.h" #include "wince.h"
...@@ -71,6 +72,7 @@ LRESULT ItemInfoDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) ...@@ -71,6 +72,7 @@ LRESULT ItemInfoDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
SHMENUBARINFO mbi; SHMENUBARINFO mbi;
INITCOMMONCONTROLSEX iccex; INITCOMMONCONTROLSEX iccex;
RECT rcClient; RECT rcClient;
char *psz_uri;
switch( msg ) switch( msg )
{ {
...@@ -104,7 +106,7 @@ LRESULT ItemInfoDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) ...@@ -104,7 +106,7 @@ LRESULT ItemInfoDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
WS_CHILD | WS_VISIBLE | SS_RIGHT, WS_CHILD | WS_VISIBLE | SS_RIGHT,
0, 10, 60, 15, hwnd, NULL, hInst, NULL); 0, 10, 60, 15, hwnd, NULL, hInst, NULL);
char *psz_uri = input_item_GetURI( &p_item->input ); psz_uri = input_item_GetURI( p_item->p_input );
uri_text = CreateWindow( _T("EDIT"), _FROMMB(psz_uri), uri_text = CreateWindow( _T("EDIT"), _FROMMB(psz_uri),
WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL, WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL,
70, 10 - 3, rcClient.right - 70 - 10, 15 + 6, hwnd, 0, hInst, 0 ); 70, 10 - 3, rcClient.right - 70 - 10, 15 + 6, hwnd, 0, hInst, 0 );
...@@ -117,7 +119,7 @@ LRESULT ItemInfoDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) ...@@ -117,7 +119,7 @@ LRESULT ItemInfoDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
hwnd, NULL, hInst, NULL); hwnd, NULL, hInst, NULL);
name_text = CreateWindow( _T("EDIT"), name_text = CreateWindow( _T("EDIT"),
_FROMMB(p_item->input.psz_name), _FROMMB(p_item->p_input->psz_name),
WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL, WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | ES_AUTOHSCROLL,
70, 10 + 15 + 10 - 3, rcClient.right - 70 - 10, 15 + 6, 70, 10 + 15 + 10 - 3, rcClient.right - 70 - 10, 15 + 6,
hwnd, NULL, hInst, NULL); hwnd, NULL, hInst, NULL);
...@@ -134,7 +136,8 @@ LRESULT ItemInfoDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) ...@@ -134,7 +136,8 @@ LRESULT ItemInfoDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
hwnd, NULL, hInst, NULL ); hwnd, NULL, hInst, NULL );
SendMessage( enabled_checkbox, BM_SETCHECK, SendMessage( enabled_checkbox, BM_SETCHECK,
p_item->b_enabled ? BST_CHECKED : BST_UNCHECKED, 0 ); (p_item->i_flags & PLAYLIST_DBL_FLAG) ?
BST_UNCHECKED : BST_CHECKED, 0 );
/* Treeview */ /* Treeview */
iccex.dwSize = sizeof( INITCOMMONCONTROLSEX ); iccex.dwSize = sizeof( INITCOMMONCONTROLSEX );
...@@ -190,7 +193,7 @@ LRESULT ItemInfoDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) ...@@ -190,7 +193,7 @@ LRESULT ItemInfoDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
// Set the text of the item. // Set the text of the item.
tvi.pszText = _FROMMB(p_item->input.psz_name); tvi.pszText = _FROMMB(p_item->p_input->psz_name);
tvi.cchTextMax = _tcslen(tvi.pszText); tvi.cchTextMax = _tcslen(tvi.pszText);
// Save the heading level in the item's application-defined data area // Save the heading level in the item's application-defined data area
...@@ -204,13 +207,13 @@ LRESULT ItemInfoDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) ...@@ -204,13 +207,13 @@ LRESULT ItemInfoDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
hPrevRootItem = hPrev; hPrevRootItem = hPrev;
/* Rebuild the tree */ /* Rebuild the tree */
vlc_mutex_lock( &p_item->input.lock ); vlc_mutex_lock( &p_item->p_input->lock );
for( int i = 0; i < p_item->input.i_categories; i++ ) for( int i = 0; i < p_item->p_input->i_categories; i++ )
{ {
info_category_t *p_cat = p_item->input.pp_categories[i]; info_category_t *p_cat = p_item->p_input->pp_categories[i];
// Set the text of the item. // Set the text of the item.
tvi.pszText = _FROMMB( p_item->input.psz_name ); tvi.pszText = _FROMMB( p_item->p_input->psz_name );
tvi.cchTextMax = _tcslen( tvi.pszText ); tvi.cchTextMax = _tcslen( tvi.pszText );
// Save the heading level in the item's application-defined data area // Save the heading level in the item's application-defined data area
...@@ -246,7 +249,7 @@ LRESULT ItemInfoDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) ...@@ -246,7 +249,7 @@ LRESULT ItemInfoDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
TreeView_Expand( info_tree, hPrevLev2Item, TreeView_Expand( info_tree, hPrevLev2Item,
TVE_EXPANDPARTIAL |TVE_EXPAND ); TVE_EXPANDPARTIAL |TVE_EXPAND );
} }
vlc_mutex_unlock( &p_item->input.lock ); vlc_mutex_unlock( &p_item->p_input->lock );
TreeView_Expand( info_tree, hPrevRootItem, TVE_EXPANDPARTIAL |TVE_EXPAND ); TreeView_Expand( info_tree, hPrevRootItem, TVE_EXPANDPARTIAL |TVE_EXPAND );
} }
...@@ -260,14 +263,14 @@ void ItemInfoDialog::OnOk() ...@@ -260,14 +263,14 @@ void ItemInfoDialog::OnOk()
TCHAR psz_name[MAX_PATH]; TCHAR psz_name[MAX_PATH];
Edit_GetText( name_text, psz_name, MAX_PATH ); Edit_GetText( name_text, psz_name, MAX_PATH );
input_item_SetName( &p_item->input, _TOMB( psz_name ) ); input_item_SetName( p_item->p_input, _TOMB( psz_name ) );
TCHAR psz_uri[MAX_PATH]; TCHAR psz_uri[MAX_PATH];
Edit_GetText( uri_text, psz_uri, MAX_PATH ); Edit_GetText( uri_text, psz_uri, MAX_PATH );
input_item_SetURI( &p_item->input, _TOMB(psz_uri) ); input_item_SetURI( p_item->p_input, _TOMB(psz_uri) );
vlc_mutex_lock( &p_item->input.lock ); vlc_mutex_lock( &p_item->p_input->lock );
bool b_old_enabled = p_item->b_enabled; bool b_old_enabled = !(p_item->i_flags & PLAYLIST_DBL_FLAG);
playlist_t * p_playlist = pl_Yield( p_intf ); playlist_t * p_playlist = pl_Yield( p_intf );
if( p_playlist != NULL ) if( p_playlist != NULL )
...@@ -276,7 +279,7 @@ void ItemInfoDialog::OnOk() ...@@ -276,7 +279,7 @@ void ItemInfoDialog::OnOk()
pl_Release( p_intf ); pl_Release( p_intf );
} }
p_item->b_enabled = (b_state & BST_CHECKED) ? true : false ; p_item->i_flags |= (b_state & BST_CHECKED) ? false : PLAYLIST_DBL_FLAG ;
vlc_mutex_unlock( &p_item->input.lock ); vlc_mutex_unlock( &p_item->p_input->lock );
} }
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_interface.h> #include <vlc_interface.h>
#include <vlc_playlist.h>
#include "wince.h" #include "wince.h"
...@@ -222,7 +223,7 @@ void PopupMenu( intf_thread_t *p_intf, HWND p_parent, POINT point ) ...@@ -222,7 +223,7 @@ void PopupMenu( intf_thread_t *p_intf, HWND p_parent, POINT point )
else else
{ {
playlist_t * p_playlist = pl_Yield( p_intf ); playlist_t * p_playlist = pl_Yield( p_intf );
if( p_playlist && p_playlist->i_size ) if( p_playlist && !playlist_IsEmpty( p_playlist ) )
{ {
AppendMenu( hmenu, MF_SEPARATOR, 0, _T("") ); AppendMenu( hmenu, MF_SEPARATOR, 0, _T("") );
AppendMenu( hmenu, MF_STRING, PlayStream_Event, _T("Play") ); AppendMenu( hmenu, MF_STRING, PlayStream_Event, _T("Play") );
......
...@@ -206,17 +206,20 @@ void Messages::UpdateLog() ...@@ -206,17 +206,20 @@ void Messages::UpdateLog()
for( i_start = p_sub->i_start; i_start != i_stop; for( i_start = p_sub->i_start; i_start != i_stop;
i_start = (i_start+1) % VLC_MSG_QSIZE ) i_start = (i_start+1) % VLC_MSG_QSIZE )
{ {
vlc_value_t val;
var_Get( p_intf->p_libvlc, "verbose", &val );
switch( p_sub->p_msg[i_start].i_type ) switch( p_sub->p_msg[i_start].i_type )
{ {
case VLC_MSG_ERR: case VLC_MSG_ERR:
case VLC_MSG_INFO: case VLC_MSG_INFO:
if( p_intf->p_libvlc_global->i_verbose < 0 ) continue; if( val.i_int < 0 ) continue;
break; break;
case VLC_MSG_WARN: case VLC_MSG_WARN:
if( p_intf->p_libvlc_global->i_verbose < 1 ) continue; if( val.i_int < 1 ) continue;
break; break;
case VLC_MSG_DBG: case VLC_MSG_DBG:
if( p_intf->p_libvlc_global->i_verbose < 2 ) continue; if( val.i_int < 2 ) continue;
break; break;
} }
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_interface.h> #include <vlc_interface.h>
#include <vlc_playlist.h>
#include "wince.h" #include "wince.h"
...@@ -601,32 +602,32 @@ void OpenDialog::OnOk() ...@@ -601,32 +602,32 @@ void OpenDialog::OnOk()
GetWindowText( mrl_combo, psz_text, 2048 ); GetWindowText( mrl_combo, psz_text, 2048 );
int i_args; int i_args;
char **pp_args = vlc_parse_cmdline( _TOMB(psz_text), &i_args ); /*char **pp_args = vlc_parse_cmdline( _TOMB(psz_text), &i_args );
ComboBox_AddString( mrl_combo, psz_text ); ComboBox_AddString( mrl_combo, psz_text );
if( ComboBox_GetCount( mrl_combo ) > 10 ) if( ComboBox_GetCount( mrl_combo ) > 10 )
ComboBox_DeleteString( mrl_combo, 0 ); ComboBox_DeleteString( mrl_combo, 0 );
ComboBox_SetCurSel( mrl_combo, ComboBox_GetCount( mrl_combo ) - 1 ); ComboBox_SetCurSel( mrl_combo, ComboBox_GetCount( mrl_combo ) - 1 );*/
/* Update the playlist */ /* Update the playlist */
playlist_t *p_playlist = pl_Yield( p_intf ); playlist_t *p_playlist = pl_Yield( p_intf );
if( p_playlist == NULL ) return; if( p_playlist == NULL ) return;
for( int i = 0; i < i_args; i++ ) /* for( int i = 0; i < i_args; i++ )
{ {
bool b_start = !i && i_open_arg; bool b_start = !i && i_open_arg;
playlist_item_t *p_item = playlist_item_t *p_item =
playlist_ItemNew( p_playlist, pp_args[i], pp_args[i] ); playlist_ItemNew( p_playlist, pp_args[i], pp_args[i] );
/* Insert options */ /* Insert options */
while( i + 1 < i_args && pp_args[i + 1][0] == ':' ) /* while( i + 1 < i_args && pp_args[i + 1][0] == ':' )
{ {
playlist_ItemAddOption( p_item, pp_args[i + 1] ); playlist_ItemAddOption( p_item, pp_args[i + 1] );
i++; i++;
} }*/
/* Get the options from the subtitles dialog */ /* Get the options from the subtitles dialog */
if( (SendMessage( subsfile_checkbox, BM_GETCHECK, 0, 0 ) & BST_CHECKED) /* if( (SendMessage( subsfile_checkbox, BM_GETCHECK, 0, 0 ) & BST_CHECKED)
&& subsfile_mrl.size() ) && subsfile_mrl.size() )
{ {
for( int j = 0; j < (int)subsfile_mrl.size(); j++ ) for( int j = 0; j < (int)subsfile_mrl.size(); j++ )
...@@ -654,7 +655,7 @@ void OpenDialog::OnOk() ...@@ -654,7 +655,7 @@ void OpenDialog::OnOk()
{ {
free( pp_args[i_args] ); free( pp_args[i_args] );
if( !i_args ) free( pp_args ); if( !i_args ) free( pp_args );
} }*/
pl_Release( p_intf ); pl_Release( p_intf );
} }
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_interface.h> #include <vlc_interface.h>
#include <vlc_playlist.h>
#include "wince.h" #include "wince.h"
...@@ -80,21 +81,21 @@ enum ...@@ -80,21 +81,21 @@ enum
// The TBBUTTON structure contains information the toolbar buttons. // The TBBUTTON structure contains information the toolbar buttons.
static TBBUTTON tbButton2[] = static TBBUTTON tbButton2[] =
{ {
{0, ID_MANAGE_OPENPL, TBSTATE_ENABLED, TBSTYLE_BUTTON}, {0, ID_MANAGE_OPENPL, TBSTATE_ENABLED, TBSTYLE_BUTTON },
{1, ID_MANAGE_SAVEPL, TBSTATE_ENABLED, TBSTYLE_BUTTON}, {1, ID_MANAGE_SAVEPL, TBSTATE_ENABLED, TBSTYLE_BUTTON },
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP}, {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP },
{2, ID_MANAGE_ADDFILE, TBSTATE_ENABLED, TBSTYLE_BUTTON}, {2, ID_MANAGE_ADDFILE, TBSTATE_ENABLED, TBSTYLE_BUTTON },
{3, ID_MANAGE_ADDMRL, TBSTATE_ENABLED, TBSTYLE_BUTTON}, {3, ID_MANAGE_ADDMRL, TBSTATE_ENABLED, TBSTYLE_BUTTON },
{4, ID_SEL_DELETE, TBSTATE_ENABLED, TBSTYLE_BUTTON}, {4, ID_SEL_DELETE, TBSTATE_ENABLED, TBSTYLE_BUTTON },
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP}, {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP },
{5, Infos_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON}, {5, Infos_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON },
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP}, {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP },
{6, Up_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON}, {6, Up_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON },
{7, Down_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON}, {7, Down_Event, TBSTATE_ENABLED, TBSTYLE_BUTTON },
{0, 0, TBSTATE_ENABLED, TBSTYLE_SEP}, {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP },
{8, Random_Event, TBSTATE_ENABLED, TBSTYLE_CHECK}, {8, Random_Event, TBSTATE_ENABLED, TBSTYLE_CHECK },
{9, Loop_Event, TBSTATE_ENABLED, TBSTYLE_CHECK}, {9, Loop_Event, TBSTATE_ENABLED, TBSTYLE_CHECK },
{10, Repeat_Event, TBSTATE_ENABLED, TBSTYLE_CHECK} {10, Repeat_Event, TBSTATE_ENABLED, TBSTYLE_CHECK }
}; };
// Toolbar ToolTips // Toolbar ToolTips
...@@ -518,21 +519,21 @@ LRESULT Playlist::ProcessCustomDraw( LPARAM lParam ) ...@@ -518,21 +519,21 @@ LRESULT Playlist::ProcessCustomDraw( LPARAM lParam )
case CDDS_ITEMPREPAINT: //Before an item is drawn case CDDS_ITEMPREPAINT: //Before an item is drawn
playlist_t *p_playlist = pl_Yield( p_intf ); playlist_t *p_playlist = pl_Yield( p_intf );
if( p_playlist == NULL ) return CDRF_DODEFAULT; if( p_playlist == NULL ) return CDRF_DODEFAULT;
if( (int)lplvcd->nmcd.dwItemSpec == p_playlist->i_index ) if( (int)lplvcd->nmcd.dwItemSpec == p_playlist->i_current_index )
{ {
lplvcd->clrText = RGB(255,0,0); lplvcd->clrText = RGB(255,0,0);
pl_Release( p_intf ); pl_Release( p_intf );
return CDRF_NEWFONT; return CDRF_NEWFONT;
} }
playlist_item_t *p_item = playlist_ItemGetByPos( p_playlist, playlist_item_t *p_item = playlist_ItemGetById( p_playlist,
(int)lplvcd->nmcd.dwItemSpec ); (int)lplvcd->nmcd.dwItemSpec, FALSE );
if( !p_item ) if( !p_item )
{ {
pl_Release( p_intf ); pl_Release( p_intf );
return CDRF_DODEFAULT; return CDRF_DODEFAULT;
} }
if( p_item->b_enabled == false ) if( p_item->i_flags & PLAYLIST_DBL_FLAG )
{ {
lplvcd->clrText = RGB(192,192,192); lplvcd->clrText = RGB(192,192,192);
pl_Release( p_intf ); pl_Release( p_intf );
...@@ -594,13 +595,13 @@ void Playlist::UpdatePlaylist() ...@@ -594,13 +595,13 @@ void Playlist::UpdatePlaylist()
/* Update the colour of items */ /* Update the colour of items */
vlc_object_lock( p_playlist ); vlc_object_lock( p_playlist );
if( p_intf->p_sys->i_playing != p_playlist->i_index ) if( p_intf->p_sys->i_playing != playlist_CurrentSize( p_playlist ) )
{ {
// p_playlist->i_index in RED // p_playlist->i_index in RED
Rebuild(); Rebuild();
// if exists, p_intf->p_sys->i_playing in BLACK // if exists, p_intf->p_sys->i_playing in BLACK
p_intf->p_sys->i_playing = p_playlist->i_index; p_intf->p_sys->i_playing = p_playlist->i_current_index;
} }
vlc_object_unlock( p_playlist ); vlc_object_unlock( p_playlist );
...@@ -623,8 +624,12 @@ void Playlist::Rebuild() ...@@ -623,8 +624,12 @@ void Playlist::Rebuild()
/* ...and rebuild it */ /* ...and rebuild it */
vlc_object_lock( p_playlist ); vlc_object_lock( p_playlist );
for( int i = 0; i < p_playlist->i_size; i++ ) playlist_item_t * p_root = p_playlist->p_local_onelevel;
playlist_item_t * p_child = NULL;
for( int i = 0; i < playlist_NodeChildrenCount( p_playlist, p_root ); i++ )
{ {
p_child = playlist_GetNextLeaf( p_playlist, p_root, p_child, FALSE, FALSE);
LVITEM lv; LVITEM lv;
lv.mask = LVIF_TEXT; lv.mask = LVIF_TEXT;
lv.pszText = _T(""); lv.pszText = _T("");
...@@ -633,8 +638,9 @@ void Playlist::Rebuild() ...@@ -633,8 +638,9 @@ void Playlist::Rebuild()
lv.iItem = i; lv.iItem = i;
ListView_InsertItem( hListView, &lv ); ListView_InsertItem( hListView, &lv );
ListView_SetItemText( hListView, lv.iItem, 0, ListView_SetItemText( hListView, lv.iItem, 0,
_FROMMB(p_playlist->pp_items[i]->input.psz_name) ); _FROMMB(p_child->p_input->psz_name) );
UpdateItem( i );
UpdateItem( p_child->i_id );
} }
vlc_object_unlock( p_playlist ); vlc_object_unlock( p_playlist );
...@@ -657,7 +663,7 @@ void Playlist::UpdateItem( int i ) ...@@ -657,7 +663,7 @@ void Playlist::UpdateItem( int i )
if( p_playlist == NULL ) return; if( p_playlist == NULL ) return;
playlist_item_t *p_item = playlist_ItemGetByPos( p_playlist, i ); playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i, FALSE );
if( !p_item ) if( !p_item )
{ {
...@@ -665,17 +671,19 @@ void Playlist::UpdateItem( int i ) ...@@ -665,17 +671,19 @@ void Playlist::UpdateItem( int i )
return; return;
} }
ListView_SetItemText( hListView, i, 0, _FROMMB(p_item->input.psz_name) ); ListView_SetItemText( hListView, i, 0, _FROMMB(p_item->p_input->psz_name) );
ListView_SetItemText( hListView, i, 1, ListView_SetItemText( hListView, i, 1,
_FROMMB( input_item_GetInfo( &p_item->input, _FROMMB( input_item_GetInfo( p_item->p_input,
_("General") , _("Author") ) ) ); _("General") , _("Author") ) ) );
char psz_duration[MSTRTIME_MAX_SIZE]; char psz_duration[MSTRTIME_MAX_SIZE];
mtime_t dur = input_item_GetDuration( p_item ); mtime_t dur = input_item_GetDuration( p_item->p_input );
if( dur != -1 ) secstotimestr( psz_duration, dur/1000000 ); if( dur != -1 ) secstotimestr( psz_duration, dur/1000000 );
else memcpy( psz_duration , "-:--:--", sizeof("-:--:--") ); else memcpy( psz_duration , "-:--:--", sizeof("-:--:--") );
ListView_SetItemText( hListView, i, 3, _FROMMB(psz_duration) ); ListView_SetItemText( hListView, i, 2, _FROMMB(psz_duration) );
pl_Release( p_intf ); pl_Release( p_intf );
} }
...@@ -688,7 +696,7 @@ void Playlist::DeleteItem( int item ) ...@@ -688,7 +696,7 @@ void Playlist::DeleteItem( int item )
playlist_t *p_playlist = pl_Yield( p_intf ); playlist_t *p_playlist = pl_Yield( p_intf );
if( p_playlist == NULL ) return; if( p_playlist == NULL ) return;
playlist_Delete( p_playlist, item ); playlist_DeleteFromInput( p_playlist, item, FALSE );
ListView_DeleteItem( hListView, item ); ListView_DeleteItem( hListView, item );
pl_Release( p_intf ); pl_Release( p_intf );
...@@ -746,7 +754,7 @@ static void OnSaveCB( intf_dialog_args_t *p_arg ) ...@@ -746,7 +754,7 @@ static void OnSaveCB( intf_dialog_args_t *p_arg )
psz_export = "export-pls"; psz_export = "export-pls";
else psz_export = "export-m3u"; else psz_export = "export-m3u";
playlist_Export( p_playlist, p_arg->psz_results[0], psz_export ); playlist_Export( p_playlist, p_arg->psz_results[0], p_playlist->p_local_onelevel, psz_export );
pl_Release( p_intf ); pl_Release( p_intf );
} }
} }
...@@ -809,8 +817,8 @@ void Playlist::OnEnableSelection() ...@@ -809,8 +817,8 @@ void Playlist::OnEnableSelection()
if( ListView_GetItemState( hListView, item, LVIS_SELECTED ) ) if( ListView_GetItemState( hListView, item, LVIS_SELECTED ) )
{ {
playlist_item_t *p_item = playlist_item_t *p_item =
playlist_ItemGetByPos( p_playlist, item ); playlist_ItemGetById( p_playlist, item, FALSE );
playlist_Enable( p_playlist, p_item ); p_item->i_flags ^= PLAYLIST_DBL_FLAG;
UpdateItem( item ); UpdateItem( item );
} }
} }
...@@ -829,8 +837,8 @@ void Playlist::OnDisableSelection() ...@@ -829,8 +837,8 @@ void Playlist::OnDisableSelection()
{ {
/*XXX*/ /*XXX*/
playlist_item_t *p_item = playlist_item_t *p_item =
playlist_ItemGetByPos( p_playlist, item ); playlist_ItemGetById( p_playlist, item, FALSE );
playlist_Disable( p_playlist, p_item ); p_item->i_flags |= PLAYLIST_DBL_FLAG;
UpdateItem( item ); UpdateItem( item );
} }
} }
...@@ -851,7 +859,7 @@ void Playlist::OnActivateItem( int i_item ) ...@@ -851,7 +859,7 @@ void Playlist::OnActivateItem( int i_item )
playlist_t *p_playlist = pl_Yield( p_intf ); playlist_t *p_playlist = pl_Yield( p_intf );
if( p_playlist == NULL ) return; if( p_playlist == NULL ) return;
playlist_Goto( p_playlist, i_item ); playlist_Skip( p_playlist, i_item - p_playlist->i_current_index );
pl_Release( p_intf ); pl_Release( p_intf );
} }
...@@ -862,7 +870,7 @@ void Playlist::ShowInfos( HWND hwnd, int i_item ) ...@@ -862,7 +870,7 @@ void Playlist::ShowInfos( HWND hwnd, int i_item )
if( p_playlist == NULL ) return; if( p_playlist == NULL ) return;
vlc_object_lock( p_playlist); vlc_object_lock( p_playlist);
playlist_item_t *p_item = playlist_ItemGetByPos( p_playlist, i_item ); playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_item, true );
vlc_object_unlock( p_playlist ); vlc_object_unlock( p_playlist );
if( p_item ) if( p_item )
...@@ -889,9 +897,9 @@ void Playlist::OnUp() ...@@ -889,9 +897,9 @@ void Playlist::OnUp()
long i_item = long i_item =
ListView_GetNextItem( hListView, -1, LVIS_SELECTED | LVNI_ALL ); ListView_GetNextItem( hListView, -1, LVIS_SELECTED | LVNI_ALL );
if( i_item > 0 && i_item < p_playlist->i_size ) if( i_item > 0 && i_item < playlist_CurrentSize( p_playlist ) )
{ {
playlist_Move( p_playlist , i_item, i_item - 1); playlist_Prev( p_playlist );
if( i_item > 1 ) if( i_item > 1 )
{ {
ListView_SetItemState( hListView, i_item - 1, LVIS_FOCUSED, ListView_SetItemState( hListView, i_item - 1, LVIS_FOCUSED,
...@@ -917,9 +925,9 @@ void Playlist::OnDown() ...@@ -917,9 +925,9 @@ void Playlist::OnDown()
long i_item = long i_item =
ListView_GetNextItem( hListView, -1, LVIS_SELECTED | LVNI_ALL ); ListView_GetNextItem( hListView, -1, LVIS_SELECTED | LVNI_ALL );
if( i_item >= 0 && i_item < p_playlist->i_size - 1 ) if( i_item >= 0 && i_item < playlist_CurrentSize( p_playlist ) - 1 )
{ {
playlist_Move( p_playlist , i_item, i_item + 2 ); playlist_Next( p_playlist );
ListView_SetItemState( hListView, i_item + 1, LVIS_FOCUSED, ListView_SetItemState( hListView, i_item + 1, LVIS_FOCUSED,
LVIS_STATEIMAGEMASK ); LVIS_STATEIMAGEMASK );
} }
...@@ -981,19 +989,24 @@ void Playlist::OnSort( UINT event ) ...@@ -981,19 +989,24 @@ void Playlist::OnSort( UINT event )
switch( event ) switch( event )
{ {
case ID_SORT_TITLE: case ID_SORT_TITLE:
playlist_SortTitle( p_playlist , ORDER_NORMAL ); playlist_RecursiveNodeSort(p_playlist , p_playlist->p_root_onelevel,
SORT_TITLE, ORDER_NORMAL);
break; break;
case ID_SORT_RTITLE: case ID_SORT_RTITLE:
playlist_SortTitle( p_playlist , ORDER_REVERSE ); playlist_RecursiveNodeSort(p_playlist , p_playlist->p_root_onelevel,
SORT_TITLE, ORDER_REVERSE );
break; break;
case ID_SORT_AUTHOR: case ID_SORT_AUTHOR:
playlist_SortAuthor(p_playlist , ORDER_NORMAL ); playlist_RecursiveNodeSort(p_playlist , p_playlist->p_root_onelevel,
SORT_ARTIST, ORDER_NORMAL);
break; break;
case ID_SORT_RAUTHOR: case ID_SORT_RAUTHOR:
playlist_SortAuthor( p_playlist , ORDER_REVERSE ); playlist_RecursiveNodeSort(p_playlist , p_playlist->p_root_onelevel,
SORT_ARTIST, ORDER_REVERSE);
break; break;
case ID_SORT_SHUFFLE: case ID_SORT_SHUFFLE:
playlist_Sort( p_playlist , SORT_RANDOM, ORDER_NORMAL ); playlist_RecursiveNodeSort(p_playlist , p_playlist->p_root_onelevel,
SORT_RANDOM, ORDER_NORMAL);
break; break;
} }
...@@ -1014,24 +1027,28 @@ void Playlist::OnColSelect( int iSubItem ) ...@@ -1014,24 +1027,28 @@ void Playlist::OnColSelect( int iSubItem )
case 0: case 0:
if( i_title_sorted != 1 ) if( i_title_sorted != 1 )
{ {
playlist_SortTitle( p_playlist, ORDER_NORMAL ); playlist_RecursiveNodeSort(p_playlist , p_playlist->p_root_onelevel,
SORT_TITLE, ORDER_NORMAL);
i_title_sorted = 1; i_title_sorted = 1;
} }
else else
{ {
playlist_SortTitle( p_playlist, ORDER_REVERSE ); playlist_RecursiveNodeSort(p_playlist , p_playlist->p_root_onelevel,
SORT_TITLE, ORDER_REVERSE );
i_title_sorted = -1; i_title_sorted = -1;
} }
break; break;
case 1: case 1:
if( i_author_sorted != 1 ) if( i_author_sorted != 1 )
{ {
playlist_SortAuthor( p_playlist, ORDER_NORMAL ); playlist_RecursiveNodeSort(p_playlist , p_playlist->p_root_onelevel,
SORT_ARTIST, ORDER_NORMAL);
i_author_sorted = 1; i_author_sorted = 1;
} }
else else
{ {
playlist_SortAuthor( p_playlist, ORDER_REVERSE ); playlist_RecursiveNodeSort(p_playlist , p_playlist->p_root_onelevel,
SORT_ARTIST, ORDER_REVERSE);
i_author_sorted = -1; i_author_sorted = -1;
} }
break; break;
...@@ -1059,7 +1076,7 @@ void Playlist::OnPopupPlay() ...@@ -1059,7 +1076,7 @@ void Playlist::OnPopupPlay()
if( i_popup_item != -1 ) if( i_popup_item != -1 )
{ {
playlist_Goto( p_playlist, i_popup_item ); playlist_Skip( p_playlist, i_popup_item - p_playlist->i_current_index );
} }
pl_Release( p_intf ); pl_Release( p_intf );
...@@ -1082,16 +1099,16 @@ void Playlist::OnPopupEna() ...@@ -1082,16 +1099,16 @@ void Playlist::OnPopupEna()
if( p_playlist == NULL ) return; if( p_playlist == NULL ) return;
playlist_item_t *p_item = playlist_item_t *p_item =
playlist_ItemGetByPos( p_playlist, i_popup_item ); playlist_ItemGetById( p_playlist, i_popup_item, FALSE );
if( p_playlist->pp_items[i_popup_item]->b_enabled ) if( !(p_playlist->items.p_elems[i_popup_item]->i_flags & PLAYLIST_DBL_FLAG) )
//playlist_IsEnabled( p_playlist, i_popup_item ) ) //playlist_IsEnabled( p_playlist, i_popup_item ) )
{ {
playlist_Disable( p_playlist, p_item ); p_item->i_flags |= PLAYLIST_DBL_FLAG;
} }
else else
{ {
playlist_Enable( p_playlist, p_item ); p_item->i_flags ^= PLAYLIST_DBL_FLAG;
} }
pl_Release( p_intf ); pl_Release( p_intf );
......
...@@ -44,9 +44,10 @@ ...@@ -44,9 +44,10 @@
#include "preferences_widgets.h" #include "preferences_widgets.h"
#define GENERAL_ID 1242 #define TYPE_CATEGORY 0
#define PLUGIN_ID 1243 #define TYPE_CATSUBCAT 1 /* Category with embedded subcategory */
#define CAPABILITY_ID 1244 #define TYPE_SUBCATEGORY 2
#define TYPE_MODULE 3
/***************************************************************************** /*****************************************************************************
* Event Table. * Event Table.
...@@ -98,7 +99,7 @@ public: ...@@ -98,7 +99,7 @@ public:
PrefsPanel() { } PrefsPanel() { }
PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf, PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf,
PrefsDialog *, int i_object_id, char *, char * ); PrefsDialog *, module_t *p_module, char *, char *, ConfigTreeData * );
virtual ~PrefsPanel() {} virtual ~PrefsPanel() {}
void Hide(); void Hide();
...@@ -126,17 +127,20 @@ class ConfigTreeData ...@@ -126,17 +127,20 @@ class ConfigTreeData
{ {
public: public:
ConfigTreeData() { b_submodule = 0; panel = NULL; psz_section = NULL; ConfigTreeData() { b_submodule = 0; panel = NULL; psz_name = NULL;
psz_help = NULL; } psz_help = NULL; }
virtual ~ConfigTreeData() { delete panel; virtual ~ConfigTreeData() { delete panel;
free( psz_section ); free( psz_name );
free( psz_help ); } free( psz_help ); }
bool b_submodule; bool b_submodule;
PrefsPanel *panel; PrefsPanel *panel;
module_t *p_module;
int i_object_id; int i_object_id;
char *psz_section; int i_subcat_id;
int i_type;
char *psz_name;
char *psz_help; char *psz_help;
}; };
...@@ -318,7 +322,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -318,7 +322,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
HINSTANCE hInst ) HINSTANCE hInst )
{ {
vlc_list_t *p_list; vlc_list_t *p_list;
module_t *p_module; module_t *p_module = NULL;
module_config_t *p_item; module_config_t *p_item;
int i_index; int i_index;
...@@ -331,7 +335,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -331,7 +335,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
size_t i_capability_count = 0; size_t i_capability_count = 0;
size_t i_child_index; size_t i_child_index;
HTREEITEM capability_item; HTREEITEM category_item, subcategory_item;
/* Initializations */ /* Initializations */
p_intf = _p_intf; p_intf = _p_intf;
...@@ -366,9 +370,9 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -366,9 +370,9 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
* Build a tree of the main options * Build a tree of the main options
*/ */
ConfigTreeData *config_data = new ConfigTreeData; ConfigTreeData *config_data = new ConfigTreeData;
config_data->i_object_id = GENERAL_ID; config_data->i_object_id = TYPE_CATEGORY;
config_data->psz_help = strdup("nothing");//strdup( GENERAL_HELP ); config_data->psz_help = strdup(MAIN_HELP);
config_data->psz_section = strdup( GENERAL_TITLE ); config_data->psz_name = strdup( GENERAL_TITLE );
tvi.pszText = _T("General settings"); tvi.pszText = _T("General settings");
tvi.cchTextMax = lstrlen(_T("General settings")); tvi.cchTextMax = lstrlen(_T("General settings"));
tvi.lParam = (long)config_data; tvi.lParam = (long)config_data;
...@@ -380,173 +384,240 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -380,173 +384,240 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
hPrev = (HTREEITEM) TreeView_InsertItem( hwndTV, &tvins); hPrev = (HTREEITEM) TreeView_InsertItem( hwndTV, &tvins);
general_item = hPrev; general_item = hPrev;
/* Build the categories list */
for( i_index = 0; i_index < p_list->i_count; i_index++ ) for( i_index = 0; i_index < p_list->i_count; i_index++ )
{ {
p_module = (module_t *)p_list->p_values[i_index].p_object; p_module = (module_t *)p_list->p_values[i_index].p_object;
if( !strcmp( p_module->psz_object_name, "main" ) ) if( strcmp( module_GetObjName( p_module ), "main" ) == 0 )
break; break;
} }
/* TODO replace by
* p_module = module_GetMainModule( p_intf );
*/
if( i_index < p_list->i_count ) if( i_index < p_list->i_count )
{ {
unsigned int confsize;
const char *psz_help;
module_config_t * p_config;
/* We found the main module */ /* We found the main module */
/* Enumerate config categories and store a reference so we can /* Enumerate config categories and store a reference so we can
* generate their config panel them when it is asked by the user. */ * generate their config panel them when it is asked by the user. */
p_item = p_module->p_config; p_config = module_GetConfig (p_module, &confsize);
if( p_item ) do for( size_t i = 0; i < confsize; i++ )
{ {
switch( p_item->i_type ) /* Work on a new item */
{ module_config_t *p_item = p_config + i;
case CONFIG_HINT_CATEGORY:
ConfigTreeData *config_data = new ConfigTreeData;
config_data->psz_section = strdup( p_item->psz_text );
if( p_item->psz_longtext )
{
config_data->psz_help =
strdup( p_item->psz_longtext );
}
else
{
config_data->psz_help = NULL;
}
config_data->i_object_id = p_module->i_object_id;
/* Add the category to the tree */
// Set the text of the item.
tvi.pszText = _FROMMB(p_item->psz_text);
tvi.cchTextMax = _tcslen(tvi.pszText);
tvi.lParam = (long)config_data;
tvins.item = tvi;
tvins.hInsertAfter = hPrev;
tvins.hParent = general_item; //level 3
// Add the item to the tree-view control.
hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins );
break; switch( p_item->i_type )
} {
} case CONFIG_CATEGORY:
while( p_item->i_type != CONFIG_HINT_END && p_item++ ); if( p_item->value.i == -1 ) break; // Don't display it
config_data = new ConfigTreeData;
config_data->psz_name = strdup( config_CategoryNameGet(p_item->value.i ) );
psz_help = config_CategoryHelpGet( p_item->value.i );
if( psz_help )
{
config_data->psz_help = wraptext( strdup( psz_help ), 72 );
}
else
{
config_data->psz_help = NULL;
}
config_data->i_type = TYPE_CATEGORY;
config_data->i_object_id = p_item->value.i;
config_data->p_module = p_module;
tvi.pszText = _FROMMB(config_data->psz_name);
tvi.cchTextMax = _tcslen(tvi.pszText);
/* Add the category to the tree */
tvi.lParam = (long)config_data;
tvins.item = tvi;
tvins.hInsertAfter = hPrev;
tvins.hParent = general_item; //level 3
// Add the item to the tree-view control.
hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins );
break;
case CONFIG_SUBCATEGORY:
if( p_item->value.i == -1 ) break; // Don't display it
/* Special case: move the "general" subcategories to their parent category */
if(config_data && p_item->value.i == SUBCAT_VIDEO_GENERAL ||
p_item->value.i == SUBCAT_ADVANCED_MISC ||
p_item->value.i == SUBCAT_INPUT_GENERAL ||
p_item->value.i == SUBCAT_INTERFACE_GENERAL ||
p_item->value.i == SUBCAT_SOUT_GENERAL||
p_item->value.i == SUBCAT_PLAYLIST_GENERAL||
p_item->value.i == SUBCAT_AUDIO_GENERAL )
{
config_data->i_type = TYPE_CATSUBCAT;
config_data->i_subcat_id = p_item->value.i;
free( config_data->psz_name );
config_data->psz_name = strdup( config_CategoryNameGet( p_item->value.i ) );
free( config_data->psz_help );
const char *psz_help = config_CategoryHelpGet( p_item->value.i );
if( psz_help )
{
config_data->psz_help = wraptext( strdup( psz_help ), 72 );
}
else
{
config_data->psz_help = NULL;
}
continue;
}
config_data = new ConfigTreeData;
config_data->psz_name = strdup( config_CategoryNameGet( p_item->value.i ) );
psz_help = config_CategoryHelpGet( p_item->value.i );
if( psz_help )
{
config_data->psz_help = wraptext( strdup( psz_help ), 72 );
}
else
{
config_data->psz_help = NULL;
}
config_data->i_type = TYPE_SUBCATEGORY;
config_data->i_object_id = p_item->value.i;
tvi.pszText = _FROMMB(config_data->psz_name);
tvi.cchTextMax = _tcslen(tvi.pszText);
tvi.lParam = (long)config_data;
tvins.item = tvi;
tvins.hInsertAfter = hPrev;
tvins.hParent = hPrev;
// Add the item to the tree-view control.
TreeView_InsertItem( hwndTV, &tvins );
break;
}
}
TreeView_SortChildren( hwndTV, general_item, 0 ); TreeView_SortChildren( hwndTV, general_item, 0 );
module_PutConfig( p_config );
} }
/*
* Build a tree of all the plugins
*/
config_data = new ConfigTreeData;
config_data->i_object_id = PLUGIN_ID;
config_data->psz_help = strdup("nothing");//strdup( PLUGIN_HELP );
config_data->psz_section = strdup("nothing");//strdup( PLUGIN_TITLE );
tvi.pszText = _T("Modules");
tvi.cchTextMax = lstrlen(_T("Modules"));
tvi.lParam = (long)config_data;
tvins.item = tvi;
tvins.hInsertAfter = TVI_LAST;
tvins.hParent = TVI_ROOT;
// Add the item to the tree-view control.
hPrev = (HTREEITEM) TreeView_InsertItem( hwndTV, &tvins);
plugins_item = hPrev;
i_capability_count = 0; module_config_t *p_config;
/*
* Build a tree of all the plugins
*/
for( i_index = 0; i_index < p_list->i_count; i_index++ ) for( i_index = 0; i_index < p_list->i_count; i_index++ )
{ {
i_child_index = 0; /* Take every module */
p_module = (module_t *)p_list->p_values[i_index].p_object; p_module = (module_t *)p_list->p_values[i_index].p_object;
/* Exclude the main module */ /* Exclude the main module */
if( !strcmp( p_module->psz_object_name, "main" ) ) if( !strcmp( module_GetObjName( p_module ), "main" ) )
continue; continue;
/* Exclude empty plugins (submodules don't have config options, they /* Exclude empty plugins (submodules don't have config options, they
* are stored in the parent module) */ * are stored in the parent module) */
if( p_module->b_submodule )
p_item = ((module_t *)p_module->p_parent)->p_config;
else
p_item = p_module->p_config;
if( !p_item ) continue; unsigned int confsize;
do i_child_index = 0;
int i_category = 0, i_subcategory = 0, i_options = 0;
bool b_options = false;
p_config = module_GetConfig( (module_t *) p_module,&confsize);
/* Loop through the configurations items */
for( size_t i = 0; i < confsize; i++ )
{ {
module_config_t *p_item = p_config + i;
if( p_item->i_type == CONFIG_CATEGORY )
i_category = p_item->value.i;
else if( p_item->i_type == CONFIG_SUBCATEGORY )
i_subcategory = p_item->value.i;
if( p_item->i_type & CONFIG_ITEM ) if( p_item->i_type & CONFIG_ITEM )
b_options = true;
if( b_options && i_category && i_subcategory )
break; break;
} }
while( p_item->i_type != CONFIG_HINT_END && p_item++ ); module_PutConfig (p_config);
if( p_item->i_type == CONFIG_HINT_END ) continue;
/* Find the capability child item */ //if( !i_options ) continue;
/*long cookie; size_t i_child_index;*/ /* Dummy item, please proceed */
capability_item = TreeView_GetChild( hwndTV, plugins_item ); if( !b_options || i_category == 0 || i_subcategory == 0 ) continue;
while( capability_item != 0 )
{
TVITEM capability_tvi = {0};
TCHAR psz_text[256];
i_child_index++;
capability_tvi.mask = TVIF_TEXT;
capability_tvi.pszText = psz_text;
capability_tvi.cchTextMax = 256;
capability_tvi.hItem = capability_item;
TreeView_GetItem( hwndTV, &capability_tvi );
if( !strcmp( _TOMB(capability_tvi.pszText),
p_module->psz_capability ) ) break;
capability_item =
TreeView_GetNextSibling( hwndTV, capability_item );
}
if( i_child_index == i_capability_count && category_item = TreeView_GetChild( hwndTV, general_item );
p_module->psz_capability && *p_module->psz_capability ) while(category_item != 0)
{ {
/* We didn't find it, add it */ TVITEM category_tvi = {0};
ConfigTreeData *config_data = new ConfigTreeData;
config_data->psz_section = category_tvi.mask = TVIF_PARAM;
strdup( GetCapabilityHelp( p_module->psz_capability , 1 ) ); category_tvi.lParam = NULL;
config_data->psz_help = category_tvi.hItem = category_item;
strdup( GetCapabilityHelp( p_module->psz_capability , 2 ) ); TreeView_GetItem( hwndTV, &category_tvi );
config_data->i_object_id = CAPABILITY_ID;
tvi.pszText = _FROMMB(p_module->psz_capability); ConfigTreeData * data = (ConfigTreeData *)category_tvi.lParam;
tvi.cchTextMax = _tcslen(tvi.pszText);
tvi.lParam = (long)config_data; if( data->i_object_id == i_category )
tvins.item = tvi; {
tvins.hInsertAfter = plugins_item; subcategory_item = TreeView_GetChild( hwndTV, category_item );
tvins.hParent = plugins_item;// level 3
while(subcategory_item != 0)
// Add the item to the tree-view control. {
capability_item = (HTREEITEM) TreeView_InsertItem( hwndTV, &tvins); TVITEM subcategory_tvi = {0};
i_capability_count++; subcategory_tvi.mask = TVIF_PARAM;
subcategory_tvi.lParam = NULL;
subcategory_tvi.hItem = subcategory_item;
TreeView_GetItem( hwndTV, &subcategory_tvi );
ConfigTreeData * subdata = (ConfigTreeData *)subcategory_tvi.lParam;
if( subdata->i_object_id == i_subcategory )
{
config_data = new ConfigTreeData;
config_data->psz_name = strdup( module_GetObjName( p_module ) );
config_data->psz_help = NULL;
config_data->i_type = TYPE_MODULE;
config_data->i_object_id = p_item->value.i;
config_data->p_module = p_module;
tvi.pszText = _FROMMB(module_GetName( p_module, false ));
tvi.cchTextMax = _tcslen(tvi.pszText);
tvi.lParam = (long)config_data;
tvins.item = tvi;
tvins.hInsertAfter = subcategory_item;
tvins.hParent = subcategory_item;
// Add the item to the tree-view control.
hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins );
break;
}
subcategory_item = TreeView_GetNextSibling( hwndTV, subcategory_item );
}
break;
}
category_item = TreeView_GetNextSibling( hwndTV, category_item );
} }
/* Add the plugin to the tree */
ConfigTreeData *config_data = new ConfigTreeData;
config_data->b_submodule = p_module->b_submodule;
config_data->i_object_id = p_module->b_submodule ?
((module_t *)p_module->p_parent)->i_object_id :
p_module->i_object_id;
config_data->psz_help = NULL;
tvi.pszText = _FROMMB(p_module->psz_object_name);
tvi.cchTextMax = _tcslen(tvi.pszText);
tvi.lParam = (long)config_data;
tvins.item = tvi;
tvins.hInsertAfter = capability_item;
tvins.hParent = capability_item;// level 4
// Add the item to the tree-view control.
TreeView_InsertItem( hwndTV, &tvins );
} }
/* Sort all this mess */ /* Sort all this mess */
/*long cookie; size_t i_child_index;*/ TreeView_SortChildren( hwndTV, general_item, 0 );
TreeView_SortChildren( hwndTV, plugins_item, 0 ); category_item = TreeView_GetChild( hwndTV, general_item );
capability_item = TreeView_GetChild( hwndTV, plugins_item ); while( category_item != 0 )
while( capability_item != 0 )
{ {
TreeView_SortChildren( hwndTV, capability_item, 0 ); TreeView_SortChildren( hwndTV, category_item, 0 );
capability_item = TreeView_GetNextSibling( hwndTV, capability_item ); category_item = TreeView_GetNextSibling( hwndTV, category_item );
} }
/* Clean-up everything */ /* Clean-up everything */
...@@ -561,7 +632,6 @@ PrefsTreeCtrl::~PrefsTreeCtrl() ...@@ -561,7 +632,6 @@ PrefsTreeCtrl::~PrefsTreeCtrl()
void PrefsTreeCtrl::ApplyChanges() void PrefsTreeCtrl::ApplyChanges()
{ {
/*long cookie, cookie2;*/
ConfigTreeData *config_data; ConfigTreeData *config_data;
/* Apply changes to the main module */ /* Apply changes to the main module */
...@@ -582,20 +652,25 @@ void PrefsTreeCtrl::ApplyChanges() ...@@ -582,20 +652,25 @@ void PrefsTreeCtrl::ApplyChanges()
} }
/* Apply changes to the plugins */ /* Apply changes to the plugins */
item = TreeView_GetChild( hwndTV, plugins_item ); item = TreeView_GetChild( hwndTV, general_item );
while( item != 0 ) while( item != 0 )
{ {
HTREEITEM item2 = TreeView_GetChild( hwndTV, item ); HTREEITEM item2 = TreeView_GetChild( hwndTV, item );
while( item2 != 0 ) while( item2 != 0 )
{ {
TVITEM tvi = {0}; HTREEITEM item3 = TreeView_GetChild( hwndTV, item2 );
tvi.mask = TVIF_PARAM; while(item3 !=0)
tvi.hItem = item2;
TreeView_GetItem( hwndTV, &tvi );
config_data = (ConfigTreeData *)tvi.lParam;
if( config_data && config_data->panel )
{ {
config_data->panel->ApplyChanges(); TVITEM tvi = {0};
tvi.mask = TVIF_PARAM;
tvi.hItem = item3;
TreeView_GetItem( hwndTV, &tvi );
config_data = (ConfigTreeData *)tvi.lParam;
if( config_data && config_data->panel )
{
config_data->panel->ApplyChanges();
}
item3 = TreeView_GetNextSibling( hwndTV, item3 );
} }
item2 = TreeView_GetNextSibling( hwndTV, item2 ); item2 = TreeView_GetNextSibling( hwndTV, item2 );
} }
...@@ -605,31 +680,31 @@ void PrefsTreeCtrl::ApplyChanges() ...@@ -605,31 +680,31 @@ void PrefsTreeCtrl::ApplyChanges()
ConfigTreeData *PrefsTreeCtrl::FindModuleConfig( ConfigTreeData *config_data ) ConfigTreeData *PrefsTreeCtrl::FindModuleConfig( ConfigTreeData *config_data )
{ {
/* We need this complexity because submodules don't have their own config if( !config_data || !config_data->p_module )
* options. They use the parent module ones. */
if( !config_data || !config_data->b_submodule )
{ {
return config_data; return config_data;
} }
/*long cookie, cookie2;*/
ConfigTreeData *config_new; ConfigTreeData *config_new;
HTREEITEM item = TreeView_GetChild( hwndTV, plugins_item ); HTREEITEM item = TreeView_GetChild( hwndTV, general_item );
while( item != 0 ) while( item != 0 )
{ {
HTREEITEM item2 = TreeView_GetChild( hwndTV, item ); HTREEITEM item2 = TreeView_GetChild( hwndTV, item );
while( item2 != 0 ) while( item2 != 0 )
{ {
TVITEM tvi = {0}; HTREEITEM item3 = TreeView_GetChild( hwndTV, item2 );
tvi.mask = TVIF_PARAM; while( item3 != 0 )
tvi.hItem = item2;
TreeView_GetItem( hwndTV, &tvi );
config_new = (ConfigTreeData *)tvi.lParam;
if( config_new && !config_new->b_submodule &&
config_new->i_object_id == config_data->i_object_id )
{ {
return config_new; TVITEM tvi = {0};
tvi.mask = TVIF_PARAM;
tvi.hItem = item3;
TreeView_GetItem( hwndTV, &tvi );
config_new = (ConfigTreeData *)tvi.lParam;
if( config_new && config_new->p_module == config_data->p_module )
{
return config_new;
}
item3 = TreeView_GetNextSibling( hwndTV, item3 );
} }
item2 = TreeView_GetNextSibling( hwndTV, item2 ); item2 = TreeView_GetNextSibling( hwndTV, item2 );
} }
...@@ -666,9 +741,9 @@ void PrefsTreeCtrl::OnSelectTreeItem( LPNM_TREEVIEW pnmtv, HWND parent, ...@@ -666,9 +741,9 @@ void PrefsTreeCtrl::OnSelectTreeItem( LPNM_TREEVIEW pnmtv, HWND parent,
/* The panel hasn't been created yet. Let's do it. */ /* The panel hasn't been created yet. Let's do it. */
config_data->panel = config_data->panel =
new PrefsPanel( parent, hInst, p_intf, p_prefs_dialog, new PrefsPanel( parent, hInst, p_intf, p_prefs_dialog,
config_data->i_object_id, config_data->p_module,
config_data->psz_section, config_data->psz_name,
config_data->psz_help ); config_data->psz_help, config_data );
} }
else else
{ {
...@@ -682,21 +757,20 @@ void PrefsTreeCtrl::OnSelectTreeItem( LPNM_TREEVIEW pnmtv, HWND parent, ...@@ -682,21 +757,20 @@ void PrefsTreeCtrl::OnSelectTreeItem( LPNM_TREEVIEW pnmtv, HWND parent,
*****************************************************************************/ *****************************************************************************/
PrefsPanel::PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf, PrefsPanel::PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf,
PrefsDialog *_p_prefs_dialog, PrefsDialog *_p_prefs_dialog,
int i_object_id, char *psz_section, char *psz_help ) module_t *p_module, char *psz_name, char *psz_help, ConfigTreeData * config_data )
{ {
module_config_t *p_item; module_config_t *p_item, *p_config, *p_end;
module_t *p_module = NULL;
/* Initializations */ /* Initializations */
p_intf = _p_intf; p_intf = _p_intf;
p_prefs_dialog = _p_prefs_dialog; p_prefs_dialog = _p_prefs_dialog;
vlc_list_t *p_list = NULL;
b_advanced = true; b_advanced = true;
if( i_object_id == PLUGIN_ID || i_object_id == GENERAL_ID || if( config_data->i_type == TYPE_CATEGORY )
i_object_id == CAPABILITY_ID )
{ {
label = CreateWindow( _T("STATIC"), _FROMMB(psz_section), label = CreateWindow( _T("STATIC"), _FROMMB(psz_name),
WS_CHILD | WS_VISIBLE | SS_LEFT, WS_CHILD | WS_VISIBLE | SS_LEFT,
5, 10 + (15 + 10), 200, 15, 5, 10 + (15 + 10), 200, 15,
parent, NULL, hInst, NULL ); parent, NULL, hInst, NULL );
...@@ -705,33 +779,79 @@ PrefsPanel::PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf, ...@@ -705,33 +779,79 @@ PrefsPanel::PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf,
else else
{ {
/* Get a pointer to the module */ /* Get a pointer to the module */
p_module = (module_t *)vlc_object_get( i_object_id ); if( config_data->i_type == TYPE_MODULE )
{
p_module = config_data->p_module;
}
else
{
/* List the plugins */
int i_index;
bool b_found = false;
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
if( !p_list ) return;
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
p_module = (module_t *)p_list->p_values[i_index].p_object;
if( !strcmp( module_GetObjName(p_module), "main" ) )
{
b_found = true;
break;
}
}
if( !p_module && !b_found )
{
msg_Warn( p_intf, "unable to create preferences "
"(main module not found)" );
return;
}
}
/* Enumerate config options and add corresponding config boxes /* Enumerate config options and add corresponding config boxes
* (submodules don't have config options, they are stored in the * (submodules don't have config options, they are stored in the
* parent module) */ * parent module) */
if( p_module->b_submodule ) unsigned confsize;
p_item = ((module_t *)p_module->p_parent)->p_config; p_config = module_GetConfig( (module_t *) p_module,&confsize);
else
p_item = p_module->p_config; p_item = p_config;
p_end = p_config + confsize;
/* Find the category if it has been specified */ /* Find the category if it has been specified */
if( psz_section && p_item->i_type == CONFIG_HINT_CATEGORY ) if( config_data->i_type == TYPE_SUBCATEGORY ||
config_data->i_type == TYPE_CATSUBCAT )
{ {
while( !(p_item->i_type == CONFIG_HINT_CATEGORY) || for( ; p_item && p_item < p_end ; p_item++ )
strcmp( psz_section, p_item->psz_text ) )
{ {
if( p_item->i_type == CONFIG_HINT_END ) break; if( p_item->i_type == CONFIG_SUBCATEGORY &&
p_item++; ( config_data->i_type == TYPE_SUBCATEGORY &&
p_item->value.i == config_data->i_object_id ) ||
( config_data->i_type == TYPE_CATSUBCAT &&
p_item->value.i == config_data->i_subcat_id ) )
{
break;
}
} }
} }
/* Add a head title to the panel */ /* Add a head title to the panel */
label = CreateWindow( _T("STATIC"), _FROMMB(psz_section ? const char *psz_head;
p_item->psz_text : p_module->psz_longname), if( config_data->i_type == TYPE_SUBCATEGORY ||
config_data->i_type == TYPE_CATSUBCAT )
{
psz_head = config_data->psz_name;
p_item++;
}
else
{
psz_head = module_GetLongName(p_module);
}
label = CreateWindow( _T("STATIC"), _FROMMB(psz_head ?
psz_head : _("Unknown")),
WS_CHILD | WS_VISIBLE | SS_LEFT, WS_CHILD | WS_VISIBLE | SS_LEFT,
5, 10 + (15 + 10), 250, 15, 5, 10 + (15 + 10), 250, 15,
parent, NULL, hInst, NULL ); parent, NULL, hInst, NULL );
WNDCLASS wc; WNDCLASS wc;
memset( &wc, 0, sizeof(wc) ); memset( &wc, 0, sizeof(wc) );
...@@ -756,15 +876,20 @@ PrefsPanel::PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf, ...@@ -756,15 +876,20 @@ PrefsPanel::PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf,
parent, NULL, hInst, (void *) _p_prefs_dialog ); parent, NULL, hInst, (void *) _p_prefs_dialog );
int y_pos = 5; int y_pos = 5;
if( p_item ) do for( ; p_item && p_item < p_end ; p_item++ )
{ {
/* If a category has been specified, check we finished the job */ /* If a category has been specified, check we finished the job */
if( psz_section && p_item->i_type == CONFIG_HINT_CATEGORY && if( ( ( config_data->i_type == TYPE_SUBCATEGORY &&
strcmp( psz_section, p_item->psz_text ) ) p_item->value.i != config_data->i_object_id ) ||
( config_data->i_type == TYPE_CATSUBCAT &&
p_item->value.i != config_data->i_subcat_id ) ) &&
(p_item->i_type == CONFIG_CATEGORY ||
p_item->i_type == CONFIG_SUBCATEGORY ) )
break; break;
ConfigControl *control = ConfigControl *control = NULL;
CreateConfigControl( VLC_OBJECT(p_intf),
control = CreateConfigControl( VLC_OBJECT(p_intf),
p_item, config_window, p_item, config_window,
hInst, &y_pos ); hInst, &y_pos );
...@@ -774,8 +899,6 @@ PrefsPanel::PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf, ...@@ -774,8 +899,6 @@ PrefsPanel::PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf,
/* Add the config data to our array so we can keep a trace of it */ /* Add the config data to our array so we can keep a trace of it */
config_array.push_back( control ); config_array.push_back( control );
} }
while( p_item->i_type != CONFIG_HINT_END && p_item++ );
GetWindowRect( config_window, &rc); GetWindowRect( config_window, &rc);
maxvalue = y_pos - (rc.bottom - rc.top) + 5; maxvalue = y_pos - (rc.bottom - rc.top) + 5;
oldvalue = 0; oldvalue = 0;
...@@ -798,7 +921,6 @@ void PrefsPanel::Show() ...@@ -798,7 +921,6 @@ void PrefsPanel::Show()
void PrefsPanel::ApplyChanges() void PrefsPanel::ApplyChanges()
{ {
vlc_value_t val; vlc_value_t val;
for( size_t i = 0; i < config_array.size(); i++ ) for( size_t i = 0; i < config_array.size(); i++ )
{ {
ConfigControl *control = config_array[i]; ConfigControl *control = config_array[i];
......
...@@ -193,7 +193,7 @@ KeyConfigControl::KeyConfigControl( vlc_object_t *p_this, ...@@ -193,7 +193,7 @@ KeyConfigControl::KeyConfigControl( vlc_object_t *p_this,
alt = CreateWindow( _T("BUTTON"), _T("Alt"), alt = CreateWindow( _T("BUTTON"), _T("Alt"),
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
20, *py_pos, 15, 15, parent, NULL, hInst, NULL ); 20, *py_pos, 15, 15, parent, NULL, hInst, NULL );
Button_SetCheck( alt, p_item->i_value & KEY_MODIFIER_ALT ? BST_CHECKED : Button_SetCheck( alt, p_item->i_type & KEY_MODIFIER_ALT ? BST_CHECKED :
BST_UNCHECKED ); BST_UNCHECKED );
alt_label = CreateWindow( _T("STATIC"), _T("Alt"), alt_label = CreateWindow( _T("STATIC"), _T("Alt"),
...@@ -204,7 +204,7 @@ KeyConfigControl::KeyConfigControl( vlc_object_t *p_this, ...@@ -204,7 +204,7 @@ KeyConfigControl::KeyConfigControl( vlc_object_t *p_this,
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
20 + 15 + 5 + 30 + 5, *py_pos, 15, 15, 20 + 15 + 5 + 30 + 5, *py_pos, 15, 15,
parent, NULL, hInst, NULL ); parent, NULL, hInst, NULL );
Button_SetCheck( ctrl, p_item->i_value & KEY_MODIFIER_CTRL ? BST_CHECKED : Button_SetCheck( ctrl, p_item->i_type & KEY_MODIFIER_CTRL ? BST_CHECKED :
BST_UNCHECKED ); BST_UNCHECKED );
ctrl_label = CreateWindow( _T("STATIC"), _T("Ctrl"), ctrl_label = CreateWindow( _T("STATIC"), _T("Ctrl"),
...@@ -216,7 +216,7 @@ KeyConfigControl::KeyConfigControl( vlc_object_t *p_this, ...@@ -216,7 +216,7 @@ KeyConfigControl::KeyConfigControl( vlc_object_t *p_this,
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
20 + 15 + 5 + 2*(30 + 5) + 15 + 5, *py_pos, 15, 15, 20 + 15 + 5 + 2*(30 + 5) + 15 + 5, *py_pos, 15, 15,
parent, NULL, hInst, NULL ); parent, NULL, hInst, NULL );
Button_SetCheck( shift, p_item->i_value & KEY_MODIFIER_SHIFT ? Button_SetCheck( shift, p_item->i_type & KEY_MODIFIER_SHIFT ?
BST_CHECKED : BST_UNCHECKED ); BST_CHECKED : BST_UNCHECKED );
shift_label = CreateWindow( _T("STATIC"), _T("Shift"), shift_label = CreateWindow( _T("STATIC"), _T("Shift"),
...@@ -238,7 +238,7 @@ KeyConfigControl::KeyConfigControl( vlc_object_t *p_this, ...@@ -238,7 +238,7 @@ KeyConfigControl::KeyConfigControl( vlc_object_t *p_this,
ComboBox_AddString( combo, _FROMMB(m_keysList[i].c_str()) ); ComboBox_AddString( combo, _FROMMB(m_keysList[i].c_str()) );
ComboBox_SetItemData( combo, i, (void*)vlc_keys[i].i_key_code ); ComboBox_SetItemData( combo, i, (void*)vlc_keys[i].i_key_code );
if( (unsigned int)vlc_keys[i].i_key_code == if( (unsigned int)vlc_keys[i].i_key_code ==
( ((unsigned int)p_item->i_value) & ~KEY_MODIFIER ) ) ( ((unsigned int)p_item->i_type) & ~KEY_MODIFIER ) )
{ {
ComboBox_SetCurSel( combo, i ); ComboBox_SetCurSel( combo, i );
ComboBox_SetText( combo, _FROMMB(m_keysList[i].c_str()) ); ComboBox_SetText( combo, _FROMMB(m_keysList[i].c_str()) );
...@@ -315,13 +315,13 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *p_this, ...@@ -315,13 +315,13 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *p_this,
{ {
p_parser = (module_t *)p_list->p_values[i_index].p_object ; p_parser = (module_t *)p_list->p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_capability, p_item->psz_type ) ) if( module_IsCapable( p_parser, p_item->psz_type ) )
{ {
ComboBox_AddString( combo, _FROMMB(p_parser->psz_longname) ); ComboBox_AddString( combo, _FROMMB(module_GetLongName( p_parser ) ));
ComboBox_SetItemData( combo, i_index, ComboBox_SetItemData( combo, i_index,
(void*)p_parser->psz_object_name ); (void *) module_GetObjName( p_parser ) );
if( p_item->psz_value && !strcmp(p_item->psz_value, if( p_item->value.psz && !strcmp( p_item->value.psz,
p_parser->psz_object_name) ) module_GetObjName( p_parser )) )
{ {
ComboBox_SetCurSel( combo, i_index ); ComboBox_SetCurSel( combo, i_index );
//ComboBox_SetText( combo, _FROMMB(p_parser->psz_longname) ); //ComboBox_SetText( combo, _FROMMB(p_parser->psz_longname) );
...@@ -360,8 +360,8 @@ StringConfigControl::StringConfigControl( vlc_object_t *p_this, ...@@ -360,8 +360,8 @@ StringConfigControl::StringConfigControl( vlc_object_t *p_this,
*py_pos += 15 + 10; *py_pos += 15 + 10;
textctrl = CreateWindow( _T("EDIT"), p_item->psz_value ? textctrl = CreateWindow( _T("EDIT"), p_item->psz_type ?
_FROMMB(p_item->psz_value) : _T(""), _FROMMB(p_item->psz_type) : _T(""),
WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | SS_LEFT |
ES_AUTOHSCROLL, 20, *py_pos - 3, 180, 15 + 3, ES_AUTOHSCROLL, 20, *py_pos - 3, 180, 15 + 3,
parent, NULL, hInst, NULL ); parent, NULL, hInst, NULL );
...@@ -733,7 +733,7 @@ FloatConfigControl::FloatConfigControl( vlc_object_t *p_this, ...@@ -733,7 +733,7 @@ FloatConfigControl::FloatConfigControl( vlc_object_t *p_this,
*py_pos += 15 + 10; *py_pos += 15 + 10;
TCHAR psz_string[100]; TCHAR psz_string[100];
_stprintf( psz_string, _T("%f"), p_item->f_value ); _stprintf( psz_string, _T("%d"), p_item->i_type );
textctrl = CreateWindow( _T("EDIT"), psz_string, textctrl = CreateWindow( _T("EDIT"), psz_string,
WS_CHILD | WS_VISIBLE | WS_BORDER | SS_RIGHT | ES_AUTOHSCROLL, WS_CHILD | WS_VISIBLE | WS_BORDER | SS_RIGHT | ES_AUTOHSCROLL,
20, *py_pos - 3, 70, 15 + 3, parent, NULL, hInst, NULL ); 20, *py_pos - 3, 70, 15 + 3, parent, NULL, hInst, NULL );
...@@ -776,7 +776,7 @@ BoolConfigControl::BoolConfigControl( vlc_object_t *p_this, ...@@ -776,7 +776,7 @@ BoolConfigControl::BoolConfigControl( vlc_object_t *p_this,
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX, WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
5, *py_pos, 15, 15, 5, *py_pos, 15, 15,
parent, NULL, hInst, NULL ); parent, NULL, hInst, NULL );
Button_SetCheck( checkbox, p_item->i_value ? BST_CHECKED : BST_UNCHECKED ); Button_SetCheck( checkbox, config_GetInt(p_this, p_item->psz_name) ? BST_CHECKED : BST_UNCHECKED );
checkbox_label = CreateWindow( _T("STATIC"), _FROMMB(p_item->psz_text), checkbox_label = CreateWindow( _T("STATIC"), _FROMMB(p_item->psz_text),
WS_CHILD | WS_VISIBLE | SS_LEFT, WS_CHILD | WS_VISIBLE | SS_LEFT,
......
...@@ -139,7 +139,7 @@ LRESULT SubsFileDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) ...@@ -139,7 +139,7 @@ LRESULT SubsFileDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
hwnd, NULL, hInst, NULL ); hwnd, NULL, hInst, NULL );
encoding_combo = CreateWindow( _T("COMBOBOX"), encoding_combo = CreateWindow( _T("COMBOBOX"),
_FROMMB(p_item->psz_value), _FROMMB(p_item->value.psz),
WS_CHILD | WS_VISIBLE | CBS_AUTOHSCROLL | CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | CBS_AUTOHSCROLL | CBS_DROPDOWNLIST |
LBS_SORT | WS_VSCROLL, LBS_SORT | WS_VSCROLL,
rcClient.right - 150 - 10, 10 + 5*(15 + 10) - 3, 150, 5*15 + 6, rcClient.right - 150 - 10, 10 + 5*(15 + 10) - 3, 150, 5*15 + 6,
...@@ -152,15 +152,15 @@ LRESULT SubsFileDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp ) ...@@ -152,15 +152,15 @@ LRESULT SubsFileDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
ComboBox_AddString( encoding_combo, ComboBox_AddString( encoding_combo,
_FROMMB(p_item->ppsz_list[i_index]) ); _FROMMB(p_item->ppsz_list[i_index]) );
if( p_item->psz_value && if( p_item->value.psz &&
!strcmp( p_item->psz_value, p_item->ppsz_list[i_index] ) ) !strcmp( p_item->value.psz, p_item->ppsz_list[i_index] ) )
ComboBox_SetCurSel( encoding_combo, i_index ); ComboBox_SetCurSel( encoding_combo, i_index );
} }
if( p_item->psz_value ) if( p_item->value.psz )
{ {
ComboBox_SelectString( encoding_combo, 0, ComboBox_SelectString( encoding_combo, 0,
_FROMMB(p_item->psz_value) ); _FROMMB(p_item->value.psz) );
} }
} }
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_aout.h> #include <vlc_aout.h>
#include <vlc_interface.h> #include <vlc_interface.h>
#include <vlc_input.h>
#include <vlc_playlist.h>
#include "wince.h" #include "wince.h"
...@@ -105,9 +107,10 @@ void Timer::Notify( void ) ...@@ -105,9 +107,10 @@ void Timer::Notify( void )
ShowWindow( p_main_interface->hwndVol, SW_SHOW ); ShowWindow( p_main_interface->hwndVol, SW_SHOW );
// only for local file, check if works well with net url // only for local file, check if works well with net url
shortname = strrchr( p_intf->p_sys->p_input->input.p_item->psz_name, '\\' ); input_item_t *p_item =input_GetItem(p_intf->p_sys->p_input);
shortname = strrchr( input_item_GetURL(p_item), '\\' );
if (! shortname) if (! shortname)
shortname = p_intf->p_sys->p_input->input.p_item->psz_name; shortname = input_item_GetURL(p_item);
else shortname++; else shortname++;
SendMessage( p_main_interface->hwndSB, SB_SETTEXT, SendMessage( p_main_interface->hwndSB, SB_SETTEXT,
......
...@@ -100,9 +100,10 @@ VideoWindow::VideoWindow( intf_thread_t *_p_intf, HWND _p_parent ) ...@@ -100,9 +100,10 @@ VideoWindow::VideoWindow( intf_thread_t *_p_intf, HWND _p_parent )
p_vout = NULL; p_vout = NULL;
p_intf->pf_request_window = ::GetWindow; // Changeset 138da19...
p_intf->pf_release_window = ::ReleaseWindow; //p_intf->pf_request_window = ::GetWindow;
p_intf->pf_control_window = ::ControlWindow; //p_intf->pf_release_window = ::ReleaseWindow;
//p_intf->pf_control_window = ::ControlWindow;
p_intf->p_sys->p_video_window = this; p_intf->p_sys->p_video_window = this;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_interface.h> #include <vlc_interface.h>
#include <vlc_input.h>
#if defined( UNDER_CE ) && defined(__MINGW32__) #if defined( UNDER_CE ) && defined(__MINGW32__)
/* This is a gross hack for the wince gcc cross-compiler */ /* This is a gross hack for the wince gcc cross-compiler */
...@@ -51,7 +52,7 @@ static void Run ( intf_thread_t * ); ...@@ -51,7 +52,7 @@ static void Run ( intf_thread_t * );
static int OpenDialogs( vlc_object_t * ); static int OpenDialogs( vlc_object_t * );
static void* MainLoop ( intf_thread_t * ); static void* MainLoop ( vlc_object_t * );
static void ShowDialog( intf_thread_t *, int, int, intf_dialog_args_t * ); static void ShowDialog( intf_thread_t *, int, int, intf_dialog_args_t * );
/***************************************************************************** /*****************************************************************************
...@@ -62,11 +63,14 @@ static void ShowDialog( intf_thread_t *, int, int, intf_dialog_args_t * ); ...@@ -62,11 +63,14 @@ static void ShowDialog( intf_thread_t *, int, int, intf_dialog_args_t * );
"of having it in a separate window.") "of having it in a separate window.")
vlc_module_begin(); vlc_module_begin();
set_shortname( "WinCE" );
set_description( (char *) _("WinCE interface module") ); set_description( (char *) _("WinCE interface module") );
set_capability( "interface", 100 ); set_capability( "interface", 100 );
set_callbacks( Open, Close ); set_callbacks( Open, Close );
add_shortcut( "wince" ); add_shortcut( "wince" );
set_category( CAT_INTERFACE );
set_subcategory( SUBCAT_INTERFACE_MAIN );
add_bool( "wince-embed", 1, NULL, add_bool( "wince-embed", 1, NULL,
EMBED_TEXT, EMBED_LONGTEXT, false ); EMBED_TEXT, EMBED_LONGTEXT, false );
...@@ -152,10 +156,11 @@ static int OpenDialogs( vlc_object_t *p_this ) ...@@ -152,10 +156,11 @@ static int OpenDialogs( vlc_object_t *p_this )
static void Close( vlc_object_t *p_this ) static void Close( vlc_object_t *p_this )
{ {
intf_thread_t *p_intf = (intf_thread_t *)p_this; intf_thread_t *p_intf = (intf_thread_t *)p_this;
intf_sys_t *p_sys = p_intf->p_sys;
if( p_intf->p_sys->p_input ) if( p_sys->p_input )
{ {
vlc_object_release( p_intf->p_sys->p_input ); vlc_object_release( p_sys->p_input );
} }
MenuItemExt::ClearList( p_intf->p_sys->p_video_menu ); MenuItemExt::ClearList( p_intf->p_sys->p_video_menu );
...@@ -194,10 +199,10 @@ static void Run( intf_thread_t *p_intf ) ...@@ -194,10 +199,10 @@ static void Run( intf_thread_t *p_intf )
/* The module is used in dialog provider mode */ /* The module is used in dialog provider mode */
/* Create a new thread for the dialogs provider */ /* Create a new thread for the dialogs provider */
if( vlc_thread_create( p_intf, "Skins Dialogs Thread", if( vlc_thread_create( p_intf, "WinCE Dialogs Thread",
MainLoop, 0, true ) ) MainLoop, 0, true ) )
{ {
msg_Err( p_intf, "cannot create Skins Dialogs Thread" ); msg_Err( p_intf, "cannot create WinCE Dialogs Thread" );
p_intf->pf_show_dialog = NULL; p_intf->pf_show_dialog = NULL;
} }
} }
...@@ -205,7 +210,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -205,7 +210,7 @@ static void Run( intf_thread_t *p_intf )
{ {
int canc = vlc_savecancel(); int canc = vlc_savecancel();
/* The module is used in interface mode */ /* The module is used in interface mode */
MainLoop( p_intf ); MainLoop( VLC_OBJECT(p_intf) );
vlc_restorecancel( canc ); vlc_restorecancel( canc );
} }
} }
......
...@@ -134,7 +134,7 @@ END ...@@ -134,7 +134,7 @@ END
// Icon with lowest ID value placed first to ensure application icon // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems. // remains consistent on all systems.
#ifdef __MINGW32__ #ifdef UNDER_CE
IDI_ICON1 ICON DISCARDABLE "bitmaps/vlc16x16.ico" IDI_ICON1 ICON DISCARDABLE "bitmaps/vlc16x16.ico"
#else #else
IDI_ICON1 ICON DISCARDABLE "bitmaps\\vlc16x16.ico" IDI_ICON1 ICON DISCARDABLE "bitmaps\\vlc16x16.ico"
...@@ -143,9 +143,9 @@ IDI_ICON1 ICON DISCARDABLE "bitmaps\\vlc16x16.ico" ...@@ -143,9 +143,9 @@ IDI_ICON1 ICON DISCARDABLE "bitmaps\\vlc16x16.ico"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Bitmap // Bitmap
// //
#ifdef __MINGW32__ #ifdef UNDER_CE
IDB_BITMAP1 BITMAP DISCARDABLE "bitmaps/toolbar1.bmp" IDB_BITMAP1 BITMAP DISCARDABLE "bitmaps/toolbar1.bmp"
IDB_BITMAP2 BITMAP DISCARDABLE "bitmaps/toolbar2.bmp" IDB_BITMAP2 BITMAP DISCARDABLE "bitmaps/toolbar2.bmp"
IDB_BITMAP3 BITMAP DISCARDABLE "bitmaps/toolbar3.bmp" IDB_BITMAP3 BITMAP DISCARDABLE "bitmaps/toolbar3.bmp"
......
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