Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: my next crazy idea... rework the menu system

Re: my next crazy idea... rework the menu system

From: Jonathan Gordon <jdgordy_at_gmail.com>
Date: Fri, 25 Aug 2006 12:24:32 +1000

Right, well I've been tweaking it a bit and I think its now useable...
attached is the diff which starts adding the sound and playback
menus.. (i've ben testing on the ipod sim, and it compiles
cleanyly...)

So just quickly, I want to explain the difference between adding a
menu item in the current and this system..

First to make a menu 2 variables are needed.
static const struct menu_item_ex *main_menu_items[] =
{&sound_menu_items, &playback_items};
static const struct menu_item_ex main_menu = {MT_MENU,
{main_menu_items},sizeof(main_menu_items)/sizeof(*main_menu_items),"Main
Menu",0};

The first is a list of all the items in this menu (they can be
sub-menus, or options, or functions to call.)
The next just puts it all together so it can be used. Compare that to
settings_menu.c where the list of items is needed anyway (but they are
either NULL or a function to call) and ~3 functions are called to run
the menu)

And to actually add a option to a menu you need (for the CHOICE and
BOOL options) an array of struct opt_items (which is needed in the old
system also, so no big deal, BOOL will be able to reuse its array so
its not so bad). Then you need to use one of the MAKE_*_OPT macros to
create the 2 vairables needed.
Lastly, you need to add the variable created by the macro to an array
holding a list of items.. (e.g the main_menu_items above).
Whereas in the old system you had to create a function which was
called by the menu that had to call set_option (or similar).

So, what do you think?

Received on 2006-08-25

Page was last modified "Jan 10 2012" The Rockbox Crew
aaa