Permalink
Browse files

fix warning+exit crash, fix menusection offset resetting when menus a…

…re rebuilt
  • Loading branch information...
jacob1 committed Jun 25, 2016
1 parent 083d488 commit 4190946de5d9faca274e08b5efb30cd461aa0983
Showing with 13 additions and 5 deletions.
  1. +1 −1 src/gui/game/Favorite.cpp
  2. +4 −2 src/gui/game/GameModel.cpp
  3. +8 −2 src/gui/game/GameView.cpp
@@ -23,4 +23,4 @@ bool Favorite::IsFavorite(std::string identifier)
{
std::vector<std::string> tempFavoritsList = *favoritesList;
return std::find(tempFavoritsList.begin(), tempFavoritsList.end(), identifier) != tempFavoritsList.end();
}
}
@@ -166,6 +166,8 @@ GameModel::~GameModel()
for (size_t i = 0; i < menuList.size(); i++)
{
if (i == SC_FAVORITES)
menuList[i]->ClearTools();
delete menuList[i];
}
for (std::vector<Tool*>::iterator iter = extraElementTools.begin(), end = extraElementTools.end(); iter != end; ++iter)
@@ -370,12 +372,12 @@ void GameModel::BuildFavoritesMenu()
{
menuList[SC_FAVORITES]->ClearTools();
for (int i = 0; i < menuList.size(); i++)
for (size_t i = 0; i < menuList.size(); i++)
{
if (i == SC_FAVORITES)
continue;
for (int j = 0; j < menuList[i]->GetToolList().size(); j++)
for (size_t j = 0; j < menuList[i]->GetToolList().size(); j++)
{
if (Favorite::Ref().IsFavorite(menuList[i]->GetToolList()[j]->GetIdentifier()))
{
@@ -538,11 +538,13 @@ class GameView::ToolAction: public ui::ButtonAction
void ActionCallback(ui::Button * sender_)
{
ToolButton *sender = (ToolButton*)sender_;
if (v->ShiftBehaviour() && !v->CtrlBehaviour() && !v->AltBehaviour())
if (v->ShiftBehaviour() && v->CtrlBehaviour() && !v->AltBehaviour())

This comment has been minimized.

@me4502

me4502 Jun 26, 2016

Contributor

Why change it to CTRL+SHIFT?

This comment has been minimized.

@jacob1

jacob1 Jun 26, 2016

Member

Uh, I think it was to match my mod, but I actually forgot I did this and I could probably change it back (I will probably just throw out the favorites menu in my mod as it is right now because it is extremely glitchy)

This comment has been minimized.

@me4502

me4502 Jun 26, 2016

Contributor

Ah, okay - I just had it shift because it's simpler to click, but your choice.

{
if (Favorite::Ref().IsFavorite(tool->GetIdentifier()) && sender->GetSelectionState() == 1)
{
Favorite::Ref().GetFavoritesList()->erase(std::remove(Favorite::Ref().GetFavoritesList()->begin(), Favorite::Ref().GetFavoritesList()->end(),
tool->GetIdentifier()), Favorite::Ref().GetFavoritesList()->end());
}
else if (sender->GetSelectionState() == 0)
Favorite::Ref().GetFavoritesList()->push_back(tool->GetIdentifier());
else if (sender->GetSelectionState() == 2)
@@ -728,7 +730,6 @@ void GameView::NotifyLastToolChanged(GameModel * sender)
void GameView::NotifyToolListChanged(GameModel * sender)
{
lastOffset = 0;
int currentX = WINDOWW-56;
for (size_t i = 0; i < menuButtons.size(); i++)
{
@@ -795,6 +796,11 @@ void GameView::NotifyToolListChanged(GameModel * sender)
}
if (sender->GetActiveMenu() != SC_DECO)
lastMenu = sender->GetActiveMenu();
// don't reset scroll back to 0
int origOffset = lastOffset;
lastOffset = 0;
setToolButtonOffset(origOffset);
}
void GameView::NotifyColourSelectorVisibilityChanged(GameModel * sender)

0 comments on commit 4190946

Please sign in to comment.