From 8fa78c60c36ed6e3d1075cd140e43fcda9769274 Mon Sep 17 00:00:00 2001 From: stephena Date: Thu, 23 Mar 2006 16:16:33 +0000 Subject: [PATCH] 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 --- stella/src/cheat/CheatCodeDialog.cxx | 5 ++- stella/src/debugger/gui/DebuggerDialog.cxx | 33 +++++++++++------- stella/src/debugger/gui/RamWidget.cxx | 20 +++++------ stella/src/debugger/gui/TiaInfoWidget.cxx | 40 +++++++++++++--------- stella/src/gui/InputTextDialog.cxx | 18 ++++++---- 5 files changed, 70 insertions(+), 46 deletions(-) diff --git a/stella/src/cheat/CheatCodeDialog.cxx b/stella/src/cheat/CheatCodeDialog.cxx index 5b1be4970..034322f3c 100644 --- a/stella/src/cheat/CheatCodeDialog.cxx +++ b/stella/src/cheat/CheatCodeDialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // 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 // Copyright (C) 2002-2004 The ScummVM project @@ -108,6 +108,9 @@ void CheatCodeDialog::loadConfig() } 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); myEditButton->setEnabled(enabled); myRemoveButton->setEnabled(enabled); diff --git a/stella/src/debugger/gui/DebuggerDialog.cxx b/stella/src/debugger/gui/DebuggerDialog.cxx index 2d751b0a9..8a0143e62 100644 --- a/stella/src/debugger/gui/DebuggerDialog.cxx +++ b/stella/src/debugger/gui/DebuggerDialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // 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 // Copyright (C) 2002-2004 The ScummVM project @@ -200,7 +200,7 @@ void DebuggerDialog::addStatusArea() int xpos, ypos; 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; myTiaZoom = new TiaZoomWidget(this, instance()->consoleFont(), xpos+10, ypos); @@ -232,16 +232,25 @@ void DebuggerDialog::addRomArea() DataGridOpsWidget* ops = new DataGridOpsWidget(this, instance()->consoleFont(), xpos, 20); - int buttonX = r.right - kButtonWidth - 5, buttonY = r.top + 5; - addButton(instance()->consoleFont(), buttonX, buttonY, "Step", kDDStepCmd, 0); - buttonY += 22; - addButton(instance()->consoleFont(), buttonX, buttonY, "Trace", kDDTraceCmd, 0); - buttonY += 22; - addButton(instance()->consoleFont(), buttonX, buttonY, "Scan +1", kDDSAdvCmd, 0); - buttonY += 22; - addButton(instance()->consoleFont(), buttonX, buttonY, "Frame +1", kDDAdvCmd, 0); - buttonY += 22; - addButton(instance()->consoleFont(), buttonX, buttonY, "Exit", kDDExitCmd, 0); + const int bwidth = instance()->consoleFont().getStringWidth("Frame +1 "), + bheight = instance()->consoleFont().getLineHeight() + 2; + int buttonX = r.right - bwidth - 5, buttonY = r.top + 5; + + new ButtonWidget(this, instance()->consoleFont(), buttonX, buttonY, + bwidth, bheight, "Step", kDDStepCmd); + buttonY += bheight + 4; + new ButtonWidget(this, instance()->consoleFont(), buttonX, buttonY, + bwidth, bheight, "Trace", kDDTraceCmd); + 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; myRom = new RomWidget(this, instance()->consoleFont(), xpos, ypos); diff --git a/stella/src/debugger/gui/RamWidget.cxx b/stella/src/debugger/gui/RamWidget.cxx index 07439d2d5..534ce2c71 100644 --- a/stella/src/debugger/gui/RamWidget.cxx +++ b/stella/src/debugger/gui/RamWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // 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 // 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(), fontHeight = font.getFontHeight(), lineHeight = font.getLineHeight(), - bwidth = 44, - bheight = 16; + bwidth = 44,//font.getStringWidth("Undo "), + bheight = lineHeight + 2; int xpos, ypos, lwidth; // 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); myUndoButton->setTarget(this); - ypos += bheight + bheight/2; + ypos += bheight + 4; myRevertButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight, - "Revert", kRevertCmd, 0); + "Rev", kRevertCmd, 0); myRevertButton->setTarget(this); ypos += 2 * bheight + 2; mySearchButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight, - "Search", kSearchCmd, 0); + "Srch", kSearchCmd, 0); mySearchButton->setTarget(this); - ypos += bheight + bheight/2; + ypos += bheight + 4; myCompareButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight, - "Compare", kCmpCmd, 0); + "Cmp", kCmpCmd, 0); myCompareButton->setTarget(this); - ypos += bheight + bheight/2; + ypos += bheight + 4; myRestartButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight, - "Reset", kRestartCmd, 0); + "Rset", kRestartCmd, 0); myRestartButton->setTarget(this); // Labels for RAM grid diff --git a/stella/src/debugger/gui/TiaInfoWidget.cxx b/stella/src/debugger/gui/TiaInfoWidget.cxx index 10b043014..12c8ab7c1 100644 --- a/stella/src/debugger/gui/TiaInfoWidget.cxx +++ b/stella/src/debugger/gui/TiaInfoWidget.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // 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 // 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), CommandSender(boss) { + x += 5; 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 xpos = x; ypos = y + 10; @@ -48,12 +49,12 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font, xpos = x; ypos += lineHeight + 5; new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, - "F. Cycles:", kTextAlignLeft); + "F. Cyc:", kTextAlignLeft); xpos += lwidth; myFrameCycles = new EditTextWidget(boss, font, xpos, ypos-2, 45, lineHeight, ""); 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->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->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, "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); - xpos = x + 100; ypos += lineHeight + 5; + ypos += lineHeight + 5; new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, - "S. Cycles:", kTextAlignLeft); - xpos += lwidth; - myScanlineCycles = new EditTextWidget(boss, font, xpos, ypos-2, 30, lineHeight, ""); + "S. Cyc:", kTextAlignLeft); + + myScanlineCycles = new EditTextWidget(boss, font, xpos+lwidth, ypos-2, 30, + lineHeight, ""); myScanlineCycles->setEditable(false); - xpos = x + 100; ypos += lineHeight + 5; + ypos += lineHeight + 5; new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, "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); - xpos = x + 100; ypos += lineHeight + 5; + ypos += lineHeight + 5; new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, "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); // Calculate actual dimensions diff --git a/stella/src/gui/InputTextDialog.cxx b/stella/src/gui/InputTextDialog.cxx index 276799a19..f273ab603 100644 --- a/stella/src/gui/InputTextDialog.cxx +++ b/stella/src/gui/InputTextDialog.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // 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 // Copyright (C) 2002-2004 The ScummVM project @@ -42,7 +42,9 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font, { const int fontWidth = font.getMaxCharWidth(), 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; // Calculate real dimensions @@ -86,11 +88,15 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font, myTitle->setColor(kTextColorEm); #ifndef MAC_OSX - addButton(font, _w - 2 * (kButtonWidth + 10), _h - 24, "OK", kAcceptCmd, 0); - addButton(font, _w - (kButtonWidth+10), _h - 24, "Cancel", kCloseCmd, 0); + new ButtonWidget(this, font, _w - 2 * (bwidth + 10), _h - bheight - 10, + bwidth, bheight, "OK", kAcceptCmd, 0); + new ButtonWidget(this, font, _w - (bwidth + 10), _h - bheight - 10, + bwidth, bheight, "Cancel", kCloseCmd, 0); #else - addButton(font, _w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); - addButton(font, _w - (kButtonWidth+10), _h - 24, "OK", kAcceptCmd, 0); + new ButtonWidget(this, font, _w - 2 * (bwidth + 10), _h - bheight - 10, + bwidth, bheight, "Cancel", kCloseCmd, 0); + new ButtonWidget(this, font, _w - (bwidth + 10), _h - bheight - 10, + bwidth, bheight, "OK", kAcceptCmd, 0); #endif }