mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-22 03:13:15 -04:00
fixed a tooltip bug in spell creation and made controller tooltip toggling a helper function in the window manager
This commit is contained in:
parent
81fc72a5b8
commit
072504d3b7
@ -396,6 +396,8 @@ namespace MWBase
|
||||
virtual void setControllerTooltipVisible(bool visible) = 0;
|
||||
virtual bool getControllerTooltipEnabled() const = 0;
|
||||
virtual void setControllerTooltipEnabled(bool enabled) = 0;
|
||||
/// Restore tooltip visibility if user has them enabled but they were hidden by mouse movement
|
||||
virtual void restoreControllerTooltips() = 0;
|
||||
virtual void updateControllerButtonsOverlay() = 0;
|
||||
|
||||
// Used in Lua bindings
|
||||
|
@ -223,34 +223,26 @@ namespace MWGui
|
||||
updateControllerFocus(-1, mControllerFocus);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_UP:
|
||||
// Restore tooltip visibility if user has them enabled but they were hidden by mouse
|
||||
if (winMgr->getControllerTooltipEnabled() && !winMgr->getControllerTooltipVisible())
|
||||
winMgr->setControllerTooltipVisible(true);
|
||||
winMgr->restoreControllerTooltips();
|
||||
if (mControllerFocus % mRows == 0)
|
||||
mControllerFocus = std::min(mControllerFocus + mRows - 1, mItemCount - 1);
|
||||
else
|
||||
mControllerFocus--;
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_DOWN:
|
||||
// Restore tooltip visibility if user has them enabled but they were hidden by mouse
|
||||
if (winMgr->getControllerTooltipEnabled() && !winMgr->getControllerTooltipVisible())
|
||||
winMgr->setControllerTooltipVisible(true);
|
||||
winMgr->restoreControllerTooltips();
|
||||
if (mControllerFocus % mRows == mRows - 1 || mControllerFocus == mItemCount - 1)
|
||||
mControllerFocus -= mControllerFocus % mRows;
|
||||
else
|
||||
mControllerFocus++;
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_LEFT:
|
||||
// Restore tooltip visibility if user has them enabled but they were hidden by mouse
|
||||
if (winMgr->getControllerTooltipEnabled() && !winMgr->getControllerTooltipVisible())
|
||||
winMgr->setControllerTooltipVisible(true);
|
||||
winMgr->restoreControllerTooltips();
|
||||
if (mControllerFocus >= mRows)
|
||||
mControllerFocus -= mRows;
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_RIGHT:
|
||||
// Restore tooltip visibility if user has them enabled but they were hidden by mouse
|
||||
if (winMgr->getControllerTooltipEnabled() && !winMgr->getControllerTooltipVisible())
|
||||
winMgr->setControllerTooltipVisible(true);
|
||||
winMgr->restoreControllerTooltips();
|
||||
if (mControllerFocus + mRows < mItemCount)
|
||||
mControllerFocus += mRows;
|
||||
else if (mControllerFocus / mRows != (mItemCount - 1) / mRows)
|
||||
@ -297,10 +289,8 @@ namespace MWGui
|
||||
else
|
||||
mScrollView->setViewOffset(MyGUI::IntPoint(-42 * (column - 3), 0));
|
||||
|
||||
// Restore tooltip visibility if user has them enabled but they were hidden by mouse movement
|
||||
MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
|
||||
if (winMgr->getControllerTooltipEnabled() && !winMgr->getControllerTooltipVisible())
|
||||
winMgr->setControllerTooltipVisible(true);
|
||||
winMgr->restoreControllerTooltips();
|
||||
|
||||
if (winMgr->getControllerTooltipVisible())
|
||||
MWBase::Environment::get().getInputManager()->warpMouseToWidget(focused);
|
||||
|
@ -248,9 +248,7 @@ namespace MWGui
|
||||
}
|
||||
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
|
||||
{
|
||||
// Restore tooltip visibility if user has them enabled but they were hidden by mouse
|
||||
if (winMgr->getControllerTooltipEnabled() && !winMgr->getControllerTooltipVisible())
|
||||
winMgr->setControllerTooltipVisible(true);
|
||||
winMgr->restoreControllerTooltips();
|
||||
|
||||
if (mSpellButtons.size() <= 1)
|
||||
return true;
|
||||
@ -261,9 +259,7 @@ namespace MWGui
|
||||
}
|
||||
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
|
||||
{
|
||||
// Restore tooltip visibility if user has them enabled but they were hidden by mouse
|
||||
if (winMgr->getControllerTooltipEnabled() && !winMgr->getControllerTooltipVisible())
|
||||
winMgr->setControllerTooltipVisible(true);
|
||||
winMgr->restoreControllerTooltips();
|
||||
|
||||
if (mSpellButtons.size() <= 1)
|
||||
return true;
|
||||
|
@ -1058,7 +1058,7 @@ namespace MWGui
|
||||
else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK)
|
||||
{
|
||||
// Toggle info tooltip
|
||||
winMgr->setControllerTooltipVisible(!mRightColumn && !winMgr->getControllerTooltipVisible());
|
||||
winMgr->setControllerTooltipEnabled(!winMgr->getControllerTooltipEnabled());
|
||||
}
|
||||
else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
|
||||
{
|
||||
|
@ -367,27 +367,19 @@ namespace MWGui
|
||||
winMgr->setControllerTooltipEnabled(!winMgr->getControllerTooltipEnabled());
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_UP:
|
||||
// Restore tooltip visibility if user has them enabled but they were hidden by mouse
|
||||
if (winMgr->getControllerTooltipEnabled() && !winMgr->getControllerTooltipVisible())
|
||||
winMgr->setControllerTooltipVisible(true);
|
||||
winMgr->restoreControllerTooltips();
|
||||
mControllerFocus--;
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_DOWN:
|
||||
// Restore tooltip visibility if user has them enabled but they were hidden by mouse
|
||||
if (winMgr->getControllerTooltipEnabled() && !winMgr->getControllerTooltipVisible())
|
||||
winMgr->setControllerTooltipVisible(true);
|
||||
winMgr->restoreControllerTooltips();
|
||||
mControllerFocus++;
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_LEFT:
|
||||
// Restore tooltip visibility if user has them enabled but they were hidden by mouse
|
||||
if (winMgr->getControllerTooltipEnabled() && !winMgr->getControllerTooltipVisible())
|
||||
winMgr->setControllerTooltipVisible(true);
|
||||
winMgr->restoreControllerTooltips();
|
||||
mControllerFocus = std::max(0, mControllerFocus - 10);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_DPAD_RIGHT:
|
||||
// Restore tooltip visibility if user has them enabled but they were hidden by mouse
|
||||
if (winMgr->getControllerTooltipEnabled() && !winMgr->getControllerTooltipVisible())
|
||||
winMgr->setControllerTooltipVisible(true);
|
||||
winMgr->restoreControllerTooltips();
|
||||
mControllerFocus = std::min(mControllerFocus + 10, static_cast<int>(mButtons.size()) - 1);
|
||||
break;
|
||||
case SDL_CONTROLLER_BUTTON_LEFTSHOULDER:
|
||||
@ -463,10 +455,8 @@ namespace MWGui
|
||||
mScrollView->setViewOffset(MyGUI::IntPoint(0, -lineHeight * (line - 5)));
|
||||
}
|
||||
|
||||
// Restore tooltip visibility if user has them enabled but they were hidden by mouse movement
|
||||
MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
|
||||
if (winMgr->getControllerTooltipEnabled() && !winMgr->getControllerTooltipVisible())
|
||||
winMgr->setControllerTooltipVisible(true);
|
||||
winMgr->restoreControllerTooltips();
|
||||
|
||||
if (winMgr->getControllerTooltipVisible())
|
||||
MWBase::Environment::get().getInputManager()->warpMouseToWidget(focused);
|
||||
|
@ -2660,6 +2660,13 @@ namespace MWGui
|
||||
mControllerTooltipVisible = enabled;
|
||||
}
|
||||
|
||||
void WindowManager::restoreControllerTooltips()
|
||||
{
|
||||
// Restore tooltip visibility if user has them enabled but they were hidden by mouse movement
|
||||
if (mControllerTooltipEnabled && !mControllerTooltipVisible)
|
||||
setControllerTooltipVisible(true);
|
||||
}
|
||||
|
||||
void WindowManager::updateControllerButtonsOverlay()
|
||||
{
|
||||
if (!Settings::gui().mControllerMenus || !mControllerButtonsOverlay)
|
||||
|
@ -399,6 +399,7 @@ namespace MWGui
|
||||
void setControllerTooltipVisible(bool visible) override;
|
||||
bool getControllerTooltipEnabled() const override { return mControllerTooltipEnabled; }
|
||||
void setControllerTooltipEnabled(bool enabled) override;
|
||||
void restoreControllerTooltips() override;
|
||||
void updateControllerButtonsOverlay() override;
|
||||
|
||||
// Used in Lua bindings
|
||||
|
Loading…
x
Reference in New Issue
Block a user