summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2020-12-20 15:28:27 +1100
committer Vas Crabb <vas@vastheman.com>2020-12-20 15:28:27 +1100
commited872d1bd2a8c50086c1fe4f97420a065f249eb1 (patch)
tree2f1edc26b22ac9f9e30bd218600161d9529e6b69 /src/frontend
parent25294ce9cdd4dde807f931fc2e28046db3b4ad39 (diff)
Fix some oversights and emergent behaviour with view selection.
Exposed the "native snapview" option on the video manager. Trying to use presence of a single view is a poor proxy that breaks with multi-screen systems. Allow rotation to be changed for native snapshot views, and disable the zoom to screen area control when it has no effect on the selected view. Treat an empty string identically to "auto" for view selectction. Previously this was being used for prefix matching so it would force the first view. (This caused the bad snapshot view selection. It had been relying on "internal" not being a common view name prefix so it fell through to automatic selection, but when changed to an empty string it forced the first view.) Documented "auto" as well as "native" for the -snapview option and changed the default to auto rather than an empty string for consistency with the -viewN options. Added [w]string_view handlers to the stuff that's instantiated in strformat.cpp since we'll be increasingly using them. Cleaned up and updated some documentation.
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/mame/ui/filemngr.cpp21
-rw-r--r--src/frontend/mame/ui/filesel.cpp6
-rw-r--r--src/frontend/mame/ui/mainmenu.cpp2
-rw-r--r--src/frontend/mame/ui/menu.cpp1
-rw-r--r--src/frontend/mame/ui/videoopt.cpp31
5 files changed, 35 insertions, 26 deletions
diff --git a/src/frontend/mame/ui/filemngr.cpp b/src/frontend/mame/ui/filemngr.cpp
index 69a3b5ca5fa..1ef861e5475 100644
--- a/src/frontend/mame/ui/filemngr.cpp
+++ b/src/frontend/mame/ui/filemngr.cpp
@@ -12,17 +12,19 @@
*********************************************************************/
#include "emu.h"
-#include "ui/ui.h"
-#include "ui/menu.h"
#include "ui/filemngr.h"
+
#include "ui/filesel.h"
-#include "ui/miscmenu.h"
-#include "ui/imgcntrl.h"
#include "ui/floppycntrl.h"
+#include "ui/imgcntrl.h"
+#include "ui/miscmenu.h"
+#include "ui/ui.h"
+
#include "softlist.h"
namespace ui {
+
/***************************************************************************
FILE MANAGER
***************************************************************************/
@@ -168,7 +170,7 @@ void menu_file_manager::handle()
{
// process the menu
const event *event = process(0);
- if (event != nullptr && event->itemref != nullptr && event->iptkey == IPT_UI_SELECT)
+ if (event && event->itemref && (event->iptkey == IPT_UI_SELECT))
{
if ((uintptr_t)event->itemref == 1)
{
@@ -177,18 +179,15 @@ void menu_file_manager::handle()
else
{
selected_device = (device_image_interface *) event->itemref;
- if (selected_device != nullptr)
+ if (selected_device)
{
m_curr_selected = true;
floppy_image_device *floppy_device = dynamic_cast<floppy_image_device *>(selected_device);
- if (floppy_device != nullptr)
- {
+ if (floppy_device)
menu::stack_push<menu_control_floppy_image>(ui(), container(), *floppy_device);
- }
else
- {
menu::stack_push<menu_control_device_image>(ui(), container(), *selected_device);
- }
+
// reset the existing menu
reset(reset_options::REMEMBER_POSITION);
}
diff --git a/src/frontend/mame/ui/filesel.cpp b/src/frontend/mame/ui/filesel.cpp
index 376202cb1c8..0c38129ed9f 100644
--- a/src/frontend/mame/ui/filesel.cpp
+++ b/src/frontend/mame/ui/filesel.cpp
@@ -12,8 +12,8 @@
***************************************************************************/
#include "emu.h"
-
#include "ui/filesel.h"
+
#include "ui/ui.h"
#include "ui/utils.h"
@@ -24,7 +24,9 @@
#include <cstring>
#include <locale>
+
namespace ui {
+
/***************************************************************************
CONSTANTS
***************************************************************************/
@@ -310,8 +312,8 @@ void menu_file_selector::select_item(const file_selector_entry &entry)
case SELECTOR_ENTRY_TYPE_DRIVE:
case SELECTOR_ENTRY_TYPE_DIRECTORY:
- // drive/directory - first check the path
{
+ // drive/directory - first check the path
util::zippath_directory::ptr dir;
osd_file::error const err = util::zippath_directory::open(entry.fullpath, dir);
if (err != osd_file::error::NONE)
diff --git a/src/frontend/mame/ui/mainmenu.cpp b/src/frontend/mame/ui/mainmenu.cpp
index 1051b322d99..9fb66331249 100644
--- a/src/frontend/mame/ui/mainmenu.cpp
+++ b/src/frontend/mame/ui/mainmenu.cpp
@@ -114,7 +114,7 @@ void menu_main::populate(float &customtop, float &custombottom)
item_append(_("Slider Controls"), 0, (void *)SLIDERS);
- item_append(_("Video Options"), 0, (machine().render().target_by_index(1) || machine().video().snapshot_target().view_name(1)) ? (void *)VIDEO_TARGETS : (void *)VIDEO_OPTIONS);
+ item_append(_("Video Options"), 0, (void *)VIDEO_TARGETS);
if (machine().crosshair().get_usage())
item_append(_("Crosshair Options"), 0, (void *)CROSSHAIR);
diff --git a/src/frontend/mame/ui/menu.cpp b/src/frontend/mame/ui/menu.cpp
index 4fb9616c355..76930eda029 100644
--- a/src/frontend/mame/ui/menu.cpp
+++ b/src/frontend/mame/ui/menu.cpp
@@ -9,7 +9,6 @@
*********************************************************************/
#include "emu.h"
-
#include "ui/menu.h"
#include "ui/ui.h"
diff --git a/src/frontend/mame/ui/videoopt.cpp b/src/frontend/mame/ui/videoopt.cpp
index 21ba181ecb7..e49b743fc15 100644
--- a/src/frontend/mame/ui/videoopt.cpp
+++ b/src/frontend/mame/ui/videoopt.cpp
@@ -56,9 +56,8 @@ void menu_video_targets::populate(float &customtop, float &custombottom)
item_append(util::string_format(_("Screen #%d"), targetnum), 0, target);
}
- // add option for snapshot target if it has multiple views
- if (machine().video().snapshot_target().view_name(1))
- item_append("Snapshot", 0, &machine().video().snapshot_target());
+ // add option for snapshot target
+ item_append("Snapshot", 0, &machine().video().snapshot_target());
}
/*-------------------------------------------------
@@ -98,8 +97,11 @@ menu_video_options::menu_video_options(
, m_show_title(false)
, m_snapshot(snapshot)
{
- set_selected_index(target.view());
- reset(reset_options::REMEMBER_POSITION);
+ if (!m_snapshot || !machine().video().snap_native())
+ {
+ set_selected_index(target.view());
+ reset(reset_options::REMEMBER_POSITION);
+ }
}
menu_video_options::menu_video_options(
@@ -114,8 +116,11 @@ menu_video_options::menu_video_options(
, m_show_title(true)
, m_snapshot(snapshot)
{
- set_selected_index(target.view() + 2);
- reset(reset_options::REMEMBER_POSITION);
+ if (!m_snapshot || !machine().video().snap_native())
+ {
+ set_selected_index(target.view() + 2);
+ reset(reset_options::REMEMBER_POSITION);
+ }
}
menu_video_options::~menu_video_options()
@@ -134,9 +139,12 @@ void menu_video_options::populate(float &customtop, float &custombottom)
}
// add items for each view
- for (char const *name = m_target.view_name(ref = 0); name; name = m_target.view_name(++ref))
- item_append(name, 0, reinterpret_cast<void *>(ITEM_VIEW_FIRST + ref));
- item_append(menu_item_type::SEPARATOR);
+ if (!m_snapshot || !machine().video().snap_native())
+ {
+ for (char const *name = m_target.view_name(ref = 0); name; name = m_target.view_name(++ref))
+ item_append(name, 0, reinterpret_cast<void *>(ITEM_VIEW_FIRST + ref));
+ item_append(menu_item_type::SEPARATOR);
+ }
// add items for visibility toggles
auto const &toggles = m_target.visibility_toggles();
@@ -169,7 +177,8 @@ void menu_video_options::populate(float &customtop, float &custombottom)
item_append(_("Rotate"), subtext, FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW, reinterpret_cast<void *>(ITEM_ROTATE));
// cropping
- item_append_on_off(_("Zoom to Screen Area"), m_target.zoom_to_screen(), 0, reinterpret_cast<void *>(ITEM_ZOOM));
+ bool const canzoom(m_target.current_view().has_art() && !m_target.current_view().visible_screens().empty());
+ item_append_on_off(_("Zoom to Screen Area"), m_target.zoom_to_screen(), canzoom ? 0U : (FLAG_INVERT | FLAG_DISABLE), reinterpret_cast<void *>(ITEM_ZOOM));
if (!m_snapshot)
{