summaryrefslogtreecommitdiffstats
path: root/apps/plugins/text_viewer
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-07-17 10:31:31 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-07-24 21:20:13 +0000
commit658026e6267277b27d297c481728f74d160a8481 (patch)
tree915a9d2bb48469bdd5b9127dc19a61f230721a6c /apps/plugins/text_viewer
parent8cb555460ff79e636a7907fb2589e16db98c8600 (diff)
downloadrockbox-658026e6267277b27d297c481728f74d160a8481.tar.gz
rockbox-658026e6267277b27d297c481728f74d160a8481.zip
[4/4] Remove HAVE_LCD_BITMAP, as it's now the only choice.
Note: I left behind lcd_bitmap in features.txt, because removing it would require considerable work in the manual and the translations. Change-Id: Ia8ca7761f610d9332a0d22a7d189775fb15ec88a
Diffstat (limited to 'apps/plugins/text_viewer')
-rw-r--r--apps/plugins/text_viewer/text_viewer.c2
-rw-r--r--apps/plugins/text_viewer/tv_action.c4
-rw-r--r--apps/plugins/text_viewer/tv_bookmark.c4
-rw-r--r--apps/plugins/text_viewer/tv_display.c73
-rw-r--r--apps/plugins/text_viewer/tv_menu.c18
-rw-r--r--apps/plugins/text_viewer/tv_preferences.c10
-rw-r--r--apps/plugins/text_viewer/tv_preferences.h3
-rw-r--r--apps/plugins/text_viewer/tv_settings.c4
-rw-r--r--apps/plugins/text_viewer/tv_text_processor.c11
9 files changed, 2 insertions, 127 deletions
diff --git a/apps/plugins/text_viewer/text_viewer.c b/apps/plugins/text_viewer/text_viewer.c
index c8102eb6d2..fea0977c0d 100644
--- a/apps/plugins/text_viewer/text_viewer.c
+++ b/apps/plugins/text_viewer/text_viewer.c
@@ -61,10 +61,8 @@ enum plugin_status plugin_start(const void* file)
atexit(tv_exit);
while (!done) {
-#ifdef HAVE_LCD_BITMAP
if (preferences->statusbar)
rb->send_event(GUI_EVENT_ACTIONUPDATE, NULL);
-#endif
if (display_update)
tv_draw();
diff --git a/apps/plugins/text_viewer/tv_action.c b/apps/plugins/text_viewer/tv_action.c
index 798871c430..041dee5a50 100644
--- a/apps/plugins/text_viewer/tv_action.c
+++ b/apps/plugins/text_viewer/tv_action.c
@@ -100,9 +100,7 @@ void tv_scroll_up(unsigned mode)
(mode == TV_VERTICAL_SCROLL_PREFS && preferences->vertical_scroll_mode == VS_PAGE))
{
offset_page--;
-#ifdef HAVE_LCD_BITMAP
offset_line = (preferences->overlap_page_mode)? 1:0;
-#endif
}
tv_move_screen(offset_page, offset_line, SEEK_CUR);
scrolled = true;
@@ -117,9 +115,7 @@ void tv_scroll_down(unsigned mode)
(mode == TV_VERTICAL_SCROLL_PREFS && preferences->vertical_scroll_mode == VS_PAGE))
{
offset_page++;
-#ifdef HAVE_LCD_BITMAP
offset_line = (preferences->overlap_page_mode)? -1:0;
-#endif
}
tv_move_screen(offset_page, offset_line, SEEK_CUR);
scrolled = true;
diff --git a/apps/plugins/text_viewer/tv_bookmark.c b/apps/plugins/text_viewer/tv_bookmark.c
index 0f5d58b24e..1edad093a9 100644
--- a/apps/plugins/text_viewer/tv_bookmark.c
+++ b/apps/plugins/text_viewer/tv_bookmark.c
@@ -182,11 +182,7 @@ static const char* get_bookmark_name(int selected, void * data,
(void)data;
struct tv_bookmark_info *bookmark = &bookmarks[selected];
rb->snprintf(buffer, buffer_len,
-#ifdef HAVE_LCD_BITMAP
"%cPage: %d Line: %d",
-#else
- "%cP:%d L:%d",
-#endif
(bookmark->flag & TV_BOOKMARK_SYSTEM)? '*' : ' ',
bookmark->pos.page + 1, bookmark->pos.line + 1);
return buffer;
diff --git a/apps/plugins/text_viewer/tv_display.c b/apps/plugins/text_viewer/tv_display.c
index d6175b79cf..9ecfd8d709 100644
--- a/apps/plugins/text_viewer/tv_display.c
+++ b/apps/plugins/text_viewer/tv_display.c
@@ -25,7 +25,6 @@
/*
* display layout
*
- * when is defined HAVE_LCD_BITMAP
* +-------------------------+
* |statusbar (1) |
* +-------------------------+
@@ -56,14 +55,6 @@
* (5) displays when preferences->footer_mode is FT_PAGE.
* (6) displays when rb->global_settings->statusbar == STATUSBAR_BOTTOM.
*
- *
- * when isn't defined HAVE_LCD_BITMAP
- * +---+---------------------+
- * | | |
- * |(7)| draw area |
- * | | |
- * +---+---------------------+
- * (7) bookmark
*/
#define TV_SCROLLBAR_WIDTH rb->global_settings->scrollbar_width
@@ -83,14 +74,10 @@ static bool is_initialized_vp = false;
static struct screen* display;
/* layout */
-#ifdef HAVE_LCD_BITMAP
static struct tv_rect header;
static struct tv_rect footer;
static struct tv_rect horizontal_scrollbar;
static struct tv_rect vertical_scrollbar;
-#else
-static struct tv_rect bookmark;
-#endif
static bool show_horizontal_scrollbar;
static bool show_vertical_scrollbar;
@@ -103,8 +90,6 @@ static int row_height = 1;
static int totalsize;
-#ifdef HAVE_LCD_BITMAP
-
static void tv_show_header(void)
{
if (preferences->header_mode)
@@ -156,8 +141,6 @@ static void tv_show_scrollbar(int window, int col, off_t cur_pos, int size)
}
}
-#endif
-
void tv_init_scrollbar(off_t total, bool show_scrollbar)
{
totalsize = total;
@@ -167,38 +150,23 @@ void tv_init_scrollbar(off_t total, bool show_scrollbar)
void tv_show_bookmarks(const int *rows, int count)
{
-#ifdef HAVE_LCD_BITMAP
display->set_viewport(&vp_text);
display->set_drawmode(DRMODE_COMPLEMENT);
-#endif
while (count--)
{
-#ifdef HAVE_LCD_BITMAP
display->fillrect(0, rows[count] * row_height,
vp_text.width, row_height);
-#else
- display->putchar(bookmark.x, bookmark.y + rows[count], TV_BOOKMARK_ICON);
-#endif
}
-#ifdef HAVE_LCD_BITMAP
display->set_drawmode(DRMODE_SOLID);
display->set_viewport(&vp_info);
-#endif
}
void tv_update_extra(int window, int col, const struct tv_screen_pos *pos, int size)
{
-#ifdef HAVE_LCD_BITMAP
tv_show_scrollbar(window, col, pos->file_pos, size);
tv_show_header();
tv_show_footer(pos);
-#else
- (void)window;
- (void)col;
- (void)pos;
- (void)size;
-#endif
}
void tv_draw_text(int row, const unsigned char *text, int offset)
@@ -217,11 +185,7 @@ void tv_draw_text(int row, const unsigned char *text, int offset)
display->set_viewport(&vp_text);
tv_night_mode();
-#ifdef HAVE_LCD_BITMAP
display->putsxy(xpos, row * row_height, text);
-#else
- display->puts(xpos, row, text);
-#endif
display->set_viewport(&vp_info);
}
@@ -229,9 +193,7 @@ void tv_start_display(void)
{
display->set_viewport(&vp_info);
tv_night_mode();
-#ifdef HAVE_LCD_BITMAP
display->set_drawmode(DRMODE_SOLID);
-#endif
#if LCD_DEPTH > 1
rb->lcd_set_backdrop(NULL);
@@ -248,7 +210,6 @@ void tv_end_display(void)
void tv_set_layout(bool show_scrollbar)
{
-#ifdef HAVE_LCD_BITMAP
int scrollbar_width = (show_scrollbar && preferences->vertical_scrollbar)?
TV_SCROLLBAR_WIDTH + 1 : 0;
int scrollbar_height = (show_scrollbar && preferences->horizontal_scrollbar)?
@@ -282,20 +243,6 @@ void tv_set_layout(bool show_scrollbar)
vp_text.y += vertical_scrollbar.y;
vp_text.width = horizontal_scrollbar.w;
vp_text.height = vertical_scrollbar.h;
-#else
- (void) show_scrollbar;
-
- row_height = 1;
-
- bookmark.x = 0;
- bookmark.y = 0;
- bookmark.w = 1;
- bookmark.h = vp_info.height;
-
- vp_text = vp_info;
- vp_text.x += 1;
- vp_text.width -= 1;
-#endif
display_columns = vp_text.width / col_width;
display_rows = vp_text.height / row_height;
@@ -310,7 +257,6 @@ void tv_get_drawarea_info(int *width, int *cols, int *rows)
static void tv_change_viewport(void)
{
-#ifdef HAVE_LCD_BITMAP
bool show_statusbar = preferences->statusbar;
if (is_initialized_vp)
@@ -321,16 +267,8 @@ static void tv_change_viewport(void)
rb->viewportmanager_theme_enable(SCREEN_MAIN, show_statusbar, &vp_info);
vp_info.flags &= ~VP_FLAG_ALIGNMENT_MASK;
display->set_viewport(&vp_info);
-#else
- if (!is_initialized_vp)
- {
- rb->viewport_set_defaults(&vp_info, SCREEN_MAIN);
- is_initialized_vp = true;
- }
-#endif
}
-#ifdef HAVE_LCD_BITMAP
static bool tv_set_font(const unsigned char *font)
{
unsigned char path[MAX_PATH];
@@ -350,11 +288,9 @@ static bool tv_set_font(const unsigned char *font)
vp_text.font = preferences->font_id;
return true;
}
-#endif
static int tv_change_preferences(const struct tv_preferences *oldp)
{
-#ifdef HAVE_LCD_BITMAP
static bool font_changing = false;
const unsigned char *font_str;
struct tv_preferences new_prefs;
@@ -382,9 +318,6 @@ static int tv_change_preferences(const struct tv_preferences *oldp)
col_width = 2 * rb->font_get_width(rb->font_get(preferences->font_id), ' ');
font_changing = false;
}
-#else
- (void)oldp;
-#endif
tv_change_viewport();
return TV_CALLBACK_OK;
}
@@ -419,7 +352,6 @@ void tv_night_mode(void)
void tv_finalize_display(void)
{
-#ifdef HAVE_LCD_BITMAP
/* restore font */
if (preferences->font_id >= 0 &&
(preferences->font_id != rb->global_status->font_id[SCREEN_MAIN]))
@@ -430,14 +362,9 @@ void tv_finalize_display(void)
/* undo viewport */
if (is_initialized_vp)
rb->viewportmanager_theme_undo(SCREEN_MAIN, false);
-#endif
}
bool tv_exist_scrollbar(void)
{
-#ifdef HAVE_LCD_BITMAP
return true;
-#else
- return false;
-#endif
}
diff --git a/apps/plugins/text_viewer/tv_menu.c b/apps/plugins/text_viewer/tv_menu.c
index 01fb052151..53e0adaf67 100644
--- a/apps/plugins/text_viewer/tv_menu.c
+++ b/apps/plugins/text_viewer/tv_menu.c
@@ -34,12 +34,10 @@ static struct tv_preferences new_prefs;
/* horizontal scroll settings menu */
/* */
-#ifdef HAVE_LCD_BITMAP
static bool tv_horizontal_scrollbar_setting(void)
{
return rb->set_bool("Horizontal Scrollbar", &new_prefs.horizontal_scrollbar);
}
-#endif
static bool tv_horizontal_scroll_mode_setting(void)
{
@@ -52,30 +50,24 @@ static bool tv_horizontal_scroll_mode_setting(void)
names, 2, NULL);
}
-#ifdef HAVE_LCD_BITMAP
MENUITEM_FUNCTION(horizontal_scrollbar_item, 0, "Scrollbar",
tv_horizontal_scrollbar_setting,
NULL, NULL, Icon_NOICON);
-#endif
MENUITEM_FUNCTION(horizontal_scroll_mode_item, 0, "Scroll Mode",
tv_horizontal_scroll_mode_setting, NULL, NULL, Icon_NOICON);
MAKE_MENU(horizontal_scroll_menu, "Horizontal", NULL, Icon_NOICON,
-#ifdef HAVE_LCD_BITMAP
&horizontal_scrollbar_item,
-#endif
&horizontal_scroll_mode_item);
/* */
/* vertical scroll settings menu */
/* */
-#ifdef HAVE_LCD_BITMAP
static bool tv_vertical_scrollbar_setting(void)
{
return rb->set_bool("Vertical Scrollbar", &new_prefs.vertical_scrollbar);
}
-#endif
static bool tv_vertical_scroll_mode_setting(void)
{
@@ -110,11 +102,9 @@ static bool tv_narrow_mode_setting(void)
names, 2, NULL);
}
-#ifdef HAVE_LCD_BITMAP
MENUITEM_FUNCTION(vertical_scrollbar_item, 0, "Scrollbar",
tv_vertical_scrollbar_setting,
NULL, NULL, Icon_NOICON);
-#endif
MENUITEM_FUNCTION(vertical_scroll_mode_item, 0, "Scroll Mode",
tv_vertical_scroll_mode_setting, NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(overlap_page_mode_item, 0, "Overlap Pages", tv_overlap_page_mode_setting,
@@ -125,9 +115,7 @@ 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, &overlap_page_mode_item, &autoscroll_speed_item,
&narrow_mode_item);
@@ -198,7 +186,6 @@ static bool tv_alignment_setting(void)
names , 2, NULL);
}
-#ifdef HAVE_LCD_BITMAP
static bool tv_header_setting(void)
{
return rb->set_bool("Show Header", &new_prefs.header_mode);
@@ -239,7 +226,6 @@ static bool tv_font_setting(void)
return false;
}
-#endif
static bool tv_indent_spaces_setting(void)
{
@@ -264,7 +250,6 @@ MENUITEM_FUNCTION(windows_item, 0, "Screens Per Page", tv_windows_setting,
NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(alignment_item, 0, "Alignment", tv_alignment_setting,
NULL, NULL, Icon_NOICON);
-#ifdef HAVE_LCD_BITMAP
MENUITEM_FUNCTION(header_item, 0, "Show Header", tv_header_setting,
NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(footer_item, 0, "Show Footer", tv_footer_setting,
@@ -273,7 +258,6 @@ MENUITEM_FUNCTION(statusbar_item, 0, "Show Statusbar", tv_statusbar_setting,
NULL, NULL, Icon_NOICON);
MENUITEM_FUNCTION(font_item, 0, "Font", tv_font_setting,
NULL, NULL, Icon_NOICON);
-#endif
MENUITEM_FUNCTION(indent_spaces_item, 0, "Indent Spaces", tv_indent_spaces_setting,
NULL, NULL, Icon_NOICON);
#ifdef HAVE_LCD_COLOR
@@ -284,9 +268,7 @@ MENUITEM_FUNCTION(night_mode_item, 0, "Night Mode", tv_night_mode_setting,
MAKE_MENU(option_menu, "Viewer Options", NULL, Icon_NOICON,
&encoding_item, &word_wrap_item, &line_mode_item, &windows_item,
&alignment_item,
-#ifdef HAVE_LCD_BITMAP
&header_item, &footer_item, &font_item, &statusbar_item,
-#endif
&scroll_menu, &indent_spaces_item
#ifdef HAVE_LCD_COLOR
, &night_mode_item
diff --git a/apps/plugins/text_viewer/tv_preferences.c b/apps/plugins/text_viewer/tv_preferences.c
index 54c21ba04d..fdfe068068 100644
--- a/apps/plugins/text_viewer/tv_preferences.c
+++ b/apps/plugins/text_viewer/tv_preferences.c
@@ -59,12 +59,10 @@ static bool tv_notify_change_preferences(const struct tv_preferences *oldp)
(oldp->vertical_scrollbar != preferences->vertical_scrollbar) ||
(oldp->encoding != preferences->encoding) ||
(oldp->indent_spaces != preferences->indent_spaces) ||
-#ifdef HAVE_LCD_BITMAP
(oldp->header_mode != preferences->header_mode) ||
(oldp->footer_mode != preferences->footer_mode) ||
(oldp->statusbar != preferences->statusbar) ||
(rb->strcmp(oldp->font_name, preferences->font_name)) ||
-#endif
(rb->strcmp(oldp->file_name, preferences->file_name)))
{
/* callback functions are called as FILO */
@@ -110,17 +108,11 @@ void tv_set_default_preferences(struct tv_preferences *p)
p->overlap_page_mode = false;
p->horizontal_scrollbar = false;
p->vertical_scrollbar = false;
-#ifdef HAVE_LCD_BITMAP
p->header_mode = true;
p->footer_mode = true;
p->statusbar = true;
rb->strlcpy(p->font_name, rb->global_settings->font_file, MAX_PATH);
p->font_id = rb->global_status->font_id[SCREEN_MAIN];
-#else
- p->header_mode = false;
- p->footer_mode = false;
- p->statusbar = false;
-#endif
p->autoscroll_speed = 10;
p->night_mode = false;
p->narrow_mode = NM_PAGE;
@@ -139,7 +131,5 @@ void tv_add_preferences_change_listner(int (*listner)(const struct tv_preference
void tv_change_fontid(int id)
{
(void)id;
-#ifdef HAVE_LCD_BITMAP
prefs.font_id = id;
-#endif
}
diff --git a/apps/plugins/text_viewer/tv_preferences.h b/apps/plugins/text_viewer/tv_preferences.h
index 65d9521e15..4f36dc1fb6 100644
--- a/apps/plugins/text_viewer/tv_preferences.h
+++ b/apps/plugins/text_viewer/tv_preferences.h
@@ -95,10 +95,9 @@ struct tv_preferences {
bool night_mode;
-#ifdef HAVE_LCD_BITMAP
unsigned char font_name[MAX_PATH];
int font_id;
-#endif
+
unsigned char file_name[MAX_PATH];
};
diff --git a/apps/plugins/text_viewer/tv_settings.c b/apps/plugins/text_viewer/tv_settings.c
index dfd47ec7a3..6f4e5f2ff8 100644
--- a/apps/plugins/text_viewer/tv_settings.c
+++ b/apps/plugins/text_viewer/tv_settings.c
@@ -219,11 +219,9 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre
if (version > 6)
prefs->night_mode = (*p++ != 0);
-#ifdef HAVE_LCD_BITMAP
rb->strlcpy(prefs->font_name, buf + read_size - MAX_PATH, MAX_PATH);
prefs->font_id = rb->global_status->font_id[SCREEN_MAIN];
-#endif
return true;
}
@@ -253,9 +251,7 @@ static void tv_serialize_preferences(unsigned char *buf, const struct tv_prefere
*p++ = prefs->statusbar;
*p++ = prefs->night_mode;
-#ifdef HAVE_LCD_BITMAP
rb->strlcpy(buf + 28, prefs->font_name, MAX_PATH);
-#endif
}
static bool tv_write_preferences(int pfd, const struct tv_preferences *prefs)
diff --git a/apps/plugins/text_viewer/tv_text_processor.c b/apps/plugins/text_viewer/tv_text_processor.c
index fa644d7725..db96d61409 100644
--- a/apps/plugins/text_viewer/tv_text_processor.c
+++ b/apps/plugins/text_viewer/tv_text_processor.c
@@ -33,11 +33,7 @@ enum{
};
/* the max characters of each blocks */
-#ifdef HAVE_LCD_BITMAP
#define TV_MAX_CHARS_PER_BLOCK (LCD_WIDTH / 2 + 1)
-#else
-#define TV_MAX_CHARS_PER_BLOCK (LCD_WIDTH + 1)
-#endif
#define TV_MAX_BLOCKS 5
@@ -90,15 +86,11 @@ static int tv_glyph_width(int ch)
if (ch == 0)
ch = ' ';
-#ifdef HAVE_LCD_BITMAP
/* the width of the diacritics charcter is 0 */
if (rb->is_diacritic(ch, NULL))
return 0;
return rb->font_get_width(rb->font_get(preferences->font_id), ch);
-#else
- return 1;
-#endif
}
static unsigned char *tv_get_ucs(const unsigned char *str, unsigned short *ch)
@@ -138,7 +130,6 @@ static unsigned char *tv_get_ucs(const unsigned char *str, unsigned short *ch)
if (preferences->encoding == UTF_8)
return (unsigned char*)rb->utf8decode(str, ch);
-#ifdef HAVE_LCD_BITMAP
if ((*str >= 0x80) &&
((preferences->encoding > SJIS) ||
(preferences->encoding == SJIS && (*str <= 0xa0 || *str >= 0xe0))))
@@ -151,7 +142,7 @@ static unsigned char *tv_get_ucs(const unsigned char *str, unsigned short *ch)
}
count = 2;
}
-#endif
+
rb->iso_decode(str, utf8_tmp, preferences->encoding, count);
rb->utf8decode(utf8_tmp, ch);
return (unsigned char *)str + count;