mirror of https://github.com/stella-emu/stella.git
Reworked EventMappingDialog, turning it into one tab in the new
InputDialog. This new class will include all things related to Stella input. For now, the old eventmapper is on one tab, and the 'mouse is paddle' setting is on the other. The latter tab will be expanded to include SDL to Stella joystick enumeration (currently done by the leftport and rightport commandline arguments), as well as the ability to set mouse sensitivity for paddle emulation. Note, there's still a bug in the interaction between the eventmapper tab and focusing on the event list. Focusing only takes effect after switching to a new tab, then back to the remapper. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@879 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
2d2bd5f62d
commit
cc668b22bc
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Dialog.cxx,v 1.32 2005-10-14 13:50:00 stephena Exp $
|
||||
// $Id: Dialog.cxx,v 1.33 2005-11-13 22:25:47 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -224,7 +224,6 @@ void Dialog::handleMouseDown(int x, int y, int button, int clickCount)
|
|||
_focusedWidget = Widget::setFocusForChain(this, getFocusList(), w, 0);
|
||||
}
|
||||
|
||||
|
||||
if(w)
|
||||
w->handleMouseDown(x - (w->getAbsX() - _x), y - (w->getAbsY() - _y), button, clickCount);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: EventMappingDialog.cxx,v 1.20 2005-11-13 16:17:10 stephena Exp $
|
||||
// $Id: EventMappingWidget.cxx,v 1.1 2005-11-13 22:25:47 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -22,55 +22,58 @@
|
|||
#include "OSystem.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "StringListWidget.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "Dialog.hxx"
|
||||
#include "GuiUtils.hxx"
|
||||
#include "Event.hxx"
|
||||
#include "EventHandler.hxx"
|
||||
#include "EventMappingDialog.hxx"
|
||||
#include "EventMappingWidget.hxx"
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
EventMappingDialog::EventMappingDialog(OSystem* osystem, DialogContainer* parent,
|
||||
int x, int y, int w, int h)
|
||||
: Dialog(osystem, parent, x, y, w, h),
|
||||
EventMappingWidget::EventMappingWidget(GuiObject* boss, int x, int y, int w, int h)
|
||||
: Widget(boss, x, y, w, h),
|
||||
CommandSender(boss),
|
||||
myActionSelected(-1),
|
||||
myRemapStatus(false)
|
||||
{
|
||||
// Add Default and OK buttons
|
||||
myDefaultsButton = addButton(10, h - 24, "Defaults", kDefaultsCmd, 0);
|
||||
myOKButton = addButton(w - (kButtonWidth + 10), h - 24, "OK", kOKCmd, 0);
|
||||
const GUI::Font& font = instance()->font();
|
||||
const int fontHeight = font.getFontHeight(),
|
||||
lineHeight = font.getLineHeight();
|
||||
int xpos = 5, ypos = 5;
|
||||
|
||||
new StaticTextWidget(this, 10, 8, 150, kFontHeight,
|
||||
"Select an event to remap:", kTextAlignCenter);
|
||||
|
||||
myActionsList = new StringListWidget(this, instance()->font(), 10, 20, 150, 100);
|
||||
myActionsList = new StringListWidget(boss, font, xpos, ypos,
|
||||
_w - 70, _h - 3*lineHeight);
|
||||
myActionsList->setTarget(this);
|
||||
myActionsList->setNumberingMode(kListNumberingOff);
|
||||
myActionsList->setEditable(false);
|
||||
myActionsList->setFlags(WIDGET_NODRAW_FOCUS);
|
||||
// myActionsList->setFlags(WIDGET_NODRAW_FOCUS);
|
||||
addFocusWidget(myActionsList);
|
||||
|
||||
myKeyMapping = new StaticTextWidget(this, 10, 125, w - 20, kFontHeight,
|
||||
// Add remap, erase, cancel and default buttons
|
||||
xpos += myActionsList->getWidth() + 15; ypos += 5;
|
||||
myMapButton = new ButtonWidget(boss, xpos, ypos, 50, 16,
|
||||
"Map", kStartMapCmd);
|
||||
myMapButton->setTarget(this);
|
||||
ypos += 20;
|
||||
myEraseButton = new ButtonWidget(boss, xpos, ypos, 50, 16,
|
||||
"Erase", kEraseCmd);
|
||||
myEraseButton->setTarget(this);
|
||||
ypos += 20;
|
||||
myCancelMapButton = new ButtonWidget(boss, xpos, ypos, 50, 16,
|
||||
"Cancel", kStopMapCmd);
|
||||
myCancelMapButton->setTarget(this);
|
||||
myCancelMapButton->clearFlags(WIDGET_ENABLED);
|
||||
ypos += 30;
|
||||
myDefaultsButton = new ButtonWidget(boss, xpos, ypos, 50, 16,
|
||||
"Defaults", kDefaultsCmd);
|
||||
myDefaultsButton->setTarget(this);
|
||||
|
||||
// Show message for currently selected event
|
||||
xpos = 10; ypos = 5 + myActionsList->getHeight() + 3;
|
||||
myKeyMapping = new StaticTextWidget(boss, xpos, ypos, _w - 20, fontHeight,
|
||||
"Action: ", kTextAlignLeft);
|
||||
myKeyMapping->setFlags(WIDGET_CLEARBG);
|
||||
|
||||
// Add remap and erase buttons
|
||||
myMapButton = addButton(170, 25, "Map", kStartMapCmd, 0);
|
||||
myEraseButton = addButton(170, 45, "Erase", kEraseCmd, 0);
|
||||
myCancelMapButton = addButton(170, 65, "Cancel", kStopMapCmd, 0);
|
||||
myCancelMapButton->clearFlags(WIDGET_ENABLED);
|
||||
|
||||
// Add 'mouse to paddle' mapping
|
||||
myPaddleModeText = new StaticTextWidget(this, 168, 93, 50, kFontHeight,
|
||||
"Mouse is", kTextAlignCenter);
|
||||
myPaddleModePopup = new PopUpWidget(this, 160, 105, 60, kLineHeight,
|
||||
"paddle: ", 40, 0);
|
||||
myPaddleModePopup->appendEntry("0", 0);
|
||||
myPaddleModePopup->appendEntry("1", 1);
|
||||
myPaddleModePopup->appendEntry("2", 2);
|
||||
myPaddleModePopup->appendEntry("3", 3);
|
||||
|
||||
// Get actions names
|
||||
StringList l;
|
||||
|
||||
|
@ -81,32 +84,25 @@ EventMappingDialog::EventMappingDialog(OSystem* osystem, DialogContainer* parent
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
EventMappingDialog::~EventMappingDialog()
|
||||
EventMappingWidget::~EventMappingWidget()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventMappingDialog::loadConfig()
|
||||
void EventMappingWidget::loadConfig()
|
||||
{
|
||||
// Make sure remapping is turned off, just in case the user didn't properly
|
||||
// exit from the dialog last time
|
||||
// exit last time
|
||||
stopRemapping();
|
||||
|
||||
// Paddle mode
|
||||
int mode = instance()->settings().getInt("paddle");
|
||||
myPaddleModePopup->setSelectedTag(mode);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventMappingDialog::saveConfig()
|
||||
void EventMappingWidget::saveConfig()
|
||||
{
|
||||
// Paddle mode
|
||||
int mode = myPaddleModePopup->getSelectedTag();
|
||||
instance()->eventHandler().setPaddleMode(mode);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventMappingDialog::startRemapping()
|
||||
void EventMappingWidget::startRemapping()
|
||||
{
|
||||
if(myActionSelected < 0 || myRemapStatus)
|
||||
return;
|
||||
|
@ -119,9 +115,6 @@ void EventMappingDialog::startRemapping()
|
|||
myMapButton->setEnabled(false);
|
||||
myEraseButton->setEnabled(false);
|
||||
myDefaultsButton->setEnabled(false);
|
||||
myOKButton->setEnabled(false);
|
||||
myPaddleModeText->setEnabled(false);
|
||||
myPaddleModePopup->setEnabled(false);
|
||||
myCancelMapButton->setEnabled(true);
|
||||
|
||||
// And show a message indicating which key is being remapped
|
||||
|
@ -133,7 +126,7 @@ void EventMappingDialog::startRemapping()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventMappingDialog::eraseRemapping()
|
||||
void EventMappingWidget::eraseRemapping()
|
||||
{
|
||||
if(myActionSelected < 0)
|
||||
return;
|
||||
|
@ -145,7 +138,7 @@ void EventMappingDialog::eraseRemapping()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventMappingDialog::stopRemapping()
|
||||
void EventMappingWidget::stopRemapping()
|
||||
{
|
||||
// Turn off remap mode
|
||||
myRemapStatus = false;
|
||||
|
@ -155,9 +148,6 @@ void EventMappingDialog::stopRemapping()
|
|||
myMapButton->setEnabled(false);
|
||||
myEraseButton->setEnabled(false);
|
||||
myDefaultsButton->setEnabled(true);
|
||||
myOKButton->setEnabled(true);
|
||||
myPaddleModeText->setEnabled(true);
|
||||
myPaddleModePopup->setEnabled(true);
|
||||
myCancelMapButton->setEnabled(false);
|
||||
|
||||
// Make sure the list widget is in a known state
|
||||
|
@ -170,7 +160,7 @@ void EventMappingDialog::stopRemapping()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventMappingDialog::drawKeyMapping()
|
||||
void EventMappingWidget::drawKeyMapping()
|
||||
{
|
||||
if(myActionSelected >= 0)
|
||||
{
|
||||
|
@ -181,9 +171,9 @@ void EventMappingDialog::drawKeyMapping()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventMappingDialog::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||
bool EventMappingWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||
{
|
||||
// Remap keys in remap mode, otherwise pass to listwidget
|
||||
// Remap keys in remap mode
|
||||
if(myRemapStatus && myActionSelected >= 0)
|
||||
{
|
||||
Event::Type event = EventHandler::ourActionList[ myActionSelected ].event;
|
||||
|
@ -191,14 +181,13 @@ void EventMappingDialog::handleKeyDown(int ascii, int keycode, int modifiers)
|
|||
|
||||
stopRemapping();
|
||||
}
|
||||
else
|
||||
myActionsList->handleKeyDown(ascii, keycode, modifiers);
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventMappingDialog::handleJoyDown(int stick, int button)
|
||||
void EventMappingWidget::handleJoyDown(int stick, int button)
|
||||
{
|
||||
// Remap joystick buttons in remap mode, otherwise pass to listwidget
|
||||
// Remap joystick buttons in remap mode
|
||||
if(myRemapStatus && myActionSelected >= 0)
|
||||
{
|
||||
Event::Type event = EventHandler::ourActionList[ myActionSelected ].event;
|
||||
|
@ -206,21 +195,14 @@ void EventMappingDialog::handleJoyDown(int stick, int button)
|
|||
|
||||
stopRemapping();
|
||||
}
|
||||
else
|
||||
myActionsList->handleJoyDown(stick, button);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventMappingDialog::handleCommand(CommandSender* sender, int cmd,
|
||||
void EventMappingWidget::handleCommand(CommandSender* sender, int cmd,
|
||||
int data, int id)
|
||||
{
|
||||
switch(cmd)
|
||||
{
|
||||
case kOKCmd:
|
||||
saveConfig();
|
||||
close();
|
||||
break;
|
||||
|
||||
case kListSelectionChangedCmd:
|
||||
if(myActionsList->getSelected() >= 0)
|
||||
{
|
||||
|
@ -248,8 +230,5 @@ void EventMappingDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
instance()->eventHandler().setDefaultMapping();
|
||||
drawKeyMapping();
|
||||
break;
|
||||
|
||||
default:
|
||||
Dialog::handleCommand(sender, cmd, data, 0);
|
||||
}
|
||||
}
|
|
@ -13,14 +13,14 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: EventMappingDialog.hxx,v 1.12 2005-08-22 18:17:10 stephena Exp $
|
||||
// $Id: EventMappingWidget.hxx,v 1.1 2005-11-13 22:25:47 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#ifndef EVENT_MAPPING_DIALOG_HXX
|
||||
#define EVENT_MAPPING_DIALOG_HXX
|
||||
#ifndef EVENT_MAPPING_WIDGET_HXX
|
||||
#define EVENT_MAPPING_WIDGET_HXX
|
||||
|
||||
class DialogContainer;
|
||||
class CommandSender;
|
||||
|
@ -28,30 +28,31 @@ class ButtonWidget;
|
|||
class StaticTextWidget;
|
||||
class StringListWidget;
|
||||
class PopUpWidget;
|
||||
class GuiObject;
|
||||
|
||||
#include "OSystem.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "Command.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
class EventMappingDialog : public Dialog
|
||||
|
||||
class EventMappingWidget : public Widget, public CommandSender
|
||||
{
|
||||
public:
|
||||
EventMappingDialog(OSystem* osystem, DialogContainer* parent,
|
||||
int x, int y, int w, int h);
|
||||
~EventMappingDialog();
|
||||
EventMappingWidget(GuiObject* boss, int x, int y, int w, int h);
|
||||
~EventMappingWidget();
|
||||
|
||||
virtual void handleKeyDown(int ascii, int keycode, int modifiers);
|
||||
virtual bool handleKeyDown(int ascii, int keycode, int modifiers);
|
||||
virtual void handleJoyDown(int stick, int button);
|
||||
|
||||
bool remapMode() { return myRemapStatus; }
|
||||
|
||||
protected:
|
||||
ButtonWidget* myMapButton;
|
||||
ButtonWidget* myCancelMapButton;
|
||||
ButtonWidget* myEraseButton;
|
||||
ButtonWidget* myOKButton;
|
||||
ButtonWidget* myDefaultsButton;
|
||||
StringListWidget* myActionsList;
|
||||
StaticTextWidget* myKeyMapping;
|
||||
PopUpWidget* myPaddleModePopup;
|
||||
StaticTextWidget* myPaddleModeText;
|
||||
|
||||
private:
|
||||
enum {
|
|
@ -0,0 +1,147 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: InputDialog.cxx,v 1.1 2005-11-13 22:25:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "OSystem.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "Array.hxx"
|
||||
#include "TabWidget.hxx"
|
||||
#include "EventMappingWidget.hxx"
|
||||
#include "InputDialog.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
InputDialog::InputDialog(
|
||||
OSystem* osystem, DialogContainer* parent,
|
||||
int x, int y, int w, int h)
|
||||
: Dialog(osystem, parent, x, y, w, h)
|
||||
{
|
||||
const GUI::Font& font = instance()->font();
|
||||
const int fontHeight = font.getFontHeight(),
|
||||
lineHeight = font.getLineHeight();
|
||||
|
||||
const int vBorder = 4;
|
||||
int xpos, ypos, tabID;
|
||||
WidgetArray wid;
|
||||
|
||||
// The tab widget
|
||||
xpos = 2; ypos = vBorder;
|
||||
myTab = new TabWidget(this, xpos, ypos, _w - 2*xpos, _h - 24 - 2*ypos);
|
||||
addTabWidget(myTab);
|
||||
|
||||
// 1) Event mapper
|
||||
tabID = myTab->addTab("Event Mapping");
|
||||
myEventMapper = new EventMappingWidget(myTab, 2, 2,
|
||||
myTab->getWidth(),
|
||||
myTab->getHeight() - ypos);
|
||||
myTab->setParentWidget(tabID, myEventMapper);
|
||||
addToFocusList(myEventMapper->getFocusList(), tabID);
|
||||
|
||||
// 2) Virtual device support
|
||||
wid.clear();
|
||||
tabID = myTab->addTab("Virtual Devices");
|
||||
|
||||
// Add 'mouse to paddle' mapping
|
||||
myPaddleModeText = new StaticTextWidget(myTab, 168, 93, 50, fontHeight,
|
||||
"Mouse is", kTextAlignCenter);
|
||||
myPaddleModePopup = new PopUpWidget(myTab, 160, 105, 60, lineHeight,
|
||||
"paddle: ", 40, 0);
|
||||
myPaddleModePopup->appendEntry("0", 0);
|
||||
myPaddleModePopup->appendEntry("1", 1);
|
||||
myPaddleModePopup->appendEntry("2", 2);
|
||||
myPaddleModePopup->appendEntry("3", 3);
|
||||
wid.push_back(myPaddleModePopup);
|
||||
|
||||
// Add items for virtual device ports
|
||||
addToFocusList(wid, tabID);
|
||||
|
||||
// Activate the first tab
|
||||
myTab->setActiveTab(0);
|
||||
|
||||
// Add OK and Cancel buttons
|
||||
#ifndef MAC_OSX
|
||||
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd, 0);
|
||||
addButton(_w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0);
|
||||
#else
|
||||
addButton(_w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd, 0);
|
||||
addButton(_w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
InputDialog::~InputDialog()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void InputDialog::loadConfig()
|
||||
{
|
||||
// Paddle mode
|
||||
int mode = instance()->settings().getInt("paddle");
|
||||
myPaddleModePopup->setSelectedTag(mode);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void InputDialog::saveConfig()
|
||||
{
|
||||
// Paddle mode
|
||||
int mode = myPaddleModePopup->getSelectedTag();
|
||||
instance()->eventHandler().setPaddleMode(mode);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void InputDialog::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||
{
|
||||
// Remap key events in remap mode, otherwise pass to listwidget
|
||||
if(myEventMapper->remapMode())
|
||||
myEventMapper->handleKeyDown(ascii, keycode, modifiers);
|
||||
else
|
||||
Dialog::handleKeyDown(ascii, keycode, modifiers);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void InputDialog::handleJoyDown(int stick, int button)
|
||||
{
|
||||
// Remap joystick buttons in remap mode, otherwise pass to listwidget
|
||||
if(myEventMapper->remapMode())
|
||||
myEventMapper->handleJoyDown(stick, button);
|
||||
else
|
||||
Dialog::handleJoyDown(stick, button);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void InputDialog::handleCommand(CommandSender* sender, int cmd,
|
||||
int data, int id)
|
||||
{
|
||||
switch(cmd)
|
||||
{
|
||||
case kOKCmd:
|
||||
saveConfig();
|
||||
close();
|
||||
break;
|
||||
|
||||
case kCloseCmd:
|
||||
// Revert changes made to event mapping
|
||||
close();
|
||||
break;
|
||||
|
||||
default:
|
||||
Dialog::handleCommand(sender, cmd, data, 0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
//============================================================================
|
||||
//
|
||||
// SSSS tt lll lll
|
||||
// SS SS tt ll ll
|
||||
// SS tttttt eeee ll ll aaaa
|
||||
// SSSS tt ee ee ll ll aa
|
||||
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||
// SS SS tt ee ll ll aa aa
|
||||
// SSSS ttt eeeee llll llll aaaaa
|
||||
//
|
||||
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: InputDialog.hxx,v 1.1 2005-11-13 22:25:47 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef INPUT_DIALOG_HXX
|
||||
#define INPUT_DIALOG_HXX
|
||||
|
||||
class OSystem;
|
||||
class GuiObject;
|
||||
class TabWidget;
|
||||
class EventMappingWidget;
|
||||
class StaticTextWidget;
|
||||
class PopUpWidget;
|
||||
|
||||
#include "Dialog.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
class InputDialog : public Dialog
|
||||
{
|
||||
public:
|
||||
InputDialog(OSystem* osystem, DialogContainer* parent,
|
||||
int x, int y, int w, int h);
|
||||
~InputDialog();
|
||||
|
||||
virtual void handleKeyDown(int ascii, int keycode, int modifiers);
|
||||
virtual void handleJoyDown(int stick, int button);
|
||||
|
||||
protected:
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
|
||||
|
||||
void loadConfig();
|
||||
void saveConfig();
|
||||
|
||||
private:
|
||||
TabWidget* myTab;
|
||||
|
||||
EventMappingWidget* myEventMapper;
|
||||
PopUpWidget* myPaddleModePopup;
|
||||
StaticTextWidget* myPaddleModeText;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: OptionsDialog.cxx,v 1.32 2005-11-12 22:59:20 stephena Exp $
|
||||
// $Id: OptionsDialog.cxx,v 1.33 2005-11-13 22:25:47 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -26,7 +26,7 @@
|
|||
#include "Control.hxx"
|
||||
#include "VideoDialog.hxx"
|
||||
#include "AudioDialog.hxx"
|
||||
#include "EventMappingDialog.hxx"
|
||||
#include "InputDialog.hxx"
|
||||
#include "GameInfoDialog.hxx"
|
||||
#include "HelpDialog.hxx"
|
||||
#include "AboutDialog.hxx"
|
||||
|
@ -41,7 +41,7 @@
|
|||
enum {
|
||||
kVidCmd = 'VIDO',
|
||||
kAudCmd = 'AUDO',
|
||||
kEMapCmd = 'EMAP',
|
||||
kInptCmd = 'INPT',
|
||||
kInfoCmd = 'INFO',
|
||||
kHelpCmd = 'HELP',
|
||||
kAboutCmd = 'ABOU',
|
||||
|
@ -61,18 +61,19 @@ enum {
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
|
||||
: Dialog(osystem, parent,
|
||||
(osystem->frameBuffer().baseWidth() - kMainMenuWidth) / 2,
|
||||
(osystem->frameBuffer().baseHeight() - kMainMenuHeight)/2,
|
||||
kMainMenuWidth, kMainMenuHeight),
|
||||
: Dialog(osystem, parent, 0, 0, kMainMenuWidth, kMainMenuHeight),
|
||||
myVideoDialog(NULL),
|
||||
myAudioDialog(NULL),
|
||||
myEventMappingDialog(NULL),
|
||||
myInputDialog(NULL),
|
||||
myGameInfoDialog(NULL),
|
||||
myCheatCodeDialog(NULL),
|
||||
myHelpDialog(NULL),
|
||||
myAboutDialog(NULL)
|
||||
{
|
||||
// Set actual dialog dimensions
|
||||
_x = (osystem->frameBuffer().baseWidth() - kMainMenuWidth) / 2;
|
||||
_y = (osystem->frameBuffer().baseHeight() - kMainMenuHeight) / 2;
|
||||
|
||||
int yoffset = 7;
|
||||
const int xoffset = (_w - kBigButtonWidth) / 2;
|
||||
ButtonWidget* b = NULL;
|
||||
|
@ -84,7 +85,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
|
|||
b = addBigButton("Audio Settings", kAudCmd, 0);
|
||||
b->clearFlags(WIDGET_ENABLED);
|
||||
#endif
|
||||
addBigButton("Event Mapping", kEMapCmd, 0);
|
||||
addBigButton("Input Settings", kInptCmd, 0);
|
||||
addBigButton("Game Properties", kInfoCmd, 0);
|
||||
#ifdef CHEATCODE_SUPPORT
|
||||
addBigButton("Cheat Code", kCheatCmd, 0);
|
||||
|
@ -112,7 +113,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
|
|||
|
||||
w = 230; h = 170;
|
||||
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
|
||||
myEventMappingDialog = new EventMappingDialog(myOSystem, parent, x, y, w, h);
|
||||
myInputDialog = new InputDialog(myOSystem, parent, x, y, w, h);
|
||||
|
||||
w = 255; h = 175;
|
||||
checkBounds(fbWidth, fbHeight, &x, &y, &w, &h);
|
||||
|
@ -138,7 +139,7 @@ OptionsDialog::~OptionsDialog()
|
|||
{
|
||||
delete myVideoDialog;
|
||||
delete myAudioDialog;
|
||||
delete myEventMappingDialog;
|
||||
delete myInputDialog;
|
||||
delete myGameInfoDialog;
|
||||
#ifdef CHEATCODE_SUPPORT
|
||||
delete myCheatCodeDialog;
|
||||
|
@ -171,8 +172,8 @@ void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
parent()->addDialog(myAudioDialog);
|
||||
break;
|
||||
|
||||
case kEMapCmd:
|
||||
parent()->addDialog(myEventMappingDialog);
|
||||
case kInptCmd:
|
||||
parent()->addDialog(myInputDialog);
|
||||
break;
|
||||
|
||||
case kInfoCmd:
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: OptionsDialog.hxx,v 1.15 2005-11-12 22:59:20 stephena Exp $
|
||||
// $Id: OptionsDialog.hxx,v 1.16 2005-11-13 22:25:47 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -27,7 +27,7 @@ class CommandSender;
|
|||
class DialogContainer;
|
||||
class VideoDialog;
|
||||
class AudioDialog;
|
||||
class EventMappingDialog;
|
||||
class InputDialog;
|
||||
class GameInfoDialog;
|
||||
class CheatCodeDialog;
|
||||
class HelpDialog;
|
||||
|
@ -52,7 +52,7 @@ class OptionsDialog : public Dialog
|
|||
protected:
|
||||
VideoDialog* myVideoDialog;
|
||||
AudioDialog* myAudioDialog;
|
||||
EventMappingDialog* myEventMappingDialog;
|
||||
InputDialog* myInputDialog;
|
||||
GameInfoDialog* myGameInfoDialog;
|
||||
CheatCodeDialog* myCheatCodeDialog;
|
||||
HelpDialog* myHelpDialog;
|
||||
|
|
|
@ -10,11 +10,12 @@ MODULE_OBJS := \
|
|||
src/gui/Dialog.o \
|
||||
src/gui/EditableWidget.o \
|
||||
src/gui/EditTextWidget.o \
|
||||
src/gui/EventMappingDialog.o \
|
||||
src/gui/EventMappingWidget.o \
|
||||
src/gui/Font.o \
|
||||
src/gui/GameInfoDialog.o \
|
||||
src/gui/GameList.o \
|
||||
src/gui/HelpDialog.o \
|
||||
src/gui/InputDialog.o \
|
||||
src/gui/InputTextDialog.o \
|
||||
src/gui/Launcher.o \
|
||||
src/gui/LauncherDialog.o \
|
||||
|
|
Loading…
Reference in New Issue