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: TiaInfoWidget.cxx,v 1.5 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
//============================================================================
22
#include "OSystem.hxx"
23
#include "FrameBuffer.hxx"
24
#include "Debugger.hxx"
25
#include "TIADebug.hxx"
27
#include "EditTextWidget.hxx"
28
#include "GuiObject.hxx"
30
#include "TiaInfoWidget.hxx"
32
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
33
TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font,
35
: Widget(boss, font, x, y, 16, 16),
39
const int lineHeight = font.getLineHeight();
40
int xpos = x, ypos = y, lwidth = font.getStringWidth("F. Cyc:");
43
xpos = x; ypos = y + 10;
44
new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
45
"Frame:", kTextAlignLeft);
47
myFrameCount = new EditTextWidget(boss, font, xpos, ypos-2, 45, lineHeight, "");
48
myFrameCount->setEditable(false);
50
xpos = x; ypos += lineHeight + 5;
51
new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
52
"F. Cyc:", kTextAlignLeft);
54
myFrameCycles = new EditTextWidget(boss, font, xpos, ypos-2, 45, lineHeight, "");
55
myFrameCycles->setEditable(false);
57
xpos = x + 10; ypos += lineHeight + 8;
58
myVSync = new CheckboxWidget(boss, font, xpos, ypos-3, "VSync", 0);
59
myVSync->setEditable(false);
61
xpos = x + 10; ypos += lineHeight + 5;
62
myVBlank = new CheckboxWidget(boss, font, xpos, ypos-3, "VBlank", 0);
63
myVBlank->setEditable(false);
65
xpos = x + lwidth + myFrameCycles->getWidth() + 5; ypos = y + 10;
66
lwidth = font.getStringWidth("Pixel Pos:");
67
new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
68
"Scanline:", kTextAlignLeft);
70
myScanlineCount = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30,
72
myScanlineCount->setEditable(false);
74
ypos += lineHeight + 5;
75
new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
76
"S. Cyc:", kTextAlignLeft);
78
myScanlineCycles = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30,
80
myScanlineCycles->setEditable(false);
82
ypos += lineHeight + 5;
83
new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
84
"Pixel Pos:", kTextAlignLeft);
86
myPixelPosition = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30,
88
myPixelPosition->setEditable(false);
90
ypos += lineHeight + 5;
91
new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
92
"Color Clk:", kTextAlignLeft);
94
myColorClocks = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30,
96
myColorClocks->setEditable(false);
98
// Calculate actual dimensions
99
_w = 100 + 30 + lwidth;
100
_h = ypos + lineHeight;
103
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
104
TiaInfoWidget::~TiaInfoWidget()
108
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
109
void TiaInfoWidget::handleMouseDown(int x, int y, int button, int clickCount)
111
cerr << "TiaInfoWidget button press: x = " << x << ", y = " << y << endl;
114
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
115
void TiaInfoWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
119
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
120
void TiaInfoWidget::loadConfig()
122
Debugger& dbg = instance()->debugger();
123
TIADebug& tia = dbg.tiaDebug();
125
myFrameCount->setEditString(dbg.valueToString(tia.frameCount(), kBASE_10));
126
myFrameCycles->setEditString(dbg.valueToString(dbg.cycles(), kBASE_10));
128
myVSync->setState(tia.vsync());
129
myVBlank->setState(tia.vblank());
131
int clk = tia.clocksThisLine();
132
myScanlineCount->setEditString(dbg.valueToString(tia.scanlines(), kBASE_10));
133
myScanlineCycles->setEditString(dbg.valueToString(clk/3, kBASE_10));
134
myPixelPosition->setEditString(dbg.valueToString(clk-68, kBASE_10));
135
myColorClocks->setEditString(dbg.valueToString(clk, kBASE_10));