Beispiel #1
0
void _controls_push(state_stack* stack, void* udata) {
	(void) udata;
	state_desc mm = {
		GAME_SETTINGS_CONTROLS, nullptr,
		nullptr, nullptr,
		&_event_controls,
		nullptr,
		&_draw_controls,
		&_destroy_controls,
		nullptr, nullptr, false,
	};
	
	_controls_menu *data = (_controls_menu*) malloc(sizeof(_controls_menu));
	
	data->m_iWhichBinding = -1;
	
	menu *pCmdMenu = menu_init(200, 50);
	menu_add_entry(pCmdMenu, "Set Controls");
	menu_add_entry(pCmdMenu, "Restore Defaults");
	menu_add_entry(pCmdMenu, STR_ARROWBIG_LEFT " Back");
	menu_auto_resize(pCmdMenu);
	data->m_cmdMenu = pCmdMenu;
	
	menu *pBindMenu = menu_init(0, 0);
	pBindMenu->m_iCursorPos = -1;
	menu_add_entry(pBindMenu, STR_ARROW_UP "    ");
	menu_add_entry(pBindMenu, STR_ARROW_DOWN "    ");
	menu_add_entry(pBindMenu, STR_ARROW_LEFT "    ");
	menu_add_entry(pBindMenu, STR_ARROW_RIGHT "    ");
	menu_add_entry(pBindMenu, "OK   ");
	menu_auto_resize(pBindMenu);
	data->m_bindingsMenu = pBindMenu;
	
	pCmdMenu->m_iHeight = pBindMenu->m_iHeight;
	pBindMenu->m_iWidth *= 8;
	pBindMenu->m_iX = pCmdMenu->m_iX + pCmdMenu->m_iWidth + 6;
	pBindMenu->m_iY = pCmdMenu->m_iY;
	
	data->m_aControls[0] = _find_control_bind(IN_DIRUP);
	data->m_aControls[1] = _find_control_bind(IN_DIRDOWN);
	data->m_aControls[2] = _find_control_bind(IN_DIRLEFT);
	data->m_aControls[3] = _find_control_bind(IN_DIRRIGHT);
	data->m_aControls[4] = _find_control_bind(IN_OK);
	_update_bind_desc(data);
	
	data->m_capturingBindings = false;
	
	data->m_iJoyAxes = input_joystick_num_axes();
	data->m_bIgnoreAxes = (bool*) calloc(data->m_iJoyAxes, sizeof(bool));
	
	mm.m_pData = data;
	table_append(stack, &mm);
}
Beispiel #2
0
void vmivr_menu_authenticate(switch_core_session_t *session, vmivr_profile_t *profile) {
	switch_channel_t *channel = switch_core_session_get_channel(session);
	vmivr_menu_t menu = { "std_authenticate" };
	int retry;
	const char *auth_var = NULL;
	/* Initialize Menu Configs */
	menu_init(profile, &menu);

	if (profile->id && (auth_var = switch_channel_get_variable(channel, "voicemail_authorized")) && switch_true(auth_var)) {
		profile->authorized = SWITCH_TRUE;
	}

	for (retry = menu.ivr_maximum_attempts; switch_channel_ready(channel) && retry > 0 && profile->authorized == SWITCH_FALSE; retry--) {
		const char *id = profile->id, *password = NULL;
		char *cmd = NULL;
		const char *password_mask = switch_event_get_header(menu.event_settings, "Password-Mask");
		const char *user_mask = switch_event_get_header(menu.event_settings, "User-Mask");
		if (!id) {
			vmivr_menu_t sub_menu = { "std_authenticate_ask_user" };
			/* Initialize Menu Configs */
			menu_init(profile, &sub_menu);

			switch_event_add_header(sub_menu.phrase_params, SWITCH_STACK_BOTTOM, "IVR-Retry-Left", "%d", retry);

			id = vmivr_menu_get_input_set(session, profile, &sub_menu, user_mask);
			menu_free(&sub_menu);
		}
		if (!password) {
			vmivr_menu_t sub_menu = { "std_authenticate_ask_password" };
			/* Initialize Menu Configs */
			menu_init(profile, &sub_menu);

			switch_event_add_header(sub_menu.phrase_params, SWITCH_STACK_BOTTOM, "IVR-Retry-Left", "%d", retry);

			password = vmivr_menu_get_input_set(session, profile, &sub_menu, password_mask);
			menu_free(&sub_menu);
		}
		cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, id, password);

		if (vmivr_api_execute(session, profile->api_auth_login, cmd) == SWITCH_STATUS_SUCCESS) {
			profile->id = id;
			profile->authorized = SWITCH_TRUE;
		} else {
			ivre_playback_dtmf_buffered(session, switch_event_get_header(menu.event_phrases, "fail_auth"), NULL, NULL, NULL, 0);
		}
	}
	menu_free(&menu);
}
Beispiel #3
0
/*
 * Display a list of commands.
 */
