small fix in debugger dialog

This commit is contained in:
thrust26 2020-05-01 12:10:00 +02:00
parent 1e518a5593
commit b5d0a5a057
2 changed files with 18 additions and 7 deletions

View File

@ -34,15 +34,16 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
: Widget(boss, lfont, x, y, 16, 16),
CommandSender(boss)
{
bool longstr = 34 * lfont.getMaxCharWidth() <= max_w;
bool longstr = 11 + 32 * lfont.getMaxCharWidth() + 9
+ EditTextWidget::calcWidth(lfont) * 3 <= max_w;
const int VGAP = 5;
x += 11;
const int lineHeight = lfont.getLineHeight();
int xpos = x, ypos = y + 10;
int lwidth = lfont.getStringWidth(longstr ? "Frame Cycle " : "F. Cycle ");
int fwidth = 5 * lfont.getMaxCharWidth() + 4;
int twidth = 8 * lfont.getMaxCharWidth() + 4;
int fwidth = EditTextWidget::calcWidth(lfont, 5);
int twidth = EditTextWidget::calcWidth(lfont, 8);
// Add frame info
// 1st column
@ -78,11 +79,9 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
// 2nd column
xpos = x + lwidth + myFrameCycles->getWidth() + 9; ypos = y + 10;
lwidth = lfont.getStringWidth(longstr ? "Color Clock " : "Pixel Pos ");
fwidth = 3 * lfont.getMaxCharWidth() + 4;
fwidth = EditTextWidget::calcWidth(lfont, 3);
new StaticTextWidget(boss, lfont, xpos, ypos,
lfont.getStringWidth(longstr ? "Scanline" : "Scn Ln"), lineHeight,
longstr ? "Scanline" : "Scn Ln", TextAlign::Left);
new StaticTextWidget(boss, lfont, xpos, ypos, longstr ? "Scanline" : "Scn Ln");
myScanlineCountLast = new EditTextWidget(boss, nfont, xpos+lwidth, ypos-1, fwidth,
lineHeight, "");
myScanlineCountLast->setEditable(false, true);

View File

@ -32,6 +32,18 @@ class EditTextWidget : public EditableWidget
void setText(const string& str, bool changed = false) override;
// Get total width of widget
static int calcWidth(const GUI::Font& font, int length = 0)
{
return length * font.getMaxCharWidth()
+ (font.getFontHeight() < 24 ? 3 * 2 : 5 * 2);
}
// Get total width of widget
static int calcWidth(const GUI::Font& font, const string& str)
{
return calcWidth(font, int(str.length()));
}
protected:
void drawWidget(bool hilite) override;
void lostFocusWidget() override;