Button action code implemented in the radio screen. Should get rid of all thos wierd doublepress bugs and you can edit your presets again.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11024 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c70b390f11
commit
a982365711
6 changed files with 151 additions and 233 deletions
|
@ -69,6 +69,7 @@ enum {
|
|||
CONTEXT_YESNOSCREEN, /*NOTE: make sure your target has this and ACTION_YESNO_ACCEPT */
|
||||
CONTEXT_RECSCREEN,
|
||||
CONTEXT_KEYBOARD,
|
||||
CONTEXT_FM,
|
||||
};
|
||||
|
||||
|
||||
|
@ -127,6 +128,19 @@ enum {
|
|||
ACTION_TREE_STOP,
|
||||
ACTION_TREE_WPS,
|
||||
|
||||
/* radio */
|
||||
ACTION_FM_MENU,
|
||||
ACTION_FM_PRESET,
|
||||
ACTION_FM_RECORD,
|
||||
ACTION_FM_FREEZE,
|
||||
ACTION_FM_STOP,
|
||||
ACTION_FM_MODE,
|
||||
ACTION_FM_EXIT,
|
||||
ACTION_FM_PLAY,
|
||||
ACTION_FM_RECORD_DBLPRE,
|
||||
ACTION_FM_NEXT_PRESET,
|
||||
ACTION_FM_PREV_PRESET,
|
||||
|
||||
/* recording screen */
|
||||
ACTION_REC_LCD,
|
||||
ACTION_REC_PAUSE,
|
||||
|
|
|
@ -259,6 +259,18 @@ const struct button_mapping button_context_keyboard[] = {
|
|||
LAST_ITEM_IN_LIST
|
||||
}; /* button_context_keyboard */
|
||||
|
||||
const struct button_mapping button_context_radio[] = {
|
||||
{ ACTION_FM_MENU, BUTTON_SELECT | BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_FM_PRESET, BUTTON_SELECT | BUTTON_REL, BUTTON_SELECT },
|
||||
{ ACTION_FM_STOP, BUTTON_OFF, BUTTON_NONE },
|
||||
{ ACTION_FM_MODE, BUTTON_ON | BUTTON_REPEAT, BUTTON_ON },
|
||||
{ ACTION_FM_EXIT, BUTTON_MODE | BUTTON_REL, BUTTON_MODE },
|
||||
{ ACTION_FM_PLAY, BUTTON_ON | BUTTON_REL, BUTTON_ON },
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
|
||||
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* Remote control mappings
|
||||
*****************************************************************************/
|
||||
|
@ -650,6 +662,21 @@ const struct button_mapping button_context_keyboard_h300lcdremote[] = {
|
|||
LAST_ITEM_IN_LIST
|
||||
}; /* button_context_keyboard_h300lcdremote */
|
||||
|
||||
const struct button_mapping button_context_radio_h100remote[] = {
|
||||
{ ACTION_FM_MENU, BUTTON_RC_MENU | BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_FM_PRESET, BUTTON_RC_MENU | BUTTON_REL, BUTTON_RC_MENU },
|
||||
{ ACTION_FM_STOP, BUTTON_RC_STOP, BUTTON_NONE },
|
||||
{ ACTION_FM_MODE, BUTTON_RC_ON | BUTTON_REPEAT, BUTTON_RC_ON },
|
||||
{ ACTION_FM_EXIT, BUTTON_RC_MODE | BUTTON_REL, BUTTON_RC_MODE },
|
||||
{ ACTION_FM_PLAY, BUTTON_RC_ON | BUTTON_REL, BUTTON_RC_ON },
|
||||
{ ACTION_FM_NEXT_PRESET, BUTTON_RC_BITRATE, BUTTON_NONE },
|
||||
{ ACTION_FM_PREV_PRESET, BUTTON_RC_SOURCE, BUTTON_NONE },
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
|
||||
};
|
||||
|
||||
const struct button_mapping *button_context_radio_h300lcdremote =
|
||||
button_context_radio_h100remote;
|
||||
|
||||
/* the actual used tables */
|
||||
static const struct button_mapping
|
||||
|
@ -667,6 +694,7 @@ static const struct button_mapping
|
|||
*remote_btn_ctxt_pitchscreen = 0,
|
||||
*remote_btn_ctxt_recscreen = 0,
|
||||
*remote_btn_ctxt_keyboard = 0;
|
||||
*remote_btn_ctxt_radio = 0;
|
||||
|
||||
static int _remote_type = -1; /*safe value, forces the first press to init the mappings */
|
||||
|
||||
|
@ -690,6 +718,7 @@ static void remap_remote(void)
|
|||
remote_btn_ctxt_pitchscreen = NULL;
|
||||
remote_btn_ctxt_recscreen = NULL;
|
||||
remote_btn_ctxt_keyboard = NULL;
|
||||
remote_btn_ctxt_radio = NULL;
|
||||
break;
|
||||
|
||||
case REMOTETYPE_H100_LCD:
|
||||
|
@ -714,6 +743,8 @@ static void remap_remote(void)
|
|||
= button_context_recscreen_h100remote,
|
||||
remote_btn_ctxt_keyboard
|
||||
= button_context_keyboard_h100remote;
|
||||
remote_btn_ctxt_radio
|
||||
= button_context_radio_h100remote;
|
||||
break;
|
||||
|
||||
case REMOTETYPE_H300_LCD:
|
||||
|
@ -738,6 +769,8 @@ static void remap_remote(void)
|
|||
= button_context_recscreen_h300lcdremote,
|
||||
remote_btn_ctxt_keyboard
|
||||
= button_context_keyboard_h300lcdremote;
|
||||
remote_btn_ctxt_radio
|
||||
= button_context_radio_h300lcdremote;
|
||||
break;
|
||||
|
||||
case REMOTETYPE_H300_NONLCD: /* FIXME: add its tables */
|
||||
|
@ -762,6 +795,8 @@ static void remap_remote(void)
|
|||
= button_context_recscreen_h300lcdremote,
|
||||
remote_btn_ctxt_keyboard
|
||||
= button_context_keyboard_h300lcdremote;
|
||||
remote_btn_ctxt_radio
|
||||
= button_context_radio_h300lcdremote;
|
||||
#if 0
|
||||
remote_btn_ctxt_std =
|
||||
remote_btn_ctxt_wps =
|
||||
|
@ -777,6 +812,7 @@ static void remap_remote(void)
|
|||
remote_btn_ctxt_pitchscreen =
|
||||
remote_btn_ctxt_recscreen =
|
||||
remote_btn_ctxt_keyboard =
|
||||
remote_btn_ctxt_radio =
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
@ -827,6 +863,8 @@ const struct button_mapping* get_context_mapping_remote(int context)
|
|||
return remote_btn_ctxt_recscreen;
|
||||
case CONTEXT_KEYBOARD:
|
||||
return remote_btn_ctxt_keyboard;
|
||||
case CONTEXT_FM:
|
||||
return remote_btn_ctxt_radio;
|
||||
}
|
||||
return remote_btn_ctxt_std;
|
||||
}
|
||||
|
@ -879,6 +917,8 @@ const struct button_mapping* get_context_mapping(int context)
|
|||
return button_context_recscreen;
|
||||
case CONTEXT_KEYBOARD:
|
||||
return button_context_keyboard;
|
||||
case CONTEXT_FM:
|
||||
return button_context_radio;
|
||||
}
|
||||
return button_context_standard;
|
||||
}
|
||||
|
|
|
@ -156,6 +156,17 @@ const struct button_mapping button_context_keyboard[] = {
|
|||
LAST_ITEM_IN_LIST
|
||||
}; /* button_context_keyboard */
|
||||
|
||||
const struct button_mapping button_context_radio[] = {
|
||||
{ ACTION_FM_MENU, BUTTON_MENU | BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_FM_RECORD_DBLPRE, BUTTON_MENU, BUTTON_NONE},
|
||||
{ ACTION_FM_RECORD, BUTTON_MENU | BUTTON_REL, BUTTON_NONE },
|
||||
{ ACTION_FM_STOP, BUTTON_OFF | BUTTON_REL, BUTTON_OFF },
|
||||
{ ACTION_FM_EXIT, BUTTON_OFF | BUTTON_REPEAT, BUTTON_OFF },
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
|
||||
|
||||
};
|
||||
|
||||
const struct button_mapping* get_context_mapping( int context )
|
||||
{
|
||||
switch( context )
|
||||
|
|
|
@ -191,7 +191,22 @@ struct button_mapping button_context_bmark[] = {
|
|||
{ ACTION_BMS_SELECT, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
|
||||
|
||||
}; /* button_context_settings_bmark */
|
||||
|
||||
const struct button_mapping button_context_radio[] = {
|
||||
{ ACTION_FM_MENU, BUTTON_F1, BUTTON_NONE },
|
||||
{ ACTION_FM_PRESET, BUTTON_F2, BUTTON_NONE },
|
||||
{ ACTION_FM_RECORD, BUTTON_F3, BUTTON_NONE },
|
||||
{ ACTION_FM_FREEZE, BUTTON_PLAY, BUTTON_NONE },
|
||||
{ ACTION_FM_STOP, BUTTON_OFF, BUTTON_NONE },
|
||||
{ ACTION_FM_MODE, BUTTON_ON | BUTTON_REPEAT, BUTTON_ON },
|
||||
{ ACTION_FM_EXIT, BUTTON_ON | BUTTON_REL, BUTTON_ON },
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
|
||||
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
* Remote control mappings
|
||||
*****************************************************************************/
|
||||
|
|
|
@ -242,6 +242,18 @@ const struct button_mapping button_context_bmark[] = {
|
|||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
|
||||
}; /* button_context_settings_bmark */
|
||||
|
||||
const struct button_mapping button_context_radio[] = {
|
||||
{ ACTION_FM_MENU, BUTTON_SELECT | BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_FM_PRESET, BUTTON_SELECT | BUTTON_REL, BUTTON_SELECT },
|
||||
{ ACTION_FM_STOP, BUTTON_POWER, BUTTON_NONE },
|
||||
{ ACTION_FM_MODE, BUTTON_PLAY | BUTTON_REPEAT, BUTTON_PLAY },
|
||||
{ ACTION_FM_EXIT, BUTTON_REC | BUTTON_REL, BUTTON_REC },
|
||||
{ ACTION_FM_PLAY, BUTTON_PLAY | BUTTON_REL, BUTTON_PLAY },
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
|
||||
|
||||
};
|
||||
|
||||
static const struct button_mapping* get_context_mapping_remote( int context )
|
||||
{
|
||||
context ^= CONTEXT_REMOTE;
|
||||
|
|
|
@ -59,86 +59,25 @@
|
|||
#include "power.h"
|
||||
#include "tree.h"
|
||||
#include "dir.h"
|
||||
#include "action.h"
|
||||
|
||||
#ifdef CONFIG_TUNER
|
||||
|
||||
#if CONFIG_KEYPAD == RECORDER_PAD
|
||||
#define FM_MENU BUTTON_F1
|
||||
#define FM_PRESET BUTTON_F2
|
||||
#define FM_RECORD BUTTON_F3
|
||||
#define FM_FREEZE BUTTON_PLAY
|
||||
#define FM_STOP BUTTON_OFF
|
||||
#define FM_MODE (BUTTON_ON | BUTTON_REPEAT)
|
||||
#define FM_EXIT_PRE BUTTON_ON
|
||||
#define FM_EXIT (BUTTON_ON | BUTTON_REL)
|
||||
#define FM_PRESET_ADD BUTTON_F1
|
||||
#define FM_PRESET_ACTION BUTTON_F3
|
||||
#define FM_RECORD
|
||||
#define FM_PRESET_ADD
|
||||
#define FM_PRESET_ACTION
|
||||
#define FM_PRESET
|
||||
|
||||
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
|
||||
/* pause/play - short PLAY */
|
||||
#define FM_PLAY_PRE BUTTON_ON
|
||||
#define FM_RC_PLAY_PRE BUTTON_RC_ON
|
||||
#define FM_PLAY (BUTTON_ON | BUTTON_REL)
|
||||
#define FM_RC_PLAY (BUTTON_RC_ON | BUTTON_REL)
|
||||
/* preset/scan mode - long PLAY */
|
||||
#define FM_MODE (BUTTON_ON | BUTTON_REPEAT)
|
||||
#define FM_RC_MODE (BUTTON_RC_ON | BUTTON_REPEAT)
|
||||
/* preset menu - short SELECT */
|
||||
#define FM_PRESET_PRE BUTTON_SELECT
|
||||
#define FM_RC_PRESET_PRE BUTTON_RC_MENU
|
||||
#define FM_PRESET (BUTTON_SELECT | BUTTON_REL)
|
||||
#define FM_RC_PRESET (BUTTON_RC_MENU | BUTTON_REL)
|
||||
/* fm menu - long SELECT */
|
||||
#define FM_MENU (BUTTON_SELECT | BUTTON_REPEAT)
|
||||
#define FM_RC_MENU (BUTTON_RC_MENU | BUTTON_REPEAT)
|
||||
/* main menu(exit radio while playing) - A-B */
|
||||
#define FM_EXIT_PRE BUTTON_MODE
|
||||
#define FM_EXIT (BUTTON_MODE | BUTTON_REL)
|
||||
#define FM_RC_EXIT_PRE BUTTON_RC_MODE
|
||||
#define FM_RC_EXIT (BUTTON_RC_MODE | BUTTON_REL)
|
||||
/* prev/next preset on the remote - BITRATE/SOURCE */
|
||||
#define FM_NEXT_PRESET (BUTTON_RC_BITRATE | BUTTON_REL)
|
||||
#define FM_PREV_PRESET (BUTTON_RC_SOURCE | BUTTON_REL)
|
||||
/* stop and exit radio - STOP */
|
||||
#define FM_STOP BUTTON_OFF
|
||||
#define FM_RC_STOP BUTTON_RC_STOP
|
||||
#define FM_PRESET
|
||||
|
||||
#elif (CONFIG_KEYPAD == IAUDIO_X5_PAD)
|
||||
/* pause/play - short PLAY */
|
||||
#define FM_PLAY_PRE BUTTON_PLAY
|
||||
#define FM_RC_PLAY_PRE BUTTON_RC_PLAY
|
||||
#define FM_PLAY (BUTTON_PLAY | BUTTON_REL)
|
||||
#define FM_RC_PLAY (BUTTON_RC_PLAY | BUTTON_REL)
|
||||
/* preset/scan mode - long PLAY */
|
||||
#define FM_MODE (BUTTON_PLAY | BUTTON_REPEAT)
|
||||
#define FM_RC_MODE (BUTTON_RC_PLAY | BUTTON_REPEAT)
|
||||
/* preset menu - short SELECT */
|
||||
#define FM_PRESET_PRE BUTTON_SELECT
|
||||
#define FM_RC_PRESET_PRE BUTTON_RC_MENU
|
||||
#define FM_PRESET (BUTTON_SELECT | BUTTON_REL)
|
||||
#define FM_RC_PRESET (BUTTON_RC_MENU | BUTTON_REL)
|
||||
/* fm menu - long SELECT */
|
||||
#define FM_MENU (BUTTON_SELECT | BUTTON_REPEAT)
|
||||
#define FM_RC_MENU (BUTTON_RC_MENU | BUTTON_REPEAT)
|
||||
/* main menu(exit radio while playing) - REC */
|
||||
#define FM_EXIT_PRE BUTTON_REC
|
||||
#define FM_EXIT (BUTTON_REC | BUTTON_REL)
|
||||
#define FM_RC_EXIT_PRE BUTTON_RC_MODE
|
||||
#define FM_RC_EXIT (BUTTON_RC_MODE | BUTTON_REL)
|
||||
/* prev/next preset on the remote - REW/FF */
|
||||
#define FM_NEXT_PRESET (BUTTON_RC_FF | BUTTON_REL)
|
||||
#define FM_PREV_PRESET (BUTTON_RC_REW | BUTTON_REL)
|
||||
/* stop and exit radio - ON */
|
||||
#define FM_STOP BUTTON_POWER
|
||||
#define FM_RC_STOP (BUTTON_RC_MODE | BUTTON_REPEAT)
|
||||
#define FM_PRESET
|
||||
|
||||
#elif CONFIG_KEYPAD == ONDIO_PAD /* restricted keypad */
|
||||
#define FM_MENU (BUTTON_MENU | BUTTON_REPEAT)
|
||||
#define FM_RECORD_DBLPRE BUTTON_MENU
|
||||
#define FM_RECORD (BUTTON_MENU | BUTTON_REL)
|
||||
#define FM_STOP_PRE BUTTON_OFF
|
||||
#define FM_STOP (BUTTON_OFF | BUTTON_REL)
|
||||
#define FM_EXIT (BUTTON_OFF | BUTTON_REPEAT)
|
||||
#elif CONFIG_KEYPAD == ONDIO_PAD
|
||||
#define FM_RECORD_DBLPRE
|
||||
#define FM_RECORD
|
||||
#endif
|
||||
|
||||
#define MAX_FREQ (108000000)
|
||||
|
@ -537,22 +476,15 @@ bool radio_screen(void)
|
|||
if(search_dir)
|
||||
button = button_get(false);
|
||||
else
|
||||
button = button_get_w_tmo(HZ / PEAK_METER_FPS);
|
||||
if (button != BUTTON_NONE)
|
||||
button = get_action(CONTEXT_FM, HZ / PEAK_METER_FPS);
|
||||
if (button != ACTION_NONE)
|
||||
{
|
||||
cpu_idle_mode(false);
|
||||
button_timeout = current_tick + (2*HZ);
|
||||
}
|
||||
switch(button)
|
||||
{
|
||||
#ifdef FM_RC_STOP
|
||||
case FM_RC_STOP:
|
||||
#endif
|
||||
case FM_STOP:
|
||||
#ifdef FM_STOP_PRE
|
||||
if (lastbutton != FM_STOP_PRE)
|
||||
break;
|
||||
#endif
|
||||
case ACTION_FM_STOP:
|
||||
#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
|
||||
if(audio_status() == AUDIO_STATUS_RECORD)
|
||||
{
|
||||
|
@ -579,9 +511,9 @@ bool radio_screen(void)
|
|||
break;
|
||||
|
||||
#ifdef FM_RECORD
|
||||
case FM_RECORD:
|
||||
case ACTION_FM_RECORD:
|
||||
#ifdef FM_RECORD_DBLPRE
|
||||
if (lastbutton != FM_RECORD_DBLPRE)
|
||||
if (lastbutton != ACTION_FM_RECORD_DBLPRE)
|
||||
{
|
||||
rec_lastclick = 0;
|
||||
break;
|
||||
|
@ -609,18 +541,7 @@ bool radio_screen(void)
|
|||
break;
|
||||
#endif /* #ifdef FM_RECORD */
|
||||
|
||||
#ifdef FM_RC_EXIT
|
||||
case FM_RC_EXIT:
|
||||
#endif
|
||||
case FM_EXIT:
|
||||
#ifdef FM_EXIT_PRE
|
||||
if(lastbutton != FM_EXIT_PRE
|
||||
#ifdef FM_RC_EXIT_PRE
|
||||
&& lastbutton != FM_RC_EXIT_PRE
|
||||
#endif
|
||||
)
|
||||
break;
|
||||
#endif
|
||||
case ACTION_FM_EXIT:
|
||||
#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
|
||||
if(audio_status() == AUDIO_STATUS_RECORD)
|
||||
audio_stop();
|
||||
|
@ -644,10 +565,7 @@ bool radio_screen(void)
|
|||
|
||||
break;
|
||||
|
||||
#ifdef BUTTON_RC_REW
|
||||
case BUTTON_RC_REW:
|
||||
#endif
|
||||
case BUTTON_LEFT:
|
||||
case ACTION_STD_PREV:
|
||||
if(radio_mode == RADIO_SCAN_MODE)
|
||||
{
|
||||
curr_freq -= FREQ_STEP;
|
||||
|
@ -663,10 +581,7 @@ bool radio_screen(void)
|
|||
update_screen = true;
|
||||
break;
|
||||
|
||||
#ifdef BUTTON_RC_FF
|
||||
case BUTTON_RC_FF:
|
||||
#endif
|
||||
case BUTTON_RIGHT:
|
||||
case ACTION_STD_NEXT:
|
||||
if(radio_mode == RADIO_SCAN_MODE)
|
||||
{
|
||||
curr_freq += FREQ_STEP;
|
||||
|
@ -682,10 +597,7 @@ bool radio_screen(void)
|
|||
update_screen = true;
|
||||
break;
|
||||
|
||||
#ifdef BUTTON_RC_REW
|
||||
case BUTTON_RC_REW | BUTTON_REPEAT:
|
||||
#endif
|
||||
case BUTTON_LEFT | BUTTON_REPEAT:
|
||||
case ACTION_STD_PREVREPEAT:
|
||||
if(radio_mode == RADIO_SCAN_MODE)
|
||||
search_dir = -1;
|
||||
else
|
||||
|
@ -696,10 +608,7 @@ bool radio_screen(void)
|
|||
|
||||
break;
|
||||
|
||||
#ifdef BUTTON_RC_FF
|
||||
case BUTTON_RC_FF | BUTTON_REPEAT:
|
||||
#endif
|
||||
case BUTTON_RIGHT | BUTTON_REPEAT:
|
||||
case ACTION_STD_NEXTREPEAT:
|
||||
if(radio_mode == RADIO_SCAN_MODE)
|
||||
search_dir = 1;
|
||||
else
|
||||
|
@ -710,12 +619,9 @@ bool radio_screen(void)
|
|||
|
||||
break;
|
||||
|
||||
#ifdef BUTTON_RC_VOL_UP
|
||||
case BUTTON_RC_VOL_UP:
|
||||
case BUTTON_RC_VOL_UP | BUTTON_REPEAT:
|
||||
#endif
|
||||
case BUTTON_UP:
|
||||
case BUTTON_UP | BUTTON_REPEAT:
|
||||
|
||||
case ACTION_SETTINGS_INC:
|
||||
case ACTION_SETTINGS_INCREPEAT:
|
||||
global_settings.volume++;
|
||||
if(global_settings.volume > sound_max(SOUND_VOLUME))
|
||||
global_settings.volume = sound_max(SOUND_VOLUME);
|
||||
|
@ -724,12 +630,8 @@ bool radio_screen(void)
|
|||
settings_save();
|
||||
break;
|
||||
|
||||
#ifdef BUTTON_RC_VOL_DOWN
|
||||
case BUTTON_RC_VOL_DOWN:
|
||||
case BUTTON_RC_VOL_DOWN | BUTTON_REPEAT:
|
||||
#endif
|
||||
case BUTTON_DOWN:
|
||||
case BUTTON_DOWN | BUTTON_REPEAT:
|
||||
case ACTION_SETTINGS_DEC:
|
||||
case ACTION_SETTINGS_DECREPEAT:
|
||||
global_settings.volume--;
|
||||
if(global_settings.volume < sound_min(SOUND_VOLUME))
|
||||
global_settings.volume = sound_min(SOUND_VOLUME);
|
||||
|
@ -738,19 +640,7 @@ bool radio_screen(void)
|
|||
settings_save();
|
||||
break;
|
||||
|
||||
#ifdef FM_PLAY
|
||||
#ifdef FM_RC_PLAY
|
||||
case FM_RC_PLAY:
|
||||
#endif
|
||||
case FM_PLAY:
|
||||
#ifdef FM_PLAY_PRE
|
||||
if(lastbutton != FM_PLAY_PRE
|
||||
#ifdef FM_RC_PLAY_PRE
|
||||
&& lastbutton != FM_RC_PLAY_PRE
|
||||
#endif
|
||||
)
|
||||
break;
|
||||
#endif
|
||||
case ACTION_FM_PLAY:
|
||||
if (radio_status == FMRADIO_PLAYING)
|
||||
radio_pause();
|
||||
else
|
||||
|
@ -758,12 +648,8 @@ bool radio_screen(void)
|
|||
|
||||
update_screen = true;
|
||||
break;
|
||||
#endif
|
||||
#ifdef FM_MENU
|
||||
#ifdef FM_RC_MENU
|
||||
case FM_RC_MENU:
|
||||
#endif
|
||||
case FM_MENU:
|
||||
|
||||
case ACTION_FM_MENU:
|
||||
radio_menu();
|
||||
curr_preset = find_preset(curr_freq);
|
||||
FOR_NB_SCREENS(i){
|
||||
|
@ -777,21 +663,9 @@ bool radio_screen(void)
|
|||
#endif
|
||||
update_screen = true;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef FM_RC_PRESET
|
||||
case FM_RC_PRESET:
|
||||
#endif
|
||||
#ifdef FM_PRESET
|
||||
case FM_PRESET:
|
||||
#ifdef FM_PRESET_PRE
|
||||
if(lastbutton != FM_PRESET_PRE
|
||||
#ifdef FM_RC_PRESET_PRE
|
||||
&& lastbutton != FM_RC_PRESET_PRE
|
||||
#endif
|
||||
)
|
||||
break;
|
||||
#endif
|
||||
case ACTION_FM_PRESET:
|
||||
if(num_presets < 1)
|
||||
{
|
||||
gui_syncsplash(HZ, true, str(LANG_FM_NO_PRESETS));
|
||||
|
@ -823,7 +697,7 @@ bool radio_screen(void)
|
|||
#endif
|
||||
|
||||
#ifdef FM_FREEZE
|
||||
case FM_FREEZE:
|
||||
case ACTION_FM_FREEZE:
|
||||
if(!screen_freeze)
|
||||
{
|
||||
gui_syncsplash(HZ, true, str(LANG_FM_FREEZE));
|
||||
|
@ -847,17 +721,8 @@ bool radio_screen(void)
|
|||
}
|
||||
break;
|
||||
|
||||
#ifdef FM_RC_MODE
|
||||
case FM_RC_MODE:
|
||||
#endif
|
||||
#ifdef FM_MODE
|
||||
case FM_MODE:
|
||||
if(lastbutton != FM_MODE
|
||||
#ifdef FM_RC_MODE
|
||||
&& lastbutton != FM_RC_MODE
|
||||
#endif
|
||||
)
|
||||
{
|
||||
case ACTION_FM_MODE:
|
||||
if(radio_mode == RADIO_SCAN_MODE)
|
||||
{
|
||||
/* Force scan mode if there are no presets. */
|
||||
|
@ -867,18 +732,17 @@ bool radio_screen(void)
|
|||
else
|
||||
radio_mode = RADIO_SCAN_MODE;
|
||||
update_screen = true;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef FM_NEXT_PRESET
|
||||
case FM_NEXT_PRESET:
|
||||
case ACTION_FM_NEXT_PRESET:
|
||||
next_preset(1);
|
||||
search_dir = 0;
|
||||
update_screen = true;
|
||||
break;
|
||||
#endif
|
||||
#ifdef FM_PREV_PRESET
|
||||
case FM_PREV_PRESET:
|
||||
case ACTION_FM_PREV_PRESET:
|
||||
next_preset(-1);
|
||||
search_dir = 0;
|
||||
update_screen = true;
|
||||
|
@ -890,9 +754,11 @@ bool radio_screen(void)
|
|||
break;
|
||||
} /*switch(button)*/
|
||||
|
||||
if (button != BUTTON_NONE)
|
||||
if (button != ACTION_NONE)
|
||||
lastbutton = button;
|
||||
|
||||
// action_signalscreenchange();
|
||||
|
||||
#if CONFIG_CODEC != SWCODEC
|
||||
peak_meter_peek();
|
||||
#endif
|
||||
|
@ -1023,8 +889,8 @@ bool radio_screen(void)
|
|||
|
||||
while(1)
|
||||
{
|
||||
button = button_get(true);
|
||||
if(button == (FM_STOP | BUTTON_REL))
|
||||
button = get_action(CONTEXT_FM, TIMEOUT_BLOCK);
|
||||
if(button == (ACTION_FM_STOP | BUTTON_REL))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1205,13 +1071,9 @@ static int handle_radio_presets_menu_cb(int key, int m)
|
|||
#ifdef FM_PRESET_ACTION
|
||||
switch(key)
|
||||
{
|
||||
case FM_PRESET_ACTION:
|
||||
key = MENU_EXIT; /* Fake an exit */
|
||||
break;
|
||||
|
||||
case FM_PRESET_ACTION | BUTTON_REL:
|
||||
/* Ignore the release events */
|
||||
key = BUTTON_NONE;
|
||||
case ACTION_F3:
|
||||
key = ACTION_STD_CANCEL; /* Fake an exit */
|
||||
action_signalscreenchange();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
@ -1361,11 +1223,11 @@ bool handle_radio_presets_menu(void)
|
|||
int handle_radio_presets_cb(int key, int m)
|
||||
{
|
||||
(void)m;
|
||||
#if 0 /* this screen needs fixing! */
|
||||
|
||||
switch(key)
|
||||
{
|
||||
#ifdef FM_PRESET_ADD
|
||||
case FM_PRESET_ADD:
|
||||
case ACTION_STD_MENU:
|
||||
radio_add_preset();
|
||||
menu_draw(m);
|
||||
key = BUTTON_NONE;
|
||||
|
@ -1373,61 +1235,25 @@ int handle_radio_presets_cb(int key, int m)
|
|||
#endif
|
||||
#if (CONFIG_KEYPAD != IRIVER_H100_PAD) && (CONFIG_KEYPAD != IRIVER_H300_PAD) && (CONFIG_KEYPAD != IAUDIO_X5_PAD)
|
||||
#ifdef FM_PRESET
|
||||
case FM_PRESET:
|
||||
case ACTION_STD_QUICKSCREEN:
|
||||
menu_draw(m);
|
||||
key = ACTION_STD_EXIT; /* Fake an exit */
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FM_PRESET_ACTION
|
||||
case FM_PRESET_ACTION:
|
||||
#endif
|
||||
#ifdef MENU_RC_ENTER
|
||||
case MENU_RC_ENTER | BUTTON_REPEAT:
|
||||
#endif
|
||||
#ifdef MENU_RC_ENTER2
|
||||
case MENU_RC_ENTER2 | BUTTON_REPEAT:
|
||||
#endif
|
||||
#ifdef MENU_ENTER2
|
||||
case MENU_ENTER2 | BUTTON_REPEAT:
|
||||
#endif
|
||||
case MENU_ENTER | BUTTON_REPEAT: /* long gives options */
|
||||
case ACTION_F3:
|
||||
case ACTION_STD_CONTEXT:
|
||||
{
|
||||
bool ret;
|
||||
ret = handle_radio_presets_menu();
|
||||
menu_draw(m);
|
||||
if(ret)
|
||||
key = MENU_ATTACHED_USB;
|
||||
key = SYS_USB_CONNECTED;
|
||||
else
|
||||
key = BUTTON_NONE;
|
||||
key = ACTION_NONE;
|
||||
break;
|
||||
}
|
||||
#ifdef MENU_RC_ENTER
|
||||
case MENU_RC_ENTER | BUTTON_REL:
|
||||
#endif
|
||||
#ifdef MENU_RC_ENTER2
|
||||
case MENU_RC_ENTER2 | BUTTON_REL:
|
||||
#endif
|
||||
#ifdef MENU_ENTER2
|
||||
case MENU_ENTER2 | BUTTON_REL:
|
||||
#endif
|
||||
case MENU_ENTER | BUTTON_REL:
|
||||
key = ACTION_STD_SELECT; /* fake enter for short press */
|
||||
break;
|
||||
|
||||
/* ignore down events */
|
||||
case ACTION_STD_SELECT:
|
||||
/* Ignore the release events */
|
||||
#ifdef FM_PRESET_ADD
|
||||
case FM_PRESET_ADD | BUTTON_REL:
|
||||
#endif
|
||||
#ifdef FM_PRESET_ACTION
|
||||
case FM_PRESET_ACTION | BUTTON_REL:
|
||||
#endif
|
||||
key = BUTTON_NONE;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return key;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue