Commit 799d80ce authored by Clément Stenac's avatar Clément Stenac

Merge general with the category when possible

parent 80e23c96
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#define AUDIO_TITLE N_( "Audio" ) #define AUDIO_TITLE N_( "Audio" )
#define AUDIO_HELP N_( "Audio settings" ) #define AUDIO_HELP N_( "Audio settings" )
#define AUDIO_GENERAL_TITLE N_( "General audio settings" )
#define AUDIO_GENERAL_HELP N_("General audio settings") #define AUDIO_GENERAL_HELP N_("General audio settings")
#define AFILTER_TITLE N_("Filters") #define AFILTER_TITLE N_("Filters")
...@@ -71,7 +72,8 @@ ...@@ -71,7 +72,8 @@
#define VIDEO_TITLE N_("Video") #define VIDEO_TITLE N_("Video")
#define VIDEO_HELP N_("Video settings") #define VIDEO_HELP N_("Video settings")
#define VIDEO_GENERAL_HELP N_( "General video settings") #define VIDEO_GENERAL_TITLE N_( "General video settings")
#define VIDEO_GENERAL_HELP N_( "General video settings" )
#define _VOUT_TITLE N_("Output modules" ) #define _VOUT_TITLE N_("Output modules" )
#define VOUT_HELP N_( \ #define VOUT_HELP N_( \
...@@ -280,14 +282,14 @@ static struct config_category_t categories_array[] = ...@@ -280,14 +282,14 @@ static struct config_category_t categories_array[] =
{ SUBCAT_INTERFACE_HOTKEYS, INTF_HOTKEYS_TITLE, INTF_HOTKEYS_HELP }, { SUBCAT_INTERFACE_HOTKEYS, INTF_HOTKEYS_TITLE, INTF_HOTKEYS_HELP },
{ CAT_AUDIO, AUDIO_TITLE, AUDIO_HELP }, { CAT_AUDIO, AUDIO_TITLE, AUDIO_HELP },
{ SUBCAT_AUDIO_GENERAL, GENERAL_TITLE, AUDIO_GENERAL_HELP }, { SUBCAT_AUDIO_GENERAL, AUDIO_GENERAL_TITLE, AUDIO_GENERAL_HELP },
{ SUBCAT_AUDIO_AOUT, AOUT_TITLE, AOUT_HELP }, { SUBCAT_AUDIO_AOUT, AOUT_TITLE, AOUT_HELP },
{ SUBCAT_AUDIO_AFILTER, AFILTER_TITLE, AFILTER_HELP }, { SUBCAT_AUDIO_AFILTER, AFILTER_TITLE, AFILTER_HELP },
{ SUBCAT_AUDIO_VISUAL, AVISUAL_TITLE, AVISUAL_HELP }, { SUBCAT_AUDIO_VISUAL, AVISUAL_TITLE, AVISUAL_HELP },
{ SUBCAT_AUDIO_MISC, AMISC_TITLE, AMISC_HELP }, { SUBCAT_AUDIO_MISC, AMISC_TITLE, AMISC_HELP },
{ CAT_VIDEO, VIDEO_TITLE, VIDEO_HELP }, { CAT_VIDEO, VIDEO_TITLE, VIDEO_HELP },
{ SUBCAT_VIDEO_GENERAL, GENERAL_TITLE, VIDEO_GENERAL_HELP }, { SUBCAT_VIDEO_GENERAL, VIDEO_GENERAL_TITLE, VIDEO_GENERAL_HELP },
{ SUBCAT_VIDEO_VOUT, _VOUT_TITLE, VOUT_HELP }, { SUBCAT_VIDEO_VOUT, _VOUT_TITLE, VOUT_HELP },
{ SUBCAT_VIDEO_VFILTER, VFILTER_TITLE, VFILTER_HELP }, { SUBCAT_VIDEO_VFILTER, VFILTER_TITLE, VFILTER_HELP },
{ SUBCAT_VIDEO_SUBPIC, SUBPIC_TITLE, SUBPIC_HELP }, { SUBCAT_VIDEO_SUBPIC, SUBPIC_TITLE, SUBPIC_HELP },
......
...@@ -47,8 +47,9 @@ ...@@ -47,8 +47,9 @@
#endif #endif
#define TYPE_CATEGORY 0 #define TYPE_CATEGORY 0
#define TYPE_SUBCATEGORY 1 #define TYPE_CATSUBCAT 1 /* Category with embedded subcategory */
#define TYPE_MODULE 2 #define TYPE_SUBCATEGORY 2
#define TYPE_MODULE 3
/***************************************************************************** /*****************************************************************************
* Classes declarations. * Classes declarations.
...@@ -369,7 +370,32 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf, ...@@ -369,7 +370,32 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
-1, -1, config_data ); -1, -1, config_data );
break; break;
case CONFIG_SUBCATEGORY: case CONFIG_SUBCATEGORY:
if( p_item->i_value == SUBCAT_VIDEO_GENERAL ||
p_item->i_value == SUBCAT_AUDIO_GENERAL )
{
ConfigTreeData *cd = (ConfigTreeData *)
GetItemData( current_item );
cd->i_type = TYPE_CATSUBCAT;
cd->i_object_id = p_item->i_value;
if( cd->psz_name ) free( cd->psz_name );
cd->psz_name = strdup( config_CategoryNameGet(
p_item->i_value ) );
if( cd->psz_help ) free( cd->psz_help );
char *psz_help = config_CategoryHelpGet( p_item->i_value );
if( psz_help )
{
cd->psz_help = wraptext( strdup( psz_help ),72 ,
ISUTF8 );
}
else
{
cd->psz_help = NULL;
}
continue;
}
config_data = new ConfigTreeData; config_data = new ConfigTreeData;
config_data->psz_name = strdup( config_CategoryNameGet( config_data->psz_name = strdup( config_CategoryNameGet(
p_item->i_value ) ); p_item->i_value ) );
psz_help = config_CategoryHelpGet( p_item->i_value ); psz_help = config_CategoryHelpGet( p_item->i_value );
...@@ -605,47 +631,6 @@ void PrefsTreeCtrl::CleanChanges() ...@@ -605,47 +631,6 @@ void PrefsTreeCtrl::CleanChanges()
category = GetNextChild( root_item, cookie ); category = GetNextChild( root_item, cookie );
} }
#if 0
/* Clean changes for the main module */
wxTreeItemId item = GetFirstChild( root_item, cookie );
for( size_t i_child_index = 0;
i_child_index < GetChildrenCount( root_item, FALSE );
i_child_index++ )
{
config_data = (ConfigTreeData *)GetItemData( item );
if( config_data && config_data->panel )
{
delete config_data->panel;
config_data->panel = NULL;
}
item = GetNextChild( root_item, cookie );
}
/* Clean changes for the plugins */
item = GetFirstChild( plugins_item, cookie );
for( size_t i_child_index = 0;
i_child_index < GetChildrenCount( plugins_item, FALSE );
i_child_index++ )
{
wxTreeItemId item2 = GetFirstChild( item, cookie2 );
for( size_t i_child_index = 0;
i_child_index < GetChildrenCount( item, FALSE );
i_child_index++ )
{
config_data = (ConfigTreeData *)GetItemData( item2 );
if( config_data && config_data->panel )
{
delete config_data->panel;
config_data->panel = NULL;
}
item2 = GetNextChild( item, cookie2 );
}
item = GetNextChild( plugins_item, cookie );
}
#endif
if( GetSelection() ) if( GetSelection() )
{ {
wxTreeEvent event; wxTreeEvent event;
...@@ -818,7 +803,7 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -818,7 +803,7 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
} }
if( !p_module && !b_found ) if( !p_module && !b_found )
{ {
msg_Warn( p_intf, "ohoh, unable to find main module"); msg_Warn( p_intf, "ohoh, unable to find main module" );
return; return;
} }
} }
...@@ -838,7 +823,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -838,7 +823,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
p_item = p_module->p_config; p_item = p_module->p_config;
/* Find the category if it has been specified */ /* Find the category if it has been specified */
if( config_data->i_type == TYPE_SUBCATEGORY ) if( config_data->i_type == TYPE_SUBCATEGORY ||
config_data->i_type == TYPE_CATSUBCAT )
{ {
do do
{ {
...@@ -854,7 +840,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -854,7 +840,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
/* Add a head title to the panel */ /* Add a head title to the panel */
char *psz_head; char *psz_head;
if( config_data->i_type == TYPE_SUBCATEGORY ) if( config_data->i_type == TYPE_SUBCATEGORY ||
config_data->i_type == TYPE_CATSUBCAT )
{ {
psz_head = config_data->psz_name; psz_head = config_data->psz_name;
p_item++; p_item++;
...@@ -883,7 +870,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -883,7 +870,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
if( p_item ) do if( p_item ) do
{ {
/* If a category has been specified, check we finished the job */ /* If a category has been specified, check we finished the job */
if( config_data->i_type == TYPE_SUBCATEGORY && if( (config_data->i_type == TYPE_SUBCATEGORY ||
config_data->i_type == TYPE_CATSUBCAT ) &&
(p_item->i_type == CONFIG_CATEGORY || (p_item->i_type == CONFIG_CATEGORY ||
p_item->i_type == CONFIG_SUBCATEGORY ) && p_item->i_type == CONFIG_SUBCATEGORY ) &&
p_item->i_value != config_data->i_object_id ) p_item->i_value != config_data->i_object_id )
...@@ -902,7 +890,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, ...@@ -902,7 +890,8 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
config_sizer->Add( control, 0, wxEXPAND | wxALL, 2 ); config_sizer->Add( control, 0, wxEXPAND | wxALL, 2 );
} }
while( !( p_item->i_type == CONFIG_HINT_END || while( !( p_item->i_type == CONFIG_HINT_END ||
( config_data->i_type == TYPE_SUBCATEGORY && ( ( config_data->i_type == TYPE_SUBCATEGORY ||
config_data->i_type == TYPE_CATSUBCAT ) &&
( p_item->i_type == CONFIG_CATEGORY || ( p_item->i_type == CONFIG_CATEGORY ||
p_item->i_type == CONFIG_SUBCATEGORY ) ) ) && p_item++ ); p_item->i_type == CONFIG_SUBCATEGORY ) ) ) && p_item++ );
......
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