mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-20 18:42:41 -05:00
text viewer: can select "move to prev/next page" or "move to top page/bottom page" when LEFT/RIGHT key is pressed (narrow mode).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26719 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c92b2cc16a
commit
8bdb1c04d3
6 changed files with 54 additions and 19 deletions
|
|
@ -52,5 +52,3 @@ TODO list
|
|||
|
||||
- more treatments of line breaking, word wrappings.
|
||||
(for example, period does not appear the top of line.)
|
||||
|
||||
- whether scroll to prev/next page or scroll to top page/bottom page can be select the settings menu.
|
||||
|
|
|
|||
|
|
@ -114,12 +114,16 @@ enum plugin_status plugin_start(const void* file)
|
|||
tv_scroll_left(TV_HORIZONTAL_SCROLL_PREFS);
|
||||
}
|
||||
else { /* prefs->windows == 1 */
|
||||
if (prefs->narrow_mode == NM_PAGE)
|
||||
{
|
||||
/* scroll to previous page */
|
||||
tv_scroll_up(TV_VERTICAL_SCROLL_PAGE);
|
||||
#if 0
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Top of file */
|
||||
tv_top();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -131,12 +135,16 @@ enum plugin_status plugin_start(const void* file)
|
|||
tv_scroll_right(TV_HORIZONTAL_SCROLL_PREFS);
|
||||
}
|
||||
else { /* prefs->windows == 1 */
|
||||
if (prefs->narrow_mode == NM_PAGE)
|
||||
{
|
||||
/* scroll to next page */
|
||||
tv_scroll_down(TV_VERTICAL_SCROLL_PAGE);
|
||||
#if 0
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Bottom of file */
|
||||
tv_bottom();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -117,6 +117,17 @@ static bool tv_autoscroll_speed_setting(void)
|
|||
&new_prefs.autoscroll_speed, NULL, 1, 1, 10, NULL);
|
||||
}
|
||||
|
||||
static bool tv_narrow_mode_setting(void)
|
||||
{
|
||||
static const struct opt_items names[] = {
|
||||
{"Previous/Next Page", -1},
|
||||
{"Top/Bottom Page", -1},
|
||||
};
|
||||
|
||||
return rb->set_option("Left/Right Key", &new_prefs.narrow_mode, INT,
|
||||
names, 2, NULL);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
MENUITEM_FUNCTION(vertical_scrollbar_item, 0, "Scrollbar",
|
||||
tv_vertical_scrollbar_setting,
|
||||
|
|
@ -128,12 +139,15 @@ MENUITEM_FUNCTION(page_mode_item, 0, "Overlap Pages", tv_page_mode_setting,
|
|||
NULL, NULL, Icon_NOICON);
|
||||
MENUITEM_FUNCTION(autoscroll_speed_item, 0, "Auto-Scroll Speed",
|
||||
tv_autoscroll_speed_setting, NULL, NULL, Icon_NOICON);
|
||||
MENUITEM_FUNCTION(narrow_mode_item, 0, "Left/Right Key (Narrow mode)",
|
||||
tv_narrow_mode_setting, NULL, NULL, Icon_NOICON);
|
||||
|
||||
MAKE_MENU(vertical_scroll_menu, "Vertical", NULL, Icon_NOICON,
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
&vertical_scrollbar_item,
|
||||
#endif
|
||||
&vertical_scroll_mode_item, &page_mode_item, &autoscroll_speed_item);
|
||||
&vertical_scroll_mode_item, &page_mode_item, &autoscroll_speed_item,
|
||||
&narrow_mode_item);
|
||||
|
||||
/* */
|
||||
/* scroll settings menu */
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ static void tv_notify_change_preferences(const struct tv_preferences *oldp,
|
|||
* - page_mode
|
||||
* - font
|
||||
* - autoscroll_speed
|
||||
* - narrow_mode
|
||||
*/
|
||||
if ((oldp == NULL) ||
|
||||
(oldp->word_mode != newp->word_mode) ||
|
||||
|
|
@ -111,6 +112,7 @@ void tv_set_default_preferences(struct tv_preferences *p)
|
|||
p->footer_mode = FT_NONE;
|
||||
#endif
|
||||
p->autoscroll_speed = 1;
|
||||
p->narrow_mode = NM_PAGE;
|
||||
/* Set codepage to system default */
|
||||
p->encoding = rb->global_settings->default_codepage;
|
||||
p->file_name[0] = '\0';
|
||||
|
|
|
|||
|
|
@ -84,6 +84,11 @@ struct tv_preferences {
|
|||
|
||||
int windows;
|
||||
|
||||
enum {
|
||||
NM_PAGE = 0,
|
||||
NM_TOP_BOTTOM,
|
||||
} narrow_mode;
|
||||
|
||||
unsigned char font_name[MAX_PATH];
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
struct font *font;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@
|
|||
* autoscroll_speed 1
|
||||
* horizontal_scrollbar 1
|
||||
* horizontal_scroll_mode 1
|
||||
* (reserved) 14
|
||||
* narrow_mode 1
|
||||
* (reserved) 13
|
||||
* font name MAX_PATH
|
||||
*/
|
||||
|
||||
|
|
@ -56,7 +57,7 @@
|
|||
#define TV_GLOBAL_SETTINGS_FILE VIEWERS_DIR "/tv_global.dat"
|
||||
|
||||
#define TV_GLOBAL_SETTINGS_HEADER "\x54\x56\x47\x53" /* "TVGS" */
|
||||
#define TV_GLOBAL_SETTINGS_VERSION 0x35
|
||||
#define TV_GLOBAL_SETTINGS_VERSION 0x36
|
||||
#define TV_GLOBAL_SETTINGS_HEADER_SIZE 5
|
||||
#define TV_GLOBAL_SETTINGS_FIRST_VERSION 0x31
|
||||
|
||||
|
|
@ -88,7 +89,8 @@
|
|||
* autoscroll_speed 1
|
||||
* horizontal_scrollbar 1
|
||||
* horizontal_scroll_mode 1
|
||||
* (reserved) 14
|
||||
* narrow_mode 1
|
||||
* (reserved) 13
|
||||
* font name MAX_PATH
|
||||
* bookmark count 1
|
||||
* [1st bookmark]
|
||||
|
|
@ -110,7 +112,7 @@
|
|||
#define TV_SETTINGS_TMP_FILE VIEWERS_DIR "/tv_file.tmp"
|
||||
|
||||
#define TV_SETTINGS_HEADER "\x54\x56\x53" /* "TVS" */
|
||||
#define TV_SETTINGS_VERSION 0x36
|
||||
#define TV_SETTINGS_VERSION 0x37
|
||||
#define TV_SETTINGS_HEADER_SIZE 4
|
||||
#define TV_SETTINGS_FIRST_VERSION 0x32
|
||||
|
||||
|
|
@ -167,6 +169,11 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre
|
|||
else
|
||||
prefs->horizontal_scroll_mode = SCREEN;
|
||||
|
||||
if (version > 4)
|
||||
prefs->narrow_mode = *p++;
|
||||
else
|
||||
prefs->narrow_mode = NM_PAGE;
|
||||
|
||||
rb->memcpy(prefs->font_name, buf + read_size - MAX_PATH, MAX_PATH);
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
|
|
@ -196,6 +203,7 @@ static bool tv_write_preferences(int pfd, const struct tv_preferences *prefs)
|
|||
*p++ = prefs->autoscroll_speed;
|
||||
*p++ = prefs->horizontal_scrollbar;
|
||||
*p++ = prefs->horizontal_scroll_mode;
|
||||
*p++ = prefs->narrow_mode;
|
||||
|
||||
rb->memcpy(buf + 28, prefs->font_name, MAX_PATH);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue