/* * Does the actions associated to the given button if any * - qs : the quickscreen * - button : the key we are going to analyse * returns : true if the button corresponded to an action, false otherwise */ static bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button) { int item; bool invert = false; switch(button) { case ACTION_QS_TOP: invert = true; item = QUICKSCREEN_TOP; break; case ACTION_QS_LEFT: invert = true; item = QUICKSCREEN_LEFT; break; case ACTION_QS_DOWN: item = QUICKSCREEN_BOTTOM; break; case ACTION_QS_RIGHT: item = QUICKSCREEN_RIGHT; break; default: return false; } if (qs->items[item] == NULL) return false; option_select_next_val(qs->items[item], invert, true); talk_qs_option(qs->items[item], false); return true; }
/* * Does the actions associated to the given button if any * - qs : the quickscreen * - button : the key we are going to analyse * returns : true if the button corresponded to an action, false otherwise */ static bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button) { int item; bool invert = false; switch(button) { case ACTION_QS_TOP: invert = true; item = QUICKSCREEN_TOP; break; case ACTION_QS_LEFT: invert = true; item = QUICKSCREEN_LEFT; break; case ACTION_QS_DOWN: item = QUICKSCREEN_BOTTOM; break; case ACTION_QS_RIGHT: item = QUICKSCREEN_RIGHT; break; default: return false; } if (qs->items[item] == NULL) return false; #ifdef ASCENDING_INT_SETTINGS if (((qs->items[item]->flags & F_INT_SETTING) == F_INT_SETTING) && ( button == ACTION_QS_DOWN || button == ACTION_QS_TOP)) { invert = !invert; } #endif option_select_next_val(qs->items[item], invert, true); talk_qs_option(qs->items[item], false); return true; }
static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter) { int button, i, j; struct viewport parent[NB_SCREENS]; struct viewport vps[NB_SCREENS][QUICKSCREEN_ITEM_COUNT]; struct viewport vp_icons[NB_SCREENS]; bool changed = false; /* To quit we need either : * - a second press on the button that made us enter * - an action taken while pressing the enter button, * then release the enter button*/ bool can_quit = false; FOR_NB_SCREENS(i) { screens[i].set_viewport(NULL); screens[i].stop_scroll(); viewportmanager_theme_enable(i, true, &parent[i]); quickscreen_fix_viewports(qs, &screens[i], &parent[i], vps[i], &vp_icons[i]); gui_quickscreen_draw(qs, &screens[i], &parent[i], vps[i], &vp_icons[i]); } /* Announce current selection on entering this screen. This is all queued up, but can be interrupted as soon as a setting is changed. */ cond_talk_ids(VOICE_QUICKSCREEN); talk_qs_option(qs->items[QUICKSCREEN_TOP], true); talk_qs_option(qs->items[QUICKSCREEN_LEFT], true); talk_qs_option(qs->items[QUICKSCREEN_BOTTOM], true); talk_qs_option(qs->items[QUICKSCREEN_RIGHT], true); while (true) { button = get_action(CONTEXT_QUICKSCREEN, HZ/5); #ifdef HAVE_TOUCHSCREEN if (button == ACTION_TOUCHSCREEN) button = quickscreen_touchscreen_button(vps[SCREEN_MAIN]); #endif if (default_event_handler(button) == SYS_USB_CONNECTED) return(true); if (gui_quickscreen_do_button(qs, button)) { changed = true; can_quit = true; FOR_NB_SCREENS(i) gui_quickscreen_draw(qs, &screens[i], &parent[i], vps[i], &vp_icons[i]); if (qs->callback) qs->callback(qs); } else if (button == button_enter) can_quit = true; if ((button == button_enter) && can_quit) break; if (button == ACTION_STD_CANCEL) break; } /* Notify that we're exiting this screen */ cond_talk_ids_fq(VOICE_OK); FOR_NB_SCREENS(i) { /* stop scrolling before exiting */ for (j = 0; j < QUICKSCREEN_ITEM_COUNT; j++) screens[i].scroll_stop(&vps[i][j]); viewportmanager_theme_undo(i, true); } return changed; }