diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-08-28 22:45:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-08-29 00:18:57 +0300 |
commit | 3db999ff2d3324ffad6ba6a469ca224c8d864dc3 (patch) | |
tree | 78ecfd05c1267f7360e42876072ddb21efa1a096 /src/gui | |
parent | 57726c7324f165c70671fc5b05d6c0964f56b870 (diff) | |
download | manaplus-3db999ff2d3324ffad6ba6a469ca224c8d864dc3.tar.gz manaplus-3db999ff2d3324ffad6ba6a469ca224c8d864dc3.tar.bz2 manaplus-3db999ff2d3324ffad6ba6a469ca224c8d864dc3.tar.xz manaplus-3db999ff2d3324ffad6ba6a469ca224c8d864dc3.zip |
add some more missing checks.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/didyouknowwindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/helpwindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/minimap.cpp | 3 | ||||
-rw-r--r-- | src/gui/setup_input.cpp | 9 | ||||
-rw-r--r-- | src/gui/setup_input.h | 2 | ||||
-rw-r--r-- | src/gui/shortcutwindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/skilldialog.cpp | 3 | ||||
-rw-r--r-- | src/gui/socialwindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/statuswindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/scrollarea.cpp | 19 | ||||
-rw-r--r-- | src/gui/windowmenu.cpp | 7 |
11 files changed, 40 insertions, 21 deletions
diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp index 338b70bf2..4c8a96e51 100644 --- a/src/gui/didyouknowwindow.cpp +++ b/src/gui/didyouknowwindow.cpp @@ -70,7 +70,8 @@ DidYouKnowWindow::DidYouKnowWindow() : setResizable(true); setStickyButtonLock(true); - setupWindow->registerWindowForReset(this); + if (setupWindow) + setupWindow->registerWindowForReset(this); setDefaultSize(500, 400, ImageRect::CENTER); mBrowserBox->setOpaque(false); diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp index d41f8a550..f6064d58a 100644 --- a/src/gui/helpwindow.cpp +++ b/src/gui/helpwindow.cpp @@ -63,7 +63,8 @@ HelpWindow::HelpWindow() : setResizable(true); setStickyButtonLock(true); - setupWindow->registerWindowForReset(this); + if (setupWindow) + setupWindow->registerWindowForReset(this); setDefaultSize(500, 400, ImageRect::CENTER); diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 641f9f9f9..cca582099 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -66,7 +66,8 @@ Minimap::Minimap() : // set this to false as the minimap window size is changed // depending on the map size setResizable(true); - setupWindow->registerWindowForReset(this); + if (setupWindow) + setupWindow->registerWindowForReset(this); setDefaultVisible(true); setSaveVisible(true); diff --git a/src/gui/setup_input.cpp b/src/gui/setup_input.cpp index fa77996dd..d4d86ce61 100644 --- a/src/gui/setup_input.cpp +++ b/src/gui/setup_input.cpp @@ -125,10 +125,9 @@ Setup_Input::Setup_Input(const Widget2 *const widget) : refreshKeys(); mKeyList->addActionListener(this); - ScrollArea *const scrollArea = new ScrollArea(mKeyList, + mScrollArea = new ScrollArea(mKeyList, true, "setup_input_background.xml"); - scrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); - + mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mAssignKeyButton->addActionListener(this); mAssignKeyButton->setEnabled(false); mUnassignKeyButton->addActionListener(this); @@ -152,7 +151,7 @@ Setup_Input::Setup_Input(const Widget2 *const widget) : ContainerPlacer place = h.getPlacer(0, 0); place(0, 0, mTabs, 5); - place(0, 1, scrollArea, 5, 5).setPadding(2); + place(0, 1, mScrollArea, 5, 5).setPadding(2); place(0, 6, mResetKeysButton); place(2, 6, mAssignKeyButton); place(3, 6, mUnassignKeyButton); @@ -180,6 +179,8 @@ Setup_Input::~Setup_Input() mResetKeysButton = nullptr; delete [] mActionDataSize; mActionDataSize = nullptr; + delete mScrollArea; + mScrollArea = nullptr; } void Setup_Input::apply() diff --git a/src/gui/setup_input.h b/src/gui/setup_input.h index 10fc2a32f..0e0420fc6 100644 --- a/src/gui/setup_input.h +++ b/src/gui/setup_input.h @@ -32,6 +32,7 @@ class Button; class CheckBox; class ListBox; class KeyListModel; +class ScrollArea; class TabStrip; struct SetupActionData; @@ -96,6 +97,7 @@ class Setup_Input final : public SetupTab Button *mDefaultButton; Button *mResetKeysButton; TabStrip *mTabs; + ScrollArea *mScrollArea; bool mKeySetting; /**< flag to check if key being set. */ int *mActionDataSize; }; diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp index 87b43e758..8bd64c9ff 100644 --- a/src/gui/shortcutwindow.cpp +++ b/src/gui/shortcutwindow.cpp @@ -74,7 +74,8 @@ ShortcutWindow::ShortcutWindow(const std::string &title, mDragOffsetY = 0; content->setWidget2(this); - setupWindow->registerWindowForReset(this); + if (setupWindow) + setupWindow->registerWindowForReset(this); const int border = SCROLL_PADDING * 2 + getPadding() * 2; setMinWidth(mItems->getBoxWidth() + border); @@ -123,7 +124,8 @@ ShortcutWindow::ShortcutWindow(const std::string &title, mDragOffsetX = 0; mDragOffsetY = 0; - setupWindow->registerWindowForReset(this); + if (setupWindow) + setupWindow->registerWindowForReset(this); const int border = SCROLL_PADDING * 2 + getPadding() * 2; diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index c30717f7b..812521391 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -271,7 +271,8 @@ SkillDialog::SkillDialog() : setSaveVisible(true); setStickyButtonLock(true); setDefaultSize(windowContainer->getWidth() - 280, 30, 275, 425); - setupWindow->registerWindowForReset(this); + if (setupWindow) + setupWindow->registerWindowForReset(this); mUseButton->setEnabled(false); mIncreaseButton->setEnabled(false); diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index c182df9ab..f25ca3e37 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -1302,7 +1302,8 @@ SocialWindow::SocialWindow() : setMinWidth(120); setMinHeight(55); setDefaultSize(590, 200, 180, 300); - setupWindow->registerWindowForReset(this); + if (setupWindow) + setupWindow->registerWindowForReset(this); place(0, 0, mCreateButton); place(1, 0, mInviteButton); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 1e1c0fe4d..fe5ec917d 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -165,7 +165,8 @@ StatusWindow::StatusWindow() : listen(CHANNEL_ATTRIBUTES); setWindowName("Status"); - setupWindow->registerWindowForReset(this); + if (setupWindow) + setupWindow->registerWindowForReset(this); setResizable(true); setCloseButton(true); setSaveVisible(true); diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 98b58f51c..c21ddd17c 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -102,9 +102,9 @@ ScrollArea::~ScrollArea() const Theme *const theme = Theme::instance(); if (theme) { - theme->unloadRect(background); if (instances == 0) { + theme->unloadRect(background); theme->unloadRect(vMarker); theme->unloadRect(vMarkerHi); theme->unloadRect(vBackground); @@ -135,12 +135,6 @@ void ScrollArea::init(std::string skinName) setLeftButtonScrollAmount(2); setRightButtonScrollAmount(2); - if (skinName == "") - skinName = "scroll_background.xml"; - Theme *const theme = Theme::instance(); - if (theme) - theme->loadRect(background, skinName, "scroll_background.xml"); - if (instances == 0) { for (int f = 0; f < 9; f ++) @@ -152,6 +146,13 @@ void ScrollArea::init(std::string skinName) hBackground.grid[f] = nullptr; } + // +++ here probably need move background from static + if (skinName == "") + skinName = "scroll_background.xml"; + Theme *const theme = Theme::instance(); + if (theme) + theme->loadRect(background, skinName, "scroll_background.xml"); + if (theme) { theme->loadRect(vMarker, "scroll.xml", ""); @@ -169,7 +170,8 @@ void ScrollArea::init(std::string skinName) const ImageRect &rect = skin->getBorder(); for (int f = UP; f < BUTTONS_DIR; f ++) { - rect.grid[f]->incRef(); + if (rect.grid[f]) + rect.grid[f]->incRef(); buttons[f][i] = rect.grid[f]; } if (i == 0) @@ -188,7 +190,6 @@ void ScrollArea::init(std::string skinName) } } mScrollbarWidth = mScrollbarSize; - instances++; } diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index bc7e0f736..0e2cc5397 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -205,6 +205,13 @@ WindowMenu::~WindowMenu() } delete_all(mButtonTexts); mButtonTexts.clear(); + if (mSkin) + { + Theme *const theme = Theme::instance(); + if (theme) + theme->unload(mSkin); + mSkin = nullptr; + } } void WindowMenu::action(const gcn::ActionEvent &event) |