1
//============================================================================
5
// SS tttttt eeee ll ll aaaa
6
// SSSS tt ee ee ll ll aa
7
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8
// SS SS tt ee ll ll aa aa
9
// SSSS ttt eeeee llll llll aaaaa
11
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
13
// See the file "license" for information on usage and redistribution of
14
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
16
// $Id: DebuggerDialog.cxx,v 1.13 2006/03/23 16:16:32 stephena Exp $
18
// Based on code from ScummVM - Scumm Interpreter
19
// Copyright (C) 2002-2004 The ScummVM project
20
//============================================================================
24
#include "TabWidget.hxx"
25
#include "TiaInfoWidget.hxx"
26
#include "TiaOutputWidget.hxx"
27
#include "TiaZoomWidget.hxx"
28
#include "AudioWidget.hxx"
29
#include "PromptWidget.hxx"
30
#include "CpuWidget.hxx"
31
#include "RamWidget.hxx"
32
#include "RomWidget.hxx"
33
#include "TiaWidget.hxx"
34
#include "DataGridOpsWidget.hxx"
35
#include "EditTextWidget.hxx"
37
#include "Debugger.hxx"
38
#include "DebuggerParser.hxx"
40
#include "DebuggerDialog.hxx"
50
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
51
DebuggerDialog::DebuggerDialog(OSystem* osystem, DialogContainer* parent,
52
int x, int y, int w, int h)
53
: Dialog(osystem, parent, x, y, w, h),
61
// Inform the output widget about its associated zoom widget
62
myTiaOutput->setZoomWidget(myTiaZoom);
65
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
66
DebuggerDialog::~DebuggerDialog()
70
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
71
void DebuggerDialog::loadConfig()
74
myTiaInfo->loadConfig();
75
myTiaOutput->loadConfig();
76
myTiaZoom->loadConfig();
81
myMessageBox->setEditString("");
84
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
85
void DebuggerDialog::handleKeyDown(int ascii, int keycode, int modifiers)
87
// Doing this means we disallow 'Alt xxx' events to any widget in the tabset
88
if(instance()->eventHandler().kbdAlt(modifiers))
107
Dialog::handleKeyDown(ascii, keycode, modifiers);
110
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
111
void DebuggerDialog::handleCommand(CommandSender* sender, int cmd,
114
// We reload the tabs in the cases where the actions could possibly
115
// change their contents
139
Dialog::handleCommand(sender, cmd, data, id);
143
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
144
void DebuggerDialog::addTiaArea()
146
GUI::Rect r = instance()->debugger().getTiaBounds();
148
myTiaOutput = new TiaOutputWidget(this, instance()->consoleFont(),
149
r.left, r.top, r.width(), r.height());
152
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
153
void DebuggerDialog::addTabArea()
155
GUI::Rect r = instance()->debugger().getTabBounds();
157
const int vBorder = 4;
160
myTab = new TabWidget(this, instance()->consoleFont(), r.left, r.top + vBorder,
161
r.width(), r.height() - vBorder);
164
const int widWidth = r.width() - vBorder;
165
const int widHeight = r.height() - myTab->getTabHeight() - vBorder - 4;
168
// The Prompt/console tab
169
tabID = myTab->addTab("Prompt");
170
myPrompt = new PromptWidget(myTab, instance()->consoleFont(),
171
2, 2, widWidth, widHeight);
172
myTab->setParentWidget(tabID, myPrompt);
173
addToFocusList(myPrompt->getFocusList(), tabID);
176
tabID = myTab->addTab("TIA");
177
TiaWidget* tia = new TiaWidget(myTab, instance()->consoleFont(),
178
2, 2, widWidth, widHeight);
179
myTab->setParentWidget(tabID, tia);
180
addToFocusList(tia->getFocusList(), tabID);
183
tabID = myTab->addTab("Audio");
184
AudioWidget* aud = new AudioWidget(myTab, instance()->consoleFont(),
185
2, 2, widWidth, widHeight);
186
myTab->setParentWidget(tabID, aud);
187
addToFocusList(aud->getFocusList(), tabID);
189
// The input/output tab (part of RIOT)
190
// tabID = myTab->addTab("I/O");
192
myTab->setActiveTab(0);
195
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
196
void DebuggerDialog::addStatusArea()
198
const GUI::Font& font = instance()->consoleFont();
199
GUI::Rect r = instance()->debugger().getStatusBounds();
202
xpos = r.left; ypos = r.top;
203
myTiaInfo = new TiaInfoWidget(this, instance()->consoleFont(), xpos, ypos);
205
ypos += myTiaInfo->getHeight() + 10;
206
myTiaZoom = new TiaZoomWidget(this, instance()->consoleFont(), xpos+10, ypos);
207
addToFocusList(myTiaZoom->getFocusList());
209
xpos += 10; ypos += myTiaZoom->getHeight() + 20;
210
myMessageBox = new EditTextWidget(this, instance()->consoleFont(),
211
xpos, ypos, myTiaZoom->getWidth(),
212
font.getLineHeight(), "");
213
myMessageBox->setEditable(false);
214
myMessageBox->setColor(kTextColorEm);
217
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
218
void DebuggerDialog::addRomArea()
220
GUI::Rect r = instance()->debugger().getRomBounds();
223
xpos = r.left + 10; ypos = 10;
224
myCpu = new CpuWidget(this, instance()->consoleFont(), xpos, ypos);
225
addToFocusList(myCpu->getFocusList());
227
xpos = r.left + 10; ypos += myCpu->getHeight() + 10;
228
myRam = new RamWidget(this, instance()->consoleFont(), xpos, ypos);
229
addToFocusList(myRam->getFocusList());
231
xpos = r.left + 10 + myCpu->getWidth() + 20;
232
DataGridOpsWidget* ops = new DataGridOpsWidget(this, instance()->consoleFont(),
235
const int bwidth = instance()->consoleFont().getStringWidth("Frame +1 "),
236
bheight = instance()->consoleFont().getLineHeight() + 2;
237
int buttonX = r.right - bwidth - 5, buttonY = r.top + 5;
239
new ButtonWidget(this, instance()->consoleFont(), buttonX, buttonY,
240
bwidth, bheight, "Step", kDDStepCmd);
241
buttonY += bheight + 4;
242
new ButtonWidget(this, instance()->consoleFont(), buttonX, buttonY,
243
bwidth, bheight, "Trace", kDDTraceCmd);
244
buttonY += bheight + 4;
245
new ButtonWidget(this, instance()->consoleFont(), buttonX, buttonY,
246
bwidth, bheight, "Scan +1", kDDSAdvCmd);
247
buttonY += bheight + 4;
248
new ButtonWidget(this, instance()->consoleFont(), buttonX, buttonY,
249
bwidth, bheight, "Frame +1", kDDAdvCmd);
250
buttonY += bheight + 4;
251
new ButtonWidget(this, instance()->consoleFont(), buttonX, buttonY,
252
bwidth, bheight, "Exit", kDDExitCmd);
253
buttonY += bheight + 4;
255
xpos = r.left + 10; ypos += myRam->getHeight() + 5;
256
myRom = new RomWidget(this, instance()->consoleFont(), xpos, ypos);
257
addToFocusList(myRom->getFocusList());
259
// Add the DataGridOpsWidget to any widgets which contain a
260
// DataGridWidget which we want controlled
261
myCpu->setOpsWidget(ops);
262
myRam->setOpsWidget(ops);
265
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
266
void DebuggerDialog::doStep()
268
instance()->debugger().parser()->run("step");
271
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
272
void DebuggerDialog::doTrace()
274
instance()->debugger().parser()->run("trace");
277
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
278
void DebuggerDialog::doAdvance()
280
instance()->debugger().parser()->run("frame #1");
283
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
284
void DebuggerDialog::doScanlineAdvance()
286
instance()->debugger().parser()->run("scanline #1");
289
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
290
void DebuggerDialog::doExit()
292
instance()->debugger().quit();