From 29167a2e87d9eee0e76e503c56057bb70b4bf4e6 Mon Sep 17 00:00:00 2001 From: stephena Date: Mon, 19 Aug 2013 15:23:33 +0000 Subject: [PATCH] When using different font sizes in the debugger, the TIA display / tab area and RAM area now take advantage of extra space. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2798 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/debugger/gui/DebuggerDialog.cxx | 36 +++++-------------------- src/debugger/gui/DebuggerDialog.hxx | 1 - src/debugger/gui/RamWidget.cxx | 42 ++++++++++++++++------------- 3 files changed, 30 insertions(+), 49 deletions(-) diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index 7174d2db7..a90988f83 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -57,7 +57,7 @@ DebuggerDialog::DebuggerDialog(OSystem* osystem, DialogContainer* parent, addStatusArea(); addRomArea(); - // Inform the output widget about its associated zoom widget + // Inform the TIA output widget about its associated zoom widget myTiaOutput->setZoomWidget(myTiaZoom); } @@ -215,12 +215,10 @@ void DebuggerDialog::createFont() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DebuggerDialog::showFatalMessage(const string& msg) { - const GUI::Rect& r = getDialogBounds(); - delete myFatalError; myFatalError = new GUI::MessageBox(this, *myFont, msg, - r.width(), r.height(), kDDExitFatalCmd, + _w*0.5, _h*0.5, kDDExitFatalCmd, "Exit ROM", "Continue"); myFatalError->show(); } @@ -397,19 +395,11 @@ void DebuggerDialog::addRomArea() myRomTab->setActiveTab(0); } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GUI::Rect DebuggerDialog::getDialogBounds() const -{ - // The dialog bounds are the actual size of the entire dialog container - GUI::Rect r(0, 0, _w, _h); - return r; -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GUI::Rect DebuggerDialog::getTiaBounds() const { // The area showing the TIA image (NTSC and PAL supported, up to 260 lines) - GUI::Rect r(0, 0, 320, 260); + GUI::Rect r(0, 0, 320, BSPF_max(260, (int)(_h * 0.35))); return r; } @@ -417,14 +407,8 @@ GUI::Rect DebuggerDialog::getTiaBounds() const GUI::Rect DebuggerDialog::getRomBounds() const { // The ROM area is the full area to the right of the tabs - const GUI::Rect& dialog = getDialogBounds(); const GUI::Rect& status = getStatusBounds(); - - int x1 = status.right + 1; - int y1 = 0; - int x2 = dialog.right; - int y2 = dialog.bottom; - GUI::Rect r(x1, y1, x2, y2); + GUI::Rect r(status.right + 1, 0, _w, _h); return r; } @@ -435,13 +419,11 @@ GUI::Rect DebuggerDialog::getStatusBounds() const // The status area is the full area to the right of the TIA image // extending as far as necessary // 30% of any space above 1030 pixels will be allocated to this area - const GUI::Rect& dlg = getDialogBounds(); const GUI::Rect& tia = getTiaBounds(); int x1 = tia.right + 1; int y1 = 0; - int x2 = tia.right + 225 + (dlg.width() > 1030 ? - (int) (0.35 * (dlg.width() - 1030)) : 0); + int x2 = tia.right + 225 + (_w > 1030 ? (int) (0.35 * (_w - 1030)) : 0); int y2 = tia.bottom; GUI::Rect r(x1, y1, x2, y2); @@ -452,15 +434,9 @@ GUI::Rect DebuggerDialog::getStatusBounds() const GUI::Rect DebuggerDialog::getTabBounds() const { // The tab area is the full area below the TIA image - const GUI::Rect& dialog = getDialogBounds(); const GUI::Rect& tia = getTiaBounds(); const GUI::Rect& status = getStatusBounds(); - - int x1 = 0; - int y1 = tia.bottom + 1; - int x2 = status.right + 1; - int y2 = dialog.bottom; - GUI::Rect r(x1, y1, x2, y2); + GUI::Rect r(0, tia.bottom + 1, status.right + 1, _h); return r; } diff --git a/src/debugger/gui/DebuggerDialog.hxx b/src/debugger/gui/DebuggerDialog.hxx index a9aae7fe6..616948a07 100644 --- a/src/debugger/gui/DebuggerDialog.hxx +++ b/src/debugger/gui/DebuggerDialog.hxx @@ -83,7 +83,6 @@ class DebuggerDialog : public Dialog void addStatusArea(); void addRomArea(); - GUI::Rect getDialogBounds() const; GUI::Rect getTiaBounds() const; GUI::Rect getRomBounds() const; GUI::Rect getStatusBounds() const; diff --git a/src/debugger/gui/RamWidget.cxx b/src/debugger/gui/RamWidget.cxx index 8cafc46c0..2197c24a5 100644 --- a/src/debugger/gui/RamWidget.cxx +++ b/src/debugger/gui/RamWidget.cxx @@ -79,6 +79,9 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y) "Reset", kRestartCmd); myRestartButton->setTarget(this); + // Remember position of right side of buttons + int xpos_r = xpos + bwidth ; + // Labels for RAM grid xpos = x; ypos = y + lineHeight; myRamStart = @@ -101,31 +104,34 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y) 3*fontWidth, fontHeight, "", kTextAlignLeft); } - xpos = x + 10; ypos += 9 * lineHeight; + ypos += 9 * lineHeight; + + // We need to define these widgets from right to left since the leftmost + // one resizes as much as possible + xpos = xpos_r - 13*fontWidth - 5; + new StaticTextWidget(boss, font, xpos, ypos, 4*fontWidth, fontHeight, + "Bin:", kTextAlignLeft); + myBinValue = new EditTextWidget(boss, font, xpos + 4*fontWidth + 5, + ypos-2, 9*fontWidth, lineHeight, ""); + myBinValue->setEditable(false); + + xpos -= 8*fontWidth + 5 + 20; + new StaticTextWidget(boss, font, xpos, ypos, 4*fontWidth, fontHeight, + "Dec:", kTextAlignLeft); + myDecValue = new EditTextWidget(boss, font, xpos + 4*fontWidth + 5, ypos-2, + 4*fontWidth, lineHeight, ""); + myDecValue->setEditable(false); + + xpos_r = xpos - 20; + xpos = x + 10; new StaticTextWidget(boss, font, xpos, ypos, 6*fontWidth, fontHeight, "Label:", kTextAlignLeft); xpos += 6*fontWidth + 5; - myLabel = new EditTextWidget(boss, font, xpos, ypos-2, 17*fontWidth, + myLabel = new EditTextWidget(boss, font, xpos, ypos-2, xpos_r-xpos, lineHeight, ""); myLabel->setEditable(false); - xpos += 17*fontWidth + 20; - new StaticTextWidget(boss, font, xpos, ypos, 4*fontWidth, fontHeight, - "Dec:", kTextAlignLeft); - xpos += 4*fontWidth + 5; - myDecValue = new EditTextWidget(boss, font, xpos, ypos-2, 4*fontWidth, - lineHeight, ""); - myDecValue->setEditable(false); - - xpos += 4*fontWidth + 20; - new StaticTextWidget(boss, font, xpos, ypos, 4*fontWidth, fontHeight, - "Bin:", kTextAlignLeft); - xpos += 4*fontWidth + 5; - myBinValue = new EditTextWidget(boss, font, xpos, ypos-2, 9*fontWidth, - lineHeight, ""); - myBinValue->setEditable(false); - // Calculate real dimensions _w = lwidth + myRamGrid->getWidth(); _h = ypos + lineHeight - y;