Added 'UIOK' and 'UICancel' menu events to the core, and made them

remappable in the InputDialog.  These are a shortcut for the OK and
Cancel buttons in certain Dialog boxes, instead of having to tab to
the respective buttons.  By default, 'UICancel' is mapped to Escape,
and 'UIOK' is not mapped to anything.

Hopefully fixed the issue with the GP2X window not being cleared
when switching between emulation modes.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1160 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-11-28 21:48:56 +00:00
parent 08863d0ba9
commit cc5afaba11
17 changed files with 85 additions and 25 deletions

View File

@ -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: FrameBufferSoft.cxx,v 1.57 2006-11-04 19:38:24 stephena Exp $
// $Id: FrameBufferSoft.cxx,v 1.58 2006-11-28 21:48:55 stephena Exp $
//============================================================================
#include <SDL.h>
@ -44,6 +44,7 @@ FrameBufferSoft::~FrameBufferSoft()
{
delete myRectList;
delete myOverlayRectList;
cls();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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: Event.hxx,v 1.21 2006-05-15 12:24:09 stephena Exp $
// $Id: Event.hxx,v 1.22 2006-11-28 21:48:56 stephena Exp $
//============================================================================
#ifndef EVENT_HXX
@ -26,7 +26,7 @@ class EventStreamer;
/**
@author Bradford W. Mott
@version $Id: Event.hxx,v 1.21 2006-05-15 12:24:09 stephena Exp $
@version $Id: Event.hxx,v 1.22 2006-11-28 21:48:56 stephena Exp $
*/
class Event
{
@ -81,7 +81,7 @@ class Event
VolumeDecrease, VolumeIncrease,
UIUp, UIDown, UILeft, UIRight, UIHome, UIEnd, UIPgUp, UIPgDown,
UISelect, UIPrevDir, UINavPrev, UINavNext, UITabPrev, UITabNext,
UISelect, UINavPrev, UINavNext, UITabPrev, UITabNext, UIOK, UICancel,
LastType
};

View File

@ -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: EventHandler.cxx,v 1.173 2006-11-27 22:57:09 stephena Exp $
// $Id: EventHandler.cxx,v 1.174 2006-11-28 21:48:56 stephena Exp $
//============================================================================
#include <sstream>
@ -1772,7 +1772,7 @@ void EventHandler::setDefaultKeymap(EventMode mode)
myKeyTable[ SDLK_PAGEDOWN ][mode] = Event::UIPgDown;
myKeyTable[ SDLK_RETURN ][mode] = Event::UISelect;
myKeyTable[ SDLK_BACKSPACE ][mode] = Event::UIPrevDir;
myKeyTable[ SDLK_ESCAPE ][mode] = Event::UICancel;
break;
default:
@ -2671,8 +2671,9 @@ ActionList EventHandler::ourMenuActionList[kMenuActionListSize] = {
{ Event::UIPgUp, "Page Up", 0 },
{ Event::UIPgDown, "Page Down", 0 },
{ Event::UIOK, "OK", 0 },
{ Event::UICancel, "Cancel", 0 },
{ Event::UISelect, "Select item", 0 },
{ Event::UIPrevDir, "Previous Directory", 0 },
{ Event::UINavPrev, "Previous object", 0 },
{ Event::UINavNext, "Next object", 0 },

View File

@ -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: EventHandler.hxx,v 1.90 2006-11-06 00:52:03 stephena Exp $
// $Id: EventHandler.hxx,v 1.91 2006-11-28 21:48:56 stephena Exp $
//============================================================================
#ifndef EVENTHANDLER_HXX
@ -62,7 +62,7 @@ struct ActionList {
enum {
kEmulActionListSize = 81,
kMenuActionListSize = 14
kMenuActionListSize = 15
};
enum EventMode {
@ -114,7 +114,7 @@ struct JoyMouse {
mapping can take place.
@author Stephen Anthony
@version $Id: EventHandler.hxx,v 1.90 2006-11-06 00:52:03 stephena Exp $
@version $Id: EventHandler.hxx,v 1.91 2006-11-28 21:48:56 stephena Exp $
*/
class EventHandler
{

View File

@ -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: OSystemGP2X.cxx,v 1.11 2006-11-13 00:21:41 stephena Exp $
// $Id: OSystemGP2X.cxx,v 1.12 2006-11-28 21:48:56 stephena Exp $
// Modified on 2006/01/06 by Alex Zaballa for use on GP2X
//============================================================================
@ -153,7 +153,6 @@ void OSystemGP2X::setDefaultJoymap()
myEventHandler->setDefaultJoyMapping(Event::UIPgDown, kMenuMode, 0, 11); // R
myEventHandler->setDefaultJoyMapping(Event::UITabNext, kMenuMode, 0, 12); // A
myEventHandler->setDefaultJoyMapping(Event::UISelect, kMenuMode, 0, 13); // B
myEventHandler->setDefaultJoyMapping(Event::UIPrevDir, kMenuMode, 0, 14); // X
myEventHandler->setDefaultJoyMapping(Event::UINavNext, kMenuMode, 0, 15); // Y
myEventHandler->setDefaultJoyMapping(Event::NoType, kMenuMode, 0, 16); // Vol+
myEventHandler->setDefaultJoyMapping(Event::NoType, kMenuMode, 0, 17); // Vol-

View File

@ -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: AboutDialog.cxx,v 1.13 2006-05-04 17:45:25 stephena Exp $
// $Id: AboutDialog.cxx,v 1.14 2006-11-28 21:48:56 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -50,6 +50,7 @@ AboutDialog::AboutDialog(OSystem* osystem, DialogContainer* parent,
ButtonWidget* b = addButton(font, w - (kButtonWidth + 10), h - 24,
"Close", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
myTitle = new StaticTextWidget(this, font, 5, 5, w - 10, font.getFontHeight(),
"", kTextAlignCenter);

View File

@ -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: AudioDialog.cxx,v 1.20 2006-11-03 16:50:18 stephena Exp $
// $Id: AudioDialog.cxx,v 1.21 2006-11-28 21:48:56 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -122,13 +122,17 @@ AudioDialog::AudioDialog(OSystem* osystem, DialogContainer* parent,
#ifndef MAC_OSX
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd);
wid.push_back(b);
addOKWidget(b);
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
#else
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd);
wid.push_back(b);
addOKWidget(b);
#endif
addToFocusList(wid);

View File

@ -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: BrowserDialog.cxx,v 1.19 2006-05-04 17:45:25 stephena Exp $
// $Id: BrowserDialog.cxx,v 1.20 2006-11-28 21:48:56 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -79,19 +79,23 @@ BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font,
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Choose",
kChooseCmd);
addFocusWidget(b);
addOKWidget(b);
xpos += bwidth + 10;
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel",
kCloseCmd);
addFocusWidget(b);
addCancelWidget(b);
#else
xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel",
kCloseCmd);
addFocusWidget(b);
addCancelWidget(b);
xpos += bwidth + 10;
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Choose",
kChooseCmd);
addFocusWidget(b);
addOKWidget(b);
#endif
addFocusWidget(_fileList);

View File

@ -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.47 2006-05-25 19:03:57 stephena Exp $
// $Id: Dialog.cxx,v 1.48 2006-11-28 21:48:56 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -43,6 +43,8 @@ Dialog::Dialog(OSystem* instance, DialogContainer* parent,
_mouseWidget(0),
_focusedWidget(0),
_dragWidget(0),
_okWidget(0),
_cancelWidget(0),
_visible(true),
_ourTab(NULL),
_focusID(0)
@ -482,6 +484,24 @@ bool Dialog::handleNavEvent(Event::Type e)
}
break;
case Event::UIOK:
if(_okWidget)
{
// Receiving 'OK' is the same as getting the 'Select' event
_okWidget->handleEvent(Event::UISelect);
return true;
}
break;
case Event::UICancel:
if(_cancelWidget)
{
// Receiving 'Cancel' is the same as getting the 'Select' event
_cancelWidget->handleEvent(Event::UISelect);
return true;
}
break;
default:
return false;
break;

