summaryrefslogtreecommitdiff
path: root/apps/plugins/text_viewer/tv_display.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/text_viewer/tv_display.c')
-rw-r--r--apps/plugins/text_viewer/tv_display.c73
1 files changed, 0 insertions, 73 deletions
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 @@
25/* 25/*
26 * display layout 26 * display layout
27 * 27 *
28 * when is defined HAVE_LCD_BITMAP
29 * +-------------------------+ 28 * +-------------------------+
30 * |statusbar (1) | 29 * |statusbar (1) |
31 * +-------------------------+ 30 * +-------------------------+
@@ -56,14 +55,6 @@
56 * (5) displays when preferences->footer_mode is FT_PAGE. 55 * (5) displays when preferences->footer_mode is FT_PAGE.
57 * (6) displays when rb->global_settings->statusbar == STATUSBAR_BOTTOM. 56 * (6) displays when rb->global_settings->statusbar == STATUSBAR_BOTTOM.
58 * 57 *
59 *
60 * when isn't defined HAVE_LCD_BITMAP
61 * +---+---------------------+
62 * | | |
63 * |(7)| draw area |
64 * | | |
65 * +---+---------------------+
66 * (7) bookmark
67 */ 58 */
68 59
69#define TV_SCROLLBAR_WIDTH rb->global_settings->scrollbar_width 60#define TV_SCROLLBAR_WIDTH rb->global_settings->scrollbar_width
@@ -83,14 +74,10 @@ static bool is_initialized_vp = false;
83static struct screen* display; 74static struct screen* display;
84 75
85/* layout */ 76/* layout */
86#ifdef HAVE_LCD_BITMAP
87static struct tv_rect header; 77static struct tv_rect header;
88static struct tv_rect footer; 78static struct tv_rect footer;
89static struct tv_rect horizontal_scrollbar; 79static struct tv_rect horizontal_scrollbar;
90static struct tv_rect vertical_scrollbar; 80static struct tv_rect vertical_scrollbar;
91#else
92static struct tv_rect bookmark;
93#endif
94 81
95static bool show_horizontal_scrollbar; 82static bool show_horizontal_scrollbar;
96static bool show_vertical_scrollbar; 83static bool show_vertical_scrollbar;
@@ -103,8 +90,6 @@ static int row_height = 1;
103 90
104static int totalsize; 91static int totalsize;
105 92
106#ifdef HAVE_LCD_BITMAP
107
108static void tv_show_header(void) 93static void tv_show_header(void)
109{ 94{
110 if (preferences->header_mode) 95 if (preferences->header_mode)
@@ -156,8 +141,6 @@ static void tv_show_scrollbar(int window, int col, off_t cur_pos, int size)
156 } 141 }
157} 142}
158 143
159#endif
160
161void tv_init_scrollbar(off_t total, bool show_scrollbar) 144void tv_init_scrollbar(off_t total, bool show_scrollbar)
162{ 145{
163 totalsize = total; 146 totalsize = total;
@@ -167,38 +150,23 @@ void tv_init_scrollbar(off_t total, bool show_scrollbar)
167 150
168void tv_show_bookmarks(const int *rows, int count) 151void tv_show_bookmarks(const int *rows, int count)
169{ 152{
170#ifdef HAVE_LCD_BITMAP
171 display->set_viewport(&vp_text); 153 display->set_viewport(&vp_text);
172 display->set_drawmode(DRMODE_COMPLEMENT); 154 display->set_drawmode(DRMODE_COMPLEMENT);
173#endif
174 155
175 while (count--) 156 while (count--)
176 { 157 {
177#ifdef HAVE_LCD_BITMAP
178 display->fillrect(0, rows[count] * row_height, 158 display->fillrect(0, rows[count] * row_height,
179 vp_text.width, row_height); 159 vp_text.width, row_height);
180#else
181 display->putchar(bookmark.x, bookmark.y + rows[count], TV_BOOKMARK_ICON);
182#endif
183 } 160 }
184#ifdef HAVE_LCD_BITMAP
185 display->set_drawmode(DRMODE_SOLID); 161 display->set_drawmode(DRMODE_SOLID);
186 display->set_viewport(&vp_info); 162 display->set_viewport(&vp_info);
187#endif
188} 163}
189 164
190void tv_update_extra(int window, int col, const struct tv_screen_pos *pos, int size) 165void tv_update_extra(int window, int col, const struct tv_screen_pos *pos, int size)
191{ 166{
192#ifdef HAVE_LCD_BITMAP
193 tv_show_scrollbar(window, col, pos->file_pos, size); 167 tv_show_scrollbar(window, col, pos->file_pos, size);
194 tv_show_header(); 168 tv_show_header();
195 tv_show_footer(pos); 169 tv_show_footer(pos);
196#else
197 (void)window;
198 (void)col;
199 (void)pos;
200 (void)size;
201#endif
202} 170}
203 171
204void tv_draw_text(int row, const unsigned char *text, int offset) 172void 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)
217 185
218 display->set_viewport(&vp_text); 186 display->set_viewport(&vp_text);
219 tv_night_mode(); 187 tv_night_mode();
220#ifdef HAVE_LCD_BITMAP
221 display->putsxy(xpos, row * row_height, text); 188 display->putsxy(xpos, row * row_height, text);
222#else
223 display->puts(xpos, row, text);
224#endif
225 display->set_viewport(&vp_info); 189 display->set_viewport(&vp_info);
226} 190}
227 191
@@ -229,9 +193,7 @@ void tv_start_display(void)
229{ 193{
230 display->set_viewport(&vp_info); 194 display->set_viewport(&vp_info);
231 tv_night_mode(); 195 tv_night_mode();
232#ifdef HAVE_LCD_BITMAP
233 display->set_drawmode(DRMODE_SOLID); 196 display->set_drawmode(DRMODE_SOLID);
234#endif
235 197
236#if LCD_DEPTH > 1 198#if LCD_DEPTH > 1
237 rb->lcd_set_backdrop(NULL); 199 rb->lcd_set_backdrop(NULL);
@@ -248,7 +210,6 @@ void tv_end_display(void)
248 210
249void tv_set_layout(bool show_scrollbar) 211void tv_set_layout(bool show_scrollbar)
250{ 212{
251#ifdef HAVE_LCD_BITMAP
252 int scrollbar_width = (show_scrollbar && preferences->vertical_scrollbar)? 213 int scrollbar_width = (show_scrollbar && preferences->vertical_scrollbar)?
253 TV_SCROLLBAR_WIDTH + 1 : 0; 214 TV_SCROLLBAR_WIDTH + 1 : 0;
254 int scrollbar_height = (show_scrollbar && preferences->horizontal_scrollbar)? 215 int scrollbar_height = (show_scrollbar && preferences->horizontal_scrollbar)?
@@ -282,20 +243,6 @@ void tv_set_layout(bool show_scrollbar)
282 vp_text.y += vertical_scrollbar.y; 243 vp_text.y += vertical_scrollbar.y;
283 vp_text.width = horizontal_scrollbar.w; 244 vp_text.width = horizontal_scrollbar.w;
284 vp_text.height = vertical_scrollbar.h; 245 vp_text.height = vertical_scrollbar.h;
285#else
286 (void) show_scrollbar;
287
288 row_height = 1;
289
290 bookmark.x = 0;
291 bookmark.y = 0;
292 bookmark.w = 1;
293 bookmark.h = vp_info.height;
294
295 vp_text = vp_info;
296 vp_text.x += 1;
297 vp_text.width -= 1;
298#endif
299 246
300 display_columns = vp_text.width / col_width; 247 display_columns = vp_text.width / col_width;
301 display_rows = vp_text.height / row_height; 248 display_rows = vp_text.height / row_height;
@@ -310,7 +257,6 @@ void tv_get_drawarea_info(int *width, int *cols, int *rows)
310 257
311static void tv_change_viewport(void) 258static void tv_change_viewport(void)
312{ 259{
313#ifdef HAVE_LCD_BITMAP
314 bool show_statusbar = preferences->statusbar; 260 bool show_statusbar = preferences->statusbar;
315 261
316 if (is_initialized_vp) 262 if (is_initialized_vp)
@@ -321,16 +267,8 @@ static void tv_change_viewport(void)
321 rb->viewportmanager_theme_enable(SCREEN_MAIN, show_statusbar, &vp_info); 267 rb->viewportmanager_theme_enable(SCREEN_MAIN, show_statusbar, &vp_info);
322 vp_info.flags &= ~VP_FLAG_ALIGNMENT_MASK; 268 vp_info.flags &= ~VP_FLAG_ALIGNMENT_MASK;
323 display->set_viewport(&vp_info); 269 display->set_viewport(&vp_info);
324#else
325 if (!is_initialized_vp)
326 {
327 rb->viewport_set_defaults(&vp_info, SCREEN_MAIN);
328 is_initialized_vp = true;
329 }
330#endif
331} 270}
332 271
333#ifdef HAVE_LCD_BITMAP
334static bool tv_set_font(const unsigned char *font) 272static bool tv_set_font(const unsigned char *font)
335{ 273{
336 unsigned char path[MAX_PATH]; 274 unsigned char path[MAX_PATH];
@@ -350,11 +288,9 @@ static bool tv_set_font(const unsigned char *font)
350 vp_text.font = preferences->font_id; 288 vp_text.font = preferences->font_id;
351 return true; 289 return true;
352} 290}
353#endif
354 291
355static int tv_change_preferences(const struct tv_preferences *oldp) 292static int tv_change_preferences(const struct tv_preferences *oldp)
356{ 293{
357#ifdef HAVE_LCD_BITMAP
358 static bool font_changing = false; 294 static bool font_changing = false;
359 const unsigned char *font_str; 295 const unsigned char *font_str;
360 struct tv_preferences new_prefs; 296 struct tv_preferences new_prefs;
@@ -382,9 +318,6 @@ static int tv_change_preferences(const struct tv_preferences *oldp)
382 col_width = 2 * rb->font_get_width(rb->font_get(preferences->font_id), ' '); 318 col_width = 2 * rb->font_get_width(rb->font_get(preferences->font_id), ' ');
383 font_changing = false; 319 font_changing = false;
384 } 320 }
385#else
386 (void)oldp;
387#endif
388 tv_change_viewport(); 321 tv_change_viewport();
389 return TV_CALLBACK_OK; 322 return TV_CALLBACK_OK;
390} 323}
@@ -419,7 +352,6 @@ void tv_night_mode(void)
419 352
420void tv_finalize_display(void) 353void tv_finalize_display(void)
421{ 354{
422#ifdef HAVE_LCD_BITMAP
423 /* restore font */ 355 /* restore font */
424 if (preferences->font_id >= 0 && 356 if (preferences->font_id >= 0 &&
425 (preferences->font_id != rb->global_status->font_id[SCREEN_MAIN])) 357 (preferences->font_id != rb->global_status->font_id[SCREEN_MAIN]))
@@ -430,14 +362,9 @@ void tv_finalize_display(void)
430 /* undo viewport */ 362 /* undo viewport */
431 if (is_initialized_vp) 363 if (is_initialized_vp)
432 rb->viewportmanager_theme_undo(SCREEN_MAIN, false); 364 rb->viewportmanager_theme_undo(SCREEN_MAIN, false);
433#endif
434} 365}
435 366
436bool tv_exist_scrollbar(void) 367bool tv_exist_scrollbar(void)
437{ 368{
438#ifdef HAVE_LCD_BITMAP
439 return true; 369 return true;
440#else
441 return false;
442#endif
443} 370}