summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/SOURCES6
-rw-r--r--apps/gui/gwps-common.c2
-rw-r--r--apps/gui/gwps.c4
-rw-r--r--apps/gui/gwps.h1
-rw-r--r--apps/gui/option_select.c102
-rw-r--r--apps/gui/option_select.h119
-rw-r--r--apps/gui/quickscreen.c179
-rw-r--r--apps/gui/quickscreen.h114
-rw-r--r--apps/gui/select.c78
-rw-r--r--apps/gui/select.h33
-rw-r--r--apps/gui/statusbar.h5
-rw-r--r--apps/screen_access.c7
-rw-r--r--apps/screen_access.h3
-rw-r--r--apps/screens.c420
-rw-r--r--apps/screens.h14
-rw-r--r--apps/tree.c7
-rw-r--r--apps/tree.h1
17 files changed, 719 insertions, 376 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index a93e7cf4ff..c4eee62714 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -32,14 +32,16 @@ filetree.c
screen_access.c
gui/buttonbar.c
+gui/gwps.c
+gui/gwps-common.c
gui/icon.c
gui/list.c
+gui/option_select.c
+gui/quickscreen.c
gui/scrollbar.c
gui/select.c
gui/splash.c
gui/statusbar.c
-gui/gwps.c
-gui/gwps-common.c
gui/textarea.c
gui/yesno.c
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index 16f3a6f2cc..4eee5f7ba1 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -61,7 +61,7 @@ static void gui_wps_statusbar_draw(struct gui_wps *wps, bool force)
{
bool draw = global_settings.statusbar;
if(wps->data->wps_sb_tag
- && gui_wps->data->show_sb_on_wps)
+ && wps->data->show_sb_on_wps)
draw = true;
else if(wps->data->wps_sb_tag)
draw = false;
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index a93750770f..52340e6547 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -509,7 +509,7 @@ long gui_wps_show(void)
#ifdef WPS_RC_QUICK
case WPS_RC_QUICK:
#endif
- if (quick_screen(CONTEXT_WPS, WPS_QUICK))
+ if (quick_screen_quick())
return SYS_USB_CONNECTED;
restore = true;
lastbutton = 0;
@@ -518,7 +518,7 @@ long gui_wps_show(void)
/* screen settings */
#ifdef BUTTON_F3
case BUTTON_F3:
- if (quick_screen(CONTEXT_WPS, BUTTON_F3))
+ if (quick_screen_f3())
return SYS_USB_CONNECTED;
restore = true;
break;
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h
index dfae7c34e2..66199bcfc4 100644
--- a/apps/gui/gwps.h
+++ b/apps/gui/gwps.h
@@ -68,6 +68,7 @@
#define WPS_RC_BROWSE (BUTTON_RC_MENU | BUTTON_REL)
#define WPS_RC_BROWSE_PRE BUTTON_RC_MENU
#define WPS_RC_CONTEXT (BUTTON_RC_MENU | BUTTON_REPEAT)
+#define WPS_RC_QUICK (BUTTON_RC_MODE | BUTTON_REPEAT)
#elif CONFIG_KEYPAD == RECORDER_PAD
#define WPS_NEXT (BUTTON_RIGHT | BUTTON_REL)
diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c
new file mode 100644
index 0000000000..0e169617c4
--- /dev/null
+++ b/apps/gui/option_select.c
@@ -0,0 +1,102 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 by Kevin Ferrare
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "option_select.h"
+#include "sprintf.h"
+#include "kernel.h"
+#include "lang.h"
+
+void option_select_init_numeric(struct option_select * opt,
+ const char * title,
+ int init_value,
+ int min_value,
+ int max_value,
+ int step,
+ const char * unit,
+ option_formatter *formatter)
+{
+ opt->title=title;
+ opt->min_value=min_value;
+ opt->max_value=max_value+1;
+ opt->option=init_value;
+ opt->step=step;
+ opt->extra_string=unit;
+ opt->formatter=formatter;
+ opt->items=NULL;
+ opt->limit_loop=false;
+}
+
+void option_select_init_items(struct option_select * opt,
+ const char * title,
+ int selected,
+ const struct opt_items * items,
+ int nb_items)
+{
+ opt->title=title;
+ opt->min_value=0;
+ opt->max_value=nb_items;
+ opt->option=selected;
+ opt->step=1;
+ opt->formatter=NULL;
+ opt->items=items;
+ opt->limit_loop=false;
+}
+
+void option_select_next(struct option_select * opt)
+{
+ if(opt->option + opt->step >= opt->max_value)
+ {
+ if(!opt->limit_loop)
+ {
+ if(opt->option==opt->max_value-1)
+ opt->option=opt->min_value;
+ else
+ opt->option=opt->max_value-1;
+ }
+ }
+ else
+ opt->option+=opt->step;
+}
+
+void option_select_prev(struct option_select * opt)
+{
+ if(opt->option - opt->step < opt->min_value)
+ {
+ if(!opt->limit_loop)
+ {
+ if(opt->option==opt->min_value)
+ opt->option=opt->max_value-1;
+ else
+ opt->option=opt->min_value;
+ }
+ }
+ else
+ opt->option-=opt->step;
+}
+
+const char * option_select_get_text(struct option_select * opt, char * buffer)
+{
+ if(opt->items)
+ return(P2STR(opt->items[opt->option].string));
+ if(!opt->formatter)
+ snprintf(buffer, sizeof buffer,"%d %s", opt->option, opt->extra_string);
+ else
+ opt->formatter(buffer, sizeof buffer, opt->option, opt->extra_string);
+ return(buffer);
+}
diff --git a/apps/gui/option_select.h b/apps/gui/option_select.h
new file mode 100644
index 0000000000..c6a5e196f0
--- /dev/null
+++ b/apps/gui/option_select.h
@@ -0,0 +1,119 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 by Kevin Ferrare
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#ifndef _GUI_OPTION_SELECT_H_
+#define _GUI_OPTION_SELECT_H_
+#include "settings.h"
+
+typedef void option_formatter(char* dest, int dest_length,
+ int variable, const char* unit);
+
+struct option_select
+{
+ const char * title;
+ int min_value;
+ int max_value;
+ int step;
+ int option;
+ const char * extra_string;
+ /* In the case the option is a number */
+ option_formatter *formatter;
+ const struct opt_items * items;
+ bool limit_loop;
+};
+
+/*
+ * Initializes an option containing a numeric values
+ * - title : the title of the option
+ * - init_value : the initial value the number will be
+ * - min_value, max_value : bounds to the value
+ * - step : the ammount you want to add / withdraw to the initial number
+ * each time a key is pressed
+ * - unit : the unit in which the value is (ex "s", "bytes", ...)
+ * - formatter : a callback function that generates a string
+ * from the number it gets
+ */
+extern void option_select_init_numeric(struct option_select * opt,
+ const char * title,
+ int init_value,
+ int min_value,
+ int max_value,
+ int step,
+ const char * unit,
+ option_formatter *formatter);
+
+/*
+ * Initializes an option containing a list of choices
+ * - title : the title of the option
+ * - selected : the initially selected item
+ * - items : the list of items, defined in settings.h
+ * - nb_items : the number of items in the 'items' list
+ */
+extern void option_select_init_items(struct option_select * opt,
+ const char * title,
+ int selected,
+ const struct opt_items * items,
+ int nb_items);
+
+/*
+ * Gets the selected option
+ * - opt : the option struct
+ * - buffer : a buffer to eventually format the option
+ * Returns the selected option
+ */
+extern const char * option_select_get_text(struct option_select * opt, char * buffer);
+
+/*
+ * Selects the next value
+ * - opt : the option struct
+ */
+extern void option_select_next(struct option_select * opt);
+
+/*
+ * Selects the previous value
+ * - opt : the option struct
+ */
+extern void option_select_prev(struct option_select * opt);
+
+/*
+ * Returns the selected number
+ * - opt : the option struct
+ */
+#define option_select_get_selected(_opt) \
+ (_opt)->option
+
+/*
+ * Returns the title
+ * - opt : the option struct
+ */
+#define option_select_get_title(_opt) \
+ (_opt)->title
+
+/*
+ * Tells the option selector wether it should stop when reaching the min/max value
+ * or should continue (by going to max/min)
+ * - opt : the option struct
+ * - scroll :
+ * - true : stops when reaching min/max
+ * - false : continues to go to max/min when reaching min/max
+ */
+#define option_select_limit_loop(_opt, loop) \
+ (_opt)->limit_loop=loop
+
+#endif /* _GUI_OPTION_SELECT_H_ */
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c
new file mode 100644
index 0000000000..760c1bdb00
--- /dev/null
+++ b/apps/gui/quickscreen.c
@@ -0,0 +1,179 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 by Kevin Ferrare
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "quickscreen.h"
+#ifdef HAS_QUICKSCREEN
+
+#include "icons.h"
+#include "textarea.h"
+#include "font.h"
+#include "kernel.h"
+#include "misc.h"
+#include "statusbar.h"
+
+void gui_quickscreen_init(struct gui_quickscreen * qs,
+ struct option_select *left_option,
+ struct option_select *bottom_option,
+ struct option_select *right_option,
+ char * left_right_title,
+ quickscreen_callback callback)
+{
+ qs->left_option=left_option;
+ qs->bottom_option=bottom_option;
+ qs->right_option=right_option;
+ qs->left_right_title=left_right_title;
+ qs->callback=callback;
+}
+
+void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display)
+{
+ int w,h;
+ char buffer[30];
+ const char * option;
+ const char * title;
+#ifdef HAS_BUTTONBAR
+ display->has_buttonbar=false;
+#endif
+ gui_textarea_clear(display);
+ display->getstringsize("M",&w,&h);
+ /* Displays the icons */
+ display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward],
+ display->width/2 - 16,
+ display->height/2 - 4, 7, 8);
+ display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow],
+ display->width/2 - 3,
+ display->height - h*3, 7, 8);
+ display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward],
+ display->width/2 + 8,
+ display->height/2 - 4, 7, 8);
+ display->setfont(FONT_SYSFIXED);
+
+ /* Displays the left's text */
+ title=option_select_get_title(qs->left_option);
+ option=option_select_get_text(qs->left_option, buffer);
+ display->putsxy(0, display->height/2 - h*2, title);
+ display->putsxy(0, display->height/2 - h, qs->left_right_title);
+ display->putsxy(0, display->height/2, option);
+
+ /* Displays the bottom's text */
+ title=option_select_get_title(qs->bottom_option);
+ option=option_select_get_text(qs->bottom_option, buffer);
+ display->getstringsize(title, &w, &h);
+ display->putsxy((display->width-w)/2, display->height - h*2, title);
+ display->getstringsize(option, &w, &h);
+ display->putsxy((display->width-w)/2, display->height - h, option);
+
+ /* Displays the right's text */
+ title=option_select_get_title(qs->right_option);
+ option=option_select_get_text(qs->right_option, buffer);
+ display->getstringsize(title,&w,&h);
+ display->putsxy(display->width - w, display->height/2 - h*2, title);
+ display->getstringsize(qs->left_right_title,&w,&h);
+ display->putsxy(display->width - w, display->height/2 - h, qs->left_right_title);
+ display->getstringsize(option,&w,&h);
+ display->putsxy(display->width - w, display->height/2, option);
+
+ gui_textarea_update(display);
+ lcd_setfont(FONT_UI);
+}
+
+void gui_syncquickscreen_draw(struct gui_quickscreen * qs)
+{
+ int i;
+ FOR_NB_SCREENS(i)
+ gui_quickscreen_draw(qs, &screens[i]);
+}
+
+bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button)
+{
+ switch(button)
+ {
+ case QUICKSCREEN_LEFT :
+ case QUICKSCREEN_LEFT | BUTTON_REPEAT :
+#ifdef QUICKSCREEN_RC_LEFT
+ case QUICKSCREEN_RC_LEFT :
+ case QUICKSCREEN_RC_LEFT | BUTTON_REPEAT :
+#endif
+ option_select_next(qs->left_option);
+ return(true);
+
+ case QUICKSCREEN_BOTTOM :
+ case QUICKSCREEN_BOTTOM | BUTTON_REPEAT :
+#ifdef QUICKSCREEN_RC_BOTTOM
+ case QUICKSCREEN_RC_BOTTOM :
+ case QUICKSCREEN_RC_BOTTOM | BUTTON_REPEAT :
+#endif
+ option_select_next(qs->bottom_option);
+ return(true);
+
+ case QUICKSCREEN_RIGHT :
+ case QUICKSCREEN_RIGHT | BUTTON_REPEAT :
+#ifdef QUICKSCREEN_RC_RIGHT
+ case QUICKSCREEN_RC_RIGHT :
+ case QUICKSCREEN_RC_RIGHT | BUTTON_REPEAT :
+#endif
+ option_select_next(qs->right_option);
+ return(true);
+
+ case QUICKSCREEN_BOTTOM_INV :
+ case QUICKSCREEN_BOTTOM_INV | BUTTON_REPEAT :
+#ifdef QUICKSCREEN_RC_BOTTOM_INV
+ case QUICKSCREEN_RC_BOTTOM_INV :
+ case QUICKSCREEN_RC_BOTTOM_INV | BUTTON_REPEAT :
+#endif
+ option_select_prev(qs->bottom_option);
+ return(true);
+ }
+ return(false);
+}
+
+bool gui_syncquickscreen_run(struct gui_quickscreen * qs)
+{
+ int key;
+ gui_syncquickscreen_draw(qs);
+ while (true) {
+ key = button_get(true);
+ if(default_event_handler(key) == SYS_USB_CONNECTED)
+ return(true);
+ if(gui_quickscreen_do_button(qs, key))
+ {
+ if(qs->callback)
+ qs->callback(qs);
+ gui_syncquickscreen_draw(qs);
+ }
+ else if(key==QUICKSCREEN_QUIT
+#ifdef QUICKSCREEN_QUIT
+ || key==QUICKSCREEN_QUIT
+#endif
+#ifdef QUICKSCREEN_QUIT2
+ || key==QUICKSCREEN_QUIT2
+#endif
+#if QUICKSCREEN_RC_QUIT
+ || key==QUICKSCREEN_RC_QUIT
+#endif
+ )
+ {
+ return(false);
+ }
+ gui_syncstatusbar_draw(&statusbars, false);
+ }
+}
+
+#endif /* HAS_QUICKSCREEN */
+
diff --git a/apps/gui/quickscreen.h b/apps/gui/quickscreen.h
new file mode 100644
index 0000000000..09a0390d93
--- /dev/null
+++ b/apps/gui/quickscreen.h
@@ -0,0 +1,114 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2005 by Kevin Ferrare
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "button.h"
+#include "config.h"
+#if (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == IRIVER_H100_PAD) ||\
+ (CONFIG_KEYPAD == IRIVER_H300_PAD)
+
+#ifndef _GUI_QUICKSCREEN_H_
+#define _GUI_QUICKSCREEN_H_
+
+#define HAS_QUICKSCREEN
+
+#include "option_select.h"
+#include "screen_access.h"
+
+#define QUICKSCREEN_LEFT BUTTON_LEFT
+#define QUICKSCREEN_BOTTOM BUTTON_DOWN
+#define QUICKSCREEN_BOTTOM_INV BUTTON_UP
+#define QUICKSCREEN_RIGHT BUTTON_RIGHT
+
+#if CONFIG_KEYPAD == RECORDER_PAD
+#define QUICKSCREEN_QUIT BUTTON_F2
+#define QUICKSCREEN_QUIT2 BUTTON_F3
+#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
+#define QUICKSCREEN_QUIT BUTTON_MODE
+#define QUICKSCREEN_QUIT2 BUTTON_OFF
+#define QUICKSCREEN_RC_QUIT BUTTON_RC_MODE
+#ifdef CONFIG_REMOTE_KEYPAD
+#define QUICKSCREEN_RC_LEFT BUTTON_RC_REW
+#define QUICKSCREEN_RC_BOTTOM BUTTON_RC_VOL_DOWN
+#define QUICKSCREEN_RC_BOTTOM_INV BUTTON_RC_VOL_UP
+#define QUICKSCREEN_RC_RIGHT BUTTON_RC_FF
+#endif
+
+#endif
+
+struct gui_quickscreen;
+/*
+ * Callback function called each time the quickscreen gets modified
+ * - qs : the quickscreen that did the modification
+ */
+typedef void (quickscreen_callback)(struct gui_quickscreen * qs);
+
+struct gui_quickscreen
+{
+ struct option_select *left_option;
+ struct option_select *bottom_option;
+ struct option_select *right_option;
+ char * left_right_title;
+ quickscreen_callback *callback;
+};
+
+/*
+ * Initializes a quickscreen
+ * - qs : the quickscreen
+ * - left_option, bottom_option, right_option : a list of choices
+ * for each option
+ * - left_right_title : the 2nd line of the title
+ * on the left and on the right
+ * - callback : a callback function called each time the quickscreen
+ * gets modified
+ */
+void gui_quickscreen_init(struct gui_quickscreen * qs,
+ struct option_select *left_option,
+ struct option_select *bottom_option,
+ struct option_select *right_option,
+ char * left_right_title,
+ quickscreen_callback *callback);
+/*
+ * Draws the quickscreen on a given screen
+ * - qs : the quickscreen
+ * - display : the screen to draw on
+ */
+void gui_quickscreen_draw(struct gui_quickscreen * qs, struct screen * display);
+
+/*
+ * Does the actions associated to the given button if any
+ * - qs : the quickscreen
+ * - button : the key we are going to analyse
+ * returns : true if the button corresponded to an action, false otherwise
+ */
+bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button);
+
+/*
+ * Draws the quickscreen on all available screens
+ * - qs : the quickscreen
+ */
+void gui_syncquickscreen_draw(struct gui_quickscreen * qs);
+
+/*
+ * Runs the quickscreen on all available screens
+ * - qs : the quickscreen
+ * returns : true if usb was connected, false otherwise
+ */
+bool gui_syncquickscreen_run(struct gui_quickscreen * qs);
+
+#endif /*_GUI_QUICK_SCREEN_H_*/
+#endif /* CONFIG_KEYPAD */
diff --git a/apps/gui/select.c b/apps/gui/select.c
index 5cde812a2f..b632177fd7 100644
--- a/apps/gui/select.c
+++ b/apps/gui/select.c
@@ -21,9 +21,9 @@
#include "lang.h"
#include "textarea.h"
-#include "sprintf.h"
-#include "kernel.h"
#include "screen_access.h"
+#include "kernel.h"
+
void gui_select_init_numeric(struct gui_select * select,
const char * title,
@@ -32,23 +32,12 @@ void gui_select_init_numeric(struct gui_select * select,
int max_value,
int step,
const char * unit,
- void (*formatter)(char* dest,
- int dest_length,
- int variable,
- const char* unit)
- )
+ option_formatter *formatter)
{
select->canceled=false;
select->validated=false;
- select->title=title;
- select->min_value=min_value;
- select->max_value=max_value+1;
- select->option=init_value;
- select->step=step;
- select->extra_string=unit;
- select->formatter=formatter;
- select->items=NULL;
- select->limit_loop=false;
+ option_select_init_numeric(&select->options, title, init_value,
+ min_value, max_value, step, unit, formatter);
}
void gui_select_init_items(struct gui_select * select,
@@ -59,69 +48,22 @@ void gui_select_init_items(struct gui_select * select,
{
select->canceled=false;
select->validated=false;
- select->title=title;
- select->min_value=0;
- select->max_value=nb_items;
- select->option=selected;
- select->step=1;
- select->formatter=NULL;
- select->items=items;
- select->limit_loop=false;
-}
-
-void gui_select_next(struct gui_select * select)
-{
- if(select->option + select->step >= select->max_value)
- {
- if(!select->limit_loop)
- {
- if(select->option==select->max_value-1)
- select->option=select->min_value;
- else
- select->option=select->max_value-1;
- }
- }
- else
- select->option+=select->step;
-}
-
-void gui_select_prev(struct gui_select * select)
-{
- if(select->option - select->step < select->min_value)
- {
- if(!select->limit_loop)
- {
- if(select->option==select->min_value)
- select->option=select->max_value-1;
- else
- select->option=select->min_value;
- }
- }
- else
- select->option-=select->step;
+ option_select_init_items(&select->options, title, selected, items, nb_items);
}
void gui_select_draw(struct gui_select * select, struct screen * display)
{
+ char buffer[30];
+ const char * selected=option_select_get_text(&(select->options), buffer);
#ifdef HAVE_LCD_BITMAP
screen_set_xmargin(display, 0);
#endif
gui_textarea_clear(display);
- display->puts_scroll(0, 0, select->title);
+ display->puts_scroll(0, 0, option_select_get_title(&(select->options)));
if(gui_select_is_canceled(select))
display->puts_scroll(0, 0, str(LANG_MENU_SETTING_CANCEL));
- if(select->items)
- display->puts_scroll(0, 1, P2STR(select->items[select->option].string));
- else
- {
- char buffer[30];
- if(!select->formatter)
- snprintf(buffer, sizeof buffer,"%d %s", select->option, select->extra_string);
- else
- select->formatter(buffer, sizeof buffer, select->option, select->extra_string);
- display->puts_scroll(0, 1, buffer);
- }
+ display->puts_scroll(0, 1, selected);
gui_textarea_update(display);
}
diff --git a/apps/gui/select.h b/apps/gui/select.h
index bc14af4a24..2799d80043 100644
--- a/apps/gui/select.h
+++ b/apps/gui/select.h
@@ -21,6 +21,7 @@
#define _GUI_SELECT_H_
#include "screen_access.h"
#include "settings.h"
+#include "option_select.h"
#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
(CONFIG_KEYPAD == IRIVER_H300_PAD)
@@ -83,19 +84,7 @@ struct gui_select
{
bool canceled;
bool validated;
- const char * title;
- int min_value;
- int max_value;
- int step;
- int option;
- const char * extra_string;
- /* In the case the option is a number */
- void (*formatter)(char* dest,
- int dest_length,
- int variable,
- const char* unit);
- const struct opt_items * items;
- bool limit_loop;
+ struct option_select options;
};
/*
@@ -116,10 +105,7 @@ extern void gui_select_init_numeric(struct gui_select * select,
int max_value,
int step,
const char * unit,
- void (*formatter)(char* dest,
- int dest_length,
- int variable,
- const char* unit));
+ option_formatter *formatter);
/*
@@ -140,13 +126,15 @@ extern void gui_select_init_items(struct gui_select * select,
* Selects the next value
* - select : the select struct
*/
-extern void gui_select_next(struct gui_select * select);
+#define gui_select_next(select) \
+ option_select_next(&(select->options))
/*
* Selects the previous value
* - select : the select struct
*/
-extern void gui_select_prev(struct gui_select * select);
+#define gui_select_prev(select) \
+ option_select_prev(&(select->options))
/*
* Draws the select on the given screen
@@ -159,9 +147,8 @@ extern void gui_select_draw(struct gui_select * select, struct screen * display)
* Returns the selected value
* - select : the select struct
*/
-#define gui_select_get_selected(select) \
- (select)->option
-
+#define gui_select_get_selected(_sel_) \
+ option_select_get_selected(&((_sel_)->options))
/*
* Cancels the select
* - select : the select struct
@@ -199,7 +186,7 @@ extern void gui_select_draw(struct gui_select * select, struct screen * display)
* - false : continues to go to max/min when reaching min/max
*/
#define gui_select_limit_loop(select, loop) \
- (select)->limit_loop=loop
+ option_select_limit_loop(&((select)->options), loop)
/*
* Draws the select on all the screens
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h
index e7fe92eaf9..816205e2b4 100644
--- a/apps/gui/statusbar.h
+++ b/apps/gui/statusbar.h
@@ -85,8 +85,9 @@ extern void gui_statusbar_init(struct gui_statusbar * bar);
* - bar : the statusbar structure
* - display : the screen to attach
*/
-#define gui_statusbar_set_screen(gui_statusbar, screen) \
- (gui_statusbar)->display = screen
+#define gui_statusbar_set_screen(gui_statusbar, _display) \
+ (gui_statusbar)->display = (_display);
+
/*
* Draws the status bar on the attached screen
diff --git a/apps/screen_access.c b/apps/screen_access.c
index db64e27199..9ea33ba25f 100644
--- a/apps/screen_access.c
+++ b/apps/screen_access.c
@@ -19,6 +19,7 @@
#include <lcd.h>
#include <lcd-remote.h>
+#include "backlight.h"
#include <font.h>
#include <button.h>
#include <sprintf.h>
@@ -67,7 +68,7 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
screen->scroll_step=&lcd_remote_scroll_step;
screen->puts_scroll_style=&lcd_remote_puts_scroll_style;
screen->invertscroll=&lcd_remote_invertscroll;
-#endif /* 1 */
+#endif /* LCD_REMOTE_DEPTH > 1 */
#if 0 /* no charcell remote LCDs so far */
screen->width=11;
@@ -89,6 +90,8 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
screen->clear_display=&lcd_remote_clear_display;
screen->update=&lcd_remote_update;
screen->puts=&lcd_remote_puts;
+ screen->backlight_on=&remote_backlight_on;
+ screen->backlight_off=&remote_backlight_off;
break;
#endif /* HAVE_REMOTE_LCD */
@@ -151,6 +154,8 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
screen->update=&lcd_update;
#endif
screen->puts=&lcd_puts;
+ screen->backlight_on=&backlight_on;
+ screen->backlight_off=&backlight_off;
break;
}
screen->screen_type=screen_type;
diff --git a/apps/screen_access.h b/apps/screen_access.h
index 7f235a2480..430d5ab661 100644
--- a/apps/screen_access.h
+++ b/apps/screen_access.h
@@ -103,7 +103,8 @@ struct screen
#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) || defined(SIMULATOR)
void (*update)(void);
#endif
-
+ void (*backlight_on)(void);
+ void (*backlight_off)(void);
void (*puts)(int x, int y, const unsigned char *str);
};
diff --git a/apps/screens.c b/apps/screens.c
index acfcd01dbe..eea06785cb 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -49,6 +49,8 @@
#include "gwps-common.h"
#include "splash.h"
#include "statusbar.h"
+#include "screen_access.h"
+#include "quickscreen.h"
#if defined(HAVE_LCD_BITMAP)
#include "widgets.h"
@@ -101,25 +103,25 @@ static const unsigned char usb_logo[] = {
};
#endif
-void usb_display_info(void)
+void usb_display_info(struct screen * display)
{
- lcd_clear_display();
+ display->clear_display();
#ifdef HAVE_LCD_BITMAP
/* Center bitmap on screen */
- lcd_mono_bitmap(usb_logo, LCD_WIDTH/2-BMPWIDTH_usb_logo/2,
- LCD_HEIGHT/2-BMPHEIGHT_usb_logo/2, BMPWIDTH_usb_logo,
- BMPHEIGHT_usb_logo);
- gui_syncstatusbar_draw(&statusbars, true);
- lcd_update();
+ display->mono_bitmap(usb_logo,
+ display->width/2-BMPWIDTH_usb_logo/2,
+ display->height/2-BMPHEIGHT_usb_logo/2,
+ BMPWIDTH_usb_logo,
+ BMPHEIGHT_usb_logo);
+ display->update();
#else
- lcd_double_height(false);
- lcd_puts(0, 0, "[USB Mode]");
- status_set_param(false);
- status_set_audio(false);
- status_set_usb(true);
- gui_syncstatusbar_draw(&statusbars, false);
-#endif
+ display->double_height(false);
+ display->puts(0, 0, "[USB Mode]");
+#ifdef SIMULATOR
+ display->update();
+#endif /* SIMULATOR */
+#endif /* HAVE_LCD_BITMAP */
}
void usb_screen(void)
@@ -127,28 +129,35 @@ void usb_screen(void)
#ifdef USB_NONE
/* nothing here! */
#else
-#ifndef SIMULATOR
- backlight_on();
+ int i;
+ FOR_NB_SCREENS(i) {
+ screens[i].backlight_on();
+ usb_display_info(&screens[i]);
+ }
+#ifdef HAVE_LCD_CHARCELLS
+ status_set_param(false);
+ status_set_audio(false);
+ status_set_usb(true);
+#endif /* HAVE_LCD_BITMAP */
+ gui_syncstatusbar_draw(&statusbars, true);
+#ifdef SIMULATOR
+ while (button_get(true) & BUTTON_REL);
+#else
usb_acknowledge(SYS_USB_CONNECTED_ACK);
- usb_display_info();
while(usb_wait_for_disconnect_w_tmo(&button_queue, HZ)) {
if(usb_inserted()) {
-
#ifdef HAVE_MMC /* USB-MMC bridge can report activity */
-
led(mmc_usb_active(HZ));
-
-#endif
-
+#endif /* HAVE_MMC */
gui_syncstatusbar_draw(&statusbars, false);
}
}
+#endif /* SIMULATOR */
#ifdef HAVE_LCD_CHARCELLS
status_set_usb(false);
-#endif
-
- backlight_on();
-#endif
+#endif /* HAVE_LCD_CHARCELLS */
+ FOR_NB_SCREENS(i)
+ screens[i].backlight_on();
#endif /* USB_NONE */
}
@@ -157,7 +166,8 @@ int mmc_remove_request(void)
{
struct event ev;
- lcd_clear_display();
+ FOR_NB_SCREENS(i)
+ screens[i].clear_display();
gui_syncsplash(1, true, str(LANG_REMOVE_MMC));
if (global_settings.talk_menu)
talk_id(LANG_REMOVE_MMC, false);
@@ -520,257 +530,137 @@ int pitch_screen(void)
#if (CONFIG_KEYPAD == RECORDER_PAD) || (CONFIG_KEYPAD == IRIVER_H100_PAD) ||\
(CONFIG_KEYPAD == IRIVER_H300_PAD)
-bool quick_screen(int context, int button)
-{
- bool exit = false;
- bool used = false;
- int w, h, key;
- char buf[32];
- int oldrepeat = global_settings.repeat_mode;
+#define bool_to_int(b)\
+ b?1:0
+#define int_to_bool(i)\
+ i==0?false:true
- /* just to stop compiler warning */
- context = context;
- lcd_setfont(FONT_SYSFIXED);
-
- lcd_getstringsize("A",&w,&h);
-
- while (!exit) {
- char* ptr=NULL;
-
- lcd_clear_display();
-
- switch(button)
- {
-#if CONFIG_KEYPAD == RECORDER_PAD
- case SCREENS_QUICK:
-#endif
-#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
- case SCREENS_QUICK | BUTTON_REPEAT:
-#endif
- /* Shuffle mode */
- lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_SHUFFLE));
- lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F2_MODE));
- lcd_putsxy(0, LCD_HEIGHT/2,
- global_settings.playlist_shuffle ?
- str(LANG_ON) : str(LANG_OFF));
-
- /* Directory Filter */
- switch ( global_settings.dirfilter ) {
- case SHOW_ALL:
- ptr = str(LANG_FILTER_ALL);
- break;
-
- case SHOW_SUPPORTED:
- ptr = str(LANG_FILTER_SUPPORTED);
- break;
-
- case SHOW_MUSIC:
- ptr = str(LANG_FILTER_MUSIC);
- break;
-
- case SHOW_PLAYLIST:
- ptr = str(LANG_FILTER_PLAYLIST);
- break;
-
- case SHOW_ID3DB:
- ptr = str(LANG_FILTER_ID3DB);
- break;
- }
-
- snprintf(buf, sizeof buf, "%s:", str(LANG_FILTER));
- lcd_getstringsize(buf,&w,&h);
- lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, buf);
- lcd_getstringsize(ptr,&w,&h);
- lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr);
-
- /* Repeat Mode */
- switch ( global_settings.repeat_mode ) {
- case REPEAT_OFF:
- ptr = str(LANG_OFF);
- break;
-
- case REPEAT_ALL:
- ptr = str(LANG_REPEAT_ALL);
- break;
-
- case REPEAT_ONE:
- ptr = str(LANG_REPEAT_ONE);
- break;
-
- case REPEAT_SHUFFLE:
- ptr = str(LANG_SHUFFLE);
- break;
+void quick_screen_quick_apply(struct gui_quickscreen *qs)
+{
+ global_settings.playlist_shuffle=int_to_bool(option_select_get_selected(qs->left_option));
+ global_settings.dirfilter=option_select_get_selected(qs->bottom_option);
+ global_settings.repeat_mode=option_select_get_selected(qs->right_option);
+}
+bool quick_screen_quick(void)
+{
+ bool res, oldrepeat;
+ struct option_select left_option;
+ struct option_select bottom_option;
+ struct option_select right_option;
+ struct opt_items left_items[] = {
+ [0]={ STR(LANG_OFF) },
+ [1]={ STR(LANG_ON) }
+ };
+ struct opt_items bottom_items[] = {
+ [SHOW_ALL]={ STR(LANG_FILTER_ALL) },
+ [SHOW_SUPPORTED]={ STR(LANG_FILTER_SUPPORTED) },
+ [SHOW_MUSIC]={ STR(LANG_FILTER_MUSIC) },
+ [SHOW_PLAYLIST]={ STR(LANG_FILTER_PLAYLIST) },
+ [SHOW_ID3DB]={ STR(LANG_FILTER_ID3DB) }
+ };
+ struct opt_items right_items[] = {
+ [REPEAT_OFF]={ STR(LANG_OFF) },
+ [REPEAT_ALL]={ STR(LANG_REPEAT_ALL) },
+ [REPEAT_ONE]={ STR(LANG_REPEAT_ONE) },
+ [REPEAT_SHUFFLE]={ STR(LANG_SHUFFLE) },
#ifdef AB_REPEAT_ENABLE
- case REPEAT_AB:
- ptr = str(LANG_REPEAT_AB);
- break;
+ [REPEAT_AB]={ STR(LANG_REPEAT_AB) }
#endif
- }
-
- lcd_getstringsize(str(LANG_REPEAT),&w,&h);
- lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, str(LANG_REPEAT));
- lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F2_MODE));
- lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, ptr);
- break;
-#ifdef BUTTON_F3
- case BUTTON_F3:
- /* Scrollbar */
- lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_F3_SCROLL));
- lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F3_BAR));
- lcd_putsxy(0, LCD_HEIGHT/2,
- global_settings.scrollbar ? str(LANG_ON) : str(LANG_OFF));
-
- /* Status bar */
- ptr = str(LANG_F3_STATUS);
- lcd_getstringsize(ptr,&w,&h);
- lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h*2, ptr);
- lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2 - h, str(LANG_F3_BAR));
- lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2,
- global_settings.statusbar ? str(LANG_ON) : str(LANG_OFF));
-
- /* Flip */
- ptr = str(LANG_FLIP_DISPLAY);
- lcd_getstringsize(ptr,&w,&h);
- lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, str(LANG_FLIP_DISPLAY));
- ptr = global_settings.flip_display ?
- str(LANG_SET_BOOL_YES) : str(LANG_SET_BOOL_NO);
- lcd_getstringsize(ptr,&w,&h);
- lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr);
- break;
-#endif
- }
-
- lcd_mono_bitmap(bitmap_icons_7x8[Icon_FastBackward],
- LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8);
- lcd_mono_bitmap(bitmap_icons_7x8[Icon_DownArrow],
- LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8);
- lcd_mono_bitmap(bitmap_icons_7x8[Icon_FastForward],
- LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8);
-
- lcd_update();
- key = button_get(true);
-
- /*
- * This is a temporary kludge so that the F2 & F3 menus operate in exactly
- * the same manner up until the full F2/F3 configurable menus are complete
- */
-
- if( key == BUTTON_LEFT || key == BUTTON_RIGHT || key == BUTTON_DOWN || key == ( BUTTON_LEFT | BUTTON_REPEAT ) || key == ( BUTTON_RIGHT | BUTTON_REPEAT ) || key == ( BUTTON_DOWN | BUTTON_REPEAT ) )
- key = button | key;
-
- switch (key) {
- case SCREENS_QUICK | BUTTON_LEFT:
- case SCREENS_QUICK | BUTTON_LEFT | BUTTON_REPEAT:
- global_settings.playlist_shuffle =
- !global_settings.playlist_shuffle;
-
- if(audio_status() & AUDIO_STATUS_PLAY)
- {
+ };
+ struct gui_quickscreen qs;
+
+ option_select_init_items(&left_option,
+ str(LANG_SHUFFLE),
+ bool_to_int(global_settings.playlist_shuffle),
+ left_items,
+ 2);
+ option_select_init_items(&bottom_option,
+ str(LANG_FILTER),
+ global_settings.dirfilter,
+ bottom_items,
+ sizeof(bottom_items)/sizeof(struct opt_items));
+ option_select_init_items(&right_option,
+ str(LANG_REPEAT),
+ global_settings.repeat_mode,
+ right_items,
+ sizeof(right_items)/sizeof(struct opt_items));
+
+ gui_quickscreen_init(&qs, &left_option, &bottom_option, &right_option,
+ str(LANG_F2_MODE), &quick_screen_quick_apply);
+ oldrepeat=global_settings.repeat_mode;
+ res=gui_syncquickscreen_run(&qs);
+ if(!res)
+ {
+ if ( oldrepeat != global_settings.repeat_mode &&
+ (audio_status() & AUDIO_STATUS_PLAY) )
+ audio_flush_and_reload_tracks();
+ if(global_settings.playlist_shuffle
+ && audio_status() & AUDIO_STATUS_PLAY)
+ {
#if CONFIG_CODEC == SWCODEC
- dsp_set_replaygain(true);
-#endif
-
- if (global_settings.playlist_shuffle)
- playlist_randomise(NULL, current_tick, true);
- else
- playlist_sort(NULL, true);
- }
- used = true;
- break;
-
- case SCREENS_QUICK | BUTTON_DOWN:
- case SCREENS_QUICK | BUTTON_DOWN | BUTTON_REPEAT:
- global_settings.dirfilter++;
- if ( global_settings.dirfilter >= NUM_FILTER_MODES )
- global_settings.dirfilter = 0;
- used = true;
- break;
-
- case SCREENS_QUICK | BUTTON_RIGHT:
- case SCREENS_QUICK | BUTTON_RIGHT | BUTTON_REPEAT:
- global_settings.repeat_mode++;
- if ( global_settings.repeat_mode >= NUM_REPEAT_MODES )
- global_settings.repeat_mode = 0;
- used = true;
- break;
-
-#ifdef BUTTON_F3
- case BUTTON_F3 | BUTTON_LEFT:
- case BUTTON_F3 | BUTTON_LEFT | BUTTON_REPEAT:
- global_settings.scrollbar = !global_settings.scrollbar;
- used = true;
- break;
-
- case BUTTON_F3 | BUTTON_RIGHT:
- case BUTTON_F3 | BUTTON_RIGHT | BUTTON_REPEAT:
- global_settings.statusbar = !global_settings.statusbar;
- used = true;
- break;
-
- case BUTTON_F3 | BUTTON_DOWN:
- case BUTTON_F3 | BUTTON_DOWN | BUTTON_REPEAT:
- case BUTTON_F3 | BUTTON_UP:
- case BUTTON_F3 | BUTTON_UP | BUTTON_REPEAT:
- global_settings.flip_display = !global_settings.flip_display;
- button_set_flip(global_settings.flip_display);
- lcd_set_flip(global_settings.flip_display);
- used = true;
- break;
-
- case BUTTON_F3 | BUTTON_REL:
+ dsp_set_replaygain(true);
#endif
- case SCREENS_QUICK | BUTTON_REL:
-
- if( used )
- exit = true;
-
- used = true;
-
- break;
-
- case BUTTON_OFF | BUTTON_REL:
- lcd_setfont(FONT_UI);
- return false;
-
- default:
- if(default_event_handler(key) == SYS_USB_CONNECTED)
- return true;
- break;
+ if (global_settings.playlist_shuffle)
+ playlist_randomise(NULL, current_tick, true);
+ else
+ playlist_sort(NULL, true);
}
+ settings_save();
}
+ return(res);
+}
- settings_save();
-
- switch( button )
- {
-#if CONFIG_KEYPAD == RECORDER_PAD
- case SCREENS_QUICK:
-#endif
-#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
- case SCREENS_QUICK | BUTTON_REPEAT:
-#endif
-
- if ( oldrepeat != global_settings.repeat_mode &&
- (audio_status() & AUDIO_STATUS_PLAY) )
- audio_flush_and_reload_tracks();
+void quick_screen_f3_apply(struct gui_quickscreen *qs)
+{
+ global_settings.scrollbar=int_to_bool(option_select_get_selected(qs->left_option));
- break;
-#ifdef BUTTON_F3
- case BUTTON_F3:
+ global_settings.flip_display=int_to_bool(option_select_get_selected(qs->bottom_option));
+ button_set_flip(global_settings.flip_display);
+ lcd_set_flip(global_settings.flip_display);
- if (global_settings.statusbar)
- lcd_setmargins(0, STATUSBAR_HEIGHT);
- else
- lcd_setmargins(0, 0);
-
- break;
-#endif
- }
+ global_settings.statusbar=int_to_bool(option_select_get_selected(qs->right_option));
+ gui_syncstatusbar_draw(&statusbars, true);
+}
- lcd_setfont(FONT_UI);
+bool quick_screen_f3(void)
+{
+ bool res;
+ struct option_select left_option;
+ struct option_select bottom_option;
+ struct option_select right_option;
+ struct opt_items onoff_items[] = {
+ [0]={ STR(LANG_OFF) },
+ [1]={ STR(LANG_ON) }
+ };
+ struct opt_items yesno_items[] = {
+ [0]={ STR(LANG_SET_BOOL_NO) },
+ [1]={ STR(LANG_SET_BOOL_YES) }
+ };
- return false;
+ struct gui_quickscreen qs;
+
+ option_select_init_items(&left_option,
+ str(LANG_F3_SCROLL),
+ bool_to_int(global_settings.scrollbar),
+ onoff_items,
+ 2);
+ option_select_init_items(&bottom_option,
+ str(LANG_FLIP_DISPLAY),
+ bool_to_int(global_settings.flip_display),
+ yesno_items,
+ 2);
+ option_select_init_items(&right_option,
+ str(LANG_F3_STATUS),
+ bool_to_int(global_settings.statusbar),
+ onoff_items,
+ 2);
+ gui_quickscreen_init(&qs, &left_option, &bottom_option, &right_option,
+ str(LANG_F3_BAR), &quick_screen_f3_apply);
+ res=gui_syncquickscreen_run(&qs);
+ if(!res)
+ settings_save();
+ return(res);
}
#endif
diff --git a/apps/screens.h b/apps/screens.h
index 60a1537e99..3de66582ee 100644
--- a/apps/screens.h
+++ b/apps/screens.h
@@ -22,7 +22,9 @@
#include "config.h"
#include "timefuncs.h"
-void usb_display_info(void);
+struct screen;
+
+void usb_display_info(struct screen * display);
void usb_screen(void);
int charging_screen(void);
void charging_splash(void);
@@ -33,15 +35,9 @@ int mmc_remove_request(void);
#if CONFIG_KEYPAD == RECORDER_PAD
int pitch_screen(void);
-bool quick_screen(const int, const int);
-#define SCREENS_QUICK BUTTON_F2
-#endif
-
-#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
-bool quick_screen(const int, const int);
-#define SCREENS_QUICK BUTTON_MODE
- /* Long press already detected so not needed here */
+extern bool quick_screen_f3(void);
#endif
+extern bool quick_screen_quick(void);
#ifdef HAVE_RTC
bool set_time_screen(const char* string, struct tm *tm);
diff --git a/apps/tree.c b/apps/tree.c
index bed4fb28fc..33b482b3d7 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -712,10 +712,13 @@ static bool dirbrowse(void)
#ifdef TREE_QUICK
case TREE_QUICK:
+#ifdef TREE_RC_QUICK
+ case TREE_RC_QUICK:
+#endif
/* don't enter f2 from plugin browser */
if (*tc.dirfilter < NUM_FILTER_MODES)
{
- if (quick_screen(curr_context, TREE_QUICK))
+ if (quick_screen_quick())
reload_dir = true;
restore = true;
@@ -730,7 +733,7 @@ static bool dirbrowse(void)
/* don't enter f3 from plugin browser */
if (*tc.dirfilter < NUM_FILTER_MODES)
{
- if (quick_screen(curr_context, BUTTON_F3))
+ if (quick_screen_f3())
reload_dir = true;
restore = true;
}
diff --git a/apps/tree.h b/apps/tree.h
index 74b33fa635..d0da72643e 100644
--- a/apps/tree.h
+++ b/apps/tree.h
@@ -59,6 +59,7 @@
#define TREE_RC_WPS (BUTTON_RC_ON | BUTTON_REL)
#define TREE_RC_WPS_PRE BUTTON_RC_ON
#define TREE_RC_CONTEXT (BUTTON_RC_ON | BUTTON_REPEAT)
+#define TREE_RC_QUICK (BUTTON_RC_MODE | BUTTON_REPEAT)
#elif CONFIG_KEYPAD == RECORDER_PAD
#define TREE_NEXT BUTTON_DOWN