Permalink
Browse files

Make ctrl+shift+click toggle favorite status

  • Loading branch information...
LBPHacker authored and jacob1 committed Jul 6, 2018
1 parent 27f5ba1 commit a3a3b3be1a38baef8a7289252933bef2825190f3
Showing with 19 additions and 10 deletions.
  1. +1 −1 src/gui/game/Favorite.cpp
  2. +18 −9 src/gui/game/GameView.cpp
@@ -20,7 +20,7 @@ bool Favorite::IsFavorite(ByteString identifier)
bool Favorite::AnyFavorites()
{
return favoritesList.size() == 0;
return favoritesList.size() != 0;
}
void Favorite::AddFavorite(ByteString identifier)
@@ -543,14 +543,23 @@ class GameView::ToolAction: public ui::ButtonAction
ToolButton *sender = (ToolButton*)sender_;
if (v->ShiftBehaviour() && v->CtrlBehaviour() && !v->AltBehaviour())
{
if (Favorite::Ref().IsFavorite(tool->GetIdentifier()) && sender->GetSelectionState() == 1)
if (sender->GetSelectionState() == 0)
{
if (Favorite::Ref().IsFavorite(tool->GetIdentifier()))
{
Favorite::Ref().RemoveFavorite(tool->GetIdentifier());
}
else
{
Favorite::Ref().AddFavorite(tool->GetIdentifier());
}
v->c->RebuildFavoritesMenu();
}
else if (sender->GetSelectionState() == 1)
{
Favorite::Ref().RemoveFavorite(tool->GetIdentifier());
else if (sender->GetSelectionState() == 0)
Favorite::Ref().AddFavorite(tool->GetIdentifier());
else if (sender->GetSelectionState() == 2)
v->c->SetActiveMenu(SC_FAVORITES);
v->c->RebuildFavoritesMenu();
v->c->RebuildFavoritesMenu();
}
}
else
{
@@ -612,8 +621,8 @@ void GameView::NotifyMenuListChanged(GameModel * sender)
String tempString = "";
tempString += menuList[i]->GetIcon();
String description = menuList[i]->GetDescription();
if (i == SC_FAVORITES && Favorite::Ref().AnyFavorites())
description += " (Use ctrl+shift+click to favorite an element)";
if (i == SC_FAVORITES && !Favorite::Ref().AnyFavorites())
description += " (Use ctrl+shift+click toggle the favorite status of an element)";
ui::Button * tempButton = new ui::Button(ui::Point(WINDOWW-16, currentY), ui::Point(15, 15), tempString, description);
tempButton->Appearance.Margin = ui::Border(0, 2, 3, 2);
tempButton->SetTogglable(true);

0 comments on commit a3a3b3b

Please sign in to comment.