From 0728b6a89de607e211bbc075b34f08495ac0d22f Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 23 Jul 2011 20:22:53 +0200 Subject: Added toggle to quickmix menu Closes #141 --- src/ui.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/ui.c') diff --git a/src/ui.c b/src/ui.c index ab22f8a..25dee66 100644 --- a/src/ui.c +++ b/src/ui.c @@ -330,9 +330,11 @@ static PianoStation_t **BarSortedStations (PianoStation_t *unsortedStations, /* let user pick one station * @param app handle * @param prompt string + * @param called if input was not a number * @return pointer to selected station or NULL */ -PianoStation_t *BarUiSelectStation (BarApp_t *app, const char *prompt) { +PianoStation_t *BarUiSelectStation (BarApp_t *app, const char *prompt, + BarUiSelectStationCallback_t callback) { PianoStation_t **sortedStations = NULL, *retStation = NULL; size_t stationCount, i; char buf[100]; @@ -351,6 +353,7 @@ PianoStation_t *BarUiSelectStation (BarApp_t *app, const char *prompt) { do { for (i = 0; i < stationCount; i++) { const PianoStation_t *currStation = sortedStations[i]; + /* filter stations */ if (BarStrCaseStr (currStation->name, buf) != NULL) { BarUiMsg (&app->settings, MSG_LIST, "%2i) %c%c%c %s\n", i, currStation->useQuickMix ? 'q' : ' ', @@ -373,6 +376,11 @@ PianoStation_t *BarUiSelectStation (BarApp_t *app, const char *prompt) { retStation = sortedStations[selected]; } } + + /* hand over buffer to external function if it was not a station number */ + if (retStation == NULL && callback != NULL) { + callback (app, buf); + } } while (retStation == NULL); free (sortedStations); -- cgit v1.2.3