Пример #1
0
void ui_menu_custom_ui::handle()
{
	bool changed = false;

	// process the menu
	const ui_menu_event *m_event = process(0);

	if (m_event != nullptr && m_event->itemref != nullptr)
	{
		switch ((FPTR)m_event->itemref)
		{
			case FONT_MENU:
				if (m_event->iptkey == IPT_UI_SELECT)
					ui_menu::stack_push(global_alloc_clear<ui_menu_font_ui>(machine(), container));
				break;
			case COLORS_MENU:
				if (m_event->iptkey == IPT_UI_SELECT)
					ui_menu::stack_push(global_alloc_clear<ui_menu_colors_ui>(machine(), container));
				break;
			case HIDE_MENU:
			{
				if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
				{
					changed = true;
					(m_event->iptkey == IPT_UI_RIGHT) ? ui_globals::panels_status++ : ui_globals::panels_status--;
				}
				else if (m_event->iptkey == IPT_UI_SELECT)
				{
					int total = ARRAY_LENGTH(hide_status);
					std::vector<std::string> s_sel(total);
					for (int index = 0; index < total; ++index)
						s_sel[index] = _(hide_status[index]);

					ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, ui_globals::panels_status));
				}
			}
			case LANGUAGE_MENU:
			{
				if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
				{
					changed = true;
					(m_event->iptkey == IPT_UI_RIGHT) ? m_currlang++ : m_currlang--;
				}
				else if (m_event->iptkey == IPT_UI_SELECT)
				{
					int total = m_lang.size();
					std::vector<std::string> s_sel(total);
					for (int index = 0; index < total; ++index)
						s_sel[index] = m_lang[index];

					ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, m_currlang));
				}
			}
		}
	}

	if (changed)
		reset(UI_MENU_RESET_REMEMBER_REF);
}
void ui_menu_sound_options::handle()
{
	bool changed = false;

	// process the menu
	const ui_menu_event *m_event = process(0);

	if (m_event != nullptr && m_event->itemref != nullptr)
	{
		switch ((FPTR)m_event->itemref)
		{
			case ENABLE_SOUND:
				if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT)
				{
					m_sound = !m_sound;
					changed = true;
				}
				break;

			case SAMPLE_RATE:
				if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
				{
					(m_event->iptkey == IPT_UI_LEFT) ? m_cur_rates-- : m_cur_rates++;
					changed = true;
				}
				else if (m_event->iptkey == IPT_UI_SELECT)
				{
					int total = ARRAY_LENGTH(m_sound_rate);
					std::vector<std::string> s_sel(total);
					for (int index = 0; index < total; index++)
						s_sel[index] = std::to_string(m_sound_rate[index]);

					ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, m_cur_rates));
				}
				break;

			case ENABLE_SAMPLES:
				if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT)
				{
					m_samples = !m_samples;
					changed = true;
				}
				break;
		}
	}

	if (changed)
		reset(UI_MENU_RESET_REMEMBER_REF);

}
Пример #3
0
void ui_menu_display_options::handle()
{
	bool changed = false;

	// process the menu
	const ui_menu_event *m_event = process(0);

	if (m_event != nullptr && m_event->itemref != nullptr)
	{
		int value = (FPTR)m_event->itemref;
		if (!strcmp(m_options[value].option, OSDOPTION_VIDEO) || !strcmp(m_options[value].option, OSDOPTION_PRESCALE))
		{
			if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
			{
				changed = true;
				(m_event->iptkey == IPT_UI_LEFT) ? m_options[value].status-- : m_options[value].status++;
			}
			else if (m_event->iptkey == IPT_UI_SELECT && !strcmp(m_options[value].option, OSDOPTION_VIDEO))
			{
				int total = m_list.size();
				std::vector<std::string> s_sel(total);
				for (int index = 0; index < total; ++index)
					s_sel[index] = m_video[m_list[index]];

				ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, m_options[value].status));
			}
		}
		else if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT || m_event->iptkey == IPT_UI_SELECT)
		{
			changed = true;
			m_options[value].status = !m_options[value].status;
		}
	}

	if (changed)
		reset(UI_MENU_RESET_REMEMBER_REF);
}
Пример #4
0
//-------------------------------------------------
//  handle
//-------------------------------------------------
void ui_menu_custom_filter::handle()
{
	bool changed = false;
	m_added = false;

	// process the menu
	const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT);
	if (m_event != nullptr && m_event->itemref != nullptr)
	{
		switch ((FPTR)m_event->itemref)
		{
			case MAIN_FILTER:
				if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
				{
					(m_event->iptkey == IPT_UI_RIGHT) ? custfltr::main++ : custfltr::main--;
					changed = true;
				}
				break;

			case ADD_FILTER:
				if (m_event->iptkey == IPT_UI_SELECT)
				{
					custfltr::numother++;
					custfltr::other[custfltr::numother] = FILTER_UNAVAILABLE + 1;
					m_added = true;
				}
				break;

			case REMOVE_FILTER:
				if (m_event->iptkey == IPT_UI_SELECT)
				{
					custfltr::other[custfltr::numother] = FILTER_UNAVAILABLE + 1;
					custfltr::numother--;
					changed = true;
				}
				break;
		}

		if ((FPTR)m_event->itemref >= OTHER_FILTER && (FPTR)m_event->itemref < OTHER_FILTER + MAX_CUST_FILTER)
		{
			int pos = (int)((FPTR)m_event->itemref - OTHER_FILTER);
			if (m_event->iptkey == IPT_UI_LEFT && custfltr::other[pos] > FILTER_UNAVAILABLE + 1)
			{
				custfltr::other[pos]--;
				for ( ; custfltr::other[pos] > FILTER_UNAVAILABLE && (custfltr::other[pos] == FILTER_CATEGORY
						|| custfltr::other[pos] == FILTER_FAVORITE); custfltr::other[pos]--) ;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::other[pos] < FILTER_LAST - 1)
			{
				custfltr::other[pos]++;
				for ( ; custfltr::other[pos] < FILTER_LAST && (custfltr::other[pos] == FILTER_CATEGORY
						|| custfltr::other[pos] == FILTER_FAVORITE); custfltr::other[pos]++) ;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_SELECT)
			{
				size_t total = main_filters::length;
				std::vector<std::string> s_sel(total);
				for (size_t index = 0; index < total; ++index)
					if (index <= FILTER_UNAVAILABLE || index == FILTER_CATEGORY || index == FILTER_FAVORITE || index == FILTER_CUSTOM)
						s_sel[index] = "_skip_";
					else
						s_sel[index] = main_filters::text[index];

				ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, custfltr::other[pos]));
			}
		}
		else if ((FPTR)m_event->itemref >= YEAR_FILTER && (FPTR)m_event->itemref < YEAR_FILTER + MAX_CUST_FILTER)
		{
			int pos = (int)((FPTR)m_event->itemref - YEAR_FILTER);
			if (m_event->iptkey == IPT_UI_LEFT && custfltr::year[pos] > 0)
			{
				custfltr::year[pos]--;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::year[pos] < c_year::ui.size() - 1)
			{
				custfltr::year[pos]++;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_SELECT)
				ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, c_year::ui, custfltr::year[pos]));
		}
		else if ((FPTR)m_event->itemref >= MNFCT_FILTER && (FPTR)m_event->itemref < MNFCT_FILTER + MAX_CUST_FILTER)
		{
			int pos = (int)((FPTR)m_event->itemref - MNFCT_FILTER);
			if (m_event->iptkey == IPT_UI_LEFT && custfltr::mnfct[pos] > 0)
			{
				custfltr::mnfct[pos]--;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_RIGHT && custfltr::mnfct[pos] < c_mnfct::ui.size() - 1)
			{
				custfltr::mnfct[pos]++;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_SELECT)
				ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, c_mnfct::ui, custfltr::mnfct[pos]));
		}
	}

	if (changed)
		reset(UI_MENU_RESET_REMEMBER_REF);
	else if (m_added)
		reset(UI_MENU_RESET_SELECT_FIRST);
}
Пример #5
0
//-------------------------------------------------
//  handle
//-------------------------------------------------
void ui_menu_swcustom_filter::handle()
{
	bool changed = false;
	m_added = false;

	// process the menu
	const ui_menu_event *m_event = process(UI_MENU_PROCESS_LR_REPEAT);
	if (m_event != nullptr && m_event->itemref != nullptr)
	{
		switch ((FPTR)m_event->itemref)
		{
			case MAIN_FILTER:
				if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT)
				{
					(m_event->iptkey == IPT_UI_RIGHT) ? sw_custfltr::main++ : sw_custfltr::main--;
					changed = true;
				}
				break;

			case ADD_FILTER:
				if (m_event->iptkey == IPT_UI_SELECT)
				{
					sw_custfltr::numother++;
					sw_custfltr::other[sw_custfltr::numother] = UI_SW_UNAVAILABLE + 1;
					m_added = true;
				}
				break;

			case REMOVE_FILTER:
				if (m_event->iptkey == IPT_UI_SELECT)
				{
					sw_custfltr::other[sw_custfltr::numother] = UI_SW_UNAVAILABLE + 1;
					sw_custfltr::numother--;
					changed = true;
				}
				break;
		}

		if ((FPTR)m_event->itemref >= OTHER_FILTER && (FPTR)m_event->itemref < OTHER_FILTER + MAX_CUST_FILTER)
		{
			int pos = (int)((FPTR)m_event->itemref - OTHER_FILTER);
			if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::other[pos] > UI_SW_UNAVAILABLE + 1)
			{
				sw_custfltr::other[pos]--;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::other[pos] < UI_SW_LAST - 1)
			{
				sw_custfltr::other[pos]++;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_SELECT)
			{
				size_t total = sw_filters::length;
				std::vector<std::string> s_sel(total);
				for (size_t index = 0; index < total; ++index)
					if (index <= UI_SW_UNAVAILABLE|| index == UI_SW_CUSTOM)
						s_sel[index] = "_skip_";
					else
						s_sel[index] = sw_filters::text[index];

				ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, sw_custfltr::other[pos]));
			}
		}
		else if ((FPTR)m_event->itemref >= YEAR_FILTER && (FPTR)m_event->itemref < YEAR_FILTER + MAX_CUST_FILTER)
		{
			int pos = (int)((FPTR)m_event->itemref - YEAR_FILTER);
			if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::year[pos] > 0)
			{
				sw_custfltr::year[pos]--;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::year[pos] < m_filter.year.ui.size() - 1)
			{
				sw_custfltr::year[pos]++;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_SELECT)
				ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, m_filter.year.ui, sw_custfltr::year[pos]));
		}
		else if ((FPTR)m_event->itemref >= TYPE_FILTER && (FPTR)m_event->itemref < TYPE_FILTER + MAX_CUST_FILTER)
		{
			int pos = (int)((FPTR)m_event->itemref - TYPE_FILTER);
			if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::type[pos] > 0)
			{
				sw_custfltr::type[pos]--;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::type[pos] < m_filter.type.ui.size() - 1)
			{
				sw_custfltr::type[pos]++;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_SELECT)
				ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, m_filter.type.ui, sw_custfltr::type[pos]));
		}
		else if ((FPTR)m_event->itemref >= MNFCT_FILTER && (FPTR)m_event->itemref < MNFCT_FILTER + MAX_CUST_FILTER)
		{
			int pos = (int)((FPTR)m_event->itemref - MNFCT_FILTER);
			if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::mnfct[pos] > 0)
			{
				sw_custfltr::mnfct[pos]--;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::mnfct[pos] < m_filter.publisher.ui.size() - 1)
			{
				sw_custfltr::mnfct[pos]++;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_SELECT)
				ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, m_filter.publisher.ui, sw_custfltr::mnfct[pos]));
		}
		else if ((FPTR)m_event->itemref >= REGION_FILTER && (FPTR)m_event->itemref < REGION_FILTER + MAX_CUST_FILTER)
		{
			int pos = (int)((FPTR)m_event->itemref - REGION_FILTER);
			if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::region[pos] > 0)
			{
				sw_custfltr::region[pos]--;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::region[pos] < m_filter.region.ui.size() - 1)
			{
				sw_custfltr::region[pos]++;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_SELECT)
				ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, m_filter.region.ui, sw_custfltr::region[pos]));
		}
		else if ((FPTR)m_event->itemref >= LIST_FILTER && (FPTR)m_event->itemref < LIST_FILTER + MAX_CUST_FILTER)
		{
			int pos = (int)((FPTR)m_event->itemref - LIST_FILTER);
			if (m_event->iptkey == IPT_UI_LEFT && sw_custfltr::list[pos] > 0)
			{
				sw_custfltr::list[pos]--;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_RIGHT && sw_custfltr::list[pos] < m_filter.swlist.name.size() - 1)
			{
				sw_custfltr::list[pos]++;
				changed = true;
			}
			else if (m_event->iptkey == IPT_UI_SELECT)
				ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, m_filter.swlist.description, sw_custfltr::list[pos]));
		}
	}

	if (changed)
		reset(UI_MENU_RESET_REMEMBER_REF);
	else if (m_added)
		reset(UI_MENU_RESET_SELECT_FIRST);
}
Пример #6
0
void menu_game_options::handle()
{
	bool changed = false;

	// process the menu
	const event *menu_event;
	if (machine().options().ui() == emu_options::UI_SIMPLE)
	{
		menu_event = process(PROCESS_LR_REPEAT);
	}
	else
	{
		process_parent();
		menu_event = process(PROCESS_LR_REPEAT | PROCESS_NOIMAGE);
	}

	if (menu_event != nullptr && menu_event->itemref != nullptr)
		switch ((uintptr_t)menu_event->itemref)
		{
			case FILTER_MENU:
			{
				if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
				{
					(menu_event->iptkey == IPT_UI_RIGHT) ? ++m_main : --m_main;
					changed = true;
				}
				else if (menu_event->iptkey == IPT_UI_SELECT)
				{
					int total = main_filters::length;
					std::vector<std::string> s_sel(total);
					for (int index = 0; index < total; ++index)
						s_sel[index] = main_filters::text[index];

					menu::stack_push<menu_selector>(ui(), container(), s_sel, m_main);
				}
				break;
			}
			case FILE_CATEGORY_FILTER:
			{
				if (menu_event->iptkey == IPT_UI_LEFT)
				{
					mame_machine_manager::instance()->inifile().move_file(-1);
					changed = true;
				}
				else if (menu_event->iptkey == IPT_UI_RIGHT)
				{
					mame_machine_manager::instance()->inifile().move_file(1);
					changed = true;
				}
				else if (menu_event->iptkey == IPT_UI_SELECT)
				{
					inifile_manager &ifile = mame_machine_manager::instance()->inifile();
					int total = ifile.total();
					std::vector<std::string> s_sel(total);
					mame_machine_manager::instance()->inifile().set_cat(0);
					for (size_t index = 0; index < total; ++index)
						s_sel[index] = ifile.get_file(index);

					menu::stack_push<menu_selector>(ui(), container(), s_sel, ifile.cur_file(), menu_selector::INIFILE);
				}
				break;
			}
			case CATEGORY_FILTER:
			{
				if (menu_event->iptkey == IPT_UI_LEFT)
				{
					mame_machine_manager::instance()->inifile().move_cat(-1);
					changed = true;
				}
				else if (menu_event->iptkey == IPT_UI_RIGHT)
				{
					mame_machine_manager::instance()->inifile().move_cat(1);
					changed = true;
				}
				else if (menu_event->iptkey == IPT_UI_SELECT)
				{
					inifile_manager &ifile = mame_machine_manager::instance()->inifile();
					int total = ifile.cat_total();
					std::vector<std::string> s_sel(total);
					for (int index = 0; index < total; ++index)
						s_sel[index] = ifile.get_category(index);

					menu::stack_push<menu_selector>(ui(), container(), s_sel, ifile.cur_cat(), menu_selector::CATEGORY);
				}
				break;
			}
			case MANUFACT_CAT_FILTER:
				if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
				{
					(menu_event->iptkey == IPT_UI_RIGHT) ? c_mnfct::actual++ : c_mnfct::actual--;
					changed = true;
				}
				else if (menu_event->iptkey == IPT_UI_SELECT)
					menu::stack_push<menu_selector>(ui(), container(), c_mnfct::ui, c_mnfct::actual);

				break;
			case YEAR_CAT_FILTER:
				if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT)
				{
					(menu_event->iptkey == IPT_UI_RIGHT) ? c_year::actual++ : c_year::actual--;
					changed = true;
				}
				else if (menu_event->iptkey == IPT_UI_SELECT)
					menu::stack_push<menu_selector>(ui(), container(), c_year::ui, c_year::actual);

				break;
			case CONF_DIR:
				if (menu_event->iptkey == IPT_UI_SELECT)
					menu::stack_push<menu_directory>(ui(), container());
				break;
			case MISC_MENU:
				if (menu_event->iptkey == IPT_UI_SELECT)
				{
					menu::stack_push<submenu>(ui(), container(), submenu::misc_options);
					ui_globals::reset = true;
				}
				break;
			case SOUND_MENU:
				if (menu_event->iptkey == IPT_UI_SELECT)
				{
					menu::stack_push<menu_sound_options>(ui(), container());
					ui_globals::reset = true;
				}
				break;
			case DISPLAY_MENU:
				if (menu_event->iptkey == IPT_UI_SELECT)
				{
					menu::stack_push<submenu>(ui(), container(), submenu::video_options);
					ui_globals::reset = true;
				}
				break;
			case CUSTOM_MENU:
				if (menu_event->iptkey == IPT_UI_SELECT)
					menu::stack_push<menu_custom_ui>(ui(), container());
				break;
			case CONTROLLER_MENU:
				if (menu_event->iptkey == IPT_UI_SELECT)
					menu::stack_push<submenu>(ui(), container(), submenu::control_options);
				break;
			case CGI_MENU:
				if (menu_event->iptkey == IPT_UI_SELECT)
					menu::stack_push<menu_input_groups>(ui(), container());
				break;
			case CUSTOM_FILTER:
				if (menu_event->iptkey == IPT_UI_SELECT)
					menu::stack_push<menu_custom_filter>(ui(), container());
				break;
			case ADVANCED_MENU:
				if (menu_event->iptkey == IPT_UI_SELECT)
				{
					menu::stack_push<submenu>(ui(), container(), submenu::advanced_options);
					ui_globals::reset = true;
				}
				break;
			case SAVE_CONFIG:
				if (menu_event->iptkey == IPT_UI_SELECT)
					ui().save_main_option();
				break;
		}

	if (changed)
		reset(reset_options::REMEMBER_REF);
}