|
|
Wiki > Main > SettingsRecode (compare)
| |||||||||||||
Difference: SettingsRecode (r3 vs. r2)How to help with the settings recode workThis is a work in progress , so for the time being just ignore me... I've just realised it will be too difficult to commit and manage this effort without a bit more work. What This IsThis page willl briefly explain how to help convert the ~200 settings and menus in rockbox to using the new system. The idea being that once this is finished it will be much easier to add/remove/edit settings, and hopefully there will be a drop in the binary size. Important source files
Where we are nowCurrently still in a patch (attached below), but it will be commited with the following completed.
How to helpThere are 2 parts to each setting that ends up in the menu. The first part is its "definition" in settings_list.c which will be made up of one of the following macros
add an actuall explanation of each macro if its needed The 2nd part of the setting is its position in one of the apps/menus/ files. Ideally these will be one .c for each major sub menu (one for playback menu, one for display, etc) but if they become too messy we can split them more. The macros in menu.h
Now, at the time of commit, each of these submenus will just be a MAKE_FUNCTION_CALL() type pointing back into apps/*_menu.c. What needs to be done is each of these needs to be converted to used. Really what needs to be doneTo actually help, you need to choose an item in any of the not completed menus to work through. The "easiest" ones are ones which only have settings or function calls as items. For example, the debug menu. If the sub menu you choose is big enough for its own file create it in apps/menus and make sure you add a pointer to the "main menu" of the file in apps/menus/exported_menus.h. (Use the MAKE_MENU() macro to create the actual menu, example in menus/main_menu.c). Now you need to use one of the 2nd set of macros above for each of this menus items. The easiest is the MAKE_SETTING_OPT() which requires a name (so the struct can be included in the menu), a pointer to the item in settings_list.c (using the variables * as the link), and a callback (see below). Now each time you use this macro you willl need to edit settings_list.c to complete the setting "definition" in that array (by using one of the first set of macros above) Now once your menu is ready, you need to tell the current menu to run it. Either add the & to the menu you want it put into, or if there are submenus between the current bottom of the menu and your menu you will need to change your parent menu to do_menu(&my_menu); e.g You changed the crossfeed menu to the new system, but the sound menu (crossfeed is a sub menu of sound menu) still uses the old system, So all you need to do is change static bool crossfeed_menu(void) to look like
MAKE_MENU(crossfeed_menu_item, ... );
static bool crossfeed_menu(void)
{
return (bool)do_menu(&crossfeed_menu_item);
}
Then submit a patch, have it commited and move on to the next bit Order of calls to the menu callback functions
Questions and comments
r5 - 08 Feb 2007 - 04:35:11 - JonathanGordon
Revision r3 - 05 Feb 2007 - 07:05 - JonathanGordonRevision r2 - 04 Feb 2007 - 13:06 - JonathanGordon Copyright © by the contributing authors.
|