From 28b80d93cffeba733b53e24fbb89a44bba5819a2 Mon Sep 17 00:00:00 2001 From: stephena Date: Tue, 20 Aug 2013 15:23:07 +0000 Subject: [PATCH] The TIA info area of the debugger is now font-sensitive. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2804 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/debugger/gui/DebuggerDialog.cxx | 2 +- src/debugger/gui/TiaInfoWidget.cxx | 41 +++++++++++++++++------------ src/debugger/gui/TiaInfoWidget.hxx | 2 +- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index d681e4d9c..6587427ae 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -290,7 +290,7 @@ void DebuggerDialog::addStatusArea() int xpos, ypos; xpos = r.left; ypos = r.top; - myTiaInfo = new TiaInfoWidget(this, *myFont, xpos, ypos); + myTiaInfo = new TiaInfoWidget(this, *myFont, xpos, ypos, r.width()); ypos += myTiaInfo->getHeight() + 10; myTiaZoom = new TiaZoomWidget(this, *myFont, xpos+10, ypos, diff --git a/src/debugger/gui/TiaInfoWidget.cxx b/src/debugger/gui/TiaInfoWidget.cxx index 00e4205be..1c61a0a48 100644 --- a/src/debugger/gui/TiaInfoWidget.cxx +++ b/src/debugger/gui/TiaInfoWidget.cxx @@ -30,51 +30,58 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font, - int x, int y) + int x, int y, int max_w) : Widget(boss, font, x, y, 16, 16), CommandSender(boss) { + bool longstr = 34 * font.getMaxCharWidth() <= max_w; + x += 5; const int lineHeight = font.getLineHeight(); - int xpos = x, ypos = y, lwidth = font.getStringWidth("F. Cyc:"); + int xpos = x, ypos = y; + int lwidth = font.getStringWidth(longstr ? "Frame Cycle:" : "F. Cycle:"); + int fwidth = 5 * font.getMaxCharWidth() + 4; // Add frame info xpos = x; ypos = y + 10; new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, - "Frame:", kTextAlignLeft); + longstr ? "Frame Count:" : "Frame:", + kTextAlignLeft); xpos += lwidth; - myFrameCount = new EditTextWidget(boss, font, xpos, ypos-1, 45, lineHeight, ""); + myFrameCount = new EditTextWidget(boss, font, xpos, ypos-1, fwidth, lineHeight, ""); myFrameCount->setEditable(false); xpos = x; ypos += lineHeight + 5; new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, - "F. Cyc:", kTextAlignLeft); + longstr ? "Frame Cycle:" : "F. Cycle:", + kTextAlignLeft); xpos += lwidth; - myFrameCycles = new EditTextWidget(boss, font, xpos, ypos-1, 45, lineHeight, ""); + myFrameCycles = new EditTextWidget(boss, font, xpos, ypos-1, fwidth, lineHeight, ""); myFrameCycles->setEditable(false); - xpos = x + 10; ypos += lineHeight + 8; + xpos = x + 20; ypos += lineHeight + 8; myVSync = new CheckboxWidget(boss, font, xpos, ypos-3, "VSync", 0); myVSync->setEditable(false); - xpos = x + 10; ypos += lineHeight + 5; + xpos = x + 20; ypos += lineHeight + 5; myVBlank = new CheckboxWidget(boss, font, xpos, ypos-3, "VBlank", 0); myVBlank->setEditable(false); - xpos = x + lwidth + myFrameCycles->getWidth() + 5; ypos = y + 10; - lwidth = font.getStringWidth("Pixel Pos:"); + xpos = x + lwidth + myFrameCycles->getWidth() + 8; ypos = y + 10; + lwidth = font.getStringWidth(longstr ? "Color Clock:" : "Pixel Pos:"); + fwidth = 3 * font.getMaxCharWidth() + 4; new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, "Scanline:", kTextAlignLeft); - myScanlineCount = new EditTextWidget(boss, font, xpos+lwidth, ypos-1, 30, + myScanlineCount = new EditTextWidget(boss, font, xpos+lwidth, ypos-1, fwidth, lineHeight, ""); myScanlineCount->setEditable(false); ypos += lineHeight + 5; new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, - "S. Cyc:", kTextAlignLeft); + longstr ? "Scan Cycle:" : "S. Cycle:", kTextAlignLeft); - myScanlineCycles = new EditTextWidget(boss, font, xpos+lwidth, ypos-1, 30, + myScanlineCycles = new EditTextWidget(boss, font, xpos+lwidth, ypos-1, fwidth, lineHeight, ""); myScanlineCycles->setEditable(false); @@ -82,20 +89,20 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& font, new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, "Pixel Pos:", kTextAlignLeft); - myPixelPosition = new EditTextWidget(boss, font, xpos+lwidth, ypos-1, 30, + myPixelPosition = new EditTextWidget(boss, font, xpos+lwidth, ypos-1, fwidth, lineHeight, ""); myPixelPosition->setEditable(false); ypos += lineHeight + 5; new StaticTextWidget(boss, font, xpos, ypos, lwidth, lineHeight, - "Color Clk:", kTextAlignLeft); + longstr ? "Color Clock:" : "Color Clk:", kTextAlignLeft); - myColorClocks = new EditTextWidget(boss, font, xpos+lwidth, ypos-1, 30, + myColorClocks = new EditTextWidget(boss, font, xpos+lwidth, ypos-1, fwidth, lineHeight, ""); myColorClocks->setEditable(false); // Calculate actual dimensions - _w = 100 + 30 + lwidth; + _w = myColorClocks->getAbsX() + myColorClocks->getWidth() - x; _h = ypos + lineHeight; } diff --git a/src/debugger/gui/TiaInfoWidget.hxx b/src/debugger/gui/TiaInfoWidget.hxx index d9013253c..88e1a445c 100644 --- a/src/debugger/gui/TiaInfoWidget.hxx +++ b/src/debugger/gui/TiaInfoWidget.hxx @@ -30,7 +30,7 @@ class EditTextWidget; class TiaInfoWidget : public Widget, public CommandSender { public: - TiaInfoWidget(GuiObject *boss, const GUI::Font& font, int x, int y); + TiaInfoWidget(GuiObject *boss, const GUI::Font& font, int x, int y, int max_w); virtual ~TiaInfoWidget(); void loadConfig();