diff options
author | Björn Stenberg <bjorn@haxx.se> | 2004-01-14 00:13:04 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2004-01-14 00:13:04 +0000 |
commit | a108ec2ebd237835a688ae5c82c90e07607219ae (patch) | |
tree | 17c0af92368ee76d16cfdc2162aadbb7f103d926 /apps/settings.c | |
parent | 50b6358272eaf1f255bcb430766e6fc9e26810d3 (diff) | |
download | rockbox-a108ec2ebd237835a688ae5c82c90e07607219ae.tar.gz rockbox-a108ec2ebd237835a688ae5c82c90e07607219ae.zip |
Added Benjamin Metzlers bookmarking feature (patch #669440)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4227 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/settings.c')
-rw-r--r-- | apps/settings.c | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/apps/settings.c b/apps/settings.c index 1cde6e02e7..a342acc746 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include "language.h" | 56 | #include "language.h" |
57 | #include "wps-display.h" | 57 | #include "wps-display.h" |
58 | #include "powermgmt.h" | 58 | #include "powermgmt.h" |
59 | #include "bookmark.h" | ||
59 | #include "sprintf.h" | 60 | #include "sprintf.h" |
60 | #include "keyboard.h" | 61 | #include "keyboard.h" |
61 | #include "version.h" | 62 | #include "version.h" |
@@ -143,7 +144,7 @@ Rest of config block, only saved to disk: | |||
143 | caption backlight (bit 1) | 144 | caption backlight (bit 1) |
144 | car adapter mode (bit 2) | 145 | car adapter mode (bit 2) |
145 | line_in (Player only) (bit 3) | 146 | line_in (Player only) (bit 3) |
146 | 0xAF [available/unused] | 147 | 0xAF <most-recent-bookmarks, auto-bookmark, autoload> |
147 | 0xB0 peak meter clip hold timeout (bit 0-4), peak meter performance (bit 7) | 148 | 0xB0 peak meter clip hold timeout (bit 0-4), peak meter performance (bit 7) |
148 | 0xB1 peak meter release step size, peak_meter_dbfs (bit 7) | 149 | 0xB1 peak meter release step size, peak_meter_dbfs (bit 7) |
149 | 0xB2 peak meter min either in -db or in percent | 150 | 0xB2 peak meter min either in -db or in percent |
@@ -419,6 +420,9 @@ int settings_save( void ) | |||
419 | ((global_settings.caption_backlight & 1) << 1) | | 420 | ((global_settings.caption_backlight & 1) << 1) | |
420 | ((global_settings.car_adapter_mode & 1) << 2) | | 421 | ((global_settings.car_adapter_mode & 1) << 2) | |
421 | ((global_settings.line_in & 1) << 3)); | 422 | ((global_settings.line_in & 1) << 3)); |
423 | config_block[0xaf] = ((global_settings.usemrb << 5) | | ||
424 | (global_settings.autocreatebookmark << 2) | | ||
425 | (global_settings.autoloadbookmark)); | ||
422 | config_block[0xb0] = (unsigned char)global_settings.peak_meter_clip_hold | | 426 | config_block[0xb0] = (unsigned char)global_settings.peak_meter_clip_hold | |
423 | (global_settings.peak_meter_performance ? 0x80 : 0); | 427 | (global_settings.peak_meter_performance ? 0x80 : 0); |
424 | config_block[0xb1] = global_settings.peak_meter_release | | 428 | config_block[0xb1] = global_settings.peak_meter_release | |
@@ -771,6 +775,9 @@ void settings_load(void) | |||
771 | if (config_block[0xa9] != 0xff) | 775 | if (config_block[0xa9] != 0xff) |
772 | global_settings.jump_scroll_delay = config_block[0xa9]; | 776 | global_settings.jump_scroll_delay = config_block[0xa9]; |
773 | #endif | 777 | #endif |
778 | global_settings.usemrb = (config_block[0xaf] >> 5) & 3; | ||
779 | global_settings.autocreatebookmark = (config_block[0xaf] >> 2) & 7; | ||
780 | global_settings.autoloadbookmark = (config_block[0xaf]) & 3; | ||
774 | } | 781 | } |
775 | 782 | ||
776 | settings_apply(); | 783 | settings_apply(); |
@@ -1128,6 +1135,21 @@ bool settings_load_config(char* file) | |||
1128 | set_cfg_option(&global_settings.recursive_dir_insert, value, | 1135 | set_cfg_option(&global_settings.recursive_dir_insert, value, |
1129 | options, 3); | 1136 | options, 3); |
1130 | } | 1137 | } |
1138 | else if (!strcasecmp(name, "autoload bookmarks")) | ||
1139 | { | ||
1140 | static char* options[] = {"off", "on", "ask"}; | ||
1141 | set_cfg_option(&global_settings.autoloadbookmark, value, options, 3); | ||
1142 | } | ||
1143 | else if (!strcasecmp(name, "autocreate bookmarks")) | ||
1144 | { | ||
1145 | static char* options[] = {"off", "on", "ask","recent only - yes","recent only - ask"}; | ||
1146 | set_cfg_option(&global_settings.autocreatebookmark, value, options, 5); | ||
1147 | } | ||
1148 | else if (!strcasecmp(name, "use most-recent-bookmarks")) | ||
1149 | { | ||
1150 | static char* options[] = {"off", "on", "unique only"}; | ||
1151 | set_cfg_option(&global_settings.usemrb, value, options, 3); | ||
1152 | } | ||
1131 | } | 1153 | } |
1132 | 1154 | ||
1133 | close(fd); | 1155 | close(fd); |
@@ -1143,6 +1165,7 @@ bool settings_save_config(void) | |||
1143 | int fd, i, value; | 1165 | int fd, i, value; |
1144 | char filename[MAX_PATH]; | 1166 | char filename[MAX_PATH]; |
1145 | char* boolopt[] = {"off","on"}; | 1167 | char* boolopt[] = {"off","on"}; |
1168 | char* triopt[] = {"off","on","ask"}; | ||
1146 | 1169 | ||
1147 | /* find unused filename */ | 1170 | /* find unused filename */ |
1148 | for (i=0; ; i++) { | 1171 | for (i=0; ; i++) { |
@@ -1431,11 +1454,27 @@ bool settings_save_config(void) | |||
1431 | 1454 | ||
1432 | #endif | 1455 | #endif |
1433 | 1456 | ||
1457 | fprintf(fd, "#\r\n# Bookmarking\r\n#\r\n"); | ||
1458 | { | ||
1459 | fprintf(fd, "autoload bookmarks: %s\r\n", | ||
1460 | triopt[global_settings.autoloadbookmark]); | ||
1461 | } | ||
1462 | |||
1463 | { | ||
1464 | static char* options[] = {"off", "on", "ask","recent only - on", "recent only - ask"}; | ||
1465 | fprintf(fd, "autocreate bookmarks: %s\r\n", | ||
1466 | options[global_settings.autocreatebookmark]); | ||
1467 | } | ||
1468 | |||
1469 | { | ||
1470 | static char* options[] = {"off", "on", "unique only"}; | ||
1471 | fprintf(fd, "UseMRB: %s\r\n", options[global_settings.usemrb]); | ||
1472 | } | ||
1473 | |||
1434 | fprintf(fd, "#\r\n# Playlists\r\n#\r\n"); | 1474 | fprintf(fd, "#\r\n# Playlists\r\n#\r\n"); |
1435 | { | 1475 | { |
1436 | static char* options[] = {"off", "on", "ask"}; | ||
1437 | fprintf(fd, "recursive directory insert: %s\r\n", | 1476 | fprintf(fd, "recursive directory insert: %s\r\n", |
1438 | options[global_settings.recursive_dir_insert]); | 1477 | triopt[global_settings.recursive_dir_insert]); |
1439 | } | 1478 | } |
1440 | 1479 | ||
1441 | close(fd); | 1480 | close(fd); |
@@ -1528,6 +1567,9 @@ void settings_reset(void) { | |||
1528 | global_settings.lang_file[0] = 0; | 1567 | global_settings.lang_file[0] = 0; |
1529 | global_settings.runtime = 0; | 1568 | global_settings.runtime = 0; |
1530 | global_settings.topruntime = 0; | 1569 | global_settings.topruntime = 0; |
1570 | global_settings.autocreatebookmark = BOOKMARK_NO; | ||
1571 | global_settings.autoloadbookmark = BOOKMARK_NO; | ||
1572 | global_settings.usemrb = BOOKMARK_NO; | ||
1531 | global_settings.fade_on_stop = true; | 1573 | global_settings.fade_on_stop = true; |
1532 | global_settings.caption_backlight = false; | 1574 | global_settings.caption_backlight = false; |
1533 | global_settings.car_adapter_mode = false; | 1575 | global_settings.car_adapter_mode = false; |