diff --git a/stella/src/common/FrameBufferGL.cxx b/stella/src/common/FrameBufferGL.cxx index 4a34509ad..1040b78f5 100644 --- a/stella/src/common/FrameBufferGL.cxx +++ b/stella/src/common/FrameBufferGL.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 @@ -203,8 +203,8 @@ bool FrameBufferGL::createScreen() SDL_GL_SwapBuffers(); glClear(GL_COLOR_BUFFER_BIT); - refreshTIA(); - refreshOverlay(); + myOSystem->eventHandler().refreshDisplay(); + return true; } @@ -256,7 +256,7 @@ void FrameBufferGL::postFrameUpdate() { // Do the following twice, since OpenGL mode is double-buffered, // 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 // and antialiasing diff --git a/stella/src/common/FrameBufferSoft.cxx b/stella/src/common/FrameBufferSoft.cxx index 9d0662297..75ac63145 100644 --- a/stella/src/common/FrameBufferSoft.cxx +++ b/stella/src/common/FrameBufferSoft.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 @@ -101,8 +101,8 @@ bool FrameBufferSoft::createScreen() return false; } - refreshTIA(); - refreshOverlay(); + myOSystem->eventHandler().refreshDisplay(); + return true; } diff --git a/stella/src/debugger/CheatWidget.cxx b/stella/src/debugger/CheatWidget.cxx index 054aedd73..ab3559484 100644 --- a/stella/src/debugger/CheatWidget.cxx +++ b/stella/src/debugger/CheatWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // 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); addFocusWidget(myResultsList); - myInputBox = new InputTextDialog(boss, instance()->consoleFont()); + myInputBox = new InputTextDialog(boss, instance()->consoleFont(), 20, 20); myInputBox->setTarget(this); } diff --git a/stella/src/debugger/CpuDebug.cxx b/stella/src/debugger/CpuDebug.cxx index 4193ac0c8..9f7dcb544 100644 --- a/stella/src/debugger/CpuDebug.cxx +++ b/stella/src/debugger/CpuDebug.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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" @@ -42,8 +42,6 @@ DebuggerState& CpuDebug::getState() myState.PSbits.clear(); 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))) myState.PSbits.push_back(true); else diff --git a/stella/src/debugger/RamWidget.cxx b/stella/src/debugger/RamWidget.cxx index b93e95524..62eb3d4e0 100644 --- a/stella/src/debugger/RamWidget.cxx +++ b/stella/src/debugger/RamWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -25,27 +25,39 @@ #include "FrameBuffer.hxx" #include "GuiUtils.hxx" #include "GuiObject.hxx" +#include "InputTextDialog.hxx" #include "Widget.hxx" #include "EditTextWidget.hxx" #include "DataGridWidget.hxx" #include "RamDebug.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) : Widget(boss, x, y, 16, 16), - CommandSender(boss) + CommandSender(boss), + myUndoAddress(-1), + myUndoValue(-1), + mySearchValue(-1) { const int fontWidth = font.getMaxCharWidth(), fontHeight = font.getFontHeight(), - lineHeight = font.getLineHeight(); + lineHeight = font.getLineHeight(), + bwidth = 44, + bheight = 16; int xpos, ypos, lwidth; 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 xpos = x; ypos = y + lineHeight; lwidth = 4 * fontWidth; 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); 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) { 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->setEditable(false); -/* - // keep a pointer to this one, it gets disabled/enabled - myUndoButton = b = new ButtonWidget(boss, xpos, ypos, buttonw*2+10, 16, "Undo", kUndoCmd, 0); - b->setTarget(this); + // Inputbox which will pop up when searching RAM + xpos = x + lwidth + 20; ypos = y + 2*lineHeight; + myInputBox = new InputTextDialog(boss, font, xpos, ypos); + myInputBox->setTarget(this); - // keep a pointer to this one, it gets disabled/enabled - myRevertButton = b = new ButtonWidget(boss, xpos, ypos, buttonw*2+10, 16, "Revert", kRevertCmd, 0); - b->setTarget(this); -*/ + // Start with these buttons disabled + myCompareButton->clearFlags(WIDGET_ENABLED); + myRestartButton->clearFlags(WIDGET_ENABLED); // Calculate real dimensions _w = lwidth + myRamGrid->getWidth(); @@ -143,8 +182,8 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) dbg.write(addr, value); myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10)); myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2)); -// myRevertButton->setEnabled(true); -// myUndoButton->setEnabled(true); + myRevertButton->setEnabled(true); + myUndoButton->setEnabled(true); break; case kDGSelectionChangedCmd: @@ -161,15 +200,53 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) case kRevertCmd: for(unsigned int i = 0; i < kRamSize; i++) - dbg.write(i, _oldValueList[i]); + dbg.write(i, myOldValueList[i]); fillGrid(true); break; case kUndoCmd: dbg.write(myUndoAddress, myUndoValue); -// myUndoButton->setEnabled(false); + myUndoButton->setEnabled(false); fillGrid(false); 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; BoolArray changed; - if(updateOld) _oldValueList.clear(); + if(updateOld) myOldValueList.clear(); RamDebug& dbg = instance()->debugger().ramDebug(); @@ -195,7 +272,7 @@ void RamWidget::fillGrid(bool updateOld) RamState oldstate = (RamState&) dbg.getOldState(); vlist = state.ram; - if(updateOld) _oldValueList = state.ram; + if(updateOld) myOldValueList = state.ram; for(unsigned int i = 0; i < 16*8; i++) { @@ -206,7 +283,139 @@ void RamWidget::fillGrid(bool updateOld) myRamGrid->setList(alist, vlist, changed); if(updateOld) { -// myRevertButton->setEnabled(false); -// myUndoButton->setEnabled(false); + myRevertButton->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); +} diff --git a/stella/src/debugger/RamWidget.hxx b/stella/src/debugger/RamWidget.hxx index e421e6e85..8e2b97d65 100644 --- a/stella/src/debugger/RamWidget.hxx +++ b/stella/src/debugger/RamWidget.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -23,20 +23,16 @@ #define RAM_WIDGET_HXX class GuiObject; +class InputTextDialog; class ButtonWidget; -class StaticTextWidget; class EditTextWidget; +class StaticTextWidget; #include "Array.hxx" #include "Widget.hxx" #include "Command.hxx" #include "DataGridWidget.hxx" -enum { - kUndoCmd = 'RWud', - kRevertCmd = 'RWrv' -}; - class RamWidget : public Widget, public CommandSender { @@ -52,19 +48,30 @@ class RamWidget : public Widget, public CommandSender private: void fillGrid(bool updateOld); + const string doSearch(const string& str); + const string doCompare(const string& str); + void doRestart(); + private: int myUndoAddress; int myUndoValue; + int mySearchValue; DataGridWidget* myRamGrid; EditTextWidget* myBinValue; EditTextWidget* myDecValue; EditTextWidget* myLabel; - ButtonWidget *myRevertButton; - ButtonWidget *myUndoButton; + ButtonWidget* myRevertButton; + ButtonWidget* myUndoButton; + ButtonWidget* mySearchButton; + ButtonWidget* myCompareButton; + ButtonWidget* myRestartButton; - IntArray _oldValueList; + InputTextDialog* myInputBox; + + IntArray myOldValueList; + IntArray mySearchResults; }; #endif diff --git a/stella/src/debugger/TiaOutputWidget.cxx b/stella/src/debugger/TiaOutputWidget.cxx index 80aeef8e4..a7eb9ff6c 100644 --- a/stella/src/debugger/TiaOutputWidget.cxx +++ b/stella/src/debugger/TiaOutputWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -38,6 +38,12 @@ TiaOutputWidget::~TiaOutputWidget() { } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TiaOutputWidget::loadConfig() +{ + setDirty(); draw(); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TiaOutputWidget::advanceScanline(int lines) { @@ -46,7 +52,6 @@ void TiaOutputWidget::advanceScanline(int lines) instance()->console().mediaSource().updateScanline(); --lines; } - setDirty(); draw(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -57,7 +62,6 @@ void TiaOutputWidget::advance(int frames) instance()->console().mediaSource().update(); --frames; } - setDirty(); draw(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -76,6 +80,6 @@ cerr << "TiaOutputWidget button press:" << endl void TiaOutputWidget::drawWidget(bool hilite) { cerr << "TiaOutputWidget::drawWidget\n"; - instance()->frameBuffer().refreshTIA(); + instance()->frameBuffer().refresh(); instance()->frameBuffer().drawMediaSource(); } diff --git a/stella/src/debugger/TiaOutputWidget.hxx b/stella/src/debugger/TiaOutputWidget.hxx index 36d5b33e7..8ae115da6 100644 --- a/stella/src/debugger/TiaOutputWidget.hxx +++ b/stella/src/debugger/TiaOutputWidget.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -35,6 +35,7 @@ class TiaOutputWidget : public Widget, public CommandSender virtual ~TiaOutputWidget(); void handleMouseDown(int x, int y, int button, int clickCount); + void loadConfig(); // Eventually, these methods will enable access to the onscreen TIA image // For example, clicking an area may cause an action diff --git a/stella/src/emucore/EventHandler.cxx b/stella/src/emucore/EventHandler.cxx index c208e9978..e8b198de5 100644 --- a/stella/src/emucore/EventHandler.cxx +++ b/stella/src/emucore/EventHandler.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 @@ -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() { @@ -463,9 +490,7 @@ void EventHandler::poll(uInt32 time) break; // SDL_QUIT case SDL_VIDEOEXPOSE: -cerr << "SDL_VIDEOEXPOSE\n"; - myOSystem->frameBuffer().refreshTIA(); - myOSystem->frameBuffer().refreshOverlay(); + refreshDisplay(); break; // SDL_VIDEOEXPOSE } @@ -1289,7 +1314,7 @@ void EventHandler::takeSnapshot() filename = sspath + ".png"; // Now create a Snapshot object and save the PNG - myOSystem->frameBuffer().refreshTIA(true); + myOSystem->frameBuffer().refresh(true); Snapshot snapshot(myOSystem->frameBuffer()); string result = snapshot.savePNG(filename); myOSystem->frameBuffer().showMessage(result); @@ -1318,7 +1343,9 @@ void EventHandler::enterMenuMode() { myState = S_MENU; myOSystem->menu().reStack(); - myOSystem->frameBuffer().refreshOverlay(); + + refreshDisplay(); + myOSystem->frameBuffer().setCursorState(); myOSystem->sound().mute(true); myEvent->clear(); @@ -1328,7 +1355,9 @@ void EventHandler::enterMenuMode() void EventHandler::leaveMenuMode() { myState = S_EMULATE; - myOSystem->frameBuffer().refreshTIA(); + + refreshDisplay(); + myOSystem->frameBuffer().setCursorState(); myOSystem->sound().mute(false); myEvent->clear(); @@ -1354,7 +1383,7 @@ bool EventHandler::enterDebugMode() // Make sure screen is always refreshed when entering debug mode // (sometimes entering on a breakpoint doesn't draw contents) - myOSystem->frameBuffer().refreshOverlay(true); + refreshDisplay(); return true; } @@ -1371,7 +1400,7 @@ void EventHandler::leaveDebugMode() myState = S_EMULATE; myOSystem->createFrameBuffer(); - myOSystem->frameBuffer().refreshTIA(); + refreshDisplay(); myOSystem->frameBuffer().setCursorState(); myEvent->clear(); diff --git a/stella/src/emucore/EventHandler.hxx b/stella/src/emucore/EventHandler.hxx index e5bc9c914..b75755039 100644 --- a/stella/src/emucore/EventHandler.hxx +++ b/stella/src/emucore/EventHandler.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 @@ -74,7 +74,7 @@ struct Stella_Joystick { mapping can take place. @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 { @@ -157,6 +157,11 @@ class EventHandler */ void reset(State state); + /** + Refresh display according to the current state + */ + void refreshDisplay(); + /** This method indicates whether a pause event has been received. */ diff --git a/stella/src/emucore/FrameBuffer.cxx b/stella/src/emucore/FrameBuffer.cxx index 423eb71fa..aea914d63 100644 --- a/stella/src/emucore/FrameBuffer.cxx +++ b/stella/src/emucore/FrameBuffer.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 @@ -38,7 +38,6 @@ FrameBuffer::FrameBuffer(OSystem* osystem) : myOSystem(osystem), theRedrawTIAIndicator(true), - theRedrawOverlayIndicator(false), theZoomLevel(2), theMaxZoomLevel(2), theAspectRatio(1.0), @@ -196,25 +195,19 @@ void FrameBuffer::update() if(theRedrawTIAIndicator) drawMediaSource(); - // Only update the overlay if it's changed - myOSystem->menu().draw(theRedrawOverlayIndicator); - + myOSystem->menu().draw(); break; // S_MENU } case EventHandler::S_LAUNCHER: { - // Only update the overlay if it's changed - myOSystem->launcher().draw(theRedrawOverlayIndicator); - + myOSystem->launcher().draw(); break; // S_LAUNCHER } case EventHandler::S_DEBUGGER: { - // Only update the overlay if it's changed - myOSystem->debugger().draw(theRedrawOverlayIndicator); - + myOSystem->debugger().draw(); break; // S_DEBUGGER } @@ -227,11 +220,11 @@ void FrameBuffer::update() postFrameUpdate(); // 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; 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) { @@ -623,10 +605,11 @@ void FrameBuffer::drawString(const GUI::Font* font, const string& s, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const uInt8 FrameBuffer::ourGUIColors[kNumColors-256][3] = { - {104, 104, 104}, - {0, 0, 0}, - {64, 64, 64}, - {32, 160, 32}, - {0, 255, 0}, - {200, 0, 0} + { 104, 104, 104 }, // kColor + { 0, 0, 0 }, // kBGColor + { 64, 64, 64 }, // kShadowColor + { 0, 0, 200 }, // kHiliteColor + { 32, 160, 32 }, // kTextColor + { 0, 255, 0 }, // kTextColorHi + { 200, 0, 0 } // kTextColorEm }; diff --git a/stella/src/emucore/FrameBuffer.hxx b/stella/src/emucore/FrameBuffer.hxx index fac77c55b..4de6ade5d 100644 --- a/stella/src/emucore/FrameBuffer.hxx +++ b/stella/src/emucore/FrameBuffer.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 @@ -52,7 +52,7 @@ enum FrameStyle { All GUI elements (ala ScummVM) are drawn here as well. @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 { @@ -137,13 +137,7 @@ class FrameBuffer @param now Determine if the refresh should be done right away or in the next frame */ - void refreshTIA(bool now = false); - - /** - Indicates that the overlay area is dirty, and certain areas need - to be redrawn. - */ - void refreshOverlay(bool now = false); + void refresh(bool now = false); /** Toggles between fullscreen and window mode. @@ -420,9 +414,6 @@ class FrameBuffer // Indicates if the TIA area should be redrawn bool theRedrawTIAIndicator; - // Indicates if the overlay area should be redrawn - bool theRedrawOverlayIndicator; - // The SDL video buffer SDL_Surface* myScreen; diff --git a/stella/src/emucore/OSystem.cxx b/stella/src/emucore/OSystem.cxx index 72a08a253..b1cef70dc 100644 --- a/stella/src/emucore/OSystem.cxx +++ b/stella/src/emucore/OSystem.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: OSystem.cxx,v 1.29 2005-08-10 12:23:42 stephena Exp $ +// $Id: OSystem.cxx,v 1.30 2005-08-11 19:12:38 stephena Exp $ //============================================================================ #include @@ -336,7 +336,9 @@ void OSystem::createLauncher() // And start the base dialog myLauncher->initialize(); myLauncher->reStack(); - myFrameBuffer->refreshOverlay(); + + myEventHandler->refreshDisplay(); + myFrameBuffer->setCursorState(); mySound->mute(true); } diff --git a/stella/src/emucore/m6502/src/M6502.cxx b/stella/src/emucore/m6502/src/M6502.cxx index 47f036a4c..923ddd29d 100644 --- a/stella/src/emucore/m6502/src/M6502.cxx +++ b/stella/src/emucore/m6502/src/M6502.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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" @@ -130,7 +130,7 @@ void M6502::clearCondBreaks() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const StringList M6502::getCondBreakNames() +const StringList& M6502::getCondBreakNames() { return myBreakCondNames; } diff --git a/stella/src/emucore/m6502/src/M6502.hxx b/stella/src/emucore/m6502/src/M6502.hxx index 0d9d7cbb3..7ebf87fec 100644 --- a/stella/src/emucore/m6502/src/M6502.hxx +++ b/stella/src/emucore/m6502/src/M6502.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 @@ -41,7 +41,7 @@ typedef GUI::Array ExpressionList; has a 64K addressing space. @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 { @@ -49,7 +49,6 @@ class M6502 /** The 6502 debugger class is a friend who needs special access */ - friend class D6502; // FIXME - remove friend class CpuDebug; public: @@ -184,13 +183,13 @@ class M6502 public: void setBreakPoints(PackedBitArray *bp); - void setTraps(PackedBitArray *read, PackedBitArray *write); + void setTraps(PackedBitArray *read, PackedBitArray *write); int totalInstructionCount() { return myTotalInstructionCount; } unsigned int addCondBreak(Expression *e, string name); void delCondBreak(unsigned int brk); void clearCondBreaks(); - const StringList getCondBreakNames(); + const StringList& getCondBreakNames(); int evalCondBreaks(); protected: @@ -282,4 +281,5 @@ class M6502 StringList myBreakCondNames; ExpressionList myBreakConds; }; + #endif diff --git a/stella/src/gui/AddrValueWidget.cxx b/stella/src/gui/AddrValueWidget.cxx index adf656183..14f876798 100644 --- a/stella/src/gui/AddrValueWidget.cxx +++ b/stella/src/gui/AddrValueWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -33,7 +33,6 @@ AddrValueWidget::AddrValueWidget(GuiObject* boss, int x, int y, int w, int h, int range, BaseFormat base) : EditableWidget(boss, x, y, w, h), - CommandSender(boss), _range(range), _base(base) { diff --git a/stella/src/gui/AddrValueWidget.hxx b/stella/src/gui/AddrValueWidget.hxx index f4eebd70d..353fba063 100644 --- a/stella/src/gui/AddrValueWidget.hxx +++ b/stella/src/gui/AddrValueWidget.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -44,7 +44,7 @@ enum { }; /* AddrValueWidget */ -class AddrValueWidget : public EditableWidget, public CommandSender +class AddrValueWidget : public EditableWidget { public: AddrValueWidget(GuiObject* boss, int x, int y, int w, int h, diff --git a/stella/src/gui/DataGridWidget.cxx b/stella/src/gui/DataGridWidget.cxx index e2b976532..c2a7558dd 100644 --- a/stella/src/gui/DataGridWidget.cxx +++ b/stella/src/gui/DataGridWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // 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) : EditableWidget(boss, x, y, cols*(colchars * font.getMaxCharWidth() + 8) + 1, font.getLineHeight()*rows + 1), - CommandSender(boss), _rows(rows), _cols(cols), _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 // _textcolorhi to erase it _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(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +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) { @@ -485,6 +511,10 @@ void DataGridWidget::drawWidget(bool hilite) else 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); } } diff --git a/stella/src/gui/DataGridWidget.hxx b/stella/src/gui/DataGridWidget.hxx index b37b0c6ce..4921484e8 100644 --- a/stella/src/gui/DataGridWidget.hxx +++ b/stella/src/gui/DataGridWidget.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -41,7 +41,7 @@ enum { }; /* DataGridWidget */ -class DataGridWidget : public EditableWidget, public CommandSender +class DataGridWidget : public EditableWidget { public: 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, const BoolArray& changed); + void setHiliteList(const IntArray& hilitelist); + void setSelectedValue(int value); int getSelectedAddr() const { return _addrList[_selectedItem]; } @@ -101,6 +103,7 @@ class DataGridWidget : public EditableWidget, public CommandSender StringList _addrStringList; StringList _valueStringList; BoolArray _changedList; + BoolArray _hiliteList; bool _editMode; int _selectedItem; diff --git a/stella/src/gui/Dialog.cxx b/stella/src/gui/Dialog.cxx index 94db07f49..ffeb71917 100644 --- a/stella/src/gui/Dialog.cxx +++ b/stella/src/gui/Dialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -44,7 +44,6 @@ Dialog::Dialog(OSystem* instance, DialogContainer* parent, _focusedWidget(0), _dragWidget(0), _visible(true), - _openCount(0), _ourTab(NULL), _focusID(0) { @@ -63,21 +62,15 @@ Dialog::~Dialog() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Dialog::open() { -cerr << " ==> Dialog::open()\n"; _result = 0; _visible = true; - _dirty = true; - if(_openCount++ == 0) - loadConfig(); + loadConfig(); // (Re)-build the focus list to use for the widgets which are currently // onscreen + _focusedWidget = 0; buildFocusWidgetList(_focusID); - - // Make all child widget dirty - Widget* w = _firstWidget; - Widget::setDirtyInChain(w); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -90,14 +83,6 @@ void Dialog::close() releaseFocus(); parent()->removeDialog(); - - reset(); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Dialog::reset() -{ - _openCount = 0; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -118,6 +103,7 @@ void Dialog::addFocusWidget(Widget* w) Focus f; _ourFocusList.push_back(f); } + _ourFocusList[0].focusedWidget = w; _ourFocusList[0].focusList.push_back(w); } @@ -201,23 +187,22 @@ void Dialog::drawDialog() Widget* w = _firstWidget; Widget::setDirtyInChain(w); - // Tell the framebuffer this area is dirty - fb.addDirtyRect(_x, _y, _w, _h); - } + // Draw all children + w = _firstWidget; + while(w) + { + w->draw(); + w = w->_next; + } - // Draw all children - Widget* w = _firstWidget; - while(w) - { - w->draw(); - w = w->_next; - } - - // Draw outlines for focused widgets - if(_dirty) + // Draw outlines for focused widgets redrawFocus(); - _dirty = false; + // Tell the framebuffer this area is dirty + fb.addDirtyRect(_x, _y, _w, _h); + + _dirty = false; + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/Dialog.hxx b/stella/src/gui/Dialog.hxx index 3e3d5be50..c160db8d3 100644 --- a/stella/src/gui/Dialog.hxx +++ b/stella/src/gui/Dialog.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -36,7 +36,7 @@ class TabWidget; This is the base class for all dialog boxes. @author Stephen Anthony - @version $Id: Dialog.hxx,v 1.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 { @@ -58,7 +58,6 @@ class Dialog : public GuiObject virtual void open(); virtual void close(); - virtual void reset(); virtual void drawDialog(); virtual void loadConfig() {} virtual void saveConfig() {} @@ -99,7 +98,6 @@ class Dialog : public GuiObject Widget* _focusedWidget; Widget* _dragWidget; bool _visible; - int _openCount; private: FocusList _ourFocusList; diff --git a/stella/src/gui/DialogContainer.cxx b/stella/src/gui/DialogContainer.cxx index 7fe5828c4..513391248 100644 --- a/stella/src/gui/DialogContainer.cxx +++ b/stella/src/gui/DialogContainer.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: DialogContainer.cxx,v 1.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" @@ -25,9 +25,10 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DialogContainer::DialogContainer(OSystem* osystem) - : myOSystem(osystem), - myBaseDialog(NULL), - myTime(0) + : myOSystem(osystem), + myBaseDialog(NULL), + myTime(0), + myRefreshFlag(false) { myCurrentKeyDown.keycode = 0; 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 - if(fullrefresh) + if(myRefreshFlag) { for(int i = 0; i < myDialogStack.size(); i++) { - myDialogStack[i]->open(); + myDialogStack[i]->setDirty(); myDialogStack[i]->drawDialog(); } + myRefreshFlag = false; } else if(!myDialogStack.empty()) { @@ -93,10 +95,8 @@ void DialogContainer::draw(bool fullrefresh) void DialogContainer::addDialog(Dialog* d) { myDialogStack.push(d); - myOSystem->frameBuffer().refreshTIA(); - myOSystem->frameBuffer().refreshOverlay(); -// d->open(); // FIXME + d->open(); d->setDirty(); // Next update() will take care of drawing } @@ -107,10 +107,9 @@ void DialogContainer::removeDialog() { myDialogStack.pop(); - // We need to redraw all underlying dialogs, since we don't know - // which ones were obscured - myOSystem->frameBuffer().refreshTIA(); - myOSystem->frameBuffer().refreshOverlay(); + // We need to redraw the entire screen contents, since we don't know + // what was obscured + myOSystem->eventHandler().refreshDisplay(); } } @@ -122,9 +121,6 @@ void DialogContainer::reStack() myDialogStack.pop(); addDialog(myBaseDialog); - // Now make sure all dialog boxes are in a known (closed) state - myBaseDialog->reset(); - // Reset all continuous events myCurrentKeyDown.keycode = 0; myCurrentMouseDown.button = -1; diff --git a/stella/src/gui/DialogContainer.hxx b/stella/src/gui/DialogContainer.hxx index a3aad2d14..9b912afde 100644 --- a/stella/src/gui/DialogContainer.hxx +++ b/stella/src/gui/DialogContainer.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: DialogContainer.hxx,v 1.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 @@ -37,7 +37,7 @@ typedef FixedStack DialogStack; a stack, and handles their events. @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 { @@ -102,7 +102,7 @@ class DialogContainer /** Draw the stack of menus. */ - void draw(bool fullrefresh = false); + void draw(); /** Add a dialog box to the stack @@ -119,6 +119,11 @@ class DialogContainer */ void reStack(); + /** + Redraw all dialogs on the stack + */ + void refresh() { myRefreshFlag = true; } + /** (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. @@ -141,6 +146,9 @@ class DialogContainer // Indicates the most current time (in milliseconds) as set by updateTime() uInt32 myTime; + // Indicates a full refresh of all dialogs is required + bool myRefreshFlag; + // For continuous events (keyDown) struct { int ascii; diff --git a/stella/src/gui/EditTextWidget.cxx b/stella/src/gui/EditTextWidget.cxx index efd939c1e..66132cca2 100644 --- a/stella/src/gui/EditTextWidget.cxx +++ b/stella/src/gui/EditTextWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -107,12 +107,10 @@ void EditTextWidget::startEditMode() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EditTextWidget::endEditMode() { - releaseFocus(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EditTextWidget::abortEditMode() { setEditString(_backupString); - releaseFocus(); } diff --git a/stella/src/gui/EditableWidget.cxx b/stella/src/gui/EditableWidget.cxx index f47a8954d..abacdbdaf 100644 --- a/stella/src/gui/EditableWidget.cxx +++ b/stella/src/gui/EditableWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -25,6 +25,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EditableWidget::EditableWidget(GuiObject* boss, int x, int y, int w, int h) : Widget(boss, x, y, w, h), + CommandSender(boss), _editable(true) { _caretVisible = false; @@ -88,11 +89,13 @@ bool EditableWidget::handleKeyDown(int ascii, int keycode, int modifiers) case '\r': // confirm edit and exit editmode endEditMode(); + sendCommand(kEditAcceptCmd, 0, _id); dirty = true; break; case 27: // escape abortEditMode(); + sendCommand(kEditCancelCmd, 0, _id); dirty = true; break; diff --git a/stella/src/gui/EditableWidget.hxx b/stella/src/gui/EditableWidget.hxx index 6ca56704d..40a290ce5 100644 --- a/stella/src/gui/EditableWidget.hxx +++ b/stella/src/gui/EditableWidget.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -25,11 +25,16 @@ #include "Widget.hxx" #include "Rect.hxx" +enum { + kEditAcceptCmd = 'EDac', + kEditCancelCmd = 'EDcl' +}; + /** * Base class for widgets which need to edit text, like ListWidget and * EditTextWidget. */ -class EditableWidget : public Widget +class EditableWidget : public Widget, public CommandSender { public: EditableWidget(GuiObject *boss, int x, int y, int w, int h); diff --git a/stella/src/gui/GuiUtils.hxx b/stella/src/gui/GuiUtils.hxx index ff82aad5e..84a87c0c7 100644 --- a/stella/src/gui/GuiUtils.hxx +++ b/stella/src/gui/GuiUtils.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -29,7 +29,7 @@ Probably not very neat, but at least it works ... @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 @@ -42,6 +42,7 @@ enum OverlayColor { kColor = 256, // The rest of the enumerations will continue from 256 kBGColor, kShadowColor, + kHiliteColor, kTextColor, kTextColorHi, kTextColorEm, diff --git a/stella/src/gui/InputTextDialog.cxx b/stella/src/gui/InputTextDialog.cxx index caefaf2f2..8549bde44 100644 --- a/stella/src/gui/InputTextDialog.cxx +++ b/stella/src/gui/InputTextDialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -21,7 +21,7 @@ #include "OSystem.hxx" #include "Widget.hxx" -#include "EditNumWidget.hxx" +#include "EditTextWidget.hxx" #include "Dialog.hxx" #include "GuiObject.hxx" #include "GuiUtils.hxx" @@ -34,8 +34,9 @@ enum { }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font) - : Dialog(boss->instance(), boss->parent(), 0, 0, 16, 16), +InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font, + int x, int y) + : Dialog(boss->instance(), boss->parent(), x, y, 16, 16), CommandSender(boss) { const int fontWidth = font.getMaxCharWidth(), @@ -46,8 +47,6 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font) // Calculate real dimensions _w = fontWidth * 30; _h = lineHeight * 6; - _x = (boss->getWidth() - _w) / 2; - _y = (boss->getHeight() - _h) / 2; xpos = 10; ypos = lineHeight; int lwidth = font.getStringWidth("Enter Data:"); @@ -58,8 +57,8 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font) t->setFont(font); xpos += lwidth + fontWidth; - _input = new EditNumWidget(this, xpos, ypos, - _w - xpos - 10, lineHeight, ""); + _input = new EditTextWidget(this, xpos, ypos, + _w - xpos - 10, lineHeight, ""); _input->setFont(font); addFocusWidget(_input); @@ -83,6 +82,7 @@ void InputTextDialog::handleCommand(CommandSender* sender, int cmd, switch (cmd) { case kAcceptCmd: + case kEditAcceptCmd: { // 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' @@ -93,8 +93,13 @@ void InputTextDialog::handleCommand(CommandSender* sender, int cmd, // If the data isn't valid, the parent may wait until it is break; } + + case kEditCancelCmd: + Dialog::handleCommand(sender, kCloseCmd, data, id); + break; + default: - Dialog::handleCommand(sender, cmd, data, 0); + Dialog::handleCommand(sender, cmd, data, id); break; } } diff --git a/stella/src/gui/InputTextDialog.hxx b/stella/src/gui/InputTextDialog.hxx index e96e68810..c61bc8333 100644 --- a/stella/src/gui/InputTextDialog.hxx +++ b/stella/src/gui/InputTextDialog.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -24,16 +24,15 @@ class GuiObject; class StaticTextWidget; -class EditNumWidget; #include "Dialog.hxx" #include "Command.hxx" -#include "bspf.hxx" +#include "EditTextWidget.hxx" class InputTextDialog : public Dialog, public CommandSender { 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(); } @@ -46,7 +45,7 @@ class InputTextDialog : public Dialog, public CommandSender private: StaticTextWidget* _title; - EditNumWidget* _input; + EditTextWidget* _input; int _cmd; }; diff --git a/stella/src/gui/LauncherDialog.cxx b/stella/src/gui/LauncherDialog.cxx index 572b6af79..964b7f675 100644 --- a/stella/src/gui/LauncherDialog.cxx +++ b/stella/src/gui/LauncherDialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: LauncherDialog.cxx,v 1.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 // Copyright (C) 2002-2004 The ScummVM project @@ -129,12 +129,6 @@ void LauncherDialog::loadConfig() updateListing(); } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void LauncherDialog::reset() -{ - myOptions->reset(); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void LauncherDialog::enableButtons(bool enable) { diff --git a/stella/src/gui/LauncherDialog.hxx b/stella/src/gui/LauncherDialog.hxx index 26e00edac..f2673aaea 100644 --- a/stella/src/gui/LauncherDialog.hxx +++ b/stella/src/gui/LauncherDialog.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -57,8 +57,6 @@ class LauncherDialog : public Dialog protected: void updateListing(bool fullReload = false); - - void reset(); void loadConfig(); protected: diff --git a/stella/src/gui/ListWidget.cxx b/stella/src/gui/ListWidget.cxx index d1427b050..cc746054e 100644 --- a/stella/src/gui/ListWidget.cxx +++ b/stella/src/gui/ListWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -32,8 +32,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ListWidget::ListWidget(GuiObject* boss, int x, int y, int w, int h) - : EditableWidget(boss, x, y, w, h), - CommandSender(boss) + : EditableWidget(boss, x, y, w, h) { _w = w - kScrollBarWidth; diff --git a/stella/src/gui/ListWidget.hxx b/stella/src/gui/ListWidget.hxx index 5094ba452..5f34c7112 100644 --- a/stella/src/gui/ListWidget.hxx +++ b/stella/src/gui/ListWidget.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -46,7 +46,7 @@ enum { }; /* ListWidget */ -class ListWidget : public EditableWidget, public CommandSender +class ListWidget : public EditableWidget { public: ListWidget(GuiObject* boss, int x, int y, int w, int h); diff --git a/stella/src/gui/OptionsDialog.cxx b/stella/src/gui/OptionsDialog.cxx index 34332b964..b0fedf8c9 100644 --- a/stella/src/gui/OptionsDialog.cxx +++ b/stella/src/gui/OptionsDialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // Copyright (C) 2002-2004 The ScummVM project @@ -143,17 +143,6 @@ void OptionsDialog::checkBounds(int width, int height, *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, int data, int id) diff --git a/stella/src/gui/OptionsDialog.hxx b/stella/src/gui/OptionsDialog.hxx index d7d26caf6..22d3d4197 100644 --- a/stella/src/gui/OptionsDialog.hxx +++ b/stella/src/gui/OptionsDialog.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: 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 // 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); - void reset(); void setGameProfile(Properties& props) { myGameInfoDialog->setGameProfile(props); } protected: diff --git a/stella/src/gui/Widget.cxx b/stella/src/gui/Widget.cxx index dedd97e80..e293d0d1b 100644 --- a/stella/src/gui/Widget.cxx +++ b/stella/src/gui/Widget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Widget.cxx,v 1.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 // Copyright (C) 2002-2004 The ScummVM project @@ -347,7 +347,10 @@ void ButtonWidget::handleMouseLeft(int button) void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount) { if(isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h) + { + clearFlags(WIDGET_HILITED); sendCommand(_cmd, 0, _id); + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -