Re-enabled saving of the event remappings to the rc-file.

Moved the refresh() method to FrameBuffer::refresh(), since
all ports may need it.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@219 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2003-11-24 14:51:06 +00:00
parent 6aef328c60
commit 120dd7b268
7 changed files with 35 additions and 78 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: EventHandler.cxx,v 1.22 2003-11-19 15:57:10 stephena Exp $ // $Id: EventHandler.cxx,v 1.23 2003-11-24 14:51:05 stephena Exp $
//============================================================================ //============================================================================
#include <algorithm> #include <algorithm>
@ -215,32 +215,6 @@ void EventHandler::setJoymap()
setDefaultJoymap(); setDefaultJoymap();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string EventHandler::getKeymap()
{
ostringstream buf;
// Iterate through the keymap table and create a colon-separated list
for(Int32 i = 0; i < StellaEvent::LastKCODE; ++i)
buf << myKeyTable[i] << ":";
myKeymapString = buf.str();
return myKeymapString;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string EventHandler::getJoymap()
{
ostringstream buf;
// Iterate through the joymap table and create a colon-separated list
for(Int32 i = 0; i < StellaEvent::LastJSTICK*StellaEvent::LastJCODE; ++i)
buf << myJoyTable[i] << ":";
myJoymapString = buf.str();
return myJoymapString;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::getKeymapArray(Event::Type** array, uInt32* size) void EventHandler::getKeymapArray(Event::Type** array, uInt32* size)
{ {

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: EventHandler.hxx,v 1.12 2003-11-06 22:22:32 stephena Exp $ // $Id: EventHandler.hxx,v 1.13 2003-11-24 14:51:06 stephena Exp $
//============================================================================ //============================================================================
#ifndef EVENTHANDLER_HXX #ifndef EVENTHANDLER_HXX
@ -41,7 +41,7 @@ class MediaSource;
mapping can take place. mapping can take place.
@author Stephen Anthony @author Stephen Anthony
@version $Id: EventHandler.hxx,v 1.12 2003-11-06 22:22:32 stephena Exp $ @version $Id: EventHandler.hxx,v 1.13 2003-11-24 14:51:06 stephena Exp $
*/ */
class EventHandler class EventHandler
{ {
@ -97,20 +97,6 @@ class EventHandler
*/ */
void setMediaSource(MediaSource* mediaSource); void setMediaSource(MediaSource* mediaSource);
/**
Get the current keymapping being used in string form
@return The keymap list in string form
*/
string getKeymap();
/**
Get the current joymapping being used in string form
@return The joymap list in string form
*/
string getJoymap();
/** /**
Enable/disable remapping mode. Enable/disable remapping mode.
@ -119,12 +105,12 @@ class EventHandler
void enableRemapping(bool status) { myRemapEnabledFlag = status; } void enableRemapping(bool status) { myRemapEnabledFlag = status; }
/** /**
This method indicated whether a pause event has been received. This method indicates whether a pause event has been received.
*/ */
bool doPause() { return myPauseStatus; } bool doPause() { return myPauseStatus; }
/** /**
This method indicated whether a quit event has been received. This method indicates whether a quit event has been received.
*/ */
bool doQuit() { return myQuitStatus; } bool doQuit() { return myQuitStatus; }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: FrameBuffer.cxx,v 1.6 2003-11-19 15:57:10 stephena Exp $ // $Id: FrameBuffer.cxx,v 1.7 2003-11-24 14:51:06 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -617,6 +617,19 @@ void FrameBuffer::loadRemapMenu()
ourRemapMenu[i].key = key; ourRemapMenu[i].key = key;
} }
} }
// Save the new bindings
ostringstream keybuf, joybuf;
// Iterate through the keymap table and create a colon-separated list
for(uInt32 i = 0; i < StellaEvent::LastKCODE; ++i)
keybuf << myKeyTable[i] << ":";
myConsole->settings().setString("keymap", keybuf.str());
// Iterate through the joymap table and create a colon-separated list
for(uInt32 i = 0; i < StellaEvent::LastJSTICK*StellaEvent::LastJCODE; ++i)
joybuf << myJoyTable[i] << ":";
myConsole->settings().setString("joymap", joybuf.str());
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: FrameBuffer.hxx,v 1.6 2003-11-19 15:57:10 stephena Exp $ // $Id: FrameBuffer.hxx,v 1.7 2003-11-24 14:51:06 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_HXX #ifndef FRAMEBUFFER_HXX
@ -35,7 +35,7 @@ class Console;
can be changed. can be changed.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.6 2003-11-19 15:57:10 stephena Exp $ @version $Id: FrameBuffer.hxx,v 1.7 2003-11-24 14:51:06 stephena Exp $
*/ */
class FrameBuffer class FrameBuffer
{ {
@ -121,6 +121,12 @@ class FrameBuffer
*/ */
void pause(bool status); void pause(bool status);
/**
Indicates that a redraw should be done, since the window contents
are dirty.
*/
void refresh() { theRedrawEntireFrameIndicator = true; }
public: public:
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// The following methods are system-specific and must be implemented // The following methods are system-specific and must be implemented

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Settings.cxx,v 1.13 2003-11-24 01:14:38 stephena Exp $ // $Id: Settings.cxx,v 1.14 2003-11-24 14:51:06 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -141,10 +141,6 @@ bool Settings::loadCommandLine(Int32 argc, char** argv)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Settings::saveConfig() void Settings::saveConfig()
{ {
// if(!myConsole)
// return;
// FIXME - there should not be a dependency on Console
ofstream out(mySettingsOutputFilename.c_str()); ofstream out(mySettingsOutputFilename.c_str());
if(!out || !out.is_open()) if(!out || !out.is_open())
{ {
@ -152,10 +148,6 @@ void Settings::saveConfig()
return; return;
} }
// Make sure that any modifications to key remapping is saved
// set("keymap", myConsole->eventHandler().getKeymap());
// set("joymap", myConsole->eventHandler().getJoymap());
out << "; Stella configuration file" << endl out << "; Stella configuration file" << endl
<< ";" << endl << ";" << endl
<< "; Lines starting with ';' are comments and are ignored." << endl << "; Lines starting with ';' are comments and are ignored." << endl

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: FrameBufferSDL.cxx,v 1.5 2003-11-17 17:43:39 stephena Exp $ // $Id: FrameBufferSDL.cxx,v 1.6 2003-11-24 14:51:06 stephena Exp $
//============================================================================ //============================================================================
#include <SDL.h> #include <SDL.h>
@ -59,9 +59,7 @@ void FrameBufferSDL::toggleFullscreen()
isFullscreen = !isFullscreen; isFullscreen = !isFullscreen;
// Update the settings // Update the settings
ostringstream tmp; myConsole->settings().setBool("fullscreen", isFullscreen);
tmp << isFullscreen;
myConsole->settings().set("fullscreen", tmp.str());
if(isFullscreen) if(isFullscreen)
mySDLFlags |= SDL_FULLSCREEN; mySDLFlags |= SDL_FULLSCREEN;
@ -118,9 +116,7 @@ void FrameBufferSDL::resize(int mode)
return; return;
// Update the settings // Update the settings
ostringstream tmp; myConsole->settings().setInt("zoom", theZoomLevel);
tmp << theZoomLevel;
myConsole->settings().set("zoom", tmp.str());
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -135,9 +131,7 @@ void FrameBufferSDL::showCursor(bool show)
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
// Update the settings // Update the settings
ostringstream tmp; myConsole->settings().setBool("hidecursor", !show);
tmp << !show;
myConsole->settings().set("hidecursor", tmp.str());
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -152,9 +146,7 @@ void FrameBufferSDL::grabMouse(bool grab)
SDL_WM_GrabInput(SDL_GRAB_OFF); SDL_WM_GrabInput(SDL_GRAB_OFF);
// Update the settings // Update the settings
ostringstream tmp; myConsole->settings().setBool("grabmouse", grab);
tmp << grab;
myConsole->settings().set("grabmouse", tmp.str());
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: FrameBufferSDL.hxx,v 1.6 2003-11-23 20:54:59 stephena Exp $ // $Id: FrameBufferSDL.hxx,v 1.7 2003-11-24 14:51:06 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_SDL_HXX #ifndef FRAMEBUFFER_SDL_HXX
@ -34,7 +34,7 @@
the core FrameBuffer. the core FrameBuffer.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBufferSDL.hxx,v 1.6 2003-11-23 20:54:59 stephena Exp $ @version $Id: FrameBufferSDL.hxx,v 1.7 2003-11-24 14:51:06 stephena Exp $
*/ */
class FrameBufferSDL : public FrameBuffer class FrameBufferSDL : public FrameBuffer
{ {
@ -92,12 +92,6 @@ class FrameBufferSDL : public FrameBuffer
*/ */
uInt32 maxWindowSizeForScreen(); uInt32 maxWindowSizeForScreen();
/**
Indicates that a redraw should be done, since the window contents
are dirty.
*/
void refresh() { theRedrawEntireFrameIndicator = true; }
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// The following methods are derived from FrameBuffer.hxx // The following methods are derived from FrameBuffer.hxx
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////