diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-04-15 22:16:28 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-04-15 22:16:28 +0000 |
commit | ce05addf52ed784026d9ca8397f3c2e239ff9ed4 (patch) | |
tree | 2371e53a613848849ed7ada266b92c26fb3542d2 /apps/settings.c | |
parent | 49cf05cb91c9160b79323bb8c798604b3cd8e2f2 (diff) | |
download | rockbox-ce05addf52ed784026d9ca8397f3c2e239ff9ed4.tar.gz rockbox-ce05addf52ed784026d9ca8397f3c2e239ff9ed4.zip |
Revert recording/repeat timer for now. It is useful as a feature, but didn't receive enough testing on multiple targets, and fixing it is non-trivial. Later reversal would be complicated because of .lng spreading. * The patch should probably redone in a different way, as it's huge for what it does... * Issues: (1) The repeat timer setting has NULL pointer hits. (2) The multi-int setting screen breaks with proportional fonts, and with somewhat larger fonts. (3) On some targets, all values except the leftmost one are unreachable. * Hint: The timer itself would be much simpler if it'd just store & compare ticks (497 days before it wraps).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13172 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/settings.c')
-rw-r--r-- | apps/settings.c | 188 |
1 files changed, 0 insertions, 188 deletions
diff --git a/apps/settings.c b/apps/settings.c index e8963b05df..23b81173bd 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -1245,194 +1245,6 @@ bool set_int(const unsigned char* string, | |||
1245 | return set_int_ex(string, unit, voice_unit, variable, function, | 1245 | return set_int_ex(string, unit, voice_unit, variable, function, |
1246 | step, min, max, formatter, NULL); | 1246 | step, min, max, formatter, NULL); |
1247 | } | 1247 | } |
1248 | |||
1249 | /* Useful for time and other multi integer settings */ | ||
1250 | bool set_multi_int(const char* string, | ||
1251 | const struct opt_items * names, | ||
1252 | struct opt_settings * variable, | ||
1253 | int varcount, | ||
1254 | bool *changes_accepted) | ||
1255 | { | ||
1256 | int i, j, w, h; | ||
1257 | char buf[32]; | ||
1258 | long button; | ||
1259 | int cursor = 0; | ||
1260 | bool done = false; | ||
1261 | int value[varcount]; | ||
1262 | int pos = 0; | ||
1263 | |||
1264 | /* store current values in temp array */ | ||
1265 | for(j = 0; j < varcount; j++) | ||
1266 | value[j] = *(int*)variable[j].setting; | ||
1267 | |||
1268 | /* initialize screen */ | ||
1269 | FOR_NB_SCREENS(i) | ||
1270 | { | ||
1271 | screens[i].clear_display(); | ||
1272 | #ifdef HAVE_LCD_BITMAP | ||
1273 | screens[i].setmargins(0, 8); | ||
1274 | #endif | ||
1275 | } | ||
1276 | |||
1277 | gui_syncstatusbar_draw(&statusbars, true); | ||
1278 | |||
1279 | FOR_NB_SCREENS(i) | ||
1280 | screens[i].getstringsize("3", &w, &h); | ||
1281 | |||
1282 | /* print title */ | ||
1283 | snprintf(buf, sizeof(buf), "%s", string); | ||
1284 | FOR_NB_SCREENS(i) | ||
1285 | screens[i].puts(0, 0, buf); | ||
1286 | |||
1287 | /* print variable names */ | ||
1288 | for(j = 0; j < varcount ; j++) | ||
1289 | { | ||
1290 | if (j > 0) | ||
1291 | { | ||
1292 | snprintf(buf, sizeof(buf), ":"); | ||
1293 | FOR_NB_SCREENS(i) | ||
1294 | screens[i].puts(pos - 2, 1, buf); | ||
1295 | } | ||
1296 | |||
1297 | snprintf(buf, sizeof(buf), "%s", P2STR(names[j].string)); | ||
1298 | FOR_NB_SCREENS(i) | ||
1299 | screens[i].puts(pos, 1, buf); | ||
1300 | |||
1301 | pos += strlen(buf) + 3; | ||
1302 | } | ||
1303 | |||
1304 | /* print button instructions */ | ||
1305 | snprintf(buf, sizeof(buf), "%s", str(LANG_MULTIINT_CONFIRM)); | ||
1306 | FOR_NB_SCREENS(i) | ||
1307 | screens[i].puts(0, 5, buf); | ||
1308 | |||
1309 | while(!done) | ||
1310 | { | ||
1311 | pos = 0; | ||
1312 | |||
1313 | /* print variables */ | ||
1314 | for(j = 0; j < varcount; j++) | ||
1315 | { | ||
1316 | if (j > 0) | ||
1317 | { | ||
1318 | snprintf(buf, sizeof(buf), " :"); | ||
1319 | FOR_NB_SCREENS(i) | ||
1320 | screens[i].puts(pos - 3, 3, buf); | ||
1321 | } | ||
1322 | |||
1323 | snprintf(buf, sizeof(buf), "%d", value[j]); | ||
1324 | |||
1325 | FOR_NB_SCREENS(i) | ||
1326 | screens[i].puts(pos, 3, buf); | ||
1327 | |||
1328 | snprintf(buf, sizeof(buf), "%d", variable[j].setting_max); | ||
1329 | |||
1330 | #ifdef HAVE_LCD_BITMAP | ||
1331 | /* highlight currently selected integer */ | ||
1332 | if (cursor == j) | ||
1333 | { | ||
1334 | FOR_NB_SCREENS(i) | ||
1335 | { | ||
1336 | screens[i].set_drawmode(DRMODE_COMPLEMENT); | ||
1337 | screens[i].fillrect(pos * w - 1, 8 + 3 * h, | ||
1338 | strlen(buf)*w + 1, h); | ||
1339 | screens[i].set_drawmode(DRMODE_SOLID); | ||
1340 | } | ||
1341 | } | ||
1342 | #endif | ||
1343 | |||
1344 | pos += strlen(buf) + 3; | ||
1345 | } | ||
1346 | |||
1347 | #ifdef HAVE_LCD_BITMAP | ||
1348 | FOR_NB_SCREENS(i) | ||
1349 | screens[i].update(); | ||
1350 | #endif | ||
1351 | |||
1352 | button = get_action(CONTEXT_SETTINGS, TIMEOUT_BLOCK); | ||
1353 | |||
1354 | switch (button) | ||
1355 | { | ||
1356 | case ACTION_STD_NEXT: | ||
1357 | cursor ++; | ||
1358 | |||
1359 | if (cursor >= varcount) | ||
1360 | cursor = varcount - 1; | ||
1361 | |||
1362 | if (global_settings.talk_menu) | ||
1363 | talk_id(names[cursor].voice_id, false); | ||
1364 | break; | ||
1365 | |||
1366 | case ACTION_STD_PREV: | ||
1367 | /* cancel if pressing left when cursor | ||
1368 | is already at the far left */ | ||
1369 | if (cursor == 0) | ||
1370 | { | ||
1371 | *changes_accepted = false; | ||
1372 | gui_syncsplash(HZ/2, str(LANG_MENU_SETTING_CANCEL)); | ||
1373 | done = true; | ||
1374 | } | ||
1375 | else | ||
1376 | { | ||
1377 | cursor --; | ||
1378 | |||
1379 | if (cursor < 0) | ||
1380 | cursor = 0; | ||
1381 | |||
1382 | if (global_settings.talk_menu) | ||
1383 | talk_id(names[cursor].voice_id, false); | ||
1384 | } | ||
1385 | break; | ||
1386 | |||
1387 | case ACTION_SETTINGS_INC: | ||
1388 | case ACTION_SETTINGS_INCREPEAT: | ||
1389 | value[cursor] += 1; | ||
1390 | |||
1391 | if (value[cursor] > variable[cursor].setting_max) | ||
1392 | value[cursor] = 0; | ||
1393 | |||
1394 | if (global_settings.talk_menu) | ||
1395 | talk_unit(INT, value[cursor], NULL); | ||
1396 | break; | ||
1397 | |||
1398 | case ACTION_SETTINGS_DEC: | ||
1399 | case ACTION_SETTINGS_DECREPEAT: | ||
1400 | value[cursor] -= 1; | ||
1401 | |||
1402 | if (value[cursor] < 0) | ||
1403 | value[cursor] = variable[cursor].setting_max; | ||
1404 | |||
1405 | if (global_settings.talk_menu) | ||
1406 | talk_unit(INT, value[cursor], NULL); | ||
1407 | break; | ||
1408 | |||
1409 | case ACTION_STD_OK: | ||
1410 | *changes_accepted = true; | ||
1411 | done = true; | ||
1412 | break; | ||
1413 | |||
1414 | case ACTION_STD_CANCEL: | ||
1415 | *changes_accepted = false; | ||
1416 | gui_syncsplash(HZ/2, str(LANG_MENU_SETTING_CANCEL)); | ||
1417 | done = true; | ||
1418 | |||
1419 | default: | ||
1420 | if (default_event_handler(button) == SYS_USB_CONNECTED) | ||
1421 | return true; | ||
1422 | } | ||
1423 | } | ||
1424 | /* store values if accepted */ | ||
1425 | if(*changes_accepted) | ||
1426 | { | ||
1427 | for(j = 0; j < varcount; j++) | ||
1428 | *(int*)variable[j].setting = value[j]; | ||
1429 | } | ||
1430 | |||
1431 | action_signalscreenchange(); | ||
1432 | |||
1433 | return false; | ||
1434 | } | ||
1435 | |||
1436 | /* NOTE: the 'type' parameter specifies the actual type of the variable | 1248 | /* NOTE: the 'type' parameter specifies the actual type of the variable |
1437 | that 'variable' points to. not the value within. Only variables with | 1249 | that 'variable' points to. not the value within. Only variables with |
1438 | type 'bool' should use parameter BOOL. | 1250 | type 'bool' should use parameter BOOL. |