~ubuntu-branches/debian/squeeze/stella/squeeze

« back to all changes in this revision

Viewing changes to src/debugger/gui/TiaInfoWidget.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Mario Iseli
  • Date: 2006-04-08 18:38:25 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 etch)
  • Revision ID: james.westby@ubuntu.com-20060408183825-vu1jk57rk929derx
* New Maintainer (Closes: #361345)
* New upstream release (Closes: #349725)
* Build-Depend now on libslang2-dev (Closes: #325577)
* Complete rebuild of debian/, upgraded to policy-standards
  3.6.2 and compat-level 5.
* Removed stellarc since stella only reads ~/.stellarc and even
  works without a first config.
* New debian/watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//============================================================================
 
2
//
 
3
//   SSSS    tt          lll  lll       
 
4
//  SS  SS   tt           ll   ll        
 
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
 
10
//
 
11
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
 
12
//
 
13
// See the file "license" for information on usage and redistribution of
 
14
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
 
15
//
 
16
// $Id: TiaInfoWidget.cxx,v 1.5 2006/03/23 16:16:32 stephena Exp $
 
17
//
 
18
//   Based on code from ScummVM - Scumm Interpreter
 
19
//   Copyright (C) 2002-2004 The ScummVM project
 
20
//============================================================================
 
21
 
 
22
#include "OSystem.hxx"
 
23
#include "FrameBuffer.hxx"
 
24
#include "Debugger.hxx"
 
25
#include "TIADebug.hxx"
 
26
#include "Widget.hxx"
 
27
#include "EditTextWidget.hxx"
 
28
#include "GuiObject.hxx"
 
29
 
 
30
#include "TiaInfoWidget.hxx"
 
31
 
 
32
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
33
TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font,
 
34
                             int x, int y)
 
35
  : Widget(boss, font, x, y, 16, 16),
 
36
    CommandSender(boss)
 
37
{
 
38
  x += 5;
 
39
  const int lineHeight = font.getLineHeight();
 
40
  int xpos = x, ypos = y, lwidth = font.getStringWidth("F. Cyc:");
 
41
 
 
42
  // Add frame info
 
43
  xpos = x;  ypos = y + 10;
 
44
  new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
 
45
                       "Frame:", kTextAlignLeft);
 
46
  xpos += lwidth;
 
47
  myFrameCount = new EditTextWidget(boss, font, xpos, ypos-2, 45, lineHeight, "");
 
48
  myFrameCount->setEditable(false);
 
49
 
 
50
  xpos = x;  ypos += lineHeight + 5;
 
51
  new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
 
52
                       "F. Cyc:", kTextAlignLeft);
 
53
  xpos += lwidth;
 
54
  myFrameCycles = new EditTextWidget(boss, font, xpos, ypos-2, 45, lineHeight, "");
 
55
  myFrameCycles->setEditable(false);
 
56
 
 
57
  xpos = x + 10;  ypos += lineHeight + 8;
 
58
  myVSync = new CheckboxWidget(boss, font, xpos, ypos-3, "VSync", 0);
 
59
  myVSync->setEditable(false);
 
60
 
 
61
  xpos = x + 10;  ypos += lineHeight + 5;
 
62
  myVBlank = new CheckboxWidget(boss, font, xpos, ypos-3, "VBlank", 0);
 
63
  myVBlank->setEditable(false);
 
64
 
 
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);
 
69
 
 
70
  myScanlineCount = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30,
 
71
                                       lineHeight, "");
 
72
  myScanlineCount->setEditable(false);
 
73
 
 
74
  ypos += lineHeight + 5;
 
75
  new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
 
76
                       "S. Cyc:", kTextAlignLeft);
 
77
 
 
78
  myScanlineCycles = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30,
 
79
                                        lineHeight, "");
 
80
  myScanlineCycles->setEditable(false);
 
81
 
 
82
  ypos += lineHeight + 5;
 
83
  new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
 
84
                       "Pixel Pos:", kTextAlignLeft);
 
85
 
 
86
  myPixelPosition = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30,
 
87
                                       lineHeight, "");
 
88
  myPixelPosition->setEditable(false);
 
89
 
 
90
  ypos += lineHeight + 5;
 
91
  new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
 
92
                       "Color Clk:", kTextAlignLeft);
 
93
 
 
94
  myColorClocks = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30,
 
95
                                     lineHeight, "");
 
96
  myColorClocks->setEditable(false);
 
97
 
 
98
  // Calculate actual dimensions
 
99
  _w = 100 + 30 + lwidth;
 
100
  _h = ypos + lineHeight;
 
101
}
 
102
 
 
103
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
104
TiaInfoWidget::~TiaInfoWidget()
 
105
{
 
106
}
 
107
 
 
108
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
109
void TiaInfoWidget::handleMouseDown(int x, int y, int button, int clickCount)
 
110
{
 
111
cerr << "TiaInfoWidget button press: x = " << x << ", y = " << y << endl;
 
112
}
 
113
 
 
114
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
115
void TiaInfoWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
 
116
{
 
117
}
 
118
 
 
119
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
120
void TiaInfoWidget::loadConfig()
 
121
{
 
122
  Debugger& dbg = instance()->debugger();
 
123
  TIADebug& tia = dbg.tiaDebug();
 
124
 
 
125
  myFrameCount->setEditString(dbg.valueToString(tia.frameCount(), kBASE_10));
 
126
  myFrameCycles->setEditString(dbg.valueToString(dbg.cycles(), kBASE_10));
 
127
 
 
128
  myVSync->setState(tia.vsync());
 
129
  myVBlank->setState(tia.vblank());
 
130
 
 
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));
 
136
}