diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 8b88c45ae..954e9c923 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -319,7 +319,7 @@ bool CartDebug::fillDisassemblyList(BankInfo& info, uInt16 search) return false; myDisassembly.list.clear(); - myDisassembly.fieldwidth = 14 + myLabelLength; + myDisassembly.fieldwidth = 24 + myLabelLength; DiStella distella(*this, myDisassembly.list, info, DiStella::settings, myDisLabels, myDisDirectives, myReserved); diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index 2c4417a1b..8f30cfc06 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -227,59 +227,57 @@ void DebuggerDialog::doExitRom() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DebuggerDialog::createFont() { - int fontstyle = instance().settings().getInt("dbg.fontstyle"); + string fontSize = instance().settings().getString("dbg.fontsize"); + int fontStyle = instance().settings().getInt("dbg.fontstyle"); - // For now, these sizes are hardcoded based on actual font size - if(_w >= kLargeFontMinW && _h >= kLargeFontMinH) + if(fontSize == "large") { - // Large font doesn't use fontstyle at all + // Large font doesn't use fontStyle at all myLFont = make_unique(GUI::stellaMediumDesc); myNFont = make_unique(GUI::stellaMediumDesc); } - else if(_w >= kMediumFontMinW && _h >= kMediumFontMinH) - { - if(fontstyle == 1) + else if(fontSize == "medium") { - myLFont = make_unique(GUI::consoleMediumBDesc); - myNFont = make_unique(GUI::consoleMediumDesc); + switch(fontStyle) + { + case 1: + myLFont = make_unique(GUI::consoleMediumBDesc); + myNFont = make_unique(GUI::consoleMediumDesc); + break; + case 2: + myLFont = make_unique(GUI::consoleMediumDesc); + myNFont = make_unique(GUI::consoleMediumBDesc); + break; + case 3: + myLFont = make_unique(GUI::consoleMediumBDesc); + myNFont = make_unique(GUI::consoleMediumBDesc); + break; + default: // default to zero + myLFont = make_unique(GUI::consoleMediumDesc); + myNFont = make_unique(GUI::consoleMediumDesc); + break; + }; } - else if(fontstyle == 2) - { - myLFont = make_unique(GUI::consoleMediumDesc); - myNFont = make_unique(GUI::consoleMediumBDesc); - } - else if(fontstyle == 3) - { - myLFont = make_unique(GUI::consoleMediumBDesc); - myNFont = make_unique(GUI::consoleMediumBDesc); - } - else // default to zero - { - myLFont = make_unique(GUI::consoleMediumDesc); - myNFont = make_unique(GUI::consoleMediumDesc); - } - } else { - if(fontstyle == 1) + switch(fontStyle) { - myLFont = make_unique(GUI::consoleBDesc); - myNFont = make_unique(GUI::consoleDesc); - } - else if(fontstyle == 2) - { - myLFont = make_unique(GUI::consoleDesc); - myNFont = make_unique(GUI::consoleBDesc); - } - else if(fontstyle == 3) - { - myLFont = make_unique(GUI::consoleBDesc); - myNFont = make_unique(GUI::consoleBDesc); - } - else // default to zero - { - myLFont = make_unique(GUI::consoleDesc); - myNFont = make_unique(GUI::consoleDesc); + case 1: + myLFont = make_unique(GUI::consoleBDesc); + myNFont = make_unique(GUI::consoleDesc); + break; + case 2: + myLFont = make_unique(GUI::consoleDesc); + myNFont = make_unique(GUI::consoleBDesc); + break; + case 3: + myLFont = make_unique(GUI::consoleBDesc); + myNFont = make_unique(GUI::consoleBDesc); + break; + default: // default to zero + myLFont = make_unique(GUI::consoleDesc); + myNFont = make_unique(GUI::consoleDesc); + break; } } } diff --git a/src/debugger/gui/DebuggerDialog.hxx b/src/debugger/gui/DebuggerDialog.hxx index 315fc93f5..c06c5131c 100644 --- a/src/debugger/gui/DebuggerDialog.hxx +++ b/src/debugger/gui/DebuggerDialog.hxx @@ -47,9 +47,9 @@ class DebuggerDialog : public Dialog { public: enum { - kSmallFontMinW = 1080, kSmallFontMinH = 720, - kMediumFontMinW = 1280, kMediumFontMinH = 860, - kLargeFontMinW = 1300, kLargeFontMinH = 980 + kSmallFontMinW = 1070, kSmallFontMinH = 720, + kMediumFontMinW = 1150, kMediumFontMinH = 770, + kLargeFontMinW = 1150, kLargeFontMinH = 870 }; DebuggerDialog(OSystem& osystem, DialogContainer& parent, diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index 09c4889e0..314679d89 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -66,8 +66,8 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont, const int fontWidth = lfont.getMaxCharWidth(), numchars = w / fontWidth; - _labelWidth = std::max(14, int(0.35 * (numchars - 18))) * fontWidth - 1; - _bytesWidth = 12 * fontWidth; + _labelWidth = std::max(14, int(0.40 * (numchars - 18))) * fontWidth - 1; + _bytesWidth = 9 * fontWidth; /////////////////////////////////////////////////////// // Add checkboxes diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index ac53b25fd..eeb753a84 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -136,6 +136,7 @@ Settings::Settings(OSystem& osystem) #ifdef DEBUGGER_SUPPORT // Debugger/disassembly options + setInternal("dbg.fontsize", "medium"); setInternal("dbg.fontstyle", "0"); setInternal("dbg.uhex", "true"); setInternal("dis.resolve", "true"); @@ -337,6 +338,10 @@ void Settings::validate() if(s != "small" && s != "medium" && s != "large") setInternal("launcherfont", "medium"); + s = getString("dbg.fontsize"); + if(s != "small" && s != "medium" && s != "large") + setInternal("dbg.fontsize", "medium"); + i = getInt("romviewer"); if(i < 0) setInternal("romviewer", "0"); else if(i > 2) setInternal("romviewer", "2"); @@ -469,10 +474,12 @@ void Settings::usage() const << " -dis.showaddr <1|0> Show opcode addresses in disassembler\n" << " -dis.relocate <1|0> Relocate calls out of address range in disassembler\n" << endl - << " -dbg.res The resolution to use in debugger mode\n" - << " -dbg.fontstyle <0-3> Font style to use in debugger window (bold vs. normal)\n" - << " -break
Set a breakpoint at 'address'\n" - << " -debug Start in debugger mode\n" + << " -dbg.res The resolution to use in debugger mode\n" + << " -dbg.fontsize \n" + << " -dbg.fontstyle <0-3> Font style to use in debugger window (bold vs. normal)\n" + << " -break
Set a breakpoint at 'address'\n" + << " -debug Start in debugger mode\n" << endl << " -bs Sets the 'Cartridge.Type' (bankswitch) property\n" << " -type Same as using -bs\n" diff --git a/src/gui/DeveloperDialog.cxx b/src/gui/DeveloperDialog.cxx index eb583e350..60a9c8a51 100644 --- a/src/gui/DeveloperDialog.cxx +++ b/src/gui/DeveloperDialog.cxx @@ -245,12 +245,40 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font) ButtonWidget* b; const GUI::Size& ds = instance().frameBuffer().desktopSize(); - lwidth = font.getStringWidth("Debugger Height "); xpos = HBORDER; ypos = VBORDER; + // font size + items.clear(); + VarList::push_back(items, "Small", "small"); + VarList::push_back(items, "Medium", "medium"); + VarList::push_back(items, "Large", "large"); + lwidth = font.getStringWidth("Font Style "); + pwidth = font.getStringWidth("Medium"); + myDebuggerFontSize = + new PopUpWidget(myTab, font, HBORDER, ypos + 1, pwidth, lineHeight, items, + "Font Size ", lwidth, kDFontSizeChanged); + wid.push_back(myDebuggerFontSize); + ypos += lineHeight + 4; + + // Font style (bold label vs. text, etc) + pwidth = font.getStringWidth("Bold non-labels only"); + items.clear(); + VarList::push_back(items, "All Normal font", "0"); + VarList::push_back(items, "Bold labels only", "1"); + VarList::push_back(items, "Bold non-labels only", "2"); + VarList::push_back(items, "All Bold font", "3"); + myDebuggerFontStyle = + new PopUpWidget(myTab, font, HBORDER, ypos + 1, pwidth, lineHeight, items, + "Font Style ", lwidth); + wid.push_back(myDebuggerFontStyle); + + ypos += lineHeight + VGAP * 4; + + lwidth = font.getStringWidth("Debugger Height "); + pwidth = font.getStringWidth("0123456789"); // Debugger width and height - myDebuggerWidthSlider = new SliderWidget(myTab, font, xpos, ypos, pwidth, + myDebuggerWidthSlider = new SliderWidget(myTab, font, xpos, ypos-1, pwidth, lineHeight, "Debugger Width ", lwidth, kDWidthChanged); myDebuggerWidthSlider->setMinValue(DebuggerDialog::kSmallFontMinW); @@ -264,7 +292,7 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font) myDebuggerWidthLabel->setFlags(WIDGET_CLEARBG); ypos += lineHeight + VGAP; - myDebuggerHeightSlider = new SliderWidget(myTab, font, xpos, ypos, pwidth, + myDebuggerHeightSlider = new SliderWidget(myTab, font, xpos, ypos-1, pwidth, lineHeight, "Debugger Height ", lwidth, kDHeightChanged); myDebuggerHeightSlider->setMinValue(DebuggerDialog::kSmallFontMinH); @@ -277,47 +305,7 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font) ypos + 1, 4 * fontWidth, fontHeight, "", kTextAlignLeft); myDebuggerHeightLabel->setFlags(WIDGET_CLEARBG); - // Add minimum window size buttons for different fonts - ypos += lineHeight + VGAP * 2; - StaticTextWidget* t = new StaticTextWidget(myTab, font, HBORDER, ypos + 3, "Select"); - - int fbwidth = font.getStringWidth("Medium font") + 20; - //xpos = (_w - fbwidth - 2 * VBORDER) / 2; ypos += 2 * lineHeight + 4; - xpos = t->getRight() + 8; - b = new ButtonWidget(myTab, font, xpos, ypos, fbwidth, buttonHeight, - "Small font", kDSmallSize); - - StaticTextWidget* t1 = new StaticTextWidget(myTab, font, b->getRight()+8, ypos + 3, "and reset debugger size"); - wid.push_back(t1); - - wid.push_back(b); - ypos += b->getHeight() + VGAP; - b = new ButtonWidget(myTab, font, xpos, ypos, fbwidth, buttonHeight, - "Medium font", kDMediumSize); - wid.push_back(b); - ypos += b->getHeight() + VGAP; - b = new ButtonWidget(myTab, font, xpos, ypos, fbwidth, buttonHeight, - "Large font", kDLargeSize); - wid.push_back(b); - ypos += b->getHeight() + VGAP * 4; - - // Font style (bold label vs. text, etc) - lwidth = font.getStringWidth("Font Style "); - pwidth = font.getStringWidth("Bold non-labels only"); - xpos = VBORDER; - items.clear(); - VarList::push_back(items, "All Normal font", "0"); - VarList::push_back(items, "Bold labels only", "1"); - VarList::push_back(items, "Bold non-labels only", "2"); - VarList::push_back(items, "All Bold font", "3"); - myDebuggerFontStyle = - new PopUpWidget(myTab, font, HBORDER, ypos + 1, pwidth, lineHeight, items, - "Font Style ", lwidth); - wid.push_back(myDebuggerFontStyle); - - ypos += b->getHeight() + VGAP * 4; - t = new StaticTextWidget(myTab, font, HBORDER, _h - lineHeight*5, "(*) Changes require application restart"); - wid.push_back(t); + StaticTextWidget* t = new StaticTextWidget(myTab, font, HBORDER, _h - lineHeight * 5, "(*) Changes require application restart"); // Debugger is only realistically available in windowed modes 800x600 or greater // (and when it's actually been compiled into the app) @@ -342,8 +330,6 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font) "Debugger support not included", kTextAlignCenter); #endif - - addToFocusList(wid, myTab, tabID); } @@ -405,31 +391,32 @@ void DeveloperDialog::loadConfig() // Debugger size const GUI::Size& ds = instance().settings().getSize("dbg.res"); w = ds.w; h = ds.h; - w = std::max(w, uInt32(DebuggerDialog::kSmallFontMinW)); - h = std::max(h, uInt32(DebuggerDialog::kSmallFontMinH)); - w = std::min(w, ds.w); - h = std::min(h, ds.h); myDebuggerWidthSlider->setValue(w); myDebuggerWidthLabel->setValue(w); myDebuggerHeightSlider->setValue(h); myDebuggerHeightLabel->setValue(h); + // Debugger font size + string size = instance().settings().getString("dbg.fontsize"); + myDebuggerFontSize->setSelected(size, "medium"); + // Debugger font style int style = instance().settings().getInt("dbg.fontstyle"); myDebuggerFontStyle->setSelected(style, "0"); + + handleFontSize(); #endif myTab->loadConfig(); + handleFontSize(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DeveloperDialog::saveConfig() { //TODO - // - bankrandom (not implemented yet) // - thumbexception (commandline only yet) - // - remove settings from within debugger bool devSettings = myDevSettings0->getState(); instance().settings().setValue("dev.settings", devSettings); @@ -488,6 +475,9 @@ void DeveloperDialog::saveConfig() GUI::Size(myDebuggerWidthSlider->getValue(), myDebuggerHeightSlider->getValue())); + // Debugger font size + instance().settings().setValue("dbg.fontsize", myDebuggerFontSize->getSelectedTag().toString()); + // Debugger font style instance().settings().setValue("dbg.fontstyle", myDebuggerFontStyle->getSelectedTag().toString()); @@ -535,7 +525,9 @@ void DeveloperDialog::setDefaults() myDebuggerWidthLabel->setValue(w); myDebuggerHeightSlider->setValue(h); myDebuggerHeightLabel->setValue(h); + myDebuggerFontSize->setSelected("medium"); myDebuggerFontStyle->setSelected("0"); + handleFontSize(); #endif break; } @@ -584,25 +576,8 @@ void DeveloperDialog::handleCommand(CommandSender* sender, int cmd, int data, in myDebuggerHeightLabel->setValue(myDebuggerHeightSlider->getValue()); break; - case kDSmallSize: - myDebuggerWidthSlider->setValue(DebuggerDialog::kSmallFontMinW); - myDebuggerWidthLabel->setValue(DebuggerDialog::kSmallFontMinW); - myDebuggerHeightSlider->setValue(DebuggerDialog::kSmallFontMinH); - myDebuggerHeightLabel->setValue(DebuggerDialog::kSmallFontMinH); - break; - - case kDMediumSize: - myDebuggerWidthSlider->setValue(DebuggerDialog::kMediumFontMinW); - myDebuggerWidthLabel->setValue(DebuggerDialog::kMediumFontMinW); - myDebuggerHeightSlider->setValue(DebuggerDialog::kMediumFontMinH); - myDebuggerHeightLabel->setValue(DebuggerDialog::kMediumFontMinH); - break; - - case kDLargeSize: - myDebuggerWidthSlider->setValue(DebuggerDialog::kLargeFontMinW); - myDebuggerWidthLabel->setValue(DebuggerDialog::kLargeFontMinW); - myDebuggerHeightSlider->setValue(DebuggerDialog::kLargeFontMinH); - myDebuggerHeightLabel->setValue(DebuggerDialog::kLargeFontMinH); + case kDFontSizeChanged: + handleFontSize(); break; #endif @@ -679,4 +654,43 @@ void DeveloperDialog::handleConsole() myRandomizeRAM->setState(false); instance().settings().setValue("dev.ramrandom", 0); } -} \ No newline at end of file +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void DeveloperDialog::handleFontSize() +{ + uInt32 minW, minH; + int fontSize = myDebuggerFontSize->getSelected(); + + if(fontSize == 0) + { + minW = DebuggerDialog::kSmallFontMinW; + minH = DebuggerDialog::kSmallFontMinH; + } + else if(fontSize == 1) + { + minW = DebuggerDialog::kMediumFontMinW; + minH = DebuggerDialog::kMediumFontMinH; + } + else // large + { + minW = DebuggerDialog::kLargeFontMinW; + minH = DebuggerDialog::kLargeFontMinH; + } + minW = std::min(instance().frameBuffer().desktopSize().w, minW); + minH = std::min(instance().frameBuffer().desktopSize().h, minH); + + myDebuggerWidthSlider->setMinValue(minW); + if(minW > myDebuggerWidthSlider->getValue()) + { + myDebuggerWidthSlider->setValue(minW); + myDebuggerWidthLabel->setValue(minW); + } + + myDebuggerHeightSlider->setMinValue(minH); + if(minH > myDebuggerHeightSlider->getValue()) + { + myDebuggerHeightSlider->setValue(minH); + myDebuggerHeightLabel->setValue(minH); + } +} diff --git a/src/gui/DeveloperDialog.hxx b/src/gui/DeveloperDialog.hxx index 40df95424..a1b458ce5 100644 --- a/src/gui/DeveloperDialog.hxx +++ b/src/gui/DeveloperDialog.hxx @@ -43,12 +43,6 @@ class DeveloperDialog : public Dialog virtual ~DeveloperDialog() = default; private: - #if 0 - void handleKeyDown(StellaKey key, StellaMod mod) override; - void handleJoyDown(int stick, int button) override; - void handleJoyAxis(int stick, int axis, int value) override; - bool handleJoyHat(int stick, int hat, int value) override; - #endif void handleCommand(CommandSender* sender, int cmd, int data, int id) override; void loadConfig() override; @@ -69,9 +63,7 @@ class DeveloperDialog : public Dialog #ifdef DEBUGGER_SUPPORT kDWidthChanged = 'UIdw', kDHeightChanged = 'UIdh', - kDSmallSize = 'UIds', - kDMediumSize = 'UIdm', - kDLargeSize = 'UIdl' + kDFontSizeChanged = 'UIfs', #endif }; @@ -101,6 +93,7 @@ class DeveloperDialog : public Dialog StaticTextWidget* myDebuggerWidthLabel; SliderWidget* myDebuggerHeightSlider; StaticTextWidget* myDebuggerHeightLabel; + PopUpWidget* myDebuggerFontSize; PopUpWidget* myDebuggerFontStyle; #endif @@ -120,6 +113,7 @@ class DeveloperDialog : public Dialog void handleTVJitterChange(bool enable); void handleDebugColors(); void handleConsole(); + void handleFontSize(); // Following constructors and assignment operators not supported DeveloperDialog() = delete;