diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-10-09 01:36:40 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-10-09 01:45:28 +0300 |
commit | e153ea49f7442a82651e4e35f2be59c459ad32cb (patch) | |
tree | 8daace3c1691df379296600af4ce3ab3ba5325d0 /src/gui/widgets | |
parent | b2c430f8e0fd67c6529227f8e8bebdc407ef530d (diff) | |
download | mv-e153ea49f7442a82651e4e35f2be59c459ad32cb.tar.gz mv-e153ea49f7442a82651e4e35f2be59c459ad32cb.tar.bz2 mv-e153ea49f7442a82651e4e35f2be59c459ad32cb.tar.xz mv-e153ea49f7442a82651e4e35f2be59c459ad32cb.zip |
Use all parameters in browserbox constructors.
Also load browserbox skin for each instance.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 16 | ||||
-rw-r--r-- | src/gui/widgets/browserbox.h | 6 | ||||
-rw-r--r-- | src/gui/widgets/tabs/chattab.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_colors.cpp | 2 |
4 files changed, 16 insertions, 10 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 6fd38e4c6..c8edf757b 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -44,7 +44,6 @@ #include "debug.h" -Skin *BrowserBox::mSkin = nullptr; ImageSet *BrowserBox::mEmotes = nullptr; int BrowserBox::mInstances = 0; @@ -58,6 +57,7 @@ BrowserBox::BrowserBox(const Widget2 *const widget, const unsigned int mode, mLineParts(), mLinks(), mLinkHandler(nullptr), + mSkin(nullptr), mMode(mode), mHighMode(UNDERLINE | BACKGROUND), mSelectedLink(-1), @@ -84,10 +84,11 @@ BrowserBox::BrowserBox(const Widget2 *const widget, const unsigned int mode, mBackgroundColor = getThemeColor(Theme::BACKGROUND); + Theme *const theme = Theme::instance(); + if (theme) + mSkin = theme->load("browserbox.xml", ""); if (mInstances == 0) { - if (Theme::instance()) - mSkin = Theme::instance()->load("browserbox.xml", ""); mEmotes = ResourceManager::getInstance()->getImageSet( "graphics/sprites/chatemotes.png", 17, 18); } @@ -130,11 +131,16 @@ BrowserBox::~BrowserBox() if (gui) gui->removeDragged(this); + Theme *const theme = Theme::instance(); + if (theme) + { + theme->unload(mSkin); + mSkin = nullptr; + } + mInstances --; if (mInstances == 0) { - if (Theme::instance()) - Theme::instance()->unload(mSkin); if (mEmotes) { mEmotes->decRef(); diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index 91d8233ed..f57519700 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -111,8 +111,8 @@ class BrowserBox final : public gcn::Widget, * Constructor. */ BrowserBox(const Widget2 *const widget, - const unsigned int mode = AUTO_SIZE, - const bool opaque = true); + const unsigned int mode, + const bool opaque); A_DELETE_COPY(BrowserBox) @@ -253,6 +253,7 @@ class BrowserBox final : public gcn::Widget, Links mLinks; LinkHandler *mLinkHandler; + Skin *mSkin; unsigned int mMode; unsigned int mHighMode; int mSelectedLink; @@ -277,7 +278,6 @@ class BrowserBox final : public gcn::Widget, bool mEnableKeys; bool mEnableTabs; - static Skin *mSkin; static ImageSet *mEmotes; static int mInstances; }; diff --git a/src/gui/widgets/tabs/chattab.cpp b/src/gui/widgets/tabs/chattab.cpp index b7f8a1a44..7ad6e303d 100644 --- a/src/gui/widgets/tabs/chattab.cpp +++ b/src/gui/widgets/tabs/chattab.cpp @@ -53,7 +53,7 @@ static const unsigned int MAX_WORD_SIZE = 50; ChatTab::ChatTab(const Widget2 *const widget, const std::string &name, const std::string &channel) : Tab(widget), - mTextOutput(new BrowserBox(this, BrowserBox::AUTO_WRAP)), + mTextOutput(new BrowserBox(this, BrowserBox::AUTO_WRAP, true)), mScrollArea(new ScrollArea(mTextOutput, false)), mChannelName(channel), mAllowHightlight(true), diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index 19139e37f..28b6d39f6 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -50,7 +50,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : gcn::SelectionListener(), mColorBox(new ListBox(this, userPalette, "")), mScroll(new ScrollArea(mColorBox, true, "setup_colors_background.xml")), - mPreview(new BrowserBox(this, BrowserBox::AUTO_WRAP)), + mPreview(new BrowserBox(this, BrowserBox::AUTO_WRAP, true)), mTextPreview(new TextPreview(this, gettext(rawmsg))), mPreviewBox(new ScrollArea(mPreview, true, "setup_colors_preview_background.xml")), |