From e545c973c5537f01c8b68c637c6d0322248d1b33 Mon Sep 17 00:00:00 2001 From: stephena Date: Sun, 8 Jan 2006 20:55:54 +0000 Subject: [PATCH] Re-added 'joymouse' argument, and made sure that joystick navigation is completely disabled when it's turned on. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@942 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/emucore/OSystem.cxx | 4 +++- stella/src/gui/CommandDialog.cxx | 5 ++++- stella/src/gui/DialogContainer.cxx | 7 ++++--- stella/src/gui/DialogContainer.hxx | 19 ++++++++++++------- stella/src/gui/LauncherDialog.cxx | 5 ++++- stella/src/gui/Widget.cxx | 10 +++++----- 6 files changed, 32 insertions(+), 18 deletions(-) diff --git a/stella/src/emucore/OSystem.cxx b/stella/src/emucore/OSystem.cxx index d98521dfc..4558f85d4 100644 --- a/stella/src/emucore/OSystem.cxx +++ b/stella/src/emucore/OSystem.cxx @@ -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: OSystem.cxx,v 1.54 2006-01-08 13:55:03 stephena Exp $ +// $Id: OSystem.cxx,v 1.55 2006-01-08 20:55:53 stephena Exp $ //============================================================================ #include @@ -130,6 +130,8 @@ bool OSystem::create() #ifdef CHEATCODE_SUPPORT myFeatures += "Cheats"; #endif + + return true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/CommandDialog.cxx b/stella/src/gui/CommandDialog.cxx index cc9833178..b445bbb90 100644 --- a/stella/src/gui/CommandDialog.cxx +++ b/stella/src/gui/CommandDialog.cxx @@ -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: CommandDialog.cxx,v 1.6 2006-01-04 01:24:17 stephena Exp $ +// $Id: CommandDialog.cxx,v 1.7 2006-01-08 20:55:53 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -208,6 +208,9 @@ void CommandDialog::handleKeyDown(int ascii, int keycode, int modifiers) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CommandDialog::handleJoyAxis(int stick, int axis, int value) { + if(!parent()->joymouse()) + return; + // We make the (hopefully) valid assumption that all joysticks // treat axis the same way. Eventually, we may need to remap // these actions of this assumption is invalid. diff --git a/stella/src/gui/DialogContainer.cxx b/stella/src/gui/DialogContainer.cxx index a6f67eca6..f95aa4c82 100644 --- a/stella/src/gui/DialogContainer.cxx +++ b/stella/src/gui/DialogContainer.cxx @@ -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: DialogContainer.cxx,v 1.27 2006-01-08 13:55:03 stephena Exp $ +// $Id: DialogContainer.cxx,v 1.28 2006-01-08 20:55:53 stephena Exp $ //============================================================================ #include "OSystem.hxx" @@ -73,7 +73,8 @@ void DialogContainer::updateTime(uInt32 time) myClickRepeatTime = myTime + kClickRepeatSustainDelay; } - if(myCurrentAxisDown.stick != -1 && myAxisRepeatTime < myTime) + if(ourEnableJoyMouseFlag && myCurrentAxisDown.stick != -1 && + myAxisRepeatTime < myTime) { // The longer an axis event is enabled, the faster it should change // We do this by decreasing the amount of time between consecutive axis events @@ -311,7 +312,7 @@ void DialogContainer::handleJoyEvent(int stick, int button, uInt8 state) else activeDialog->handleJoyUp(stick, button); } - else + else if(ourEnableJoyMouseFlag) myOSystem->eventHandler().createMouseButtonEvent( ourJoyMouse.x, ourJoyMouse.y, state); } diff --git a/stella/src/gui/DialogContainer.hxx b/stella/src/gui/DialogContainer.hxx index b8ba6d721..754b97972 100644 --- a/stella/src/gui/DialogContainer.hxx +++ b/stella/src/gui/DialogContainer.hxx @@ -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: DialogContainer.hxx,v 1.14 2006-01-08 13:55:03 stephena Exp $ +// $Id: DialogContainer.hxx,v 1.15 2006-01-08 20:55:54 stephena Exp $ //============================================================================ #ifndef DIALOG_CONTAINER_HXX @@ -37,7 +37,7 @@ typedef FixedStack DialogStack; a stack, and handles their events. @author Stephen Anthony - @version $Id: DialogContainer.hxx,v 1.14 2006-01-08 13:55:03 stephena Exp $ + @version $Id: DialogContainer.hxx,v 1.15 2006-01-08 20:55:54 stephena Exp $ */ class DialogContainer { @@ -141,11 +141,10 @@ class DialogContainer */ virtual void initialize() = 0; - // Whether to enable joymouse emulation - static bool ourEnableJoyMouseFlag; - - // Emulation of mouse using joystick axis events - static JoyMouse ourJoyMouse; + /** + Whether joymouse emulation is enabled + */ + static bool joymouse() { return ourEnableJoyMouseFlag; } private: void handleJoyMouse(uInt32); @@ -203,6 +202,12 @@ class DialogContainer uInt32 time; // Time int count; // How often was it already pressed? } myLastClick; + + // Whether to enable joymouse emulation + static bool ourEnableJoyMouseFlag; + + // Emulation of mouse using joystick axis events + static JoyMouse ourJoyMouse; }; #endif diff --git a/stella/src/gui/LauncherDialog.cxx b/stella/src/gui/LauncherDialog.cxx index 5d7ed3f99..cc54851d0 100644 --- a/stella/src/gui/LauncherDialog.cxx +++ b/stella/src/gui/LauncherDialog.cxx @@ -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.36 2006-01-05 18:53:23 stephena Exp $ +// $Id: LauncherDialog.cxx,v 1.37 2006-01-08 20:55:54 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -394,6 +394,9 @@ void LauncherDialog::handleKeyDown(int ascii, int keycode, int modifiers) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void LauncherDialog::handleJoyAxis(int stick, int axis, int value) { + if(!parent()->joymouse()) + return; + // We make the (hopefully) valid assumption that all joysticks // treat axis the same way. Eventually, we may need to remap // these actions of this assumption is invalid. diff --git a/stella/src/gui/Widget.cxx b/stella/src/gui/Widget.cxx index dc97f5cc3..43fa664a8 100644 --- a/stella/src/gui/Widget.cxx +++ b/stella/src/gui/Widget.cxx @@ -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: Widget.cxx,v 1.40 2005-12-21 01:50:16 stephena Exp $ +// $Id: Widget.cxx,v 1.41 2006-01-08 20:55:54 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -23,6 +23,7 @@ #include "FrameBuffer.hxx" #include "Font.hxx" #include "Dialog.hxx" +#include "DialogContainer.hxx" #include "Command.hxx" #include "GuiObject.hxx" #include "bspf.hxx" @@ -30,8 +31,6 @@ #include "Widget.hxx" #include "EditableWidget.hxx" -//static int COUNT = 0; - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Widget::Widget(GuiObject* boss, int x, int y, int w, int h) : GuiObject(boss->instance(), boss->parent(), x, y, w, h), @@ -377,8 +376,9 @@ bool ButtonWidget::handleKeyDown(int ascii, int keycode, int modifiers) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ButtonWidget::handleJoyDown(int stick, int button) { - // Any button activates the button - handleMouseUp(0, 0, 1, 0); + // Any button activates the button, but only while in joymouse mode + if(DialogContainer::joymouse()) + handleMouseUp(0, 0, 1, 0); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -