diff options
Diffstat (limited to 'apps/plugins/viewer.c')
-rw-r--r-- | apps/plugins/viewer.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index a212885540..88b43c30b3 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c | |||
@@ -1,12 +1,11 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * | ||
3 | * __________ __ ___. | 2 | * __________ __ ___. |
4 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
5 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
6 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
7 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
8 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
9 | * | 8 | * $Id$ |
10 | * | 9 | * |
11 | * Copyright (C) 2002 Gilles Roux, 2003 Garrett Derner | 10 | * Copyright (C) 2002 Gilles Roux, 2003 Garrett Derner |
12 | * | 11 | * |
@@ -432,7 +431,6 @@ struct preferences { | |||
432 | } scroll_mode; | 431 | } scroll_mode; |
433 | 432 | ||
434 | int autoscroll_speed; | 433 | int autoscroll_speed; |
435 | |||
436 | }; | 434 | }; |
437 | 435 | ||
438 | struct preferences prefs; | 436 | struct preferences prefs; |
@@ -1226,7 +1224,7 @@ static void viewer_load_settings(void) /* same name as global, but not the same | |||
1226 | int settings_fd, i; | 1224 | int settings_fd, i; |
1227 | struct bookmark_file_data *data; | 1225 | struct bookmark_file_data *data; |
1228 | struct bookmarked_file_info this_bookmark; | 1226 | struct bookmarked_file_info this_bookmark; |
1229 | 1227 | ||
1230 | /* read settings file */ | 1228 | /* read settings file */ |
1231 | settings_fd=rb->open(SETTINGS_FILE, O_RDONLY); | 1229 | settings_fd=rb->open(SETTINGS_FILE, O_RDONLY); |
1232 | if ((settings_fd >= 0) && (rb->filesize(settings_fd) == sizeof(struct preferences))) | 1230 | if ((settings_fd >= 0) && (rb->filesize(settings_fd) == sizeof(struct preferences))) |
@@ -1271,7 +1269,7 @@ static void viewer_load_settings(void) /* same name as global, but not the same | |||
1271 | file_pos = screen_pos - screen_top; | 1269 | file_pos = screen_pos - screen_top; |
1272 | screen_top_ptr = buffer + screen_top; | 1270 | screen_top_ptr = buffer + screen_top; |
1273 | break; | 1271 | break; |
1274 | } | 1272 | } |
1275 | } | 1273 | } |
1276 | 1274 | ||
1277 | this_bookmark.file_position = file_pos; | 1275 | this_bookmark.file_position = file_pos; |
@@ -1284,16 +1282,16 @@ static void viewer_load_settings(void) /* same name as global, but not the same | |||
1284 | if (i >= data->bookmarked_files_count) | 1282 | if (i >= data->bookmarked_files_count) |
1285 | { | 1283 | { |
1286 | if (i < MAX_BOOKMARKED_FILES) | 1284 | if (i < MAX_BOOKMARKED_FILES) |
1287 | data->bookmarked_files_count++; | 1285 | data->bookmarked_files_count++; |
1288 | else | 1286 | else |
1289 | i = MAX_BOOKMARKED_FILES-1; | 1287 | i = MAX_BOOKMARKED_FILES-1; |
1290 | } | 1288 | } |
1291 | 1289 | ||
1292 | /* write bookmark file with spare slot in first position | 1290 | /* write bookmark file with spare slot in first position |
1293 | to be filled in by viewer_save_settings */ | 1291 | to be filled in by viewer_save_settings */ |
1294 | settings_fd = rb->open(BOOKMARKS_FILE, O_WRONLY|O_CREAT); | 1292 | settings_fd = rb->open(BOOKMARKS_FILE, O_WRONLY|O_CREAT); |
1295 | if (settings_fd >=0 ) | 1293 | if (settings_fd >=0 ) |
1296 | { | 1294 | { |
1297 | /* write count */ | 1295 | /* write count */ |
1298 | rb->write (settings_fd, &data->bookmarked_files_count, sizeof(signed int)); | 1296 | rb->write (settings_fd, &data->bookmarked_files_count, sizeof(signed int)); |
1299 | 1297 | ||
@@ -1336,7 +1334,7 @@ static void viewer_save_settings(void)/* same name as global, but not the same f | |||
1336 | rb->close(settings_fd); | 1334 | rb->close(settings_fd); |
1337 | } | 1335 | } |
1338 | } | 1336 | } |
1339 | 1337 | ||
1340 | /* save the bookmark if the position has changed */ | 1338 | /* save the bookmark if the position has changed */ |
1341 | if (file_pos + screen_top_ptr - buffer != start_position) | 1339 | if (file_pos + screen_top_ptr - buffer != start_position) |
1342 | { | 1340 | { |
@@ -1559,11 +1557,11 @@ enum plugin_status plugin_start(const void* file) | |||
1559 | } | 1557 | } |
1560 | 1558 | ||
1561 | viewer_load_settings(); /* load the preferences and bookmark */ | 1559 | viewer_load_settings(); /* load the preferences and bookmark */ |
1562 | 1560 | ||
1563 | #if LCD_DEPTH > 1 | 1561 | #if LCD_DEPTH > 1 |
1564 | rb->lcd_set_backdrop(NULL); | 1562 | rb->lcd_set_backdrop(NULL); |
1565 | #endif | 1563 | #endif |
1566 | 1564 | ||
1567 | viewer_draw(col); | 1565 | viewer_draw(col); |
1568 | 1566 | ||
1569 | while (!done) { | 1567 | while (!done) { |
@@ -1577,7 +1575,7 @@ enum plugin_status plugin_start(const void* file) | |||
1577 | old_tick = *rb->current_tick; | 1575 | old_tick = *rb->current_tick; |
1578 | } | 1576 | } |
1579 | } | 1577 | } |
1580 | 1578 | ||
1581 | button = rb->button_get_w_tmo(HZ/10); | 1579 | button = rb->button_get_w_tmo(HZ/10); |
1582 | switch (button) { | 1580 | switch (button) { |
1583 | case VIEWER_MENU: | 1581 | case VIEWER_MENU: |