Added Undo, Revert, Search, Compare and Reset buttons to the RamWidget.

The latter three completely replace the functionality of the CheatWidget,
so it will soon disappear.

The results of a RAM search are indicated by a blue frame around a cell.
Compare still isn't working, but I know how to fix it.

Made EditableWidget a CommandSender, and have it send signals when
data entry is complete or cancelled.

Some API cleanups in FrameBuffer/DialogContainer wrt refreshOverlay()
and refreshTIA().


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@716 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-08-11 19:12:39 +00:00
parent 3c530b0586
commit 547575e7a2
36 changed files with 469 additions and 228 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: FrameBufferGL.cxx,v 1.39 2005-08-03 13:26:01 stephena Exp $ // $Id: FrameBufferGL.cxx,v 1.40 2005-08-11 19:12:37 stephena Exp $
//============================================================================ //============================================================================
#ifdef DISPLAY_OPENGL #ifdef DISPLAY_OPENGL
@ -203,8 +203,8 @@ bool FrameBufferGL::createScreen()
SDL_GL_SwapBuffers(); SDL_GL_SwapBuffers();
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
refreshTIA(); myOSystem->eventHandler().refreshDisplay();
refreshOverlay();
return true; return true;
} }
@ -256,7 +256,7 @@ void FrameBufferGL::postFrameUpdate()
{ {
// Do the following twice, since OpenGL mode is double-buffered, // Do the following twice, since OpenGL mode is double-buffered,
// and we need the contents placed in both buffers // and we need the contents placed in both buffers
if(theRedrawTIAIndicator || theRedrawOverlayIndicator || myDirtyFlag) if(theRedrawTIAIndicator || myDirtyFlag)
{ {
// Texturemap complete texture to surface so we have free scaling // Texturemap complete texture to surface so we have free scaling
// and antialiasing // and antialiasing

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: FrameBufferSoft.cxx,v 1.33 2005-08-04 22:59:38 stephena Exp $ // $Id: FrameBufferSoft.cxx,v 1.34 2005-08-11 19:12:37 stephena Exp $
//============================================================================ //============================================================================
#include <SDL.h> #include <SDL.h>
@ -101,8 +101,8 @@ bool FrameBufferSoft::createScreen()
return false; return false;
} }
refreshTIA(); myOSystem->eventHandler().refreshDisplay();
refreshOverlay();
return true; return true;
} }

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: CheatWidget.cxx,v 1.3 2005-08-10 12:23:42 stephena Exp $ // $Id: CheatWidget.cxx,v 1.4 2005-08-11 19:12:38 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -97,7 +97,7 @@ CheatWidget::CheatWidget(GuiObject* boss, int x, int y, int w, int h)
myResultsList->setTarget(this); myResultsList->setTarget(this);
addFocusWidget(myResultsList); addFocusWidget(myResultsList);
myInputBox = new InputTextDialog(boss, instance()->consoleFont()); myInputBox = new InputTextDialog(boss, instance()->consoleFont(), 20, 20);
myInputBox->setTarget(this); myInputBox->setTarget(this);
} }

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: CpuDebug.cxx,v 1.5 2005-07-19 01:31:36 urchlay Exp $ // $Id: CpuDebug.cxx,v 1.6 2005-08-11 19:12:38 stephena Exp $
//============================================================================ //============================================================================
#include "Array.hxx" #include "Array.hxx"
@ -42,8 +42,6 @@ DebuggerState& CpuDebug::getState()
myState.PSbits.clear(); myState.PSbits.clear();
for(int i = 0; i < 8; ++i) for(int i = 0; i < 8; ++i)
{ {
// FIXME: Hey, Steve, I think these are *backwards*!
// At least, formatFlags was backwards
if(myState.PS & (1<<(7-i))) if(myState.PS & (1<<(7-i)))
myState.PSbits.push_back(true); myState.PSbits.push_back(true);
else else

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: RamWidget.cxx,v 1.6 2005-08-10 18:44:37 stephena Exp $ // $Id: RamWidget.cxx,v 1.7 2005-08-11 19:12:38 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -25,27 +25,39 @@
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
#include "GuiUtils.hxx" #include "GuiUtils.hxx"
#include "GuiObject.hxx" #include "GuiObject.hxx"
#include "InputTextDialog.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "EditTextWidget.hxx" #include "EditTextWidget.hxx"
#include "DataGridWidget.hxx" #include "DataGridWidget.hxx"
#include "RamDebug.hxx" #include "RamDebug.hxx"
#include "RamWidget.hxx" #include "RamWidget.hxx"
enum {
kUndoCmd = 'RWud',
kRevertCmd = 'RWrv',
kSearchCmd = 'RWse',
kCmpCmd = 'RWcp',
kRestartCmd = 'RWrs',
kSValEntered = 'RWsv',
kCValEntered = 'RWcv'
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y) RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
: Widget(boss, x, y, 16, 16), : Widget(boss, x, y, 16, 16),
CommandSender(boss) CommandSender(boss),
myUndoAddress(-1),
myUndoValue(-1),
mySearchValue(-1)
{ {
const int fontWidth = font.getMaxCharWidth(), const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(), fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(); lineHeight = font.getLineHeight(),
bwidth = 44,
bheight = 16;
int xpos, ypos, lwidth; int xpos, ypos, lwidth;
StaticTextWidget* t; StaticTextWidget* t;
// FIXME - this contains magic numbers
const int vWidth = _w - kButtonWidth - 20, space = 6, buttonw = 24;
// Create a 16x8 grid holding byte values (16 x 8 = 128 RAM bytes) with labels // Create a 16x8 grid holding byte values (16 x 8 = 128 RAM bytes) with labels
xpos = x; ypos = y + lineHeight; lwidth = 4 * fontWidth; xpos = x; ypos = y + lineHeight; lwidth = 4 * fontWidth;
myRamGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos, myRamGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos,
@ -53,6 +65,34 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
myRamGrid->setTarget(this); myRamGrid->setTarget(this);
addFocusWidget(myRamGrid); addFocusWidget(myRamGrid);
// Create actions buttons to the left of the RAM grid
xpos += lwidth + myRamGrid->getWidth() + 4;
myUndoButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight,
"Undo", kUndoCmd, 0);
myUndoButton->setTarget(this);
ypos += bheight + bheight/2;
myRevertButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight,
"Revert", kRevertCmd, 0);
myRevertButton->setTarget(this);
ypos += 2 * bheight + 2;
mySearchButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight,
"Search", kSearchCmd, 0);
mySearchButton->setTarget(this);
ypos += bheight + bheight/2;
myCompareButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight,
"Compare", kCmpCmd, 0);
myCompareButton->setTarget(this);
ypos += bheight + bheight/2;
myRestartButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight,
"Reset", kRestartCmd, 0);
myRestartButton->setTarget(this);
// Labels for RAM grid
xpos = x; ypos = y + lineHeight;
for(int row = 0; row < 8; ++row) for(int row = 0; row < 8; ++row)
{ {
t = new StaticTextWidget(boss, xpos-2, ypos + row*lineHeight + 2, t = new StaticTextWidget(boss, xpos-2, ypos + row*lineHeight + 2,
@ -101,15 +141,14 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
myBinValue->setFont(font); myBinValue->setFont(font);
myBinValue->setEditable(false); myBinValue->setEditable(false);
/* // Inputbox which will pop up when searching RAM
// keep a pointer to this one, it gets disabled/enabled xpos = x + lwidth + 20; ypos = y + 2*lineHeight;
myUndoButton = b = new ButtonWidget(boss, xpos, ypos, buttonw*2+10, 16, "Undo", kUndoCmd, 0); myInputBox = new InputTextDialog(boss, font, xpos, ypos);
b->setTarget(this); myInputBox->setTarget(this);
// keep a pointer to this one, it gets disabled/enabled // Start with these buttons disabled
myRevertButton = b = new ButtonWidget(boss, xpos, ypos, buttonw*2+10, 16, "Revert", kRevertCmd, 0); myCompareButton->clearFlags(WIDGET_ENABLED);
b->setTarget(this); myRestartButton->clearFlags(WIDGET_ENABLED);
*/
// Calculate real dimensions // Calculate real dimensions
_w = lwidth + myRamGrid->getWidth(); _w = lwidth + myRamGrid->getWidth();
@ -143,8 +182,8 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
dbg.write(addr, value); dbg.write(addr, value);
myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10)); myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10));
myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2)); myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2));
// myRevertButton->setEnabled(true); myRevertButton->setEnabled(true);
// myUndoButton->setEnabled(true); myUndoButton->setEnabled(true);
break; break;
case kDGSelectionChangedCmd: case kDGSelectionChangedCmd:
@ -161,15 +200,53 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
case kRevertCmd: case kRevertCmd:
for(unsigned int i = 0; i < kRamSize; i++) for(unsigned int i = 0; i < kRamSize; i++)
dbg.write(i, _oldValueList[i]); dbg.write(i, myOldValueList[i]);
fillGrid(true); fillGrid(true);
break; break;
case kUndoCmd: case kUndoCmd:
dbg.write(myUndoAddress, myUndoValue); dbg.write(myUndoAddress, myUndoValue);
// myUndoButton->setEnabled(false); myUndoButton->setEnabled(false);
fillGrid(false); fillGrid(false);
break; break;
case kSearchCmd:
myInputBox->setEditString("");
myInputBox->setTitle("");
myInputBox->setEmitSignal(kSValEntered);
parent()->addDialog(myInputBox);
break;
case kCmpCmd:
myInputBox->setEditString("");
myInputBox->setTitle("");
myInputBox->setEmitSignal(kCValEntered);
parent()->addDialog(myInputBox);
break;
case kRestartCmd:
doRestart();
break;
case kSValEntered:
{
const string& result = doSearch(myInputBox->getResult());
if(result != "")
myInputBox->setTitle(result);
else
parent()->removeDialog();
break;
}
case kCValEntered:
{
const string& result = doCompare(myInputBox->getResult());
if(result != "")
myInputBox->setTitle(result);
else
parent()->removeDialog();
break;
}
} }
} }
@ -187,7 +264,7 @@ void RamWidget::fillGrid(bool updateOld)
IntArray vlist; IntArray vlist;
BoolArray changed; BoolArray changed;
if(updateOld) _oldValueList.clear(); if(updateOld) myOldValueList.clear();
RamDebug& dbg = instance()->debugger().ramDebug(); RamDebug& dbg = instance()->debugger().ramDebug();
@ -195,7 +272,7 @@ void RamWidget::fillGrid(bool updateOld)
RamState oldstate = (RamState&) dbg.getOldState(); RamState oldstate = (RamState&) dbg.getOldState();
vlist = state.ram; vlist = state.ram;
if(updateOld) _oldValueList = state.ram; if(updateOld) myOldValueList = state.ram;
for(unsigned int i = 0; i < 16*8; i++) for(unsigned int i = 0; i < 16*8; i++)
{ {
@ -206,7 +283,139 @@ void RamWidget::fillGrid(bool updateOld)
myRamGrid->setList(alist, vlist, changed); myRamGrid->setList(alist, vlist, changed);
if(updateOld) if(updateOld)
{ {
// myRevertButton->setEnabled(false); myRevertButton->setEnabled(false);
// myUndoButton->setEnabled(false); myUndoButton->setEnabled(false);
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string RamWidget::doSearch(const string& str)
{
bool comparisonSearch = true;
if(str.length() == 0)
{
// An empty field means return all memory locations
comparisonSearch = false;
}
else if(str.find_first_of("+-", 0) != string::npos)
{
// Don't accept these characters here, only in compare
return "Invalid input +|-";
}
mySearchValue = instance()->debugger().stringToValue(str);
// Clear the search array of previous items
mySearchResults.clear();
// Now, search all memory locations for this value, and add it to the
// search array
RamDebug& dbg = instance()->debugger().ramDebug();
for(int addr = 0; addr < kRamSize; ++addr)
{
if(comparisonSearch)
{
if(dbg.read(addr) == mySearchValue)
mySearchResults.push_back(addr);
}
else // match all memory locations
mySearchResults.push_back(addr);
}
// If we have some hits, enable the comparison methods
if(mySearchResults.size() > 0)
{
mySearchButton->setEnabled(false);
myCompareButton->setEnabled(true);
myRestartButton->setEnabled(true);
}
// Finally, show the search results in the list
myRamGrid->setHiliteList(mySearchResults);
return "";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string RamWidget::doCompare(const string& str)
{
bool comparitiveSearch = false;
int searchVal = 0;
if(str.length() == 0)
return "Enter an absolute or comparitive value";
// Do some pre-processing on the string
string::size_type pos = str.find_first_of("+-", 0);
if(pos > 0 && pos != string::npos)
{
// Only accept '+' or '-' at the start of the string
return "Input must be [+|-]NUM";
}
// A comparitive search searches memory for locations that have changed by
// the specified amount, vs. for exact values
if(str[0] == '+' || str[0] == '-')
{
comparitiveSearch = true;
bool negative = false;
if(str[0] == '-')
negative = true;
string tmp = str;
tmp.erase(0, 1); // remove the operator
searchVal = instance()->debugger().stringToValue(tmp);
if(negative)
searchVal = -searchVal;
}
else
searchVal = instance()->debugger().stringToValue(str);
cerr << " ==> searching for " << searchVal << endl;
// Now, search all memory locations specified in mySearchArray for this value
RamDebug& dbg = instance()->debugger().ramDebug();
IntArray tempList;
for(unsigned int i = 0; i < mySearchResults.size(); ++i)
{
if(comparitiveSearch)
{
searchVal += mySearchValue;
if(searchVal >= 0 && searchVal <= 255)
continue;
}
int addr = mySearchResults[i];
if(dbg.read(addr) == searchVal)
tempList.push_back(addr);
}
// Update the searchArray to the new results
mySearchResults = tempList;
// If we have some hits, enable the comparison methods
if(mySearchResults.size() > 0)
{
myCompareButton->setEnabled(true);
myRestartButton->setEnabled(true);
}
// Finally, show the search results in the list
myRamGrid->setHiliteList(mySearchResults);
return "";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RamWidget::doRestart()
{
// Erase all search buffers, reset to start mode
mySearchValue = -1;
mySearchResults.clear();
myRamGrid->setHiliteList(mySearchResults);
mySearchButton->setEnabled(true);
myCompareButton->setEnabled(false);
myRestartButton->setEnabled(false);
}

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: RamWidget.hxx,v 1.4 2005-08-10 18:44:37 stephena Exp $ // $Id: RamWidget.hxx,v 1.5 2005-08-11 19:12:38 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -23,20 +23,16 @@
#define RAM_WIDGET_HXX #define RAM_WIDGET_HXX
class GuiObject; class GuiObject;
class InputTextDialog;
class ButtonWidget; class ButtonWidget;
class StaticTextWidget;
class EditTextWidget; class EditTextWidget;
class StaticTextWidget;
#include "Array.hxx" #include "Array.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "Command.hxx" #include "Command.hxx"
#include "DataGridWidget.hxx" #include "DataGridWidget.hxx"
enum {
kUndoCmd = 'RWud',
kRevertCmd = 'RWrv'
};
class RamWidget : public Widget, public CommandSender class RamWidget : public Widget, public CommandSender
{ {
@ -52,9 +48,14 @@ class RamWidget : public Widget, public CommandSender
private: private:
void fillGrid(bool updateOld); void fillGrid(bool updateOld);
const string doSearch(const string& str);
const string doCompare(const string& str);
void doRestart();
private: private:
int myUndoAddress; int myUndoAddress;
int myUndoValue; int myUndoValue;
int mySearchValue;
DataGridWidget* myRamGrid; DataGridWidget* myRamGrid;
EditTextWidget* myBinValue; EditTextWidget* myBinValue;
@ -63,8 +64,14 @@ class RamWidget : public Widget, public CommandSender
ButtonWidget* myRevertButton; ButtonWidget* myRevertButton;
ButtonWidget* myUndoButton; ButtonWidget* myUndoButton;
ButtonWidget* mySearchButton;
ButtonWidget* myCompareButton;
ButtonWidget* myRestartButton;
IntArray _oldValueList; InputTextDialog* myInputBox;
IntArray myOldValueList;
IntArray mySearchResults;
}; };
#endif #endif

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: TiaOutputWidget.cxx,v 1.4 2005-08-03 13:26:02 stephena Exp $ // $Id: TiaOutputWidget.cxx,v 1.5 2005-08-11 19:12:38 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -38,6 +38,12 @@ TiaOutputWidget::~TiaOutputWidget()
{ {
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaOutputWidget::loadConfig()
{
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaOutputWidget::advanceScanline(int lines) void TiaOutputWidget::advanceScanline(int lines)
{ {
@ -46,7 +52,6 @@ void TiaOutputWidget::advanceScanline(int lines)
instance()->console().mediaSource().updateScanline(); instance()->console().mediaSource().updateScanline();
--lines; --lines;
} }
setDirty(); draw();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -57,7 +62,6 @@ void TiaOutputWidget::advance(int frames)
instance()->console().mediaSource().update(); instance()->console().mediaSource().update();
--frames; --frames;
} }
setDirty(); draw();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -76,6 +80,6 @@ cerr << "TiaOutputWidget button press:" << endl
void TiaOutputWidget::drawWidget(bool hilite) void TiaOutputWidget::drawWidget(bool hilite)
{ {
cerr << "TiaOutputWidget::drawWidget\n"; cerr << "TiaOutputWidget::drawWidget\n";
instance()->frameBuffer().refreshTIA(); instance()->frameBuffer().refresh();
instance()->frameBuffer().drawMediaSource(); instance()->frameBuffer().drawMediaSource();
} }

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: TiaOutputWidget.hxx,v 1.4 2005-08-03 13:26:02 stephena Exp $ // $Id: TiaOutputWidget.hxx,v 1.5 2005-08-11 19:12:38 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -35,6 +35,7 @@ class TiaOutputWidget : public Widget, public CommandSender
virtual ~TiaOutputWidget(); virtual ~TiaOutputWidget();
void handleMouseDown(int x, int y, int button, int clickCount); void handleMouseDown(int x, int y, int button, int clickCount);
void loadConfig();
// Eventually, these methods will enable access to the onscreen TIA image // Eventually, these methods will enable access to the onscreen TIA image
// For example, clicking an area may cause an action // For example, clicking an area may cause an action

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.84 2005-08-02 15:59:44 stephena Exp $ // $Id: EventHandler.cxx,v 1.85 2005-08-11 19:12:38 stephena Exp $
//============================================================================ //============================================================================
#include <algorithm> #include <algorithm>
@ -153,6 +153,33 @@ void EventHandler::reset(State state)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::refreshDisplay()
{
switch(myState)
{
case S_EMULATE:
myOSystem->frameBuffer().refresh();
break;
case S_MENU:
myOSystem->frameBuffer().refresh();
myOSystem->menu().refresh();
break;
case S_LAUNCHER:
myOSystem->launcher().refresh();
break;
case S_DEBUGGER:
myOSystem->debugger().refresh();
break;
default:
break;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::setupJoysticks() void EventHandler::setupJoysticks()
{ {
@ -463,9 +490,7 @@ void EventHandler::poll(uInt32 time)
break; // SDL_QUIT break; // SDL_QUIT
case SDL_VIDEOEXPOSE: case SDL_VIDEOEXPOSE:
cerr << "SDL_VIDEOEXPOSE\n"; refreshDisplay();
myOSystem->frameBuffer().refreshTIA();
myOSystem->frameBuffer().refreshOverlay();
break; // SDL_VIDEOEXPOSE break; // SDL_VIDEOEXPOSE
} }
@ -1289,7 +1314,7 @@ void EventHandler::takeSnapshot()
filename = sspath + ".png"; filename = sspath + ".png";
// Now create a Snapshot object and save the PNG // Now create a Snapshot object and save the PNG
myOSystem->frameBuffer().refreshTIA(true); myOSystem->frameBuffer().refresh(true);
Snapshot snapshot(myOSystem->frameBuffer()); Snapshot snapshot(myOSystem->frameBuffer());
string result = snapshot.savePNG(filename); string result = snapshot.savePNG(filename);
myOSystem->frameBuffer().showMessage(result); myOSystem->frameBuffer().showMessage(result);
@ -1318,7 +1343,9 @@ void EventHandler::enterMenuMode()
{ {
myState = S_MENU; myState = S_MENU;
myOSystem->menu().reStack(); myOSystem->menu().reStack();
myOSystem->frameBuffer().refreshOverlay();
refreshDisplay();
myOSystem->frameBuffer().setCursorState(); myOSystem->frameBuffer().setCursorState();
myOSystem->sound().mute(true); myOSystem->sound().mute(true);
myEvent->clear(); myEvent->clear();
@ -1328,7 +1355,9 @@ void EventHandler::enterMenuMode()
void EventHandler::leaveMenuMode() void EventHandler::leaveMenuMode()
{ {
myState = S_EMULATE; myState = S_EMULATE;
myOSystem->frameBuffer().refreshTIA();
refreshDisplay();
myOSystem->frameBuffer().setCursorState(); myOSystem->frameBuffer().setCursorState();
myOSystem->sound().mute(false); myOSystem->sound().mute(false);
myEvent->clear(); myEvent->clear();
@ -1354,7 +1383,7 @@ bool EventHandler::enterDebugMode()
// Make sure screen is always refreshed when entering debug mode // Make sure screen is always refreshed when entering debug mode
// (sometimes entering on a breakpoint doesn't draw contents) // (sometimes entering on a breakpoint doesn't draw contents)
myOSystem->frameBuffer().refreshOverlay(true); refreshDisplay();
return true; return true;
} }
@ -1371,7 +1400,7 @@ void EventHandler::leaveDebugMode()
myState = S_EMULATE; myState = S_EMULATE;
myOSystem->createFrameBuffer(); myOSystem->createFrameBuffer();
myOSystem->frameBuffer().refreshTIA(); refreshDisplay();
myOSystem->frameBuffer().setCursorState(); myOSystem->frameBuffer().setCursorState();
myEvent->clear(); myEvent->clear();

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.44 2005-07-10 02:16:00 stephena Exp $ // $Id: EventHandler.hxx,v 1.45 2005-08-11 19:12:38 stephena Exp $
//============================================================================ //============================================================================
#ifndef EVENTHANDLER_HXX #ifndef EVENTHANDLER_HXX
@ -74,7 +74,7 @@ struct Stella_Joystick {
mapping can take place. mapping can take place.
@author Stephen Anthony @author Stephen Anthony
@version $Id: EventHandler.hxx,v 1.44 2005-07-10 02:16:00 stephena Exp $ @version $Id: EventHandler.hxx,v 1.45 2005-08-11 19:12:38 stephena Exp $
*/ */
class EventHandler class EventHandler
{ {
@ -157,6 +157,11 @@ class EventHandler
*/ */
void reset(State state); void reset(State state);
/**
Refresh display according to the current state
*/
void refreshDisplay();
/** /**
This method indicates whether a pause event has been received. This method indicates whether a pause event has been received.
*/ */

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.58 2005-08-01 22:33:12 stephena Exp $ // $Id: FrameBuffer.cxx,v 1.59 2005-08-11 19:12:38 stephena Exp $
//============================================================================ //============================================================================
#include <sstream> #include <sstream>
@ -38,7 +38,6 @@
FrameBuffer::FrameBuffer(OSystem* osystem) FrameBuffer::FrameBuffer(OSystem* osystem)
: myOSystem(osystem), : myOSystem(osystem),
theRedrawTIAIndicator(true), theRedrawTIAIndicator(true),
theRedrawOverlayIndicator(false),
theZoomLevel(2), theZoomLevel(2),
theMaxZoomLevel(2), theMaxZoomLevel(2),
theAspectRatio(1.0), theAspectRatio(1.0),
@ -196,25 +195,19 @@ void FrameBuffer::update()
if(theRedrawTIAIndicator) if(theRedrawTIAIndicator)
drawMediaSource(); drawMediaSource();
// Only update the overlay if it's changed myOSystem->menu().draw();
myOSystem->menu().draw(theRedrawOverlayIndicator);
break; // S_MENU break; // S_MENU
} }
case EventHandler::S_LAUNCHER: case EventHandler::S_LAUNCHER:
{ {
// Only update the overlay if it's changed myOSystem->launcher().draw();
myOSystem->launcher().draw(theRedrawOverlayIndicator);
break; // S_LAUNCHER break; // S_LAUNCHER
} }
case EventHandler::S_DEBUGGER: case EventHandler::S_DEBUGGER:
{ {
// Only update the overlay if it's changed myOSystem->debugger().draw();
myOSystem->debugger().draw(theRedrawOverlayIndicator);
break; // S_DEBUGGER break; // S_DEBUGGER
} }
@ -227,11 +220,11 @@ void FrameBuffer::update()
postFrameUpdate(); postFrameUpdate();
// The frame doesn't need to be completely redrawn anymore // The frame doesn't need to be completely redrawn anymore
theRedrawTIAIndicator = theRedrawOverlayIndicator = false; theRedrawTIAIndicator = false;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::refreshTIA(bool now) void FrameBuffer::refresh(bool now)
{ {
cerr << "refreshTIA() " << myNumRedraws++ << endl; cerr << "refreshTIA() " << myNumRedraws++ << endl;
theRedrawTIAIndicator = true; theRedrawTIAIndicator = true;
@ -242,17 +235,6 @@ void FrameBuffer::refreshTIA(bool now)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::refreshOverlay(bool now)
{
cerr << "refreshOverlay()\n";
if(myOSystem->eventHandler().state() == EventHandler::S_MENU)
refreshTIA(now);
theRedrawOverlayIndicator = true;
if(now) update();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::showMessage(const string& message) void FrameBuffer::showMessage(const string& message)
{ {
@ -623,10 +605,11 @@ void FrameBuffer::drawString(const GUI::Font* font, const string& s,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const uInt8 FrameBuffer::ourGUIColors[kNumColors-256][3] = { const uInt8 FrameBuffer::ourGUIColors[kNumColors-256][3] = {
{104, 104, 104}, { 104, 104, 104 }, // kColor
{0, 0, 0}, { 0, 0, 0 }, // kBGColor
{64, 64, 64}, { 64, 64, 64 }, // kShadowColor
{32, 160, 32}, { 0, 0, 200 }, // kHiliteColor
{0, 255, 0}, { 32, 160, 32 }, // kTextColor
{200, 0, 0} { 0, 255, 0 }, // kTextColorHi
{ 200, 0, 0 } // kTextColorEm
}; };

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.53 2005-08-10 12:23:42 stephena Exp $ // $Id: FrameBuffer.hxx,v 1.54 2005-08-11 19:12:38 stephena Exp $
//============================================================================ //============================================================================
#ifndef FRAMEBUFFER_HXX #ifndef FRAMEBUFFER_HXX
@ -52,7 +52,7 @@ enum FrameStyle {
All GUI elements (ala ScummVM) are drawn here as well. All GUI elements (ala ScummVM) are drawn here as well.
@author Stephen Anthony @author Stephen Anthony
@version $Id: FrameBuffer.hxx,v 1.53 2005-08-10 12:23:42 stephena Exp $ @version $Id: FrameBuffer.hxx,v 1.54 2005-08-11 19:12:38 stephena Exp $
*/ */
class FrameBuffer class FrameBuffer
{ {
@ -137,13 +137,7 @@ class FrameBuffer
@param now Determine if the refresh should be done right away or in @param now Determine if the refresh should be done right away or in
the next frame the next frame
*/ */
void refreshTIA(bool now = false); void refresh(bool now = false);
/**
Indicates that the overlay area is dirty, and certain areas need
to be redrawn.
*/
void refreshOverlay(bool now = false);
/** /**
Toggles between fullscreen and window mode. Toggles between fullscreen and window mode.
@ -420,9 +414,6 @@ class FrameBuffer
// Indicates if the TIA area should be redrawn // Indicates if the TIA area should be redrawn
bool theRedrawTIAIndicator; bool theRedrawTIAIndicator;
// Indicates if the overlay area should be redrawn
bool theRedrawOverlayIndicator;
// The SDL video buffer // The SDL video buffer
SDL_Surface* myScreen; SDL_Surface* myScreen;

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: OSystem.cxx,v 1.29 2005-08-10 12:23:42 stephena Exp $ // $Id: OSystem.cxx,v 1.30 2005-08-11 19:12:38 stephena Exp $
//============================================================================ //============================================================================
#include <cassert> #include <cassert>
@ -336,7 +336,9 @@ void OSystem::createLauncher()
// And start the base dialog // And start the base dialog
myLauncher->initialize(); myLauncher->initialize();
myLauncher->reStack(); myLauncher->reStack();
myFrameBuffer->refreshOverlay();
myEventHandler->refreshDisplay();
myFrameBuffer->setCursorState(); myFrameBuffer->setCursorState();
mySound->mute(true); mySound->mute(true);
} }

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: M6502.cxx,v 1.12 2005-07-18 23:00:18 urchlay Exp $ // $Id: M6502.cxx,v 1.13 2005-08-11 19:12:38 stephena Exp $
//============================================================================ //============================================================================
#include "M6502.hxx" #include "M6502.hxx"
@ -130,7 +130,7 @@ void M6502::clearCondBreaks()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const StringList M6502::getCondBreakNames() const StringList& M6502::getCondBreakNames()
{ {
return myBreakCondNames; return myBreakCondNames;
} }

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: M6502.hxx,v 1.11 2005-07-18 23:00:18 urchlay Exp $ // $Id: M6502.hxx,v 1.12 2005-08-11 19:12:38 stephena Exp $
//============================================================================ //============================================================================
#ifndef M6502_HXX #ifndef M6502_HXX
@ -41,7 +41,7 @@ typedef GUI::Array<Expression*> ExpressionList;
has a 64K addressing space. has a 64K addressing space.
@author Bradford W. Mott @author Bradford W. Mott
@version $Id: M6502.hxx,v 1.11 2005-07-18 23:00:18 urchlay Exp $ @version $Id: M6502.hxx,v 1.12 2005-08-11 19:12:38 stephena Exp $
*/ */
class M6502 class M6502
{ {
@ -49,7 +49,6 @@ class M6502
/** /**
The 6502 debugger class is a friend who needs special access The 6502 debugger class is a friend who needs special access
*/ */
friend class D6502; // FIXME - remove
friend class CpuDebug; friend class CpuDebug;
public: public:
@ -190,7 +189,7 @@ class M6502
unsigned int addCondBreak(Expression *e, string name); unsigned int addCondBreak(Expression *e, string name);
void delCondBreak(unsigned int brk); void delCondBreak(unsigned int brk);
void clearCondBreaks(); void clearCondBreaks();
const StringList getCondBreakNames(); const StringList& getCondBreakNames();
int evalCondBreaks(); int evalCondBreaks();
protected: protected:
@ -282,4 +281,5 @@ class M6502
StringList myBreakCondNames; StringList myBreakCondNames;
ExpressionList myBreakConds; ExpressionList myBreakConds;
}; };
#endif #endif

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: AddrValueWidget.cxx,v 1.10 2005-08-10 12:23:42 stephena Exp $ // $Id: AddrValueWidget.cxx,v 1.11 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -33,7 +33,6 @@
AddrValueWidget::AddrValueWidget(GuiObject* boss, int x, int y, int w, int h, AddrValueWidget::AddrValueWidget(GuiObject* boss, int x, int y, int w, int h,
int range, BaseFormat base) int range, BaseFormat base)
: EditableWidget(boss, x, y, w, h), : EditableWidget(boss, x, y, w, h),
CommandSender(boss),
_range(range), _range(range),
_base(base) _base(base)
{ {

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: AddrValueWidget.hxx,v 1.6 2005-07-05 15:25:44 stephena Exp $ // $Id: AddrValueWidget.hxx,v 1.7 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -44,7 +44,7 @@ enum {
}; };
/* AddrValueWidget */ /* AddrValueWidget */
class AddrValueWidget : public EditableWidget, public CommandSender class AddrValueWidget : public EditableWidget
{ {
public: public:
AddrValueWidget(GuiObject* boss, int x, int y, int w, int h, AddrValueWidget(GuiObject* boss, int x, int y, int w, int h,

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: DataGridWidget.cxx,v 1.19 2005-08-10 18:44:37 stephena Exp $ // $Id: DataGridWidget.cxx,v 1.20 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -36,7 +36,6 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
int colchars, int bits, BaseFormat base) int colchars, int bits, BaseFormat base)
: EditableWidget(boss, x, y, cols*(colchars * font.getMaxCharWidth() + 8) + 1, : EditableWidget(boss, x, y, cols*(colchars * font.getMaxCharWidth() + 8) + 1,
font.getLineHeight()*rows + 1), font.getLineHeight()*rows + 1),
CommandSender(boss),
_rows(rows), _rows(rows),
_cols(cols), _cols(cols),
_currentRow(0), _currentRow(0),
@ -59,6 +58,12 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
// The item is selected, thus _bgcolor is used to draw the caret and // The item is selected, thus _bgcolor is used to draw the caret and
// _textcolorhi to erase it // _textcolorhi to erase it
_caretInverse = true; _caretInverse = true;
// Make sure hilite list contains all false values
_hiliteList.clear();
int size = _rows * _cols;
while((int)_hiliteList.size() < size)
_hiliteList.push_back(false);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -112,6 +117,27 @@ cerr << "_addrList.size() = " << _addrList.size()
setDirty(); draw(); setDirty(); draw();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::setHiliteList(const IntArray& hilitelist)
{
// We can't assume this given list contains the exact number of
// items in this DataGrid, so we make sure
_hiliteList.clear();
int size = _rows * _cols;
while((int)_hiliteList.size() < size)
_hiliteList.push_back(false);
// Now fill it with the addresses/positions given in 'hilitelist'
for(unsigned int i = 0; i < hilitelist.size(); ++i)
{
int pos = hilitelist[i];
if(pos >= 0 && pos <= size)
_hiliteList[pos] = true;
}
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::setSelectedValue(int value) void DataGridWidget::setSelectedValue(int value)
{ {
@ -485,6 +511,10 @@ void DataGridWidget::drawWidget(bool hilite)
else else
fb.drawString(_font, buffer, x, y, _colWidth, kTextColor); fb.drawString(_font, buffer, x, y, _colWidth, kTextColor);
} }
// Hilite special items by drawing a frame
if (_hiliteList[pos])
fb.frameRect(x - 4, y - 2, _colWidth+1, _rowHeight+1, kHiliteColor);
} }
} }

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: DataGridWidget.hxx,v 1.11 2005-08-10 18:44:37 stephena Exp $ // $Id: DataGridWidget.hxx,v 1.12 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -41,7 +41,7 @@ enum {
}; };
/* DataGridWidget */ /* DataGridWidget */
class DataGridWidget : public EditableWidget, public CommandSender class DataGridWidget : public EditableWidget
{ {
public: public:
DataGridWidget(GuiObject* boss, const GUI::Font& font, DataGridWidget(GuiObject* boss, const GUI::Font& font,
@ -51,6 +51,8 @@ class DataGridWidget : public EditableWidget, public CommandSender
void setList(const IntArray& alist, const IntArray& vlist, void setList(const IntArray& alist, const IntArray& vlist,
const BoolArray& changed); const BoolArray& changed);
void setHiliteList(const IntArray& hilitelist);
void setSelectedValue(int value); void setSelectedValue(int value);
int getSelectedAddr() const { return _addrList[_selectedItem]; } int getSelectedAddr() const { return _addrList[_selectedItem]; }
@ -101,6 +103,7 @@ class DataGridWidget : public EditableWidget, public CommandSender
StringList _addrStringList; StringList _addrStringList;
StringList _valueStringList; StringList _valueStringList;
BoolArray _changedList; BoolArray _changedList;
BoolArray _hiliteList;
bool _editMode; bool _editMode;
int _selectedItem; int _selectedItem;

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: Dialog.cxx,v 1.25 2005-08-10 12:23:42 stephena Exp $ // $Id: Dialog.cxx,v 1.26 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -44,7 +44,6 @@ Dialog::Dialog(OSystem* instance, DialogContainer* parent,
_focusedWidget(0), _focusedWidget(0),
_dragWidget(0), _dragWidget(0),
_visible(true), _visible(true),
_openCount(0),
_ourTab(NULL), _ourTab(NULL),
_focusID(0) _focusID(0)
{ {
@ -63,21 +62,15 @@ Dialog::~Dialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::open() void Dialog::open()
{ {
cerr << " ==> Dialog::open()\n";
_result = 0; _result = 0;
_visible = true; _visible = true;
_dirty = true;
if(_openCount++ == 0)
loadConfig(); loadConfig();
// (Re)-build the focus list to use for the widgets which are currently // (Re)-build the focus list to use for the widgets which are currently
// onscreen // onscreen
_focusedWidget = 0;
buildFocusWidgetList(_focusID); buildFocusWidgetList(_focusID);
// Make all child widget dirty
Widget* w = _firstWidget;
Widget::setDirtyInChain(w);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -90,14 +83,6 @@ void Dialog::close()
releaseFocus(); releaseFocus();
parent()->removeDialog(); parent()->removeDialog();
reset();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::reset()
{
_openCount = 0;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -118,6 +103,7 @@ void Dialog::addFocusWidget(Widget* w)
Focus f; Focus f;
_ourFocusList.push_back(f); _ourFocusList.push_back(f);
} }
_ourFocusList[0].focusedWidget = w;
_ourFocusList[0].focusList.push_back(w); _ourFocusList[0].focusList.push_back(w);
} }
@ -201,12 +187,8 @@ void Dialog::drawDialog()
Widget* w = _firstWidget; Widget* w = _firstWidget;
Widget::setDirtyInChain(w); Widget::setDirtyInChain(w);
// Tell the framebuffer this area is dirty
fb.addDirtyRect(_x, _y, _w, _h);
}
// Draw all children // Draw all children
Widget* w = _firstWidget; w = _firstWidget;
while(w) while(w)
{ {
w->draw(); w->draw();
@ -214,11 +196,14 @@ void Dialog::drawDialog()
} }
// Draw outlines for focused widgets // Draw outlines for focused widgets
if(_dirty)
redrawFocus(); redrawFocus();
// Tell the framebuffer this area is dirty
fb.addDirtyRect(_x, _y, _w, _h);
_dirty = false; _dirty = false;
} }
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::handleMouseDown(int x, int y, int button, int clickCount) void Dialog::handleMouseDown(int x, int y, int button, int clickCount)

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: Dialog.hxx,v 1.19 2005-08-10 12:23:42 stephena Exp $ // $Id: Dialog.hxx,v 1.20 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -36,7 +36,7 @@ class TabWidget;
This is the base class for all dialog boxes. This is the base class for all dialog boxes.
@author Stephen Anthony @author Stephen Anthony
@version $Id: Dialog.hxx,v 1.19 2005-08-10 12:23:42 stephena Exp $ @version $Id: Dialog.hxx,v 1.20 2005-08-11 19:12:39 stephena Exp $
*/ */
class Dialog : public GuiObject class Dialog : public GuiObject
{ {
@ -58,7 +58,6 @@ class Dialog : public GuiObject
virtual void open(); virtual void open();
virtual void close(); virtual void close();
virtual void reset();
virtual void drawDialog(); virtual void drawDialog();
virtual void loadConfig() {} virtual void loadConfig() {}
virtual void saveConfig() {} virtual void saveConfig() {}
@ -99,7 +98,6 @@ class Dialog : public GuiObject
Widget* _focusedWidget; Widget* _focusedWidget;
Widget* _dragWidget; Widget* _dragWidget;
bool _visible; bool _visible;
int _openCount;
private: private:
FocusList _ourFocusList; FocusList _ourFocusList;

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: DialogContainer.cxx,v 1.15 2005-08-10 12:23:42 stephena Exp $ // $Id: DialogContainer.cxx,v 1.16 2005-08-11 19:12:39 stephena Exp $
//============================================================================ //============================================================================
#include "OSystem.hxx" #include "OSystem.hxx"
@ -27,7 +27,8 @@
DialogContainer::DialogContainer(OSystem* osystem) DialogContainer::DialogContainer(OSystem* osystem)
: myOSystem(osystem), : myOSystem(osystem),
myBaseDialog(NULL), myBaseDialog(NULL),
myTime(0) myTime(0),
myRefreshFlag(false)
{ {
myCurrentKeyDown.keycode = 0; myCurrentKeyDown.keycode = 0;
myCurrentMouseDown.button = -1; myCurrentMouseDown.button = -1;
@ -72,16 +73,17 @@ void DialogContainer::updateTime(uInt32 time)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DialogContainer::draw(bool fullrefresh) void DialogContainer::draw()
{ {
// Draw all the dialogs on the stack when we want a full refresh // Draw all the dialogs on the stack when we want a full refresh
if(fullrefresh) if(myRefreshFlag)
{ {
for(int i = 0; i < myDialogStack.size(); i++) for(int i = 0; i < myDialogStack.size(); i++)
{ {
myDialogStack[i]->open(); myDialogStack[i]->setDirty();
myDialogStack[i]->drawDialog(); myDialogStack[i]->drawDialog();
} }
myRefreshFlag = false;
} }
else if(!myDialogStack.empty()) else if(!myDialogStack.empty())
{ {
@ -93,10 +95,8 @@ void DialogContainer::draw(bool fullrefresh)
void DialogContainer::addDialog(Dialog* d) void DialogContainer::addDialog(Dialog* d)
{ {
myDialogStack.push(d); myDialogStack.push(d);
myOSystem->frameBuffer().refreshTIA();
myOSystem->frameBuffer().refreshOverlay();
// d->open(); // FIXME d->open();
d->setDirty(); // Next update() will take care of drawing d->setDirty(); // Next update() will take care of drawing
} }
@ -107,10 +107,9 @@ void DialogContainer::removeDialog()
{ {
myDialogStack.pop(); myDialogStack.pop();
// We need to redraw all underlying dialogs, since we don't know // We need to redraw the entire screen contents, since we don't know
// which ones were obscured // what was obscured
myOSystem->frameBuffer().refreshTIA(); myOSystem->eventHandler().refreshDisplay();
myOSystem->frameBuffer().refreshOverlay();
} }
} }
@ -122,9 +121,6 @@ void DialogContainer::reStack()
myDialogStack.pop(); myDialogStack.pop();
addDialog(myBaseDialog); addDialog(myBaseDialog);
// Now make sure all dialog boxes are in a known (closed) state
myBaseDialog->reset();
// Reset all continuous events // Reset all continuous events
myCurrentKeyDown.keycode = 0; myCurrentKeyDown.keycode = 0;
myCurrentMouseDown.button = -1; myCurrentMouseDown.button = -1;

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: DialogContainer.hxx,v 1.7 2005-08-01 22:33:15 stephena Exp $ // $Id: DialogContainer.hxx,v 1.8 2005-08-11 19:12:39 stephena Exp $
//============================================================================ //============================================================================
#ifndef DIALOG_CONTAINER_HXX #ifndef DIALOG_CONTAINER_HXX
@ -37,7 +37,7 @@ typedef FixedStack<Dialog *> DialogStack;
a stack, and handles their events. a stack, and handles their events.
@author Stephen Anthony @author Stephen Anthony
@version $Id: DialogContainer.hxx,v 1.7 2005-08-01 22:33:15 stephena Exp $ @version $Id: DialogContainer.hxx,v 1.8 2005-08-11 19:12:39 stephena Exp $
*/ */
class DialogContainer class DialogContainer
{ {
@ -102,7 +102,7 @@ class DialogContainer
/** /**
Draw the stack of menus. Draw the stack of menus.
*/ */
void draw(bool fullrefresh = false); void draw();
/** /**
Add a dialog box to the stack Add a dialog box to the stack
@ -119,6 +119,11 @@ class DialogContainer
*/ */
void reStack(); void reStack();
/**
Redraw all dialogs on the stack
*/
void refresh() { myRefreshFlag = true; }
/** /**
(Re)initialize the menuing system. This is necessary if a new Console (Re)initialize the menuing system. This is necessary if a new Console
has been loaded, since in most cases the screen dimensions will have changed. has been loaded, since in most cases the screen dimensions will have changed.
@ -141,6 +146,9 @@ class DialogContainer
// Indicates the most current time (in milliseconds) as set by updateTime() // Indicates the most current time (in milliseconds) as set by updateTime()
uInt32 myTime; uInt32 myTime;
// Indicates a full refresh of all dialogs is required
bool myRefreshFlag;
// For continuous events (keyDown) // For continuous events (keyDown)
struct { struct {
int ascii; int ascii;

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: EditTextWidget.cxx,v 1.8 2005-08-10 12:23:42 stephena Exp $ // $Id: EditTextWidget.cxx,v 1.9 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -107,12 +107,10 @@ void EditTextWidget::startEditMode()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EditTextWidget::endEditMode() void EditTextWidget::endEditMode()
{ {
releaseFocus();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EditTextWidget::abortEditMode() void EditTextWidget::abortEditMode()
{ {
setEditString(_backupString); setEditString(_backupString);
releaseFocus();
} }

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: EditableWidget.cxx,v 1.9 2005-08-04 16:31:24 stephena Exp $ // $Id: EditableWidget.cxx,v 1.10 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -25,6 +25,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EditableWidget::EditableWidget(GuiObject* boss, int x, int y, int w, int h) EditableWidget::EditableWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h), : Widget(boss, x, y, w, h),
CommandSender(boss),
_editable(true) _editable(true)
{ {
_caretVisible = false; _caretVisible = false;
@ -88,11 +89,13 @@ bool EditableWidget::handleKeyDown(int ascii, int keycode, int modifiers)
case '\r': case '\r':
// confirm edit and exit editmode // confirm edit and exit editmode
endEditMode(); endEditMode();
sendCommand(kEditAcceptCmd, 0, _id);
dirty = true; dirty = true;
break; break;
case 27: // escape case 27: // escape
abortEditMode(); abortEditMode();
sendCommand(kEditCancelCmd, 0, _id);
dirty = true; dirty = true;
break; break;

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: EditableWidget.hxx,v 1.5 2005-06-30 00:08:01 stephena Exp $ // $Id: EditableWidget.hxx,v 1.6 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -25,11 +25,16 @@
#include "Widget.hxx" #include "Widget.hxx"
#include "Rect.hxx" #include "Rect.hxx"
enum {
kEditAcceptCmd = 'EDac',
kEditCancelCmd = 'EDcl'
};
/** /**
* Base class for widgets which need to edit text, like ListWidget and * Base class for widgets which need to edit text, like ListWidget and
* EditTextWidget. * EditTextWidget.
*/ */
class EditableWidget : public Widget class EditableWidget : public Widget, public CommandSender
{ {
public: public:
EditableWidget(GuiObject *boss, int x, int y, int w, int h); EditableWidget(GuiObject *boss, int x, int y, int w, int h);

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: GuiUtils.hxx,v 1.17 2005-08-10 12:23:42 stephena Exp $ // $Id: GuiUtils.hxx,v 1.18 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -29,7 +29,7 @@
Probably not very neat, but at least it works ... Probably not very neat, but at least it works ...
@author Stephen Anthony @author Stephen Anthony
@version $Id: GuiUtils.hxx,v 1.17 2005-08-10 12:23:42 stephena Exp $ @version $Id: GuiUtils.hxx,v 1.18 2005-08-11 19:12:39 stephena Exp $
*/ */
#define kFontHeight 10 #define kFontHeight 10
@ -42,6 +42,7 @@ enum OverlayColor {
kColor = 256, // The rest of the enumerations will continue from 256 kColor = 256, // The rest of the enumerations will continue from 256
kBGColor, kBGColor,
kShadowColor, kShadowColor,
kHiliteColor,
kTextColor, kTextColor,
kTextColorHi, kTextColorHi,
kTextColorEm, kTextColorEm,

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: InputTextDialog.cxx,v 1.3 2005-08-10 12:23:42 stephena Exp $ // $Id: InputTextDialog.cxx,v 1.4 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -21,7 +21,7 @@
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "EditNumWidget.hxx" #include "EditTextWidget.hxx"
#include "Dialog.hxx" #include "Dialog.hxx"
#include "GuiObject.hxx" #include "GuiObject.hxx"
#include "GuiUtils.hxx" #include "GuiUtils.hxx"
@ -34,8 +34,9 @@ enum {
}; };
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font) InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
: Dialog(boss->instance(), boss->parent(), 0, 0, 16, 16), int x, int y)
: Dialog(boss->instance(), boss->parent(), x, y, 16, 16),
CommandSender(boss) CommandSender(boss)
{ {
const int fontWidth = font.getMaxCharWidth(), const int fontWidth = font.getMaxCharWidth(),
@ -46,8 +47,6 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font)
// Calculate real dimensions // Calculate real dimensions
_w = fontWidth * 30; _w = fontWidth * 30;
_h = lineHeight * 6; _h = lineHeight * 6;
_x = (boss->getWidth() - _w) / 2;
_y = (boss->getHeight() - _h) / 2;
xpos = 10; ypos = lineHeight; xpos = 10; ypos = lineHeight;
int lwidth = font.getStringWidth("Enter Data:"); int lwidth = font.getStringWidth("Enter Data:");
@ -58,7 +57,7 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font)
t->setFont(font); t->setFont(font);
xpos += lwidth + fontWidth; xpos += lwidth + fontWidth;
_input = new EditNumWidget(this, xpos, ypos, _input = new EditTextWidget(this, xpos, ypos,
_w - xpos - 10, lineHeight, ""); _w - xpos - 10, lineHeight, "");
_input->setFont(font); _input->setFont(font);
addFocusWidget(_input); addFocusWidget(_input);
@ -83,6 +82,7 @@ void InputTextDialog::handleCommand(CommandSender* sender, int cmd,
switch (cmd) switch (cmd)
{ {
case kAcceptCmd: case kAcceptCmd:
case kEditAcceptCmd:
{ {
// Send a signal to the calling class that a selection has been made // Send a signal to the calling class that a selection has been made
// Since we aren't derived from a widget, we don't have a 'data' or 'id' // Since we aren't derived from a widget, we don't have a 'data' or 'id'
@ -93,8 +93,13 @@ void InputTextDialog::handleCommand(CommandSender* sender, int cmd,
// If the data isn't valid, the parent may wait until it is // If the data isn't valid, the parent may wait until it is
break; break;
} }
case kEditCancelCmd:
Dialog::handleCommand(sender, kCloseCmd, data, id);
break;
default: default:
Dialog::handleCommand(sender, cmd, data, 0); Dialog::handleCommand(sender, cmd, data, id);
break; break;
} }
} }

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: InputTextDialog.hxx,v 1.1 2005-08-04 16:31:24 stephena Exp $ // $Id: InputTextDialog.hxx,v 1.2 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -24,16 +24,15 @@
class GuiObject; class GuiObject;
class StaticTextWidget; class StaticTextWidget;
class EditNumWidget;
#include "Dialog.hxx" #include "Dialog.hxx"
#include "Command.hxx" #include "Command.hxx"
#include "bspf.hxx" #include "EditTextWidget.hxx"
class InputTextDialog : public Dialog, public CommandSender class InputTextDialog : public Dialog, public CommandSender
{ {
public: public:
InputTextDialog(GuiObject* boss, const GUI::Font& font); InputTextDialog(GuiObject* boss, const GUI::Font& font, int x, int y);
const string& getResult() { return _input->getEditString(); } const string& getResult() { return _input->getEditString(); }
@ -46,7 +45,7 @@ class InputTextDialog : public Dialog, public CommandSender
private: private:
StaticTextWidget* _title; StaticTextWidget* _title;
EditNumWidget* _input; EditTextWidget* _input;
int _cmd; int _cmd;
}; };

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: LauncherDialog.cxx,v 1.27 2005-08-10 12:23:42 stephena Exp $ // $Id: LauncherDialog.cxx,v 1.28 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -129,12 +129,6 @@ void LauncherDialog::loadConfig()
updateListing(); updateListing();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::reset()
{
myOptions->reset();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::enableButtons(bool enable) void LauncherDialog::enableButtons(bool enable)
{ {

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: LauncherDialog.hxx,v 1.11 2005-07-05 15:25:44 stephena Exp $ // $Id: LauncherDialog.hxx,v 1.12 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -57,8 +57,6 @@ class LauncherDialog : public Dialog
protected: protected:
void updateListing(bool fullReload = false); void updateListing(bool fullReload = false);
void reset();
void loadConfig(); void loadConfig();
protected: protected:

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: ListWidget.cxx,v 1.25 2005-08-10 12:23:42 stephena Exp $ // $Id: ListWidget.cxx,v 1.26 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -32,8 +32,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ListWidget::ListWidget(GuiObject* boss, int x, int y, int w, int h) ListWidget::ListWidget(GuiObject* boss, int x, int y, int w, int h)
: EditableWidget(boss, x, y, w, h), : EditableWidget(boss, x, y, w, h)
CommandSender(boss)
{ {
_w = w - kScrollBarWidth; _w = w - kScrollBarWidth;

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: ListWidget.hxx,v 1.8 2005-07-05 15:25:44 stephena Exp $ // $Id: ListWidget.hxx,v 1.9 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -46,7 +46,7 @@ enum {
}; };
/* ListWidget */ /* ListWidget */
class ListWidget : public EditableWidget, public CommandSender class ListWidget : public EditableWidget
{ {
public: public:
ListWidget(GuiObject* boss, int x, int y, int w, int h); ListWidget(GuiObject* boss, int x, int y, int w, int h);

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: OptionsDialog.cxx,v 1.23 2005-08-10 12:23:42 stephena Exp $ // $Id: OptionsDialog.cxx,v 1.24 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -143,17 +143,6 @@ void OptionsDialog::checkBounds(int width, int height,
*y = (height - *h) / 2; *y = (height - *h) / 2;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OptionsDialog::reset()
{
myVideoDialog->reset();
myAudioDialog->reset();
myEventMappingDialog->reset();
myGameInfoDialog->reset();
myHelpDialog->reset();
myAboutDialog->reset();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OptionsDialog::handleCommand(CommandSender* sender, int cmd, void OptionsDialog::handleCommand(CommandSender* sender, int cmd,
int data, int id) int data, int id)

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: OptionsDialog.hxx,v 1.12 2005-08-05 02:28:22 urchlay Exp $ // $Id: OptionsDialog.hxx,v 1.13 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -45,7 +45,6 @@ class OptionsDialog : public Dialog
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id); virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
void reset();
void setGameProfile(Properties& props) { myGameInfoDialog->setGameProfile(props); } void setGameProfile(Properties& props) { myGameInfoDialog->setGameProfile(props); }
protected: protected:

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: Widget.cxx,v 1.27 2005-08-10 12:23:42 stephena Exp $ // $Id: Widget.cxx,v 1.28 2005-08-11 19:12:39 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -347,8 +347,11 @@ void ButtonWidget::handleMouseLeft(int button)
void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount) void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount)
{ {
if(isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h) if(isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h)
{
clearFlags(WIDGET_HILITED);
sendCommand(_cmd, 0, _id); sendCommand(_cmd, 0, _id);
} }
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ButtonWidget::drawWidget(bool hilite) void ButtonWidget::drawWidget(bool hilite)