summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2018-06-24 09:01:47 -0400
committer AJR <ajrhacker@users.noreply.github.com>2018-06-24 09:01:47 -0400
commitd2fbefd97733188b4ceb2e3de963971b9e658813 (patch)
tree7c0afa15f13e17dd4405a8bd714c5e7c0a133933 /src
parentf5f123c18475aa52526b9bd737259d7ce8e25ef4 (diff)
Standardize "On"/"Off" items in UI menus. "On" is now consistently to the right of "Off", as with DIP switches.
Diffstat (limited to 'src')
-rw-r--r--src/frontend/mame/ui/cheatopt.cpp14
-rw-r--r--src/frontend/mame/ui/custui.cpp4
-rw-r--r--src/frontend/mame/ui/menu.cpp16
-rw-r--r--src/frontend/mame/ui/menu.h1
-rw-r--r--src/frontend/mame/ui/miscmenu.cpp3
-rw-r--r--src/frontend/mame/ui/sndmenu.cpp4
-rw-r--r--src/frontend/mame/ui/submenu.cpp7
7 files changed, 27 insertions, 22 deletions
diff --git a/src/frontend/mame/ui/cheatopt.cpp b/src/frontend/mame/ui/cheatopt.cpp
index 3982a7c7a33..cb207458ed1 100644
--- a/src/frontend/mame/ui/cheatopt.cpp
+++ b/src/frontend/mame/ui/cheatopt.cpp
@@ -292,19 +292,9 @@ void menu_autofire::populate(float &customtop, float &custombottom)
item_append(menu_item_type::SEPARATOR);
is_first_button = false;
}
+
/* add an autofire item */
- if (!autofire_toggle)
- {
- // 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);
- }
+ item_append_on_off(field.name(), settings.autofire, (autofire_toggle ? FLAG_DISABLE : FLAG_INVERT), (void *)&field);
}
}
}
diff --git a/src/frontend/mame/ui/custui.cpp b/src/frontend/mame/ui/custui.cpp
index 6598f6bc6ba..186a5bc1c2d 100644
--- a/src/frontend/mame/ui/custui.cpp
+++ b/src/frontend/mame/ui/custui.cpp
@@ -333,8 +333,8 @@ void menu_font_ui::populate(float &customtop, float &custombottom)
#ifdef UI_WINDOWS
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(_("Italic"), m_italic ? "On" : "Off", m_italic ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)(uintptr_t)MUI_ITALIC);
+ item_append_on_off(_("Bold"), m_bold, 0, (void *)(uintptr_t)MUI_BOLD);
+ item_append_on_off(_("Italic"), m_italic, 0, (void *)(uintptr_t)MUI_ITALIC);
}
#endif
diff --git a/src/frontend/mame/ui/menu.cpp b/src/frontend/mame/ui/menu.cpp
index 2344d3bf07d..e3abdc0e0a5 100644
--- a/src/frontend/mame/ui/menu.cpp
+++ b/src/frontend/mame/ui/menu.cpp
@@ -406,6 +406,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
//-------------------------------------------------
diff --git a/src/frontend/mame/ui/menu.h b/src/frontend/mame/ui/menu.h
index cf3b83003bc..1a6c2d977f8 100644
--- a/src/frontend/mame/ui/menu.h
+++ b/src/frontend/mame/ui/menu.h
@@ -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(menu_item item);
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
static void init(running_machine &machine, ui_options &mopt);
diff --git a/src/frontend/mame/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp
index 5ad96276311..6792cef3f4f 100644
--- a/src/frontend/mame/ui/miscmenu.cpp
+++ b/src/frontend/mame/ui/miscmenu.cpp
@@ -892,8 +892,7 @@ void menu_plugins_configure::populate(float &customtop, float &custombottom)
if (curentry->type() != OPTION_HEADER)
{
auto enabled = !strcmp(curentry->value(), "1");
- item_append(curentry->description(), enabled ? _("On") : _("Off"),
- enabled ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)(uintptr_t)curentry->name().c_str());
+ item_append_on_off(curentry->description(), enabled, 0, (void *)(uintptr_t)curentry->name().c_str());
}
}
item_append(menu_item_type::SEPARATOR);
diff --git a/src/frontend/mame/ui/sndmenu.cpp b/src/frontend/mame/ui/sndmenu.cpp
index 2456c44992e..501e8ffea1e 100644
--- a/src/frontend/mame/ui/sndmenu.cpp
+++ b/src/frontend/mame/ui/sndmenu.cpp
@@ -132,9 +132,9 @@ void menu_sound_options::populate(float &customtop, float &custombottom)
m_sample_rate = m_sound_rate[m_cur_rates];
// 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(_("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);
customtop = ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER);
diff --git a/src/frontend/mame/ui/submenu.cpp b/src/frontend/mame/ui/submenu.cpp
index 33632cb4150..fd0dcc14f7b 100644
--- a/src/frontend/mame/ui/submenu.cpp
+++ b/src/frontend/mame/ui/submenu.cpp
@@ -342,10 +342,9 @@ void submenu::populate(float &customtop, float &custombottom)
switch (sm_option->entry->type())
{
case OPTION_BOOLEAN:
- arrow_flags = sm_option->options->bool_value(sm_option->name) ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW;
- item_append(_(sm_option->description),
- (arrow_flags == FLAG_RIGHT_ARROW) ? "On" : "Off",
- arrow_flags,
+ item_append_on_off(_(sm_option->description),
+ sm_option->options->bool_value(sm_option->name),
+ 0,
static_cast<void*>(&(*sm_option)));
break;
case OPTION_INTEGER: