forked from len0rd/rockbox
Text viewer: * Only show those options which really exist. * Basic button functions now available on all targets. * Implemented option setting in a more straightforward way (like the core options menus).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9874 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
542d9b5942
commit
2343a1935d
3 changed files with 128 additions and 120 deletions
|
@ -439,6 +439,8 @@ static const struct plugin_api rockbox_api = {
|
||||||
lcd_setmargins,
|
lcd_setmargins,
|
||||||
#endif
|
#endif
|
||||||
utf8seek,
|
utf8seek,
|
||||||
|
|
||||||
|
set_int,
|
||||||
};
|
};
|
||||||
|
|
||||||
int plugin_load(const char* plugin, void* parameter)
|
int plugin_load(const char* plugin, void* parameter)
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
#include "rbunicode.h"
|
#include "rbunicode.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
#include "talk.h"
|
||||||
|
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
#include "lcd-remote.h"
|
#include "lcd-remote.h"
|
||||||
|
@ -103,7 +104,7 @@
|
||||||
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
||||||
|
|
||||||
/* increase this every time the api struct changes */
|
/* increase this every time the api struct changes */
|
||||||
#define PLUGIN_API_VERSION 20
|
#define PLUGIN_API_VERSION 21
|
||||||
|
|
||||||
/* update this to latest version if a change to the api struct breaks
|
/* update this to latest version if a change to the api struct breaks
|
||||||
backwards compatibility (and please take the opportunity to sort in any
|
backwards compatibility (and please take the opportunity to sort in any
|
||||||
|
@ -515,6 +516,10 @@ struct plugin_api {
|
||||||
void (*lcd_setmargins)(int x, int y);
|
void (*lcd_setmargins)(int x, int y);
|
||||||
#endif
|
#endif
|
||||||
int (*utf8seek)(const unsigned char* utf8, int offset);
|
int (*utf8seek)(const unsigned char* utf8, int offset);
|
||||||
|
|
||||||
|
bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit,
|
||||||
|
int* variable, void (*function)(int), int step, int min,
|
||||||
|
int max, void (*formatter)(char*, int, int, const char*) );
|
||||||
};
|
};
|
||||||
|
|
||||||
/* plugin header */
|
/* plugin header */
|
||||||
|
|
|
@ -75,20 +75,24 @@ PLUGIN_HEADER
|
||||||
|
|
||||||
/* Ondio keys */
|
/* Ondio keys */
|
||||||
#elif CONFIG_KEYPAD == ONDIO_PAD
|
#elif CONFIG_KEYPAD == ONDIO_PAD
|
||||||
|
#define VIEWER_QUIT BUTTON_OFF
|
||||||
#define VIEWER_PAGE_UP BUTTON_UP
|
#define VIEWER_PAGE_UP BUTTON_UP
|
||||||
#define VIEWER_PAGE_DOWN BUTTON_DOWN
|
#define VIEWER_PAGE_DOWN BUTTON_DOWN
|
||||||
#define VIEWER_SCREEN_LEFT BUTTON_LEFT
|
#define VIEWER_SCREEN_LEFT BUTTON_LEFT
|
||||||
#define VIEWER_SCREEN_RIGHT BUTTON_RIGHT
|
#define VIEWER_SCREEN_RIGHT BUTTON_RIGHT
|
||||||
#define VIEWER_MENU BUTTON_OFF
|
#define VIEWER_MENU (BUTTON_MENU|BUTTON_REPEAT)
|
||||||
#define VIEWER_AUTOSCROLL BUTTON_MENU
|
#define VIEWER_AUTOSCROLL_PRE BUTTON_MENU
|
||||||
|
#define VIEWER_AUTOSCROLL (BUTTON_MENU|BUTTON_REL)
|
||||||
|
|
||||||
/* Player keys */
|
/* Player keys */
|
||||||
#elif CONFIG_KEYPAD == PLAYER_PAD
|
#elif CONFIG_KEYPAD == PLAYER_PAD
|
||||||
#define VIEWER_QUIT BUTTON_STOP
|
#define VIEWER_QUIT BUTTON_STOP
|
||||||
#define VIEWER_PAGE_UP BUTTON_LEFT
|
#define VIEWER_PAGE_UP BUTTON_LEFT
|
||||||
#define VIEWER_PAGE_DOWN BUTTON_RIGHT
|
#define VIEWER_PAGE_DOWN BUTTON_RIGHT
|
||||||
|
#define VIEWER_SCREEN_LEFT (BUTTON_ON|BUTTON_LEFT)
|
||||||
|
#define VIEWER_SCREEN_RIGHT (BUTTON_ON|BUTTON_RIGHT)
|
||||||
#define VIEWER_MENU BUTTON_MENU
|
#define VIEWER_MENU BUTTON_MENU
|
||||||
#define VIEWER_AUTOSCROLL BUTTON_ON
|
#define VIEWER_AUTOSCROLL BUTTON_PLAY
|
||||||
|
|
||||||
/* iRiver H1x0 && H3x0 keys */
|
/* iRiver H1x0 && H3x0 keys */
|
||||||
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
|
||||||
|
@ -102,18 +106,20 @@ PLUGIN_HEADER
|
||||||
#define VIEWER_AUTOSCROLL BUTTON_SELECT
|
#define VIEWER_AUTOSCROLL BUTTON_SELECT
|
||||||
#define VIEWER_LINE_UP (BUTTON_ON | BUTTON_UP)
|
#define VIEWER_LINE_UP (BUTTON_ON | BUTTON_UP)
|
||||||
#define VIEWER_LINE_DOWN (BUTTON_ON | BUTTON_DOWN)
|
#define VIEWER_LINE_DOWN (BUTTON_ON | BUTTON_DOWN)
|
||||||
|
#define VIEWER_COLUMN_LEFT (BUTTON_ON | BUTTON_LEFT)
|
||||||
|
#define VIEWER_COLUMN_RIGHT (BUTTON_ON | BUTTON_RIGHT)
|
||||||
|
|
||||||
/* iPods with the 4G pad */
|
/* iPods with the 4G pad */
|
||||||
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
|
||||||
(CONFIG_KEYPAD == IPOD_3G_PAD)
|
(CONFIG_KEYPAD == IPOD_3G_PAD)
|
||||||
#define VIEWER_QUIT_PRE BUTTON_SELECT
|
#define VIEWER_QUIT_PRE BUTTON_SELECT
|
||||||
#define VIEWER_QUIT (BUTTON_SELECT | BUTTON_MENU)
|
#define VIEWER_QUIT (BUTTON_SELECT | BUTTON_MENU)
|
||||||
#define VIEWER_MENU BUTTON_MENU
|
|
||||||
#define VIEWER_AUTOSCROLL BUTTON_PLAY
|
|
||||||
#define VIEWER_PAGE_UP BUTTON_SCROLL_BACK
|
#define VIEWER_PAGE_UP BUTTON_SCROLL_BACK
|
||||||
#define VIEWER_PAGE_DOWN BUTTON_SCROLL_FWD
|
#define VIEWER_PAGE_DOWN BUTTON_SCROLL_FWD
|
||||||
#define VIEWER_SCREEN_LEFT BUTTON_LEFT
|
#define VIEWER_SCREEN_LEFT BUTTON_LEFT
|
||||||
#define VIEWER_SCREEN_RIGHT BUTTON_RIGHT
|
#define VIEWER_SCREEN_RIGHT BUTTON_RIGHT
|
||||||
|
#define VIEWER_MENU BUTTON_MENU
|
||||||
|
#define VIEWER_AUTOSCROLL BUTTON_PLAY
|
||||||
|
|
||||||
/* iFP7xx keys */
|
/* iFP7xx keys */
|
||||||
#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
|
#elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
|
||||||
|
@ -151,48 +157,36 @@ struct preferences {
|
||||||
enum {
|
enum {
|
||||||
WRAP=0,
|
WRAP=0,
|
||||||
CHOP,
|
CHOP,
|
||||||
WORD_MODES
|
|
||||||
} word_mode;
|
} word_mode;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
NORMAL=0,
|
NORMAL=0,
|
||||||
JOIN,
|
JOIN,
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
REFLOW, /* Makes no sense for the player */
|
|
||||||
#endif
|
|
||||||
EXPAND,
|
EXPAND,
|
||||||
LINE_MODES,
|
REFLOW, /* won't be set on charcell LCD, must be last */
|
||||||
#ifndef HAVE_LCD_BITMAP
|
|
||||||
REFLOW /* Sorting it behind LINE_MODES effectively disables it. */
|
|
||||||
#endif
|
|
||||||
} line_mode;
|
} line_mode;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
NARROW=0,
|
NARROW=0,
|
||||||
WIDE,
|
WIDE,
|
||||||
VIEW_MODES
|
|
||||||
} view_mode;
|
} view_mode;
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
enum {
|
enum {
|
||||||
SB_OFF=0,
|
SB_OFF=0,
|
||||||
SB_ON,
|
SB_ON,
|
||||||
SCROLLBAR_MODES
|
|
||||||
} scrollbar_mode;
|
} scrollbar_mode;
|
||||||
bool need_scrollbar;
|
bool need_scrollbar;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
NO_OVERLAP=0,
|
NO_OVERLAP=0,
|
||||||
OVERLAP,
|
OVERLAP,
|
||||||
PAGE_MODES
|
|
||||||
} page_mode;
|
} page_mode;
|
||||||
|
|
||||||
#endif /* HAVE_LCD_BITMAP */
|
#endif /* HAVE_LCD_BITMAP */
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PAGE=0,
|
PAGE=0,
|
||||||
LINE,
|
LINE,
|
||||||
SCROLL_MODES
|
|
||||||
} scroll_mode;
|
} scroll_mode;
|
||||||
|
|
||||||
int autoscroll_speed;
|
int autoscroll_speed;
|
||||||
|
@ -816,7 +810,6 @@ static void viewer_top(void)
|
||||||
fill_buffer(0, buffer, BUFFER_SIZE);
|
fill_buffer(0, buffer, BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
static void viewer_bottom(void)
|
static void viewer_bottom(void)
|
||||||
{
|
{
|
||||||
/* Read bottom of file into buffer
|
/* Read bottom of file into buffer
|
||||||
|
@ -838,6 +831,7 @@ static void viewer_bottom(void)
|
||||||
fill_buffer(last_sectors, buffer, BUFFER_SIZE);
|
fill_buffer(last_sectors, buffer, BUFFER_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
static void init_need_scrollbar(void) {
|
static void init_need_scrollbar(void) {
|
||||||
/* Call viewer_draw in quiet mode to initialize next_screen_ptr,
|
/* Call viewer_draw in quiet mode to initialize next_screen_ptr,
|
||||||
and thus ONE_SCREEN_FITS_ALL(), and thus NEED_SCROLLBAR() */
|
and thus ONE_SCREEN_FITS_ALL(), and thus NEED_SCROLLBAR() */
|
||||||
|
@ -911,6 +905,7 @@ static void viewer_reset_settings(void)
|
||||||
prefs.page_mode = NO_OVERLAP;
|
prefs.page_mode = NO_OVERLAP;
|
||||||
prefs.scrollbar_mode = SB_OFF;
|
prefs.scrollbar_mode = SB_OFF;
|
||||||
#endif
|
#endif
|
||||||
|
prefs.autoscroll_speed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void viewer_load_settings(void) /* same name as global, but not the same file.. */
|
static void viewer_load_settings(void) /* same name as global, but not the same file.. */
|
||||||
|
@ -963,7 +958,6 @@ static void viewer_exit(void *parameter)
|
||||||
rb->close(fd);
|
rb->close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
static int col_limit(int col)
|
static int col_limit(int col)
|
||||||
{
|
{
|
||||||
if (col < 0)
|
if (col < 0)
|
||||||
|
@ -974,114 +968,120 @@ static int col_limit(int col)
|
||||||
|
|
||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* settings helper functions */
|
||||||
|
|
||||||
|
static bool word_wrap_setting(void)
|
||||||
|
{
|
||||||
|
static const struct opt_items names[] = {
|
||||||
|
{"On", NULL},
|
||||||
|
{"Off (Chop Words)", NULL},
|
||||||
|
};
|
||||||
|
|
||||||
|
return rb->set_option("Word Wrap", &prefs.word_mode, INT,
|
||||||
|
names, 2, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool line_mode_setting(void)
|
||||||
|
{
|
||||||
|
static const struct opt_items names[] = {
|
||||||
|
{"Normal", NULL},
|
||||||
|
{"Join Lines", NULL},
|
||||||
|
{"Expand Lines", NULL},
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
{"Reflow Lines", NULL},
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
return rb->set_option("Line Mode", &prefs.line_mode, INT, names,
|
||||||
|
sizeof(names) / sizeof(names[0]), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool view_mode_setting(void)
|
||||||
|
{
|
||||||
|
static const struct opt_items names[] = {
|
||||||
|
{"No (Narrow)", NULL},
|
||||||
|
{"Yes", NULL},
|
||||||
|
};
|
||||||
|
|
||||||
|
return rb->set_option("Wide View", &prefs.view_mode, INT,
|
||||||
|
names , 2, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool scroll_mode_setting(void)
|
||||||
|
{
|
||||||
|
static const struct opt_items names[] = {
|
||||||
|
{"Scroll by Page", NULL},
|
||||||
|
{"Scroll by Line", NULL},
|
||||||
|
};
|
||||||
|
|
||||||
|
return rb->set_option("Scroll Mode", &prefs.scroll_mode, INT,
|
||||||
|
names, 2, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
static bool page_mode_setting(void)
|
||||||
|
{
|
||||||
|
static const struct opt_items names[] = {
|
||||||
|
{"No", NULL},
|
||||||
|
{"Yes", NULL},
|
||||||
|
};
|
||||||
|
|
||||||
|
return rb->set_option("Overlap Pages", &prefs.page_mode, INT,
|
||||||
|
names, 2, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool scrollbar_setting(void)
|
||||||
|
{
|
||||||
|
static const struct opt_items names[] = {
|
||||||
|
{"Off", NULL},
|
||||||
|
{"On", NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
return rb->set_option("Show Scrollbar", &prefs.scrollbar_mode, INT,
|
||||||
|
names, 2, NULL);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void change_options_menu(void)
|
static bool autoscroll_speed_setting(void)
|
||||||
{
|
{
|
||||||
int m, result;
|
return rb->set_int("Auto-scroll Speed", "", UNIT_INT,
|
||||||
bool done = false;
|
&prefs.autoscroll_speed, NULL, 1, 1, 10, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool viewer_options_menu(void)
|
||||||
|
{
|
||||||
|
int m;
|
||||||
|
bool result;
|
||||||
|
|
||||||
static const struct menu_item items[] = {
|
static const struct menu_item items[] = {
|
||||||
{"Word Wrap", NULL },
|
{"Word Wrap", word_wrap_setting },
|
||||||
{"Line Mode", NULL },
|
{"Line Mode", line_mode_setting },
|
||||||
{"Wide View", NULL },
|
{"Wide View", view_mode_setting },
|
||||||
{"Overlap Pages", NULL },
|
|
||||||
{"Scroll Mode", NULL},
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
{"Show Scrollbar", NULL },
|
{"Show Scrollbar", scrollbar_setting },
|
||||||
|
{"Overlap Pages", page_mode_setting },
|
||||||
#endif
|
#endif
|
||||||
{"Auto-Scroll Speed", NULL },
|
{"Scroll Mode", scroll_mode_setting},
|
||||||
};
|
{"Auto-Scroll Speed", autoscroll_speed_setting },
|
||||||
static const struct opt_items opt_word_mode[2] = {
|
|
||||||
{"On",NULL},{"Off (Chop Words)",NULL},
|
|
||||||
};
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
static const struct opt_items opt_line_mode[4] = {
|
|
||||||
{"Normal",NULL},{"Join Lines",NULL},
|
|
||||||
{"Reflow Lines",NULL},{"Expand Lines",NULL},
|
|
||||||
#else
|
|
||||||
static const struct opt_items opt_line_mode[3] = {
|
|
||||||
{"Normal",NULL},{"Join Lines",NULL},
|
|
||||||
{"Expand Lines",NULL},
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
static const struct opt_items opt_view_mode[2] = {
|
|
||||||
{"No (Narrow)",NULL},{"Yes",NULL}
|
|
||||||
};
|
|
||||||
static const struct opt_items opt_scroll_mode[2] = {
|
|
||||||
{"Scroll by Page",NULL},{"Scroll by Line",NULL}
|
|
||||||
};
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
static const struct opt_items opt_scrollbar_mode[2] = {
|
|
||||||
{"Off",NULL},{"On",NULL}
|
|
||||||
};
|
|
||||||
static const struct opt_items opt_page_mode[2] = {
|
|
||||||
{"No",NULL},{"Yes",NULL}
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
static const struct opt_items opt_autoscroll_speed[10] = {
|
|
||||||
{ "1", NULL },{ "2", NULL },{ "3", NULL },{ "4", NULL },{ "5", NULL },
|
|
||||||
{ "6", NULL },{ "7", NULL },{ "8", NULL },{ "9", NULL },{ "10", NULL }
|
|
||||||
};
|
};
|
||||||
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
m = rb->menu_init(items, sizeof(items) / sizeof(*items),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
while(!done)
|
result = rb->menu_run(m);
|
||||||
{
|
|
||||||
result=rb->menu_show(m);
|
|
||||||
switch (result)
|
|
||||||
{
|
|
||||||
case MENU_SELECTED_EXIT:
|
|
||||||
done = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0: /* word mode */
|
|
||||||
rb->set_option("Word Wrap", &prefs.word_mode, INT,
|
|
||||||
opt_word_mode , 2, NULL);
|
|
||||||
break;
|
|
||||||
case 1: /* line mode */
|
|
||||||
rb->set_option("Line Mode", &prefs.line_mode, INT, opt_line_mode,
|
|
||||||
sizeof(opt_line_mode) / sizeof(*opt_line_mode), NULL);
|
|
||||||
break;
|
|
||||||
case 2: /* view mode */
|
|
||||||
rb->set_option("Wide View", &prefs.view_mode, INT,
|
|
||||||
opt_view_mode , 2, NULL);
|
|
||||||
break;
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
case 3:
|
|
||||||
rb->set_option("Overlap Pages", &prefs.page_mode, INT,
|
|
||||||
opt_page_mode , 2, NULL);
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case 4:
|
|
||||||
rb->set_option("Scroll Mode", &prefs.scroll_mode, INT,
|
|
||||||
opt_scroll_mode , 2, NULL);
|
|
||||||
break;
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
case 5:
|
|
||||||
rb->set_option("Show Scrollbar", &prefs.scrollbar_mode, INT,
|
|
||||||
opt_scrollbar_mode , 2, NULL);
|
|
||||||
/* Show-scrollbar mode for current view-width mode */
|
|
||||||
if (!(ONE_SCREEN_FITS_ALL())) {
|
|
||||||
if (prefs.scrollbar_mode == true)
|
|
||||||
init_need_scrollbar();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case 6:
|
|
||||||
rb->set_option("Auto-Scroll Speed", &prefs.autoscroll_speed, INT,
|
|
||||||
opt_autoscroll_speed, sizeof(opt_autoscroll_speed) /
|
|
||||||
sizeof(*opt_autoscroll_speed), NULL);
|
|
||||||
break;
|
|
||||||
} /* switch() */
|
|
||||||
}
|
|
||||||
rb->menu_exit(m);
|
rb->menu_exit(m);
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
rb->lcd_setmargins(0,0);
|
rb->lcd_setmargins(0,0);
|
||||||
|
|
||||||
|
/* Show-scrollbar mode for current view-width mode */
|
||||||
|
if (!ONE_SCREEN_FITS_ALL())
|
||||||
|
if (prefs.scrollbar_mode == true)
|
||||||
|
init_need_scrollbar();
|
||||||
#endif
|
#endif
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_menu(void)
|
static void viewer_menu(void)
|
||||||
{
|
{
|
||||||
int m;
|
int m;
|
||||||
int result;
|
int result;
|
||||||
|
@ -1103,7 +1103,7 @@ static void show_menu(void)
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
case 1: /* change settings */
|
case 1: /* change settings */
|
||||||
change_options_menu();
|
done = viewer_options_menu();
|
||||||
break;
|
break;
|
||||||
case 2: /* playback control */
|
case 2: /* playback control */
|
||||||
playback_control(rb);
|
playback_control(rb);
|
||||||
|
@ -1121,6 +1121,7 @@ static void show_menu(void)
|
||||||
enum plugin_status plugin_start(struct plugin_api* api, void* file)
|
enum plugin_status plugin_start(struct plugin_api* api, void* file)
|
||||||
{
|
{
|
||||||
int button, i, ok;
|
int button, i, ok;
|
||||||
|
int lastbutton = BUTTON_NONE;
|
||||||
bool autoscroll = false;
|
bool autoscroll = false;
|
||||||
int old_tick = *rb->current_tick;
|
int old_tick = *rb->current_tick;
|
||||||
|
|
||||||
|
@ -1157,10 +1158,14 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
|
||||||
button = rb->button_get_w_tmo(HZ/10);
|
button = rb->button_get_w_tmo(HZ/10);
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case VIEWER_MENU:
|
case VIEWER_MENU:
|
||||||
show_menu();
|
viewer_menu();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIEWER_AUTOSCROLL:
|
case VIEWER_AUTOSCROLL:
|
||||||
|
#ifdef VIEWER_AUTOSCROLL_PRE
|
||||||
|
if (lastbutton != VIEWER_AUTOSCROLL_PRE)
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
autoscroll = !autoscroll;
|
autoscroll = !autoscroll;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1196,7 +1201,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
|
||||||
viewer_draw(col);
|
viewer_draw(col);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef VIEWER_SCREEN_LEFT
|
|
||||||
case VIEWER_SCREEN_LEFT:
|
case VIEWER_SCREEN_LEFT:
|
||||||
case VIEWER_SCREEN_LEFT | BUTTON_REPEAT:
|
case VIEWER_SCREEN_LEFT | BUTTON_REPEAT:
|
||||||
if (prefs.view_mode == WIDE) {
|
if (prefs.view_mode == WIDE) {
|
||||||
|
@ -1211,9 +1215,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
|
||||||
|
|
||||||
viewer_draw(col);
|
viewer_draw(col);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VIEWER_SCREEN_LEFT
|
|
||||||
case VIEWER_SCREEN_RIGHT:
|
case VIEWER_SCREEN_RIGHT:
|
||||||
case VIEWER_SCREEN_RIGHT | BUTTON_REPEAT:
|
case VIEWER_SCREEN_RIGHT | BUTTON_REPEAT:
|
||||||
if (prefs.view_mode == WIDE) {
|
if (prefs.view_mode == WIDE) {
|
||||||
|
@ -1228,7 +1230,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
|
||||||
|
|
||||||
viewer_draw(col);
|
viewer_draw(col);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef VIEWER_LINE_UP
|
#ifdef VIEWER_LINE_UP
|
||||||
case VIEWER_LINE_UP:
|
case VIEWER_LINE_UP:
|
||||||
|
@ -1266,12 +1267,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VIEWER_QUIT
|
|
||||||
case VIEWER_QUIT:
|
case VIEWER_QUIT:
|
||||||
viewer_exit(NULL);
|
viewer_exit(NULL);
|
||||||
done = true;
|
done = true;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (rb->default_event_handler_ex(button, viewer_exit, NULL)
|
if (rb->default_event_handler_ex(button, viewer_exit, NULL)
|
||||||
|
@ -1279,6 +1278,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
|
||||||
return PLUGIN_USB_CONNECTED;
|
return PLUGIN_USB_CONNECTED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (button != BUTTON_NONE)
|
||||||
|
lastbutton = button;
|
||||||
}
|
}
|
||||||
return PLUGIN_OK;
|
return PLUGIN_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue