From 8d5d2fad353db9b95ae48de99c9cf2c30a6fcab3 Mon Sep 17 00:00:00 2001 From: etabeta78 Date: Thu, 8 Jan 2015 12:23:50 +0100 Subject: (MESS) ui: fixed a small problem with tape control menu with systems with multiple cassette drives attached. nw. --- src/emu/ui/devctrl.h | 23 ++++++++++++++++++++++- src/emu/ui/tapectrl.c | 14 ++------------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/emu/ui/devctrl.h b/src/emu/ui/devctrl.h index 1051d1a099e..ec6dafc7b9e 100644 --- a/src/emu/ui/devctrl.h +++ b/src/emu/ui/devctrl.h @@ -38,6 +38,7 @@ protected: void previous(); void next(); astring current_display_name(); + UINT32 current_display_flags(); private: // device iterator @@ -124,7 +125,7 @@ template astring ui_menu_device_control<_DeviceType>::current_display_name() { astring display_name; - display_name.cpy(current_device()->device().name()); + display_name.cpy(current_device()->name()); if (count() > 1) { astring temp; @@ -134,4 +135,24 @@ astring ui_menu_device_control<_DeviceType>::current_display_name() return display_name; } + +//------------------------------------------------- +// current_display_flags +//------------------------------------------------- + +template +UINT32 ui_menu_device_control<_DeviceType>::current_display_flags() +{ + UINT32 flags = 0; + if (count() > 1) + { + if (current_index() > 0) + flags |= MENU_FLAG_LEFT_ARROW; + if (current_index() < count() - 1) + flags |= MENU_FLAG_RIGHT_ARROW; + } + return flags; +} + + #endif /* __UI_DEVCTRL_H__ */ diff --git a/src/emu/ui/tapectrl.c b/src/emu/ui/tapectrl.c index d3d4f94b926..168d227440e 100644 --- a/src/emu/ui/tapectrl.c +++ b/src/emu/ui/tapectrl.c @@ -55,20 +55,10 @@ ui_menu_tape_control::~ui_menu_tape_control() void ui_menu_tape_control::populate() { - UINT32 flags = 0; - - if (count() > 1) - { - if (current_index() == (count() - 1)) - flags |= MENU_FLAG_LEFT_ARROW; - else - flags |= MENU_FLAG_RIGHT_ARROW; - } - if (current_device()) { // name of tape - item_append(current_display_name().cstr(), current_device()->exists() ? current_device()->filename() : "No Tape Image loaded", flags, TAPECMD_SELECT); + item_append(current_display_name().cstr(), current_device()->exists() ? current_device()->filename() : "No Tape Image loaded", current_display_flags(), TAPECMD_SELECT); if (current_device()->exists()) { @@ -125,7 +115,7 @@ void ui_menu_tape_control::populate() void ui_menu_tape_control::handle() { - // rebuild the menu - we have to do this so that the counter updates + // rebuild the menu (so to update the selected device, if the user has pressed L or R, and the tape counter) reset(UI_MENU_RESET_REMEMBER_POSITION); populate(); -- cgit v1.2.3