static bool cmd_menu(command_list *list, void *selection_p)
{
	menu_type menu;
	menu_iter commands_menu = { NULL, NULL, cmd_sub_entry, NULL, NULL };
	region area = { 23, 4, 37, 13 };

	ui_event evt;
	struct cmd_info **selection = selection_p;

	/* Set up the menu */
	menu_init(&menu, MN_SKIN_SCROLL, &commands_menu);
	menu_setpriv(&menu, list->len, list->list);
	menu_layout(&menu, &area);

	/* Set up the screen */
	screen_save();
	window_make(21, 3, 62, 17);

	/* Select an entry */
	evt = menu_select(&menu, 0, TRUE);

	/* Load de screen */
	screen_load();

	if (evt.type == EVT_SELECT)
		*selection = &list->list[menu.cursor];

	return FALSE;
}
Beispiel #4
0
/*
 * Display quality squelch menu.
 */
static void quality_menu(void *unused, const char *also_unused)
{
	menu_type menu;
	menu_iter menu_f = { NULL, NULL, quality_display, quality_action };
	region area = { 1, 5, -1, -1 };

	/* Save screen */
	screen_save();
	clear_from(0);

	/* Help text */
	prt("Quality squelch menu", 0, 0);

	Term_gotoxy(1, 1);
	text_out_to_screen(TERM_L_RED, "Use the movement keys to navigate, and Enter to change settings.");

	/* Set up the menu */
	menu_init(&menu, MN_SKIN_SCROLL, &menu_f);
	menu_setpriv(&menu, TYPE_MAX, quality_values);
	menu_layout(&menu, &area);

	/* Select an entry */
	menu_select(&menu, 0);

	/* Load screen */
	screen_load();
	return;
}
Beispiel #5
0
void get_ready(void)
{
	menu_init();
#if DEBUG	
	uart_puts_p(PSTR("menu_init() Completed! \n"));
#endif

	LED_on(LED_0);
	LED_on(LED_1);
	LED_on(LED_2);
	LED_on(LED_3);
	
	set_screen(SPLASH_SCN);
	_delay_ms(2000);
	
	gps_set_arg();
	
	LED_off(LED_0);
	LED_off(LED_1);
	LED_off(LED_2);
	LED_off(LED_3);
	
	set_screen(READY_SCN);
	menu_start();	
}
static bool system_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
        { ID2P(LANG_BATTERY_MENU),     battery_settings_menu },
#ifndef HAVE_MMC
        { ID2P(LANG_DISK_MENU),        disk_settings_menu     },
#endif
#ifdef HAVE_RTC
        { ID2P(LANG_TIME_MENU),        time_settings_menu     },
#endif
        { ID2P(LANG_POWEROFF_IDLE),    poweroff_idle_timer    },
        { ID2P(LANG_SLEEP_TIMER),      sleeptimer_screen      },
#ifdef HAVE_ALARM_MOD
        { ID2P(LANG_ALARM_MOD_ALARM_MENU), alarm_screen       },
#endif
        { ID2P(LANG_LIMITS_MENU),      limits_settings_menu   },
#if CONFIG_CODEC == MAS3507D
        { ID2P(LANG_LINE_IN),          line_in                },
