diff options
-rw-r--r-- | apps/plugins/text_viewer/tv_action.c | 16 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_bookmark.c | 2 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_preferences.c | 12 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_preferences.h | 28 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_settings.c | 4 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_text_processor.c | 24 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_window.c | 4 |
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) int offset_line = -1; if ((mode == TV_VERTICAL_SCROLL_PAGE) || - (mode == TV_VERTICAL_SCROLL_PREFS && preferences->vertical_scroll_mode == PAGE)) + (mode == TV_VERTICAL_SCROLL_PREFS && preferences->vertical_scroll_mode == VS_PAGE)) { offset_page--; #ifdef HAVE_LCD_BITMAP - offset_line = (preferences->page_mode == OVERLAP)? 1:0; + offset_line = (preferences->page_mode == PM_OVERLAP)? 1:0; #endif } tv_move_screen(offset_page, offset_line, SEEK_CUR); @@ -95,11 +95,11 @@ void tv_scroll_down(unsigned mode) int offset_line = 1; if ((mode == TV_VERTICAL_SCROLL_PAGE) || - (mode == TV_VERTICAL_SCROLL_PREFS && preferences->vertical_scroll_mode == PAGE)) + (mode == TV_VERTICAL_SCROLL_PREFS && preferences->vertical_scroll_mode == VS_PAGE)) { offset_page++; #ifdef HAVE_LCD_BITMAP - offset_line = (preferences->page_mode == OVERLAP)? -1:0; + offset_line = (preferences->page_mode == PM_OVERLAP)? -1:0; #endif } tv_move_screen(offset_page, offset_line, SEEK_CUR); @@ -111,7 +111,7 @@ void tv_scroll_left(unsigned mode) int offset_column = 0; if ((mode == TV_HORIZONTAL_SCROLL_COLUMN) || - (mode == TV_HORIZONTAL_SCROLL_PREFS && preferences->horizontal_scroll_mode == COLUMN)) + (mode == TV_HORIZONTAL_SCROLL_PREFS && preferences->horizontal_scroll_mode == HS_COLUMN)) { /* Scroll left one column */ offset_column--; @@ -130,7 +130,7 @@ void tv_scroll_right(unsigned mode) int offset_column = 0; if ((mode == TV_HORIZONTAL_SCROLL_COLUMN) || - (mode == TV_HORIZONTAL_SCROLL_PREFS && preferences->horizontal_scroll_mode == COLUMN)) + (mode == TV_HORIZONTAL_SCROLL_PREFS && preferences->horizontal_scroll_mode == HS_COLUMN)) { /* Scroll right one column */ offset_column++; @@ -151,7 +151,7 @@ void tv_top(void) void tv_bottom(void) { tv_move_screen(0, 0, SEEK_END); - if (preferences->vertical_scroll_mode == PAGE) + if (preferences->vertical_scroll_mode == VS_PAGE) tv_move_screen(0, -tv_get_screen_pos()->line, SEEK_CUR); } @@ -166,7 +166,7 @@ unsigned tv_menu(void) if (res == TV_MENU_RESULT_EXIT_MENU) { tv_convert_fpos(cur_file_pos, &cur_pos); - if (preferences->vertical_scroll_mode == PAGE) + if (preferences->vertical_scroll_mode == VS_PAGE) cur_pos.line = 0; 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) } /* move to the select position */ - if (preferences->vertical_scroll_mode == PAGE) + if (preferences->vertical_scroll_mode == VS_PAGE) select_pos.line = 0; 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) void tv_set_default_preferences(struct tv_preferences *p) { - p->word_mode = WRAP; - p->line_mode = NORMAL; + p->word_mode = WM_WRAP; + p->line_mode = LM_NORMAL; p->windows = 1; - p->alignment = LEFT; - p->horizontal_scroll_mode = SCREEN; - p->vertical_scroll_mode = PAGE; - p->page_mode = NO_OVERLAP; + p->alignment = AL_LEFT; + p->horizontal_scroll_mode = HS_SCREEN; + p->vertical_scroll_mode = VS_PAGE; + p->page_mode = PM_NO_OVERLAP; p->horizontal_scrollbar = SB_OFF; p->vertical_scrollbar = SB_OFF; #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 { /* word_mode */ enum { - WRAP = 0, - CHOP, + WM_WRAP = 0, + WM_CHOP, }; /* line_mode */ enum { - NORMAL = 0, - JOIN, - EXPAND, - REFLOW, + LM_NORMAL = 0, + LM_JOIN, + LM_EXPAND, + LM_REFLOW, }; /* alignment */ enum { - LEFT = 0, - RIGHT, + AL_LEFT = 0, + AL_RIGHT, }; /* page_mode */ enum { - NO_OVERLAP = 0, - OVERLAP, + PM_NO_OVERLAP = 0, + PM_OVERLAP, }; /* header_mode */ @@ -74,14 +74,14 @@ enum { /* horizontal_scroll_mode */ enum { - SCREEN = 0, - COLUMN, + HS_SCREEN = 0, + HS_COLUMN, }; /* vertical_scroll_mode */ enum { - PAGE = 0, - LINE, + VS_PAGE = 0, + VS_LINE, }; /* 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 if (version > 0) prefs->alignment = *p++; else - prefs->alignment = LEFT; + prefs->alignment = AL_LEFT; prefs->encoding = *p++; prefs->vertical_scrollbar = *p++; @@ -169,7 +169,7 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre if (version > 3) prefs->horizontal_scroll_mode = *p++; else - prefs->horizontal_scroll_mode = SCREEN; + prefs->horizontal_scroll_mode = HS_SCREEN; if (version > 4) 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) size_t i; /* when the word mode is CHOP, all characters does not break line. */ - if (preferences->word_mode == CHOP) + if (preferences->word_mode == WM_CHOP) return false; for (i = 0; i < sizeof(break_chars); i++) @@ -221,7 +221,7 @@ static int tv_form_reflow_line(unsigned short *ucs, int chars) int spaces = 0; int words_spaces; - if (preferences->alignment == LEFT) + if (preferences->alignment == AL_LEFT) { while (chars > 0 && ucs[chars-1] == ' ') chars--; @@ -386,7 +386,7 @@ static int tv_parse_text(const unsigned char *src, unsigned short *ucs, next = tv_get_ucs(cur, &ch); if (ch == '\n') { - if (preferences->line_mode != JOIN || tv_is_break_line_join_mode(next)) + if (preferences->line_mode != LM_JOIN || tv_is_break_line_join_mode(next)) { line_end_ptr = next; line_end_chars = chars; @@ -394,7 +394,7 @@ static int tv_parse_text(const unsigned char *src, unsigned short *ucs, break; } - if (preferences->word_mode == CHOP || tv_isspace(prev_ch)) + if (preferences->word_mode == WM_CHOP || tv_isspace(prev_ch)) continue; /* @@ -411,7 +411,7 @@ static int tv_parse_text(const unsigned char *src, unsigned short *ucs, * (1) spacelike character convert to ' ' * (2) plural spaces are collected to one */ - if (preferences->line_mode == REFLOW) + if (preferences->line_mode == LM_REFLOW) { ch = ' '; if (prev_ch == ch) @@ -419,13 +419,13 @@ static int tv_parse_text(const unsigned char *src, unsigned short *ucs, } /* when the alignment is RIGHT, ignores indent spaces. */ - if (preferences->alignment == RIGHT && is_indent) + if (preferences->alignment == AL_RIGHT && is_indent) continue; } else is_indent = false; - if (preferences->line_mode == REFLOW && is_indent) + if (preferences->line_mode == LM_REFLOW && is_indent) gw = tv_glyph_width(ch) * preferences->indent_spaces; else gw = tv_glyph_width(ch); @@ -443,7 +443,7 @@ static int tv_parse_text(const unsigned char *src, unsigned short *ucs, break; } - if (preferences->line_mode != REFLOW || !is_indent) + if (preferences->line_mode != LM_REFLOW || !is_indent) ucs[chars++] = ch; else { @@ -472,7 +472,7 @@ static int tv_parse_text(const unsigned char *src, unsigned short *ucs, * when the last line break position is too short (line length < 0.75 * block width), * the line is cut off at the position where it is closest to the displayed width. */ - if ((preferences->line_mode == REFLOW && line_break_ptr == NULL) || + if ((preferences->line_mode == LM_REFLOW && line_break_ptr == NULL) || (4 * line_break_width < 3 * block_width)) { line_end_ptr = cur; @@ -504,7 +504,7 @@ int tv_create_formed_text(const unsigned char *src, ssize_t bufsize, if (dst != NULL) *dst = utf8buf; - if (preferences->line_mode == EXPAND && (expand_extra_line = !expand_extra_line) == true) + if (preferences->line_mode == LM_EXPAND && (expand_extra_line = !expand_extra_line) == true) return 0; end_ptr = src + bufsize; @@ -526,14 +526,14 @@ int tv_create_formed_text(const unsigned char *src, ssize_t bufsize, if (dst != NULL) { - if (preferences->alignment == RIGHT) + if (preferences->alignment == AL_RIGHT) tv_align_right(chars); for (i = 0; i < block_count; i++) { if (i == block || (is_multi && i == block + 1)) { - if (is_break_line && preferences->line_mode == REFLOW) + if (is_break_line && preferences->line_mode == LM_REFLOW) chars[i] = tv_form_reflow_line(ucsbuf[i], chars[i]); 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) tv_copy_screen_pos(&pos); rb->lcd_clear_display(); - if (preferences->alignment == LEFT) + if (preferences->alignment == AL_LEFT) tv_read_start(cur_window, (cur_column > 0)); else tv_read_start(0, preferences->windows > 1); @@ -244,7 +244,7 @@ void tv_draw_window(void) if (!tv_get_next_line(&line_buf)) break; - if (preferences->alignment == RIGHT) + if (preferences->alignment == AL_RIGHT) { rb->lcd_getstringsize(line_buf, &line_width, NULL); dx = draw_width - line_width; |