Rearrangement of GUI-specific code from Debugger to DebuggerDialog; more

cleanups and removals to follow.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2794 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2013-08-13 16:44:23 +00:00
parent bcb4c592d3
commit 77dfaa0ebc
4 changed files with 99 additions and 109 deletions

View File

@ -173,11 +173,8 @@ void Debugger::initialize()
myHeight = BSPF_max(myHeight, 720u);
myOSystem->settings().setValue("debuggerres", GUI::Size(myWidth, myHeight));
const GUI::Rect& r = getDialogBounds();
delete myBaseDialog; myBaseDialog = myDialog = NULL;
myDialog = new DebuggerDialog(myOSystem, this,
r.left, r.top, r.width(), r.height());
myDialog = new DebuggerDialog(myOSystem, this, 0, 0, myWidth, myHeight);
myBaseDialog = myDialog;
myRewindManager = new RewindManager(*myOSystem, myDialog->rewindButton());
@ -187,10 +184,8 @@ void Debugger::initialize()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FBInitStatus Debugger::initializeVideo()
{
const GUI::Rect& r = getDialogBounds();
string title = string("Stella ") + STELLA_VERSION + ": Debugger mode";
return myOSystem->frameBuffer().initialize(title, r.width(), r.height());
return myOSystem->frameBuffer().initialize(title, myWidth, myHeight);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -561,74 +556,6 @@ void Debugger::setQuitState()
mySystem.m6502().execute(1);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect Debugger::getDialogBounds() const
{
// The dialog bounds are the actual size of the entire dialog container
GUI::Rect r(0, 0, myWidth, myHeight);
return r;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect Debugger::getTiaBounds() const
{
// The area showing the TIA image (NTSC and PAL supported, up to 260 lines)
GUI::Rect r(0, 0, 320, 260);
return r;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect Debugger::getRomBounds() const
{
// The ROM area is the full area to the right of the tabs
const GUI::Rect& dialog = getDialogBounds();
const GUI::Rect& status = getStatusBounds();
int x1 = status.right + 1;
int y1 = 0;
int x2 = dialog.right;
int y2 = dialog.bottom;
GUI::Rect r(x1, y1, x2, y2);
return r;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect Debugger::getStatusBounds() const
{
// The status area is the full area to the right of the TIA image
// extending as far as necessary
// 30% of any space above 1030 pixels will be allocated to this area
const GUI::Rect& dlg = getDialogBounds();
const GUI::Rect& tia = getTiaBounds();
int x1 = tia.right + 1;
int y1 = 0;
int x2 = tia.right + 225 + (dlg.width() > 1030 ?
(int) (0.35 * (dlg.width() - 1030)) : 0);
int y2 = tia.bottom;
GUI::Rect r(x1, y1, x2, y2);
return r;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect Debugger::getTabBounds() const
{
// The tab area is the full area below the TIA image
const GUI::Rect& dialog = getDialogBounds();
const GUI::Rect& tia = getTiaBounds();
const GUI::Rect& status = getStatusBounds();
int x1 = 0;
int y1 = tia.bottom + 1;
int x2 = status.right + 1;
int y2 = dialog.bottom;
GUI::Rect r(x1, y1, x2, y2);
return r;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::addFunction(const string& name, const string& definition,
Expression* exp, bool builtin)

View File

@ -46,7 +46,6 @@ class ButtonWidget;
#include "DebuggerDialog.hxx"
#include "DebuggerParser.hxx"
#include "System.hxx"
#include "Rect.hxx"
#include "Stack.hxx"
#include "bspf.hxx"
@ -227,16 +226,6 @@ class Debugger : public DialogContainer
*/
static Debugger& debugger() { return *myStaticDebugger; }
/**
Get the dimensions of the various debugger dialog areas
(takes mediasource into account)
*/
GUI::Rect getDialogBounds() const;
GUI::Rect getTiaBounds() const;
GUI::Rect getRomBounds() const;
GUI::Rect getStatusBounds() const;
GUI::Rect getTabBounds() const;
/* These are now exposed so Expressions can use them. */
int peek(int addr) { return mySystem.peek(addr); }
int dpeek(int addr) { return mySystem.peek(addr) | (mySystem.peek(addr+1) << 8); }

View File

@ -34,7 +34,6 @@
#include "DataGridOpsWidget.hxx"
#include "EditTextWidget.hxx"
#include "MessageBox.hxx"
#include "Rect.hxx"
#include "Debugger.hxx"
#include "DebuggerParser.hxx"
#include "ConsoleFont.hxx"
@ -51,7 +50,7 @@ DebuggerDialog::DebuggerDialog(OSystem* osystem, DialogContainer* parent,
myFont(NULL),
myFatalError(NULL)
{
createFont();
createFont(); // Font is sized according to available space
addTiaArea();
addTabArea();
@ -175,7 +174,7 @@ void DebuggerDialog::createFont()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::showFatalMessage(const string& msg)
{
const GUI::Rect& r = instance().debugger().getDialogBounds();
const GUI::Rect& r = getDialogBounds();
delete myFatalError;
myFatalError =
@ -188,7 +187,7 @@ void DebuggerDialog::showFatalMessage(const string& msg)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::addTiaArea()
{
const GUI::Rect& r = instance().debugger().getTiaBounds();
const GUI::Rect& r = getTiaBounds();
myTiaOutput = new TiaOutputWidget(this, *myFont,
r.left, r.top, r.width(), r.height());
@ -197,7 +196,7 @@ void DebuggerDialog::addTiaArea()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::addTabArea()
{
const GUI::Rect& r = instance().debugger().getTabBounds();
const GUI::Rect& r = getTabBounds();
const int vBorder = 4;
// The tab widget
@ -248,7 +247,7 @@ void DebuggerDialog::addStatusArea()
{
const GUI::Font& font = *myFont;
const int lineHeight = font.getLineHeight();
const GUI::Rect& r = instance().debugger().getStatusBounds();
const GUI::Rect& r = getStatusBounds();
int xpos, ypos;
xpos = r.left; ypos = r.top;
@ -271,7 +270,7 @@ void DebuggerDialog::addStatusArea()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::addRomArea()
{
const GUI::Rect& r = instance().debugger().getRomBounds();
const GUI::Rect& r = getRomBounds();
const int vBorder = 4;
int xpos, ypos;
@ -357,6 +356,74 @@ void DebuggerDialog::addRomArea()
myRomTab->setActiveTab(0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect DebuggerDialog::getDialogBounds() const
{
// The dialog bounds are the actual size of the entire dialog container
GUI::Rect r(0, 0, _w, _h);
return r;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect DebuggerDialog::getTiaBounds() const
{
// The area showing the TIA image (NTSC and PAL supported, up to 260 lines)
GUI::Rect r(0, 0, 320, 260);
return r;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect DebuggerDialog::getRomBounds() const
{
// The ROM area is the full area to the right of the tabs
const GUI::Rect& dialog = getDialogBounds();
const GUI::Rect& status = getStatusBounds();
int x1 = status.right + 1;
int y1 = 0;
int x2 = dialog.right;
int y2 = dialog.bottom;
GUI::Rect r(x1, y1, x2, y2);
return r;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect DebuggerDialog::getStatusBounds() const
{
// The status area is the full area to the right of the TIA image
// extending as far as necessary
// 30% of any space above 1030 pixels will be allocated to this area
const GUI::Rect& dlg = getDialogBounds();
const GUI::Rect& tia = getTiaBounds();
int x1 = tia.right + 1;
int y1 = 0;
int x2 = tia.right + 225 + (dlg.width() > 1030 ?
(int) (0.35 * (dlg.width() - 1030)) : 0);
int y2 = tia.bottom;
GUI::Rect r(x1, y1, x2, y2);
return r;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GUI::Rect DebuggerDialog::getTabBounds() const
{
// The tab area is the full area below the TIA image
const GUI::Rect& dialog = getDialogBounds();
const GUI::Rect& tia = getTiaBounds();
const GUI::Rect& status = getStatusBounds();
int x1 = 0;
int y1 = tia.bottom + 1;
int x2 = status.right + 1;
int y2 = dialog.bottom;
GUI::Rect r(x1, y1, x2, y2);
return r;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::doStep()
{

View File

@ -37,6 +37,7 @@ class CartDebugWidget;
#include "Dialog.hxx"
#include "MessageBox.hxx"
#include "Rect.hxx"
class DebuggerDialog : public Dialog
{
@ -61,11 +62,32 @@ class DebuggerDialog : public Dialog
EditTextWidget& message() const { return *myMessageBox; }
ButtonWidget& rewindButton() const { return *myRewindButton; }
void showFatalMessage(const string& msg);
private:
void loadConfig();
void handleKeyDown(StellaKey key, StellaMod mod, char ascii);
void handleCommand(CommandSender* sender, int cmd, int data, int id);
void showFatalMessage(const string& msg);
void doStep();
void doTrace();
void doScanlineAdvance();
void doAdvance();
void doRewind();
void doExitDebugger();
void doExitRom();
void createFont();
void addTiaArea();
void addTabArea();
void addStatusArea();
void addRomArea();
GUI::Rect getDialogBounds() const;
GUI::Rect getTiaBounds() const;
GUI::Rect getRomBounds() const;
GUI::Rect getStatusBounds() const;
GUI::Rect getTabBounds() const;
private:
enum {
@ -92,21 +114,6 @@ class DebuggerDialog : public Dialog
EditTextWidget* myMessageBox;
ButtonWidget* myRewindButton;
GUI::MessageBox* myFatalError;
private:
void createFont();
void addTiaArea();
void addTabArea();
void addStatusArea();
void addRomArea();
void doStep();
void doTrace();
void doScanlineAdvance();
void doAdvance();
void doRewind();
void doExitDebugger();
void doExitRom();
};
#endif