Skip to content

Commit

Permalink
ctrl+p shortcut to select prop tool
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Feb 3, 2018
1 parent 3d66b7e commit 0d1c3f5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/gui/game/GameController.cpp
Expand Up @@ -1166,6 +1166,14 @@ void GameController::SetActiveTool(int toolSelection, Tool * tool)
((PropertyTool *)tool)->OpenWindow(gameModel->GetSimulation());
}

void GameController::SetActiveTool(int toolSelection, std::string identifier)
{
Tool *tool = gameModel->GetToolFromIdentifier(identifier);
if (!tool)
return;
SetActiveTool(toolSelection, tool);
}

void GameController::SetLastTool(Tool * tool)
{
gameModel->SetLastTool(tool);
Expand Down
1 change: 1 addition & 0 deletions src/gui/game/GameController.h
Expand Up @@ -109,6 +109,7 @@ class GameController: public ClientListener
void RebuildFavoritesMenu();
Tool * GetActiveTool(int selection);
void SetActiveTool(int toolSelection, Tool * tool);
void SetActiveTool(int toolSelection, std::string identifier);
void SetLastTool(Tool * tool);
int GetReplaceModeFlags();
void SetReplaceModeFlags(int flags);
Expand Down
10 changes: 9 additions & 1 deletion src/gui/game/GameView.cpp
Expand Up @@ -1481,7 +1481,15 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
break;
case 'p':
case SDLK_F2:
screenshot();
if (ctrl)
{
if (shift)
c->SetActiveTool(1, "DEFAULT_UI_PROPERTY");
else
c->SetActiveTool(0, "DEFAULT_UI_PROPERTY");
}
else
screenshot();
break;
case SDLK_F3:
SetDebugHUD(!GetDebugHUD());
Expand Down

0 comments on commit 0d1c3f5

Please sign in to comment.