Fixed another long-standing GUI crash in software mode when switching

to the debugger (incorrect width for DataGridOpsWidget).

Added 'autoslot' commandline argument.  When set, pressing the save state
button (by default F9) will save state to the current slot, then
automatically switch to the next higher slot.  I still need to add this to
the GUI settings somewhere.  This was a request from N. Strum of AtariAge.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1140 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-11-06 00:52:04 +00:00
parent ba82080839
commit 0c5beed367
19 changed files with 125 additions and 48 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: AudioWidget.cxx,v 1.2 2006-02-22 17:38:04 stephena Exp $
// $Id: AudioWidget.cxx,v 1.3 2006-11-06 00:52:01 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -42,6 +42,8 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, font, x, y, w, h),
CommandSender(boss)
{
_type = kAudioWidget;
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();

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: CpuWidget.cxx,v 1.5 2006-06-09 02:45:11 urchlay Exp $
// $Id: CpuWidget.cxx,v 1.6 2006-11-06 00:52:01 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -63,6 +63,8 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
: Widget(boss, font, x, y, 16, 16),
CommandSender(boss)
{
_type = kCpuWidget;
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();

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: DataGridOpsWidget.cxx,v 1.4 2006-05-04 17:45:23 stephena Exp $
// $Id: DataGridOpsWidget.cxx,v 1.5 2006-11-06 00:52:01 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -34,8 +34,10 @@ DataGridOpsWidget::DataGridOpsWidget(GuiObject* boss, const GUI::Font& font,
_shiftLeftButton(NULL),
_shiftRightButton(NULL)
{
const int bwidth = _font->getMaxCharWidth() * 3,
bheight = _font->getFontHeight() + 2,
_type = kDataGridOpsWidget;
const int bwidth = _font->getMaxCharWidth() * 4,
bheight = _font->getFontHeight() + 3,
space = 6;
int xpos, ypos;
@ -70,8 +72,8 @@ DataGridOpsWidget::DataGridOpsWidget(GuiObject* boss, const GUI::Font& font,
">>", kDGShiftRCmd);
// Calculate real dimensions
_w = xpos + bwidth;
_h = ypos + bheight;
_w = 2 * (bwidth+space);
_h = 4 * (bheight+space);
// We don't enable the buttons until the DataGridWidget is attached
// Don't call setEnabled(false), since that does an immediate redraw

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: DebuggerDialog.cxx,v 1.15 2006-05-29 22:31:20 stephena Exp $
// $Id: DebuggerDialog.cxx,v 1.16 2006-11-06 00:52:01 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -232,7 +232,7 @@ void DebuggerDialog::addRomArea()
myRam = new RamWidget(this, instance()->consoleFont(), xpos, ypos);
addToFocusList(myRam->getFocusList());
xpos = r.left + 10 + myCpu->getWidth() + 20;
xpos = r.left + 10 + myCpu->getWidth() + 5;
DataGridOpsWidget* ops = new DataGridOpsWidget(this, instance()->consoleFont(),
xpos, 20);

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: RamWidget.cxx,v 1.7 2006-06-09 02:45:11 urchlay Exp $
// $Id: RamWidget.cxx,v 1.8 2006-11-06 00:52:01 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -49,6 +49,8 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
myUndoAddress(-1),
myUndoValue(-1)
{
_type = kRamWidget;
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(),

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: RomListWidget.cxx,v 1.6 2006-05-04 17:45:24 stephena Exp $
// $Id: RomListWidget.cxx,v 1.7 2006-11-06 00:52:02 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -29,6 +29,8 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& font,
myMenu(NULL),
myHighlightedItem(-1)
{
_type = kRomListWidget;
myMenu = new ContextMenu(this, font);
StringList l;

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: RomWidget.cxx,v 1.16 2006-02-22 17:38:04 stephena Exp $
// $Id: RomWidget.cxx,v 1.17 2006-11-06 00:52:02 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -45,6 +45,8 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
mySourceAvailable(false),
myCurrentBank(-1)
{
_type = kRomWidget;
int w = 58 * font.getMaxCharWidth(),
h = 0, xpos, ypos;
StaticTextWidget* t;

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: TiaInfoWidget.cxx,v 1.5 2006-03-23 16:16:32 stephena Exp $
// $Id: TiaInfoWidget.cxx,v 1.6 2006-11-06 00:52:02 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -35,6 +35,8 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, font, x, y, 16, 16),
CommandSender(boss)
{
_type = kTiaInfoWidget;
x += 5;
const int lineHeight = font.getLineHeight();
int xpos = x, ypos = y, lwidth = font.getStringWidth("F. Cyc:");

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: TiaOutputWidget.cxx,v 1.10 2006-03-05 01:18:41 stephena Exp $
// $Id: TiaOutputWidget.cxx,v 1.11 2006-11-06 00:52:02 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -41,6 +41,8 @@ TiaOutputWidget::TiaOutputWidget(GuiObject* boss, const GUI::Font& font,
myMenu(NULL),
myZoom(NULL)
{
_type = kTiaOutputWidget;
// Create context menu for commands
myMenu = new ContextMenu(this, font);

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: TiaWidget.cxx,v 1.4 2006-04-05 12:28:37 stephena Exp $
// $Id: TiaWidget.cxx,v 1.5 2006-11-06 00:52:02 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -86,6 +86,8 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, font, x, y, w, h),
CommandSender(boss)
{
_type = kTiaWidget;
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();

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: TiaZoomWidget.cxx,v 1.8 2006-05-04 17:45:24 stephena Exp $
// $Id: TiaZoomWidget.cxx,v 1.9 2006-11-06 00:52:02 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -36,7 +36,7 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font,
{
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
WIDGET_WANTS_RAWDATA;
_type = kTiaZoomWidget;
_w = 210;
_h = 120;

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: ToggleBitWidget.cxx,v 1.3 2006-02-22 17:38:04 stephena Exp $
// $Id: ToggleBitWidget.cxx,v 1.4 2006-11-06 00:52:02 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -32,6 +32,8 @@ ToggleBitWidget::ToggleBitWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows, int colchars)
: ToggleWidget(boss, font, x, y, cols, rows)
{
_type = kToggleBitWidget;
_rowHeight = font.getLineHeight();
_colWidth = colchars * font.getMaxCharWidth() + 8;

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: TogglePixelWidget.cxx,v 1.3 2006-02-22 17:38:04 stephena Exp $
// $Id: TogglePixelWidget.cxx,v 1.4 2006-11-06 00:52:02 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -32,6 +32,8 @@ TogglePixelWidget::TogglePixelWidget(GuiObject* boss, const GUI::Font& font,
: ToggleWidget(boss, font, x, y, cols, rows),
_pixelColor(kBGColor)
{
_type = kTogglePixelWidget;
_rowHeight = font.getLineHeight();
_colWidth = 15;

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: Cart4A50.hxx,v 1.1 2006-06-12 14:12:51 stephena Exp $
// $Id: Cart4A50.hxx,v 1.2 2006-11-06 00:52:03 stephena Exp $
//============================================================================
#ifndef CARTRIDGE4A50_HXX
@ -32,7 +32,7 @@ class Deserializer;
not bankswitched.
@author Bradford W. Mott
@version $Id: Cart4A50.hxx,v 1.1 2006-06-12 14:12:51 stephena Exp $
@version $Id: Cart4A50.hxx,v 1.2 2006-11-06 00:52:03 stephena Exp $
*/
class Cartridge4A50 : public Cartridge
{
@ -104,7 +104,7 @@ class Cartridge4A50 : public Cartridge
*/
virtual void poke(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
bool patch(uInt16 address, uInt8 value);
private:
// The 4K ROM image for the cartridge

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.167 2006-11-03 16:50:17 stephena Exp $
// $Id: EventHandler.cxx,v 1.168 2006-11-06 00:52:03 stephena Exp $
//============================================================================
#include <sstream>
@ -2048,7 +2048,14 @@ void EventHandler::saveState()
// Do a state save using the System
buf.str("");
if(myOSystem->console().system().saveState(md5, out))
{
buf << "State " << myLSState << " saved";
if(myOSystem->settings().getBool("autoslot"))
{
buf << ", switching to slot " << (myLSState+1) % 10;
changeState(false); // don't show a message for state change
}
}
else
buf << "Error saving state " << myLSState;
@ -2064,15 +2071,17 @@ void EventHandler::saveState(int state)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::changeState()
void EventHandler::changeState(bool show)
{
myLSState = (myLSState + 1) % 10;
// Print appropriate message
ostringstream buf;
buf << "Changed to slot " << myLSState;
myOSystem->frameBuffer().showMessage(buf.str());
if(show)
{
ostringstream buf;
buf << "Changed to slot " << myLSState;
myOSystem->frameBuffer().showMessage(buf.str());
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.89 2006-11-03 16:50:17 stephena Exp $
// $Id: EventHandler.hxx,v 1.90 2006-11-06 00:52:03 stephena Exp $
//============================================================================
#ifndef EVENTHANDLER_HXX
@ -114,7 +114,7 @@ struct JoyMouse {
mapping can take place.
@author Stephen Anthony
@version $Id: EventHandler.hxx,v 1.89 2006-11-03 16:50:17 stephena Exp $
@version $Id: EventHandler.hxx,v 1.90 2006-11-06 00:52:03 stephena Exp $
*/
class EventHandler
{
@ -518,7 +518,7 @@ class EventHandler
inline bool isJitter(int paddle, int value);
void saveState();
void changeState();
void changeState(bool show = true);
void loadState();
void takeSnapshot();
void setEventState(State state);

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: OSystem.cxx,v 1.74 2006-11-03 16:50:18 stephena Exp $
// $Id: OSystem.cxx,v 1.75 2006-11-06 00:52:03 stephena Exp $
//============================================================================
#include <cassert>
@ -44,6 +44,7 @@
#include "ConsoleFont.hxx"
#include "bspf.hxx"
#include "OSystem.hxx"
#include "Widget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystem::OSystem()
@ -63,6 +64,36 @@ OSystem::OSystem()
myFont(NULL),
myConsoleFont(NULL)
{
#if 0
// Debugging info for the GUI widgets
cerr << " kStaticTextWidget = " << kStaticTextWidget << endl;
cerr << " kEditTextWidget = " << kEditTextWidget << endl;
cerr << " kButtonWidget = " << kButtonWidget << endl;
cerr << " kCheckboxWidget = " << kCheckboxWidget << endl;
cerr << " kSliderWidget = " << kSliderWidget << endl;
cerr << " kListWidget = " << kListWidget << endl;
cerr << " kScrollBarWidget = " << kScrollBarWidget << endl;
cerr << " kPopUpWidget = " << kPopUpWidget << endl;
cerr << " kTabWidget = " << kTabWidget << endl;
cerr << " kEventMappingWidget = " << kEventMappingWidget << endl;
cerr << " kEditableWidget = " << kEditableWidget << endl;
cerr << " kAudioWidget = " << kAudioWidget << endl;
cerr << " kColorWidget = " << kColorWidget << endl;
cerr << " kCpuWidget = " << kCpuWidget << endl;
cerr << " kDataGridOpsWidget = " << kDataGridOpsWidget << endl;
cerr << " kDataGridWidget = " << kDataGridWidget << endl;
cerr << " kPromptWidget = " << kPromptWidget << endl;
cerr << " kRamWidget = " << kRamWidget << endl;
cerr << " kRomListWidget = " << kRomListWidget << endl;
cerr << " kRomWidget = " << kRomWidget << endl;
cerr << " kTiaInfoWidget = " << kTiaInfoWidget << endl;
cerr << " kTiaOutputWidget = " << kTiaOutputWidget << endl;
cerr << " kTiaWidget = " << kTiaWidget << endl;
cerr << " kTiaZoomWidget = " << kTiaZoomWidget << endl;
cerr << " kToggleBitWidget = " << kToggleBitWidget << endl;
cerr << " kTogglePixelWidget = " << kTogglePixelWidget << endl;
cerr << " kToggleWidget = " << kToggleWidget << endl;
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: Settings.cxx,v 1.87 2006-11-04 19:38:24 stephena Exp $
// $Id: Settings.cxx,v 1.88 2006-11-06 00:52:03 stephena Exp $
//============================================================================
#include <cassert>
@ -82,6 +82,7 @@ Settings::Settings(OSystem* osystem)
setInternal("modtime", ""); // romdir last modification time
setInternal("tiadefaults", "false");
setInternal("autoslot", "false");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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: Widget.hxx,v 1.50 2006-05-04 17:45:25 stephena Exp $
// $Id: Widget.hxx,v 1.51 2006-11-06 00:52:04 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -50,19 +50,33 @@ enum {
};
enum {
kStaticTextWidget = 'TEXT',
kEditTextWidget = 'EDIT',
kButtonWidget = 'BTTN',
kCheckboxWidget = 'CHKB',
kSliderWidget = 'SLDE',
kListWidget = 'LIST',
kScrollBarWidget = 'SCRB',
kPopUpWidget = 'POPU',
kTabWidget = 'TABW',
kPromptWidget = 'PROM',
kDataGridWidget = 'BGRI',
kToggleWidget = 'TOGL',
kColorWidget = 'COLR'
kStaticTextWidget = 'TEXT',
kEditTextWidget = 'EDIT',
kButtonWidget = 'BTTN',
kCheckboxWidget = 'CHKB',
kSliderWidget = 'SLDE',
kListWidget = 'LIST',
kScrollBarWidget = 'SCRB',
kPopUpWidget = 'POPU',
kTabWidget = 'TABW',
kEventMappingWidget = 'EVMP',
kEditableWidget = 'EDLE',
kAudioWidget = 'AUDW',
kColorWidget = 'COLR',
kCpuWidget = 'CPUW',
kDataGridOpsWidget = 'BGRO',
kDataGridWidget = 'BGRI',
kPromptWidget = 'PROM',
kRamWidget = 'RAMW',
kRomListWidget = 'ROML',
kRomWidget = 'ROMW',
kTiaInfoWidget = 'TIAI',
kTiaOutputWidget = 'TIAO',
kTiaWidget = 'TIAW',
kTiaZoomWidget = 'TIAZ',
kToggleBitWidget = 'TGLB',
kTogglePixelWidget = 'TGLP',
kToggleWidget = 'TOGL'
};
enum {
@ -74,7 +88,7 @@ enum {
This is the base class for all widgets.
@author Stephen Anthony
@version $Id: Widget.hxx,v 1.50 2006-05-04 17:45:25 stephena Exp $
@version $Id: Widget.hxx,v 1.51 2006-11-06 00:52:04 stephena Exp $
*/
class Widget : public GuiObject
{