FS#1314 - Patch of radio menu

Attached to Project: Rockbox
Opened by Alexandre Flament (flament) - Sunday, 04 May 2003, 22:11 GMT
Last edited by Alexandre Flament (flament) - Sunday, 29 August 2004, 21:36 GMT
Task Type Patches
Status Closed
Assigned To Linus Nielsen Feltzing (linusnielsen)
Operating System
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Modify :
- radio.c
- menu.c & menu.h

radio.c (patch from version 1.7) :
F1 : global menu for radio (nothing except a dummy entry)
F2 : list of presets, with contextual menu with F3
(modify or delete)
F3 : contextual menu for current radio :
- if preset exist : modify/delete
- if it doesn't exist : add

menu.c, menu.h
Add :
- typedef int (*KeyHandler)(int, struct menu);
- int menu_default_key_handler(int key, struct menu);
- int menu_show_custom(int m, KeyHandler* handlers, int
- bool menu_run_custom(int m, KeyHandler* handlers, int

the KeyHandler is called each time a key is pressed, so
we can define custom keyhandler for menu.
The result can be :

The default key handler is menu_default_key_handler.
This task depends upon

Closed by  Hristo Kovachev (bger)
Sunday, 26 March 2006, 13:10 GMT
Reason for closing:  Out of Date
Comment by Alexandre Flament (flament) - Sunday, 04 May 2003, 23:39 GMT

2 notes :
- There is a refresh bug on F2 contextual menu
- There is a warning in menu.c
Comment by Alexandre Flament (flament) - Tuesday, 06 May 2003, 21:06 GMT

I changed menu.h again :

int menu_default_key_handler(int key, struct menu*);

int menu_init(struct menu_items* items, int count);
int menu_init_with_keyhandler(struct menu_items* items, int
count, KeyHandler* handlers, int handlerscount);
void menu_exit(int menu);
int menu_show(int m);

So all is the same than the orignal menu.h except the

There still is a bug of refresh with F2 contextual menu.
On F2 :
ON+UP : move up the selected entry
ON+DOWN isn't implemented yet
(the menu isn't refresh but by pressing twice F2 you can see
the effect)

Comment by Alexandre Flament (flament) - Thursday, 08 May 2003, 21:52 GMT

radio20030508.patch adds :
- ON+FOWARD / ON+PREVIOUS to go on next/previous preset
- Default radio is first preset
- PLAY : mute/unmute radio (update status bar, perhaps a
special icon is need for radio)

- still bug move up/move down/delete with F2 menu (if
someone could help me with menu_key_handler in radio.c)
Comment by Alexandre Flament (flament) - Friday, 23 May 2003, 22:26 GMT

Suppress all of bug (except ON+UP, ON+DOWN on F2 menu)
Add on F1:
- Set sensitivity
- Force mono
- Frequency range

Add on F3:
- Record (go on recording screen with settings set for radio)

A compiled version can download here :
Comment by Alexandre Flament (flament) - Sunday, 25 May 2003, 16:53 GMT

About radio-set.patch :
Add function radio_set which can set frequency, mute,
sensitivity, start IF measurement

About radio-format-fmr.patch :
Modify format of .fmr to store only used presets
Comment by Björn Stenberg (zagor) - Thursday, 05 June 2003, 11:17 GMT

I don't have an FM recorder. Assigning to Linus :-)
Comment by Linus Nielsen Feltzing (linusnielsen) - Monday, 05 July 2004, 14:37 GMT

Thanks Alexandre! I have committed my version of most of
your stuff except for the sensitivity. That'll come too.
Comment by Alexandre Flament (flament) - Sunday, 29 August 2004, 21:36 GMT

Thanks to commit my work ;)
Is it possible to implement also on+down/on+up on presets
menu ? (and perhaps on+right/on+left ?)

I have a question about radio.c revision 1.38 : why
status_draw() is call only when update_screen is true ?
When I want to watch time but I didn't press any button for
a while, I see a wrong time.