#endif
#ifdef HAVE_CHARGING
        { ID2P(LANG_CAR_ADAPTER_MODE), car_adapter_mode       },
#endif
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
static void browser_action(unsigned short userChoice)
{
	current_file = browser_entries[userChoice].full_name;
	if(strncmp(current_file, ".", strlen(current_file)) == 0 ||
			strncmp(current_file, "..", strlen(current_file)) == 0)
		return;

	browser_menu = menu_init(browser_wid, browser_entries[userChoice].name,
			0, 0, screen_info.cols, screen_info.rows -
			(HEADER_TOPLINE + 1), browser_menu, NULL, ASCII);

	switch (browser_entries[userChoice].type) {
	case FILE_TYPE_DIRECTORY:
		break;
	case FILE_TYPE_PROGRAM:
		menu_add_item(browser_menu, _("Pipe output to textviewer"),
				browser_pipe_exec, 0, ACTION_MENU |
				SUB_MENU_PREV);
	case FILE_TYPE_OTHER:
		if(access("/bin/viP", X_OK) == 0)
			menu_add_item(browser_menu, _("Open with viP"),
					browser_vip_open_file, 0, ACTION_MENU |
					SUB_MENU_PREV);
			menu_add_item(browser_menu, _("Open with PodWrite"),
					browser_podwrite_open_file, 0, ACTION_MENU |
					SUB_MENU_PREV);
		break;
	}
	menu_add_item(browser_menu, _("Delete"),  browser_delete_confirm, 0,
			ACTION_MENU | ARROW_MENU);
	menu_add_item(browser_menu, _("Rename"),  browser_rename, 0,
			ACTION_MENU);
}
Beispiel #8
0
void textui_knowledge_init(void)
{
	/* Initialize the menus */
	menu_type *menu = &knowledge_menu;
	menu_init(menu, MN_SKIN_SCROLL, menu_find_iter(MN_ITER_ACTIONS));
	menu_setpriv(menu, N_ELEMENTS(knowledge_actions), knowledge_actions);

	menu->title = "Display current knowledge";
	menu->selections = lower_case;

	/* initialize other static variables */
	if (!obj_group_order) {
		int i;
		int gid = -1;

		obj_group_order = C_ZNEW(TV_GOLD + 1, int);
		atexit(cleanup_cmds);

		/* Allow for missing values */
		for (i = 0; i <= TV_GOLD; i++)
			obj_group_order[i] = -1;

		for (i = 0; 0 != object_text_order[i].tval; i++) {
			if (object_text_order[i].name)
				gid = i;
			obj_group_order[object_text_order[i].tval] = gid;
		}
	}
static bool lcd_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
#ifdef CONFIG_BACKLIGHT
        { ID2P(LANG_BACKLIGHT),       backlight_timer },
#ifdef HAVE_CHARGING
        { ID2P(LANG_BACKLIGHT_ON_WHEN_CHARGING), backlight_on_when_charging },
#endif
        { ID2P(LANG_CAPTION_BACKLIGHT), caption_backlight },
#if CONFIG_BACKLIGHT == BL_IRIVER
        { ID2P(LANG_BACKLIGHT_FADE_IN), backlight_fade_in },
        { ID2P(LANG_BACKLIGHT_FADE_OUT), backlight_fade_out },
#endif
#endif /* CONFIG_BACKLIGHT */
        { ID2P(LANG_CONTRAST),        contrast },
#ifdef HAVE_LCD_BITMAP
        { ID2P(LANG_INVERT),          invert },
        { ID2P(LANG_FLIP_DISPLAY),    flip_display },
        { ID2P(LANG_INVERT_CURSOR),   invert_cursor },
#endif
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
Beispiel #10
0
void settings_menu_push(state_stack* stack, void* udata) {
	(void) udata;
	state_desc mm = {
		GAME_SETTINGS_MENU, nullptr,
		nullptr, nullptr,
		&_event,
		nullptr,
		&_draw,
		&_destroy,
		nullptr, nullptr, false,
	};
	
	_settings_menu *data = (_settings_menu*) malloc(sizeof(_settings_menu));
	
	menu *pMenu = menu_init(100, 50);
	menu_add_entry(pMenu, "Controls");
	menu_add_entry(pMenu, "");
	menu_add_entry(pMenu, STR_ARROWBIG_LEFT " Save Settings");
	menu_add_entry(pMenu, STR_ARROWBIG_LEFT " Discard Changes");
	menu_auto_resize(pMenu);
	data->m_menu = pMenu;
	
	data->m_settings = settings_init();
	input_config_settings(data->m_settings, g_keybinds);
	screen_config_settings(data->m_settings, nullptr);
	settings_load(data->m_settings, settings_file_path);
	
	mm.m_pData = data;
	table_append(stack, &mm);
}
Beispiel #11
0
int main(int argc, const char *argv[])
{
    menu_init();
    // top bar
    menu_setvalue("NO McASP", OFFSET(0, 18), 8);    // McASP
#ifdef DEBUG
        menu_setvalue("1025", OFFSET(0, 79), 6); // inits
#endif
    // audio input
    menu_setvalue("E1",  OFFSET(2, COL1), 2);       // input reg
    menu_setvalue("off", OFFSET(4, COL1), 3);       // loopback
    menu_setvalue("22",  OFFSET(5, COL1), 3);       // gain
    menu_setvalue("med",    OFFSET(6, COL1), 3);    // bias
    // audio output
    menu_setvalue("G3",  OFFSET(2, COL3), 2);   // output reg
    menu_setvalue("0",  OFFSET(4, COL3), 1);    // enable1
    menu_setvalue("1",  OFFSET(5, COL3), 1);    // enable2
    menu_setvalue("36",  OFFSET(6, COL3), 2);   // gain1
    menu_setvalue("0",  OFFSET(7, COL3), 2);   // gain2
    menu_setvalue("DC",  OFFSET(8, COL3), 2);   // coupling1
    menu_setvalue("AC",  OFFSET(9, COL3), 2);   // coupling2

    menu_print(OFFSET(6, COL1), 3, "%3f", 3.1415);

    printf("%s\n", menu_copy);

    return 0;
}
Beispiel #12
0
/*
 * Have the player decide, before the game is started, if they are playing NPP Moria or NPPAngband
 */
static void get_game_mode(void)
{
	int cursor = 0;
	ui_event_data c = EVENT_EMPTY;
	const char cmd_keys[] = { ARROW_LEFT, ARROW_RIGHT, '\0' };
	menu_type menu;
	menu_iter menu_f = { tag_game_mode_item , valid_game_mode_item, display_game_mode_item, NULL};

	WIPE(&menu, menu_type);
	menu.cmd_keys = cmd_keys;
	menu.title = "Please select a game to play.";
	menu.count = N_ELEMENTS(game_mode_menu),
	menu_init(&menu, MN_SKIN_SCROLL, &menu_f, &SCREEN_REGION);

	/* Start with a blank screen */
	game_mode = 0;

	while (game_mode == 0)
	{
		clear_from(0);

		c = menu_select(&menu, &cursor, 0);

		if (c.type == EVT_SELECT)
		{
			if ((size_t) cursor < N_ELEMENTS(game_mode_menu))
			{
				game_mode_menu[cursor].action(NULL);
			}
		}
	}

	/* Clear the screen */
	clear_from(0);
}
Beispiel #13
0
/* Set up one of our menus ready to display choices for a birth question.
   This is slightly involved. */
static void init_birth_menu(menu_type *menu, int n_choices, int initial_choice, const region *reg, bool allow_random, browse_f aux)
{
	struct birthmenu_data *menu_data;

	/* A couple of behavioural flags - we want selections letters in
	   lower case and a double tap to act as a selection. */
	menu->selections = lower_case;
	menu->flags = MN_DBL_TAP;

	/* Set the number of choices in the menu to the same as the game
	   has told us we've got to offer. */
	menu->count = n_choices;

	/* Allocate sufficient space for our own bits of menu information. */
	menu_data = mem_alloc(sizeof *menu_data);

	/* Copy across the game's suggested initial selection, etc. */
	menu->cursor = initial_choice;
	menu_data->allow_random = allow_random;

	/* Allocate space for an array of menu item texts and help texts
	   (where applicable) */
	menu_data->items = mem_alloc(menu->count * sizeof *menu_data->items);

	/* Poke our menu data in to the assigned slot in the menu structure. */
	menu->menu_data = menu_data;

	/* Set up the "browse" hook to display help text (where applicable). */
	menu->browse_hook = aux;

	/* Get ui-menu to initialise whatever it wants to to give us a scrollable
	   menu. */
	menu_init(menu, MN_SKIN_SCROLL, &birth_iter, reg);
}
Beispiel #14
0
void init_menu(void)
{
   const char *video_driver;
   driver_t *driver     = driver_get_ptr();

   if (driver->menu)
      return;

   find_menu_driver();

   video_driver = menu_video_get_ident();

   switch (driver->menu_ctx->type)
   {
      case MENU_VIDEO_DRIVER_GENERIC:
         break;
      case MENU_VIDEO_DRIVER_DIRECT3D:
         if (video_driver && (strcmp(video_driver, "d3d") != 0))
            init_menu_fallback();
         break;
      case MENU_VIDEO_DRIVER_OPENGL:
         if (video_driver && (strcmp(video_driver, "gl") != 0))
            init_menu_fallback();
         break;
   }

   if (!(driver->menu = (menu_handle_t*)menu_init(driver->menu_ctx)))
      rarch_fail(1, "init_menu()");

   if (driver->menu_ctx->lists_init)
      if (!driver->menu_ctx->lists_init(driver->menu))
         rarch_fail(1, "init_menu()");
}
Beispiel #15
0
struct view_app *view_app_setup(unsigned int w, unsigned int h)
{

    view_init(&view.base, load, render, keydown);
    box_init(&view.titlebox);
    box_init(&view.shortbox);
    box_init(&view.menubox);
    box_setpartsize(&view.titlebox, w / 10, h / 10, 0, 0, 10, 2);
    box_setpartsize(&view.shortbox, w / 10, h / 10, 0, 1, 10, 6);
    box_setpartsize(&view.menubox, w / 10, h / 10, 0, 6, 10, 4);
    menu_init(&view.menu, view.menuitems, 3);
    menu_inititem(&view.menuitems[0], "Run", 0);
    menu_inititem(&view.menuitems[1], "Install", 0);
    menu_inititem(&view.menuitems[2], "Uninstall", 0);
    menu_setrow(&view.menu, 0);

    view.menu.onselect = menu_onselect;
    view.installview = view_install_setup(w, h);
    view.installview->base.onquit = xinstallview_onquit;
    view.installview->onload = installview_onload;
    view.uninstallview = view_uninstall_setup(w, h);
    view.uninstallview->base.onquit = xinstallview_onquit;
    view.uninstallview->onload = uninstallview_onload;

    return &view;

}
Beispiel #16
0
/**
 * Display list available specialties.
 */
void view_spec_menu(void)
{
    menu_type menu;
    menu_iter menu_f = { view_spec_tag, 0, view_spec_display, 0, 0 };
    region loc = { 0, 0, 70, -99 };
    char buf[80];

    /* Save the screen and clear it */
    screen_save();

    /* Prompt choices */
    sprintf(buf, "Race, class, and specialties abilities (%c-%c, ESC=exit): ",
	    I2A(0), I2A(spec_known - 1));

    /* Set up the menu */
    menu_init(&menu, MN_SKIN_SCROLL, &menu_f);
    menu.header = buf;
    menu_setpriv(&menu, spec_known, spec_list);
    loc.page_rows = spec_known + 1;
    menu.flags = MN_DBL_TAP;
    menu.browse_hook = view_spec_menu_browser;
    region_erase_bordered(&loc);
    menu_layout(&menu, &loc);

    menu_select(&menu, 0);

    /* Load screen */
    screen_load();

    return;
}
Beispiel #17
0
/**
 * Display list items to choose from
 */
ui_event item_menu(cmd_code cmd, int mode)
{
    menu_type menu;
    menu_iter menu_f = {0, 0, get_item_display, get_item_action, 0 };
    ui_event evt = { 0 };

    size_t max_len = Term->wid - 1;

    char selections[40];

    int i;

    /* Set up the menu */
    WIPE(&menu, menu);
    menu_init(&menu, MN_SKIN_SCROLL, &menu_f);
    menu_setpriv(&menu, num_obj, items);
    for (i = 0; i < num_obj; i++)
	selections[i] = items[i].key;
    menu.selections = selections;
    menu.cmd_keys = "/-0123456789";
    get_max_len(&max_len);
    area.page_rows = menu.count + 1;
    area.width = max_len;
    area.col = MIN(Term->wid - 1 - (int) max_len, COL_MAP + tile_width);
    menu_layout(&menu, &area);
    evt = menu_select(&menu, 0, TRUE);

    if (evt.type != EVT_ESCAPE)
    {
	evt.key.code = selection;
    }

    /* Result */
    return (evt);
}
Beispiel #18
0
void highscore_loop() {
  uint64_t ascii = readKeyCode();

  if(ascii == KEY_CODE_ENT) {
    menu_init();
  }
}
Beispiel #19
0
static menu_st *menu_right_transition(menu_st *menulist, item_st *item)
{
	menu_st *m;
	int i, jump;

	GrCopyArea(menulist->transition, menulist->menu_gc, 0, 0,
			menulist->w, menulist->h, menulist->menu_wid,
			menulist->x, menulist->y, 0);
	m = menu_init(menulist->transition, item->text,
			menulist->w, 0, menulist->w, menulist->h,
			menulist, (item_st *)item->action, menulist->op);
	menu_draw(m);

	m->menu_wid = menulist->menu_wid;
	m->x = menulist->x;
	m->y = menulist->y;

	jump = (ipod_get_setting(SLIDE_TRANSIT)) ?
		menulist->w / TRANSITION_STEPS : 0;
	for (i = 0; i < TRANSITION_STEPS; i++) {
		GrCopyArea(menulist->menu_wid, menulist->menu_gc,
				menulist->x, menulist->y, menulist->w,
				menulist->h, menulist->transition,
				(i + 1) * jump, 0, 0);
	}
	return m;
}
Beispiel #20
0
/**
* Display a list of commands.
*/
bool show_cmd_menu(bool object)
{
    menu_type menu;
    menu_iter commands_menu = { show_tag, 0, show_display, show_action, 0 };
    region area = { 15, (object ? 2 : 1), 20, 0 };

    ui_event evt = EVENT_EMPTY;
    int cursor = 0;

    /* Size of menu */
    area.page_rows = poss + (object ? 1 : 0);

    /* Set up the menu */
    WIPE(&menu, menu);
    menu_init(&menu, MN_SKIN_SCROLL, &commands_menu);
    menu.cmd_keys = "\x8B\x8C\n\r";
    area.page_rows = poss + (object ? 1 : 0);
    menu_setpriv(&menu, poss, comm);
    menu_layout(&menu, &area);

    /* Select an entry */
    evt = menu_select(&menu, cursor, TRUE);

    return (evt.type != EVT_ESCAPE);
}
Beispiel #21
0
static void show_brightness_menu(uint8_t item) {
    menu_close();
    gfx_fillRect(0, 8, 128, 65, SSD1306_BLACK);
    show_actual_brightness();
    menu_init(0, 24, 128, 64 - 24, ARRAY_SIZE(brightness_items), brightness_items);
    _state = SETTING_STATE_BRIGHTNESS;
}
Beispiel #22
0
static void show_speed_menu(uint8_t item) {
    menu_close();
    gfx_fillRect(0, 8, 128, 65, SSD1306_BLACK);
    show_actual_speed();
    menu_init(0, 24, 128, 64 - 24, ARRAY_SIZE(speed_items), speed_items);
    _state = SETTING_STATE_SPEED;
}
Beispiel #23
0
struct menulist *new_ml()
{
	struct menulist *ret =
		(struct menulist *) malloc(sizeof(struct menulist));
		
	GrGetScreenInfo(&ret->screen_info);

	ret->gc = pz_get_gc(1);
	GrSetGCUseBackground(ret->gc, GR_FALSE);
	GrSetGCForeground(ret->gc, BLACK);
	GrSetGCBackground(ret->gc, BLACK);

	ret->wid = pz_new_window(0, HEADER_TOPLINE + 1, ret->screen_info.cols,
			ret->screen_info.rows - (HEADER_TOPLINE + 1),
			itunes_do_draw, itunes_do_keystroke);

	GrSelectEvents(ret->wid, GR_EVENT_MASK_EXPOSURE|GR_EVENT_MASK_KEY_DOWN|GR_EVENT_MASK_KEY_UP|GR_EVENT_MASK_TIMER);

	GrGetGCTextSize(ret->gc, "M", -1, GR_TFASCII, &ret->gr_width,
			&ret->gr_height, &ret->gr_base);

	ret->gr_height += 4;

	GrMapWindow(ret->wid);
	ret->itunes_menu = menu_init(ret->wid, "Music", 0, 0,
			screen_info.cols, screen_info.rows -
			(HEADER_TOPLINE + 1), NULL, NULL, UTF8);
	ret->init = 0;
	ret->prevml = NULL;

	return ret;
}
Beispiel #24
0
static void show_reverse_menu(uint8_t item) {
    menu_close();
    gfx_fillRect(0, 8, 128, 65, SSD1306_BLACK);
    show_actual_reverse();
    menu_init(0, 24, 128, 64 - 24, ARRAY_SIZE(reverse_items), reverse_items);
    _state = SETTING_STATE_REVERSE;
}
static bool display_settings_menu(void)
{
    int m;
    bool result;

    static const struct menu_item items[] = {
#ifdef HAVE_LCD_BITMAP
        { ID2P(LANG_CUSTOM_FONT),     font_browse },
#endif
        { ID2P(LANG_WHILE_PLAYING),   custom_wps_browse },
        { ID2P(LANG_LCD_MENU),        lcd_settings_menu },
#ifdef HAVE_REMOTE_LCD
        { ID2P(LANG_LCD_REMOTE_MENU), lcd_remote_settings_menu },
#endif
        { ID2P(LANG_SCROLL_MENU),     scroll_settings_menu },
#ifdef HAVE_LCD_BITMAP
        { ID2P(LANG_BARS_MENU),       bars_settings_menu },
        { ID2P(LANG_PM_MENU),         peak_meter_menu },
        { ID2P(LANG_BIDI_SUPPORT),    bidi_support },
#endif
    };

    m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
                 NULL, NULL, NULL);
    result = menu_run(m);
    menu_exit(m);
    return result;
}
Beispiel #26
0
static void show_control_menu(uint8_t item) {
    menu_close();
    gfx_fillRect(0, 8, 128, 65, SSD1306_BLACK);
    show_actual_control();
    menu_init(0, 24, 128, 64 - 24, ARRAY_SIZE(control_items), control_items);
    _state = SETTING_STATE_CONTROL;
}
Beispiel #27
0
/* Set up one of our menus ready to display choices for a birth question.
   This is slightly involved. */
