Commit e4e2ff7f authored by Geoffroy Couprie's avatar Geoffroy Couprie

WinCE intf: get rid of VLC_OBJECT_MODULE

parent 559e9799
...@@ -321,10 +321,8 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -321,10 +321,8 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
PrefsDialog *_p_prefs_dialog, HWND hwnd, PrefsDialog *_p_prefs_dialog, HWND hwnd,
HINSTANCE hInst ) HINSTANCE hInst )
{ {
vlc_list_t *p_list;
module_t *p_module = NULL; module_t *p_module = NULL;
module_config_t *p_item; module_config_t *p_item;
int i_index;
INITCOMMONCONTROLSEX iccex; INITCOMMONCONTROLSEX iccex;
RECT rcClient; RECT rcClient;
...@@ -362,10 +360,6 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -362,10 +360,6 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
/* List the plugins */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
if( !p_list ) return;
/* /*
* Build a tree of the main options * Build a tree of the main options
*/ */
...@@ -385,98 +379,72 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -385,98 +379,72 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
general_item = hPrev; general_item = hPrev;
/* Build the categories list */ /* Build the categories list */
for( i_index = 0; i_index < p_list->i_count; i_index++ ) p_module = module_get_main();
{
p_module = (module_t *)p_list->p_values[i_index].p_object;
if( strcmp( module_get_object( p_module ), "main" ) == 0 )
break;
}
/* TODO replace by
* p_module = module_get_main( p_intf );
*/
if( i_index < p_list->i_count )
{
unsigned int confsize;
const char *psz_help;
module_config_t * p_config;
/* We found the main module */ unsigned int confsize;
const char *psz_help;
module_config_t * p_config;
/* 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 when it is asked by the user. */
p_config = module_config_get (p_module, &confsize); p_config = module_config_get (p_module, &confsize);
for( size_t i = 0; i < confsize; i++ ) for( size_t i = 0; i < confsize; i++ )
{ {
/* Work on a new item */ /* Work on a new item */
module_config_t *p_item = p_config + i; module_config_t *p_item = p_config + i;
switch( p_item->i_type )
{
case CONFIG_CATEGORY:
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; switch( p_item->i_type )
config_data->i_object_id = p_item->value.i; {
config_data->p_module = p_module; case CONFIG_CATEGORY:
tvi.pszText = _FROMMB(config_data->psz_name); if( p_item->value.i == -1 ) break; // Don't display it
tvi.cchTextMax = _tcslen(tvi.pszText); 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;
}
/* Add the category to the tree */ config_data->i_type = TYPE_CATEGORY;
tvi.lParam = (long)config_data; config_data->i_object_id = p_item->value.i;
tvins.item = tvi; config_data->p_module = p_module;
tvins.hInsertAfter = hPrev; tvi.pszText = _FROMMB(config_data->psz_name);
tvins.hParent = general_item; //level 3 tvi.cchTextMax = _tcslen(tvi.pszText);
// Add the item to the tree-view control. /* Add the category to the tree */
hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins ); tvi.lParam = (long)config_data;
break; tvins.item = tvi;
tvins.hInsertAfter = hPrev;
tvins.hParent = general_item; //level 3
case CONFIG_SUBCATEGORY: // Add the item to the tree-view control.
if( p_item->value.i == -1 ) break; // Don't display it hPrev = (HTREEITEM)TreeView_InsertItem( hwndTV, &tvins );
/* Special case: move the "general" subcategories to their parent category */ break;
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; case CONFIG_SUBCATEGORY:
config_data->i_subcat_id = p_item->value.i; if( p_item->value.i == -1 ) break; // Don't display it
free( config_data->psz_name ); /* Special case: move the "general" subcategories to their parent category */
config_data->psz_name = strdup( config_CategoryNameGet( p_item->value.i ) ); if(config_data && p_item->value.i == SUBCAT_VIDEO_GENERAL ||
p_item->value.i == SUBCAT_ADVANCED_MISC ||
free( config_data->psz_help ); p_item->value.i == SUBCAT_INPUT_GENERAL ||
const char *psz_help = config_CategoryHelpGet( p_item->value.i ); p_item->value.i == SUBCAT_INTERFACE_GENERAL ||
if( psz_help ) p_item->value.i == SUBCAT_SOUT_GENERAL||
{ p_item->value.i == SUBCAT_PLAYLIST_GENERAL||
config_data->psz_help = wraptext( strdup( psz_help ), 72 ); p_item->value.i == SUBCAT_AUDIO_GENERAL )
} {
else
{
config_data->psz_help = NULL;
}
continue;
}
config_data = new ConfigTreeData; 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 ) );
config_data->psz_name = strdup( config_CategoryNameGet( p_item->value.i ) ); free( config_data->psz_help );
psz_help = config_CategoryHelpGet( p_item->value.i ); const char *psz_help = config_CategoryHelpGet( p_item->value.i );
if( psz_help ) if( psz_help )
{ {
config_data->psz_help = wraptext( strdup( psz_help ), 72 ); config_data->psz_help = wraptext( strdup( psz_help ), 72 );
...@@ -485,39 +453,54 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -485,39 +453,54 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
{ {
config_data->psz_help = NULL; config_data->psz_help = NULL;
} }
config_data->i_type = TYPE_SUBCATEGORY; continue;
config_data->i_object_id = p_item->value.i; }
tvi.pszText = _FROMMB(config_data->psz_name); config_data = new ConfigTreeData;
tvi.cchTextMax = _tcslen(tvi.pszText);
tvi.lParam = (long)config_data; config_data->psz_name = strdup( config_CategoryNameGet( p_item->value.i ) );
tvins.item = tvi; psz_help = config_CategoryHelpGet( p_item->value.i );
tvins.hInsertAfter = hPrev; if( psz_help )
tvins.hParent = hPrev; {
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;
// Add the item to the tree-view control. tvi.pszText = _FROMMB(config_data->psz_name);
TreeView_InsertItem( hwndTV, &tvins ); tvi.cchTextMax = _tcslen(tvi.pszText);
break;
} tvi.lParam = (long)config_data;
} tvins.item = tvi;
TreeView_SortChildren( hwndTV, general_item, 0 ); tvins.hInsertAfter = hPrev;
module_config_free( p_config ); tvins.hParent = hPrev;
}
// Add the item to the tree-view control.
TreeView_InsertItem( hwndTV, &tvins );
break;
}
}
TreeView_SortChildren( hwndTV, general_item, 0 );
module_config_free( p_config );
/* List the plugins */
module_t **p_list = module_list_get( NULL );
module_config_t *p_config;
/* /*
* Build a tree of all the plugins * Build a tree of all the plugins
*/ */
for( i_index = 0; i_index < p_list->i_count; i_index++ ) for( size_t i_index = 0; p_list[i_index]; i_index++ )
{ {
/* Take every module */ /* Take every module */
p_module = (module_t *)p_list->p_values[i_index].p_object; p_module = p_list[i_index];
/* Exclude the main module */ /* Exclude the main module */
if( !strcmp( module_get_object( p_module ), "main" ) ) if( module_is_main( p_module ) )
continue; continue;
/* Exclude empty plugins (submodules don't have config options, they /* Exclude empty plugins (submodules don't have config options, they
...@@ -547,7 +530,6 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -547,7 +530,6 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
} }
module_config_free (p_config); module_config_free (p_config);
//if( !i_options ) continue;
/* Dummy item, please proceed */ /* Dummy item, please proceed */
if( !b_options || i_category == 0 || i_subcategory == 0 ) continue; if( !b_options || i_category == 0 || i_subcategory == 0 ) continue;
...@@ -588,7 +570,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -588,7 +570,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
config_data->i_object_id = p_item->value.i; config_data->i_object_id = p_item->value.i;
config_data->p_module = p_module; config_data->p_module = p_module;
tvi.pszText = _FROMMB(module_name( p_module, false )); tvi.pszText = _FROMMB(module_get_name( p_module, false ));
tvi.cchTextMax = _tcslen(tvi.pszText); tvi.cchTextMax = _tcslen(tvi.pszText);
tvi.lParam = (long)config_data; tvi.lParam = (long)config_data;
...@@ -621,7 +603,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf, ...@@ -621,7 +603,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( intf_thread_t *_p_intf,
} }
/* Clean-up everything */ /* Clean-up everything */
vlc_list_release( p_list ); module_list_free( p_list );
TreeView_Expand( hwndTV, general_item, TVE_EXPANDPARTIAL |TVE_EXPAND ); TreeView_Expand( hwndTV, general_item, TVE_EXPANDPARTIAL |TVE_EXPAND );
} }
...@@ -764,7 +746,7 @@ PrefsPanel::PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf, ...@@ -764,7 +746,7 @@ PrefsPanel::PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf,
/* 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; module_t **p_list;
b_advanced = true; b_advanced = true;
...@@ -786,14 +768,13 @@ PrefsPanel::PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf, ...@@ -786,14 +768,13 @@ PrefsPanel::PrefsPanel( HWND parent, HINSTANCE hInst, intf_thread_t *_p_intf,
else else
{ {
/* List the plugins */ /* List the plugins */
int i_index; size_t i_index;
bool b_found = false; bool b_found = false;
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE ); p_list = module_list_get( NULL );
if( !p_list ) return;
for( i_index = 0; i_index < p_list->i_count; i_index++ ) for( i_index = 0; p_list[i_index]; i_index++ )
{ {
p_module = (module_t *)p_list->p_values[i_index].p_object; p_module = p_list[i_index];
if( !strcmp( module_get_object(p_module), "main" ) ) if( !strcmp( module_get_object(p_module), "main" ) )
{ {
b_found = true; b_found = true;
......
...@@ -287,7 +287,7 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *p_this, ...@@ -287,7 +287,7 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *p_this,
int * py_pos ) int * py_pos )
: ConfigControl( p_this, p_item, parent, hInst ) : ConfigControl( p_this, p_item, parent, hInst )
{ {
vlc_list_t *p_list; module_t **p_list;
module_t *p_parser; module_t *p_parser;
label = CreateWindow( _T("STATIC"), _FROMMB(p_item->psz_text), label = CreateWindow( _T("STATIC"), _FROMMB(p_item->psz_text),
...@@ -306,14 +306,15 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *p_this, ...@@ -306,14 +306,15 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *p_this,
*py_pos += 15 + 10; *py_pos += 15 + 10;
/* build a list of available modules */ /* build a list of available modules */
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE ); p_list = module_list_get( NULL );
ComboBox_AddString( combo, _T("Default") ); ComboBox_AddString( combo, _T("Default") );
ComboBox_SetItemData( combo, 0, (void *)NULL ); ComboBox_SetItemData( combo, 0, (void *)NULL );
ComboBox_SetCurSel( combo, 0 ); ComboBox_SetCurSel( combo, 0 );
//ComboBox_SetText( combo, _T("Default") ); //ComboBox_SetText( combo, _T("Default") );
for( int i_index = 0; i_index < p_list->i_count; i_index++ )
for( size_t i_index = 0; p_list[i_index]; i_index++ )
{ {
p_parser = (module_t *)p_list->p_values[i_index].p_object ; p_parser = p_list[i_index];
if( module_provides( p_parser, p_item->psz_type ) ) if( module_provides( p_parser, p_item->psz_type ) )
{ {
...@@ -324,11 +325,11 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *p_this, ...@@ -324,11 +325,11 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *p_this,
module_get_object( p_parser )) ) module_get_object( p_parser )) )
{ {
ComboBox_SetCurSel( combo, i_index ); ComboBox_SetCurSel( combo, i_index );
//ComboBox_SetText( combo, _FROMMB(p_parser->psz_longname) ); //ComboBox_SetText( combo, _FROMMB( module_GetLongName(p_parser)) );
} }
} }
} }
vlc_list_release( p_list ); module_list_free( p_list );
} }
ModuleConfigControl::~ModuleConfigControl() ModuleConfigControl::~ModuleConfigControl()
......
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