Debugger UI tab refactored (font size selection and debugger size)

debugger disassembly reformatted
This commit is contained in:
thrust26 2017-11-21 16:30:33 +01:00
parent cc45822816
commit 956f284a51
7 changed files with 147 additions and 134 deletions

View File

@ -319,7 +319,7 @@ bool CartDebug::fillDisassemblyList(BankInfo& info, uInt16 search)
return false; return false;
myDisassembly.list.clear(); myDisassembly.list.clear();
myDisassembly.fieldwidth = 14 + myLabelLength; myDisassembly.fieldwidth = 24 + myLabelLength;
DiStella distella(*this, myDisassembly.list, info, DiStella::settings, DiStella distella(*this, myDisassembly.list, info, DiStella::settings,
myDisLabels, myDisDirectives, myReserved); myDisLabels, myDisDirectives, myReserved);

View File

@ -227,59 +227,57 @@ void DebuggerDialog::doExitRom()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::createFont() 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(fontSize == "large")
if(_w >= kLargeFontMinW && _h >= kLargeFontMinH)
{ {
// Large font doesn't use fontstyle at all // Large font doesn't use fontStyle at all
myLFont = make_unique<GUI::Font>(GUI::stellaMediumDesc); myLFont = make_unique<GUI::Font>(GUI::stellaMediumDesc);
myNFont = make_unique<GUI::Font>(GUI::stellaMediumDesc); myNFont = make_unique<GUI::Font>(GUI::stellaMediumDesc);
} }
else if(_w >= kMediumFontMinW && _h >= kMediumFontMinH) else if(fontSize == "medium")
{
if(fontstyle == 1)
{ {
myLFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc); switch(fontStyle)
myNFont = make_unique<GUI::Font>(GUI::consoleMediumDesc); {
case 1:
myLFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc);
myNFont = make_unique<GUI::Font>(GUI::consoleMediumDesc);
break;
case 2:
myLFont = make_unique<GUI::Font>(GUI::consoleMediumDesc);
myNFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc);
break;
case 3:
myLFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc);
myNFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc);
break;
default: // default to zero
myLFont = make_unique<GUI::Font>(GUI::consoleMediumDesc);
myNFont = make_unique<GUI::Font>(GUI::consoleMediumDesc);
break;
};
} }
else if(fontstyle == 2)
{
myLFont = make_unique<GUI::Font>(GUI::consoleMediumDesc);
myNFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc);
}
else if(fontstyle == 3)
{
myLFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc);
myNFont = make_unique<GUI::Font>(GUI::consoleMediumBDesc);
}
else // default to zero
{
myLFont = make_unique<GUI::Font>(GUI::consoleMediumDesc);
myNFont = make_unique<GUI::Font>(GUI::consoleMediumDesc);
}
}
else else
{ {
if(fontstyle == 1) switch(fontStyle)
{ {
myLFont = make_unique<GUI::Font>(GUI::consoleBDesc); case 1:
myNFont = make_unique<GUI::Font>(GUI::consoleDesc); myLFont = make_unique<GUI::Font>(GUI::consoleBDesc);
} myNFont = make_unique<GUI::Font>(GUI::consoleDesc);
else if(fontstyle == 2) break;
{ case 2:
myLFont = make_unique<GUI::Font>(GUI::consoleDesc); myLFont = make_unique<GUI::Font>(GUI::consoleDesc);
myNFont = make_unique<GUI::Font>(GUI::consoleBDesc); myNFont = make_unique<GUI::Font>(GUI::consoleBDesc);
} break;
else if(fontstyle == 3) case 3:
{ myLFont = make_unique<GUI::Font>(GUI::consoleBDesc);
myLFont = make_unique<GUI::Font>(GUI::consoleBDesc); myNFont = make_unique<GUI::Font>(GUI::consoleBDesc);
myNFont = make_unique<GUI::Font>(GUI::consoleBDesc); break;
} default: // default to zero
else // default to zero myLFont = make_unique<GUI::Font>(GUI::consoleDesc);
{ myNFont = make_unique<GUI::Font>(GUI::consoleDesc);
myLFont = make_unique<GUI::Font>(GUI::consoleDesc); break;
myNFont = make_unique<GUI::Font>(GUI::consoleDesc);
} }
} }
} }

