From a7550bc8bb23fc49d5e549439060e635374df1f9 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 1 Mar 2015 18:13:06 +0000 Subject: [PATCH] Add window expand on Alt+W --- src/Editor.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Editor.cpp b/src/Editor.cpp index 62baca3..85deabd 100644 --- a/src/Editor.cpp +++ b/src/Editor.cpp @@ -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;