static void init_birth_menu(menu_type *menu, int n_choices, int initial_choice, const region *reg, bool allow_random, browse_f aux)
{
	struct birthmenu_data *menu_data;

	/* Initialise a basic menu */
	menu_init(menu, MN_SKIN_SCROLL, &birth_iter);

	/* A couple of behavioural flags - we want selections letters in
	   lower case and a double tap to act as a selection. */
	menu->selections = lower_case;
	menu->flags = MN_DBL_TAP;

	/* Copy across the game's suggested initial selection, etc. */
	menu->cursor = initial_choice;

	/* Allocate sufficient space for our own bits of menu information. */
	menu_data = mem_alloc(sizeof *menu_data);

	/* Allocate space for an array of menu item texts and help texts
	   (where applicable) */
	menu_data->items = mem_alloc(n_choices * sizeof *menu_data->items);
	menu_data->allow_random = allow_random;

	/* Set private data */
	menu_setpriv(menu, n_choices, menu_data);

	/* Set up the "browse" hook to display help text (where applicable). */
	menu->browse_hook = aux;

	/* Lay out the menu appropriately */
	menu_layout(menu, reg);
}
Beispiel #28
0
void menu_init(Layer *root_layer, GRect bounds)
{
	int item_index = 0;
	
	menu_items[item_index++] = (SimpleMenuItem) {
		.title = "Quick Departures",
		.callback = menu_select_callback
	};
	menu_items[item_index++] = (SimpleMenuItem) {
		.title = "Select Station",
		.callback = menu_select_callback
	};
	
	menu_sections[0] = (SimpleMenuSection) {
		.num_items = NUM_MENU_ITEMS,
		.items = menu_items
	};
	
	menu = simple_menu_layer_create(bounds, my_window, menu_sections, NUM_SECTIONS, NULL);
	
	layer_add_child(root_layer, simple_menu_layer_get_layer(menu));
}