View File

@ -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.hxx,v 1.30 2006-05-15 16:21:27 stephena Exp $
// $Id: Dialog.hxx,v 1.31 2006-11-28 21:48:56 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -36,7 +36,7 @@ class TabWidget;
This is the base class for all dialog boxes.
@author Stephen Anthony
@version $Id: Dialog.hxx,v 1.30 2006-05-15 16:21:27 stephena Exp $
@version $Id: Dialog.hxx,v 1.31 2006-11-28 21:48:56 stephena Exp $
*/
class Dialog : public GuiObject
{
@ -67,6 +67,8 @@ class Dialog : public GuiObject
void addToFocusList(WidgetArray& list, int id = -1);
void redrawFocus();
void addTabWidget(TabWidget* w) { _ourTab = w; }
void addOKWidget(Widget* w) { _okWidget = w; }
void addCancelWidget(Widget* w) { _cancelWidget = w; }
void setFocus(Widget* w);
protected:
@ -102,6 +104,8 @@ class Dialog : public GuiObject
Widget* _mouseWidget;
Widget* _focusedWidget;
Widget* _dragWidget;
Widget* _okWidget;
Widget* _cancelWidget;
bool _visible;
private:

View File

@ -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: GameInfoDialog.cxx,v 1.27 2006-11-19 20:59:30 stephena Exp $
// $Id: GameInfoDialog.cxx,v 1.28 2006-11-28 21:48:56 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -288,13 +288,17 @@ GameInfoDialog::GameInfoDialog(
#ifndef MAC_OSX
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd);
wid.push_back(b);
addOKWidget(b);
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
#else
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd);
wid.push_back(b);
addOKWidget(b);
#endif
addToFocusList(wid);
}

