mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-27 04:10:24 +00:00
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
This commit is contained in:
commit
3fcf3aca77
9 changed files with 39 additions and 15 deletions
|
@ -136,6 +136,7 @@ namespace MWBase
|
||||||
|
|
||||||
virtual bool isConsoleMode() const = 0;
|
virtual bool isConsoleMode() const = 0;
|
||||||
virtual bool isPostProcessorHudVisible() const = 0;
|
virtual bool isPostProcessorHudVisible() const = 0;
|
||||||
|
virtual bool isSettingsWindowVisible() const = 0;
|
||||||
virtual bool isInteractiveMessageBoxActive() const = 0;
|
virtual bool isInteractiveMessageBoxActive() const = 0;
|
||||||
|
|
||||||
virtual void toggleVisible(MWGui::GuiWindow wnd) = 0;
|
virtual void toggleVisible(MWGui::GuiWindow wnd) = 0;
|
||||||
|
@ -157,7 +158,6 @@ namespace MWBase
|
||||||
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
|
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
|
||||||
virtual MWGui::TradeWindow* getTradeWindow() = 0;
|
virtual MWGui::TradeWindow* getTradeWindow() = 0;
|
||||||
virtual MWGui::PostProcessorHud* getPostProcessorHud() = 0;
|
virtual MWGui::PostProcessorHud* getPostProcessorHud() = 0;
|
||||||
virtual MWGui::SettingsWindow* getSettingsWindow() = 0;
|
|
||||||
|
|
||||||
/// Make the player use an item, while updating GUI state accordingly
|
/// Make the player use an item, while updating GUI state accordingly
|
||||||
virtual void useItem(const MWWorld::Ptr& item, bool force = false) = 0;
|
virtual void useItem(const MWWorld::Ptr& item, bool force = false) = 0;
|
||||||
|
@ -342,6 +342,7 @@ namespace MWBase
|
||||||
virtual void toggleConsole() = 0;
|
virtual void toggleConsole() = 0;
|
||||||
virtual void toggleDebugWindow() = 0;
|
virtual void toggleDebugWindow() = 0;
|
||||||
virtual void togglePostProcessorHud() = 0;
|
virtual void togglePostProcessorHud() = 0;
|
||||||
|
virtual void toggleSettingsWindow() = 0;
|
||||||
|
|
||||||
/// Cycle to next or previous spell
|
/// Cycle to next or previous spell
|
||||||
virtual void cycleSpell(bool next) = 0;
|
virtual void cycleSpell(bool next) = 0;
|
||||||
|
|
|
@ -99,7 +99,7 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
else if (name == "options")
|
else if (name == "options")
|
||||||
{
|
{
|
||||||
winMgr->getSettingsWindow()->setVisible(true);
|
winMgr->toggleSettingsWindow();
|
||||||
}
|
}
|
||||||
else if (name == "credits")
|
else if (name == "credits")
|
||||||
winMgr->playVideo("mw_credits.bik", true);
|
winMgr->playVideo("mw_credits.bik", true);
|
||||||
|
@ -212,6 +212,12 @@ namespace MWGui
|
||||||
|
|
||||||
bool MainMenu::exit()
|
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;
|
return MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_Running;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,7 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsWindow::SettingsWindow()
|
SettingsWindow::SettingsWindow()
|
||||||
: WindowModal("openmw_settings_window.layout")
|
: WindowBase("openmw_settings_window.layout")
|
||||||
, mKeyboardMode(true)
|
, mKeyboardMode(true)
|
||||||
, mCurrentPage(-1)
|
, mCurrentPage(-1)
|
||||||
{
|
{
|
||||||
|
@ -1042,8 +1042,6 @@ namespace MWGui
|
||||||
|
|
||||||
void SettingsWindow::onOpen()
|
void SettingsWindow::onOpen()
|
||||||
{
|
{
|
||||||
WindowModal::onOpen();
|
|
||||||
|
|
||||||
highlightCurrentResolution();
|
highlightCurrentResolution();
|
||||||
updateControlsBox();
|
updateControlsBox();
|
||||||
updateLightSettings();
|
updateLightSettings();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
class SettingsWindow : public WindowModal
|
class SettingsWindow : public WindowBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SettingsWindow();
|
SettingsWindow();
|
||||||
|
|
|
@ -914,6 +914,9 @@ namespace MWGui
|
||||||
if (isConsoleMode())
|
if (isConsoleMode())
|
||||||
mConsole->onFrame(frameDuration);
|
mConsole->onFrame(frameDuration);
|
||||||
|
|
||||||
|
if (isSettingsWindowVisible())
|
||||||
|
mSettingsWindow->onFrame(frameDuration);
|
||||||
|
|
||||||
if (!gameRunning)
|
if (!gameRunning)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1470,10 +1473,6 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
return mPostProcessorHud;
|
return mPostProcessorHud;
|
||||||
}
|
}
|
||||||
MWGui::SettingsWindow* WindowManager::getSettingsWindow()
|
|
||||||
{
|
|
||||||
return mSettingsWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WindowManager::useItem(const MWWorld::Ptr& item, bool bypassBeastRestrictions)
|
void WindowManager::useItem(const MWWorld::Ptr& item, bool bypassBeastRestrictions)
|
||||||
{
|
{
|
||||||
|
@ -1549,6 +1548,11 @@ namespace MWGui
|
||||||
return mPostProcessorHud && mPostProcessorHud->isVisible();
|
return mPostProcessorHud && mPostProcessorHud->isVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WindowManager::isSettingsWindowVisible() const
|
||||||
|
{
|
||||||
|
return mSettingsWindow && mSettingsWindow->isVisible();
|
||||||
|
}
|
||||||
|
|
||||||
bool WindowManager::isInteractiveMessageBoxActive() const
|
bool WindowManager::isInteractiveMessageBoxActive() const
|
||||||
{
|
{
|
||||||
return mMessageBoxManager && mMessageBoxManager->isInteractiveMessageBox();
|
return mMessageBoxManager && mMessageBoxManager->isInteractiveMessageBox();
|
||||||
|
@ -2130,6 +2134,21 @@ namespace MWGui
|
||||||
updateVisible();
|
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)
|
void WindowManager::cycleSpell(bool next)
|
||||||
{
|
{
|
||||||
if (!isGuiMode())
|
if (!isGuiMode())
|
||||||
|
|
|
@ -162,6 +162,7 @@ namespace MWGui
|
||||||
|
|
||||||
bool isConsoleMode() const override;
|
bool isConsoleMode() const override;
|
||||||
bool isPostProcessorHudVisible() const override;
|
bool isPostProcessorHudVisible() const override;
|
||||||
|
bool isSettingsWindowVisible() const override;
|
||||||
bool isInteractiveMessageBoxActive() const override;
|
bool isInteractiveMessageBoxActive() const override;
|
||||||
|
|
||||||
void toggleVisible(GuiWindow wnd) override;
|
void toggleVisible(GuiWindow wnd) override;
|
||||||
|
@ -183,7 +184,6 @@ namespace MWGui
|
||||||
MWGui::ConfirmationDialog* getConfirmationDialog() override;
|
MWGui::ConfirmationDialog* getConfirmationDialog() override;
|
||||||
MWGui::TradeWindow* getTradeWindow() override;
|
MWGui::TradeWindow* getTradeWindow() override;
|
||||||
MWGui::PostProcessorHud* getPostProcessorHud() override;
|
MWGui::PostProcessorHud* getPostProcessorHud() override;
|
||||||
MWGui::SettingsWindow* getSettingsWindow() override;
|
|
||||||
|
|
||||||
/// Make the player use an item, while updating GUI state accordingly
|
/// Make the player use an item, while updating GUI state accordingly
|
||||||
void useItem(const MWWorld::Ptr& item, bool bypassBeastRestrictions = false) override;
|
void useItem(const MWWorld::Ptr& item, bool bypassBeastRestrictions = false) override;
|
||||||
|
@ -364,6 +364,7 @@ namespace MWGui
|
||||||
void toggleConsole() override;
|
void toggleConsole() override;
|
||||||
void toggleDebugWindow() override;
|
void toggleDebugWindow() override;
|
||||||
void togglePostProcessorHud() override;
|
void togglePostProcessorHud() override;
|
||||||
|
void toggleSettingsWindow() override;
|
||||||
|
|
||||||
/// Cycle to next or previous spell
|
/// Cycle to next or previous spell
|
||||||
void cycleSpell(bool next) override;
|
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
|
// 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
|
// Also do not trigger bindings when input controls are disabled, e.g. during save loading
|
||||||
const MWGui::SettingsWindow* settingsWindow
|
if (!MWBase::Environment::get().getWindowManager()->isSettingsWindowVisible() && !input->controlsDisabled())
|
||||||
= MWBase::Environment::get().getWindowManager()->getSettingsWindow();
|
|
||||||
if ((!settingsWindow || !settingsWindow->isVisible()) && !input->controlsDisabled())
|
|
||||||
{
|
{
|
||||||
mBindingsManager->mousePressed(arg, id);
|
mBindingsManager->mousePressed(arg, id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<Layer name="DrowningBar" overlapped="false" pick="false"/>
|
<Layer name="DrowningBar" overlapped="false" pick="false"/>
|
||||||
<Layer name="MainMenuBackground" overlapped="true" pick="true"/>
|
<Layer name="MainMenuBackground" overlapped="true" pick="true"/>
|
||||||
<Layer name="MainMenu" 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="LoadingScreenBackground" overlapped="false" pick="true"/>
|
||||||
<Layer name="LoadingScreen" overlapped="false" pick="true"/>
|
<Layer name="LoadingScreen" overlapped="false" pick="true"/>
|
||||||
<Layer name="Debug" overlapped="true" pick="true"/>
|
<Layer name="Debug" overlapped="true" pick="true"/>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<MyGUI type="Layout" version="3.2.0">
|
<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"/>
|
<Property key="MinSize" value="640 490"/>
|
||||||
<Widget type="TabControl" skin="TabControl" position="8 8 368 405" align="Stretch" name="SettingsTab">
|
<Widget type="TabControl" skin="TabControl" position="8 8 368 405" align="Stretch" name="SettingsTab">
|
||||||
<Property key="ButtonAutoWidth" value="true"/>
|
<Property key="ButtonAutoWidth" value="true"/>
|
||||||
|
|
Loading…
Reference in a new issue