summaryrefslogtreecommitdiff
path: root/apps/plugins/text_viewer/tv_settings.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/text_viewer/tv_settings.c')
-rw-r--r--apps/plugins/text_viewer/tv_settings.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/apps/plugins/text_viewer/tv_settings.c b/apps/plugins/text_viewer/tv_settings.c
index 3b9a684b94..bf6ae1e74a 100644
--- a/apps/plugins/text_viewer/tv_settings.c
+++ b/apps/plugins/text_viewer/tv_settings.c
@@ -39,14 +39,15 @@
39 * windows 1 (when version <= 0x32, this value is view_mode) 39 * windows 1 (when version <= 0x32, this value is view_mode)
40 * alignment 1 40 * alignment 1
41 * encoding 1 41 * encoding 1
42 * scrollbar_mode 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 * page_number_mode 1
46 * title_mode 1 46 * title_mode 1
47 * scroll_mode 1 47 * scroll_mode 1
48 * autoscroll_speed 1 48 * autoscroll_speed 1
49 * (reserved) 16 49 * horizontal_scrollbar 1
50 * (reserved) 15
50 * font name MAX_PATH 51 * font name MAX_PATH
51 */ 52 */
52 53
@@ -54,7 +55,7 @@
54#define TV_GLOBAL_SETTINGS_FILE VIEWERS_DIR "/tv_global.dat" 55#define TV_GLOBAL_SETTINGS_FILE VIEWERS_DIR "/tv_global.dat"
55 56
56#define TV_GLOBAL_SETTINGS_HEADER "\x54\x56\x47\x53" /* "TVGS" */ 57#define TV_GLOBAL_SETTINGS_HEADER "\x54\x56\x47\x53" /* "TVGS" */
57#define TV_GLOBAL_SETTINGS_VERSION 0x33 58#define TV_GLOBAL_SETTINGS_VERSION 0x34
58#define TV_GLOBAL_SETTINGS_HEADER_SIZE 5 59#define TV_GLOBAL_SETTINGS_HEADER_SIZE 5
59#define TV_GLOBAL_SETTINGS_FIRST_VERSION 0x31 60#define TV_GLOBAL_SETTINGS_FIRST_VERSION 0x31
60 61
@@ -77,14 +78,15 @@
77 * windows 1 (when version <= 0x33, this value is view_mode) 78 * windows 1 (when version <= 0x33, this value is view_mode)
78 * alignment 1 79 * alignment 1
79 * encoding 1 80 * encoding 1
80 * scrollbar_mode 1 81 * vertical_scrollbar 1
81 * (unused) 1 (for compatibility) 82 * (unused) 1 (for compatibility)
82 * page_mode 1 83 * page_mode 1
83 * header_mode 1 84 * header_mode 1
84 * footer_mode 1 85 * footer_mode 1
85 * scroll_mode 1 86 * scroll_mode 1
86 * autoscroll_speed 1 87 * autoscroll_speed 1
87 * (reserved) 16 88 * horizontal_scrollbar 1
89 * (reserved) 15
88 * font name MAX_PATH 90 * font name MAX_PATH
89 * bookmark count 1 91 * bookmark count 1
90 * [1st bookmark] 92 * [1st bookmark]
@@ -106,7 +108,7 @@
106#define TV_SETTINGS_TMP_FILE VIEWERS_DIR "/tv_file.tmp" 108#define TV_SETTINGS_TMP_FILE VIEWERS_DIR "/tv_file.tmp"
107 109
108#define TV_SETTINGS_HEADER "\x54\x56\x53" /* "TVS" */ 110#define TV_SETTINGS_HEADER "\x54\x56\x53" /* "TVS" */
109#define TV_SETTINGS_VERSION 0x34 111#define TV_SETTINGS_VERSION 0x35
110#define TV_SETTINGS_HEADER_SIZE 4 112#define TV_SETTINGS_HEADER_SIZE 4
111#define TV_SETTINGS_FIRST_VERSION 0x32 113#define TV_SETTINGS_FIRST_VERSION 0x32
112 114
@@ -143,8 +145,8 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre
143 else 145 else
144 prefs->alignment = LEFT; 146 prefs->alignment = LEFT;
145 147
146 prefs->encoding = *p++; 148 prefs->encoding = *p++;
147 prefs->scrollbar_mode = *p++; 149 prefs->vertical_scrollbar = *p++;
148 /* skip need_scrollbar */ 150 /* skip need_scrollbar */
149 p++; 151 p++;
150 prefs->page_mode = *p++; 152 prefs->page_mode = *p++;
@@ -153,6 +155,11 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre
153 prefs->scroll_mode = *p++; 155 prefs->scroll_mode = *p++;
154 prefs->autoscroll_speed = *p++; 156 prefs->autoscroll_speed = *p++;
155 157
158 if (version > 2)
159 prefs->horizontal_scrollbar = *p;
160 else
161 prefs->horizontal_scrollbar = SB_OFF;
162
156 rb->memcpy(prefs->font_name, buf + read_size - MAX_PATH, MAX_PATH); 163 rb->memcpy(prefs->font_name, buf + read_size - MAX_PATH, MAX_PATH);
157 164
158#ifdef HAVE_LCD_BITMAP 165#ifdef HAVE_LCD_BITMAP
@@ -172,7 +179,7 @@ static bool tv_write_preferences(int pfd, const struct tv_preferences *prefs)
172 *p++ = prefs->windows; 179 *p++ = prefs->windows;
173 *p++ = prefs->alignment; 180 *p++ = prefs->alignment;
174 *p++ = prefs->encoding; 181 *p++ = prefs->encoding;
175 *p++ = prefs->scrollbar_mode; 182 *p++ = prefs->vertical_scrollbar;
176 /* skip need_scrollbar */ 183 /* skip need_scrollbar */
177 p++; 184 p++;
178 *p++ = prefs->page_mode; 185 *p++ = prefs->page_mode;
@@ -180,6 +187,7 @@ static bool tv_write_preferences(int pfd, const struct tv_preferences *prefs)
180 *p++ = prefs->footer_mode; 187 *p++ = prefs->footer_mode;
181 *p++ = prefs->scroll_mode; 188 *p++ = prefs->scroll_mode;
182 *p++ = prefs->autoscroll_speed; 189 *p++ = prefs->autoscroll_speed;
190 *p++ = prefs->horizontal_scrollbar;
183 191
184 rb->memcpy(buf + 28, prefs->font_name, MAX_PATH); 192 rb->memcpy(buf + 28, prefs->font_name, MAX_PATH);
185 193