FS#7003 - Allow forward references of menus in tagnavi.config

Attached to Project: Rockbox
Opened by Mark Reiche (Porphyr) - Monday, 09 April 2007, 20:13 GMT
Last edited by Miika Pekkarinen (miipekk) - Friday, 22 June 2007, 12:48 GMT
Task Type Patches
Category Music playback
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Here is another patch that I consider useful. It allows to reference menus in the tagnavi.config that are defined later. I use this to reference the default main menu from my customized menus in tagnavi_custom.config (because they are defined below the %include statement, and copy'n'paste is not a smart solution :-)

Technical details of change:
- Parsing of submenu entries (label ==> id): When no menu with that id specified yet, create a new empty menu with that id
- Parsing of menu start lines (%menu_start id title): First check if there is already a menu with that id (if found, append; if not found create new empty menu)

Side effect
- removed obsolete link to parent menu
- removed obsolete " menu->itemcount = 0; " (because menu is filled with zeros by memset)

This task depends upon

Closed by  Miika Pekkarinen (miipekk)
Friday, 22 June 2007, 12:48 GMT
Reason for closing:  Accepted
Comment by Pascal Briehl (ColdSphinX) - Tuesday, 10 April 2007, 12:38 GMT
After this patch I increased TAGMENU_MAX_MENUS (in tagtree.h) from 16 to 32 because 16 will be reached very fast this way.
Comment by Mark Reiche (Porphyr) - Tuesday, 10 April 2007, 15:54 GMT
Increasing the TAGMENU_MAX_MENUS does not really hurt as it just enlarges the array of pointers.

But I don't really understand why this should be necessary. Actually, this patch should *reduce* the number of necessary menus because you don't have to copy menus from the tagnavi.config to your tagnavi_custom.config if you want to reference them from there.
Comment by Pascal Briehl (ColdSphinX) - Tuesday, 10 April 2007, 16:15 GMT
In the 'tagnavi.config' there are 6 menus, but in my 'tagnavi_custom.config' I have 14 menus (different "Search for...", Sortet by Years, different "Sortet by Genre", ...). Now after you patch I selectet my '"Default view..." ==> "main"'-entry and it only showed a blank list. That means if you using a 'tagnavi_custom.config' you can only add 10 new menues, if you don't want to loose a menu of the 'tagnavi.config'. And if you loose the "main"-menu the forward definition of the old menus is obsolete.
Comment by Mark Reiche (Porphyr) - Tuesday, 10 April 2007, 16:39 GMT
Ah. Understood - I didn't expect that many own menus (but to be honest - I just started tweaking around my rockbox).

So in case anybody is going to integrate this into the main release, please use the attached version of the patch (which includes Pascal's suggestion).
Thanks a lot.