Fixed some font issues in the debugger and cheatcode dialogs.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1064 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2006-03-23 16:16:33 +00:00
parent 8dbaa8e729
commit 8fa78c60c3
5 changed files with 70 additions and 46 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CheatCodeDialog.cxx,v 1.8 2006-02-22 17:38:03 stephena Exp $ // $Id: CheatCodeDialog.cxx,v 1.9 2006-03-23 16:16:32 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -108,6 +108,9 @@ void CheatCodeDialog::loadConfig()
} }
myCheatList->setList(l, b); myCheatList->setList(l, b);
// Redraw the list, auto-selecting the first item if possible
myCheatList->setSelected(l.size() > 0 ? 0 : -1);
bool enabled = (list.size() > 0); bool enabled = (list.size() > 0);
myEditButton->setEnabled(enabled); myEditButton->setEnabled(enabled);
myRemoveButton->setEnabled(enabled); myRemoveButton->setEnabled(enabled);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: DebuggerDialog.cxx,v 1.12 2006-02-22 17:38:04 stephena Exp $ // $Id: DebuggerDialog.cxx,v 1.13 2006-03-23 16:16:32 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -200,7 +200,7 @@ void DebuggerDialog::addStatusArea()
int xpos, ypos; int xpos, ypos;
xpos = r.left; ypos = r.top; xpos = r.left; ypos = r.top;
myTiaInfo = new TiaInfoWidget(this, instance()->consoleFont(), xpos+20, ypos); myTiaInfo = new TiaInfoWidget(this, instance()->consoleFont(), xpos, ypos);
ypos += myTiaInfo->getHeight() + 10; ypos += myTiaInfo->getHeight() + 10;
myTiaZoom = new TiaZoomWidget(this, instance()->consoleFont(), xpos+10, ypos); myTiaZoom = new TiaZoomWidget(this, instance()->consoleFont(), xpos+10, ypos);
@ -232,16 +232,25 @@ void DebuggerDialog::addRomArea()
DataGridOpsWidget* ops = new DataGridOpsWidget(this, instance()->consoleFont(), DataGridOpsWidget* ops = new DataGridOpsWidget(this, instance()->consoleFont(),
xpos, 20); xpos, 20);
int buttonX = r.right - kButtonWidth - 5, buttonY = r.top + 5; const int bwidth = instance()->consoleFont().getStringWidth("Frame +1 "),
addButton(instance()->consoleFont(), buttonX, buttonY, "Step", kDDStepCmd, 0); bheight = instance()->consoleFont().getLineHeight() + 2;
buttonY += 22; int buttonX = r.right - bwidth - 5, buttonY = r.top + 5;
addButton(instance()->consoleFont(), buttonX, buttonY, "Trace", kDDTraceCmd, 0);
buttonY += 22; new ButtonWidget(this, instance()->consoleFont(), buttonX, buttonY,
addButton(instance()->consoleFont(), buttonX, buttonY, "Scan +1", kDDSAdvCmd, 0); bwidth, bheight, "Step", kDDStepCmd);
buttonY += 22; buttonY += bheight + 4;
addButton(instance()->consoleFont(), buttonX, buttonY, "Frame +1", kDDAdvCmd, 0); new ButtonWidget(this, instance()->consoleFont(), buttonX, buttonY,
buttonY += 22; bwidth, bheight, "Trace", kDDTraceCmd);
addButton(instance()->consoleFont(), buttonX, buttonY, "Exit", kDDExitCmd, 0); buttonY += bheight + 4;
new ButtonWidget(this, instance()->consoleFont(), buttonX, buttonY,
bwidth, bheight, "Scan +1", kDDSAdvCmd);
buttonY += bheight + 4;
new ButtonWidget(this, instance()->consoleFont(), buttonX, buttonY,
bwidth, bheight, "Frame +1", kDDAdvCmd);
buttonY += bheight + 4;
new ButtonWidget(this, instance()->consoleFont(), buttonX, buttonY,
bwidth, bheight, "Exit", kDDExitCmd);
buttonY += bheight + 4;
xpos = r.left + 10; ypos += myRam->getHeight() + 5; xpos = r.left + 10; ypos += myRam->getHeight() + 5;
myRom = new RomWidget(this, instance()->consoleFont(), xpos, ypos); myRom = new RomWidget(this, instance()->consoleFont(), xpos, ypos);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: RamWidget.cxx,v 1.3 2006-02-22 17:38:04 stephena Exp $ // $Id: RamWidget.cxx,v 1.4 2006-03-23 16:16:32 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -52,8 +52,8 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
const int fontWidth = font.getMaxCharWidth(), const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(), fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(), lineHeight = font.getLineHeight(),
bwidth = 44, bwidth = 44,//font.getStringWidth("Undo "),
bheight = 16; bheight = lineHeight + 2;
int xpos, ypos, lwidth; int xpos, ypos, lwidth;
// Create a 16x8 grid holding byte values (16 x 8 = 128 RAM bytes) with labels // Create a 16x8 grid holding byte values (16 x 8 = 128 RAM bytes) with labels
@ -69,24 +69,24 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
"Undo", kUndoCmd, 0); "Undo", kUndoCmd, 0);
myUndoButton->setTarget(this); myUndoButton->setTarget(this);
ypos += bheight + bheight/2; ypos += bheight + 4;
myRevertButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight, myRevertButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Revert", kRevertCmd, 0); "Rev", kRevertCmd, 0);
myRevertButton->setTarget(this); myRevertButton->setTarget(this);
ypos += 2 * bheight + 2; ypos += 2 * bheight + 2;
mySearchButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight, mySearchButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Search", kSearchCmd, 0); "Srch", kSearchCmd, 0);
mySearchButton->setTarget(this); mySearchButton->setTarget(this);
ypos += bheight + bheight/2; ypos += bheight + 4;
myCompareButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight, myCompareButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Compare", kCmpCmd, 0); "Cmp", kCmpCmd, 0);
myCompareButton->setTarget(this); myCompareButton->setTarget(this);
ypos += bheight + bheight/2; ypos += bheight + 4;
myRestartButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight, myRestartButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
"Reset", kRestartCmd, 0); "Rset", kRestartCmd, 0);
myRestartButton->setTarget(this); myRestartButton->setTarget(this);
// Labels for RAM grid // Labels for RAM grid

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: TiaInfoWidget.cxx,v 1.4 2006-02-22 17:38:04 stephena Exp $ // $Id: TiaInfoWidget.cxx,v 1.5 2006-03-23 16:16:32 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -35,8 +35,9 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font,
: Widget(boss, font, x, y, 16, 16), : Widget(boss, font, x, y, 16, 16),
CommandSender(boss) CommandSender(boss)
{ {
x += 5;
const int lineHeight = font.getLineHeight(); const int lineHeight = font.getLineHeight();
int xpos = x, ypos = y, lwidth = 45; int xpos = x, ypos = y, lwidth = font.getStringWidth("F. Cyc:");
// Add frame info // Add frame info
xpos = x; ypos = y + 10; xpos = x; ypos = y + 10;
@ -48,12 +49,12 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font,
xpos = x; ypos += lineHeight + 5; xpos = x; ypos += lineHeight + 5;
new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
"F. Cycles:", kTextAlignLeft); "F. Cyc:", kTextAlignLeft);
xpos += lwidth; xpos += lwidth;
myFrameCycles = new EditTextWidget(boss, font, xpos, ypos-2, 45, lineHeight, ""); myFrameCycles = new EditTextWidget(boss, font, xpos, ypos-2, 45, lineHeight, "");
myFrameCycles->setEditable(false); myFrameCycles->setEditable(false);
xpos = x + 10; ypos += lineHeight + 5; xpos = x + 10; ypos += lineHeight + 8;
myVSync = new CheckboxWidget(boss, font, xpos, ypos-3, "VSync", 0); myVSync = new CheckboxWidget(boss, font, xpos, ypos-3, "VSync", 0);
myVSync->setEditable(false); myVSync->setEditable(false);
@ -61,32 +62,37 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font,
myVBlank = new CheckboxWidget(boss, font, xpos, ypos-3, "VBlank", 0); myVBlank = new CheckboxWidget(boss, font, xpos, ypos-3, "VBlank", 0);
myVBlank->setEditable(false); myVBlank->setEditable(false);
xpos = x + 100; ypos = y + 10; xpos = x + lwidth + myFrameCycles->getWidth() + 5; ypos = y + 10;
lwidth = font.getStringWidth("Pixel Pos:");
new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
"Scanline:", kTextAlignLeft); "Scanline:", kTextAlignLeft);
xpos += lwidth;
myScanlineCount = new EditTextWidget(boss, font, xpos, ypos-2, 30, lineHeight, ""); myScanlineCount = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30,
lineHeight, "");
myScanlineCount->setEditable(false); myScanlineCount->setEditable(false);
xpos = x + 100; ypos += lineHeight + 5; ypos += lineHeight + 5;
new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
"S. Cycles:", kTextAlignLeft); "S. Cyc:", kTextAlignLeft);
xpos += lwidth;
myScanlineCycles = new EditTextWidget(boss, font, xpos, ypos-2, 30, lineHeight, ""); myScanlineCycles = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30,
lineHeight, "");
myScanlineCycles->setEditable(false); myScanlineCycles->setEditable(false);
xpos = x + 100; ypos += lineHeight + 5; ypos += lineHeight + 5;
new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
"Pixel Pos:", kTextAlignLeft); "Pixel Pos:", kTextAlignLeft);
xpos += lwidth;
myPixelPosition = new EditTextWidget(boss, font, xpos, ypos-2, 30, lineHeight, ""); myPixelPosition = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30,
lineHeight, "");
myPixelPosition->setEditable(false); myPixelPosition->setEditable(false);
xpos = x + 100; ypos += lineHeight + 5; ypos += lineHeight + 5;
new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight,
"Color Clk:", kTextAlignLeft); "Color Clk:", kTextAlignLeft);
xpos += lwidth;
myColorClocks = new EditTextWidget(boss, font, xpos, ypos-2, 30, lineHeight, ""); myColorClocks = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30,
lineHeight, "");
myColorClocks->setEditable(false); myColorClocks->setEditable(false);
// Calculate actual dimensions // Calculate actual dimensions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: InputTextDialog.cxx,v 1.11 2006-02-22 17:38:04 stephena Exp $ // $Id: InputTextDialog.cxx,v 1.12 2006-03-23 16:16:33 stephena Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -42,7 +42,9 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
{ {
const int fontWidth = font.getMaxCharWidth(), const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(), fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(); lineHeight = font.getLineHeight(),
bwidth = font.getStringWidth(" Cancel "),
bheight = font.getLineHeight() + 2;
unsigned int xpos, ypos, i, lwidth = 0, maxIdx = 0; unsigned int xpos, ypos, i, lwidth = 0, maxIdx = 0;
// Calculate real dimensions // Calculate real dimensions
@ -86,11 +88,15 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
myTitle->setColor(kTextColorEm); myTitle->setColor(kTextColorEm);
#ifndef MAC_OSX #ifndef MAC_OSX
addButton(font, _w - 2 * (kButtonWidth + 10), _h - 24, "OK", kAcceptCmd, 0); new ButtonWidget(this, font, _w - 2 * (bwidth + 10), _h - bheight - 10,
addButton(font, _w - (kButtonWidth+10), _h - 24, "Cancel", kCloseCmd, 0); bwidth, bheight, "OK", kAcceptCmd, 0);
new ButtonWidget(this, font, _w - (bwidth + 10), _h - bheight - 10,
bwidth, bheight, "Cancel", kCloseCmd, 0);
#else #else
addButton(font, _w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); new ButtonWidget(this, font, _w - 2 * (bwidth + 10), _h - bheight - 10,
addButton(font, _w - (kButtonWidth+10), _h - 24, "OK", kAcceptCmd, 0); bwidth, bheight, "Cancel", kCloseCmd, 0);
new ButtonWidget(this, font, _w - (bwidth + 10), _h - bheight - 10,
bwidth, bheight, "OK", kAcceptCmd, 0);
#endif #endif
} }