View File

@ -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: HelpDialog.cxx,v 1.16 2006-05-04 17:45:25 stephena Exp $
// $Id: HelpDialog.cxx,v 1.17 2006-11-28 21:48:56 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -48,6 +48,7 @@ HelpDialog::HelpDialog(OSystem* osystem, DialogContainer* parent,
ButtonWidget* b = addButton(font, w - (kButtonWidth + 10), h - 24,
"Close", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
myTitle = new StaticTextWidget(this, font, 5, 5, w - 10, font.getFontHeight(),
"", kTextAlignCenter);

View File

@ -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: InputTextDialog.cxx,v 1.13 2006-05-04 17:45:25 stephena Exp $
// $Id: InputTextDialog.cxx,v 1.14 2006-11-28 21:48:56 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -87,16 +87,20 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
b = new ButtonWidget(this, font, _w - 2 * (bwidth + 10), _h - bheight - 10,
bwidth, bheight, "OK", kAcceptCmd);
wid.push_back(b);
addOKWidget(b);
b = new ButtonWidget(this, font, _w - (bwidth + 10), _h - bheight - 10,
bwidth, bheight, "Cancel", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
#else
b = new ButtonWidget(this, font, _w - 2 * (bwidth + 10), _h - bheight - 10,
bwidth, bheight, "Cancel", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
b = new ButtonWidget(this, font, _w - (bwidth + 10), _h - bheight - 10,
bwidth, bheight, "OK", kAcceptCmd);
wid.push_back(b);
addOKWidget(b);
#endif
addToFocusList(wid);

View File

@ -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: LauncherDialog.cxx,v 1.56 2006-11-27 14:52:51 stephena Exp $
// $Id: LauncherDialog.cxx,v 1.57 2006-11-28 21:48:56 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -280,6 +280,14 @@ void LauncherDialog::loadDirListing()
{
FSList files = myCurrentNode.listDir(FilesystemNode::kListAll);
// Add '[..]' to indicate previous folder
if(myCurrentNode.hasParent())
{
const string& parent = myCurrentNode.getParent().path();
myGameList->appendGame(" [..]", parent, "", true);
}
// Now add the directory entries
for(unsigned int idx = 0; idx < files.size(); idx++)
{
string name = files[idx].displayName();

View File

@ -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: LauncherOptionsDialog.cxx,v 1.18 2006-11-13 00:21:41 stephena Exp $
// $Id: LauncherOptionsDialog.cxx,v 1.19 2006-11-28 21:48:56 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -115,16 +115,20 @@ LauncherOptionsDialog::LauncherOptionsDialog(
xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "OK", kOKCmd);
wid.push_back(b);
addOKWidget(b);
xpos += bwidth + 10;
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
#else
xpos = _w - 2 *(bwidth + 10); ypos = _h - bheight - 8;
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "Cancel", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
xpos += bwidth + 10;
b = new ButtonWidget(this, font, xpos, ypos, bwidth, bheight, "OK", kOKCmd);
wid.push_back(b);
addOKWidget(b);
#endif
// Add focus widgets for OK/Cancel buttons
addToFocusList(wid);

View File

@ -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.42 2006-11-18 13:29:11 stephena Exp $
// $Id: OptionsDialog.cxx,v 1.43 2006-11-28 21:48:56 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -111,6 +111,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
b = addBigButton("Exit Menu", kExitCmd);
wid.push_back(b);
addCancelWidget(b);
// Set some sane values for the dialog boxes
int x, y, w, h;

View File

@ -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: VideoDialog.cxx,v 1.33 2006-11-25 01:34:35 stephena Exp $
// $Id: VideoDialog.cxx,v 1.34 2006-11-28 21:48:56 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -157,13 +157,17 @@ VideoDialog::VideoDialog(OSystem* osystem, DialogContainer* parent,
#ifndef MAC_OSX
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "OK", kOKCmd);
wid.push_back(b);
addOKWidget(b);
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
#else
b = addButton(font, _w - 2 * (kButtonWidth + 7), _h - 24, "Cancel", kCloseCmd);
wid.push_back(b);
addCancelWidget(b);
b = addButton(font, _w - (kButtonWidth + 10), _h - 24, "OK", kOKCmd);
wid.push_back(b);
addOKWidget(b);
#endif
addToFocusList(wid);