void window_load(Window *window)
{
	Layer *root_layer = window_get_root_layer(my_window);
	title_layer_init(root_layer, GRect(0, 0, 144, 60));
	menu_init(root_layer, GRect(0, 63, 144, 105));
}

void window_unload(Window *window)
{
	text_layer_destroy(title_layer);
	simple_menu_layer_destroy(menu);
}
Beispiel #29
0
static void watchfile_menu_init(void)
{
  static _Bool ready = 0;
  if (!ready) {
    ready = 1;
    struct menu *menu = &watchfile_menu;
    menu_init(menu, MENU_NOVALUE, MENU_NOVALUE, MENU_NOVALUE);
    watchfile_return = menu_add_submenu(menu, 0, 0, NULL, "return");
    watchfile_return->leave_proc = watchfile_leave_proc;
    struct gfx_texture *t_arrow = resource_get(RES_ICON_ARROW);
    menu_add_button_icon(menu, 0, 1,
                         t_arrow, 0, 0xFFFFFF,
                         scroll_up_proc, NULL);
    menu_add_button_icon(menu, 0, 1 + WATCHFILE_VIEW_ROWS - 1,
                         t_arrow, 1, 0xFFFFFF,
                         scroll_down_proc, NULL);
    for (int i = 0; i < WATCHFILE_VIEW_ROWS; ++i) {
      struct menu_item *item = menu_item_add(menu, 2, 1 + i, NULL, 0xFFFFFF);
      item->data = (void*)i;
      item->enter_proc = entry_enter_proc;
      item->draw_proc = entry_draw_proc;
      item->activate_proc = entry_activate_proc;
      watchfile_items[i] = item;
    }
  }
}
Beispiel #30
0
/* This function is meant to contain board-specific initialization code
 * for, e.g., the I/O pins. The initialization can rely on application-
 * specific board configuration, found in conf_board.h.
 */
void v2x_board_init(void)
{
	irq_initialize_vectors();
	pmic_init();
	sysclk_init();							//configure clock sources for core and USB
	sleepmgr_init();						// Initialize the sleep manager
	ioport_init();							//Initializes the IOPORT service
	pin_init();								//whole chip pin init, modes and initial conditions
	spi_start();							//start SPI driver
	PWR_init();								//sets SR to default states - holds power up
	cpu_irq_enable();
	eeprom_init();							//verifies eeprom safe for use
	menu_init();							//loads menu settings
	time_init();							//starts the RTC
	button_init();							//init button stuffs
	ACL_init();								//configures, but does not start sampling
	GSM_usart_init();						//starts direct serial channel to the SIM module
	CAN_uart_start();						//starts direct serial channel to the ELM module
	canbus_serial_routing(AVR_ROUTING);		//cause the serial 3-state buffer to route the serial path from the ELM to the FTDI 
	udc_start();							//start stack and vbus monitoring
	PWR_hub_start();						//connect the hub to the computer

	//autostart all systems
	delay_ms(500);
	GSM_modem_init();
	CAN_elm_init();
	ACL_set_sample_on();
	PWR_host_start();
}