diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/eq_menu.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/apps/eq_menu.c b/apps/eq_menu.c index a74fddb05a..80cdec3f65 100644 --- a/apps/eq_menu.c +++ b/apps/eq_menu.c | |||
@@ -364,22 +364,40 @@ static int draw_eq_slider(struct screen * screen, int x, int y, | |||
364 | { | 364 | { |
365 | char buf[26]; | 365 | char buf[26]; |
366 | const char separator[2] = " "; | 366 | const char separator[2] = " "; |
367 | int steps = EQ_GAIN_MAX - EQ_GAIN_MIN; | 367 | int steps, min_item, max_item; |
368 | int abs_q = abs(q); | ||
369 | int abs_gain = abs(gain); | 368 | int abs_gain = abs(gain); |
370 | int current_x, total_height, separator_width, separator_height; | 369 | int current_x, total_height, separator_width, separator_height; |
371 | int w, h; | 370 | int w, h; |
372 | const int slider_height = 6; | 371 | const int slider_height = 6; |
373 | 372 | ||
373 | switch(mode) { | ||
374 | case Q: | ||
375 | steps = EQ_Q_MAX - EQ_Q_MIN; | ||
376 | min_item = q - EQ_Q_STEP - EQ_Q_MIN; | ||
377 | max_item = q + EQ_Q_STEP - EQ_Q_MIN; | ||
378 | break; | ||
379 | case CUTOFF: | ||
380 | steps = EQ_CUTOFF_MAX - EQ_CUTOFF_MIN; | ||
381 | min_item = cutoff - EQ_CUTOFF_FAST_STEP * 2; | ||
382 | max_item = cutoff + EQ_CUTOFF_FAST_STEP * 2; | ||
383 | break; | ||
384 | case GAIN: | ||
385 | default: | ||
386 | steps = EQ_GAIN_MAX - EQ_GAIN_MIN; | ||
387 | min_item = abs(EQ_GAIN_MIN) + gain - EQ_GAIN_STEP * 5; | ||
388 | max_item = abs(EQ_GAIN_MIN) + gain + EQ_GAIN_STEP * 5; | ||
389 | break; | ||
390 | } | ||
391 | |||
374 | /* Start two pixels in, one for border, one for margin */ | 392 | /* Start two pixels in, one for border, one for margin */ |
375 | current_x = x + 2; | 393 | current_x = x + 2; |
376 | 394 | ||
377 | /* Figure out how large our separator string is */ | 395 | /* Figure out how large our separator string is */ |
378 | screen->getstringsize(separator, &separator_width, &separator_height); | 396 | screen->getstringsize(separator, &separator_width, &separator_height); |
379 | 397 | ||
380 | /* Total height includes margins, text, and line selector */ | 398 | /* Total height includes margins, text, and line selector */ |
381 | total_height = separator_height + slider_height + 2 + 3; | 399 | total_height = separator_height + slider_height + 2 + 3; |
382 | 400 | ||
383 | /* Print out the band label */ | 401 | /* Print out the band label */ |
384 | if (type == LOW_SHELF) { | 402 | if (type == LOW_SHELF) { |
385 | screen->putsxy(current_x, y + 2, "LS:"); | 403 | screen->putsxy(current_x, y + 2, "LS:"); |
@@ -408,18 +426,18 @@ static int draw_eq_slider(struct screen * screen, int x, int y, | |||
408 | screen->putsxy(current_x, y + 2, buf); | 426 | screen->putsxy(current_x, y + 2, buf); |
409 | screen->getstringsize(buf, &w, &h); | 427 | screen->getstringsize(buf, &w, &h); |
410 | current_x += w; | 428 | current_x += w; |
411 | 429 | ||
412 | /* Print separator */ | 430 | /* Print separator */ |
413 | screen->set_drawmode(DRMODE_SOLID); | 431 | screen->set_drawmode(DRMODE_SOLID); |
414 | screen->putsxy(current_x, y + 2, separator); | 432 | screen->putsxy(current_x, y + 2, separator); |
415 | current_x += separator_width; | 433 | current_x += separator_width; |
416 | 434 | ||
417 | /* Print out cutoff part of status line */ | 435 | /* Print out cutoff part of status line */ |
418 | snprintf(buf, sizeof(buf), "%5dHz", cutoff); | 436 | snprintf(buf, sizeof(buf), "%5dHz", cutoff); |
419 | 437 | ||
420 | if (mode == CUTOFF && selected) | 438 | if (mode == CUTOFF && selected) |
421 | screen->set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID); | 439 | screen->set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID); |
422 | 440 | ||
423 | screen->putsxy(current_x, y + 2, buf); | 441 | screen->putsxy(current_x, y + 2, buf); |
424 | screen->getstringsize(buf, &w, &h); | 442 | screen->getstringsize(buf, &w, &h); |
425 | current_x += w; | 443 | current_x += w; |
@@ -430,8 +448,8 @@ static int draw_eq_slider(struct screen * screen, int x, int y, | |||
430 | current_x += separator_width; | 448 | current_x += separator_width; |
431 | 449 | ||
432 | /* Print out Q part of status line */ | 450 | /* Print out Q part of status line */ |
433 | snprintf(buf, sizeof(buf), "%d.%d Q", abs_q / EQ_USER_DIVISOR, | 451 | snprintf(buf, sizeof(buf), "%d.%d Q", q / EQ_USER_DIVISOR, |
434 | abs_q % EQ_USER_DIVISOR); | 452 | q % EQ_USER_DIVISOR); |
435 | 453 | ||
436 | if (mode == Q && selected) | 454 | if (mode == Q && selected) |
437 | screen->set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID); | 455 | screen->set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID); |
@@ -449,8 +467,7 @@ static int draw_eq_slider(struct screen * screen, int x, int y, | |||
449 | 467 | ||
450 | /* Draw horizontal slider. Reuse scrollbar for this */ | 468 | /* Draw horizontal slider. Reuse scrollbar for this */ |
451 | gui_scrollbar_draw(screen, x + 3, y + h + 3, width - 6, slider_height, steps, | 469 | gui_scrollbar_draw(screen, x + 3, y + h + 3, width - 6, slider_height, steps, |
452 | abs(EQ_GAIN_MIN) + gain - 10, abs(EQ_GAIN_MIN) + gain + 10, | 470 | min_item, max_item, HORIZONTAL); |
453 | HORIZONTAL); | ||
454 | 471 | ||
455 | return total_height; | 472 | return total_height; |
456 | } | 473 | } |