mirror of
https://github.com/holub/mame
synced 2025-07-02 16:49:22 +03:00
Refactoring and cleanup of tapectrl.? and bbcontrl.?, created base class
This commit is contained in:
parent
77044d754f
commit
cd9479b751
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -2506,6 +2506,7 @@ src/emu/ui.c svneol=native#text/plain
|
|||||||
src/emu/ui.h svneol=native#text/plain
|
src/emu/ui.h svneol=native#text/plain
|
||||||
src/emu/ui/bbcontrl.c svneol=native#text/plain
|
src/emu/ui/bbcontrl.c svneol=native#text/plain
|
||||||
src/emu/ui/bbcontrl.h svneol=native#text/plain
|
src/emu/ui/bbcontrl.h svneol=native#text/plain
|
||||||
|
src/emu/ui/devctrl.h svneol=native#text/plain
|
||||||
src/emu/ui/filemngr.c svneol=native#text/plain
|
src/emu/ui/filemngr.c svneol=native#text/plain
|
||||||
src/emu/ui/filemngr.h svneol=native#text/plain
|
src/emu/ui/filemngr.h svneol=native#text/plain
|
||||||
src/emu/ui/filesel.c svneol=native#text/plain
|
src/emu/ui/filesel.c svneol=native#text/plain
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "ui/menu.h"
|
#include "ui/menu.h"
|
||||||
#include "ui/bbcontrl.h"
|
#include "ui/bbcontrl.h"
|
||||||
#include "imagedev/bitbngr.h"
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -33,7 +32,8 @@
|
|||||||
// ctor
|
// ctor
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
ui_menu_mess_bitbanger_control::ui_menu_mess_bitbanger_control(running_machine &machine, render_container *container) : ui_menu(machine, container)
|
ui_menu_mess_bitbanger_control::ui_menu_mess_bitbanger_control(running_machine &machine, render_container *container, bitbanger_device *device)
|
||||||
|
: ui_menu_device_control<bitbanger_device>(machine, container, device)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,67 +47,54 @@ ui_menu_mess_bitbanger_control::~ui_menu_mess_bitbanger_control()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
|
||||||
// bitbanger_count - returns the number of bitbanger
|
|
||||||
// devices in the machine
|
|
||||||
//-------------------------------------------------
|
|
||||||
|
|
||||||
int ui_menu_mess_bitbanger_control::bitbanger_count()
|
|
||||||
{
|
|
||||||
bitbanger_device_iterator iter(machine().root_device());
|
|
||||||
return iter.count();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// populate - populates the main bitbanger control menu
|
// populate - populates the main bitbanger control menu
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
void ui_menu_mess_bitbanger_control::populate()
|
void ui_menu_mess_bitbanger_control::populate()
|
||||||
{
|
{
|
||||||
int count = bitbanger_count();
|
|
||||||
UINT32 flags = 0, mode_flags = 0, baud_flags = 0, tune_flags = 0;
|
UINT32 flags = 0, mode_flags = 0, baud_flags = 0, tune_flags = 0;
|
||||||
|
|
||||||
if( count > 0 )
|
if( count() > 0 )
|
||||||
{
|
{
|
||||||
if( index == (count-1) )
|
int index = current_index();
|
||||||
|
|
||||||
|
if( index == (count()-1) )
|
||||||
flags |= MENU_FLAG_LEFT_ARROW;
|
flags |= MENU_FLAG_LEFT_ARROW;
|
||||||
else
|
else
|
||||||
flags |= MENU_FLAG_RIGHT_ARROW;
|
flags |= MENU_FLAG_RIGHT_ARROW;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((device != NULL) && (device->exists()))
|
if ((current_device() != NULL) && (current_device()->exists()))
|
||||||
{
|
{
|
||||||
bitbanger_device *bitbanger = downcast<bitbanger_device *>(&device->device());
|
if (current_device()->inc_mode(TRUE))
|
||||||
|
|
||||||
if (bitbanger->inc_mode(TRUE))
|
|
||||||
mode_flags |= MENU_FLAG_RIGHT_ARROW;
|
mode_flags |= MENU_FLAG_RIGHT_ARROW;
|
||||||
|
|
||||||
if (bitbanger->dec_mode(TRUE))
|
if (current_device()->dec_mode(TRUE))
|
||||||
mode_flags |= MENU_FLAG_LEFT_ARROW;
|
mode_flags |= MENU_FLAG_LEFT_ARROW;
|
||||||
|
|
||||||
if (bitbanger->inc_baud(TRUE))
|
if (current_device()->inc_baud(TRUE))
|
||||||
baud_flags |= MENU_FLAG_RIGHT_ARROW;
|
baud_flags |= MENU_FLAG_RIGHT_ARROW;
|
||||||
|
|
||||||
if (bitbanger->dec_baud(TRUE))
|
if (current_device()->dec_baud(TRUE))
|
||||||
baud_flags |= MENU_FLAG_LEFT_ARROW;
|
baud_flags |= MENU_FLAG_LEFT_ARROW;
|
||||||
|
|
||||||
if (bitbanger->inc_tune(TRUE))
|
if (current_device()->inc_tune(TRUE))
|
||||||
tune_flags |= MENU_FLAG_RIGHT_ARROW;
|
tune_flags |= MENU_FLAG_RIGHT_ARROW;
|
||||||
|
|
||||||
if (bitbanger->dec_tune(TRUE))
|
if (current_device()->dec_tune(TRUE))
|
||||||
tune_flags |= MENU_FLAG_LEFT_ARROW;
|
tune_flags |= MENU_FLAG_LEFT_ARROW;
|
||||||
|
|
||||||
// name of bitbanger file
|
// name of bitbanger file
|
||||||
item_append(device->device().name(), device->filename(), flags, BITBANGERCMD_SELECT);
|
item_append(current_device()->device().name(), current_device()->filename(), flags, BITBANGERCMD_SELECT);
|
||||||
item_append("Device Mode:", bitbanger->mode_string(), mode_flags, BITBANGERCMD_MODE);
|
item_append("Device Mode:", current_device()->mode_string(), mode_flags, BITBANGERCMD_MODE);
|
||||||
item_append("Baud:", bitbanger->baud_string(), baud_flags, BITBANGERCMD_BAUD);
|
item_append("Baud:", current_device()->baud_string(), baud_flags, BITBANGERCMD_BAUD);
|
||||||
item_append("Baud Tune:", bitbanger->tune_string(), tune_flags, BITBANGERCMD_TUNE);
|
item_append("Baud Tune:", current_device()->tune_string(), tune_flags, BITBANGERCMD_TUNE);
|
||||||
item_append("Protocol:", "8-1-N", 0, NULL);
|
item_append("Protocol:", "8-1-N", 0, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// no tape loaded
|
// no bitbanger loaded
|
||||||
item_append("No Bitbanger Image loaded", NULL, flags, NULL);
|
item_append("No Bitbanger Image loaded", NULL, flags, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,17 +106,6 @@ void ui_menu_mess_bitbanger_control::populate()
|
|||||||
|
|
||||||
void ui_menu_mess_bitbanger_control::handle()
|
void ui_menu_mess_bitbanger_control::handle()
|
||||||
{
|
{
|
||||||
// do we have to load the device?
|
|
||||||
if (device == NULL)
|
|
||||||
{
|
|
||||||
bitbanger_device_iterator iter(machine().root_device());
|
|
||||||
device = iter.byindex(index);
|
|
||||||
reset((ui_menu_reset_options)0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the bitbanger
|
|
||||||
bitbanger_device *bitbanger = downcast<bitbanger_device *>(device);
|
|
||||||
|
|
||||||
// rebuild the menu
|
// rebuild the menu
|
||||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||||
populate();
|
populate();
|
||||||
@ -142,52 +118,25 @@ void ui_menu_mess_bitbanger_control::handle()
|
|||||||
{
|
{
|
||||||
case IPT_UI_LEFT:
|
case IPT_UI_LEFT:
|
||||||
if (event->itemref==BITBANGERCMD_SELECT)
|
if (event->itemref==BITBANGERCMD_SELECT)
|
||||||
{
|
previous();
|
||||||
// left arrow - rotate left through cassette devices
|
|
||||||
if (index > 0)
|
|
||||||
index--;
|
|
||||||
else
|
|
||||||
index = bitbanger_count() - 1;
|
|
||||||
device = NULL;
|
|
||||||
}
|
|
||||||
else if (event->itemref==BITBANGERCMD_MODE)
|
else if (event->itemref==BITBANGERCMD_MODE)
|
||||||
{
|
current_device()->dec_mode(false);
|
||||||
bitbanger->dec_mode(FALSE);
|
|
||||||
}
|
|
||||||
else if (event->itemref==BITBANGERCMD_BAUD)
|
else if (event->itemref==BITBANGERCMD_BAUD)
|
||||||
{
|
current_device()->dec_baud(false);
|
||||||
bitbanger->dec_baud(FALSE);
|
|
||||||
}
|
|
||||||
else if (event->itemref==BITBANGERCMD_TUNE)
|
else if (event->itemref==BITBANGERCMD_TUNE)
|
||||||
{
|
current_device()->dec_tune(false);
|
||||||
bitbanger->dec_tune(FALSE);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IPT_UI_RIGHT:
|
case IPT_UI_RIGHT:
|
||||||
if (event->itemref==BITBANGERCMD_SELECT)
|
if (event->itemref==BITBANGERCMD_SELECT)
|
||||||
{
|
next();
|
||||||
// right arrow - rotate right through cassette devices
|
|
||||||
if (index < bitbanger_count() - 1)
|
|
||||||
index++;
|
|
||||||
else
|
|
||||||
index = 0;
|
|
||||||
device = NULL;
|
|
||||||
}
|
|
||||||
else if (event->itemref==BITBANGERCMD_MODE)
|
else if (event->itemref==BITBANGERCMD_MODE)
|
||||||
{
|
current_device()->inc_mode(false);
|
||||||
bitbanger->inc_mode(FALSE);
|
|
||||||
}
|
|
||||||
else if (event->itemref==BITBANGERCMD_BAUD)
|
else if (event->itemref==BITBANGERCMD_BAUD)
|
||||||
{
|
current_device()->inc_baud(false);
|
||||||
bitbanger->inc_baud(FALSE);
|
|
||||||
}
|
|
||||||
else if (event->itemref==BITBANGERCMD_TUNE)
|
else if (event->itemref==BITBANGERCMD_TUNE)
|
||||||
{
|
current_device()->inc_tune(false);
|
||||||
bitbanger->inc_tune(FALSE);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,17 +14,15 @@
|
|||||||
#ifndef __UI_BBCONTRL_H__
|
#ifndef __UI_BBCONTRL_H__
|
||||||
#define __UI_BBCONTRL_H__
|
#define __UI_BBCONTRL_H__
|
||||||
|
|
||||||
class ui_menu_mess_bitbanger_control : public ui_menu {
|
#include "imagedev/bitbngr.h"
|
||||||
|
#include "ui/devctrl.h"
|
||||||
|
|
||||||
|
class ui_menu_mess_bitbanger_control : public ui_menu_device_control<bitbanger_device> {
|
||||||
public:
|
public:
|
||||||
ui_menu_mess_bitbanger_control(running_machine &machine, render_container *container);
|
ui_menu_mess_bitbanger_control(running_machine &machine, render_container *container, bitbanger_device *bitbanger);
|
||||||
virtual ~ui_menu_mess_bitbanger_control();
|
virtual ~ui_menu_mess_bitbanger_control();
|
||||||
virtual void populate();
|
virtual void populate();
|
||||||
virtual void handle();
|
virtual void handle();
|
||||||
|
|
||||||
private:
|
|
||||||
int index;
|
|
||||||
device_image_interface *device;
|
|
||||||
int bitbanger_count();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __UI_BBCONTRL_H__
|
#endif // __UI_BBCONTRL_H__
|
||||||
|
107
src/emu/ui/devctrl.h
Normal file
107
src/emu/ui/devctrl.h
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
|
||||||
|
ui/devctrl.h
|
||||||
|
|
||||||
|
Device specific control (base class for tapectrl and bbcontrl)
|
||||||
|
|
||||||
|
Copyright Nicola Salmoria and the MAME Team.
|
||||||
|
Visit http://mamedev.org for licensing and usage restrictions.
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __UI_DEVCTRL_H__
|
||||||
|
#define __UI_DEVCTRL_H__
|
||||||
|
|
||||||
|
template<class _DeviceType>
|
||||||
|
class ui_menu_device_control : public ui_menu
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ui_menu_device_control(running_machine &machine, render_container *container, _DeviceType *device);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
_DeviceType *current_device() { return m_device; }
|
||||||
|
int count() { return m_count; }
|
||||||
|
|
||||||
|
int current_index();
|
||||||
|
void previous();
|
||||||
|
void next();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// device iterator
|
||||||
|
typedef device_type_iterator<&device_creator<_DeviceType>, _DeviceType> device_iterator;
|
||||||
|
|
||||||
|
_DeviceType * m_device;
|
||||||
|
int m_count;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// ctor
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
template<class _DeviceType>
|
||||||
|
ui_menu_device_control<_DeviceType>::ui_menu_device_control(running_machine &machine, render_container *container, _DeviceType *device)
|
||||||
|
: ui_menu(machine, container)
|
||||||
|
{
|
||||||
|
device_iterator iter(machine.root_device());
|
||||||
|
m_device = device ? device : iter.first();
|
||||||
|
m_count = iter.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// current_index
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
template<class _DeviceType>
|
||||||
|
int ui_menu_device_control<_DeviceType>::current_index()
|
||||||
|
{
|
||||||
|
device_iterator iter(machine().root_device());
|
||||||
|
return iter.indexof(*m_device);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// previous
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
template<class _DeviceType>
|
||||||
|
void ui_menu_device_control<_DeviceType>::previous()
|
||||||
|
{
|
||||||
|
// left arrow - rotate left through cassette devices
|
||||||
|
if (m_device != NULL)
|
||||||
|
{
|
||||||
|
device_iterator iter(machine().root_device());
|
||||||
|
int index = iter.indexof(*m_device);
|
||||||
|
if (index > 0)
|
||||||
|
index--;
|
||||||
|
else
|
||||||
|
index = m_count - 1;
|
||||||
|
m_device = iter.byindex(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------
|
||||||
|
// next
|
||||||
|
//-------------------------------------------------
|
||||||
|
|
||||||
|
template<class _DeviceType>
|
||||||
|
void ui_menu_device_control<_DeviceType>::next()
|
||||||
|
{
|
||||||
|
// right arrow - rotate right through cassette devices
|
||||||
|
if (m_device != NULL)
|
||||||
|
{
|
||||||
|
device_iterator iter(machine().root_device());
|
||||||
|
int index = iter.indexof(*m_device);
|
||||||
|
if (index < m_count - 1)
|
||||||
|
index++;
|
||||||
|
else
|
||||||
|
index = 0;
|
||||||
|
m_device = iter.byindex(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* __UI_DEVCTRL_H__ */
|
@ -187,11 +187,11 @@ void ui_menu_main::handle()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MESS_MENU_TAPE_CONTROL:
|
case MESS_MENU_TAPE_CONTROL:
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_mess_tape_control(machine(), container)));
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_mess_tape_control(machine(), container, NULL)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MESS_MENU_BITBANGER_CONTROL:
|
case MESS_MENU_BITBANGER_CONTROL:
|
||||||
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_mess_bitbanger_control(machine(), container)));
|
ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_mess_bitbanger_control(machine(), container, NULL)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SLOT_DEVICES:
|
case SLOT_DEVICES:
|
||||||
|
@ -36,8 +36,8 @@
|
|||||||
// ctor
|
// ctor
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
ui_menu_mess_tape_control::ui_menu_mess_tape_control(running_machine &machine, render_container *container)
|
ui_menu_mess_tape_control::ui_menu_mess_tape_control(running_machine &machine, render_container *container, cassette_image_device *device)
|
||||||
: ui_menu(machine, container)
|
: ui_menu_device_control<cassette_image_device>(machine, container, device)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,18 +51,6 @@ ui_menu_mess_tape_control::~ui_menu_mess_tape_control()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
|
||||||
// cassette_count - returns the number of cassette
|
|
||||||
// devices in the machine
|
|
||||||
//-------------------------------------------------
|
|
||||||
|
|
||||||
int ui_menu_mess_tape_control::cassette_count()
|
|
||||||
{
|
|
||||||
cassette_device_iterator iter(machine().root_device());
|
|
||||||
return iter.count();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// populate - populates the main tape control menu
|
// populate - populates the main tape control menu
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -71,25 +59,25 @@ void ui_menu_mess_tape_control::populate()
|
|||||||
{
|
{
|
||||||
astring timepos;
|
astring timepos;
|
||||||
cassette_state state;
|
cassette_state state;
|
||||||
int count = cassette_count();
|
|
||||||
UINT32 flags = 0;
|
UINT32 flags = 0;
|
||||||
|
|
||||||
if( count > 0 )
|
if (count() > 0)
|
||||||
{
|
{
|
||||||
if( index == (count-1) )
|
int index = current_index();
|
||||||
|
|
||||||
|
if( index == (count()-1) )
|
||||||
flags |= MENU_FLAG_LEFT_ARROW;
|
flags |= MENU_FLAG_LEFT_ARROW;
|
||||||
else
|
else
|
||||||
flags |= MENU_FLAG_RIGHT_ARROW;
|
flags |= MENU_FLAG_RIGHT_ARROW;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((device != NULL) && (device->exists()))
|
if ((current_device() != NULL) && (current_device()->exists()))
|
||||||
{
|
{
|
||||||
double t0, t1;
|
double t0, t1;
|
||||||
UINT32 tapeflags = 0;
|
UINT32 tapeflags = 0;
|
||||||
cassette_image_device* cassette = dynamic_cast<cassette_image_device*>(&device->device());
|
|
||||||
|
|
||||||
t0 = cassette->get_position();
|
t0 = current_device()->get_position();
|
||||||
t1 = cassette->get_length();
|
t1 = current_device()->get_length();
|
||||||
|
|
||||||
if (t1 > 0)
|
if (t1 > 0)
|
||||||
{
|
{
|
||||||
@ -100,11 +88,11 @@ void ui_menu_mess_tape_control::populate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// name of tape
|
// name of tape
|
||||||
item_append(device->device().name(), device->filename(), flags, TAPECMD_SELECT);
|
item_append(current_device()->device().name(), current_device()->filename(), flags, TAPECMD_SELECT);
|
||||||
|
|
||||||
// state
|
// state
|
||||||
get_time_string(timepos, cassette, NULL, NULL);
|
get_time_string(timepos, current_device(), NULL, NULL);
|
||||||
state = cassette->get_state();
|
state = current_device()->get_state();
|
||||||
item_append(
|
item_append(
|
||||||
(state & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED
|
(state & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED
|
||||||
? "stopped"
|
? "stopped"
|
||||||
@ -145,20 +133,10 @@ void ui_menu_mess_tape_control::populate()
|
|||||||
|
|
||||||
void ui_menu_mess_tape_control::handle()
|
void ui_menu_mess_tape_control::handle()
|
||||||
{
|
{
|
||||||
// do we have to load the device?
|
|
||||||
if (device == NULL)
|
|
||||||
{
|
|
||||||
cassette_device_iterator iter(machine().root_device());
|
|
||||||
device = iter.byindex(index);
|
|
||||||
reset((ui_menu_reset_options)0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// rebuild the menu - we have to do this so that the counter updates
|
// rebuild the menu - we have to do this so that the counter updates
|
||||||
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
reset(UI_MENU_RESET_REMEMBER_POSITION);
|
||||||
populate();
|
populate();
|
||||||
|
|
||||||
cassette_image_device* cassette = dynamic_cast<cassette_image_device*>(&device->device());
|
|
||||||
|
|
||||||
// process the menu
|
// process the menu
|
||||||
const ui_menu_event *event = process(UI_MENU_PROCESS_LR_REPEAT);
|
const ui_menu_event *event = process(UI_MENU_PROCESS_LR_REPEAT);
|
||||||
if (event != NULL)
|
if (event != NULL)
|
||||||
@ -167,46 +145,32 @@ void ui_menu_mess_tape_control::handle()
|
|||||||
{
|
{
|
||||||
case IPT_UI_LEFT:
|
case IPT_UI_LEFT:
|
||||||
if (event->itemref==TAPECMD_SLIDER)
|
if (event->itemref==TAPECMD_SLIDER)
|
||||||
cassette->seek(-1, SEEK_CUR);
|
current_device()->seek(-1, SEEK_CUR);
|
||||||
else if (event->itemref==TAPECMD_SELECT)
|
else if (event->itemref==TAPECMD_SELECT)
|
||||||
{
|
previous();
|
||||||
// left arrow - rotate left through cassette devices
|
|
||||||
if (index > 0)
|
|
||||||
index--;
|
|
||||||
else
|
|
||||||
index = cassette_count() - 1;
|
|
||||||
device = NULL;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IPT_UI_RIGHT:
|
case IPT_UI_RIGHT:
|
||||||
if (event->itemref==TAPECMD_SLIDER)
|
if (event->itemref==TAPECMD_SLIDER)
|
||||||
cassette->seek(+1, SEEK_CUR);
|
current_device()->seek(+1, SEEK_CUR);
|
||||||
else if (event->itemref==TAPECMD_SELECT)
|
else if (event->itemref==TAPECMD_SELECT)
|
||||||
{
|
next();
|
||||||
// right arrow - rotate right through cassette devices
|
|
||||||
if (index < cassette_count() - 1)
|
|
||||||
index++;
|
|
||||||
else
|
|
||||||
index = 0;
|
|
||||||
device = NULL;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IPT_UI_SELECT:
|
case IPT_UI_SELECT:
|
||||||
{
|
{
|
||||||
if (event->itemref==TAPECMD_STOP)
|
if (event->itemref==TAPECMD_STOP)
|
||||||
cassette->change_state(CASSETTE_STOPPED, CASSETTE_MASK_UISTATE);
|
current_device()->change_state(CASSETTE_STOPPED, CASSETTE_MASK_UISTATE);
|
||||||
else if (event->itemref==TAPECMD_PLAY)
|
else if (event->itemref==TAPECMD_PLAY)
|
||||||
cassette->change_state(CASSETTE_PLAY, CASSETTE_MASK_UISTATE);
|
current_device()->change_state(CASSETTE_PLAY, CASSETTE_MASK_UISTATE);
|
||||||
else if (event->itemref==TAPECMD_RECORD)
|
else if (event->itemref==TAPECMD_RECORD)
|
||||||
cassette->change_state(CASSETTE_RECORD, CASSETTE_MASK_UISTATE);
|
current_device()->change_state(CASSETTE_RECORD, CASSETTE_MASK_UISTATE);
|
||||||
else if (event->itemref==TAPECMD_REWIND)
|
else if (event->itemref==TAPECMD_REWIND)
|
||||||
cassette->seek(-30, SEEK_CUR);
|
current_device()->seek(-30, SEEK_CUR);
|
||||||
else if (event->itemref==TAPECMD_FAST_FORWARD)
|
else if (event->itemref==TAPECMD_FAST_FORWARD)
|
||||||
cassette->seek(30, SEEK_CUR);
|
current_device()->seek(30, SEEK_CUR);
|
||||||
else if (event->itemref==TAPECMD_SLIDER)
|
else if (event->itemref==TAPECMD_SLIDER)
|
||||||
cassette->seek(0, SEEK_SET);
|
current_device()->seek(0, SEEK_SET);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -15,19 +15,16 @@
|
|||||||
#define __UI_TAPECTRL_H__
|
#define __UI_TAPECTRL_H__
|
||||||
|
|
||||||
#include "imagedev/cassette.h"
|
#include "imagedev/cassette.h"
|
||||||
|
#include "ui/devctrl.h"
|
||||||
|
|
||||||
class ui_menu_mess_tape_control : public ui_menu {
|
class ui_menu_mess_tape_control : public ui_menu_device_control<cassette_image_device> {
|
||||||
public:
|
public:
|
||||||
ui_menu_mess_tape_control(running_machine &machine, render_container *container);
|
ui_menu_mess_tape_control(running_machine &machine, render_container *container, cassette_image_device *device);
|
||||||
virtual ~ui_menu_mess_tape_control();
|
virtual ~ui_menu_mess_tape_control();
|
||||||
virtual void populate();
|
virtual void populate();
|
||||||
virtual void handle();
|
virtual void handle();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int index;
|
|
||||||
device_image_interface *device;
|
|
||||||
int cassette_count();
|
|
||||||
|
|
||||||
static void get_time_string(astring &dest, cassette_image_device *cassette, int *curpos, int *endpos);
|
static void get_time_string(astring &dest, cassette_image_device *cassette, int *curpos, int *endpos);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user