Rockbox Technical Forums

Support and General Use => User Interface and Voice => Topic started by: fed on June 19, 2007, 02:42:51 AM

Title: Button handler for the root menu
Post by: fed on June 19, 2007, 02:42:51 AM
Do you know where the button handler is for the root menu.  I can't seem to find it in root_menu.c
Title: Re: Button handler for the root menu
Post by: JdGordon on June 19, 2007, 03:52:02 AM
first, please call the root menu the main menu, its named badly in the code...
now whats the problem?
the root_menu_ variable (its hidden in a MAKE_MENU() macro) is passed to do_menu() which does the actual button handling.

If you want techinal help the best place is on irc...
Title: Re: Button handler for the root menu
Post by: fed on June 19, 2007, 08:58:19 AM
And where are these macros located?
Title: Re: Button handler for the root menu
Post by: GodEater on June 19, 2007, 09:12:36 AM
do you know how to use "grep" ? :)
Title: Re: Button handler for the root menu
Post by: fed on June 19, 2007, 09:19:44 AM
No, sorry.  What is that?
Title: Re: Button handler for the root menu
Post by: JdGordon on June 19, 2007, 09:26:57 AM
in root_menu.c is the one you want...
what do you want to do?
Title: Re: Button handler for the root menu
Post by: fed on June 19, 2007, 09:52:57 AM
I would like to add a new function to the rec button.  I know how to change keymap.  I've even succesfully changed a couple of buttons in the rec screen, and added the function to recording.c.  Now, I'd like to add a button function to the main menu (the one that starts up when rockbox boots.  The one with 'Files, Database, Setting, Recording, ...).  But I cannot find the switch where I should be putting in the new function.
Title: Re: Button handler for the root menu
Post by: JdGordon on June 19, 2007, 09:54:46 AM
your being to vague too give proper help to...
menu.c in do_menu there is a switch for the action... add it there if (menu==&root_menu_)
Title: Re: Button handler for the root menu
Post by: fed on June 19, 2007, 10:03:58 AM
In keymap, I assign an ACTION_SOMETHING to the rec button.  Then in recording.c I placed 'case ACTION_SOMETHING' in a switch that then ran my function when the button is pushed.  This worked.

I would like to do the same thing for the main menu, but I cannot find out where to place my function.

Does that help?

Also, what is 'grep'?
Title: Re: Button handler for the root menu
Post by: JdGordon on June 19, 2007, 10:08:41 AM
grep is the unix/linux program to search in files...

my previous post told you where to put your action case
Title: Re: Button handler for the root menu
Post by: fed on June 19, 2007, 10:20:14 AM
I found no such location in menu.c in do_menu.

Sorry, but maybe I am missing something.  I cannot find all the STD eactions there either.
Title: Re: Button handler for the root menu
Post by: JdGordon on June 19, 2007, 10:22:34 AM
bah, its not a siwtch, its alot of else if() lines starting line 437.
Title: Re: Button handler for the root menu
Post by: fed on June 19, 2007, 10:23:44 AM
Got it!  Thanks.

I'll give it a try.
Title: Re: Button handler for the root menu
Post by: fed on June 19, 2007, 11:28:45 AM
Thanks a lot!

It works!