New Touchscreen region type... 'mute' which un/mutes volume without pausing playback
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29046 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
ded64f1db5
commit
605e2d0e90
7 changed files with 66 additions and 6 deletions
|
@ -246,6 +246,7 @@ enum {
|
||||||
* being used, but are nice additions if the touchscreen is used */
|
* being used, but are nice additions if the touchscreen is used */
|
||||||
ACTION_TOUCH_SHUFFLE,
|
ACTION_TOUCH_SHUFFLE,
|
||||||
ACTION_TOUCH_REPMODE,
|
ACTION_TOUCH_REPMODE,
|
||||||
|
ACTION_TOUCH_MUTE,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* USB HID codes */
|
/* USB HID codes */
|
||||||
|
|
|
@ -880,6 +880,7 @@ static const struct touchaction touchactions[] = {
|
||||||
{ "resumeplayback", ACTION_TREE_WPS}, /* returns to previous music, WPS/FM */
|
{ "resumeplayback", ACTION_TREE_WPS}, /* returns to previous music, WPS/FM */
|
||||||
/* not really WPS specific, but no equivilant ACTION_STD_* */
|
/* not really WPS specific, but no equivilant ACTION_STD_* */
|
||||||
{"voldown", ACTION_WPS_VOLDOWN}, {"volup", ACTION_WPS_VOLUP},
|
{"voldown", ACTION_WPS_VOLDOWN}, {"volup", ACTION_WPS_VOLUP},
|
||||||
|
{"mute", ACTION_TOUCH_MUTE },
|
||||||
|
|
||||||
/* generic settings changers */
|
/* generic settings changers */
|
||||||
{"setting_inc", ACTION_SETTINGS_INC}, {"setting_dec", ACTION_SETTINGS_DEC},
|
{"setting_inc", ACTION_SETTINGS_INC}, {"setting_dec", ACTION_SETTINGS_DEC},
|
||||||
|
@ -945,7 +946,7 @@ static int parse_touchregion(struct skin_element *element,
|
||||||
region->wvp = curr_vp;
|
region->wvp = curr_vp;
|
||||||
region->armed = false;
|
region->armed = false;
|
||||||
region->reverse_bar = false;
|
region->reverse_bar = false;
|
||||||
region->extradata = NULL;
|
region->data = NULL;
|
||||||
action = element->params[4].data.text;
|
action = element->params[4].data.text;
|
||||||
|
|
||||||
strcpy(temp, action);
|
strcpy(temp, action);
|
||||||
|
@ -998,7 +999,7 @@ static int parse_touchregion(struct skin_element *element,
|
||||||
break;
|
break;
|
||||||
if (j==nb_settings)
|
if (j==nb_settings)
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
region->extradata = (void*)&settings[j];
|
region->data = (void*)&settings[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1011,6 +1012,13 @@ static int parse_touchregion(struct skin_element *element,
|
||||||
if (!item)
|
if (!item)
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
add_to_ll_chain(&wps_data->touchregions, item);
|
add_to_ll_chain(&wps_data->touchregions, item);
|
||||||
|
|
||||||
|
if (region->action == ACTION_TOUCH_MUTE)
|
||||||
|
{
|
||||||
|
region->value = global_settings.volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -196,7 +196,10 @@ struct touchregion {
|
||||||
int action; /* action this button will return */
|
int action; /* action this button will return */
|
||||||
bool armed; /* A region is armed on press. Only armed regions are triggered
|
bool armed; /* A region is armed on press. Only armed regions are triggered
|
||||||
on repeat or release. */
|
on repeat or release. */
|
||||||
void* extradata;
|
union { /* Extra data, action dependant */
|
||||||
|
void* data;
|
||||||
|
int value;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,10 @@
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "icon.h"
|
#include "icon.h"
|
||||||
#include "option_select.h"
|
#include "option_select.h"
|
||||||
|
#ifdef HAVE_TOUCHSCREEN
|
||||||
|
#include "sound.h"
|
||||||
|
#include "misc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* initial setup of wps_data */
|
/* initial setup of wps_data */
|
||||||
static int update_delay = DEFAULT_UPDATE_DELAY;
|
static int update_delay = DEFAULT_UPDATE_DELAY;
|
||||||
|
@ -296,10 +300,23 @@ int sb_touch_to_button(int context)
|
||||||
case ACTION_SETTINGS_INC:
|
case ACTION_SETTINGS_INC:
|
||||||
case ACTION_SETTINGS_DEC:
|
case ACTION_SETTINGS_DEC:
|
||||||
{
|
{
|
||||||
const struct settings_list *setting = region->extradata;
|
const struct settings_list *setting = region->data;
|
||||||
option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true);
|
option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true);
|
||||||
}
|
}
|
||||||
return ACTION_REDRAW;
|
return ACTION_REDRAW;
|
||||||
|
case ACTION_TOUCH_MUTE:
|
||||||
|
{
|
||||||
|
const int min_vol = sound_min(SOUND_VOLUME);
|
||||||
|
if (global_settings.volume == min_vol)
|
||||||
|
global_settings.volume = region->value;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
region->value = global_settings.volume;
|
||||||
|
global_settings.volume = min_vol;
|
||||||
|
}
|
||||||
|
setvol();
|
||||||
|
}
|
||||||
|
return ACTION_REDRAW;
|
||||||
/* TODO */
|
/* TODO */
|
||||||
}
|
}
|
||||||
return button;
|
return button;
|
||||||
|
|
|
@ -242,10 +242,23 @@ static int skintouch_to_wps(struct wps_data *data)
|
||||||
case ACTION_SETTINGS_INC:
|
case ACTION_SETTINGS_INC:
|
||||||
case ACTION_SETTINGS_DEC:
|
case ACTION_SETTINGS_DEC:
|
||||||
{
|
{
|
||||||
const struct settings_list *setting = region->extradata;
|
const struct settings_list *setting = region->data;
|
||||||
option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true);
|
option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true);
|
||||||
}
|
}
|
||||||
return ACTION_REDRAW;
|
return ACTION_REDRAW;
|
||||||
|
case ACTION_TOUCH_MUTE:
|
||||||
|
{
|
||||||
|
const int min_vol = sound_min(SOUND_VOLUME);
|
||||||
|
if (global_settings.volume == min_vol)
|
||||||
|
global_settings.volume = region->value;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
region->value = global_settings.volume;
|
||||||
|
global_settings.volume = min_vol;
|
||||||
|
}
|
||||||
|
setvol();
|
||||||
|
}
|
||||||
|
return ACTION_REDRAW;
|
||||||
}
|
}
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,10 @@
|
||||||
#include "appevents.h"
|
#include "appevents.h"
|
||||||
#include "statusbar-skinned.h"
|
#include "statusbar-skinned.h"
|
||||||
#include "option_select.h"
|
#include "option_select.h"
|
||||||
|
#ifdef HAVE_TOUCHSCREEN
|
||||||
|
#include "sound.h"
|
||||||
|
#include "misc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
char* default_radio_skin(enum screen_type screen)
|
char* default_radio_skin(enum screen_type screen)
|
||||||
|
@ -120,10 +124,23 @@ int fms_do_button_loop(bool update_screen)
|
||||||
case ACTION_SETTINGS_INC:
|
case ACTION_SETTINGS_INC:
|
||||||
case ACTION_SETTINGS_DEC:
|
case ACTION_SETTINGS_DEC:
|
||||||
{
|
{
|
||||||
const struct settings_list *setting = region->extradata;
|
const struct settings_list *setting = region->data;
|
||||||
option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true);
|
option_select_next_val(setting, button == ACTION_SETTINGS_DEC, true);
|
||||||
}
|
}
|
||||||
return ACTION_REDRAW;
|
return ACTION_REDRAW;
|
||||||
|
case ACTION_TOUCH_MUTE:
|
||||||
|
{
|
||||||
|
const int min_vol = sound_min(SOUND_VOLUME);
|
||||||
|
if (global_settings.volume == min_vol)
|
||||||
|
global_settings.volume = region->value;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
region->value = global_settings.volume;
|
||||||
|
global_settings.volume = min_vol;
|
||||||
|
}
|
||||||
|
setvol();
|
||||||
|
}
|
||||||
|
return ACTION_REDRAW;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return button;
|
return button;
|
||||||
|
|
|
@ -615,6 +615,7 @@ display cycling round the defined sublines. See
|
||||||
\item[pitch] -- Open the pitchscreen.
|
\item[pitch] -- Open the pitchscreen.
|
||||||
\item[voldown] -- Decrease the volume by one step.
|
\item[voldown] -- Decrease the volume by one step.
|
||||||
\item[volup] -- Increase the volume by one step.
|
\item[volup] -- Increase the volume by one step.
|
||||||
|
\item[mute] -- Un/Mute playback.
|
||||||
\end{description}
|
\end{description}
|
||||||
|
|
||||||
\section{Last Touchscreen Press}
|
\section{Last Touchscreen Press}
|
||||||
|
|
Loading…
Reference in a new issue