diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 2 | ||||
-rw-r--r-- | src/gui/popups/speechbubble.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 17 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.h | 15 | ||||
-rw-r--r-- | src/gui/widgets/browserbox_unittest.cc | 2 | ||||
-rw-r--r-- | src/gui/widgets/desktop.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chat/chattab.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_colors.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/didyouknowwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/helpwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/npcdialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/questswindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/updaterwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/whoisonline.cpp | 2 |
14 files changed, 28 insertions, 30 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 7e05e3f1f..846c29174 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -104,7 +104,7 @@ PopupMenu *popupMenu = nullptr; PopupMenu::PopupMenu() : Popup("PopupMenu", "popupmenu.xml"), - mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, Opaque_true, + mBrowserBox(new BrowserBox(this, BrowserBoxMode::AUTO_SIZE, Opaque_true, "popupbrowserbox.xml")), mScrollArea(nullptr), mBeingId(BeingId_zero), diff --git a/src/gui/popups/speechbubble.cpp b/src/gui/popups/speechbubble.cpp index c02802095..a76f8694c 100644 --- a/src/gui/popups/speechbubble.cpp +++ b/src/gui/popups/speechbubble.cpp @@ -39,7 +39,7 @@ SpeechBubble::SpeechBubble() : mText(), mSpacing(mSkin ? mSkin->getOption("spacing") : 2), mCaption(new Label(this)), - mSpeechBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, Opaque_true, + mSpeechBox(new BrowserBox(this, BrowserBoxMode::AUTO_SIZE, Opaque_true, "speechbrowserbox.xml")) { setContentSize(140, 46); diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 916ce76d7..c443bf07d 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -98,7 +98,7 @@ int BrowserBox::mInstances = 0; mColors[1][color] = getThemeColor(ThemeColorId::color##_OUTLINE) BrowserBox::BrowserBox(const Widget2 *const widget, - const unsigned int mode, + const BrowserBoxModeT mode, const Opaque opaque, const std::string &skin) : Widget(widget), @@ -409,7 +409,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) } // Auto size mode - if (mMode == AUTO_SIZE) + if (mMode == BrowserBoxMode::AUTO_SIZE) { std::string plain = newRow; for (idx1 = plain.find("##"); @@ -426,7 +426,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) } const int fontHeight = font->getHeight(); - if (mMode == AUTO_WRAP) + if (mMode == BrowserBoxMode::AUTO_WRAP) { unsigned int y = 0; unsigned int nextChar; @@ -911,8 +911,10 @@ int BrowserBox::calcHeight() width = font->getWidth(part); // Auto wrap mode - if (mMode == AUTO_WRAP && wWidth > 0 && width > 0 - && (x + CAST_U32(width) + 10) > wWidth) + if (mMode == BrowserBoxMode::AUTO_WRAP && + wWidth > 0 && + width > 0 && + (x + CAST_U32(width) + 10) > wWidth) { bool forced = false; @@ -976,8 +978,11 @@ int BrowserBox::calcHeight() else width = font->getWidth(part); - if (mMode == AUTO_WRAP && (width == 0 && !processed)) + if (mMode == BrowserBoxMode::AUTO_WRAP && + (width == 0 && !processed)) + { break; + } x += CAST_U32(width); if (x > mDataWidth) diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index 7eff1f1ea..77f103d83 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -28,6 +28,8 @@ #include "enums/simpletypes/opaque.h" +#include "enums/gui/browserboxmode.h" + #include "gui/browserlink.h" #include "gui/widgets/linepart.h" @@ -49,7 +51,7 @@ class BrowserBox final : public Widget, * Constructor. */ BrowserBox(const Widget2 *const widget, - const unsigned int mode, + const BrowserBoxModeT mode, const Opaque opaque, const std::string &skin); @@ -112,15 +114,6 @@ class BrowserBox final : public Widget, void updateHeight(); - /** - * BrowserBox modes. - */ - enum - { - AUTO_SIZE = 0, - AUTO_WRAP /**< Maybe it needs a fix or to be redone. */ - }; - enum { RED = 0, @@ -205,7 +198,7 @@ class BrowserBox final : public Widget, LinkHandler *mLinkHandler; Skin *mSkin; - unsigned int mMode; + BrowserBoxModeT mMode; unsigned int mHighMode; int mSelectedLink; unsigned int mMaxRows; diff --git a/src/gui/widgets/browserbox_unittest.cc b/src/gui/widgets/browserbox_unittest.cc index c2316eaa3..b31758cbd 100644 --- a/src/gui/widgets/browserbox_unittest.cc +++ b/src/gui/widgets/browserbox_unittest.cc @@ -70,7 +70,7 @@ TEST_CASE("BrowserBox tests", "browserbox") Widget::setGlobalFont(new Font("/usr/share/fonts/truetype/" "ttf-dejavu/DejaVuSans-Oblique.ttf", 18)); BrowserBox *const box = new BrowserBox(nullptr, - BrowserBox::AUTO_WRAP, + BrowserBoxMode::AUTO_WRAP, Opaque_true, ""); box->setWidth(100); diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 05a31f4ec..46bb3cba3 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -52,7 +52,7 @@ Desktop::Desktop(const Widget2 *const widget) : LinkHandler(), WidgetListener(), mWallpaper(nullptr), - mVersionLabel(new BrowserBox(this, BrowserBox::AUTO_WRAP, Opaque_false, + mVersionLabel(new BrowserBox(this, BrowserBoxMode::AUTO_WRAP, Opaque_false, "browserbox.xml")), mSkin(nullptr), mBackgroundColor(getThemeColor(ThemeColorId::BACKGROUND, 128)), diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp index 5691f063a..0a8d38355 100644 --- a/src/gui/widgets/tabs/chat/chattab.cpp +++ b/src/gui/widgets/tabs/chat/chattab.cpp @@ -69,7 +69,7 @@ ChatTab::ChatTab(const Widget2 *const widget, const std::string &logName, const ChatTabTypeT &type) : Tab(widget), - mTextOutput(new BrowserBox(this, BrowserBox::AUTO_WRAP, Opaque_true, + mTextOutput(new BrowserBox(this, BrowserBoxMode::AUTO_WRAP, Opaque_true, "browserbox.xml")), mScrollArea(new ScrollArea(this, mTextOutput, Opaque_false)), mChannelName(channel), diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index e0fc0b21e..9f7ad0154 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -55,7 +55,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : mColorBox(CREATEWIDGETR(ListBox, this, userPalette, "")), mScroll(new ScrollArea(this, mColorBox, Opaque_true, "setup_colors_background.xml")), - mPreview(new BrowserBox(this, BrowserBox::AUTO_WRAP, Opaque_true, + mPreview(new BrowserBox(this, BrowserBoxMode::AUTO_WRAP, Opaque_true, "browserbox.xml")), mTextPreview(new TextPreview(this, gettext(rawmsg))), mPreviewBox(new ScrollArea(this, mPreview, Opaque_true, diff --git a/src/gui/windows/didyouknowwindow.cpp b/src/gui/windows/didyouknowwindow.cpp index 1b66acf05..43251f2dd 100644 --- a/src/gui/windows/didyouknowwindow.cpp +++ b/src/gui/windows/didyouknowwindow.cpp @@ -55,7 +55,7 @@ DidYouKnowWindow::DidYouKnowWindow() : Window(_("Did You Know?"), Modal_false, nullptr, "didyouknow.xml"), ActionListener(), mItemLinkHandler(new ItemLinkHandler), - mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, Opaque_true, + mBrowserBox(new BrowserBox(this, BrowserBoxMode::AUTO_SIZE, Opaque_true, "browserbox.xml")), mScrollArea(new ScrollArea(this, mBrowserBox, Opaque_true, "didyouknow_background.xml")), diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp index 14be15074..62c341ac3 100644 --- a/src/gui/windows/helpwindow.cpp +++ b/src/gui/windows/helpwindow.cpp @@ -56,7 +56,7 @@ HelpWindow::HelpWindow() : ActionListener(), // TRANSLATORS: help window. button. mDYKButton(new Button(this, _("Did you know..."), "DYK", this)), - mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, Opaque_true, + mBrowserBox(new BrowserBox(this, BrowserBoxMode::AUTO_SIZE, Opaque_true, "browserbox.xml")), mScrollArea(new ScrollArea(this, mBrowserBox, Opaque_true, "help_background.xml")), diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index c4f8c6b9c..1c7fca17e 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -100,7 +100,7 @@ NpcDialog::NpcDialog(const BeingId npcId) : mNpcId(npcId), mDefaultInt(0), mDefaultString(), - mTextBox(new BrowserBox(this, BrowserBox::AUTO_WRAP, Opaque_true, + mTextBox(new BrowserBox(this, BrowserBoxMode::AUTO_WRAP, Opaque_true, "browserbox.xml")), mScrollArea(new ScrollArea(this, mTextBox, fromBool(getOptionBool("showtextbackground"), Opaque), @@ -1293,7 +1293,7 @@ void NpcDialog::createSkinControls() { const NpcTextInfo *const info = *it; BrowserBox *box = new BrowserBox(this, - BrowserBox::AUTO_WRAP, + BrowserBoxMode::AUTO_WRAP, Opaque_true, "browserbox.xml"); box->setOpaque(Opaque_false); diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp index f8288c976..e0bb3305d 100644 --- a/src/gui/windows/questswindow.cpp +++ b/src/gui/windows/questswindow.cpp @@ -72,7 +72,7 @@ QuestsWindow::QuestsWindow() : fromBool(getOptionBool("showlistbackground"), Opaque), "quests_list_background.xml")), mItemLinkHandler(new ItemLinkHandler), - mText(new BrowserBox(this, BrowserBox::AUTO_WRAP, Opaque_true, + mText(new BrowserBox(this, BrowserBoxMode::AUTO_WRAP, Opaque_true, "browserbox.xml")), mTextScrollArea(new ScrollArea(this, mText, fromBool(getOptionBool("showtextbackground"), Opaque), diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 918f44c99..941788723 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -195,7 +195,7 @@ UpdaterWindow::UpdaterWindow(const std::string &restrict updateHost, mProgressBar(new ProgressBar(this, 0.0, 310, 0, ProgressColorId::PROG_UPDATE, "updateprogressbar.xml", "updateprogressbar_fill.xml")), - mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, Opaque_true, + mBrowserBox(new BrowserBox(this, BrowserBoxMode::AUTO_SIZE, Opaque_true, "browserbox.xml")), mScrollArea(new ScrollArea(this, mBrowserBox, Opaque_true, "update_background.xml")), diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index bfc72ca3b..b11b957c5 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -100,7 +100,7 @@ WhoIsOnline::WhoIsOnline() : mThread(nullptr), mMemoryBuffer(nullptr), mCurlError(new char[CURL_ERROR_SIZE]), - mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, Opaque_true, + mBrowserBox(new BrowserBox(this, BrowserBoxMode::AUTO_SIZE, Opaque_true, "onlinebrowserbox.xml")), mScrollArea(new ScrollArea(this, mBrowserBox, Opaque_false)), // TRANSLATORS: who is online. button. |