Merge branch 'modalsettingsmodal' into 'master'

Reimplement the Settings window as a normal window (#7845, #7870)

Closes #7845 and #7870

See merge request OpenMW/openmw!3895
fix-osga-rotate-wildly
psi29a 9 months ago
commit 3fcf3aca77

@ -136,6 +136,7 @@ namespace MWBase
virtual bool isConsoleMode() const = 0;
virtual bool isPostProcessorHudVisible() const = 0;
virtual bool isSettingsWindowVisible() const = 0;
virtual bool isInteractiveMessageBoxActive() const = 0;
virtual void toggleVisible(MWGui::GuiWindow wnd) = 0;
@ -157,7 +158,6 @@ namespace MWBase
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
virtual MWGui::TradeWindow* getTradeWindow() = 0;
virtual MWGui::PostProcessorHud* getPostProcessorHud() = 0;
virtual MWGui::SettingsWindow* getSettingsWindow() = 0;
/// Make the player use an item, while updating GUI state accordingly
virtual void useItem(const MWWorld::Ptr& item, bool force = false) = 0;
@ -342,6 +342,7 @@ namespace MWBase
virtual void toggleConsole() = 0;
virtual void toggleDebugWindow() = 0;
virtual void togglePostProcessorHud() = 0;
virtual void toggleSettingsWindow() = 0;
/// Cycle to next or previous spell
virtual void cycleSpell(bool next) = 0;

@ -99,7 +99,7 @@ namespace MWGui
}
else if (name == "options")
{
winMgr->getSettingsWindow()->setVisible(true);
winMgr->toggleSettingsWindow();
}
else if (name == "credits")
winMgr->playVideo("mw_credits.bik", true);
@ -212,6 +212,12 @@ namespace MWGui
bool MainMenu::exit()
{
if (MWBase::Environment::get().getWindowManager()->isSettingsWindowVisible())
{
MWBase::Environment::get().getWindowManager()->toggleSettingsWindow();
return false;
}
return MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_Running;
}

@ -241,7 +241,7 @@ namespace MWGui
}
SettingsWindow::SettingsWindow()
: WindowModal("openmw_settings_window.layout")
: WindowBase("openmw_settings_window.layout")
, mKeyboardMode(true)
, mCurrentPage(-1)
{
@ -1042,8 +1042,6 @@ namespace MWGui
void SettingsWindow::onOpen()
{
WindowModal::onOpen();
highlightCurrentResolution();
updateControlsBox();
updateLightSettings();

@ -7,7 +7,7 @@
namespace MWGui
{
class SettingsWindow : public WindowModal
class SettingsWindow : public WindowBase
{
public:
SettingsWindow();

@ -914,6 +914,9 @@ namespace MWGui
if (isConsoleMode())
mConsole->onFrame(frameDuration);
if (isSettingsWindowVisible())
mSettingsWindow->onFrame(frameDuration);
if (!gameRunning)
return;
@ -1470,10 +1473,6 @@ namespace MWGui
{
return mPostProcessorHud;
}
MWGui::SettingsWindow* WindowManager::getSettingsWindow()
{
return mSettingsWindow;
}
void WindowManager::useItem(const MWWorld::Ptr& item, bool bypassBeastRestrictions)
{
@ -1549,6 +1548,11 @@ namespace MWGui
return mPostProcessorHud && mPostProcessorHud->isVisible();
}
bool WindowManager::isSettingsWindowVisible() const
{
return mSettingsWindow && mSettingsWindow->isVisible();
}
bool WindowManager::isInteractiveMessageBoxActive() const
{
return mMessageBoxManager && mMessageBoxManager->isInteractiveMessageBox();
@ -2130,6 +2134,21 @@ namespace MWGui
updateVisible();
}
void WindowManager::toggleSettingsWindow()
{
bool visible = mSettingsWindow->isVisible();
if (!visible && !mGuiModes.empty())
mKeyboardNavigation->saveFocus(mGuiModes.back());
mSettingsWindow->setVisible(!visible);
if (visible && !mGuiModes.empty())
mKeyboardNavigation->restoreFocus(mGuiModes.back());
updateVisible();
}
void WindowManager::cycleSpell(bool next)
{
if (!isGuiMode())

@ -162,6 +162,7 @@ namespace MWGui
bool isConsoleMode() const override;
bool isPostProcessorHudVisible() const override;
bool isSettingsWindowVisible() const override;
bool isInteractiveMessageBoxActive() const override;
void toggleVisible(GuiWindow wnd) override;
@ -183,7 +184,6 @@ namespace MWGui
MWGui::ConfirmationDialog* getConfirmationDialog() override;
MWGui::TradeWindow* getTradeWindow() override;
MWGui::PostProcessorHud* getPostProcessorHud() override;
MWGui::SettingsWindow* getSettingsWindow() override;
/// Make the player use an item, while updating GUI state accordingly
void useItem(const MWWorld::Ptr& item, bool bypassBeastRestrictions = false) override;
@ -364,6 +364,7 @@ namespace MWGui
void toggleConsole() override;
void toggleDebugWindow() override;
void togglePostProcessorHud() override;
void toggleSettingsWindow() override;
/// Cycle to next or previous spell
void cycleSpell(bool next) override;

@ -166,9 +166,7 @@ namespace MWInput
// Don't trigger any mouse bindings while in settings menu, otherwise rebinding controls becomes impossible
// Also do not trigger bindings when input controls are disabled, e.g. during save loading
const MWGui::SettingsWindow* settingsWindow
= MWBase::Environment::get().getWindowManager()->getSettingsWindow();
if ((!settingsWindow || !settingsWindow->isVisible()) && !input->controlsDisabled())
if (!MWBase::Environment::get().getWindowManager()->isSettingsWindowVisible() && !input->controlsDisabled())
{
mBindingsManager->mousePressed(arg, id);
}

@ -13,6 +13,7 @@
<Layer name="DrowningBar" overlapped="false" pick="false"/>
<Layer name="MainMenuBackground" overlapped="true" pick="true"/>
<Layer name="MainMenu" overlapped="true" pick="true"/>
<Layer name="Settings" overlapped="true" pick="true"/>
<Layer name="LoadingScreenBackground" overlapped="false" pick="true"/>
<Layer name="LoadingScreen" overlapped="false" pick="true"/>
<Layer name="Debug" overlapped="true" pick="true"/>

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout" version="3.2.0">
<Widget type="Window" skin="MW_Window" position="0 0 400 485" layer="MainMenu" name="_Main">
<Widget type="Window" skin="MW_Window" position="0 0 400 485" layer="Settings" name="_Main">
<Property key="MinSize" value="640 490"/>
<Widget type="TabControl" skin="TabControl" position="8 8 368 405" align="Stretch" name="SettingsTab">
<Property key="ButtonAutoWidth" value="true"/>

Loading…
Cancel
Save