View File

@ -47,9 +47,9 @@ class DebuggerDialog : public Dialog
{ {
public: public:
enum { enum {
kSmallFontMinW = 1080, kSmallFontMinH = 720, kSmallFontMinW = 1070, kSmallFontMinH = 720,
kMediumFontMinW = 1280, kMediumFontMinH = 860, kMediumFontMinW = 1150, kMediumFontMinH = 770,
kLargeFontMinW = 1300, kLargeFontMinH = 980 kLargeFontMinW = 1150, kLargeFontMinH = 870
}; };
DebuggerDialog(OSystem& osystem, DialogContainer& parent, DebuggerDialog(OSystem& osystem, DialogContainer& parent,

View File

@ -66,8 +66,8 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
const int fontWidth = lfont.getMaxCharWidth(), const int fontWidth = lfont.getMaxCharWidth(),
numchars = w / fontWidth; numchars = w / fontWidth;
_labelWidth = std::max(14, int(0.35 * (numchars - 18))) * fontWidth - 1; _labelWidth = std::max(14, int(0.40 * (numchars - 18))) * fontWidth - 1;
_bytesWidth = 12 * fontWidth; _bytesWidth = 9 * fontWidth;
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
// Add checkboxes // Add checkboxes

View File

@ -136,6 +136,7 @@ Settings::Settings(OSystem& osystem)
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
// Debugger/disassembly options // Debugger/disassembly options
setInternal("dbg.fontsize", "medium");
setInternal("dbg.fontstyle", "0"); setInternal("dbg.fontstyle", "0");
setInternal("dbg.uhex", "true"); setInternal("dbg.uhex", "true");
setInternal("dis.resolve", "true"); setInternal("dis.resolve", "true");
@ -337,6 +338,10 @@ void Settings::validate()
if(s != "small" && s != "medium" && s != "large") if(s != "small" && s != "medium" && s != "large")
setInternal("launcherfont", "medium"); setInternal("launcherfont", "medium");
s = getString("dbg.fontsize");
if(s != "small" && s != "medium" && s != "large")
setInternal("dbg.fontsize", "medium");
i = getInt("romviewer"); i = getInt("romviewer");
if(i < 0) setInternal("romviewer", "0"); if(i < 0) setInternal("romviewer", "0");
else if(i > 2) setInternal("romviewer", "2"); 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.showaddr <1|0> Show opcode addresses in disassembler\n"
<< " -dis.relocate <1|0> Relocate calls out of address range in disassembler\n" << " -dis.relocate <1|0> Relocate calls out of address range in disassembler\n"
<< endl << endl
<< " -dbg.res <WxH> The resolution to use in debugger mode\n" << " -dbg.res <WxH> The resolution to use in debugger mode\n"
<< " -dbg.fontstyle <0-3> Font style to use in debugger window (bold vs. normal)\n" << " -dbg.fontsize <small|medium| Font size to use in debugger window\n"
<< " -break <address> Set a breakpoint at 'address'\n" << " large>\n"
<< " -debug Start in debugger mode\n" << " -dbg.fontstyle <0-3> Font style to use in debugger window (bold vs. normal)\n"
<< " -break <address> Set a breakpoint at 'address'\n"
<< " -debug Start in debugger mode\n"
<< endl << endl
<< " -bs <arg> Sets the 'Cartridge.Type' (bankswitch) property\n" << " -bs <arg> Sets the 'Cartridge.Type' (bankswitch) property\n"
<< " -type <arg> Same as using -bs\n" << " -type <arg> Same as using -bs\n"

View File

@ -245,12 +245,40 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
ButtonWidget* b; ButtonWidget* b;
const GUI::Size& ds = instance().frameBuffer().desktopSize(); const GUI::Size& ds = instance().frameBuffer().desktopSize();
lwidth = font.getStringWidth("Debugger Height ");
xpos = HBORDER; xpos = HBORDER;
ypos = VBORDER; 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 // Debugger width and height
myDebuggerWidthSlider = new SliderWidget(myTab, font, xpos, ypos, pwidth, myDebuggerWidthSlider = new SliderWidget(myTab, font, xpos, ypos-1, pwidth,
lineHeight, "Debugger Width ", lineHeight, "Debugger Width ",
lwidth, kDWidthChanged); lwidth, kDWidthChanged);
myDebuggerWidthSlider->setMinValue(DebuggerDialog::kSmallFontMinW); myDebuggerWidthSlider->setMinValue(DebuggerDialog::kSmallFontMinW);
@ -264,7 +292,7 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
myDebuggerWidthLabel->setFlags(WIDGET_CLEARBG); myDebuggerWidthLabel->setFlags(WIDGET_CLEARBG);
ypos += lineHeight + VGAP; ypos += lineHeight + VGAP;
myDebuggerHeightSlider = new SliderWidget(myTab, font, xpos, ypos, pwidth, myDebuggerHeightSlider = new SliderWidget(myTab, font, xpos, ypos-1, pwidth,
lineHeight, "Debugger Height ", lineHeight, "Debugger Height ",
lwidth, kDHeightChanged); lwidth, kDHeightChanged);
myDebuggerHeightSlider->setMinValue(DebuggerDialog::kSmallFontMinH); myDebuggerHeightSlider->setMinValue(DebuggerDialog::kSmallFontMinH);
@ -277,47 +305,7 @@ void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
ypos + 1, 4 * fontWidth, fontHeight, "", kTextAlignLeft); ypos + 1, 4 * fontWidth, fontHeight, "", kTextAlignLeft);
myDebuggerHeightLabel->setFlags(WIDGET_CLEARBG); myDebuggerHeightLabel->setFlags(WIDGET_CLEARBG);
// Add minimum window size buttons for different fonts StaticTextWidget* t = new StaticTextWidget(myTab, font, HBORDER, _h - lineHeight * 5, "(*) Changes require application restart");
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);
// Debugger is only realistically available in windowed modes 800x600 or greater // Debugger is only realistically available in windowed modes 800x600 or greater
// (and when it's actually been compiled into the app) // (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); "Debugger support not included", kTextAlignCenter);
#endif #endif
addToFocusList(wid, myTab, tabID); addToFocusList(wid, myTab, tabID);
} }
@ -405,31 +391,32 @@ void DeveloperDialog::loadConfig()
// Debugger size // Debugger size
const GUI::Size& ds = instance().settings().getSize("dbg.res"); const GUI::Size& ds = instance().settings().getSize("dbg.res");
w = ds.w; h = ds.h; 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); myDebuggerWidthSlider->setValue(w);
myDebuggerWidthLabel->setValue(w); myDebuggerWidthLabel->setValue(w);
myDebuggerHeightSlider->setValue(h); myDebuggerHeightSlider->setValue(h);
myDebuggerHeightLabel->setValue(h); myDebuggerHeightLabel->setValue(h);
// Debugger font size
string size = instance().settings().getString("dbg.fontsize");
myDebuggerFontSize->setSelected(size, "medium");
// Debugger font style // Debugger font style
int style = instance().settings().getInt("dbg.fontstyle"); int style = instance().settings().getInt("dbg.fontstyle");
myDebuggerFontStyle->setSelected(style, "0"); myDebuggerFontStyle->setSelected(style, "0");
handleFontSize();
#endif #endif
myTab->loadConfig(); myTab->loadConfig();
handleFontSize();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::saveConfig() void DeveloperDialog::saveConfig()
{ {
//TODO //TODO
// - bankrandom (not implemented yet)
// - thumbexception (commandline only yet) // - thumbexception (commandline only yet)
// - remove settings from within debugger
bool devSettings = myDevSettings0->getState(); bool devSettings = myDevSettings0->getState();
instance().settings().setValue("dev.settings", devSettings); instance().settings().setValue("dev.settings", devSettings);
@ -488,6 +475,9 @@ void DeveloperDialog::saveConfig()
GUI::Size(myDebuggerWidthSlider->getValue(), GUI::Size(myDebuggerWidthSlider->getValue(),
myDebuggerHeightSlider->getValue())); myDebuggerHeightSlider->getValue()));
// Debugger font size
instance().settings().setValue("dbg.fontsize", myDebuggerFontSize->getSelectedTag().toString());
// Debugger font style // Debugger font style
instance().settings().setValue("dbg.fontstyle", instance().settings().setValue("dbg.fontstyle",
myDebuggerFontStyle->getSelectedTag().toString()); myDebuggerFontStyle->getSelectedTag().toString());
@ -535,7 +525,9 @@ void DeveloperDialog::setDefaults()
myDebuggerWidthLabel->setValue(w); myDebuggerWidthLabel->setValue(w);
myDebuggerHeightSlider->setValue(h); myDebuggerHeightSlider->setValue(h);
myDebuggerHeightLabel->setValue(h); myDebuggerHeightLabel->setValue(h);
myDebuggerFontSize->setSelected("medium");
myDebuggerFontStyle->setSelected("0"); myDebuggerFontStyle->setSelected("0");
handleFontSize();
#endif #endif
break; break;
} }
@ -584,25 +576,8 @@ void DeveloperDialog::handleCommand(CommandSender* sender, int cmd, int data, in
myDebuggerHeightLabel->setValue(myDebuggerHeightSlider->getValue()); myDebuggerHeightLabel->setValue(myDebuggerHeightSlider->getValue());
break; break;
case kDSmallSize: case kDFontSizeChanged:
myDebuggerWidthSlider->setValue(DebuggerDialog::kSmallFontMinW); handleFontSize();
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);
break; break;
#endif #endif
@ -680,3 +655,42 @@ void DeveloperDialog::handleConsole()
instance().settings().setValue("dev.ramrandom", 0); instance().settings().setValue("dev.ramrandom", 0);
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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);
}
}

