summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/text_viewer/tv_action.c16
-rw-r--r--apps/plugins/text_viewer/tv_bookmark.c2
-rw-r--r--apps/plugins/text_viewer/tv_preferences.c12
-rw-r--r--apps/plugins/text_viewer/tv_preferences.h28
-rw-r--r--apps/plugins/text_viewer/tv_settings.c4
-rw-r--r--apps/plugins/text_viewer/tv_text_processor.c24
-rw-r--r--apps/plugins/text_viewer/tv_window.c4
7 files changed, 45 insertions, 45 deletions
diff --git a/apps/plugins/text_viewer/tv_action.c b/apps/plugins/text_viewer/tv_action.c
index 88338feb1e..2549709a5f 100644
--- a/apps/plugins/text_viewer/tv_action.c
+++ b/apps/plugins/text_viewer/tv_action.c
@@ -79,11 +79,11 @@ void tv_scroll_up(unsigned mode)
79 int offset_line = -1; 79 int offset_line = -1;
80 80
81 if ((mode == TV_VERTICAL_SCROLL_PAGE) || 81 if ((mode == TV_VERTICAL_SCROLL_PAGE) ||
82 (mode == TV_VERTICAL_SCROLL_PREFS && preferences->vertical_scroll_mode == PAGE)) 82 (mode == TV_VERTICAL_SCROLL_PREFS && preferences->vertical_scroll_mode == VS_PAGE))
83 { 83 {
84 offset_page--; 84 offset_page--;
85#ifdef HAVE_LCD_BITMAP 85#ifdef HAVE_LCD_BITMAP
86 offset_line = (preferences->page_mode == OVERLAP)? 1:0; 86 offset_line = (preferences->page_mode == PM_OVERLAP)? 1:0;
87#endif 87#endif
88 } 88 }
89 tv_move_screen(offset_page, offset_line, SEEK_CUR); 89 tv_move_screen(offset_page, offset_line, SEEK_CUR);
@@ -95,11 +95,11 @@ void tv_scroll_down(unsigned mode)
95 int offset_line = 1; 95 int offset_line = 1;
96 96
97 if ((mode == TV_VERTICAL_SCROLL_PAGE) || 97 if ((mode == TV_VERTICAL_SCROLL_PAGE) ||
98 (mode == TV_VERTICAL_SCROLL_PREFS && preferences->vertical_scroll_mode == PAGE)) 98 (mode == TV_VERTICAL_SCROLL_PREFS && preferences->vertical_scroll_mode == VS_PAGE))
99 { 99 {
100 offset_page++; 100 offset_page++;
101#ifdef HAVE_LCD_BITMAP 101#ifdef HAVE_LCD_BITMAP
102 offset_line = (preferences->page_mode == OVERLAP)? -1:0; 102 offset_line = (preferences->page_mode == PM_OVERLAP)? -1:0;
103#endif 103#endif
104 } 104 }
105 tv_move_screen(offset_page, offset_line, SEEK_CUR); 105 tv_move_screen(offset_page, offset_line, SEEK_CUR);
@@ -111,7 +111,7 @@ void tv_scroll_left(unsigned mode)
111 int offset_column = 0; 111 int offset_column = 0;
112 112
113 if ((mode == TV_HORIZONTAL_SCROLL_COLUMN) || 113 if ((mode == TV_HORIZONTAL_SCROLL_COLUMN) ||
114 (mode == TV_HORIZONTAL_SCROLL_PREFS && preferences->horizontal_scroll_mode == COLUMN)) 114 (mode == TV_HORIZONTAL_SCROLL_PREFS && preferences->horizontal_scroll_mode == HS_COLUMN))
115 { 115 {
116 /* Scroll left one column */ 116 /* Scroll left one column */
117 offset_column--; 117 offset_column--;
@@ -130,7 +130,7 @@ void tv_scroll_right(unsigned mode)
130 int offset_column = 0; 130 int offset_column = 0;
131 131
132 if ((mode == TV_HORIZONTAL_SCROLL_COLUMN) || 132 if ((mode == TV_HORIZONTAL_SCROLL_COLUMN) ||
133 (mode == TV_HORIZONTAL_SCROLL_PREFS && preferences->horizontal_scroll_mode == COLUMN)) 133 (mode == TV_HORIZONTAL_SCROLL_PREFS && preferences->horizontal_scroll_mode == HS_COLUMN))
134 { 134 {
135 /* Scroll right one column */ 135 /* Scroll right one column */
136 offset_column++; 136 offset_column++;
@@ -151,7 +151,7 @@ void tv_top(void)
151void tv_bottom(void) 151void tv_bottom(void)
152{ 152{
153 tv_move_screen(0, 0, SEEK_END); 153 tv_move_screen(0, 0, SEEK_END);
154 if (preferences->vertical_scroll_mode == PAGE) 154 if (preferences->vertical_scroll_mode == VS_PAGE)
155 tv_move_screen(0, -tv_get_screen_pos()->line, SEEK_CUR); 155 tv_move_screen(0, -tv_get_screen_pos()->line, SEEK_CUR);
156} 156}
157 157
@@ -166,7 +166,7 @@ unsigned tv_menu(void)
166 if (res == TV_MENU_RESULT_EXIT_MENU) 166 if (res == TV_MENU_RESULT_EXIT_MENU)
167 { 167 {
168 tv_convert_fpos(cur_file_pos, &cur_pos); 168 tv_convert_fpos(cur_file_pos, &cur_pos);
169 if (preferences->vertical_scroll_mode == PAGE) 169 if (preferences->vertical_scroll_mode == VS_PAGE)
170 cur_pos.line = 0; 170 cur_pos.line = 0;
171 171
172 tv_move_screen(cur_pos.page, cur_pos.line, SEEK_SET); 172 tv_move_screen(cur_pos.page, cur_pos.line, SEEK_SET);
diff --git a/apps/plugins/text_viewer/tv_bookmark.c b/apps/plugins/text_viewer/tv_bookmark.c
index d379c924c4..d569ed8d11 100644
--- a/apps/plugins/text_viewer/tv_bookmark.c
+++ b/apps/plugins/text_viewer/tv_bookmark.c
@@ -224,7 +224,7 @@ void tv_select_bookmark(void)
224 } 224 }
225 225
226 /* move to the select position */ 226 /* move to the select position */
227 if (preferences->vertical_scroll_mode == PAGE) 227 if (preferences->vertical_scroll_mode == VS_PAGE)
228 select_pos.line = 0; 228 select_pos.line = 0;
229 229
230 tv_move_screen(select_pos.page, select_pos.line, SEEK_SET); 230 tv_move_screen(select_pos.page, select_pos.line, SEEK_SET);
diff --git a/apps/plugins/text_viewer/tv_preferences.c b/apps/plugins/text_viewer/tv_preferences.c
index ec59dd89a8..30b5f5ce51 100644
--- a/apps/plugins/text_viewer/tv_preferences.c
+++ b/apps/plugins/text_viewer/tv_preferences.c
@@ -88,13 +88,13 @@ void tv_copy_preferences(struct tv_preferences *copy_prefs)
88 88
89void tv_set_default_preferences(struct tv_preferences *p) 89void tv_set_default_preferences(struct tv_preferences *p)
90{ 90{
91 p->word_mode = WRAP; 91 p->word_mode = WM_WRAP;
92 p->line_mode = NORMAL; 92 p->line_mode = LM_NORMAL;
93 p->windows = 1; 93 p->windows = 1;
94 p->alignment = LEFT; 94 p->alignment = AL_LEFT;
95 p->horizontal_scroll_mode = SCREEN; 95 p->horizontal_scroll_mode = HS_SCREEN;
96 p->vertical_scroll_mode = PAGE; 96 p->vertical_scroll_mode = VS_PAGE;
97 p->page_mode = NO_OVERLAP; 97 p->page_mode = PM_NO_OVERLAP;
98 p->horizontal_scrollbar = SB_OFF; 98 p->horizontal_scrollbar = SB_OFF;
99 p->vertical_scrollbar = SB_OFF; 99 p->vertical_scrollbar = SB_OFF;
100#ifdef HAVE_LCD_BITMAP 100#ifdef HAVE_LCD_BITMAP
diff --git a/apps/plugins/text_viewer/tv_preferences.h b/apps/plugins/text_viewer/tv_preferences.h
index 7705a1673a..ee861ee6b6 100644
--- a/apps/plugins/text_viewer/tv_preferences.h
+++ b/apps/plugins/text_viewer/tv_preferences.h
@@ -31,28 +31,28 @@ enum {
31 31
32/* word_mode */ 32/* word_mode */
33enum { 33enum {
34 WRAP = 0, 34 WM_WRAP = 0,
35 CHOP, 35 WM_CHOP,
36}; 36};
37 37
38/* line_mode */ 38/* line_mode */
39enum { 39enum {
40 NORMAL = 0, 40 LM_NORMAL = 0,
41 JOIN, 41 LM_JOIN,
42 EXPAND, 42 LM_EXPAND,
43 REFLOW, 43 LM_REFLOW,
44}; 44};
45 45
46/* alignment */ 46/* alignment */
47enum { 47enum {
48 LEFT = 0, 48 AL_LEFT = 0,
49 RIGHT, 49 AL_RIGHT,
50}; 50};
51 51
52/* page_mode */ 52/* page_mode */
53enum { 53enum {
54 NO_OVERLAP = 0, 54 PM_NO_OVERLAP = 0,
55 OVERLAP, 55 PM_OVERLAP,
56}; 56};
57 57
58/* header_mode */ 58/* header_mode */
@@ -74,14 +74,14 @@ enum {
74 74
75/* horizontal_scroll_mode */ 75/* horizontal_scroll_mode */
76enum { 76enum {
77 SCREEN = 0, 77 HS_SCREEN = 0,
78 COLUMN, 78 HS_COLUMN,
79}; 79};
80 80
81/* vertical_scroll_mode */ 81/* vertical_scroll_mode */
82enum { 82enum {
83 PAGE = 0, 83 VS_PAGE = 0,
84 LINE, 84 VS_LINE,
85}; 85};
86 86
87/* narrow_mode */ 87/* narrow_mode */
diff --git a/apps/plugins/text_viewer/tv_settings.c b/apps/plugins/text_viewer/tv_settings.c
index 428666de24..93f16b5a66 100644
--- a/apps/plugins/text_viewer/tv_settings.c
+++ b/apps/plugins/text_viewer/tv_settings.c
@@ -149,7 +149,7 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre
149 if (version > 0) 149 if (version > 0)
150 prefs->alignment = *p++; 150 prefs->alignment = *p++;
151 else 151 else
152 prefs->alignment = LEFT; 152 prefs->alignment = AL_LEFT;
153 153
154 prefs->encoding = *p++; 154 prefs->encoding = *p++;
155 prefs->vertical_scrollbar = *p++; 155 prefs->vertical_scrollbar = *p++;
@@ -169,7 +169,7 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre
169 if (version > 3) 169 if (version > 3)
170 prefs->horizontal_scroll_mode = *p++; 170 prefs->horizontal_scroll_mode = *p++;
171 else 171 else
172 prefs->horizontal_scroll_mode = SCREEN; 172 prefs->horizontal_scroll_mode = HS_SCREEN;
173 173
174 if (version > 4) 174 if (version > 4)
175 prefs->narrow_mode = *p++; 175 prefs->narrow_mode = *p++;
diff --git a/apps/plugins/text_viewer/tv_text_processor.c b/apps/plugins/text_viewer/tv_text_processor.c
index 3ad388e6c5..1ddee62077 100644
--- a/apps/plugins/text_viewer/tv_text_processor.c
+++ b/apps/plugins/text_viewer/tv_text_processor.c
@@ -172,7 +172,7 @@ static bool tv_is_line_break_char(unsigned short ch)
172 size_t i; 172 size_t i;
173 173
174 /* when the word mode is CHOP, all characters does not break line. */ 174 /* when the word mode is CHOP, all characters does not break line. */
175 if (preferences->word_mode == CHOP) 175 if (preferences->word_mode == WM_CHOP)
176 return false; 176 return false;
177 177
178 for (i = 0; i < sizeof(break_chars); i++) 178 for (i = 0; i < sizeof(break_chars); i++)
@@ -221,7 +221,7 @@ static int tv_form_reflow_line(unsigned short *ucs, int chars)
221 int spaces = 0; 221 int spaces = 0;
222 int words_spaces; 222 int words_spaces;
223 223
224 if (preferences->alignment == LEFT) 224 if (preferences->alignment == AL_LEFT)
225 { 225 {
226 while (chars > 0 && ucs[chars-1] == ' ') 226 while (chars > 0 && ucs[chars-1] == ' ')
227 chars--; 227 chars--;
@@ -386,7 +386,7 @@ static int tv_parse_text(const unsigned char *src, unsigned short *ucs,
386 next = tv_get_ucs(cur, &ch); 386 next = tv_get_ucs(cur, &ch);
387 if (ch == '\n') 387 if (ch == '\n')
388 { 388 {
389 if (preferences->line_mode != JOIN || tv_is_break_line_join_mode(next)) 389 if (preferences->line_mode != LM_JOIN || tv_is_break_line_join_mode(next))
390 { 390 {
391 line_end_ptr = next; 391 line_end_ptr = next;
392 line_end_chars = chars; 392 line_end_chars = chars;
@@ -394,7 +394,7 @@ static int tv_parse_text(const unsigned char *src, unsigned short *ucs,
394 break; 394 break;
395 } 395 }
396 396
397 if (preferences->word_mode == CHOP || tv_isspace(prev_ch)) 397 if (preferences->word_mode == WM_CHOP || tv_isspace(prev_ch))
398 continue; 398 continue;
399 399
400 /* 400 /*
@@ -411,7 +411,7 @@ static int tv_parse_text(const unsigned char *src, unsigned short *ucs,
411 * (1) spacelike character convert to ' ' 411 * (1) spacelike character convert to ' '
412 * (2) plural spaces are collected to one 412 * (2) plural spaces are collected to one
413 */ 413 */
414 if (preferences->line_mode == REFLOW) 414 if (preferences->line_mode == LM_REFLOW)
415 { 415 {
416 ch = ' '; 416 ch = ' ';
417 if (prev_ch == ch) 417 if (prev_ch == ch)
@@ -419,13 +419,13 @@ static int tv_parse_text(const unsigned char *src, unsigned short *ucs,
419 } 419 }
420 420
421 /* when the alignment is RIGHT, ignores indent spaces. */ 421 /* when the alignment is RIGHT, ignores indent spaces. */
422 if (preferences->alignment == RIGHT && is_indent) 422 if (preferences->alignment == AL_RIGHT && is_indent)
423 continue; 423 continue;
424 } 424 }
425 else 425 else
426 is_indent = false; 426 is_indent = false;
427 427
428 if (preferences->line_mode == REFLOW && is_indent) 428 if (preferences->line_mode == LM_REFLOW && is_indent)
429 gw = tv_glyph_width(ch) * preferences->indent_spaces; 429 gw = tv_glyph_width(ch) * preferences->indent_spaces;
430 else 430 else
431 gw = tv_glyph_width(ch); 431 gw = tv_glyph_width(ch);
@@ -443,7 +443,7 @@ static int tv_parse_text(const unsigned char *src, unsigned short *ucs,
443 break; 443 break;
444 } 444 }
445 445
446 if (preferences->line_mode != REFLOW || !is_indent) 446 if (preferences->line_mode != LM_REFLOW || !is_indent)
447 ucs[chars++] = ch; 447 ucs[chars++] = ch;
448 else 448 else
449 { 449 {
@@ -472,7 +472,7 @@ static int tv_parse_text(const unsigned char *src, unsigned short *ucs,
472 * when the last line break position is too short (line length < 0.75 * block width), 472 * when the last line break position is too short (line length < 0.75 * block width),
473 * the line is cut off at the position where it is closest to the displayed width. 473 * the line is cut off at the position where it is closest to the displayed width.
474 */ 474 */
475 if ((preferences->line_mode == REFLOW && line_break_ptr == NULL) || 475 if ((preferences->line_mode == LM_REFLOW && line_break_ptr == NULL) ||
476 (4 * line_break_width < 3 * block_width)) 476 (4 * line_break_width < 3 * block_width))
477 { 477 {
478 line_end_ptr = cur; 478 line_end_ptr = cur;
@@ -504,7 +504,7 @@ int tv_create_formed_text(const unsigned char *src, ssize_t bufsize,
504 if (dst != NULL) 504 if (dst != NULL)
505 *dst = utf8buf; 505 *dst = utf8buf;
506 506
507 if (preferences->line_mode == EXPAND && (expand_extra_line = !expand_extra_line) == true) 507 if (preferences->line_mode == LM_EXPAND && (expand_extra_line = !expand_extra_line) == true)
508 return 0; 508 return 0;
509 509
510 end_ptr = src + bufsize; 510 end_ptr = src + bufsize;
@@ -526,14 +526,14 @@ int tv_create_formed_text(const unsigned char *src, ssize_t bufsize,
526 526
527 if (dst != NULL) 527 if (dst != NULL)
528 { 528 {
529 if (preferences->alignment == RIGHT) 529 if (preferences->alignment == AL_RIGHT)
530 tv_align_right(chars); 530 tv_align_right(chars);
531 531
532 for (i = 0; i < block_count; i++) 532 for (i = 0; i < block_count; i++)
533 { 533 {
534 if (i == block || (is_multi && i == block + 1)) 534 if (i == block || (is_multi && i == block + 1))
535 { 535 {
536 if (is_break_line && preferences->line_mode == REFLOW) 536 if (is_break_line && preferences->line_mode == LM_REFLOW)
537 chars[i] = tv_form_reflow_line(ucsbuf[i], chars[i]); 537 chars[i] = tv_form_reflow_line(ucsbuf[i], chars[i]);
538 538
539 tv_decode2utf8(ucsbuf[i], chars[i]); 539 tv_decode2utf8(ucsbuf[i], chars[i]);
diff --git a/apps/plugins/text_viewer/tv_window.c b/apps/plugins/text_viewer/tv_window.c
index f1f2033ef1..1bb47b18f3 100644
--- a/apps/plugins/text_viewer/tv_window.c
+++ b/apps/plugins/text_viewer/tv_window.c
@@ -234,7 +234,7 @@ void tv_draw_window(void)
234 tv_copy_screen_pos(&pos); 234 tv_copy_screen_pos(&pos);
235 rb->lcd_clear_display(); 235 rb->lcd_clear_display();
236 236
237 if (preferences->alignment == LEFT) 237 if (preferences->alignment == AL_LEFT)
238 tv_read_start(cur_window, (cur_column > 0)); 238 tv_read_start(cur_window, (cur_column > 0));
239 else 239 else
240 tv_read_start(0, preferences->windows > 1); 240 tv_read_start(0, preferences->windows > 1);
@@ -244,7 +244,7 @@ void tv_draw_window(void)
244 if (!tv_get_next_line(&line_buf)) 244 if (!tv_get_next_line(&line_buf))
245 break; 245 break;
246 246
247 if (preferences->alignment == RIGHT) 247 if (preferences->alignment == AL_RIGHT)
248 { 248 {
249 rb->lcd_getstringsize(line_buf, &line_width, NULL); 249 rb->lcd_getstringsize(line_buf, &line_width, NULL);
250 dx = draw_width - line_width; 250 dx = draw_width - line_width;