diff options
Diffstat (limited to 'apps/plugins/text_viewer/tv_settings.c')
-rw-r--r-- | apps/plugins/text_viewer/tv_settings.c | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/apps/plugins/text_viewer/tv_settings.c b/apps/plugins/text_viewer/tv_settings.c index 93f16b5a66..56c0bbe7ce 100644 --- a/apps/plugins/text_viewer/tv_settings.c +++ b/apps/plugins/text_viewer/tv_settings.c | |||
@@ -42,15 +42,16 @@ | |||
42 | * vertical_scrollbar 1 | 42 | * vertical_scrollbar 1 |
43 | * (unused) 1 (for compatibility) | 43 | * (unused) 1 (for compatibility) |
44 | * page_mode 1 | 44 | * page_mode 1 |
45 | * page_number_mode 1 | 45 | * header_mode 1 |
46 | * title_mode 1 | 46 | * footer_mode 1 |
47 | * scroll_mode 1 | 47 | * scroll_mode 1 |
48 | * autoscroll_speed 1 | 48 | * autoscroll_speed 1 |
49 | * horizontal_scrollbar 1 | 49 | * horizontal_scrollbar 1 |
50 | * horizontal_scroll_mode 1 | 50 | * horizontal_scroll_mode 1 |
51 | * narrow_mode 1 | 51 | * narrow_mode 1 |
52 | * indent_spaces 1 | 52 | * indent_spaces 1 |
53 | * (reserved) 12 | 53 | * statusbar 1 |
54 | * (reserved) 11 | ||
54 | * font name MAX_PATH | 55 | * font name MAX_PATH |
55 | */ | 56 | */ |
56 | 57 | ||
@@ -58,7 +59,7 @@ | |||
58 | #define TV_GLOBAL_SETTINGS_FILE VIEWERS_DIR "/tv_global.dat" | 59 | #define TV_GLOBAL_SETTINGS_FILE VIEWERS_DIR "/tv_global.dat" |
59 | 60 | ||
60 | #define TV_GLOBAL_SETTINGS_HEADER "\x54\x56\x47\x53" /* "TVGS" */ | 61 | #define TV_GLOBAL_SETTINGS_HEADER "\x54\x56\x47\x53" /* "TVGS" */ |
61 | #define TV_GLOBAL_SETTINGS_VERSION 0x37 | 62 | #define TV_GLOBAL_SETTINGS_VERSION 0x38 |
62 | #define TV_GLOBAL_SETTINGS_HEADER_SIZE 5 | 63 | #define TV_GLOBAL_SETTINGS_HEADER_SIZE 5 |
63 | #define TV_GLOBAL_SETTINGS_FIRST_VERSION 0x31 | 64 | #define TV_GLOBAL_SETTINGS_FIRST_VERSION 0x31 |
64 | 65 | ||
@@ -92,7 +93,8 @@ | |||
92 | * horizontal_scroll_mode 1 | 93 | * horizontal_scroll_mode 1 |
93 | * narrow_mode 1 | 94 | * narrow_mode 1 |
94 | * indent_spaces 1 | 95 | * indent_spaces 1 |
95 | * (reserved) 12 | 96 | * statusbar 1 |
97 | * (reserved) 11 | ||
96 | * font name MAX_PATH | 98 | * font name MAX_PATH |
97 | * bookmark count 1 | 99 | * bookmark count 1 |
98 | * [1st bookmark] | 100 | * [1st bookmark] |
@@ -114,7 +116,7 @@ | |||
114 | #define TV_SETTINGS_TMP_FILE VIEWERS_DIR "/tv_file.tmp" | 116 | #define TV_SETTINGS_TMP_FILE VIEWERS_DIR "/tv_file.tmp" |
115 | 117 | ||
116 | #define TV_SETTINGS_HEADER "\x54\x56\x53" /* "TVS" */ | 118 | #define TV_SETTINGS_HEADER "\x54\x56\x53" /* "TVS" */ |
117 | #define TV_SETTINGS_VERSION 0x38 | 119 | #define TV_SETTINGS_VERSION 0x39 |
118 | #define TV_SETTINGS_HEADER_SIZE 4 | 120 | #define TV_SETTINGS_HEADER_SIZE 4 |
119 | #define TV_SETTINGS_FIRST_VERSION 0x32 | 121 | #define TV_SETTINGS_FIRST_VERSION 0x32 |
120 | 122 | ||
@@ -156,8 +158,34 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre | |||
156 | /* skip need_scrollbar */ | 158 | /* skip need_scrollbar */ |
157 | p++; | 159 | p++; |
158 | prefs->page_mode = *p++; | 160 | prefs->page_mode = *p++; |
159 | prefs->header_mode = *p++; | 161 | |
160 | prefs->footer_mode = *p++; | 162 | if (version < 7) |
163 | { | ||
164 | prefs->statusbar = false; | ||
165 | if (*p > 1) | ||
166 | { | ||
167 | prefs->header_mode = (*p & 1); | ||
168 | prefs->statusbar = true; | ||
169 | } | ||
170 | else | ||
171 | prefs->header_mode = *p; | ||
172 | |||
173 | if (*(++p) > 1) | ||
174 | { | ||
175 | prefs->footer_mode = (*p & 1); | ||
176 | prefs->statusbar = true; | ||
177 | } | ||
178 | else | ||
179 | prefs->footer_mode = *p; | ||
180 | |||
181 | p++; | ||
182 | } | ||
183 | else | ||
184 | { | ||
185 | prefs->header_mode = *p++; | ||
186 | prefs->footer_mode = *p++; | ||
187 | } | ||
188 | |||
161 | prefs->vertical_scroll_mode = *p++; | 189 | prefs->vertical_scroll_mode = *p++; |
162 | prefs->autoscroll_speed = *p++; | 190 | prefs->autoscroll_speed = *p++; |
163 | 191 | ||
@@ -181,6 +209,9 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre | |||
181 | else | 209 | else |
182 | prefs->indent_spaces = 2; | 210 | prefs->indent_spaces = 2; |
183 | 211 | ||
212 | if (version > 6) | ||
213 | prefs->statusbar = (*p++ != 0); | ||
214 | |||
184 | #ifdef HAVE_LCD_BITMAP | 215 | #ifdef HAVE_LCD_BITMAP |
185 | rb->memcpy(prefs->font_name, buf + read_size - MAX_PATH, MAX_PATH); | 216 | rb->memcpy(prefs->font_name, buf + read_size - MAX_PATH, MAX_PATH); |
186 | 217 | ||
@@ -212,6 +243,7 @@ static bool tv_write_preferences(int pfd, const struct tv_preferences *prefs) | |||
212 | *p++ = prefs->horizontal_scroll_mode; | 243 | *p++ = prefs->horizontal_scroll_mode; |
213 | *p++ = prefs->narrow_mode; | 244 | *p++ = prefs->narrow_mode; |
214 | *p++ = prefs->indent_spaces; | 245 | *p++ = prefs->indent_spaces; |
246 | *p++ = prefs->statusbar; | ||
215 | 247 | ||
216 | #ifdef HAVE_LCD_BITMAP | 248 | #ifdef HAVE_LCD_BITMAP |
217 | rb->memcpy(buf + 28, prefs->font_name, MAX_PATH); | 249 | rb->memcpy(buf + 28, prefs->font_name, MAX_PATH); |