View File

@ -43,12 +43,6 @@ class DeveloperDialog : public Dialog
virtual ~DeveloperDialog() = default; virtual ~DeveloperDialog() = default;
private: 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 handleCommand(CommandSender* sender, int cmd, int data, int id) override;
void loadConfig() override; void loadConfig() override;
@ -69,9 +63,7 @@ class DeveloperDialog : public Dialog
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
kDWidthChanged = 'UIdw', kDWidthChanged = 'UIdw',
kDHeightChanged = 'UIdh', kDHeightChanged = 'UIdh',
kDSmallSize = 'UIds', kDFontSizeChanged = 'UIfs',
kDMediumSize = 'UIdm',
kDLargeSize = 'UIdl'
#endif #endif
}; };
@ -101,6 +93,7 @@ class DeveloperDialog : public Dialog
StaticTextWidget* myDebuggerWidthLabel; StaticTextWidget* myDebuggerWidthLabel;
SliderWidget* myDebuggerHeightSlider; SliderWidget* myDebuggerHeightSlider;
StaticTextWidget* myDebuggerHeightLabel; StaticTextWidget* myDebuggerHeightLabel;
PopUpWidget* myDebuggerFontSize;
PopUpWidget* myDebuggerFontStyle; PopUpWidget* myDebuggerFontStyle;
#endif #endif
@ -120,6 +113,7 @@ class DeveloperDialog : public Dialog
void handleTVJitterChange(bool enable); void handleTVJitterChange(bool enable);
void handleDebugColors(); void handleDebugColors();
void handleConsole(); void handleConsole();
void handleFontSize();
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
DeveloperDialog() = delete; DeveloperDialog() = delete;