mirror of
https://github.com/holub/mame
synced 2025-07-04 01:18:59 +03:00
Standardize "On"/"Off" items in UI menus. "On" is now consistently to the right of "Off", as with DIP switches.
This commit is contained in:
parent
f5f123c184
commit
d2fbefd977
@ -292,19 +292,9 @@ void menu_autofire::populate(float &customtop, float &custombottom)
|
|||||||
item_append(menu_item_type::SEPARATOR);
|
item_append(menu_item_type::SEPARATOR);
|
||||||
is_first_button = false;
|
is_first_button = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add an autofire item */
|
/* add an autofire item */
|
||||||
if (!autofire_toggle)
|
item_append_on_off(field.name(), settings.autofire, (autofire_toggle ? FLAG_DISABLE : FLAG_INVERT), (void *)&field);
|
||||||
{
|
|
||||||
// item is enabled and can be switched to values on/off
|
|
||||||
item_append(field.name(), (settings.autofire ? _("On") : _("Off")),
|
|
||||||
(settings.autofire ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW), (void *)&field);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// item is disabled
|
|
||||||
item_append(field.name(), (settings.autofire ? _("On") : _("Off")),
|
|
||||||
FLAG_DISABLE | FLAG_INVERT, nullptr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,8 +333,8 @@ void menu_font_ui::populate(float &customtop, float &custombottom)
|
|||||||
#ifdef UI_WINDOWS
|
#ifdef UI_WINDOWS
|
||||||
if (m_fonts[m_actual].first != "default")
|
if (m_fonts[m_actual].first != "default")
|
||||||
{
|
{
|
||||||
item_append(_("Bold"), m_bold ? "On" : "Off", m_bold ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)(uintptr_t)MUI_BOLD);
|
item_append_on_off(_("Bold"), m_bold, 0, (void *)(uintptr_t)MUI_BOLD);
|
||||||
item_append(_("Italic"), m_italic ? "On" : "Off", m_italic ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)(uintptr_t)MUI_ITALIC);
|
item_append_on_off(_("Italic"), m_italic, 0, (void *)(uintptr_t)MUI_ITALIC);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -405,6 +405,22 @@ void menu::item_append(std::string &&text, std::string &&subtext, uint32_t flags
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// item_append_on_off - append a new "On"/"Off"
|
||||||
|
// item to the end of the menu
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
void menu::item_append_on_off(const std::string &text, bool state, uint32_t flags, void *ref, menu_item_type type)
|
||||||
|
{
|
||||||
|
if (state & FLAG_DISABLE)
|
||||||
|
ref = nullptr;
|
||||||
|
else
|
||||||
|
flags |= state ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW;
|
||||||
|
|
||||||
|
item_append(std::string(text), state ? _("On") : _("Off"), flags, ref, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// repopulate - repopulate menu items
|
// repopulate - repopulate menu items
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
@ -56,6 +56,7 @@ public:
|
|||||||
void item_append(std::string &&text, std::string &&subtext, uint32_t flags, void *ref, menu_item_type type = menu_item_type::UNKNOWN);
|
void item_append(std::string &&text, std::string &&subtext, uint32_t flags, void *ref, menu_item_type type = menu_item_type::UNKNOWN);
|
||||||
void item_append(menu_item item);
|
void item_append(menu_item item);
|
||||||
void item_append(menu_item_type type, uint32_t flags = 0);
|
void item_append(menu_item_type type, uint32_t flags = 0);
|
||||||
|
void item_append_on_off(const std::string &text, bool state, uint32_t flags, void *ref, menu_item_type type = menu_item_type::UNKNOWN);
|
||||||
|
|
||||||
// Global initialization
|
// Global initialization
|
||||||
static void init(running_machine &machine, ui_options &mopt);
|
static void init(running_machine &machine, ui_options &mopt);
|
||||||
|
@ -892,8 +892,7 @@ void menu_plugins_configure::populate(float &customtop, float &custombottom)
|
|||||||
if (curentry->type() != OPTION_HEADER)
|
if (curentry->type() != OPTION_HEADER)
|
||||||
{
|
{
|
||||||
auto enabled = !strcmp(curentry->value(), "1");
|
auto enabled = !strcmp(curentry->value(), "1");
|
||||||
item_append(curentry->description(), enabled ? _("On") : _("Off"),
|
item_append_on_off(curentry->description(), enabled, 0, (void *)(uintptr_t)curentry->name().c_str());
|
||||||
enabled ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)(uintptr_t)curentry->name().c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item_append(menu_item_type::SEPARATOR);
|
item_append(menu_item_type::SEPARATOR);
|
||||||
|
@ -132,9 +132,9 @@ void menu_sound_options::populate(float &customtop, float &custombottom)
|
|||||||
m_sample_rate = m_sound_rate[m_cur_rates];
|
m_sample_rate = m_sound_rate[m_cur_rates];
|
||||||
|
|
||||||
// add options items
|
// add options items
|
||||||
item_append(_("Sound"), m_sound ? _("On") : _("Off"), m_sound ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)(uintptr_t)ENABLE_SOUND);
|
item_append_on_off(_("Sound"), m_sound, 0, (void *)(uintptr_t)ENABLE_SOUND);
|
||||||
item_append(_("Sample Rate"), string_format("%d", m_sample_rate), arrow_flags, (void *)(uintptr_t)SAMPLE_RATE);
|
item_append(_("Sample Rate"), string_format("%d", m_sample_rate), arrow_flags, (void *)(uintptr_t)SAMPLE_RATE);
|
||||||
item_append(_("Use External Samples"), m_samples ? _("On") : _("Off"), m_samples ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)(uintptr_t)ENABLE_SAMPLES);
|
item_append_on_off(_("Use External Samples"), m_samples, 0, (void *)(uintptr_t)ENABLE_SAMPLES);
|
||||||
item_append(menu_item_type::SEPARATOR);
|
item_append(menu_item_type::SEPARATOR);
|
||||||
|
|
||||||
customtop = ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);
|
customtop = ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);
|
||||||
|
@ -342,10 +342,9 @@ void submenu::populate(float &customtop, float &custombottom)
|
|||||||
switch (sm_option->entry->type())
|
switch (sm_option->entry->type())
|
||||||
{
|
{
|
||||||
case OPTION_BOOLEAN:
|
case OPTION_BOOLEAN:
|
||||||
arrow_flags = sm_option->options->bool_value(sm_option->name) ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW;
|
item_append_on_off(_(sm_option->description),
|
||||||
item_append(_(sm_option->description),
|
sm_option->options->bool_value(sm_option->name),
|
||||||
(arrow_flags == FLAG_RIGHT_ARROW) ? "On" : "Off",
|
0,
|
||||||
arrow_flags,
|
|
||||||
static_cast<void*>(&(*sm_option)));
|
static_cast<void*>(&(*sm_option)));
|
||||||
break;
|
break;
|
||||||
case OPTION_INTEGER:
|
case OPTION_INTEGER:
|
||||||
|
Loading…
Reference in New Issue
Block a user