mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 16:19:41 +00:00
Make console to do not hide other GUI windows (bug #1515)
This commit is contained in:
parent
4d292425b3
commit
1ce370e7fa
11 changed files with 64 additions and 39 deletions
|
@ -1,6 +1,7 @@
|
||||||
0.46.0
|
0.46.0
|
||||||
------
|
------
|
||||||
|
|
||||||
|
Bug #1515: Opening console masks dialogue, inventory menu
|
||||||
Bug #2969: Scripted items can stack
|
Bug #2969: Scripted items can stack
|
||||||
Bug #2987: Editor: some chance and AI data fields can overflow
|
Bug #2987: Editor: some chance and AI data fields can overflow
|
||||||
Bug #3006: 'else if' operator breaks script compilation
|
Bug #3006: 'else if' operator breaks script compilation
|
||||||
|
|
|
@ -333,6 +333,7 @@ namespace MWBase
|
||||||
virtual void activateHitOverlay(bool interrupt=true) = 0;
|
virtual void activateHitOverlay(bool interrupt=true) = 0;
|
||||||
virtual void setWerewolfOverlay(bool set) = 0;
|
virtual void setWerewolfOverlay(bool set) = 0;
|
||||||
|
|
||||||
|
virtual void toggleConsole() = 0;
|
||||||
virtual void toggleDebugWindow() = 0;
|
virtual void toggleDebugWindow() = 0;
|
||||||
|
|
||||||
/// Cycle to next or previous spell
|
/// Cycle to next or previous spell
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <MyGUI_EditBox.h>
|
#include <MyGUI_EditBox.h>
|
||||||
#include <MyGUI_InputManager.h>
|
#include <MyGUI_InputManager.h>
|
||||||
|
#include <MyGUI_LayerManager.h>
|
||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/filesystem/fstream.hpp>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
@ -151,8 +152,9 @@ namespace MWGui
|
||||||
void Console::onOpen()
|
void Console::onOpen()
|
||||||
{
|
{
|
||||||
// Give keyboard focus to the combo box whenever the console is
|
// Give keyboard focus to the combo box whenever the console is
|
||||||
// turned on
|
// turned on and place it over other widgets
|
||||||
MyGUI::InputManager::getInstance().setKeyFocusWidget(mCommandLine);
|
MyGUI::InputManager::getInstance().setKeyFocusWidget(mCommandLine);
|
||||||
|
MyGUI::LayerManager::getInstance().upLayerItem(mMainWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Console::print(const std::string &msg, const std::string& color)
|
void Console::print(const std::string &msg, const std::string& color)
|
||||||
|
|
|
@ -234,6 +234,7 @@ namespace MWGui
|
||||||
if (!MWBase::Environment::get().getWindowManager ()->isGuiMode ())
|
if (!MWBase::Environment::get().getWindowManager ()->isGuiMode ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();
|
||||||
if (mDragAndDrop->mIsOnDragAndDrop)
|
if (mDragAndDrop->mIsOnDragAndDrop)
|
||||||
{
|
{
|
||||||
// drop item into the gameworld
|
// drop item into the gameworld
|
||||||
|
@ -248,24 +249,24 @@ namespace MWGui
|
||||||
WorldItemModel drop (mouseX, mouseY);
|
WorldItemModel drop (mouseX, mouseY);
|
||||||
mDragAndDrop->drop(&drop, nullptr);
|
mDragAndDrop->drop(&drop, nullptr);
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->changePointer("arrow");
|
winMgr->changePointer("arrow");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GuiMode mode = MWBase::Environment::get().getWindowManager()->getMode();
|
GuiMode mode = winMgr->getMode();
|
||||||
|
|
||||||
if ( (mode != GM_Console) && (mode != GM_Container) && (mode != GM_Inventory) )
|
if (!winMgr->isConsoleMode() && (mode != GM_Container) && (mode != GM_Inventory))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MWWorld::Ptr object = MWBase::Environment::get().getWorld()->getFacedObject();
|
MWWorld::Ptr object = MWBase::Environment::get().getWorld()->getFacedObject();
|
||||||
|
|
||||||
if (mode == GM_Console)
|
if (winMgr->isConsoleMode())
|
||||||
MWBase::Environment::get().getWindowManager()->setConsoleSelectedObject(object);
|
winMgr->setConsoleSelectedObject(object);
|
||||||
else //if ((mode == GM_Container) || (mode == GM_Inventory))
|
else //if ((mode == GM_Container) || (mode == GM_Inventory))
|
||||||
{
|
{
|
||||||
// pick up object
|
// pick up object
|
||||||
if (!object.isEmpty())
|
if (!object.isEmpty())
|
||||||
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->pickUpObject(object);
|
winMgr->getInventoryWindow()->pickUpObject(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ namespace MWGui
|
||||||
GM_Companion,
|
GM_Companion,
|
||||||
GM_MainMenu, // Main menu mode
|
GM_MainMenu, // Main menu mode
|
||||||
|
|
||||||
GM_Console, // Console mode
|
|
||||||
GM_Journal, // Journal mode
|
GM_Journal, // Journal mode
|
||||||
|
|
||||||
GM_Scroll, // Read scroll
|
GM_Scroll, // Read scroll
|
||||||
|
|
|
@ -94,17 +94,19 @@ namespace MWGui
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool guiMode = MWBase::Environment::get().getWindowManager()->isGuiMode();
|
MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();
|
||||||
|
bool guiMode = winMgr->isGuiMode();
|
||||||
|
|
||||||
if (guiMode)
|
if (guiMode)
|
||||||
{
|
{
|
||||||
if (!MWBase::Environment::get().getWindowManager()->getCursorVisible())
|
if (!winMgr->getCursorVisible())
|
||||||
return;
|
return;
|
||||||
const MyGUI::IntPoint& mousePos = MyGUI::InputManager::getInstance().getMousePosition();
|
const MyGUI::IntPoint& mousePos = MyGUI::InputManager::getInstance().getMousePosition();
|
||||||
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getWorldMouseOver() && ((MWBase::Environment::get().getWindowManager()->getMode() == GM_Console)
|
if (winMgr->getWorldMouseOver() &&
|
||||||
|| (MWBase::Environment::get().getWindowManager()->getMode() == GM_Container)
|
(winMgr->isConsoleMode() ||
|
||||||
|| (MWBase::Environment::get().getWindowManager()->getMode() == GM_Inventory)))
|
(winMgr->getMode() == GM_Container) ||
|
||||||
|
(winMgr->getMode() == GM_Inventory)))
|
||||||
{
|
{
|
||||||
if (mFocusObject.isEmpty ())
|
if (mFocusObject.isEmpty ())
|
||||||
return;
|
return;
|
||||||
|
@ -112,7 +114,7 @@ namespace MWGui
|
||||||
const MWWorld::Class& objectclass = mFocusObject.getClass();
|
const MWWorld::Class& objectclass = mFocusObject.getClass();
|
||||||
|
|
||||||
MyGUI::IntSize tooltipSize;
|
MyGUI::IntSize tooltipSize;
|
||||||
if ((!objectclass.hasToolTip(mFocusObject))&&(MWBase::Environment::get().getWindowManager()->getMode() == GM_Console))
|
if (!objectclass.hasToolTip(mFocusObject) && winMgr->isConsoleMode())
|
||||||
{
|
{
|
||||||
setCoord(0, 0, 300, 300);
|
setCoord(0, 0, 300, 300);
|
||||||
mDynamicToolTipBox->setVisible(true);
|
mDynamicToolTipBox->setVisible(true);
|
||||||
|
@ -212,7 +214,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
MyGUI::IntCoord avatarPos = focus->getAbsoluteCoord();
|
MyGUI::IntCoord avatarPos = focus->getAbsoluteCoord();
|
||||||
MyGUI::IntPoint relMousePos = MyGUI::InputManager::getInstance ().getMousePosition () - MyGUI::IntPoint(avatarPos.left, avatarPos.top);
|
MyGUI::IntPoint relMousePos = MyGUI::InputManager::getInstance ().getMousePosition () - MyGUI::IntPoint(avatarPos.left, avatarPos.top);
|
||||||
MWWorld::Ptr item = MWBase::Environment::get().getWindowManager()->getInventoryWindow ()->getAvatarSelectedItem (relMousePos.left, relMousePos.top);
|
MWWorld::Ptr item = winMgr->getInventoryWindow ()->getAvatarSelectedItem (relMousePos.left, relMousePos.top);
|
||||||
|
|
||||||
mFocusObject = item;
|
mFocusObject = item;
|
||||||
if (!mFocusObject.isEmpty ())
|
if (!mFocusObject.isEmpty ())
|
||||||
|
|
|
@ -445,7 +445,6 @@ namespace MWGui
|
||||||
mConsole = new Console(w,h, mConsoleOnlyScripts);
|
mConsole = new Console(w,h, mConsoleOnlyScripts);
|
||||||
mWindows.push_back(mConsole);
|
mWindows.push_back(mConsole);
|
||||||
trackWindow(mConsole, "console");
|
trackWindow(mConsole, "console");
|
||||||
mGuiModeStates[GM_Console] = GuiModeState(mConsole);
|
|
||||||
|
|
||||||
bool questList = mResourceSystem->getVFS()->exists("textures/tx_menubook_options_over.dds");
|
bool questList = mResourceSystem->getVFS()->exists("textures/tx_menubook_options_over.dds");
|
||||||
JournalWindow* journal = JournalWindow::create(JournalViewModel::create (), questList, mEncoding);
|
JournalWindow* journal = JournalWindow::create(JournalViewModel::create (), questList, mEncoding);
|
||||||
|
@ -711,10 +710,10 @@ namespace MWGui
|
||||||
// If in game mode (or interactive messagebox), show the pinned windows
|
// If in game mode (or interactive messagebox), show the pinned windows
|
||||||
if (mGuiModes.empty())
|
if (mGuiModes.empty())
|
||||||
{
|
{
|
||||||
mMap->setVisible(mMap->pinned() && !(mForceHidden & GW_Map) && (mAllowed & GW_Map));
|
mMap->setVisible(mMap->pinned() && !isConsoleMode() && !(mForceHidden & GW_Map) && (mAllowed & GW_Map));
|
||||||
mStatsWindow->setVisible(mStatsWindow->pinned() && !(mForceHidden & GW_Stats) && (mAllowed & GW_Stats));
|
mStatsWindow->setVisible(mStatsWindow->pinned() && !isConsoleMode() && !(mForceHidden & GW_Stats) && (mAllowed & GW_Stats));
|
||||||
mInventoryWindow->setVisible(mInventoryWindow->pinned() && !(mForceHidden & GW_Inventory) && (mAllowed & GW_Inventory));
|
mInventoryWindow->setVisible(mInventoryWindow->pinned() && !isConsoleMode() && !(mForceHidden & GW_Inventory) && (mAllowed & GW_Inventory));
|
||||||
mSpellWindow->setVisible(mSpellWindow->pinned() && !(mForceHidden & GW_Magic) && (mAllowed & GW_Magic));
|
mSpellWindow->setVisible(mSpellWindow->pinned() && !isConsoleMode() && !(mForceHidden & GW_Magic) && (mAllowed & GW_Magic));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (getMode() != GM_Inventory)
|
else if (getMode() != GM_Inventory)
|
||||||
|
@ -1320,6 +1319,10 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
updateVisible();
|
updateVisible();
|
||||||
|
|
||||||
|
// To make sure that console window get focus again
|
||||||
|
if (mConsole && mConsole->isVisible())
|
||||||
|
mConsole->onOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::removeGuiMode(GuiMode mode, bool noSound)
|
void WindowManager::removeGuiMode(GuiMode mode, bool noSound)
|
||||||
|
@ -1529,14 +1532,15 @@ namespace MWGui
|
||||||
|
|
||||||
bool WindowManager::isGuiMode() const
|
bool WindowManager::isGuiMode() const
|
||||||
{
|
{
|
||||||
return !mGuiModes.empty() || (mMessageBoxManager && mMessageBoxManager->isInteractiveMessageBox());
|
return
|
||||||
|
!mGuiModes.empty() ||
|
||||||
|
isConsoleMode() ||
|
||||||
|
(mMessageBoxManager && mMessageBoxManager->isInteractiveMessageBox());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WindowManager::isConsoleMode() const
|
bool WindowManager::isConsoleMode() const
|
||||||
{
|
{
|
||||||
if (!mGuiModes.empty() && mGuiModes.back()==GM_Console)
|
return mConsole && mConsole->isVisible();
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MWGui::GuiMode WindowManager::getMode() const
|
MWGui::GuiMode WindowManager::getMode() const
|
||||||
|
@ -1836,6 +1840,7 @@ namespace MWGui
|
||||||
bool WindowManager::isSavingAllowed() const
|
bool WindowManager::isSavingAllowed() const
|
||||||
{
|
{
|
||||||
return !MyGUI::InputManager::getInstance().isModalAny()
|
return !MyGUI::InputManager::getInstance().isModalAny()
|
||||||
|
&& !isConsoleMode()
|
||||||
// TODO: remove this, once we have properly serialized the state of open windows
|
// TODO: remove this, once we have properly serialized the state of open windows
|
||||||
&& (!isGuiMode() || (mGuiModes.size() == 1 && (getMode() == GM_MainMenu || getMode() == GM_Rest)));
|
&& (!isGuiMode() || (mGuiModes.size() == 1 && (getMode() == GM_MainMenu || getMode() == GM_Rest)));
|
||||||
}
|
}
|
||||||
|
@ -2083,6 +2088,21 @@ namespace MWGui
|
||||||
SDL_free(text);
|
SDL_free(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::toggleConsole()
|
||||||
|
{
|
||||||
|
bool visible = mConsole->isVisible();
|
||||||
|
|
||||||
|
if (!visible && !mGuiModes.empty())
|
||||||
|
mKeyboardNavigation->saveFocus(mGuiModes.back());
|
||||||
|
|
||||||
|
mConsole->setVisible(!visible);
|
||||||
|
|
||||||
|
if (visible && !mGuiModes.empty())
|
||||||
|
mKeyboardNavigation->restoreFocus(mGuiModes.back());
|
||||||
|
|
||||||
|
updateVisible();
|
||||||
|
}
|
||||||
|
|
||||||
void WindowManager::toggleDebugWindow()
|
void WindowManager::toggleDebugWindow()
|
||||||
{
|
{
|
||||||
mDebugWindow->setVisible(!mDebugWindow->isVisible());
|
mDebugWindow->setVisible(!mDebugWindow->isVisible());
|
||||||
|
|
|
@ -361,6 +361,7 @@ namespace MWGui
|
||||||
virtual void activateHitOverlay(bool interrupt);
|
virtual void activateHitOverlay(bool interrupt);
|
||||||
virtual void setWerewolfOverlay(bool set);
|
virtual void setWerewolfOverlay(bool set);
|
||||||
|
|
||||||
|
virtual void toggleConsole();
|
||||||
virtual void toggleDebugWindow();
|
virtual void toggleDebugWindow();
|
||||||
|
|
||||||
/// Cycle to next or previous spell
|
/// Cycle to next or previous spell
|
||||||
|
|
|
@ -495,7 +495,7 @@ namespace MWInput
|
||||||
void InputManager::updateCursorMode()
|
void InputManager::updateCursorMode()
|
||||||
{
|
{
|
||||||
bool grab = !MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu)
|
bool grab = !MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu)
|
||||||
&& MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Console;
|
&& !MWBase::Environment::get().getWindowManager()->isConsoleMode();
|
||||||
|
|
||||||
bool was_relative = mInputManager->getMouseRelative();
|
bool was_relative = mInputManager->getMouseRelative();
|
||||||
bool is_relative = !MWBase::Environment::get().getWindowManager()->isGuiMode();
|
bool is_relative = !MWBase::Environment::get().getWindowManager()->isGuiMode();
|
||||||
|
@ -864,7 +864,7 @@ namespace MWInput
|
||||||
OIS::KeyCode kc = mInputManager->sdl2OISKeyCode(arg.keysym.sym);
|
OIS::KeyCode kc = mInputManager->sdl2OISKeyCode(arg.keysym.sym);
|
||||||
if (mInputBinder->getKeyBinding(mInputBinder->getControl(A_Console), ICS::Control::INCREASE)
|
if (mInputBinder->getKeyBinding(mInputBinder->getControl(A_Console), ICS::Control::INCREASE)
|
||||||
== arg.keysym.scancode
|
== arg.keysym.scancode
|
||||||
&& MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Console)
|
&& MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
||||||
SDL_StopTextInput();
|
SDL_StopTextInput();
|
||||||
|
|
||||||
bool consumed = false;
|
bool consumed = false;
|
||||||
|
@ -1152,6 +1152,9 @@ namespace MWInput
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
||||||
|
return;
|
||||||
|
|
||||||
bool inGame = MWBase::Environment::get().getStateManager()->getState() != MWBase::StateManager::State_NoGame;
|
bool inGame = MWBase::Environment::get().getStateManager()->getState() != MWBase::StateManager::State_NoGame;
|
||||||
MWGui::GuiMode mode = MWBase::Environment::get().getWindowManager()->getMode();
|
MWGui::GuiMode mode = MWBase::Environment::get().getWindowManager()->getMode();
|
||||||
|
|
||||||
|
@ -1170,6 +1173,9 @@ namespace MWInput
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
||||||
|
return;
|
||||||
|
|
||||||
MWGui::GuiMode mode = MWBase::Environment::get().getWindowManager()->getMode();
|
MWGui::GuiMode mode = MWBase::Environment::get().getWindowManager()->getMode();
|
||||||
bool inGame = MWBase::Environment::get().getStateManager()->getState() != MWBase::StateManager::State_NoGame;
|
bool inGame = MWBase::Environment::get().getStateManager()->getState() != MWBase::StateManager::State_NoGame;
|
||||||
|
|
||||||
|
@ -1284,6 +1290,9 @@ namespace MWInput
|
||||||
if (MyGUI::InputManager::getInstance ().isModalAny())
|
if (MyGUI::InputManager::getInstance ().isModalAny())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (MWBase::Environment::get().getWindowManager()->isConsoleMode())
|
||||||
|
return;
|
||||||
|
|
||||||
// Toggle between game mode and inventory mode
|
// Toggle between game mode and inventory mode
|
||||||
if(!MWBase::Environment::get().getWindowManager()->isGuiMode())
|
if(!MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Inventory);
|
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Inventory);
|
||||||
|
@ -1302,17 +1311,7 @@ namespace MWInput
|
||||||
if (MyGUI::InputManager::getInstance ().isModalAny())
|
if (MyGUI::InputManager::getInstance ().isModalAny())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Switch to console mode no matter what mode we are currently
|
MWBase::Environment::get().getWindowManager()->toggleConsole();
|
||||||
// in, except of course if we are already in console mode
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
|
||||||
{
|
|
||||||
if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Console)
|
|
||||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
|
||||||
else
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Console);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Console);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputManager::toggleJournal()
|
void InputManager::toggleJournal()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<MyGUI type="Layout">
|
<MyGUI type="Layout">
|
||||||
<Widget type="Window" skin="MW_Window" position="0 0 400 400" layer="Console" name="_Main">
|
<Widget type="Window" skin="MW_Window" position="0 0 400 400" layer="Windows" name="_Main">
|
||||||
<Property key="Caption" value="#{sConsoleTitle}"/>
|
<Property key="Caption" value="#{sConsoleTitle}"/>
|
||||||
<Property key="MinSize" value="40 40"/>
|
<Property key="MinSize" value="40 40"/>
|
||||||
<Property key="Visible" value="false"/>
|
<Property key="Visible" value="false"/>
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
<Layer name="JournalBooks" type="ScalingLayer" pick="true">
|
<Layer name="JournalBooks" type="ScalingLayer" pick="true">
|
||||||
<Property key="Size" value="600 520"/>
|
<Property key="Size" value="600 520"/>
|
||||||
</Layer>
|
</Layer>
|
||||||
<Layer name="Console" overlapped="false" pick="true"/>
|
|
||||||
<Layer name="Debug" overlapped="true" pick="true"/>
|
<Layer name="Debug" overlapped="true" pick="true"/>
|
||||||
<Layer name="Notification" overlapped="false" pick="false"/>
|
<Layer name="Notification" overlapped="false" pick="false"/>
|
||||||
<Layer name="Popup" overlapped="true" pick="true"/>
|
<Layer name="Popup" overlapped="true" pick="true"/>
|
||||||
|
|
Loading…
Reference in a new issue