Skip to content
This repository has been archived by the owner on Dec 3, 2020. It is now read-only.

Commit

Permalink
Add window expand on Alt+W
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Mar 1, 2015
1 parent 2b1b09e commit a7550bc
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,38 @@ bool Editor::OnEvent(const SEvent& event)
}
}

if (event.EventType == EET_KEY_INPUT_EVENT && event.KeyInput.Key < NUMBER_OF_KEYS) {
if (event.EventType == EET_KEY_INPUT_EVENT &&
event.KeyInput.Key < NUMBER_OF_KEYS) {
if (event.KeyInput.PressedDown) {
state->keys[event.KeyInput.Key] = EKS_DOWN;
} else {
state->keys[event.KeyInput.Key] = EKS_UP;
}

if (event.KeyInput.PressedDown &&
event.KeyInput.Key == KEY_KEY_W &&
state->keys[164] == EKS_DOWN) {
if (currentWindow == -1) {
IVideoDriver *driver = state->device->getVideoDriver();
int ResX = driver->getScreenSize().Width;
if (!state->settings->getBool("hide_sidebar"))
ResX -= 256;
int ResY = driver->getScreenSize().Height;

if (state->mouse_position.X > ResX / 2)
if (state->mouse_position.Y > ResY / 2)
currentWindow = 3;
else
currentWindow = 1;
else
if (state->mouse_position.Y > ResY / 2)
currentWindow = 2;
else
currentWindow = 0;
} else
currentWindow = -1;
}

if (state->device->getGUIEnvironment()->getFocus() &&
state->device->getGUIEnvironment()->getFocus()->getType() == EGUIET_EDIT_BOX)
return false;
Expand Down

0 comments on commit a7550bc

Please sign in to comment.