diff options
-rw-r--r-- | data/graphics/gui/browserbox.xml | 1 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 20 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.h | 1 |
3 files changed, 14 insertions, 8 deletions
diff --git a/data/graphics/gui/browserbox.xml b/data/graphics/gui/browserbox.xml index 3d0d028cf..621be46f3 100644 --- a/data/graphics/gui/browserbox.xml +++ b/data/graphics/gui/browserbox.xml @@ -3,5 +3,6 @@ <widget type="Window"> <option name="padding" value="1" /> <option name="newLinePadding" value="15" /> + <option name="itemPadding" value="0" /> </widget> </skinset> diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index df0fd5705..a2bee9219 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -70,6 +70,7 @@ BrowserBox::BrowserBox(const Widget2 *const widget, mUpdateTime(-1), mPadding(0), mNewLinePadding(15), + mItemPadding(0), mHighlightColor(getThemeColor(Theme::HIGHLIGHT)), mHyperLinkColor(getThemeColor(Theme::HYPERLINK)), mOpaque(opaque), @@ -100,6 +101,7 @@ BrowserBox::BrowserBox(const Widget2 *const widget, { mPadding = mSkin->getPadding(); mNewLinePadding = mSkin->getOption("newLinePadding", 15); + mItemPadding = mSkin->getOption("itemPadding"); } mColors[0][BLACK] = getThemeColor(Theme::BLACK); @@ -525,7 +527,7 @@ int BrowserBox::calcHeight() return 1; const gcn::Font *const font = getFont(); - const int fontHeight = font->getHeight(); + const int fontHeight = font->getHeight() + 2 * mItemPadding; const int fontWidthMinus = font->getWidth("-"); const char *const hyphen = "~"; const int hyphenWidth = font->getWidth(hyphen); @@ -549,7 +551,7 @@ int BrowserBox::calcHeight() const int dashWidth = fontWidthMinus; for (x = mPadding; x < wWidth; x ++) { - mLineParts.push_back(LinePart(x, y, + mLineParts.push_back(LinePart(x, y + mItemPadding, selColor[0], selColor[1], "-", false)); x += dashWidth - 2; } @@ -567,7 +569,7 @@ int BrowserBox::calcHeight() if (img) { img->incRef(); - mLineParts.push_back(LinePart(x, y, + mLineParts.push_back(LinePart(x, y + mItemPadding, selColor[0], selColor[1], img)); y += img->getHeight() + 2; moreHeight += img->getHeight(); @@ -735,7 +737,8 @@ int BrowserBox::calcHeight() Image *const img = mEmotes->get(cid); if (img) { - mLineParts.push_back(LinePart(x, y, + mLineParts.push_back(LinePart( + x, y + mItemPadding, selColor[0], selColor[1], img)); x += 18; } @@ -803,8 +806,9 @@ int BrowserBox::calcHeight() if (forced) { x -= hyphenWidth; // Remove the wrap-notifier accounting - mLineParts.push_back(LinePart(wWidth - hyphenWidth, - y, selColor[0], selColor[1], hyphen, bold)); + mLineParts.push_back(LinePart( + wWidth - hyphenWidth, y + mItemPadding, + selColor[0], selColor[1], hyphen, bold)); end++; // Skip to the next character } else @@ -816,8 +820,8 @@ int BrowserBox::calcHeight() wrappedLines++; } - mLineParts.push_back(LinePart(x, y, selColor[0], selColor[1], - part.c_str(), bold)); + mLineParts.push_back(LinePart(x, y + mItemPadding, + selColor[0], selColor[1], part.c_str(), bold)); if (bold) width = boldFont->getWidth(part); diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index 87ed57382..7c2d3c053 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -265,6 +265,7 @@ class BrowserBox final : public gcn::Widget, int mUpdateTime; int mPadding; int mNewLinePadding; + int mItemPadding; gcn::Color mHighlightColor; gcn::Color mHyperLinkColor; |