diff --git a/apps/launcher/settingspage.cpp b/apps/launcher/settingspage.cpp
index 294c2c09f3..dfddc45bc5 100644
--- a/apps/launcher/settingspage.cpp
+++ b/apps/launcher/settingspage.cpp
@@ -304,9 +304,6 @@ bool Launcher::SettingsPage::loadSettings()
loadSettingBool(Settings::gui().mColorTopicEnable, *changeDialogTopicsCheckBox);
showOwnedComboBox->setCurrentIndex(Settings::game().mShowOwned);
loadSettingBool(Settings::gui().mStretchMenuBackground, *stretchBackgroundCheckBox);
- connect(controllerMenusCheckBox, &QCheckBox::toggled, this, &SettingsPage::slotControllerMenusToggled);
- loadSettingBool(Settings::gui().mControllerMenus, *controllerMenusCheckBox);
- loadSettingBool(Settings::gui().mControllerTooltips, *controllerMenuTooltipsCheckBox);
loadSettingBool(Settings::map().mAllowZooming, *useZoomOnMapCheckBox);
loadSettingBool(Settings::game().mGraphicHerbalism, *graphicHerbalismCheckBox);
scalingSpinBox->setValue(Settings::gui().mScalingFactor);
@@ -500,8 +497,6 @@ void Launcher::SettingsPage::saveSettings()
saveSettingBool(*changeDialogTopicsCheckBox, Settings::gui().mColorTopicEnable);
saveSettingInt(*showOwnedComboBox, Settings::game().mShowOwned);
saveSettingBool(*stretchBackgroundCheckBox, Settings::gui().mStretchMenuBackground);
- saveSettingBool(*controllerMenusCheckBox, Settings::gui().mControllerMenus);
- saveSettingBool(*controllerMenuTooltipsCheckBox, Settings::gui().mControllerTooltips);
saveSettingBool(*useZoomOnMapCheckBox, Settings::map().mAllowZooming);
saveSettingBool(*graphicHerbalismCheckBox, Settings::game().mGraphicHerbalism);
Settings::gui().mScalingFactor.set(scalingSpinBox->value());
@@ -560,11 +555,6 @@ void Launcher::SettingsPage::slotAnimSourcesToggled(bool checked)
}
}
-void Launcher::SettingsPage::slotControllerMenusToggled(bool checked)
-{
- controllerMenuTooltipsCheckBox->setEnabled(checked);
-}
-
void Launcher::SettingsPage::slotPostProcessToggled(bool checked)
{
postprocessTransparentPostpassCheckBox->setEnabled(checked);
diff --git a/apps/launcher/settingspage.hpp b/apps/launcher/settingspage.hpp
index 2c6eca477a..d2bb80d86a 100644
--- a/apps/launcher/settingspage.hpp
+++ b/apps/launcher/settingspage.hpp
@@ -34,7 +34,6 @@ namespace Launcher
void slotSkyBlendingToggled(bool checked);
void slotShadowDistLimitToggled(bool checked);
void slotDistantLandToggled(bool checked);
- void slotControllerMenusToggled(bool checked);
private:
Config::GameSettings& mGameSettings;
diff --git a/apps/launcher/ui/settingspage.ui b/apps/launcher/ui/settingspage.ui
index aace4b49c7..e792ac2843 100644
--- a/apps/launcher/ui/settingspage.ui
+++ b/apps/launcher/ui/settingspage.ui
@@ -1398,29 +1398,6 @@
- -
-
-
- <html><head/><body><p>Make it easier to use game menus with a controller.</p></body></html>
-
-
- Enable Controller Menus
-
-
-
- -
-
-
- false
-
-
- <html><head/><body><p>When using controller menus, make tooltips visible by default.</p></body></html>
-
-
- Show Controller Tooltips By Default
-
-
-
-
diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt
index 39fe9c4f7a..e3629d6f27 100644
--- a/apps/openmw/CMakeLists.txt
+++ b/apps/openmw/CMakeLists.txt
@@ -44,7 +44,7 @@ add_openmw_dir (mwgui
tradeitemmodel companionitemmodel pickpocketitemmodel controllers savegamedialog
recharge mode videowidget backgroundimage itemwidget screenfader debugwindow spellmodel spellview
draganddrop timeadvancer jailscreen itemchargeview keyboardnavigation textcolours statswatcher
- postprocessorhud settings controllerbuttonsoverlay inventorytabsoverlay
+ postprocessorhud settings
)
add_openmw_dir (mwdialogue
diff --git a/apps/openmw/mwbase/inputmanager.hpp b/apps/openmw/mwbase/inputmanager.hpp
index f5adc42340..5ee20476b3 100644
--- a/apps/openmw/mwbase/inputmanager.hpp
+++ b/apps/openmw/mwbase/inputmanager.hpp
@@ -5,7 +5,6 @@
#include
#include
-#include
#include
#include
@@ -62,7 +61,6 @@ namespace MWBase
virtual float getControllerAxisValue(SDL_GameControllerAxis axis) const = 0; // returns value in range [-1, 1]
virtual int getMouseMoveX() const = 0;
virtual int getMouseMoveY() const = 0;
- virtual void warpMouseToWidget(MyGUI::Widget* widget) = 0;
/// Actions available for binding to keyboard buttons
virtual const std::initializer_list& getActionKeySorting() = 0;
diff --git a/apps/openmw/mwbase/windowmanager.hpp b/apps/openmw/mwbase/windowmanager.hpp
index 83a714cf05..8164501b4b 100644
--- a/apps/openmw/mwbase/windowmanager.hpp
+++ b/apps/openmw/mwbase/windowmanager.hpp
@@ -11,9 +11,7 @@
#include
-#include "../mwgui/hud.hpp"
#include "../mwgui/mode.hpp"
-#include "../mwgui/windowbase.hpp"
#include
@@ -159,9 +157,7 @@ namespace MWBase
virtual MWGui::CountDialog* getCountDialog() = 0;
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
virtual MWGui::TradeWindow* getTradeWindow() = 0;
- virtual MWGui::HUD* getHud() = 0;
virtual MWGui::PostProcessorHud* getPostProcessorHud() = 0;
- virtual std::vector getGuiModeWindows(MWGui::GuiMode mode) = 0;
/// Make the player use an item, while updating GUI state accordingly
virtual void useItem(const MWWorld::Ptr& item, bool force = false) = 0;
@@ -385,15 +381,6 @@ namespace MWBase
/// Same as viewer->getCamera()->getCullMask(), provided for consistency.
virtual uint32_t getCullMask() = 0;
- /// Return the window that should receive controller events
- virtual MWGui::WindowBase* getActiveControllerWindow() = 0;
- /// Cycle to the next window to receive controller events
- virtual void cycleActiveControllerWindow(bool next) = 0;
- virtual void setActiveControllerWindow(MWGui::GuiMode mode, int activeIndex) = 0;
- virtual bool getControllerTooltip() const = 0;
- virtual void setControllerTooltip(bool enabled) = 0;
- virtual void updateControllerButtonsOverlay() = 0;
-
// Used in Lua bindings
virtual const std::vector& getGuiModeStack() const = 0;
virtual void setDisabledByLua(std::string_view windowId, bool disabled) = 0;
diff --git a/apps/openmw/mwgui/alchemywindow.cpp b/apps/openmw/mwgui/alchemywindow.cpp
index 6cf34702d7..5a6245fca0 100644
--- a/apps/openmw/mwgui/alchemywindow.cpp
+++ b/apps/openmw/mwgui/alchemywindow.cpp
@@ -6,7 +6,6 @@
#include
#include
#include
-#include
#include
#include
@@ -92,15 +91,6 @@ namespace MWGui
mFilterValue->eventEditTextChange += MyGUI::newDelegate(this, &AlchemyWindow::onFilterEdited);
mFilterType->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::switchFilterType);
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sCancel}";
- mControllerButtons.x = "#{sCreate}";
- mControllerButtons.y = "#{sMagicEffects}";
- mControllerButtons.r3 = "#{sInfo}";
- }
-
center();
}
@@ -175,12 +165,7 @@ namespace MWGui
std::string_view ingredient = wm->getGameSettingString("sIngredients", "Ingredients");
if (mFilterType->getCaption() == ingredient)
- {
- if (Settings::gui().mControllerMenus)
- switchFilterType(mFilterType);
- else
- mCurrentFilter = FilterType::ByName;
- }
+ mCurrentFilter = FilterType::ByName;
else
mCurrentFilter = FilterType::ByEffect;
updateFilters();
@@ -306,9 +291,6 @@ namespace MWGui
initFilter();
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mNameEdit);
-
- if (Settings::gui().mControllerMenus)
- mItemView->setActiveControllerWindow(true);
}
void AlchemyWindow::onIngredientSelected(MyGUI::Widget* _sender)
@@ -546,80 +528,4 @@ namespace MWGui
if (currentCount > 1)
mBrewCountEdit->setValue(currentCount - 1);
}
-
- bool AlchemyWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
- bool isFilterListOpen
- = focus != nullptr && focus->getParent() != nullptr && focus->getParent()->getParent() == mFilterValue;
-
- if (isFilterListOpen)
- {
- // When the filter list combo box is open, send all inputs to it.
- if (arg.button == SDL_CONTROLLER_BUTTON_A || arg.button == SDL_CONTROLLER_BUTTON_Y)
- {
- // Select the highlighted entry in the combo box and close it.
- int index = mFilterValue->getIndexSelected();
- mFilterValue->setIndexSelected(index);
- onFilterChanged(mFilterValue, index);
- MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mNameEdit); // Close list
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- // Close the list without selecting anything
- mFilterValue->clearIndexSelected();
- onFilterEdited(mFilterValue);
- MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mNameEdit); // Close list
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::ArrowUp, 0, false);
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false);
- }
- else
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- // Remove active ingredients or close the window
- if (mIngredients[3]->isUserString("ToolTipType"))
- onIngredientSelected(mIngredients[3]);
- else if (mIngredients[2]->isUserString("ToolTipType"))
- onIngredientSelected(mIngredients[2]);
- else if (mIngredients[1]->isUserString("ToolTipType"))
- onIngredientSelected(mIngredients[1]);
- else if (mIngredients[0]->isUserString("ToolTipType"))
- onIngredientSelected(mIngredients[0]);
- else
- onCancelButtonClicked(mCancelButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_X)
- onCreateButtonClicked(mCreateButton);
- else if (arg.button == SDL_CONTROLLER_BUTTON_Y && mFilterValue->getItemCount() > 0)
- {
- // Magical effects/ingredients filter
- if (mFilterValue->getIndexSelected() != MyGUI::ITEM_NONE)
- {
- // Clear the active filter
- mFilterValue->clearIndexSelected();
- onFilterEdited(mFilterValue);
- }
- else
- {
- // Open the combo box to choose the a filter
- MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mFilterValue);
- MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false);
- }
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
- onDecreaseButtonTriggered();
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
- onIncreaseButtonTriggered();
- else
- mItemView->onControllerButton(arg.button);
- }
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/alchemywindow.hpp b/apps/openmw/mwgui/alchemywindow.hpp
index e79c41b659..82e5c3f583 100644
--- a/apps/openmw/mwgui/alchemywindow.hpp
+++ b/apps/openmw/mwgui/alchemywindow.hpp
@@ -99,8 +99,6 @@ namespace MWGui
std::vector mApparatus;
std::vector mIngredients;
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
};
}
diff --git a/apps/openmw/mwgui/birth.cpp b/apps/openmw/mwgui/birth.cpp
index 5a5605aa6e..3dfdd17627 100644
--- a/apps/openmw/mwgui/birth.cpp
+++ b/apps/openmw/mwgui/birth.cpp
@@ -50,20 +50,15 @@ namespace MWGui
mBirthList->eventListSelectAccept += MyGUI::newDelegate(this, &BirthDialog::onAccept);
mBirthList->eventListChangePosition += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth);
- getWidget(mBackButton, "BackButton");
- mBackButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onBackClicked);
+ MyGUI::Button* backButton;
+ getWidget(backButton, "BackButton");
+ backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onBackClicked);
- getWidget(mOkButton, "OKButton");
- mOkButton->setCaption(
+ MyGUI::Button* okButton;
+ getWidget(okButton, "OKButton");
+ okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {})));
- mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onOkClicked);
-
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.lStick = "#{sMouse}";
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sBack}";
- }
+ okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onOkClicked);
updateBirths();
updateSpells();
@@ -75,17 +70,8 @@ namespace MWGui
getWidget(okButton, "OKButton");
if (shown)
- {
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {})));
- mControllerButtons.x = "#{sNext}";
- }
- else if (Settings::gui().mControllerMenus)
- {
- okButton->setCaption(
- MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sDone", {})));
- mControllerButtons.x = "#{sDone}";
- }
else
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {})));
@@ -285,30 +271,4 @@ namespace MWGui
mSpellArea->setVisibleVScroll(true);
mSpellArea->setViewOffset(MyGUI::IntPoint(0, 0));
}
-
- bool BirthDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onBackClicked(mBackButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_X)
- {
- onOkClicked(mOkButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
- winMgr->setKeyFocusWidget(mBirthList);
- winMgr->injectKeyPress(MyGUI::KeyCode::ArrowUp, 0, false);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
- winMgr->setKeyFocusWidget(mBirthList);
- winMgr->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false);
- }
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/birth.hpp b/apps/openmw/mwgui/birth.hpp
index b41b1fbb9a..db9e997b6c 100644
--- a/apps/openmw/mwgui/birth.hpp
+++ b/apps/openmw/mwgui/birth.hpp
@@ -53,12 +53,8 @@ namespace MWGui
MyGUI::ScrollView* mSpellArea;
MyGUI::ImageBox* mBirthImage;
std::vector mSpellItems;
- MyGUI::Button* mBackButton;
- MyGUI::Button* mOkButton;
ESM::RefId mCurrentBirthId;
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
};
}
#endif
diff --git a/apps/openmw/mwgui/bookpage.cpp b/apps/openmw/mwgui/bookpage.cpp
index 2c58ca3b72..47e85b1f4b 100644
--- a/apps/openmw/mwgui/bookpage.cpp
+++ b/apps/openmw/mwgui/bookpage.cpp
@@ -105,18 +105,6 @@ namespace MWGui
Styles mStyles;
MyGUI::IntRect mRect;
- void setColour(size_t section, size_t line, size_t run, const MyGUI::Colour& colour) const override
- {
- if (section >= mSections.size())
- return;
- if (line >= mSections[section].mLines.size())
- return;
- if (run >= mSections[section].mLines[line].mRuns.size())
- return;
-
- mSections[section].mLines[line].mRuns[run].mStyle->mNormalColour = colour;
- }
-
virtual ~TypesetBookImpl() {}
Range addContent(const BookTypesetter::Utf8Span& text)
@@ -1300,12 +1288,6 @@ namespace MWGui
void unadviseLinkClicked() override { mPageDisplay->mLinkClicked = std::function(); }
- void setFocusItem(BookTypesetter::Style* itemStyle) override
- {
- mPageDisplay->mFocusItem = (TypesetBookImpl::StyleImpl*)itemStyle;
- mPageDisplay->dirtyFocusItem();
- }
-
protected:
void initialiseOverride() override
{
diff --git a/apps/openmw/mwgui/bookpage.hpp b/apps/openmw/mwgui/bookpage.hpp
index bb85130b7f..d42fb4783f 100644
--- a/apps/openmw/mwgui/bookpage.hpp
+++ b/apps/openmw/mwgui/bookpage.hpp
@@ -31,9 +31,6 @@ namespace MWGui
/// text combined prior to pagination.
virtual std::pair getSize() const = 0;
- /// Used to highlight journal indices
- virtual void setColour(size_t section, size_t line, size_t run, const MyGUI::Colour& colour) const = 0;
-
virtual ~TypesetBook() = default;
};
@@ -167,8 +164,6 @@ namespace MWGui
/// Register the widget and associated sub-widget with MyGUI. Should be
/// called once near the beginning of the program.
static void registerMyGUIComponents();
-
- virtual void setFocusItem(BookTypesetter::Style* itemStyle) = 0;
};
}
diff --git a/apps/openmw/mwgui/bookwindow.cpp b/apps/openmw/mwgui/bookwindow.cpp
index beba6e5968..ef875a18b9 100644
--- a/apps/openmw/mwgui/bookwindow.cpp
+++ b/apps/openmw/mwgui/bookwindow.cpp
@@ -66,10 +66,6 @@ namespace MWGui
MyGUI::IntCoord(0, 0, (64 - 7) * scale, mNextPageButton->getSize().height * scale));
}
- mControllerButtons.l1 = "#{sPrev}";
- mControllerButtons.r1 = "#{sNext}";
- mControllerButtons.b = "#{sClose}";
-
center();
}
@@ -222,26 +218,4 @@ namespace MWGui
}
}
- ControllerButtonStr* BookWindow::getControllerButtons()
- {
- mControllerButtons.a = mTakeButton->getVisible() ? "#{sTake}" : "";
- return &mControllerButtons;
- }
-
- bool BookWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mTakeButton->getVisible())
- onTakeButtonClicked(mTakeButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- onCloseButtonClicked(mCloseButton);
- else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
- prevPage();
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
- nextPage();
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/bookwindow.hpp b/apps/openmw/mwgui/bookwindow.hpp
index 0a1beb7342..5a3dfdf584 100644
--- a/apps/openmw/mwgui/bookwindow.hpp
+++ b/apps/openmw/mwgui/bookwindow.hpp
@@ -18,10 +18,8 @@ namespace MWGui
void setInventoryAllowed(bool allowed);
void onResChange(int, int) override { center(); }
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
std::string_view getWindowIdForLua() const override { return "Book"; }
- ControllerButtonStr* getControllerButtons() override;
protected:
void onNextPageButtonClicked(MyGUI::Widget* sender);
diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp
index 450a61b4f8..839f0f5072 100644
--- a/apps/openmw/mwgui/class.cpp
+++ b/apps/openmw/mwgui/class.cpp
@@ -18,7 +18,6 @@
#include
#include
#include
-#include
#include
#include "tooltips.hpp"
@@ -47,21 +46,15 @@ namespace MWGui
getWidget(mClassImage, "ClassImage");
getWidget(mClassName, "ClassName");
- getWidget(mBackButton, "BackButton");
- mBackButton->setCaptionWithReplacing("#{sMessageQuestionAnswer3}");
- mBackButton->eventMouseButtonClick += MyGUI::newDelegate(this, &GenerateClassResultDialog::onBackClicked);
+ MyGUI::Button* backButton;
+ getWidget(backButton, "BackButton");
+ backButton->setCaptionWithReplacing("#{sMessageQuestionAnswer3}");
+ backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &GenerateClassResultDialog::onBackClicked);
- getWidget(mOkButton, "OKButton");
- mOkButton->setCaptionWithReplacing("#{sMessageQuestionAnswer2}");
- mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &GenerateClassResultDialog::onOkClicked);
-
- if (Settings::gui().mControllerMenus)
- {
- mOkButton->setStateSelected(true);
- mDisableGamepadCursor = true;
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sBack}";
- }
+ MyGUI::Button* okButton;
+ getWidget(okButton, "OKButton");
+ okButton->setCaptionWithReplacing("#{sMessageQuestionAnswer2}");
+ okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &GenerateClassResultDialog::onOkClicked);
center();
}
@@ -78,30 +71,6 @@ namespace MWGui
center();
}
- bool GenerateClassResultDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mOkButtonFocus)
- onOkClicked(mOkButton);
- else
- onBackClicked(mBackButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onBackClicked(mBackButton);
- }
- else if ((arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && mOkButtonFocus)
- || (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT && !mOkButtonFocus))
- {
- mOkButtonFocus = !mOkButtonFocus;
- mOkButton->setStateSelected(mOkButtonFocus);
- mBackButton->setStateSelected(!mOkButtonFocus);
- }
-
- return true;
- }
-
// widget controls
void GenerateClassResultDialog::onOkClicked(MyGUI::Widget* _sender)
@@ -141,18 +110,13 @@ namespace MWGui
getWidget(mClassImage, "ClassImage");
- getWidget(mBackButton, "BackButton");
- mBackButton->eventMouseButtonClick += MyGUI::newDelegate(this, &PickClassDialog::onBackClicked);
+ MyGUI::Button* backButton;
+ getWidget(backButton, "BackButton");
+ backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &PickClassDialog::onBackClicked);
- getWidget(mOkButton, "OKButton");
- mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &PickClassDialog::onOkClicked);
-
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.lStick = "#{sMouse}";
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sBack}";
- }
+ MyGUI::Button* okButton;
+ getWidget(okButton, "OKButton");
+ okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &PickClassDialog::onOkClicked);
updateClasses();
updateStats();
@@ -164,17 +128,8 @@ namespace MWGui
getWidget(okButton, "OKButton");
if (shown)
- {
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {})));
- mControllerButtons.x = "#{sNext}";
- }
- else if (Settings::gui().mControllerMenus)
- {
- okButton->setCaption(
- MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sDone", {})));
- mControllerButtons.x = "#{sDone}";
- }
else
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {})));
@@ -323,32 +278,6 @@ namespace MWGui
setClassImage(mClassImage, mCurrentClassId);
}
- bool PickClassDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onBackClicked(mBackButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_X)
- {
- onOkClicked(mOkButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
- winMgr->setKeyFocusWidget(mClassList);
- winMgr->injectKeyPress(MyGUI::KeyCode::ArrowUp, 0, false);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
- winMgr->setKeyFocusWidget(mClassList);
- winMgr->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false);
- }
-
- return true;
- }
-
/* InfoBoxDialog */
void InfoBoxDialog::fitToText(MyGUI::TextBox* widget)
@@ -390,9 +319,6 @@ namespace MWGui
getWidget(mButtonBar, "ButtonBar");
center();
-
- mDisableGamepadCursor = Settings::gui().mControllerMenus;
- mControllerButtons.a = "#{sSelect}";
}
void InfoBoxDialog::setText(const std::string& str)
@@ -427,13 +353,6 @@ namespace MWGui
fitToText(button);
button->eventMouseButtonClick += MyGUI::newDelegate(this, &InfoBoxDialog::onButtonClicked);
coord.top += button->getHeight();
-
- if (Settings::gui().mControllerMenus && buttons.size() > 1 && this->mButtons.empty())
- {
- // First button is selected by default
- button->setStateSelected(true);
- }
-
this->mButtons.push_back(button);
}
}
@@ -463,44 +382,6 @@ namespace MWGui
}
}
- bool InfoBoxDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mControllerFocus >= 0 && mControllerFocus < static_cast(mButtons.size()))
- onButtonClicked(mButtons[mControllerFocus]);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- if (mButtons.size() == 1)
- onButtonClicked(mButtons[0]);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- if (mButtons.size() <= 1)
- return true;
- if (mButtons.size() == 2 && mControllerFocus == 0)
- return true;
-
- setControllerFocus(mButtons, mControllerFocus, false);
- mControllerFocus = wrap(mControllerFocus - 1, mButtons.size());
- setControllerFocus(mButtons, mControllerFocus, true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- if (mButtons.size() <= 1)
- return true;
- if (mButtons.size() == 2 && mControllerFocus == static_cast(mButtons.size()) - 1)
- return true;
-
- setControllerFocus(mButtons, mControllerFocus, false);
- mControllerFocus = wrap(mControllerFocus + 1, mButtons.size());
- setControllerFocus(mButtons, mControllerFocus, true);
- }
-
- return true;
- }
-
/* ClassChoiceDialog */
ClassChoiceDialog::ClassChoiceDialog()
@@ -569,25 +450,14 @@ namespace MWGui
MyGUI::Button* descriptionButton;
getWidget(descriptionButton, "DescriptionButton");
descriptionButton->eventMouseButtonClick += MyGUI::newDelegate(this, &CreateClassDialog::onDescriptionClicked);
- mButtons.push_back(descriptionButton);
MyGUI::Button* backButton;
getWidget(backButton, "BackButton");
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &CreateClassDialog::onBackClicked);
- mButtons.push_back(backButton);
MyGUI::Button* okButton;
getWidget(okButton, "OKButton");
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &CreateClassDialog::onOkClicked);
- mButtons.push_back(okButton);
-
- if (Settings::gui().mControllerMenus)
- {
- okButton->setStateSelected(true);
- mControllerButtons.lStick = "#{sMouse}";
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sBack}";
- }
// Set default skills, attributes
@@ -675,56 +545,13 @@ namespace MWGui
getWidget(okButton, "OKButton");
if (shown)
- {
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {})));
- mControllerButtons.x = "#{sNext}";
- }
- else if (Settings::gui().mControllerMenus)
- {
- okButton->setCaption(
- MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sDone", {})));
- mControllerButtons.x = "#{sDone}";
- }
else
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {})));
}
- bool CreateClassDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mControllerFocus == 0)
- onDescriptionClicked(mButtons[0]);
- else if (mControllerFocus == 1)
- onBackClicked(mButtons[1]);
- else
- onOkClicked(mButtons[2]);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onBackClicked(mButtons[1]);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_X)
- {
- onOkClicked(mButtons[2]);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
- {
- setControllerFocus(mButtons, mControllerFocus, false);
- mControllerFocus = wrap(mControllerFocus - 1, mButtons.size());
- setControllerFocus(mButtons, mControllerFocus, true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- {
- setControllerFocus(mButtons, mControllerFocus, false);
- mControllerFocus = wrap(mControllerFocus + 1, mButtons.size());
- setControllerFocus(mButtons, mControllerFocus, true);
- }
- return true;
- }
-
// widget controls
void CreateClassDialog::onDialogCancel()
@@ -881,9 +708,6 @@ namespace MWGui
MyGUI::Button* cancelButton;
getWidget(cancelButton, "CancelButton");
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onCancelClicked);
-
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sCancel}";
}
SelectSpecializationDialog::~SelectSpecializationDialog() {}
@@ -915,16 +739,6 @@ namespace MWGui
return true;
}
- bool SelectSpecializationDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onCancelClicked(nullptr);
- return true;
- }
- return false;
- }
-
/* SelectAttributeDialog */
SelectAttributeDialog::SelectAttributeDialog()
@@ -946,7 +760,6 @@ namespace MWGui
widget->setAttributeId(attribute.mId);
widget->eventClicked += MyGUI::newDelegate(this, &SelectAttributeDialog::onAttributeClicked);
ToolTips::createAttributeToolTip(widget, attribute.mId);
- mAttributeButtons.emplace_back(widget);
}
attributes->setVisibleVScroll(false);
@@ -957,16 +770,6 @@ namespace MWGui
MyGUI::Button* cancelButton;
getWidget(cancelButton, "CancelButton");
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectAttributeDialog::onCancelClicked);
-
- if (Settings::gui().mControllerMenus)
- {
- mControllerFocus = 0;
- if (mAttributeButtons.size() > 0)
- mAttributeButtons[0]->setStateSelected(true);
-
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sCancel}";
- }
}
// widget controls
@@ -988,33 +791,6 @@ namespace MWGui
return true;
}
- bool SelectAttributeDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mControllerFocus >= 0 && mControllerFocus < static_cast(mAttributeButtons.size()))
- onAttributeClicked(mAttributeButtons[mControllerFocus]);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onCancelClicked(nullptr);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- mAttributeButtons[mControllerFocus]->setStateSelected(false);
- mControllerFocus = wrap(mControllerFocus - 1, mAttributeButtons.size());
- mAttributeButtons[mControllerFocus]->setStateSelected(true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- mAttributeButtons[mControllerFocus]->setStateSelected(false);
- mControllerFocus = wrap(mControllerFocus + 1, mAttributeButtons.size());
- mAttributeButtons[mControllerFocus]->setStateSelected(true);
- }
-
- return true;
- }
-
/* SelectSkillDialog */
SelectSkillDialog::SelectSkillDialog()
@@ -1044,7 +820,6 @@ namespace MWGui
skillWidget->setSkillId(skill.mId);
skillWidget->eventClicked += MyGUI::newDelegate(this, &SelectSkillDialog::onSkillClicked);
ToolTips::createSkillToolTip(skillWidget, skill.mId);
- mSkillButtons.emplace_back(skillWidget);
}
for (const auto& [widget, coord] : specializations)
{
@@ -1057,16 +832,6 @@ namespace MWGui
MyGUI::Button* cancelButton;
getWidget(cancelButton, "CancelButton");
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSkillDialog::onCancelClicked);
-
- if (Settings::gui().mControllerMenus)
- {
- mControllerFocus = 0;
- if (mSkillButtons.size() > 0)
- mSkillButtons[0]->setStateSelected(true);
-
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sCancel}";
- }
}
SelectSkillDialog::~SelectSkillDialog() {}
@@ -1090,51 +855,6 @@ namespace MWGui
return true;
}
- bool SelectSkillDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mControllerFocus >= 0 && mControllerFocus < static_cast(mSkillButtons.size()))
- onSkillClicked(mSkillButtons[mControllerFocus]);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onCancelClicked(nullptr);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- mSkillButtons[mControllerFocus]->setStateSelected(false);
- mControllerFocus = wrap(mControllerFocus - 1, mSkillButtons.size());
- mSkillButtons[mControllerFocus]->setStateSelected(true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- mSkillButtons[mControllerFocus]->setStateSelected(false);
- mControllerFocus = wrap(mControllerFocus + 1, mSkillButtons.size());
- mSkillButtons[mControllerFocus]->setStateSelected(true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
- {
- mSkillButtons[mControllerFocus]->setStateSelected(false);
- if (mControllerFocus < 9)
- mControllerFocus += 18;
- else
- mControllerFocus -= 9;
- mSkillButtons[mControllerFocus]->setStateSelected(true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- {
- mSkillButtons[mControllerFocus]->setStateSelected(false);
- if (mControllerFocus >= 18)
- mControllerFocus -= 18;
- else
- mControllerFocus += 9;
- mSkillButtons[mControllerFocus]->setStateSelected(true);
- }
-
- return true;
- }
-
/* DescriptionDialog */
DescriptionDialog::DescriptionDialog()
@@ -1153,8 +873,6 @@ namespace MWGui
// Make sure the edit box has focus
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mTextEdit);
-
- mControllerButtons.a = "#{sOk}";
}
DescriptionDialog::~DescriptionDialog() {}
@@ -1186,13 +904,4 @@ namespace MWGui
imageBox->setImageTexture(classImage);
}
- bool DescriptionDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A || arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onOkClicked(nullptr);
- return true;
- }
- return false;
- }
}
diff --git a/apps/openmw/mwgui/class.hpp b/apps/openmw/mwgui/class.hpp
index a4db03d4ab..f89a0c7d88 100644
--- a/apps/openmw/mwgui/class.hpp
+++ b/apps/openmw/mwgui/class.hpp
@@ -42,7 +42,6 @@ namespace MWGui
protected:
void onButtonClicked(MyGUI::Widget* _sender);
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
private:
void fitToText(MyGUI::TextBox* widget);
@@ -51,7 +50,6 @@ namespace MWGui
MyGUI::TextBox* mText;
MyGUI::Widget* mButtonBar;
std::vector mButtons;
- int mControllerFocus = 0;
};
// Lets the player choose between 3 ways of creating a class
@@ -94,14 +92,10 @@ namespace MWGui
protected:
void onOkClicked(MyGUI::Widget* _sender);
void onBackClicked(MyGUI::Widget* _sender);
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- bool mOkButtonFocus = true;
private:
MyGUI::ImageBox* mClassImage;
MyGUI::TextBox* mClassName;
- MyGUI::Button* mBackButton;
- MyGUI::Button* mOkButton;
ESM::RefId mCurrentClassId;
};
@@ -146,15 +140,11 @@ namespace MWGui
MyGUI::ImageBox* mClassImage;
MyGUI::ListBox* mClassList;
MyGUI::TextBox* mSpecializationName;
- MyGUI::Button* mBackButton;
- MyGUI::Button* mOkButton;
Widgets::MWAttributePtr mFavoriteAttribute[2];
Widgets::MWSkillPtr mMajorSkill[5];
Widgets::MWSkillPtr mMinorSkill[5];
ESM::RefId mCurrentClassId;
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
};
class SelectSpecializationDialog : public WindowModal
@@ -183,7 +173,6 @@ namespace MWGui
protected:
void onSpecializationClicked(MyGUI::Widget* _sender);
void onCancelClicked(MyGUI::Widget* _sender);
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
private:
MyGUI::TextBox *mSpecialization0, *mSpecialization1, *mSpecialization2;
@@ -217,9 +206,6 @@ namespace MWGui
protected:
void onAttributeClicked(Widgets::MWAttributePtr _sender);
void onCancelClicked(MyGUI::Widget* _sender);
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- int mControllerFocus;
- std::vector mAttributeButtons;
private:
ESM::RefId mAttributeId;
@@ -251,9 +237,6 @@ namespace MWGui
protected:
void onSkillClicked(Widgets::MWSkillPtr _sender);
void onCancelClicked(MyGUI::Widget* _sender);
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- int mControllerFocus;
- std::vector mSkillButtons;
private:
ESM::RefId mSkillId;
@@ -275,7 +258,6 @@ namespace MWGui
protected:
void onOkClicked(MyGUI::Widget* _sender);
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
private:
MyGUI::EditBox* mTextEdit;
@@ -332,7 +314,6 @@ namespace MWGui
private:
MyGUI::EditBox* mEditName;
MyGUI::TextBox* mSpecializationName;
- std::vector mButtons;
Widgets::MWAttributePtr mFavoriteAttribute0, mFavoriteAttribute1;
std::array mMajorSkill;
std::array mMinorSkill;
@@ -348,9 +329,6 @@ namespace MWGui
Widgets::MWAttributePtr mAffectedAttribute;
Widgets::MWSkillPtr mAffectedSkill;
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- int mControllerFocus = 2;
};
}
#endif
diff --git a/apps/openmw/mwgui/companionwindow.cpp b/apps/openmw/mwgui/companionwindow.cpp
index 4a7863b856..240198eddc 100644
--- a/apps/openmw/mwgui/companionwindow.cpp
+++ b/apps/openmw/mwgui/companionwindow.cpp
@@ -6,8 +6,6 @@
#include
#include
-#include
-
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
@@ -16,7 +14,6 @@
#include "companionitemmodel.hpp"
#include "countdialog.hpp"
#include "draganddrop.hpp"
-#include "inventorywindow.hpp"
#include "itemview.hpp"
#include "messagebox.hpp"
#include "sortfilteritemmodel.hpp"
@@ -61,11 +58,6 @@ namespace MWGui
mCloseButton->eventMouseButtonClick += MyGUI::newDelegate(this, &CompanionWindow::onCloseButtonClicked);
setCoord(200, 0, 600, 300);
-
- mControllerButtons.a = "#{sTake}";
- mControllerButtons.b = "#{sClose}";
- mControllerButtons.r3 = "#{sInfo}";
- mControllerButtons.l2 = "#{sInventory}";
}
void CompanionWindow::onItemSelected(int index)
@@ -101,13 +93,8 @@ namespace MWGui
name += MWGui::ToolTips::getSoulString(object.getCellRef());
dialog->openCountDialog(name, "#{sTake}", count);
dialog->eventOkClicked.clear();
- if (Settings::gui().mControllerMenus)
- dialog->eventOkClicked += MyGUI::newDelegate(this, &CompanionWindow::takeItem);
- else
- dialog->eventOkClicked += MyGUI::newDelegate(this, &CompanionWindow::dragItem);
+ dialog->eventOkClicked += MyGUI::newDelegate(this, &CompanionWindow::dragItem);
}
- else if (Settings::gui().mControllerMenus)
- takeItem(nullptr, count);
else
dragItem(nullptr, count);
}
@@ -123,29 +110,6 @@ namespace MWGui
mDragAndDrop->startDrag(mSelectedItem, mSortModel, mModel, mItemView, count);
}
- void CompanionWindow::takeItem(MyGUI::Widget* sender, int count)
- {
- if (!mModel)
- return;
-
- const ItemStack& item = mModel->getItem(mSelectedItem);
- if (!mModel->onTakeItem(item.mBase, count))
- return;
-
- MWGui::InventoryWindow* inventoryWindow = MWBase::Environment::get().getWindowManager()->getInventoryWindow();
- ItemModel* playerModel = inventoryWindow->getModel();
-
- mModel->moveItem(item, count, playerModel);
-
- inventoryWindow->updateItemView();
- mItemView->update();
-
- // play the item's sound
- MWWorld::Ptr itemBase = item.mBase;
- const ESM::RefId& sound = itemBase.getClass().getUpSoundId(itemBase);
- MWBase::Environment::get().getWindowManager()->playSound(sound);
- }
-
void CompanionWindow::onBackgroundSelected()
{
if (mDragAndDrop->mIsOnDragAndDrop)
@@ -238,31 +202,4 @@ namespace MWGui
mSortModel = nullptr;
}
- bool CompanionWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- int index = mItemView->getControllerFocus();
- if (index >= 0 && index < mItemView->getItemCount())
- onItemSelected(index);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onCloseButtonClicked(mCloseButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK || arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP
- || arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN || arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT
- || arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- {
- mItemView->onControllerButton(arg.button);
- }
-
- return true;
- }
-
- void CompanionWindow::setActiveControllerWindow(bool active)
- {
- mItemView->setActiveControllerWindow(active);
- WindowBase::setActiveControllerWindow(active);
- }
}
diff --git a/apps/openmw/mwgui/companionwindow.hpp b/apps/openmw/mwgui/companionwindow.hpp
index c0cd87c9d5..97f3a0072e 100644
--- a/apps/openmw/mwgui/companionwindow.hpp
+++ b/apps/openmw/mwgui/companionwindow.hpp
@@ -1,8 +1,6 @@
#ifndef OPENMW_MWGUI_COMPANIONWINDOW_H
#define OPENMW_MWGUI_COMPANIONWINDOW_H
-#include "companionitemmodel.hpp"
-#include "itemmodel.hpp"
#include "referenceinterface.hpp"
#include "windowbase.hpp"
@@ -34,12 +32,6 @@ namespace MWGui
std::string_view getWindowIdForLua() const override { return "Companion"; }
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- void setActiveControllerWindow(bool active) override;
-
- MWGui::ItemView* getItemView() { return mItemView; }
- ItemModel* getModel() { return mModel; }
-
private:
ItemView* mItemView;
SortFilterItemModel* mSortModel;
@@ -58,7 +50,6 @@ namespace MWGui
void onNameFilterChanged(MyGUI::EditBox* _sender);
void onBackgroundSelected();
void dragItem(MyGUI::Widget* sender, int count);
- void takeItem(MyGUI::Widget* sender, int count);
void onMessageBoxButtonClicked(int button);
diff --git a/apps/openmw/mwgui/confirmationdialog.cpp b/apps/openmw/mwgui/confirmationdialog.cpp
index f858b9628a..48b209f17e 100644
--- a/apps/openmw/mwgui/confirmationdialog.cpp
+++ b/apps/openmw/mwgui/confirmationdialog.cpp
@@ -3,8 +3,6 @@
#include
#include
-#include
-
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
@@ -19,13 +17,6 @@ namespace MWGui
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ConfirmationDialog::onCancelButtonClicked);
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ConfirmationDialog::onOkButtonClicked);
-
- if (Settings::gui().mControllerMenus)
- {
- mDisableGamepadCursor = true;
- mControllerButtons.a = "#{sOk}";
- mControllerButtons.b = "#{sCancel}";
- }
}
void ConfirmationDialog::askForConfirmation(const std::string& message)
@@ -44,13 +35,6 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mOkButton);
- if (Settings::gui().mControllerMenus)
- {
- mOkButtonFocus = true;
- mOkButton->setStateSelected(true);
- mCancelButton->setStateSelected(false);
- }
-
center();
}
@@ -72,28 +56,4 @@ namespace MWGui
eventOkClicked();
}
-
- bool ConfirmationDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mOkButtonFocus)
- onOkButtonClicked(mOkButton);
- else
- onCancelButtonClicked(mCancelButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onCancelButtonClicked(mCancelButton);
- }
- else if ((arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && !mOkButtonFocus)
- || (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT && mOkButtonFocus))
- {
- mOkButtonFocus = !mOkButtonFocus;
- mOkButton->setStateSelected(mOkButtonFocus);
- mCancelButton->setStateSelected(!mOkButtonFocus);
- }
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/confirmationdialog.hpp b/apps/openmw/mwgui/confirmationdialog.hpp
index 9b26e3a3c9..1344f2a501 100644
--- a/apps/openmw/mwgui/confirmationdialog.hpp
+++ b/apps/openmw/mwgui/confirmationdialog.hpp
@@ -27,9 +27,6 @@ namespace MWGui
void onCancelButtonClicked(MyGUI::Widget* _sender);
void onOkButtonClicked(MyGUI::Widget* _sender);
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- bool mOkButtonFocus = true;
};
}
diff --git a/apps/openmw/mwgui/container.cpp b/apps/openmw/mwgui/container.cpp
index 0be99d38a0..6ab2c862d4 100644
--- a/apps/openmw/mwgui/container.cpp
+++ b/apps/openmw/mwgui/container.cpp
@@ -3,8 +3,6 @@
#include
#include
-#include
-
#include "../mwbase/environment.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/scriptmanager.hpp"
@@ -56,12 +54,6 @@ namespace MWGui
mTakeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ContainerWindow::onTakeAllButtonClicked);
setCoord(200, 0, 600, 300);
-
- mControllerButtons.a = "#{sTake}";
- mControllerButtons.b = "#{sClose}";
- mControllerButtons.x = "#{sTakeAll}";
- mControllerButtons.r3 = "#{sInfo}";
- mControllerButtons.l2 = "#{sInventory}";
}
void ContainerWindow::onItemSelected(int index)
@@ -96,13 +88,8 @@ namespace MWGui
name += MWGui::ToolTips::getSoulString(object.getCellRef());
dialog->openCountDialog(name, "#{sTake}", count);
dialog->eventOkClicked.clear();
- if (Settings::gui().mControllerMenus)
- dialog->eventOkClicked += MyGUI::newDelegate(this, &ContainerWindow::takeItem);
- else
- dialog->eventOkClicked += MyGUI::newDelegate(this, &ContainerWindow::dragItem);
+ dialog->eventOkClicked += MyGUI::newDelegate(this, &ContainerWindow::dragItem);
}
- else if (Settings::gui().mControllerMenus)
- takeItem(nullptr, count);
else
dragItem(nullptr, count);
}
@@ -118,29 +105,6 @@ namespace MWGui
mDragAndDrop->startDrag(mSelectedItem, mSortModel, mModel, mItemView, count);
}
- void ContainerWindow::takeItem(MyGUI::Widget* sender, int count)
- {
- if (!mModel)
- return;
-
- const ItemStack& item = mModel->getItem(mSelectedItem);
- if (!onTakeItem(item, count))
- return;
-
- MWGui::InventoryWindow* inventoryWindow = MWBase::Environment::get().getWindowManager()->getInventoryWindow();
- ItemModel* playerModel = inventoryWindow->getModel();
-
- mModel->moveItem(item, count, playerModel);
-
- inventoryWindow->updateItemView();
- mItemView->update();
-
- // play the item's sound
- MWWorld::Ptr itemBase = item.mBase;
- const ESM::RefId& sound = itemBase.getClass().getUpSoundId(itemBase);
- MWBase::Environment::get().getWindowManager()->playSound(sound);
- }
-
void ContainerWindow::dropItem()
{
if (!mModel)
@@ -356,47 +320,4 @@ namespace MWGui
if (mModel && mModel->usesContainer(ptr))
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Container);
}
-
- ControllerButtonStr* ContainerWindow::getControllerButtons()
- {
- mControllerButtons.r1 = mDisposeCorpseButton->getVisible() ? "#{sDisposeofCorpse}" : "";
- return &mControllerButtons;
- }
-
- bool ContainerWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- int index = mItemView->getControllerFocus();
- if (index >= 0 && index < mItemView->getItemCount())
- onItemSelected(index);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onCloseButtonClicked(mCloseButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_X)
- {
- onTakeAllButtonClicked(mTakeButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
- {
- if (mDisposeCorpseButton->getVisible())
- onDisposeCorpseButtonClicked(mDisposeCorpseButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK || arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP
- || arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN || arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT
- || arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- {
- mItemView->onControllerButton(arg.button);
- }
-
- return true;
- }
-
- void ContainerWindow::setActiveControllerWindow(bool active)
- {
- mItemView->setActiveControllerWindow(active);
- WindowBase::setActiveControllerWindow(active);
- }
}
diff --git a/apps/openmw/mwgui/container.hpp b/apps/openmw/mwgui/container.hpp
index 96ee6a6380..555fa8e1ae 100644
--- a/apps/openmw/mwgui/container.hpp
+++ b/apps/openmw/mwgui/container.hpp
@@ -40,13 +40,6 @@ namespace MWGui
std::string_view getWindowIdForLua() const override { return "Container"; }
- ControllerButtonStr* getControllerButtons() override;
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- void setActiveControllerWindow(bool active) override;
-
- MWGui::ItemView* getItemView() { return mItemView; }
- ItemModel* getModel() { return mModel; }
-
private:
DragAndDrop* mDragAndDrop;
@@ -62,7 +55,6 @@ namespace MWGui
void onItemSelected(int index);
void onBackgroundSelected();
void dragItem(MyGUI::Widget* sender, int count);
- void takeItem(MyGUI::Widget* sender, int count);
void dropItem();
void onCloseButtonClicked(MyGUI::Widget* _sender);
void onTakeAllButtonClicked(MyGUI::Widget* _sender);
diff --git a/apps/openmw/mwgui/controllerbuttonsoverlay.cpp b/apps/openmw/mwgui/controllerbuttonsoverlay.cpp
deleted file mode 100644
index 9466f40105..0000000000
--- a/apps/openmw/mwgui/controllerbuttonsoverlay.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-#include "controllerbuttonsoverlay.hpp"
-
-#include "../mwbase/environment.hpp"
-#include "../mwbase/windowmanager.hpp"
-
-namespace MWGui
-{
- ControllerButtonsOverlay::ControllerButtonsOverlay()
- : WindowBase("openmw_controllerbuttons.layout")
- {
- getWidget(mImageA, "BtnAImage");
- getWidget(mTextA, "BtnAText");
-
- getWidget(mImageB, "BtnBImage");
- getWidget(mTextB, "BtnBText");
-
- getWidget(mImageDpad, "BtnDpadImage");
- getWidget(mTextDpad, "BtnDpadText");
-
- getWidget(mImageL1, "BtnL1Image");
- getWidget(mTextL1, "BtnL1Text");
-
- getWidget(mImageL2, "BtnL2Image");
- getWidget(mTextL2, "BtnL2Text");
-
- getWidget(mImageL3, "BtnL3Image");
- getWidget(mTextL3, "BtnL3Text");
-
- getWidget(mImageLStick, "BtnLStickImage");
- getWidget(mTextLStick, "BtnLStickText");
-
- getWidget(mImageMenu, "BtnMenuImage");
- getWidget(mTextMenu, "BtnMenuText");
-
- getWidget(mImageR1, "BtnR1Image");
- getWidget(mTextR1, "BtnR1Text");
-
- getWidget(mImageR2, "BtnR2Image");
- getWidget(mTextR2, "BtnR2Text");
-
- getWidget(mImageR3, "BtnR3Image");
- getWidget(mTextR3, "BtnR3Text");
-
- getWidget(mImageRStick, "BtnRStickImage");
- getWidget(mTextRStick, "BtnRStickText");
-
- getWidget(mImageView, "BtnViewImage");
- getWidget(mTextView, "BtnViewText");
-
- getWidget(mImageX, "BtnXImage");
- getWidget(mTextX, "BtnXText");
-
- getWidget(mImageY, "BtnYImage");
- getWidget(mTextY, "BtnYText");
-
- getWidget(mHBox, "ButtonBox");
- }
-
- void ControllerButtonsOverlay::setButtons(ControllerButtonStr* buttons)
- {
- int buttonCount = 0;
- buttonCount += updateButton(mTextA, mImageA, buttons->a);
- buttonCount += updateButton(mTextB, mImageB, buttons->b);
- buttonCount += updateButton(mTextDpad, mImageDpad, buttons->dpad);
- buttonCount += updateButton(mTextL1, mImageL1, buttons->l1);
- buttonCount += updateButton(mTextL2, mImageL2, buttons->l2);
- buttonCount += updateButton(mTextL3, mImageL3, buttons->l3);
- buttonCount += updateButton(mTextLStick, mImageLStick, buttons->lStick);
- buttonCount += updateButton(mTextMenu, mImageMenu, buttons->menu);
- buttonCount += updateButton(mTextR1, mImageR1, buttons->r1);
- buttonCount += updateButton(mTextR2, mImageR2, buttons->r2);
- buttonCount += updateButton(mTextR3, mImageR3, buttons->r3);
- buttonCount += updateButton(mTextRStick, mImageRStick, buttons->rStick);
- buttonCount += updateButton(mTextView, mImageView, buttons->view);
- buttonCount += updateButton(mTextX, mImageX, buttons->x);
- buttonCount += updateButton(mTextY, mImageY, buttons->y);
- mHBox->notifyChildrenSizeChanged();
-
- setVisible(buttonCount > 0);
- }
-
- int ControllerButtonsOverlay::updateButton(
- MyGUI::TextBox* text, MyGUI::ImageBox* image, const std::string& buttonStr)
- {
- if (buttonStr.length() > 0)
- {
- image->setVisible(true);
- image->setUserString("Hidden", "false");
-
- text->setCaptionWithReplacing(buttonStr);
- text->setVisible(true);
- text->setUserString("Hidden", "false");
- text->setSize(text->getTextSize().width + 16, 48);
- return 1;
- }
- else
- {
- image->setVisible(false);
- image->setUserString("Hidden", "true");
-
- text->setVisible(false);
- text->setUserString("Hidden", "true");
- return 0;
- }
- }
-}
diff --git a/apps/openmw/mwgui/controllerbuttonsoverlay.hpp b/apps/openmw/mwgui/controllerbuttonsoverlay.hpp
deleted file mode 100644
index 7008384bee..0000000000
--- a/apps/openmw/mwgui/controllerbuttonsoverlay.hpp
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef MWGUI_CONTROLLERBUTTONSOVERLAY_H
-#define MWGUI_CONTROLLERBUTTONSOVERLAY_H
-
-#include
-#include
-
-#include
-
-#include "windowbase.hpp"
-
-namespace MWGui
-{
- class ControllerButtonsOverlay : public WindowBase
- {
- public:
- ControllerButtonsOverlay();
-
- void setButtons(ControllerButtonStr* buttons);
-
- private:
- MyGUI::ImageBox* mImageA;
- MyGUI::TextBox* mTextA;
-
- MyGUI::ImageBox* mImageB;
- MyGUI::TextBox* mTextB;
-
- MyGUI::ImageBox* mImageDpad;
- MyGUI::TextBox* mTextDpad;
-
- MyGUI::ImageBox* mImageL1;
- MyGUI::TextBox* mTextL1;
-
- MyGUI::ImageBox* mImageL2;
- MyGUI::TextBox* mTextL2;
-
- MyGUI::ImageBox* mImageL3;
- MyGUI::TextBox* mTextL3;
-
- MyGUI::ImageBox* mImageLStick;
- MyGUI::TextBox* mTextLStick;
-
- MyGUI::ImageBox* mImageMenu;
- MyGUI::TextBox* mTextMenu;
-
- MyGUI::ImageBox* mImageR1;
- MyGUI::TextBox* mTextR1;
-
- MyGUI::ImageBox* mImageR2;
- MyGUI::TextBox* mTextR2;
-
- MyGUI::ImageBox* mImageR3;
- MyGUI::TextBox* mTextR3;
-
- MyGUI::ImageBox* mImageRStick;
- MyGUI::TextBox* mTextRStick;
-
- MyGUI::ImageBox* mImageView;
- MyGUI::TextBox* mTextView;
-
- MyGUI::ImageBox* mImageX;
- MyGUI::TextBox* mTextX;
-
- MyGUI::ImageBox* mImageY;
- MyGUI::TextBox* mTextY;
-
- Gui::HBox* mHBox;
-
- int updateButton(MyGUI::TextBox* text, MyGUI::ImageBox* image, const std::string& buttonStr);
- };
-}
-
-#endif
diff --git a/apps/openmw/mwgui/countdialog.cpp b/apps/openmw/mwgui/countdialog.cpp
index 816d67921c..2ca6657a17 100644
--- a/apps/openmw/mwgui/countdialog.cpp
+++ b/apps/openmw/mwgui/countdialog.cpp
@@ -27,9 +27,6 @@ namespace MWGui
mSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &CountDialog::onSliderMoved);
// make sure we read the enter key being pressed to accept multiple items
mItemEdit->eventEditSelectAccept += MyGUI::newDelegate(this, &CountDialog::onEnterKeyPressed);
-
- mControllerButtons.a = "#{sOk}";
- mControllerButtons.b = "#{sCancel}";
}
void CountDialog::openCountDialog(const std::string& item, const std::string& message, const int maxCount)
@@ -41,7 +38,7 @@ namespace MWGui
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
mSlider->setScrollRange(maxCount);
- mItemText->setCaptionWithReplacing(item);
+ mItemText->setCaption(item);
int width = std::max(mItemText->getTextSize().width + 160, 320);
setCoord(viewSize.width / 2 - width / 2, viewSize.height / 2 - mMainWidget->getHeight() / 2, width,
@@ -57,13 +54,6 @@ namespace MWGui
mItemEdit->setValue(maxCount);
}
- void CountDialog::setCount(int count)
- {
- count = std::clamp(count, 1, (int)mSlider->getScrollRange());
- mSlider->setScrollPosition(count - 1);
- mItemEdit->setValue(count);
- }
-
void CountDialog::onCancelButtonClicked(MyGUI::Widget* _sender)
{
setVisible(false);
@@ -96,22 +86,4 @@ namespace MWGui
{
mItemEdit->setValue(_position + 1);
}
-
- bool CountDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- onOkButtonClicked(mOkButton);
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- onCancelButtonClicked(mCancelButton);
- else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
- setCount(1);
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
- setCount((int)mSlider->getScrollRange());
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
- MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false);
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::ArrowUp, 0, false);
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/countdialog.hpp b/apps/openmw/mwgui/countdialog.hpp
index b3a1aab3b3..9cdf231549 100644
--- a/apps/openmw/mwgui/countdialog.hpp
+++ b/apps/openmw/mwgui/countdialog.hpp
@@ -3,8 +3,6 @@
#include "windowbase.hpp"
-#include
-
namespace Gui
{
class NumericEditBox;
@@ -17,7 +15,6 @@ namespace MWGui
public:
CountDialog();
void openCountDialog(const std::string& item, const std::string& message, const int maxCount);
- void setCount(int count);
typedef MyGUI::delegates::MultiDelegate EventHandle_WidgetInt;
@@ -27,7 +24,7 @@ namespace MWGui
EventHandle_WidgetInt eventOkClicked;
private:
- Gui::ScrollBar* mSlider;
+ MyGUI::ScrollBar* mSlider;
Gui::NumericEditBox* mItemEdit;
MyGUI::TextBox* mItemText;
MyGUI::TextBox* mLabelText;
@@ -39,7 +36,6 @@ namespace MWGui
void onEditValueChanged(int value);
void onSliderMoved(MyGUI::ScrollBar* _sender, size_t _position);
void onEnterKeyPressed(MyGUI::EditBox* _sender);
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
};
}
diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp
index b3f83f3771..6b1e007770 100644
--- a/apps/openmw/mwgui/dialogue.cpp
+++ b/apps/openmw/mwgui/dialogue.cpp
@@ -88,10 +88,6 @@ namespace MWGui
mBribe10Button->eventMouseButtonClick += MyGUI::newDelegate(this, &PersuasionDialog::onPersuade);
mBribe100Button->eventMouseButtonClick += MyGUI::newDelegate(this, &PersuasionDialog::onPersuade);
mBribe1000Button->eventMouseButtonClick += MyGUI::newDelegate(this, &PersuasionDialog::onPersuade);
-
- mDisableGamepadCursor = Settings::gui().mControllerMenus;
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sCancel}";
}
void PersuasionDialog::adjustAction(MyGUI::Widget* action, int& totalHeight)
@@ -148,24 +144,6 @@ namespace MWGui
else
mMainWidget->setSize(mInitialMainWidgetWidth, mMainWidget->getSize().height);
- if (Settings::gui().mControllerMenus)
- {
- mControllerFocus = 0;
- mButtons.clear();
- mButtons.push_back(mAdmireButton);
- mButtons.push_back(mIntimidateButton);
- mButtons.push_back(mTauntButton);
- if (mBribe10Button->getEnabled())
- mButtons.push_back(mBribe10Button);
- if (mBribe100Button->getEnabled())
- mButtons.push_back(mBribe100Button);
- if (mBribe1000Button->getEnabled())
- mButtons.push_back(mBribe1000Button);
-
- for (size_t i = 0; i < mButtons.size(); i++)
- mButtons[i]->setStateSelected(i == 0);
- }
-
WindowModal::onOpen();
}
@@ -174,31 +152,6 @@ namespace MWGui
return mAdmireButton;
}
- bool PersuasionDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- onPersuade(mButtons[mControllerFocus]);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- onCancel(mCancelButton);
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- setControllerFocus(mButtons, mControllerFocus, false);
- mControllerFocus = wrap(mControllerFocus - 1, mButtons.size());
- setControllerFocus(mButtons, mControllerFocus, true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- setControllerFocus(mButtons, mControllerFocus, false);
- mControllerFocus = wrap(mControllerFocus + 1, mButtons.size());
- setControllerFocus(mButtons, mControllerFocus, true);
- }
-
- return true;
- }
-
// --------------------------------------------------------------------------------------------------
Response::Response(std::string_view text, std::string_view title, bool needMargin)
@@ -382,11 +335,6 @@ namespace MWGui
mMainWidget->castType()->eventWindowChangeCoord
+= MyGUI::newDelegate(this, &DialogueWindow::onWindowResize);
-
- mControllerScrollWidget = mHistory->getParent();
- mControllerButtons.a = "#{sAsk}";
- mControllerButtons.b = "#{sGoodbye}";
- mControllerButtons.rStick = "#{sScrollup}";
}
void DialogueWindow::onTradeComplete()
@@ -540,14 +488,6 @@ namespace MWGui
updateTopics();
updateTopicsPane(); // force update for new services
- if (Settings::gui().mControllerMenus && !sameActor)
- {
- setControllerFocus(mControllerFocus, false);
- // Reset focus to very top. Maybe change this to mTopicsList->getItemCount() - mKeywords.size()?
- mControllerFocus = 0;
- setControllerFocus(mControllerFocus, true);
- }
-
updateDisposition();
restock();
}
@@ -603,11 +543,6 @@ namespace MWGui
void DialogueWindow::updateTopicsPane()
{
- const std::string focusedTopic
- = Settings::gui().mControllerMenus && mControllerFocus < static_cast(mTopicsList->getItemCount())
- ? mTopicsList->getItemNameAt(mControllerFocus)
- : "";
-
mTopicsList->clear();
for (auto& linkPair : mTopicLinks)
mDeleteLater.push_back(std::move(linkPair.second));
@@ -665,16 +600,10 @@ namespace MWGui
mKeywordSearch.seed(topicId, intptr_t(t.get()));
t->eventTopicActivated += MyGUI::newDelegate(this, &DialogueWindow::onTopicActivated);
mTopicLinks[topicId] = std::move(t);
-
- if (keyword == focusedTopic)
- mControllerFocus = mTopicsList->getItemCount() - 1;
}
redrawTopicsList();
updateHistory();
-
- if (Settings::gui().mControllerMenus)
- setControllerFocus(mControllerFocus, true);
}
void DialogueWindow::updateHistory(bool scrollbar)
@@ -701,8 +630,6 @@ namespace MWGui
// choices
const TextColours& textColours = MWBase::Environment::get().getWindowManager()->getTextColours();
mChoices = MWBase::Environment::get().getDialogueManager()->getChoices();
- mChoiceStyles.clear();
- mControllerChoice = -1; // -1 so you must make a choice (and can't accidentally pick the first answer)
for (std::pair& choice : mChoices)
{
auto link = std::make_unique(choice.second);
@@ -714,7 +641,6 @@ namespace MWGui
BookTypesetter::Style* questionStyle = typesetter->createHotStyle(
body, textColours.answer, textColours.answerOver, textColours.answerPressed, interactiveId);
typesetter->write(questionStyle, to_utf8_span(choice.first));
- mChoiceStyles.push_back(questionStyle);
}
mGoodbye = MWBase::Environment::get().getDialogueManager()->isGoodbye();
@@ -924,125 +850,4 @@ namespace MWGui
&& actor.getRefData().getLocals().getIntVar(actor.getClass().getScript(actor), "companion");
}
- void DialogueWindow::setControllerFocus(size_t index, bool focused)
- {
- // List is mTopicsList + "Goodbye" button below the list.
- if (index > mTopicsList->getItemCount())
- return;
-
- if (index == mTopicsList->getItemCount())
- {
- mGoodbyeButton->setStateSelected(focused);
- }
- else
- {
- const std::string& keyword = mTopicsList->getItemNameAt(mControllerFocus);
- if (keyword.empty())
- return;
-
- MyGUI::Button* button = mTopicsList->getItemWidget(keyword);
- button->setStateSelected(focused);
- }
-
- if (focused)
- {
- // Scroll the side bar to keep the active item in view
- if (index <= 8)
- mTopicsList->setViewOffset(0);
- else
- {
- int offset = 0;
- for (int i = 0; i < static_cast(index) - 8; i++)
- {
- const std::string& keyword = mTopicsList->getItemNameAt(i);
- if (keyword.empty())
- offset += 21;
- else
- offset += mTopicsList->getItemWidget(keyword)->getHeight() + 3;
- }
- mTopicsList->setViewOffset(-offset);
- }
- }
- }
-
- bool DialogueWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mChoices.size() > 0)
- {
- if (mChoices.size() == 1)
- onChoiceActivated(mChoices[0].second);
- else if (mControllerChoice >= 0 && mControllerChoice < static_cast(mChoices.size()))
- onChoiceActivated(mChoices[mControllerChoice].second);
- }
- else if (mControllerFocus == static_cast(mTopicsList->getItemCount()))
- onGoodbyeActivated();
- else
- onSelectListItem(mTopicsList->getItemNameAt(mControllerFocus), mControllerFocus);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B && mChoices.empty())
- {
- onGoodbyeActivated();
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- if (mChoices.size() > 0)
- {
- // In-dialogue choice (red text)
- mControllerChoice = std::clamp(mControllerChoice - 1, 0, static_cast(mChoices.size()) - 1);
- mHistory->setFocusItem(mChoiceStyles.at(mControllerChoice));
- }
- else
- {
- // Number of items is mTopicsList.length+1 because of "Goodbye" button.
- setControllerFocus(mControllerFocus, false);
- if (mControllerFocus <= 0)
- mControllerFocus = mTopicsList->getItemCount(); // "Goodbye" button
- else if (mTopicsList->getItemNameAt(mControllerFocus - 1).empty())
- mControllerFocus -= 2; // Skip separator
- else
- mControllerFocus--;
- setControllerFocus(mControllerFocus, true);
- }
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- if (mChoices.size() > 0)
- {
- // In-dialogue choice (red text)
- mControllerChoice = std::clamp(mControllerChoice + 1, 0, static_cast(mChoices.size()) - 1);
- mHistory->setFocusItem(mChoiceStyles.at(mControllerChoice));
- }
- else
- {
- // Number of items is mTopicsList.length+1 because of "Goodbye" button.
- setControllerFocus(mControllerFocus, false);
- if (mControllerFocus >= static_cast(mTopicsList->getItemCount()))
- mControllerFocus = 0;
- else if (mControllerFocus == static_cast(mTopicsList->getItemCount()) - 1)
- mControllerFocus = mTopicsList->getItemCount(); // "Goodbye" button
- else if (mTopicsList->getItemNameAt(mControllerFocus + 1).empty())
- mControllerFocus += 2; // Skip separator
- else
- mControllerFocus++;
- setControllerFocus(mControllerFocus, true);
- }
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER && mChoices.size() == 0)
- {
- setControllerFocus(mControllerFocus, false);
- mControllerFocus = std::max(mControllerFocus - 5, 0);
- setControllerFocus(mControllerFocus, true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER && mChoices.size() == 0)
- {
- setControllerFocus(mControllerFocus, false);
- mControllerFocus = std::min(mControllerFocus + 5, static_cast(mTopicsList->getItemCount()));
- setControllerFocus(mControllerFocus, true);
- }
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/dialogue.hpp b/apps/openmw/mwgui/dialogue.hpp
index 6f03076e92..8a8b309401 100644
--- a/apps/openmw/mwgui/dialogue.hpp
+++ b/apps/openmw/mwgui/dialogue.hpp
@@ -49,9 +49,6 @@ namespace MWGui
MyGUI::Widget* getDefaultKeyFocus() override;
- protected:
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
-
private:
std::unique_ptr mCallback;
@@ -68,9 +65,6 @@ namespace MWGui
MyGUI::Widget* mActionsBox;
Gui::AutoSizedTextBox* mGoldLabel;
- std::vector mButtons;
- int mControllerFocus = 0;
-
void adjustAction(MyGUI::Widget* action, int& totalHeight);
void onCancel(MyGUI::Widget* sender);
@@ -192,8 +186,6 @@ namespace MWGui
void onReferenceUnavailable() override;
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
-
private:
void updateDisposition();
void restock();
@@ -205,7 +197,6 @@ namespace MWGui
std::vector> mHistoryContents;
std::vector> mChoices;
- std::vector mChoiceStyles;
bool mGoodbye;
std::vector> mLinks;
@@ -229,10 +220,6 @@ namespace MWGui
std::unique_ptr mCallback;
std::unique_ptr mGreetingCallback;
- void setControllerFocus(size_t index, bool focused);
- int mControllerFocus = 0;
- int mControllerChoice = -1;
-
void updateTopicFormat();
};
}
diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp
index 7a1c1532f6..af4a3e8ce3 100644
--- a/apps/openmw/mwgui/enchantingdialog.cpp
+++ b/apps/openmw/mwgui/enchantingdialog.cpp
@@ -59,12 +59,6 @@ namespace MWGui
mBuyButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onBuyButtonClicked);
mTypeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onTypeButtonClicked);
mName->eventEditSelectAccept += MyGUI::newDelegate(this, &EnchantingDialog::onAccept);
-
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sCancel}";
- mControllerButtons.y = "#{OMWEngine:EnchantType}";
- mControllerButtons.l1 = "#{sItem}";
- mControllerButtons.r1 = "#{sSoulGem}";
}
void EnchantingDialog::onOpen()
@@ -158,7 +152,6 @@ namespace MWGui
mEnchanting.setSelfEnchanting(false);
mEnchanting.setEnchanter(ptr);
mBuyButton->setCaptionWithReplacing("#{sBuy}");
- mControllerButtons.x = "#{sBuy}";
mChanceLayout->setVisible(false);
mPtr = ptr;
setSoulGem(MWWorld::Ptr());
@@ -170,7 +163,6 @@ namespace MWGui
mEnchanting.setSelfEnchanting(true);
mEnchanting.setEnchanter(MWMechanics::getPlayer());
mBuyButton->setCaptionWithReplacing("#{sCreate}");
- mControllerButtons.x = "#{sCreate}";
mChanceLayout->setVisible(Settings::game().mShowEnchantChance);
mPtr = MWMechanics::getPlayer();
setSoulGem(ptr);
@@ -390,22 +382,4 @@ namespace MWGui
}
}
}
-
- bool EnchantingDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_B)
- onCancelButtonClicked(mCancelButton);
- else if (arg.button == SDL_CONTROLLER_BUTTON_X)
- onBuyButtonClicked(mBuyButton);
- else if (arg.button == SDL_CONTROLLER_BUTTON_Y)
- onTypeButtonClicked(mTypeButton);
- else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
- onSelectItem(mItemBox);
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
- onSelectSoul(mSoulBox);
- else
- return EffectEditorBase::onControllerButtonEvent(arg);
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/enchantingdialog.hpp b/apps/openmw/mwgui/enchantingdialog.hpp
index 3cda350152..4c720a11fc 100644
--- a/apps/openmw/mwgui/enchantingdialog.hpp
+++ b/apps/openmw/mwgui/enchantingdialog.hpp
@@ -73,8 +73,6 @@ namespace MWGui
MWMechanics::Enchanting mEnchanting;
ESM::EffectList mEffectList;
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
};
}
diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp
index a62120fc10..0a37c93b4f 100644
--- a/apps/openmw/mwgui/hud.cpp
+++ b/apps/openmw/mwgui/hud.cpp
@@ -243,17 +243,6 @@ namespace MWGui
mDrowningBar->setVisible(visible);
}
- void HUD::dropDraggedItem(float mouseX, float mouseY)
- {
- if (!mDragAndDrop->mIsOnDragAndDrop)
- return;
-
- MWBase::Environment::get().getWorld()->breakInvisibility(MWMechanics::getPlayer());
-
- WorldItemModel drop(mouseX, mouseY);
- mDragAndDrop->drop(&drop, nullptr);
- }
-
void HUD::onWorldClicked(MyGUI::Widget* _sender)
{
if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
@@ -263,12 +252,15 @@ namespace MWGui
if (mDragAndDrop->mIsOnDragAndDrop)
{
// drop item into the gameworld
+ MWBase::Environment::get().getWorld()->breakInvisibility(MWMechanics::getPlayer());
+
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
MyGUI::IntPoint cursorPosition = MyGUI::InputManager::getInstance().getMousePosition();
float mouseX = cursorPosition.left / float(viewSize.width);
float mouseY = cursorPosition.top / float(viewSize.height);
- dropDraggedItem(mouseX, mouseY);
+ WorldItemModel drop(mouseX, mouseY);
+ mDragAndDrop->drop(&drop, nullptr);
winMgr->changePointer("arrow");
}
diff --git a/apps/openmw/mwgui/hud.hpp b/apps/openmw/mwgui/hud.hpp
index 1a1076ff68..8dd98628c4 100644
--- a/apps/openmw/mwgui/hud.hpp
+++ b/apps/openmw/mwgui/hud.hpp
@@ -61,8 +61,6 @@ namespace MWGui
void clear() override;
- void dropDraggedItem(float mouseX, float mouseY);
-
private:
MyGUI::ProgressBar *mHealth, *mMagicka, *mStamina, *mEnemyHealth, *mDrowning;
MyGUI::Widget* mHealthFrame;
diff --git a/apps/openmw/mwgui/inventorytabsoverlay.cpp b/apps/openmw/mwgui/inventorytabsoverlay.cpp
deleted file mode 100644
index 35b4d1d87f..0000000000
--- a/apps/openmw/mwgui/inventorytabsoverlay.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-#include "inventorytabsoverlay.hpp"
-
-#include "../mwbase/environment.hpp"
-#include "../mwbase/windowmanager.hpp"
-
-namespace MWGui
-{
- InventoryTabsOverlay::InventoryTabsOverlay()
- : WindowBase("openmw_inventory_tabs.layout")
- {
- MyGUI::Button* tab;
-
- getWidget(tab, "TabMap");
- tab->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryTabsOverlay::onTabClicked);
- mTabs.push_back(tab);
-
- getWidget(tab, "TabInventory");
- tab->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryTabsOverlay::onTabClicked);
- mTabs.push_back(tab);
-
- getWidget(tab, "TabSpells");
- tab->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryTabsOverlay::onTabClicked);
- mTabs.push_back(tab);
-
- getWidget(tab, "TabStats");
- tab->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryTabsOverlay::onTabClicked);
- mTabs.push_back(tab);
- }
-
- void InventoryTabsOverlay::onTabClicked(MyGUI::Widget* sender)
- {
- if (!MWBase::Environment::get().getWindowManager()->getJournalAllowed())
- return;
-
- for (int i = 0; i < static_cast(mTabs.size()); i++)
- {
- if (mTabs[i] == sender)
- {
- MWBase::Environment::get().getWindowManager()->setActiveControllerWindow(GM_Inventory, i);
- setTab(i);
- break;
- }
- }
- }
-
- void InventoryTabsOverlay::setTab(int index)
- {
- for (int i = 0; i < static_cast(mTabs.size()); i++)
- mTabs[i]->setStateSelected(i == index);
- }
-}
diff --git a/apps/openmw/mwgui/inventorytabsoverlay.hpp b/apps/openmw/mwgui/inventorytabsoverlay.hpp
deleted file mode 100644
index 5368d9710f..0000000000
--- a/apps/openmw/mwgui/inventorytabsoverlay.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef MWGUI_INVENTORYTABSSOVERLAY_H
-#define MWGUI_INVENTORYTABSSOVERLAY_H
-
-#include
-
-#include "windowbase.hpp"
-
-namespace MWGui
-{
- class InventoryTabsOverlay : public WindowBase
- {
- public:
- InventoryTabsOverlay();
-
- void setTab(int index);
-
- private:
- std::vector mTabs;
-
- void onTabClicked(MyGUI::Widget* sender);
- };
-}
-
-#endif
diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp
index a398139df4..b4a2024052 100644
--- a/apps/openmw/mwgui/inventorywindow.cpp
+++ b/apps/openmw/mwgui/inventorywindow.cpp
@@ -31,11 +31,8 @@
#include "../mwmechanics/actorutil.hpp"
#include "../mwmechanics/npcstats.hpp"
-#include "companionwindow.hpp"
-#include "container.hpp"
#include "countdialog.hpp"
#include "draganddrop.hpp"
-#include "hud.hpp"
#include "inventoryitemmodel.hpp"
#include "itemview.hpp"
#include "settings.hpp"
@@ -130,21 +127,6 @@ namespace MWGui
setGuiMode(mGuiMode);
- if (Settings::gui().mControllerMenus)
- {
- // Show L1 and R1 buttons next to tabs
- MyGUI::Widget* image;
- getWidget(image, "BtnL1Image");
- image->setVisible(true);
- image->setUserString("Hidden", "false");
-
- getWidget(image, "BtnR1Image");
- image->setVisible(true);
- image->setUserString("Hidden", "false");
-
- mControllerButtons.r3 = "#{sInfo}";
- }
-
adjustPanes();
}
@@ -222,13 +204,9 @@ namespace MWGui
void InventoryWindow::setGuiMode(GuiMode mode)
{
- if (Settings::gui().mControllerMenus && mGuiMode == mode && isVisible())
- return;
-
mGuiMode = mode;
const WindowSettingValues settings = getModeSettings(mGuiMode);
- setPinButtonVisible(
- mode != GM_Container && mode != GM_Companion && mode != GM_Barter && !Settings::gui().mControllerMenus);
+ setPinButtonVisible(mode != GM_Container && mode != GM_Companion && mode != GM_Barter);
const WindowRectSettingValues& rect = settings.mIsMaximized ? settings.mMaximized : settings.mRegular;
@@ -324,9 +302,7 @@ namespace MWGui
}
}
- // Show a dialog to select a count of items, but not when using an item from the inventory
- // in controller mode. In that case, we skip the dialog and just use one item immediately.
- if (count > 1 && !shift && !(Settings::gui().mControllerMenus && mGuiMode == MWGui::GM_Inventory))
+ if (count > 1 && !shift)
{
CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
std::string message = mTrading ? "#{sQuanityMenuMessage01}" : "#{sTake}";
@@ -334,10 +310,7 @@ namespace MWGui
name += MWGui::ToolTips::getSoulString(object.getCellRef());
dialog->openCountDialog(name, message, count);
dialog->eventOkClicked.clear();
- if (Settings::gui().mControllerMenus
- && (mGuiMode == MWGui::GM_Companion || mGuiMode == MWGui::GM_Container))
- dialog->eventOkClicked += MyGUI::newDelegate(this, &InventoryWindow::giveItem);
- else if (mTrading)
+ if (mTrading)
dialog->eventOkClicked += MyGUI::newDelegate(this, &InventoryWindow::sellItem);
else
dialog->eventOkClicked += MyGUI::newDelegate(this, &InventoryWindow::dragItem);
@@ -417,32 +390,6 @@ namespace MWGui
notifyContentChanged();
}
- void InventoryWindow::giveItem(MyGUI::Widget* sender, int count)
- {
- ensureSelectedItemUnequipped(count);
- mDragAndDrop->startDrag(mSelectedItem, mSortModel, mTradeModel, mItemView, count);
- notifyContentChanged();
-
- if (mGuiMode == MWGui::GM_Companion && mDragAndDrop->mIsOnDragAndDrop)
- {
- // Drag and drop the item on the companion's window.
- MWGui::CompanionWindow* companionWindow = (MWGui::CompanionWindow*)MWBase::Environment::get()
- .getWindowManager()
- ->getGuiModeWindows(mGuiMode)
- .at(1);
- mDragAndDrop->drop(companionWindow->getModel(), companionWindow->getItemView());
- }
- else if (mGuiMode == MWGui::GM_Container && mDragAndDrop->mIsOnDragAndDrop)
- {
- // Drag and drop the item on the container window.
- MWGui::ContainerWindow* containerWindow = (MWGui::ContainerWindow*)MWBase::Environment::get()
- .getWindowManager()
- ->getGuiModeWindows(mGuiMode)
- .at(0);
- mDragAndDrop->drop(containerWindow->getModel(), containerWindow->getItemView());
- }
- }
-
void InventoryWindow::updateItemView()
{
MWBase::Environment::get().getWindowManager()->updateSpellWindow();
@@ -919,189 +866,4 @@ namespace MWGui
const MyGUI::IntSize viewport = getPreviewViewportSize();
return osg::Vec2f(normalisedX * float(viewport.width - 1), (1.0 - normalisedY) * float(viewport.height - 1));
}
-
- ControllerButtonStr* InventoryWindow::getControllerButtons()
- {
- switch (mGuiMode)
- {
- case MWGui::GM_Companion:
- mControllerButtons.a = "#{OMWEngine:InventorySelect}";
- mControllerButtons.b = "#{sClose}";
- mControllerButtons.x = "";
- mControllerButtons.y = "";
- mControllerButtons.r2 = "#{sCompanionShare}";
- break;
- case MWGui::GM_Container:
- mControllerButtons.a = "#{OMWEngine:InventorySelect}";
- mControllerButtons.b = "#{sClose}";
- mControllerButtons.x = "#{sTakeAll}";
- mControllerButtons.y = "";
- mControllerButtons.r2 = "#{sContainer}";
- break;
- case MWGui::GM_Barter:
- mControllerButtons.a = "#{sSell}";
- mControllerButtons.b = "#{sCancel}";
- mControllerButtons.x = "#{sOffer}";
- mControllerButtons.y = "";
- mControllerButtons.r2 = "#{sBarter}";
- break;
- case MWGui::GM_Inventory:
- default:
- mControllerButtons.a = "#{sEquip}";
- mControllerButtons.b = "#{sBack}";
- mControllerButtons.x = "#{sDrop}";
- mControllerButtons.y = "#{sUnequip}";
- mControllerButtons.r2 = "";
- break;
- }
- return &mControllerButtons;
- }
-
- bool InventoryWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- mItemView->onControllerButton(SDL_CONTROLLER_BUTTON_A);
- // The following actions are done here, not in onItemSelectedFromSourceModel, because we
- // want the mouse to work even in controller mode.
- if (mGuiMode == MWGui::GM_Inventory && mDragAndDrop->mIsOnDragAndDrop)
- {
- // Drag and drop the item on the avatar to activate it.
- onAvatarClicked(nullptr); // Equip or use
- // Drop any remaining items back in inventory. This is needed when clicking on a
- // stack of items; we only want to use the first item.
- onBackgroundSelected();
- }
- else if (mGuiMode == MWGui::GM_Companion && mDragAndDrop->mIsOnDragAndDrop)
- {
- // Drag and drop the item on the companion's window.
- MWGui::CompanionWindow* companionWindow = (MWGui::CompanionWindow*)MWBase::Environment::get()
- .getWindowManager()
- ->getGuiModeWindows(mGuiMode)
- .at(1);
- mDragAndDrop->drop(companionWindow->getModel(), companionWindow->getItemView());
- }
- else if (mGuiMode == MWGui::GM_Container && mDragAndDrop->mIsOnDragAndDrop)
- {
- // Drag and drop the item on the container window.
- MWGui::ContainerWindow* containerWindow = (MWGui::ContainerWindow*)MWBase::Environment::get()
- .getWindowManager()
- ->getGuiModeWindows(mGuiMode)
- .at(0);
- mDragAndDrop->drop(containerWindow->getModel(), containerWindow->getItemView());
- }
- // GM_Barter is handled by onControllerButtonEvent. No other steps are necessary.
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_X)
- {
- if (mGuiMode == MWGui::GM_Inventory)
- {
- // Drop the item into the gameworld
- mItemView->onControllerButton(SDL_CONTROLLER_BUTTON_A);
- if (mDragAndDrop->mIsOnDragAndDrop)
- MWBase::Environment::get().getWindowManager()->getHud()->dropDraggedItem(0.5f, 0.5f);
- }
- else if (mGuiMode == MWGui::GM_Container)
- {
- // Take all. Pass the button press to the container window and let it do the
- // logic of taking all.
- MWGui::ContainerWindow* containerWindow = (MWGui::ContainerWindow*)MWBase::Environment::get()
- .getWindowManager()
- ->getGuiModeWindows(mGuiMode)
- .at(0);
- containerWindow->onControllerButtonEvent(arg);
- }
- else if (mGuiMode == MWGui::GM_Barter)
- {
- // Offer. Pass the button press to the barter window and let it do the logic
- // of making an offer.
- MWGui::TradeWindow* tradeWindow = (MWGui::TradeWindow*)MWBase::Environment::get()
- .getWindowManager()
- ->getGuiModeWindows(mGuiMode)
- .at(1);
- tradeWindow->onControllerButtonEvent(arg);
- }
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_Y)
- {
- if (mGuiMode == MWGui::GM_Inventory)
- {
- // Unequip an item.
- mItemView->onControllerButton(SDL_CONTROLLER_BUTTON_A);
- onBackgroundSelected(); // Drop on inventory background to unequip
- }
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
- {
- if (mFilterAll->getStateSelected())
- onFilterChanged(mFilterMisc);
- else if (mFilterWeapon->getStateSelected())
- onFilterChanged(mFilterAll);
- else if (mFilterApparel->getStateSelected())
- onFilterChanged(mFilterWeapon);
- else if (mFilterMagic->getStateSelected())
- onFilterChanged(mFilterApparel);
- else if (mFilterMisc->getStateSelected())
- onFilterChanged(mFilterMagic);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
- {
- if (mFilterAll->getStateSelected())
- onFilterChanged(mFilterWeapon);
- else if (mFilterWeapon->getStateSelected())
- onFilterChanged(mFilterApparel);
- else if (mFilterApparel->getStateSelected())
- onFilterChanged(mFilterMagic);
- else if (mFilterMagic->getStateSelected())
- onFilterChanged(mFilterMisc);
- else if (mFilterMisc->getStateSelected())
- onFilterChanged(mFilterAll);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else
- {
- mItemView->onControllerButton(arg.button);
- }
-
- return true;
- }
-
- void InventoryWindow::setActiveControllerWindow(bool active)
- {
- if (!Settings::gui().mControllerMenus)
- return;
-
- if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Inventory)
- {
- // Fill the screen, or limit to a certain size on large screens. Size chosen to
- // match the size of the stats window.
- MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
- int width = std::min(viewSize.width, 1600);
- int height = std::min(viewSize.height - 48 - 48, 750);
- int x = (viewSize.width - width) / 2;
- int y = (viewSize.height - height) / 2;
-
- MyGUI::Window* window = mMainWidget->castType();
- window->setCoord(x, active ? y : viewSize.height + 1, width, height);
-
- adjustPanes();
- updatePreviewSize();
- }
-
- // Show L1 and R1 buttons next to tabs
- MyGUI::Widget* image;
- getWidget(image, "BtnL1Image");
- image->setVisible(active);
-
- getWidget(image, "BtnR1Image");
- image->setVisible(active);
-
- mItemView->setActiveControllerWindow(active);
- WindowBase::setActiveControllerWindow(active);
- }
}
diff --git a/apps/openmw/mwgui/inventorywindow.hpp b/apps/openmw/mwgui/inventorywindow.hpp
index a14e0f9477..9fc77ceec5 100644
--- a/apps/openmw/mwgui/inventorywindow.hpp
+++ b/apps/openmw/mwgui/inventorywindow.hpp
@@ -67,12 +67,8 @@ namespace MWGui
std::string_view getWindowIdForLua() const override { return "Inventory"; }
- ControllerButtonStr* getControllerButtons() override;
-
protected:
void onTitleDoubleClicked() override;
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- void setActiveControllerWindow(bool active) override;
private:
DragAndDrop* mDragAndDrop;
@@ -122,7 +118,6 @@ namespace MWGui
void sellItem(MyGUI::Widget* sender, int count);
void dragItem(MyGUI::Widget* sender, int count);
- void giveItem(MyGUI::Widget* sender, int count);
void onWindowResize(MyGUI::Window* _sender);
void onFilterChanged(MyGUI::Widget* _sender);
diff --git a/apps/openmw/mwgui/itemchargeview.cpp b/apps/openmw/mwgui/itemchargeview.cpp
index 31b29122f3..02c3cc182c 100644
--- a/apps/openmw/mwgui/itemchargeview.cpp
+++ b/apps/openmw/mwgui/itemchargeview.cpp
@@ -1,6 +1,5 @@
#include "itemchargeview.hpp"
-#include
#include
#include
@@ -10,11 +9,8 @@
#include
#include
-#include
#include "../mwbase/environment.hpp"
-#include "../mwbase/inputmanager.hpp"
-#include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/spellutil.hpp"
@@ -23,7 +19,6 @@
#include "itemmodel.hpp"
#include "itemwidget.hpp"
-#include "textcolours.hpp"
namespace MWGui
{
@@ -161,20 +156,11 @@ namespace MWGui
mScrollView->setCanvasSize(
MyGUI::IntSize(mScrollView->getWidth(), std::max(mScrollView->getHeight(), currentY)));
mScrollView->setVisibleVScroll(true);
-
- if (Settings::gui().mControllerMenus)
- updateControllerFocus(-1, mControllerFocus);
}
void ItemChargeView::resetScrollbars()
{
mScrollView->setViewOffset(MyGUI::IntPoint(0, 0));
-
- if (Settings::gui().mControllerMenus)
- {
- updateControllerFocus(mControllerFocus, 0);
- mControllerFocus = 0;
- }
}
void ItemChargeView::setSize(const MyGUI::IntSize& value)
@@ -238,52 +224,4 @@ namespace MWGui
mScrollView->setViewOffset(
MyGUI::IntPoint(0, static_cast(mScrollView->getViewOffset().top + rel * 0.3f)));
}
-
- void ItemChargeView::onControllerButton(const unsigned char button)
- {
- if (mLines.empty())
- return;
-
- int prevFocus = mControllerFocus;
-
- if (button == SDL_CONTROLLER_BUTTON_A)
- {
- // Select the focused item, if any.
- if (mControllerFocus >= 0 && mControllerFocus < static_cast(mLines.size()))
- onIconClicked(mLines[mControllerFocus].mIcon);
- }
- else if (button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- mControllerFocus = wrap(mControllerFocus - 1, mLines.size());
- else if (button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- mControllerFocus = wrap(mControllerFocus + 1, mLines.size());
-
- if (prevFocus != mControllerFocus)
- updateControllerFocus(prevFocus, mControllerFocus);
- }
-
- void ItemChargeView::updateControllerFocus(int prevFocus, int newFocus)
- {
- if (mLines.empty())
- return;
-
- const TextColours& textColours{ MWBase::Environment::get().getWindowManager()->getTextColours() };
-
- if (prevFocus >= 0 && prevFocus < static_cast(mLines.size()))
- {
- mLines[prevFocus].mText->setTextColour(textColours.normal);
- mLines[prevFocus].mIcon->setControllerFocus(false);
- }
-
- if (newFocus >= 0 && newFocus < static_cast(mLines.size()))
- {
- mLines[newFocus].mText->setTextColour(textColours.link);
- mLines[newFocus].mIcon->setControllerFocus(true);
-
- // Scroll the list to keep the active item in view
- if (newFocus <= 3)
- mScrollView->setViewOffset(MyGUI::IntPoint(0, 0));
- else
- mScrollView->setViewOffset(MyGUI::IntPoint(0, -55 * (newFocus - 3)));
- }
- }
}
diff --git a/apps/openmw/mwgui/itemchargeview.hpp b/apps/openmw/mwgui/itemchargeview.hpp
index 73bf9c3de2..f7617d37eb 100644
--- a/apps/openmw/mwgui/itemchargeview.hpp
+++ b/apps/openmw/mwgui/itemchargeview.hpp
@@ -52,8 +52,6 @@ namespace MWGui
MyGUI::delegates::MultiDelegate eventItemClicked;
- void onControllerButton(const unsigned char button);
-
private:
struct Line
{
@@ -74,9 +72,6 @@ namespace MWGui
std::unique_ptr mModel;
MyGUI::ScrollView* mScrollView;
DisplayMode mDisplayMode;
-
- int mControllerFocus;
- void updateControllerFocus(int prevFocus, int newFocus);
};
}
diff --git a/apps/openmw/mwgui/itemselection.cpp b/apps/openmw/mwgui/itemselection.cpp
index ad2b141d8d..4fe40ce693 100644
--- a/apps/openmw/mwgui/itemselection.cpp
+++ b/apps/openmw/mwgui/itemselection.cpp
@@ -3,8 +3,6 @@
#include
#include
-#include
-
#include "inventoryitemmodel.hpp"
#include "itemview.hpp"
#include "sortfilteritemmodel.hpp"
@@ -28,10 +26,6 @@ namespace MWGui
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ItemSelectionDialog::onCancelButtonClicked);
center();
-
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sCancel}";
- mControllerButtons.r3 = "#{sInfo}";
}
bool ItemSelectionDialog::exit()
@@ -46,8 +40,6 @@ namespace MWGui
mSortModel = sortModel.get();
mItemView->setModel(std::move(sortModel));
mItemView->resetScrollBars();
- if (Settings::gui().mControllerMenus)
- mItemView->setActiveControllerWindow(true);
}
void ItemSelectionDialog::setCategory(int category)
@@ -73,13 +65,4 @@ namespace MWGui
exit();
}
- bool ItemSelectionDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_B)
- onCancelButtonClicked(nullptr);
- else
- mItemView->onControllerButton(arg.button);
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/itemselection.hpp b/apps/openmw/mwgui/itemselection.hpp
index 83af6d4840..fe87d7e38a 100644
--- a/apps/openmw/mwgui/itemselection.hpp
+++ b/apps/openmw/mwgui/itemselection.hpp
@@ -41,7 +41,6 @@ namespace MWGui
void onSelectedItem(int index);
void onCancelButtonClicked(MyGUI::Widget* sender);
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
};
}
diff --git a/apps/openmw/mwgui/itemview.cpp b/apps/openmw/mwgui/itemview.cpp
index 0afb3d3d76..ff05a8b2d6 100644
--- a/apps/openmw/mwgui/itemview.cpp
+++ b/apps/openmw/mwgui/itemview.cpp
@@ -7,12 +7,6 @@
#include
#include
-#include
-
-#include "../mwbase/environment.hpp"
-#include "../mwbase/inputmanager.hpp"
-#include "../mwbase/windowmanager.hpp"
-
#include "itemmodel.hpp"
#include "itemwidget.hpp"
@@ -21,7 +15,6 @@ namespace MWGui
ItemView::ItemView()
: mScrollView(nullptr)
- , mControllerActiveWindow(false)
{
}
@@ -53,16 +46,13 @@ namespace MWGui
MyGUI::Widget* dragArea = mScrollView->getChildAt(0);
int maxHeight = mScrollView->getHeight();
- mRows = std::max(maxHeight / 42, 1);
- mItemCount = dragArea->getChildCount();
- bool showScrollbar = int(std::ceil(mItemCount / float(mRows))) > mScrollView->getWidth() / 42;
+ int rows = maxHeight / 42;
+ rows = std::max(rows, 1);
+ bool showScrollbar = int(std::ceil(dragArea->getChildCount() / float(rows))) > mScrollView->getWidth() / 42;
if (showScrollbar)
- {
maxHeight -= 18;
- mRows = std::max(maxHeight / 42, 1);
- }
- for (int i = 0; i < mItemCount; ++i)
+ for (unsigned int i = 0; i < dragArea->getChildCount(); ++i)
{
MyGUI::Widget* w = dragArea->getChildAt(i);
@@ -70,7 +60,7 @@ namespace MWGui
y += 42;
- if (y > maxHeight - 42 && i < mItemCount - 1)
+ if (y > maxHeight - 42 && i < dragArea->getChildCount() - 1)
{
x += 42;
y = 0;
@@ -80,12 +70,6 @@ namespace MWGui
MyGUI::IntSize size = MyGUI::IntSize(std::max(mScrollView->getSize().width, x), mScrollView->getSize().height);
- if (Settings::gui().mControllerMenus)
- {
- mControllerFocus = std::clamp(mControllerFocus, 0, mItemCount - 1);
- updateControllerFocus(-1, mControllerFocus);
- }
-
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the
// scrollbar is hidden
mScrollView->setVisibleVScroll(false);
@@ -138,11 +122,6 @@ namespace MWGui
void ItemView::resetScrollBars()
{
mScrollView->setViewOffset(MyGUI::IntPoint(0, 0));
- if (Settings::gui().mControllerMenus)
- {
- updateControllerFocus(mControllerFocus, 0);
- mControllerFocus = 0;
- }
}
void ItemView::onSelectedItem(MyGUI::Widget* sender)
@@ -186,106 +165,4 @@ namespace MWGui
MyGUI::FactoryManager::getInstance().registerFactory("Widget");
}
- void ItemView::setActiveControllerWindow(bool active)
- {
- mControllerActiveWindow = active;
-
- MWBase::Environment::get().getWindowManager()->setControllerTooltip(
- active && Settings::gui().mControllerTooltips);
-
- if (active)
- updateControllerFocus(-1, mControllerFocus);
- else
- updateControllerFocus(mControllerFocus, -1);
- }
-
- void ItemView::onControllerButton(const unsigned char button)
- {
- if (!mItemCount)
- return;
-
- int prevFocus = mControllerFocus;
-
- if (button == SDL_CONTROLLER_BUTTON_A)
- {
- // Select the focused item, if any.
- if (mControllerFocus >= 0 && mControllerFocus < mItemCount)
- {
- MyGUI::Widget* dragArea = mScrollView->getChildAt(0);
- onSelectedItem(dragArea->getChildAt(mControllerFocus));
- }
- }
- else if (button == SDL_CONTROLLER_BUTTON_RIGHTSTICK)
- {
- // Toggle info tooltip
- MWBase::Environment::get().getWindowManager()->setControllerTooltip(
- !MWBase::Environment::get().getWindowManager()->getControllerTooltip());
- updateControllerFocus(-1, mControllerFocus);
- }
- else if (button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- if (mControllerFocus % mRows == 0)
- mControllerFocus = std::min(mControllerFocus + mRows - 1, mItemCount - 1);
- else
- mControllerFocus--;
- }
- else if (button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- if (mControllerFocus % mRows == mRows - 1 || mControllerFocus == mItemCount - 1)
- mControllerFocus -= mControllerFocus % mRows;
- else
- mControllerFocus++;
- }
- else if (button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && mControllerFocus >= mRows)
- mControllerFocus -= mRows;
- else if (button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- {
- if (mControllerFocus + mRows < mItemCount)
- mControllerFocus += mRows;
- else if (mControllerFocus / mRows != (mItemCount - 1) / mRows)
- mControllerFocus = mItemCount - 1;
- }
-
- if (prevFocus != mControllerFocus)
- updateControllerFocus(prevFocus, mControllerFocus);
- else
- updateControllerFocus(-1, mControllerFocus);
- }
-
- void ItemView::updateControllerFocus(int prevFocus, int newFocus)
- {
- MWBase::Environment::get().getWindowManager()->setCursorVisible(
- !MWBase::Environment::get().getWindowManager()->getControllerTooltip());
-
- if (!mItemCount)
- return;
-
- MyGUI::Widget* dragArea = mScrollView->getChildAt(0);
-
- if (prevFocus >= 0 && prevFocus < mItemCount)
- {
- ItemWidget* prev = (ItemWidget*)dragArea->getChildAt(prevFocus);
- if (prev)
- prev->setControllerFocus(false);
- }
-
- if (mControllerActiveWindow && newFocus >= 0 && newFocus < mItemCount)
- {
- ItemWidget* focused = (ItemWidget*)dragArea->getChildAt(newFocus);
- if (focused)
- {
- focused->setControllerFocus(true);
-
- // Scroll the list to keep the active item in view
- int column = newFocus / mRows;
- if (column <= 3)
- mScrollView->setViewOffset(MyGUI::IntPoint(0, 0));
- else
- mScrollView->setViewOffset(MyGUI::IntPoint(-42 * (column - 3), 0));
-
- if (MWBase::Environment::get().getWindowManager()->getControllerTooltip())
- MWBase::Environment::get().getInputManager()->warpMouseToWidget(focused);
- }
- }
- }
}
diff --git a/apps/openmw/mwgui/itemview.hpp b/apps/openmw/mwgui/itemview.hpp
index 7915a4dcf1..cfbc8a37ac 100644
--- a/apps/openmw/mwgui/itemview.hpp
+++ b/apps/openmw/mwgui/itemview.hpp
@@ -2,7 +2,6 @@
#define MWGUI_ITEMVIEW_H
#include
-#include
#include "itemmodel.hpp"
@@ -32,11 +31,6 @@ namespace MWGui
void resetScrollBars();
- void setActiveControllerWindow(bool active);
- int getControllerFocus() { return mControllerFocus; }
- int getItemCount() { return mItemCount; }
- void onControllerButton(const unsigned char button);
-
private:
void initialiseOverride() override;
@@ -51,12 +45,6 @@ namespace MWGui
std::unique_ptr mModel;
MyGUI::ScrollView* mScrollView;
-
- int mItemCount = 0;
- int mRows;
- int mControllerFocus = 0;
- bool mControllerActiveWindow;
- void updateControllerFocus(int prevFocus, int newFocus);
};
}
diff --git a/apps/openmw/mwgui/itemwidget.cpp b/apps/openmw/mwgui/itemwidget.cpp
index 5e47577b27..05fff2d40f 100644
--- a/apps/openmw/mwgui/itemwidget.cpp
+++ b/apps/openmw/mwgui/itemwidget.cpp
@@ -58,7 +58,6 @@ namespace MWGui
: mItem(nullptr)
, mItemShadow(nullptr)
, mFrame(nullptr)
- , mControllerBorder(nullptr)
, mText(nullptr)
{
}
@@ -83,22 +82,10 @@ namespace MWGui
assignWidget(mText, "Text");
if (mText)
mText->setNeedMouseFocus(false);
- if (Settings::gui().mControllerMenus)
- {
- assignWidget(mControllerBorder, "ControllerBorder");
- if (mControllerBorder)
- mControllerBorder->setNeedMouseFocus(false);
- }
Base::initialiseOverride();
}
- void ItemWidget::setControllerFocus(bool focus)
- {
- if (mControllerBorder)
- mControllerBorder->setVisible(focus);
- }
-
void ItemWidget::setCount(int count)
{
if (!mText)
diff --git a/apps/openmw/mwgui/itemwidget.hpp b/apps/openmw/mwgui/itemwidget.hpp
index 1191a23342..63837ae92f 100644
--- a/apps/openmw/mwgui/itemwidget.hpp
+++ b/apps/openmw/mwgui/itemwidget.hpp
@@ -40,15 +40,12 @@ namespace MWGui
void setIcon(const MWWorld::Ptr& ptr);
void setFrame(const std::string& frame, const MyGUI::IntCoord& coord);
- void setControllerFocus(bool focus);
-
protected:
void initialiseOverride() override;
MyGUI::ImageBox* mItem;
MyGUI::ImageBox* mItemShadow;
MyGUI::ImageBox* mFrame;
- MyGUI::ImageBox* mControllerBorder;
MyGUI::TextBox* mText;
std::string mCurrentIcon;
diff --git a/apps/openmw/mwgui/journalbooks.cpp b/apps/openmw/mwgui/journalbooks.cpp
index c127508062..86b45b4863 100644
--- a/apps/openmw/mwgui/journalbooks.cpp
+++ b/apps/openmw/mwgui/journalbooks.cpp
@@ -169,7 +169,7 @@ namespace MWGui
{
BookTypesetter::Ptr typesetter = createTypesetter();
- BookTypesetter::Style* header = typesetter->createStyle({}, journalHeaderColour);
+ BookTypesetter::Style* header = typesetter->createStyle({}, MyGUI::Colour(0.60f, 0.00f, 0.00f));
BookTypesetter::Style* body = typesetter->createStyle({}, MyGUI::Colour::Black);
typesetter->write(header, to_utf8_span("You have no journal entries!"));
@@ -184,7 +184,7 @@ namespace MWGui
{
BookTypesetter::Ptr typesetter = createTypesetter();
- BookTypesetter::Style* header = typesetter->createStyle({}, journalHeaderColour);
+ BookTypesetter::Style* header = typesetter->createStyle({}, MyGUI::Colour(0.60f, 0.00f, 0.00f));
BookTypesetter::Style* body = typesetter->createStyle({}, MyGUI::Colour::Black);
mModel->visitJournalEntries({}, AddJournalEntry(typesetter, body, header, true));
@@ -196,7 +196,7 @@ namespace MWGui
{
BookTypesetter::Ptr typesetter = createTypesetter();
- BookTypesetter::Style* header = typesetter->createStyle({}, journalHeaderColour);
+ BookTypesetter::Style* header = typesetter->createStyle({}, MyGUI::Colour(0.60f, 0.00f, 0.00f));
BookTypesetter::Style* body = typesetter->createStyle({}, MyGUI::Colour::Black);
mModel->visitTopicName(topicId, AddTopicName(typesetter, header));
@@ -212,7 +212,7 @@ namespace MWGui
{
BookTypesetter::Ptr typesetter = createTypesetter();
- BookTypesetter::Style* header = typesetter->createStyle({}, journalHeaderColour);
+ BookTypesetter::Style* header = typesetter->createStyle({}, MyGUI::Colour(0.60f, 0.00f, 0.00f));
BookTypesetter::Style* body = typesetter->createStyle({}, MyGUI::Colour::Black);
AddQuestName addName(typesetter, header);
diff --git a/apps/openmw/mwgui/journalbooks.hpp b/apps/openmw/mwgui/journalbooks.hpp
index 2549b2ad5b..792edcc070 100644
--- a/apps/openmw/mwgui/journalbooks.hpp
+++ b/apps/openmw/mwgui/journalbooks.hpp
@@ -10,8 +10,6 @@ namespace MWGui
{
MWGui::BookTypesetter::Utf8Span to_utf8_span(std::string_view text);
- const MyGUI::Colour journalHeaderColour = MyGUI::Colour(0.60f, 0.00f, 0.00f);
-
struct JournalBooks
{
typedef TypesetBook::Ptr Book;
diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp
index 8302f4faea..574c425d3e 100644
--- a/apps/openmw/mwgui/journalwindow.cpp
+++ b/apps/openmw/mwgui/journalwindow.cpp
@@ -218,10 +218,6 @@ namespace
}
}
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.x = "#{OMWEngine:JournalQuests}";
- mControllerButtons.y = "#{sTopics}";
-
mQuestMode = false;
mAllQuests = false;
mOptionsMode = false;
@@ -252,9 +248,6 @@ namespace
}
updateShowingPages();
- if (Settings::gui().mControllerMenus)
- setControllerFocusedQuest(0);
-
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(getWidget(CloseBTN));
}
@@ -282,8 +275,6 @@ namespace
updateShowingPages();
updateCloseJournalButton();
-
- MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
}
void setOptionsMode()
@@ -316,8 +307,6 @@ namespace
notifyQuests(getWidget(QuestsList));
else
notifyTopics(getWidget(TopicsList));
-
- MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
}
void pushBook(Book& book, unsigned int page)
@@ -349,7 +338,6 @@ namespace
{
setVisible(CloseBTN, mStates.size() < 2);
setVisible(JournalBTN, mStates.size() >= 2);
- MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
}
void updateShowingPages()
@@ -392,8 +380,6 @@ namespace
setText(PageOneNum, page + 1);
setText(PageTwoNum, page + 2);
-
- MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
}
void notifyKeyPress(MyGUI::Widget* sender, MyGUI::KeyCode key, MyGUI::Char character)
@@ -421,7 +407,6 @@ namespace
mTopicsMode = false;
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("book page"));
- MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
}
void notifyTopicSelected(const std::string& topicIdString, int id)
@@ -454,7 +439,6 @@ namespace
mOptionsMode = false;
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("book page"));
- MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
}
void notifyOptions(MyGUI::Widget* _sender)
@@ -475,9 +459,6 @@ namespace
getPage(LeftTopicIndex)->showPage(mTopicIndexBook, 0);
getPage(RightTopicIndex)->showPage(mTopicIndexBook, 1);
}
-
- if (Settings::gui().mControllerMenus)
- setIndexControllerFocus(true);
}
void notifyJournal(MyGUI::Widget* _sender)
@@ -486,22 +467,6 @@ namespace
popBook();
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("book page"));
- MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
- }
-
- void addControllerButtons(Gui::MWList* _list, size_t _selectedIndex)
- {
- mButtons.clear();
- for (size_t i = 0; i < _list->getItemCount(); i++)
- {
- MyGUI::Button* listItem = _list->getItemWidget(_list->getItemNameAt(i));
- if (listItem)
- {
- listItem->setTextColour(
- mButtons.size() == _selectedIndex ? MWGui::journalHeaderColour : MyGUI::Colour::Black);
- mButtons.push_back(listItem);
- }
- }
}
void notifyIndexLinkClicked(MWGui::TypesetBook::InteractiveId index)
@@ -522,14 +487,7 @@ namespace
list->adjustSize();
- if (Settings::gui().mControllerMenus)
- {
- setControllerFocusedQuest(0);
- addControllerButtons(list, mSelectedQuest);
- }
-
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("book page"));
- MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
}
void notifyTopics(MyGUI::Widget* _sender)
@@ -545,7 +503,6 @@ namespace
setVisible(ShowActiveBTN, false);
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("book page"));
- MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
}
struct AddNamesToList
@@ -597,12 +554,6 @@ namespace
list->sort();
list->adjustSize();
- if (Settings::gui().mControllerMenus)
- {
- addControllerButtons(list, mSelectedQuest);
- setControllerFocusedQuest(MWGui::wrap(mSelectedQuest, mButtons.size()));
- }
-
if (mAllQuests)
{
SetNamesInactive setInactive(list);
@@ -610,7 +561,6 @@ namespace
}
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("book page"));
- MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
}
void notifyShowAll(MyGUI::Widget* _sender)
@@ -689,299 +639,6 @@ namespace
}
}
}
-
- MWGui::ControllerButtonStr* getControllerButtons() override
- {
- mControllerButtons.b = mOptionsMode || mStates.size() > 1 ? "#{sBack}" : "#{sClose}";
- mControllerButtons.l1 = mOptionsMode ? "" : "#{sPrev}";
- mControllerButtons.r1 = mOptionsMode ? "" : "#{sNext}";
- mControllerButtons.r3 = mOptionsMode && mQuestMode ? "#{OMWEngine:JournalShowAll}" : "";
- return &mControllerButtons;
- }
-
- void setIndexControllerFocus(bool focused)
- {
- int col, row;
- bool isRussian = (mEncoding == ToUTF8::WINDOWS_1251);
- if (isRussian)
- {
- // Cyrillic = 30 (10 + 10 + 10)
- col = mSelectedIndex / 10;
- row = mSelectedIndex % 10;
- }
- else
- {
- // Latin = 26 (13 + 13)
- col = mSelectedIndex / 13;
- row = mSelectedIndex % 13;
- }
-
- mTopicIndexBook->setColour(col, row, 0, focused ? MWGui::journalHeaderColour : MyGUI::Colour::Black);
- }
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override
- {
- bool isRussian = (mEncoding == ToUTF8::WINDOWS_1251);
-
- if (arg.button == SDL_CONTROLLER_BUTTON_A) // A: Mouse click or Select
- {
- if (mOptionsMode && mQuestMode)
- {
- // Choose a quest
- Gui::MWList* list = getWidget(QuestsList);
- notifyQuestClicked(list->getItemNameAt(mSelectedQuest), 0);
- }
- else if (mOptionsMode && mTopicsMode)
- {
- // Choose a topic
- Gui::MWList* list = getWidget(TopicsList);
- notifyTopicSelected(list->getItemNameAt(mSelectedQuest), 0);
- }
- else if (mOptionsMode)
- {
- // Choose an index. Cyrillic capital A is a 0xd090 in UTF-8.
- // Words can not be started with characters 26 or 28.
- int russianOffset = 0xd090;
- if (mSelectedIndex >= 26)
- russianOffset++;
- if (mSelectedIndex >= 27)
- russianOffset++; // 27, not 28, because of skipping char 26
- notifyIndexLinkClicked(isRussian ? mSelectedIndex + russianOffset : mSelectedIndex + 'A');
- }
- return true;
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B) // B: Back
- {
- if (mOptionsMode)
- {
- // Hide the options overlay
- notifyCancel(getWidget(CancelBTN));
- mQuestMode = false;
- }
- else if (mStates.size() > 1)
- {
- // Pop the current book. If in quest mode, reopen the quest list.
- notifyJournal(getWidget(JournalBTN));
- if (mQuestMode)
- {
- notifyOptions(getWidget(OptionsBTN));
- notifyQuests(getWidget(QuestsBTN));
- }
- }
- else
- {
- // Close the journal window
- notifyClose(getWidget(CloseBTN));
- }
- return true;
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_X) // X: Quests
- {
- if (mOptionsMode && mQuestMode)
- {
- // Hide the quest overlay if visible
- notifyCancel(getWidget(CancelBTN));
- mQuestMode = false;
- }
- else
- {
- // Show the quest overlay if viewing a journal entry or the topics
- if (!mOptionsMode)
- notifyOptions(getWidget(OptionsBTN));
- if (!mQuestMode)
- notifyQuests(getWidget(QuestsBTN));
- }
- return true;
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_Y) // Y: Topics
- {
- if (mOptionsMode && !mQuestMode)
- {
- // Hide the topics overlay if visible
- notifyCancel(getWidget(CancelBTN));
- mQuestMode = false;
- }
- else
- {
- // Show the topics overlay if viewing a journal entry or the quest list
- if (!mOptionsMode)
- notifyOptions(getWidget(OptionsBTN));
- if (mQuestMode)
- notifyTopics(getWidget(TopicsBTN));
- }
- return true;
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK) // R3: Show All/Some
- {
- if (mAllQuests)
- notifyShowActive(getWidget(ShowActiveBTN));
- else
- notifyShowAll(getWidget(ShowAllBTN));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- if (mOptionsMode && (mQuestMode || mTopicsMode))
- {
- if (mButtons.size() <= 1)
- return true;
-
- // Scroll through the list of quests or topics
- setControllerFocusedQuest(MWGui::wrap(mSelectedQuest - 1, mButtons.size()));
- }
- else if (mOptionsMode)
- {
- setIndexControllerFocus(false);
- if (isRussian)
- {
- // Cyrillic = 30 (10 + 10 + 10)
- if (mSelectedIndex == 0)
- mSelectedIndex = 9;
- else if (mSelectedIndex == 10)
- mSelectedIndex = 19;
- else if (mSelectedIndex == 20)
- mSelectedIndex = 29;
- else
- mSelectedIndex--;
- }
- else
- {
- // Latin = 26 (13 + 13)
- if (mSelectedIndex == 0)
- mSelectedIndex = 12;
- else if (mSelectedIndex == 13)
- mSelectedIndex = 25;
- else
- mSelectedIndex--;
- }
- setIndexControllerFocus(true);
- setText(PageOneNum, 1); // Redraw the list
- }
- return true;
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- if (mOptionsMode && (mQuestMode || mTopicsMode))
- {
- if (mButtons.size() <= 1)
- return true;
-
- // Scroll through the list of quests or topics
- setControllerFocusedQuest(MWGui::wrap(mSelectedQuest + 1, mButtons.size()));
- }
- else if (mOptionsMode)
- {
- setIndexControllerFocus(false);
- if (isRussian)
- {
- // Cyrillic = 30 (10 + 10 + 10)
- if (mSelectedIndex == 9)
- mSelectedIndex = 0;
- else if (mSelectedIndex == 19)
- mSelectedIndex = 10;
- else if (mSelectedIndex == 29)
- mSelectedIndex = 20;
- else
- mSelectedIndex++;
- }
- else
- {
- // Latin = 26 (13 + 13)
- if (mSelectedIndex == 12)
- mSelectedIndex = 0;
- else if (mSelectedIndex == 25)
- mSelectedIndex = 13;
- else
- mSelectedIndex++;
- }
- setIndexControllerFocus(true);
- setText(PageOneNum, 1); // Redraw the list
- }
- return true;
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
- {
- if (!mOptionsMode)
- notifyPrevPage(getWidget(PrevPageBTN));
- else if (mOptionsMode && !mQuestMode && !mTopicsMode)
- {
- setIndexControllerFocus(false);
- if (isRussian)
- {
- // Cyrillic = 30 (10 + 10 + 10)
- mSelectedIndex = (mSelectedIndex + 20) % 30;
- }
- else
- {
- // Latin = 26 (13 + 13)
- mSelectedIndex = (mSelectedIndex + 13) % 26;
- }
- setIndexControllerFocus(true);
- setText(PageOneNum, 1); // Redraw the list
- }
- return true;
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- {
- if (!mOptionsMode)
- notifyNextPage(getWidget(NextPageBTN));
- else if (mOptionsMode && !mQuestMode && !mTopicsMode)
- {
- setIndexControllerFocus(false);
- if (isRussian)
- {
- // Cyrillic = 30 (10 + 10 + 10)
- mSelectedIndex = (mSelectedIndex + 10) % 30;
- }
- else
- {
- // Latin = 26 (13 + 13)
- mSelectedIndex = (mSelectedIndex + 13) % 26;
- }
- setIndexControllerFocus(true);
- setText(PageOneNum, 1); // Redraw the list
- }
- return true;
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER) // LB: Previous Page
- {
- if (!mOptionsMode)
- notifyPrevPage(getWidget(PrevPageBTN));
- return true;
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER) // RB: Next Page
- {
- if (!mOptionsMode)
- notifyNextPage(getWidget(NextPageBTN));
- return true;
- }
-
- return false;
- }
-
- void setControllerFocusedQuest(size_t index)
- {
- size_t listSize = mButtons.size();
- if (mSelectedQuest < listSize)
- mButtons[mSelectedQuest]->setTextColour(MyGUI::Colour::Black);
-
- mSelectedQuest = index;
- if (mSelectedQuest < listSize)
- {
- mButtons[mSelectedQuest]->setTextColour(MWGui::journalHeaderColour);
-
- // Scroll the list to keep the active item in view
- Gui::MWList* list = getWidget(mQuestMode ? QuestsList : TopicsList);
- if (mSelectedQuest <= 3)
- list->setViewOffset(0);
- else
- {
- int offset = 0;
- for (int i = 0; i < static_cast(mSelectedQuest) - 3; i++)
- offset += mButtons[i]->getHeight() + 3;
- list->setViewOffset(-offset);
- }
- }
- }
};
}
diff --git a/apps/openmw/mwgui/journalwindow.hpp b/apps/openmw/mwgui/journalwindow.hpp
index 4a1f686ff1..f0f394156c 100644
--- a/apps/openmw/mwgui/journalwindow.hpp
+++ b/apps/openmw/mwgui/journalwindow.hpp
@@ -31,12 +31,6 @@ namespace MWGui
void setVisible(bool newValue) override = 0;
std::string_view getWindowIdForLua() const override { return "Journal"; }
-
- std::vector mButtons;
- size_t mSelectedQuest = 0;
- size_t mSelectedIndex = 0;
- void setIndexControllerFocus(bool focused);
- void setControllerFocusedQuest(size_t index);
};
}
diff --git a/apps/openmw/mwgui/levelupdialog.cpp b/apps/openmw/mwgui/levelupdialog.cpp
index b9c90e51e2..87f2db55a5 100644
--- a/apps/openmw/mwgui/levelupdialog.cpp
+++ b/apps/openmw/mwgui/levelupdialog.cpp
@@ -8,7 +8,6 @@
#include
#include
-#include
#include
#include "../mwbase/environment.hpp"
@@ -73,7 +72,6 @@ namespace MWGui
widgets.mButton->setCaption(attribute.mName);
widgets.mValue = hbox->createWidget("SandText", {}, MyGUI::Align::Default);
mAttributeWidgets.emplace(attribute.mId, widgets);
- mAttributeButtons.emplace_back(widgets.mButton);
++i;
}
@@ -92,15 +90,6 @@ namespace MWGui
mCoins.push_back(image);
}
- if (Settings::gui().mControllerMenus)
- {
- mDisableGamepadCursor = true;
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.x = "#{sDone}";
- mOkButton->setCaption(
- MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sDone", {})));
- }
-
center();
}
@@ -228,13 +217,6 @@ namespace MWGui
center();
- if (Settings::gui().mControllerMenus)
- {
- mControllerFocus = 0;
- for (size_t i = 0; i < mAttributeButtons.size(); i++)
- setControllerFocus(mAttributeButtons, i, i == 0);
- }
-
// Play LevelUp Music
MWBase::Environment::get().getSoundManager()->streamMusic(MWSound::triumphMusic, MWSound::MusicType::Normal);
}
@@ -381,48 +363,4 @@ namespace MWGui
return ret;
}
-
- bool LevelupDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mControllerFocus >= 0 && mControllerFocus < static_cast(mAttributeButtons.size()))
- onAttributeClicked(mAttributeButtons[mControllerFocus]);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Item Gold Up"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_X)
- {
- onOkButtonClicked(mOkButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- setControllerFocus(mAttributeButtons, mControllerFocus, false);
- if (mControllerFocus == 0)
- mControllerFocus = 3;
- else if (mControllerFocus == 4)
- mControllerFocus = 7;
- else
- mControllerFocus--;
- setControllerFocus(mAttributeButtons, mControllerFocus, true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- setControllerFocus(mAttributeButtons, mControllerFocus, false);
- if (mControllerFocus == 3)
- mControllerFocus = 0;
- else if (mControllerFocus == 7)
- mControllerFocus = 4;
- else
- mControllerFocus++;
- setControllerFocus(mAttributeButtons, mControllerFocus, true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT || arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- {
- setControllerFocus(mAttributeButtons, mControllerFocus, false);
- mControllerFocus = (mControllerFocus + 4) % mAttributeButtons.size();
- setControllerFocus(mAttributeButtons, mControllerFocus, true);
- }
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/levelupdialog.hpp b/apps/openmw/mwgui/levelupdialog.hpp
index 8a34a94c8b..486390679b 100644
--- a/apps/openmw/mwgui/levelupdialog.hpp
+++ b/apps/openmw/mwgui/levelupdialog.hpp
@@ -49,10 +49,6 @@ namespace MWGui
std::string_view getLevelupClassImage(
const int combatIncreases, const int magicIncreases, const int stealthIncreases);
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- std::vector mAttributeButtons;
- int mControllerFocus;
};
}
diff --git a/apps/openmw/mwgui/mainmenu.cpp b/apps/openmw/mwgui/mainmenu.cpp
index d9d5b5c33b..1b3619bd9f 100644
--- a/apps/openmw/mwgui/mainmenu.cpp
+++ b/apps/openmw/mwgui/mainmenu.cpp
@@ -1,7 +1,6 @@
#include "mainmenu.hpp"
#include
-#include
#include
#include
@@ -106,7 +105,6 @@ namespace MWGui
constexpr VFS::Path::NormalizedView menuBackgroundVideo("video/menu_background.bik");
mHasAnimatedMenu = mVFS->exists(menuBackgroundVideo);
- mDisableGamepadCursor = Settings::gui().mControllerMenus;
updateMenu();
}
@@ -165,7 +163,9 @@ namespace MWGui
const std::string& name = *sender->getUserData();
winMgr->playSound(ESM::RefId::stringRefId("Menu Click"));
if (name == "return")
+ {
winMgr->removeGuiMode(GM_MainMenu);
+ }
else if (name == "credits")
winMgr->playVideo("mw_credits.bik", true);
else if (name == "exitgame")
@@ -208,32 +208,6 @@ namespace MWGui
}
}
- bool MainMenu::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::Space, 0, false);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B || arg.button == SDL_CONTROLLER_BUTTON_START)
- {
- if (mButtons["return"]->getVisible())
- onButtonClicked(mButtons["return"]);
- else
- MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::Escape, 0, false);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- MyGUI::InputManager::getInstance().injectKeyPress(MyGUI::KeyCode::LeftShift);
- MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::Tab, 0, false);
- MyGUI::InputManager::getInstance().injectKeyRelease(MyGUI::KeyCode::LeftShift);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::Tab, 0, false);
- }
- return true;
- }
-
void MainMenu::showBackground(bool show)
{
if (mVideo && !show)
diff --git a/apps/openmw/mwgui/mainmenu.hpp b/apps/openmw/mwgui/mainmenu.hpp
index 453a16b5e4..06a8c945c1 100644
--- a/apps/openmw/mwgui/mainmenu.hpp
+++ b/apps/openmw/mwgui/mainmenu.hpp
@@ -49,7 +49,6 @@ namespace MWGui
MainMenu(int w, int h, const VFS::Manager* vfs, const std::string& versionDescription);
void onResChange(int w, int h) override;
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
void setVisible(bool visible) override;
diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp
index 38cfbc1e58..bf4bd7644c 100644
--- a/apps/openmw/mwgui/mapwindow.cpp
+++ b/apps/openmw/mwgui/mapwindow.cpp
@@ -12,7 +12,6 @@
#include
#include
#include
-#include
#include
#include
@@ -833,14 +832,6 @@ namespace MWGui
mGlobalMap->setVisible(global);
mLocalMap->setVisible(!global);
-
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.b = "#{sBack}";
- mControllerButtons.x = global ? "#{sLocal}" : "#{sWorld}";
- mControllerButtons.y = "#{sCenter}";
- mControllerButtons.dpad = Settings::map().mAllowZooming ? "" : "#{sMove}";
- }
}
void MapWindow::onNoteEditOk()
@@ -1029,20 +1020,7 @@ namespace MWGui
void MapWindow::setVisible(bool visible)
{
WindowBase::setVisible(visible);
- MWGui::GuiMode mode = MWBase::Environment::get().getWindowManager()->getMode();
- mButton->setVisible(visible && mode != MWGui::GM_None);
-
- if (Settings::gui().mControllerMenus && mode == MWGui::GM_None && pinned() && visible)
- {
- // Restore the window to pinned size.
- MyGUI::Window* window = mMainWidget->castType();
- MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
- const float x = Settings::windows().mMapX * viewSize.width;
- const float y = Settings::windows().mMapY * viewSize.height;
- const float w = Settings::windows().mMapW * viewSize.width;
- const float h = Settings::windows().mMapH * viewSize.height;
- window->setCoord(x, y, w, h);
- }
+ mButton->setVisible(visible && MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_None);
}
void MapWindow::renderGlobalMap()
@@ -1230,8 +1208,6 @@ namespace MWGui
mLocalMap->setVisible(!global);
mButton->setCaptionWithReplacing(global ? "#{sLocal}" : "#{sWorld}");
- mControllerButtons.x = global ? "#{sLocal}" : "#{sWorld}";
- MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
}
void MapWindow::onPinToggled()
@@ -1392,69 +1368,6 @@ namespace MWGui
mGlobalMapRender->asyncWritePng();
}
- bool MapWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_B)
- MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
- else if (arg.button == SDL_CONTROLLER_BUTTON_X)
- {
- onWorldButtonClicked(mButton);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_Y)
- {
- centerView();
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- shiftMap(0, 100);
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- shiftMap(0, -100);
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
- shiftMap(100, 0);
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- shiftMap(-100, 0);
-
- return true;
- }
-
- void MapWindow::shiftMap(int dx, int dy)
- {
- if (dx == 0 && dy == 0)
- return;
-
- if (!Settings::map().mGlobal)
- {
- mNeedDoorMarkersUpdate = true;
- mLocalMap->setViewOffset(
- MyGUI::IntPoint(mLocalMap->getViewOffset().left + dx, mLocalMap->getViewOffset().top + dy));
- }
- else
- {
- mGlobalMap->setViewOffset(
- MyGUI::IntPoint(mGlobalMap->getViewOffset().left + dx, mGlobalMap->getViewOffset().top + dy));
- }
- }
-
- void MapWindow::setActiveControllerWindow(bool active)
- {
- if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Inventory)
- {
- // Fill the screen, or limit to a certain size on large screens. Size chosen to
- // show the entire local map without scrolling.
- MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
- int width = std::min(viewSize.width, 1552);
- int height = std::min(viewSize.height - 48 - 48, 1572);
- int x = (viewSize.width - width) / 2;
- int y = (viewSize.height - height) / 2;
-
- MyGUI::Window* window = mMainWidget->castType();
- window->setCoord(x, active ? y : viewSize.height + 1, width, height);
- }
-
- WindowBase::setActiveControllerWindow(active);
- }
-
// -------------------------------------------------------------------
EditNoteDialog::EditNoteDialog()
@@ -1468,12 +1381,6 @@ namespace MWGui
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EditNoteDialog::onCancelButtonClicked);
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EditNoteDialog::onOkButtonClicked);
mDeleteButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EditNoteDialog::onDeleteButtonClicked);
-
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.a = "#{sOk}";
- mControllerButtons.b = "#{sCancel}";
- }
}
void EditNoteDialog::showDeleteButton(bool show)
@@ -1501,13 +1408,6 @@ namespace MWGui
WindowModal::onOpen();
center();
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mTextEdit);
-
- if (Settings::gui().mControllerMenus)
- {
- mControllerFocus = getDeleteButtonShown() ? 1 : 0;
- mOkButton->setStateSelected(true);
- mCancelButton->setStateSelected(false);
- }
}
void EditNoteDialog::onCancelButtonClicked(MyGUI::Widget* sender)
@@ -1525,78 +1425,6 @@ namespace MWGui
eventDeleteClicked();
}
- ControllerButtonStr* EditNoteDialog::getControllerButtons()
- {
- mControllerButtons.x = getDeleteButtonShown() ? "#{sDelete}" : "";
- return &mControllerButtons;
- }
-
- bool EditNoteDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (getDeleteButtonShown())
- {
- if (mControllerFocus == 0)
- onDeleteButtonClicked(mDeleteButton);
- else if (mControllerFocus == 1)
- onOkButtonClicked(mOkButton);
- else
- onCancelButtonClicked(mCancelButton);
- }
- else
- {
- if (mControllerFocus == 0)
- onOkButtonClicked(mOkButton);
- else
- onCancelButtonClicked(mCancelButton);
- }
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onCancelButtonClicked(mCancelButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_X)
- {
- if (getDeleteButtonShown())
- onDeleteButtonClicked(mDeleteButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
- {
- if (getDeleteButtonShown())
- {
- mControllerFocus = wrap(mControllerFocus - 1, 3);
- mDeleteButton->setStateSelected(mControllerFocus == 0);
- mOkButton->setStateSelected(mControllerFocus == 1);
- mCancelButton->setStateSelected(mControllerFocus == 2);
- }
- else
- {
- mControllerFocus = 0;
- mOkButton->setStateSelected(mControllerFocus == 0);
- mCancelButton->setStateSelected(mControllerFocus == 1);
- }
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- {
- if (getDeleteButtonShown())
- {
- mControllerFocus = wrap(mControllerFocus + 1, 3);
- mDeleteButton->setStateSelected(mControllerFocus == 0);
- mOkButton->setStateSelected(mControllerFocus == 1);
- mCancelButton->setStateSelected(mControllerFocus == 2);
- }
- else
- {
- mControllerFocus = 1;
- mOkButton->setStateSelected(mControllerFocus == 0);
- mCancelButton->setStateSelected(mControllerFocus == 1);
- }
- }
-
- return true;
- }
-
bool LocalMapBase::MarkerUserData::isPositionExplored() const
{
if (!mLocalMapRender)
diff --git a/apps/openmw/mwgui/mapwindow.hpp b/apps/openmw/mwgui/mapwindow.hpp
index 8730964094..ed070c5407 100644
--- a/apps/openmw/mwgui/mapwindow.hpp
+++ b/apps/openmw/mwgui/mapwindow.hpp
@@ -212,8 +212,6 @@ namespace MWGui
EventHandle_Void eventDeleteClicked;
EventHandle_Void eventOkClicked;
- ControllerButtonStr* getControllerButtons() override;
-
private:
void onCancelButtonClicked(MyGUI::Widget* sender);
void onOkButtonClicked(MyGUI::Widget* sender);
@@ -223,9 +221,6 @@ namespace MWGui
MyGUI::Button* mOkButton;
MyGUI::Button* mCancelButton;
MyGUI::Button* mDeleteButton;
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- int mControllerFocus;
};
class MapWindow : public MWGui::WindowPinnableBase, public LocalMapBase, public NoDrop
@@ -270,10 +265,6 @@ namespace MWGui
std::string_view getWindowIdForLua() const override { return "Map"; }
- protected:
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- void setActiveControllerWindow(bool active) override;
-
private:
void onDragStart(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
void onMouseDrag(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
@@ -292,7 +283,6 @@ namespace MWGui
void setGlobalMapMarkerTooltip(MyGUI::Widget* widget, int x, int y);
float getMarkerSize(size_t agregatedWeight) const;
void resizeGlobalMap();
- void shiftMap(int dx, int dy);
void worldPosToGlobalMapImageSpace(float x, float z, float& imageX, float& imageY) const;
MyGUI::IntCoord createMarkerCoords(float x, float y, float agregatedWeight) const;
MyGUI::Widget* createMarker(const std::string& name, float x, float y, float agregatedWeight);
diff --git a/apps/openmw/mwgui/merchantrepair.cpp b/apps/openmw/mwgui/merchantrepair.cpp
index 425c519175..54f9ae4187 100644
--- a/apps/openmw/mwgui/merchantrepair.cpp
+++ b/apps/openmw/mwgui/merchantrepair.cpp
@@ -28,13 +28,6 @@ namespace MWGui
getWidget(mGoldLabel, "PlayerGold");
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MerchantRepair::onOkButtonClick);
-
- if (Settings::gui().mControllerMenus)
- {
- mDisableGamepadCursor = true;
- mControllerButtons.a = "#{sRepair}";
- mControllerButtons.b = "#{sCancel}";
- }
}
void MerchantRepair::setPtr(const MWWorld::Ptr& actor)
@@ -45,7 +38,6 @@ namespace MWGui
while (mList->getChildCount())
MyGUI::Gui::getInstance().destroyWidget(mList->getChildAt(0));
- mButtons.clear();
const int lineHeight = Settings::gui().mFontSize + 2;
int currentY = 0;
@@ -109,15 +101,6 @@ namespace MWGui
button->eventMouseWheel += MyGUI::newDelegate(this, &MerchantRepair::onMouseWheel);
button->setUserString("ToolTipType", "ItemPtr");
button->eventMouseButtonClick += MyGUI::newDelegate(this, &MerchantRepair::onRepairButtonClick);
- if (price <= playerGold)
- mButtons.emplace_back(std::make_pair(button, mButtons.size()));
- }
-
- if (Settings::gui().mControllerMenus)
- {
- mControllerFocus = 0;
- if (mButtons.size() > 0)
- mButtons[0].first->setStateSelected(true);
}
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the
@@ -174,49 +157,4 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_MerchantRepair);
}
- bool MerchantRepair::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mControllerFocus >= 0 && mControllerFocus < static_cast(mButtons.size()))
- onRepairButtonClick(mButtons[mControllerFocus].first);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onOkButtonClick(mOkButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- if (mButtons.size() <= 1)
- return true;
-
- mButtons[mControllerFocus].first->setStateSelected(false);
- mControllerFocus = wrap(mControllerFocus - 1, mButtons.size());
- mButtons[mControllerFocus].first->setStateSelected(true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- if (mButtons.size() <= 1)
- return true;
-
- mButtons[mControllerFocus].first->setStateSelected(false);
- mControllerFocus = wrap(mControllerFocus + 1, mButtons.size());
- mButtons[mControllerFocus].first->setStateSelected(true);
- }
-
- // Scroll the list to keep the active item in view
- if (mControllerFocus >= 0 && mControllerFocus < static_cast(mButtons.size()))
- {
- int line = mButtons[mControllerFocus].second;
- if (line <= 5)
- mList->setViewOffset(MyGUI::IntPoint(0, 0));
- else
- {
- const int lineHeight = Settings::gui().mFontSize + 2;
- mList->setViewOffset(MyGUI::IntPoint(0, -lineHeight * (line - 5)));
- }
- }
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/merchantrepair.hpp b/apps/openmw/mwgui/merchantrepair.hpp
index e878d34b7d..ffe5b86bdb 100644
--- a/apps/openmw/mwgui/merchantrepair.hpp
+++ b/apps/openmw/mwgui/merchantrepair.hpp
@@ -22,18 +22,13 @@ namespace MWGui
MyGUI::ScrollView* mList;
MyGUI::Button* mOkButton;
MyGUI::TextBox* mGoldLabel;
- /// List of enabled/repairable items and their index in the full list.
- std::vector> mButtons;
MWWorld::Ptr mActor;
- int mControllerFocus;
-
protected:
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
void onRepairButtonClick(MyGUI::Widget* sender);
void onOkButtonClick(MyGUI::Widget* sender);
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
};
}
diff --git a/apps/openmw/mwgui/messagebox.cpp b/apps/openmw/mwgui/messagebox.cpp
index 80b2a34a5b..1d6e1511c4 100644
--- a/apps/openmw/mwgui/messagebox.cpp
+++ b/apps/openmw/mwgui/messagebox.cpp
@@ -8,7 +8,6 @@
#include
#include
-#include
#include "../mwbase/environment.hpp"
#include "../mwbase/inputmanager.hpp"
@@ -281,22 +280,6 @@ namespace MWGui
}
}
- if (Settings::gui().mControllerMenus)
- {
- mDisableGamepadCursor = true;
- mControllerButtons.a = "#{sOk}";
-
- // If we have more than one button, we need to set the focus to the first one.
- if (mButtons.size() > 1)
- {
- mControllerFocus = 0;
- if (mDefaultFocus >= 0 && mDefaultFocus < static_cast(mButtons.size()))
- mControllerFocus = mDefaultFocus;
- for (int i = 0; i < static_cast(mButtons.size()); ++i)
- mButtons[i]->setStateSelected(i == mControllerFocus);
- }
- }
-
MyGUI::IntSize mainWidgetSize;
if (buttonsWidth < textSize.width)
{
@@ -448,41 +431,4 @@ namespace MWGui
return mButtonPressed;
}
- bool InteractiveMessageBox::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- mControllerFocus = std::clamp(mControllerFocus, 0, static_cast(mButtons.size()) - 1);
- buttonActivated(mButtons[mControllerFocus]);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- if (mButtons.size() == 1)
- buttonActivated(mButtons[0]);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP || arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
- {
- if (mButtons.size() <= 1)
- return true;
- if (mButtons.size() == 2 && mControllerFocus == 0)
- return true;
-
- setControllerFocus(mButtons, mControllerFocus, false);
- mControllerFocus = wrap(mControllerFocus - 1, mButtons.size());
- setControllerFocus(mButtons, mControllerFocus, true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN || arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- {
- if (mButtons.size() <= 1)
- return true;
- if (mButtons.size() == 2 && mControllerFocus == static_cast(mButtons.size()) - 1)
- return true;
-
- setControllerFocus(mButtons, mControllerFocus, false);
- mControllerFocus = wrap(mControllerFocus + 1, mButtons.size());
- setControllerFocus(mButtons, mControllerFocus, true);
- }
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/messagebox.hpp b/apps/openmw/mwgui/messagebox.hpp
index e6128ee0d1..feb717e0ad 100644
--- a/apps/openmw/mwgui/messagebox.hpp
+++ b/apps/openmw/mwgui/messagebox.hpp
@@ -103,8 +103,6 @@ namespace MWGui
bool mMarkedToDelete;
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
-
private:
void buttonActivated(MyGUI::Widget* _widget);
@@ -116,7 +114,6 @@ namespace MWGui
int mButtonPressed;
int mDefaultFocus;
bool mImmediate;
- int mControllerFocus = 0;
};
}
diff --git a/apps/openmw/mwgui/quickkeysmenu.cpp b/apps/openmw/mwgui/quickkeysmenu.cpp
index 96045b8e21..c8932c97b6 100644
--- a/apps/openmw/mwgui/quickkeysmenu.cpp
+++ b/apps/openmw/mwgui/quickkeysmenu.cpp
@@ -58,12 +58,6 @@ namespace MWGui
unassign(&mKey[i]);
}
-
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sOK}";
- }
}
void QuickKeysMenu::clear()
@@ -115,13 +109,6 @@ namespace MWGui
{
validate(index);
}
-
- if (Settings::gui().mControllerMenus)
- {
- mControllerFocus = 0;
- for (int i = 0; i < static_cast(mKey.size()); i++)
- mKey[i].button->setControllerFocus(i == mControllerFocus);
- }
}
void QuickKeysMenu::onClose()
@@ -469,39 +456,6 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->updateSpellWindow();
}
- bool QuickKeysMenu::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- onQuickKeyButtonClicked(mKey[mControllerFocus].button);
- if (arg.button == SDL_CONTROLLER_BUTTON_B)
- onOkButtonClicked(mOkButton);
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP || arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- mControllerFocus = (mControllerFocus + 5) % 10;
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
- {
- if (mControllerFocus == 0)
- mControllerFocus = 4;
- else if (mControllerFocus == 5)
- mControllerFocus = 9;
- else
- mControllerFocus--;
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- {
- if (mControllerFocus == 4)
- mControllerFocus = 0;
- else if (mControllerFocus == 9)
- mControllerFocus = 5;
- else
- mControllerFocus++;
- }
-
- for (int i = 0; i < static_cast(mKey.size()); i++)
- mKey[i].button->setControllerFocus(i == mControllerFocus);
-
- return true;
- }
-
// ---------------------------------------------------------------------------------------------------------
QuickKeysMenuAssign::QuickKeysMenuAssign(QuickKeysMenu* parent)
@@ -537,45 +491,9 @@ namespace MWGui
mCancelButton->setCoord((maxWidth - mCancelButton->getTextSize().width - 24) / 2 + 8, mCancelButton->getTop(),
mCancelButton->getTextSize().width + 24, mCancelButton->getHeight());
- if (Settings::gui().mControllerMenus)
- {
- mDisableGamepadCursor = true;
- mItemButton->setStateSelected(true);
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sCancel}";
- }
-
center();
}
- bool QuickKeysMenuAssign::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mControllerFocus == 0)
- mParent->onItemButtonClicked(mItemButton);
- else if (mControllerFocus == 1)
- mParent->onMagicButtonClicked(mMagicButton);
- else if (mControllerFocus == 2)
- mParent->onUnassignButtonClicked(mUnassignButton);
- else if (mControllerFocus == 3)
- mParent->onCancelButtonClicked(mCancelButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- mParent->onCancelButtonClicked(mCancelButton);
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- mControllerFocus = wrap(mControllerFocus - 1, 4);
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- mControllerFocus = wrap(mControllerFocus + 1, 4);
-
- mItemButton->setStateSelected(mControllerFocus == 0);
- mMagicButton->setStateSelected(mControllerFocus == 1);
- mUnassignButton->setStateSelected(mControllerFocus == 2);
- mCancelButton->setStateSelected(mControllerFocus == 3);
-
- return true;
- }
-
void QuickKeysMenu::write(ESM::ESMWriter& writer)
{
writer.startRecord(ESM::REC_KEYS);
@@ -685,12 +603,6 @@ namespace MWGui
mMagicList->setHighlightSelected(false);
mMagicList->eventSpellClicked += MyGUI::newDelegate(this, &MagicSelectionDialog::onModelIndexSelected);
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sCancel}";
- }
-
center();
}
@@ -722,13 +634,4 @@ namespace MWGui
mParent->onAssignMagic(spell.mId);
}
- bool MagicSelectionDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_B)
- onCancelButtonClicked(mCancelButton);
- else
- mMagicList->onControllerButton(arg.button);
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/quickkeysmenu.hpp b/apps/openmw/mwgui/quickkeysmenu.hpp
index 228eb926b4..904029b9a0 100644
--- a/apps/openmw/mwgui/quickkeysmenu.hpp
+++ b/apps/openmw/mwgui/quickkeysmenu.hpp
@@ -72,9 +72,6 @@ namespace MWGui
// Check if quick key is still valid
inline void validate(int index);
void unassign(keyData* key);
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- int mControllerFocus;
};
class QuickKeysMenuAssign : public WindowModal
@@ -90,9 +87,6 @@ namespace MWGui
MyGUI::Button* mCancelButton;
QuickKeysMenu* mParent;
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- int mControllerFocus;
};
class MagicSelectionDialog : public WindowModal
@@ -111,9 +105,6 @@ namespace MWGui
void onCancelButtonClicked(MyGUI::Widget* sender);
void onModelIndexSelected(SpellModel::ModelIndex index);
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- int mControllerFocus;
};
}
diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp
index fdc8725fa0..7b445d419f 100644
--- a/apps/openmw/mwgui/race.cpp
+++ b/apps/openmw/mwgui/race.cpp
@@ -23,6 +23,16 @@
namespace
{
+ int wrap(int index, int max)
+ {
+ if (index < 0)
+ return max - 1;
+ else if (index >= max)
+ return 0;
+ else
+ return index;
+ }
+
bool sortRaces(const std::pair& left, const std::pair& right)
{
return left.second.compare(right.second) < 0;
@@ -98,23 +108,15 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu7", "Specials"));
getWidget(mSpellPowerList, "SpellPowerList");
- getWidget(mBackButton, "BackButton");
- mBackButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onBackClicked);
+ MyGUI::Button* backButton;
+ getWidget(backButton, "BackButton");
+ backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onBackClicked);
- getWidget(mOkButton, "OKButton");
- mOkButton->setCaption(
+ MyGUI::Button* okButton;
+ getWidget(okButton, "OKButton");
+ okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {})));
- mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onOkClicked);
-
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.lStick = "#{sMouse}";
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sBack}";
- mControllerButtons.y = "#{sSex}";
- mControllerButtons.l1 = "#{sHair}";
- mControllerButtons.r1 = "#{sFace}";
- }
+ okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onOkClicked);
updateRaces();
updateSkills();
@@ -127,17 +129,8 @@ namespace MWGui
getWidget(okButton, "OKButton");
if (shown)
- {
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sNext", {})));
- mControllerButtons.x = "#{sNext}";
- }
- else if (Settings::gui().mControllerMenus)
- {
- okButton->setCaption(
- MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sDone", {})));
- mControllerButtons.x = "#{sDone}";
- }
else
okButton->setCaption(
MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", {})));
@@ -469,56 +462,6 @@ namespace MWGui
}
}
- bool RaceDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onBackClicked(mBackButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_X)
- {
- onOkClicked(mOkButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_Y)
- {
- onSelectNextGender(nullptr);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
- {
- onSelectNextHair(nullptr);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
- {
- onSelectNextFace(nullptr);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
- winMgr->setKeyFocusWidget(mRaceList);
- winMgr->injectKeyPress(MyGUI::KeyCode::ArrowUp, 0, false);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
- winMgr->setKeyFocusWidget(mRaceList);
- winMgr->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false);
- }
-
- return true;
- }
-
- bool RaceDialog::onControllerThumbstickEvent(const SDL_ControllerAxisEvent& arg)
- {
- if (arg.axis == SDL_CONTROLLER_AXIS_RIGHTX)
- {
- if (arg.value < -1000 || arg.value > 1000)
- onPreviewScroll(nullptr, arg.value < 0 ? 1 : -1);
- return true;
- }
-
- return false;
- }
-
const ESM::NPC& RaceDialog::getResult() const
{
return mPreview->getPrototype();
diff --git a/apps/openmw/mwgui/race.hpp b/apps/openmw/mwgui/race.hpp
index ead058214c..a6ac0e2813 100644
--- a/apps/openmw/mwgui/race.hpp
+++ b/apps/openmw/mwgui/race.hpp
@@ -3,7 +3,6 @@
#include "windowbase.hpp"
#include
-#include
#include
namespace MWRender
@@ -101,9 +100,7 @@ namespace MWGui
MyGUI::ImageBox* mPreviewImage;
MyGUI::ListBox* mRaceList;
- Gui::ScrollBar* mHeadRotate;
- MyGUI::Button* mBackButton;
- MyGUI::Button* mOkButton;
+ MyGUI::ScrollBar* mHeadRotate;
MyGUI::Widget* mSkillList;
std::vector mSkillItems;
@@ -121,9 +118,6 @@ namespace MWGui
std::unique_ptr mPreviewTexture;
bool mPreviewDirty;
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- bool onControllerThumbstickEvent(const SDL_ControllerAxisEvent& arg) override;
};
}
#endif
diff --git a/apps/openmw/mwgui/recharge.cpp b/apps/openmw/mwgui/recharge.cpp
index 2dfb47fa23..7d57988d97 100644
--- a/apps/openmw/mwgui/recharge.cpp
+++ b/apps/openmw/mwgui/recharge.cpp
@@ -39,10 +39,6 @@ namespace MWGui
mBox->setDisplayMode(ItemChargeView::DisplayMode_EnchantmentCharge);
mGemIcon->eventMouseButtonClick += MyGUI::newDelegate(this, &Recharge::onSelectItem);
-
- mControllerButtons.a = "#{OMWEngine:RechargeSelect}";
- mControllerButtons.b = "#{sCancel}";
- mControllerButtons.y = "#{sSoulGem}";
}
void Recharge::onOpen()
@@ -140,18 +136,4 @@ namespace MWGui
updateView();
}
- bool Recharge::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if ((arg.button == SDL_CONTROLLER_BUTTON_A && !mGemBox->getVisible()) || arg.button == SDL_CONTROLLER_BUTTON_Y)
- {
- onSelectItem(mGemIcon);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- onCancel(mCancelButton);
- else
- mBox->onControllerButton(arg.button);
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/recharge.hpp b/apps/openmw/mwgui/recharge.hpp
index c10f96e71e..f8a037d2db 100644
--- a/apps/openmw/mwgui/recharge.hpp
+++ b/apps/openmw/mwgui/recharge.hpp
@@ -51,8 +51,6 @@ namespace MWGui
void onItemClicked(MyGUI::Widget* sender, const MWWorld::Ptr& item);
void onCancel(MyGUI::Widget* sender);
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
};
}
diff --git a/apps/openmw/mwgui/repair.cpp b/apps/openmw/mwgui/repair.cpp
index 8962ae2abd..c1602b8407 100644
--- a/apps/openmw/mwgui/repair.cpp
+++ b/apps/openmw/mwgui/repair.cpp
@@ -39,10 +39,6 @@ namespace MWGui
mRepairBox->setDisplayMode(ItemChargeView::DisplayMode_Health);
mToolIcon->eventMouseButtonClick += MyGUI::newDelegate(this, &Repair::onSelectItem);
-
- mControllerButtons.a = "#{sRepair}";
- mControllerButtons.b = "#{sCancel}";
- mControllerButtons.y = "#{OMWEngine:RepairTool}";
}
void Repair::onOpen()
@@ -154,18 +150,4 @@ namespace MWGui
updateRepairView();
}
- bool Repair::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if ((arg.button == SDL_CONTROLLER_BUTTON_A && !mToolBox->getVisible()) || arg.button == SDL_CONTROLLER_BUTTON_Y)
- {
- onSelectItem(mToolIcon);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- onCancel(mCancelButton);
- else
- mRepairBox->onControllerButton(arg.button);
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/repair.hpp b/apps/openmw/mwgui/repair.hpp
index 986b28b613..093a10e3fa 100644
--- a/apps/openmw/mwgui/repair.hpp
+++ b/apps/openmw/mwgui/repair.hpp
@@ -50,8 +50,6 @@ namespace MWGui
void onRepairItem(MyGUI::Widget* sender, const MWWorld::Ptr& ptr);
void onCancel(MyGUI::Widget* sender);
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
};
}
diff --git a/apps/openmw/mwgui/review.cpp b/apps/openmw/mwgui/review.cpp
index dcaa49b1e2..ddce2c5f50 100644
--- a/apps/openmw/mwgui/review.cpp
+++ b/apps/openmw/mwgui/review.cpp
@@ -46,25 +46,21 @@ namespace MWGui
getWidget(button, "NameButton");
adjustButtonSize(button);
button->eventMouseButtonClick += MyGUI::newDelegate(this, &ReviewDialog::onNameClicked);
- mButtons.push_back(button);
getWidget(mRaceWidget, "RaceText");
getWidget(button, "RaceButton");
adjustButtonSize(button);
button->eventMouseButtonClick += MyGUI::newDelegate(this, &ReviewDialog::onRaceClicked);
- mButtons.push_back(button);
getWidget(mClassWidget, "ClassText");
getWidget(button, "ClassButton");
adjustButtonSize(button);
button->eventMouseButtonClick += MyGUI::newDelegate(this, &ReviewDialog::onClassClicked);
- mButtons.push_back(button);
getWidget(mBirthSignWidget, "SignText");
getWidget(button, "SignButton");
adjustButtonSize(button);
button->eventMouseButtonClick += MyGUI::newDelegate(this, &ReviewDialog::onBirthSignClicked);
- mButtons.push_back(button);
// Setup dynamic stats
getWidget(mHealth, "Health");
@@ -112,22 +108,10 @@ namespace MWGui
MyGUI::Button* backButton;
getWidget(backButton, "BackButton");
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ReviewDialog::onBackClicked);
- mButtons.push_back(backButton);
MyGUI::Button* okButton;
getWidget(okButton, "OKButton");
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &ReviewDialog::onOkClicked);
- mButtons.push_back(okButton);
-
- if (Settings::gui().mControllerMenus)
- {
- setControllerFocus(mButtons, mControllerFocus, true);
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sBack}";
- mControllerButtons.x = "#{sDone}";
- okButton->setCaption(
- MyGUI::UString(MWBase::Environment::get().getWindowManager()->getGameSettingString("sDone", {})));
- }
}
void ReviewDialog::onOpen()
@@ -538,54 +522,4 @@ namespace MWGui
MyGUI::IntPoint(0, static_cast(mSkillView->getViewOffset().top + _rel * 0.3)));
}
- bool ReviewDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- switch (mControllerFocus)
- {
- case 0:
- onNameClicked(mButtons[0]);
- break;
- case 1:
- onRaceClicked(mButtons[1]);
- break;
- case 2:
- onClassClicked(mButtons[2]);
- break;
- case 3:
- onBirthSignClicked(mButtons[3]);
- break;
- case 4:
- onBackClicked(mButtons[4]);
- break;
- case 5:
- onOkClicked(mButtons[5]);
- break;
- }
- return true;
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onBackClicked(mButtons[4]);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_X)
- {
- onOkClicked(mButtons[5]);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP || arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
- {
- setControllerFocus(mButtons, mControllerFocus, false);
- mControllerFocus = wrap(mControllerFocus - 1, mButtons.size());
- setControllerFocus(mButtons, mControllerFocus, true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN || arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- {
- setControllerFocus(mButtons, mControllerFocus, false);
- mControllerFocus = wrap(mControllerFocus + 1, mButtons.size());
- setControllerFocus(mButtons, mControllerFocus, true);
- }
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/review.hpp b/apps/openmw/mwgui/review.hpp
index fe53787fe3..7226ad628d 100644
--- a/apps/openmw/mwgui/review.hpp
+++ b/apps/openmw/mwgui/review.hpp
@@ -72,7 +72,6 @@ namespace MWGui
void onBirthSignClicked(MyGUI::Widget* _sender);
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
private:
void addSkills(const std::vector& skills, const std::string& titleId,
@@ -101,10 +100,6 @@ namespace MWGui
std::vector mSkillWidgets; //< Skills and other information
bool mUpdateSkillArea;
-
- // 0 = Name, 1 = Race, 2 = Class, 3 = BirthSign, 4 = Back, 5 = OK
- std::vector mButtons;
- int mControllerFocus = 5;
};
}
#endif
diff --git a/apps/openmw/mwgui/savegamedialog.cpp b/apps/openmw/mwgui/savegamedialog.cpp
index e0b10f6b37..4957789ffd 100644
--- a/apps/openmw/mwgui/savegamedialog.cpp
+++ b/apps/openmw/mwgui/savegamedialog.cpp
@@ -17,7 +17,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -29,7 +28,6 @@
#include "../mwbase/world.hpp"
#include "../mwworld/datetimemanager.hpp"
#include "../mwworld/esmstore.hpp"
-#include "../mwworld/timestamp.hpp"
#include "../mwstate/character.hpp"
@@ -66,9 +64,6 @@ namespace MWGui
// To avoid accidental deletions
mDeleteButton->setNeedKeyFocus(false);
-
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sCancel}";
}
void SaveGameDialog::onSlotActivated(MyGUI::ListBox* sender, size_t pos)
@@ -150,28 +145,6 @@ namespace MWGui
WindowModal::onOpen();
mSaveNameEdit->setCaption({});
- if (Settings::gui().mControllerMenus && mSaving)
- {
- // For controller mode, set a default save file name. The format is
- // "Day 24 - Last Steed 7 p.m."
- const MWWorld::DateTimeManager& timeManager = *MWBase::Environment::get().getWorld()->getTimeManager();
- std::string_view month = timeManager.getMonthName();
- int hour = static_cast(timeManager.getTimeStamp().getHour());
- bool pm = hour >= 12;
- if (hour >= 13)
- hour -= 12;
- if (hour == 0)
- hour = 12;
-
- ESM::EpochTimeStamp currentDate = timeManager.getEpochTimeStamp();
- std::string daysPassed
- = Misc::StringUtils::format("#{Calendar:day} %i", timeManager.getTimeStamp().getDay());
- std::string_view formattedHour(pm ? "#{Calendar:pm}" : "#{Calendar:am}");
- std::string autoFilename = Misc::StringUtils::format(
- "%s - %i %s %i %s", daysPassed, currentDate.mDay, month, hour, formattedHour);
-
- mSaveNameEdit->setCaptionWithReplacing(autoFilename);
- }
if (mSaving)
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mSaveNameEdit);
else
@@ -186,13 +159,6 @@ namespace MWGui
mSaveList->removeAllItems();
onSlotSelected(mSaveList, MyGUI::ITEM_NONE);
- if (Settings::gui().mControllerMenus)
- {
- mOkButtonFocus = true;
- mOkButton->setStateSelected(true);
- mCancelButton->setStateSelected(false);
- }
-
MWBase::StateManager* mgr = MWBase::Environment::get().getStateManager();
if (mgr->characterBegin() == mgr->characterEnd())
return;
@@ -251,7 +217,7 @@ namespace MWGui
}
mCharacterSelection->setIndexSelected(selectedIndex);
if (selectedIndex == MyGUI::ITEM_NONE)
- mCharacterSelection->setCaptionWithReplacing("#{OMWEngine:SelectCharacter}...");
+ mCharacterSelection->setCaptionWithReplacing("#{OMWEngine:SelectCharacter}");
fillSaveList();
}
@@ -525,55 +491,4 @@ namespace MWGui
mScreenshotTexture = std::make_unique(texture);
mScreenshot->setRenderItemTexture(mScreenshotTexture.get());
}
-
- ControllerButtonStr* SaveGameDialog::getControllerButtons()
- {
- mControllerButtons.y = mSaving ? "" : "#{OMWEngine:SelectCharacter}";
- return &mControllerButtons;
- }
-
- bool SaveGameDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mOkButtonFocus)
- onOkButtonClicked(mOkButton);
- else
- onCancelButtonClicked(mCancelButton);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onCancelButtonClicked(mCancelButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_Y)
- {
- uint32_t index = mCharacterSelection->getIndexSelected();
- index = wrap(index + 1, mCharacterSelection->getItemCount());
- mCharacterSelection->setIndexSelected(index);
- onCharacterSelected(mCharacterSelection, index);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
- winMgr->setKeyFocusWidget(mSaveList);
- winMgr->injectKeyPress(MyGUI::KeyCode::ArrowUp, 0, false);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
- winMgr->setKeyFocusWidget(mSaveList);
- winMgr->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false);
- }
- else if ((arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && !mOkButtonFocus)
- || (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT && mOkButtonFocus))
- {
- mOkButtonFocus = !mOkButtonFocus;
- mOkButton->setStateSelected(mOkButtonFocus);
- mCancelButton->setStateSelected(!mOkButtonFocus);
- }
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/savegamedialog.hpp b/apps/openmw/mwgui/savegamedialog.hpp
index 13c4588d3f..af831f066e 100644
--- a/apps/openmw/mwgui/savegamedialog.hpp
+++ b/apps/openmw/mwgui/savegamedialog.hpp
@@ -24,8 +24,6 @@ namespace MWGui
void setLoadOrSave(bool load);
- ControllerButtonStr* getControllerButtons() override;
-
private:
void confirmDeleteSave();
@@ -69,9 +67,6 @@ namespace MWGui
const MWState::Character* mCurrentCharacter;
const MWState::Slot* mCurrentSlot;
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- bool mOkButtonFocus = true;
};
}
diff --git a/apps/openmw/mwgui/scrollwindow.cpp b/apps/openmw/mwgui/scrollwindow.cpp
index 59fb1f2d20..0b1658fd84 100644
--- a/apps/openmw/mwgui/scrollwindow.cpp
+++ b/apps/openmw/mwgui/scrollwindow.cpp
@@ -7,7 +7,6 @@
#include
#include "../mwbase/environment.hpp"
-#include "../mwbase/inputmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/actorutil.hpp"
@@ -39,10 +38,6 @@ namespace MWGui
mCloseButton->eventKeyButtonPressed += MyGUI::newDelegate(this, &ScrollWindow::onKeyButtonPressed);
mTakeButton->eventKeyButtonPressed += MyGUI::newDelegate(this, &ScrollWindow::onKeyButtonPressed);
- mControllerScrollWidget = mTextView;
- mControllerButtons.b = "#{sClose}";
- mControllerButtons.dpad = "#{sScrolldown}";
-
center();
}
@@ -120,32 +115,4 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll);
}
-
- void ScrollWindow::onClose()
- {
- if (Settings::gui().mControllerMenus)
- MWBase::Environment::get().getInputManager()->setGamepadGuiCursorEnabled(true);
- BookWindowBase::onClose();
- }
-
- ControllerButtonStr* ScrollWindow::getControllerButtons()
- {
- mControllerButtons.a = mTakeButton->getVisible() ? "#{sTake}" : "";
- return &mControllerButtons;
- }
-
- bool ScrollWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mTakeButton->getVisible())
- onTakeButtonClicked(mTakeButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- onCloseButtonClicked(mCloseButton);
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP || arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- return false; // Fall through to keyboard
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/scrollwindow.hpp b/apps/openmw/mwgui/scrollwindow.hpp
index 314925c7a7..7daea98894 100644
--- a/apps/openmw/mwgui/scrollwindow.hpp
+++ b/apps/openmw/mwgui/scrollwindow.hpp
@@ -20,19 +20,15 @@ namespace MWGui
void setPtr(const MWWorld::Ptr& scroll) override;
void setInventoryAllowed(bool allowed);
- void onClose() override;
void onResChange(int, int) override { center(); }
std::string_view getWindowIdForLua() const override { return "Scroll"; }
- ControllerButtonStr* getControllerButtons() override;
-
protected:
void onCloseButtonClicked(MyGUI::Widget* _sender);
void onTakeButtonClicked(MyGUI::Widget* _sender);
void setTakeButtonShow(bool show);
void onKeyButtonPressed(MyGUI::Widget* sender, MyGUI::KeyCode key, MyGUI::Char character);
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
private:
Gui::ImageButton* mCloseButton;
diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp
index 726809c583..02353c5d41 100644
--- a/apps/openmw/mwgui/settingswindow.cpp
+++ b/apps/openmw/mwgui/settingswindow.cpp
@@ -459,10 +459,6 @@ namespace MWGui
i++;
}
-
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sOk}";
- mControllerButtons.lStick = "#{sMouse}";
}
void SettingsWindow::onTabChanged(MyGUI::TabControl* /*_sender*/, size_t /*index*/)
@@ -472,7 +468,7 @@ namespace MWGui
void SettingsWindow::onOkButtonClicked(MyGUI::Widget* _sender)
{
- MWBase::Environment::get().getWindowManager()->toggleSettingsWindow();
+ setVisible(false);
}
void SettingsWindow::onResolutionSelected(MyGUI::ListBox* _sender, size_t index)
@@ -1132,32 +1128,4 @@ namespace MWGui
mResolutionList->setScrollPosition(0);
mControlsBox->setViewOffset(MyGUI::IntPoint(0, 0));
}
-
- bool SettingsWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onOkButtonClicked(mOkButton);
- return true;
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
- {
- uint32_t index = mSettingsTab->getIndexSelected();
- index = wrap(index - 1, mSettingsTab->getItemCount());
- mSettingsTab->setIndexSelected(index);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- return true;
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
- {
- uint32_t index = mSettingsTab->getIndexSelected();
- index = wrap(index + 1, mSettingsTab->getItemCount());
- mSettingsTab->setIndexSelected(index);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- return true;
- }
-
- return false;
- }
-
}
diff --git a/apps/openmw/mwgui/settingswindow.hpp b/apps/openmw/mwgui/settingswindow.hpp
index 555468d806..dc4e09f8ac 100644
--- a/apps/openmw/mwgui/settingswindow.hpp
+++ b/apps/openmw/mwgui/settingswindow.hpp
@@ -26,8 +26,6 @@ namespace MWGui
void onResChange(int, int) override;
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
-
protected:
MyGUI::TabControl* mSettingsTab;
MyGUI::Button* mOkButton;
diff --git a/apps/openmw/mwgui/spellbuyingwindow.cpp b/apps/openmw/mwgui/spellbuyingwindow.cpp
index e43bbfc497..2a67af5498 100644
--- a/apps/openmw/mwgui/spellbuyingwindow.cpp
+++ b/apps/openmw/mwgui/spellbuyingwindow.cpp
@@ -9,7 +9,6 @@
#include
#include "../mwbase/environment.hpp"
-#include "../mwbase/inputmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/windowmanager.hpp"
@@ -33,14 +32,6 @@ namespace MWGui
getWidget(mSpellsView, "SpellsView");
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellBuyingWindow::onCancelButtonClicked);
-
- if (Settings::gui().mControllerMenus)
- {
- mDisableGamepadCursor = true;
- mControllerButtons.a = "#{sBuy}";
- mControllerButtons.b = "#{sCancel}";
- mControllerButtons.r3 = "#{sInfo}";
- }
}
bool SpellBuyingWindow::sortSpells(const ESM::Spell* left, const ESM::Spell* right)
@@ -80,8 +71,6 @@ namespace MWGui
toAdd->setUserString("SpellCost", std::to_string(spell.mData.mCost));
toAdd->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellBuyingWindow::onSpellButtonClick);
mSpellsWidgetMap.insert(std::make_pair(toAdd, spell.mId));
- if (price <= playerGold)
- mSpellButtons.emplace_back(std::make_pair(toAdd, mSpellsWidgetMap.size()));
}
void SpellBuyingWindow::clearSpells()
@@ -91,7 +80,6 @@ namespace MWGui
while (mSpellsView->getChildCount())
MyGUI::Gui::getInstance().destroyWidget(mSpellsView->getChildAt(0));
mSpellsWidgetMap.clear();
- mSpellButtons.clear();
}
void SpellBuyingWindow::setPtr(const MWWorld::Ptr& actor)
@@ -142,18 +130,6 @@ namespace MWGui
updateLabels();
- if (Settings::gui().mControllerMenus)
- {
- mControllerFocus = 0;
- if (mSpellButtons.size() > 0)
- mSpellButtons[0].first->setStateSelected(true);
-
- MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
- winMgr->setControllerTooltip(Settings::gui().mControllerTooltips);
- if (winMgr->getControllerTooltip())
- MWBase::Environment::get().getInputManager()->warpMouseToWidget(mSpellButtons[0].first);
- }
-
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the
// scrollbar is hidden
mSpellsView->setVisibleVScroll(false);
@@ -224,60 +200,4 @@ namespace MWGui
mSpellsView->setViewOffset(
MyGUI::IntPoint(0, static_cast(mSpellsView->getViewOffset().top + _rel * 0.3f)));
}
-
- bool SpellBuyingWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mControllerFocus >= 0 && mControllerFocus < static_cast(mSpellButtons.size()))
- onSpellButtonClick(mSpellButtons[mControllerFocus].first);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onCancelButtonClicked(mCancelButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK)
- {
- // Toggle info tooltip
- MWBase::Environment::get().getWindowManager()->setControllerTooltip(
- !MWBase::Environment::get().getWindowManager()->getControllerTooltip());
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- if (mSpellButtons.size() <= 1)
- return true;
-
- mSpellButtons[mControllerFocus].first->setStateSelected(false);
- mControllerFocus = wrap(mControllerFocus - 1, mSpellButtons.size());
- mSpellButtons[mControllerFocus].first->setStateSelected(true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- if (mSpellButtons.size() <= 1)
- return true;
-
- mSpellButtons[mControllerFocus].first->setStateSelected(false);
- mControllerFocus = wrap(mControllerFocus + 1, mSpellButtons.size());
- mSpellButtons[mControllerFocus].first->setStateSelected(true);
- }
-
- if (mControllerFocus >= 0 && mControllerFocus < static_cast(mSpellButtons.size()))
- {
- // Scroll the list to keep the active item in view
- int line = mSpellButtons[mControllerFocus].second;
- if (line <= 5)
- mSpellsView->setViewOffset(MyGUI::IntPoint(0, 0));
- else
- {
- const int lineHeight = Settings::gui().mFontSize + 2;
- mSpellsView->setViewOffset(MyGUI::IntPoint(0, -lineHeight * (line - 5)));
- }
-
- // Warp the mouse to the selected spell to show the tooltip
- if (MWBase::Environment::get().getWindowManager()->getControllerTooltip())
- MWBase::Environment::get().getInputManager()->warpMouseToWidget(mSpellButtons[mControllerFocus].first);
- }
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/spellbuyingwindow.hpp b/apps/openmw/mwgui/spellbuyingwindow.hpp
index e67dfde76c..257b8a0df9 100644
--- a/apps/openmw/mwgui/spellbuyingwindow.hpp
+++ b/apps/openmw/mwgui/spellbuyingwindow.hpp
@@ -39,8 +39,6 @@ namespace MWGui
MyGUI::ScrollView* mSpellsView;
std::map mSpellsWidgetMap;
- /// List of enabled/purchasable spells and their index in the full list.
- std::vector> mSpellButtons;
void onCancelButtonClicked(MyGUI::Widget* _sender);
void onSpellButtonClick(MyGUI::Widget* _sender);
@@ -57,8 +55,6 @@ namespace MWGui
private:
static bool sortSpells(const ESM::Spell* left, const ESM::Spell* right);
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- int mControllerFocus;
};
}
diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp
index 976c2eebd8..d8302df87c 100644
--- a/apps/openmw/mwgui/spellcreationdialog.cpp
+++ b/apps/openmw/mwgui/spellcreationdialog.cpp
@@ -7,13 +7,11 @@
#include
#include
-#include
#include
#include
#include "../mwbase/environment.hpp"
-#include "../mwbase/inputmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/windowmanager.hpp"
@@ -27,8 +25,8 @@
#include "../mwmechanics/spellutil.hpp"
#include "class.hpp"
-#include "textcolours.hpp"
#include "tooltips.hpp"
+#include "widgets.hpp"
namespace
{
@@ -97,13 +95,6 @@ namespace MWGui
+= MyGUI::newDelegate(this, &EditEffectDialog::onMagnitudeMaxChanged);
mDurationSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &EditEffectDialog::onDurationChanged);
mAreaSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &EditEffectDialog::onAreaChanged);
-
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sCancel}";
- mControllerButtons.x = "#{sOk}";
- }
}
void EditEffectDialog::setConstantEffect(bool constant)
@@ -163,15 +154,6 @@ namespace MWGui
mMagnitudeMaxValue->setCaption(to + " 1");
mAreaValue->setCaption("0");
- if (Settings::gui().mControllerMenus)
- {
- mRangeButton->setStateSelected(true);
- mDeleteButton->setStateSelected(false);
- mOkButton->setStateSelected(false);
- mCancelButton->setStateSelected(false);
- mControllerFocus = 0;
- }
-
setVisible(true);
}
@@ -205,15 +187,6 @@ namespace MWGui
onDurationChanged(mDurationSlider, effect.mDuration - 1);
eventEffectModified(mEffect);
- if (Settings::gui().mControllerMenus)
- {
- mRangeButton->setStateSelected(true);
- mDeleteButton->setStateSelected(false);
- mOkButton->setStateSelected(false);
- mCancelButton->setStateSelected(false);
- mControllerFocus = 0;
- }
-
updateBoxes();
}
@@ -258,25 +231,6 @@ namespace MWGui
mAreaBox->setVisible(true);
// curY += mAreaBox->getSize().height;
}
-
- if (Settings::gui().mControllerMenus)
- {
- mButtons.clear();
- mButtons.emplace_back(mRangeButton);
- if (mMagnitudeBox->getVisible())
- {
- mButtons.emplace_back(mMagnitudeMinValue);
- mButtons.emplace_back(mMagnitudeMaxValue);
- }
- if (mDurationBox->getVisible())
- mButtons.emplace_back(mDurationValue);
- if (mAreaBox->getVisible())
- mButtons.emplace_back(mAreaValue);
- if (mDeleteButton->getVisible())
- mButtons.emplace_back(mDeleteButton);
- mButtons.emplace_back(mOkButton);
- mButtons.emplace_back(mCancelButton);
- }
}
void EditEffectDialog::onRangeButtonClicked(MyGUI::Widget* sender)
@@ -386,195 +340,6 @@ namespace MWGui
eventEffectModified(mEffect);
}
- bool EditEffectDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- int prevFocus = mControllerFocus;
- mControllerFocus = std::clamp(mControllerFocus, 0, static_cast(mButtons.size()) - 1);
- MyGUI::TextBox* button = mButtons[mControllerFocus];
-
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (button == mRangeButton)
- onRangeButtonClicked(mRangeButton);
- else if (button == mCancelButton)
- onCancelButtonClicked(mCancelButton);
- else if (button == mOkButton)
- onOkButtonClicked(mOkButton);
- else if (button == mDeleteButton)
- onDeleteButtonClicked(mDeleteButton);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- onCancelButtonClicked(mCancelButton);
- else if (arg.button == SDL_CONTROLLER_BUTTON_X)
- {
- onOkButtonClicked(mOkButton);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- if (mControllerFocus == 0)
- mControllerFocus = static_cast(mButtons.size()) - 2;
- else if (button == mCancelButton && mDeleteButton->getVisible())
- mControllerFocus -= 3;
- else if (button == mCancelButton || (button == mOkButton && mDeleteButton->getVisible()))
- mControllerFocus -= 2;
- else
- mControllerFocus = std::max(mControllerFocus - 1, 0);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- if (button == mDeleteButton || button == mOkButton || button == mCancelButton)
- mControllerFocus = 0;
- else
- mControllerFocus++;
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
- {
- if (button == mMagnitudeMinValue)
- {
- mMagnitudeMinSlider->setScrollPosition(0);
- onMagnitudeMinChanged(nullptr, mMagnitudeMinSlider->getScrollPosition());
- }
- else if (button == mMagnitudeMaxValue)
- {
- mMagnitudeMaxSlider->setScrollPosition(mMagnitudeMinSlider->getScrollPosition());
- onMagnitudeMaxChanged(nullptr, mMagnitudeMaxSlider->getScrollPosition());
- }
- else if (button == mDurationValue)
- {
- mDurationSlider->setScrollPosition(0);
- onDurationChanged(nullptr, mDurationSlider->getScrollPosition());
- }
- else if (button == mAreaValue)
- {
- mAreaSlider->setScrollPosition(0);
- onAreaChanged(nullptr, mAreaSlider->getScrollPosition());
- }
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
- {
- if (button == mMagnitudeMinValue)
- {
- mMagnitudeMinSlider->setScrollPosition(mMagnitudeMaxSlider->getScrollPosition());
- onMagnitudeMinChanged(nullptr, mMagnitudeMinSlider->getScrollPosition());
- }
- else if (button == mMagnitudeMaxValue)
- {
- mMagnitudeMaxSlider->setScrollPosition(mMagnitudeMaxSlider->getScrollRange() - 1);
- onMagnitudeMaxChanged(nullptr, mMagnitudeMaxSlider->getScrollPosition());
- }
- else if (button == mDurationValue)
- {
- mDurationSlider->setScrollPosition(mDurationSlider->getScrollRange() - 1);
- onDurationChanged(nullptr, mDurationSlider->getScrollPosition());
- }
- else if (button == mAreaValue)
- {
- mAreaSlider->setScrollPosition(mAreaSlider->getScrollRange() - 1);
- onAreaChanged(nullptr, mAreaSlider->getScrollPosition());
- }
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
- {
- if (button == mRangeButton)
- onRangeButtonClicked(mRangeButton);
- else if (button == mCancelButton)
- mControllerFocus--;
- else if (button == mOkButton && mDeleteButton->getVisible())
- mControllerFocus--;
- else if (button == mMagnitudeMinValue)
- {
- mMagnitudeMinSlider->setScrollPosition(mMagnitudeMinSlider->getScrollPosition() - 1);
- onMagnitudeMinChanged(nullptr, mMagnitudeMinSlider->getScrollPosition());
- }
- else if (button == mMagnitudeMaxValue)
- {
- mMagnitudeMaxSlider->setScrollPosition(
- std::max(mMagnitudeMaxSlider->getScrollPosition() - 1, mMagnitudeMinSlider->getScrollPosition()));
- onMagnitudeMaxChanged(nullptr, mMagnitudeMaxSlider->getScrollPosition());
- }
- else if (button == mDurationValue)
- {
- mDurationSlider->setScrollPosition(mDurationSlider->getScrollPosition() - 1);
- onDurationChanged(nullptr, mDurationSlider->getScrollPosition());
- }
- else if (button == mAreaValue)
- {
- mAreaSlider->setScrollPosition(mAreaSlider->getScrollPosition() - 1);
- onAreaChanged(nullptr, mAreaSlider->getScrollPosition());
- }
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- {
- if (button == mRangeButton)
- onRangeButtonClicked(mRangeButton);
- else if (button == mDeleteButton)
- mControllerFocus++;
- else if (button == mOkButton)
- mControllerFocus++;
- else if (button == mMagnitudeMinValue)
- {
- mMagnitudeMinSlider->setScrollPosition(
- std::min(mMagnitudeMinSlider->getScrollPosition() + 1, mMagnitudeMaxSlider->getScrollPosition()));
- onMagnitudeMinChanged(nullptr, mMagnitudeMinSlider->getScrollPosition());
- }
- else if (button == mMagnitudeMaxValue)
- {
- mMagnitudeMaxSlider->setScrollPosition(mMagnitudeMaxSlider->getScrollPosition() + 1);
- onMagnitudeMaxChanged(nullptr, mMagnitudeMaxSlider->getScrollPosition());
- }
- else if (button == mDurationValue)
- {
- mDurationSlider->setScrollPosition(mDurationSlider->getScrollPosition() + 1);
- onDurationChanged(nullptr, mDurationSlider->getScrollPosition());
- }
- else if (button == mAreaValue)
- {
- mAreaSlider->setScrollPosition(mAreaSlider->getScrollPosition() + 1);
- onAreaChanged(nullptr, mAreaSlider->getScrollPosition());
- }
- }
-
- if (prevFocus != mControllerFocus)
- updateControllerFocus(prevFocus, mControllerFocus);
-
- return true;
- }
-
- void EditEffectDialog::updateControllerFocus(int prevFocus, int newFocus)
- {
- const TextColours& textColours{ MWBase::Environment::get().getWindowManager()->getTextColours() };
-
- if (prevFocus >= 0 && prevFocus < static_cast(mButtons.size()))
- {
- MyGUI::TextBox* button = mButtons[prevFocus];
- if (button == mMagnitudeMinValue || button == mMagnitudeMaxValue || button == mDurationValue
- || button == mAreaValue)
- {
- button->setTextColour(textColours.normal);
- }
- else
- {
- ((MyGUI::Button*)button)->setStateSelected(false);
- }
- }
-
- if (newFocus >= 0 && newFocus < static_cast(mButtons.size()))
- {
- MyGUI::TextBox* button = mButtons[newFocus];
- if (button == mMagnitudeMinValue || button == mMagnitudeMaxValue || button == mDurationValue
- || button == mAreaValue)
- {
- button->setTextColour(textColours.link);
- }
- else
- {
- ((MyGUI::Button*)button)->setStateSelected(true);
- }
- }
- }
-
// ------------------------------------------------------------------------------------------------
SpellCreationDialog::SpellCreationDialog()
@@ -595,14 +360,6 @@ namespace MWGui
mNameEdit->eventEditSelectAccept += MyGUI::newDelegate(this, &SpellCreationDialog::onAccept);
setWidgets(mAvailableEffectsList, mUsedEffectsView);
-
- if (Settings::gui().mControllerMenus)
- {
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sCancel}";
- mControllerButtons.x = "#{sBuy}";
- mControllerButtons.r3 = "#{sInfo}";
- }
}
void SpellCreationDialog::setPtr(const MWWorld::Ptr& actor)
@@ -733,22 +490,6 @@ namespace MWGui
mSuccessChance->setCaption(MyGUI::utility::toString(intChance));
}
- bool SpellCreationDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onCancelButtonClicked(mCancelButton);
- return true;
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_X)
- {
- onBuyButtonClicked(mBuyButton);
- return true;
- }
- else
- return EffectEditorBase::onControllerButtonEvent(arg);
- }
-
// ------------------------------------------------------------------------------------------------
EffectEditorBase::EffectEditorBase(Type type)
@@ -820,7 +561,6 @@ namespace MWGui
mAvailableEffectsList->adjustSize();
mAvailableEffectsList->scrollToTop();
- mAvailableButtons.clear();
for (const short effectId : knownEffects)
{
const std::string& name = MWBase::Environment::get()
@@ -828,27 +568,13 @@ namespace MWGui
->get()
.find(ESM::MagicEffect::indexToGmstString(effectId))
->mValue.getString();
- MyGUI::Button* w = mAvailableEffectsList->getItemWidget(name);
- mAvailableButtons.emplace_back(w);
+ MyGUI::Widget* w = mAvailableEffectsList->getItemWidget(name);
ToolTips::createMagicEffectToolTip(w, effectId);
}
mEffects.clear();
updateEffectsView();
-
- if (Settings::gui().mControllerMenus)
- {
- mAvailableFocus = 0;
- mEffectFocus = 0;
- mRightColumn = false;
- if (mAvailableButtons.size() > 0)
- {
- mAvailableButtons[0]->setStateSelected(true);
- if (MWBase::Environment::get().getWindowManager()->getControllerTooltip())
- MWBase::Environment::get().getInputManager()->warpMouseToWidget(mAvailableButtons[0]);
- }
- }
}
void EffectEditorBase::setWidgets(Gui::MWList* availableEffectsList, MyGUI::ScrollView* usedEffectsView)
@@ -960,7 +686,6 @@ namespace MWGui
MyGUI::IntSize size(0, 0);
- mEffectButtons.clear();
int i = 0;
for (const ESM::ENAMstruct& effectInfo : mEffects)
{
@@ -993,8 +718,6 @@ namespace MWGui
size.width = std::max(size.width, effect->getRequestedWidth());
size.height += 24;
++i;
-
- mEffectButtons.emplace_back(std::pair(effect, button));
}
// Canvas size must be expressed with HScroll disabled, otherwise MyGUI would expand the scroll area when the
@@ -1032,100 +755,4 @@ namespace MWGui
effect.mRange = ESM::RT_Self;
mConstantEffect = constant;
}
-
- bool EffectEditorBase::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- MWBase::WindowManager* winMgr = MWBase::Environment::get().getWindowManager();
-
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (!mRightColumn && mAvailableFocus >= 0 && mAvailableFocus < static_cast(mAvailableButtons.size()))
- {
- onAvailableEffectClicked(mAvailableButtons[mAvailableFocus]);
- winMgr->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (mRightColumn && mEffectFocus >= 0 && mEffectFocus < static_cast(mEffectButtons.size()))
- {
- onEditEffect(mEffectButtons[mEffectFocus].second);
- winMgr->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK)
- {
- // Toggle info tooltip
- winMgr->setControllerTooltip(!mRightColumn && !winMgr->getControllerTooltip());
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- if (mRightColumn && mEffectButtons.size() > 0)
- {
- if (mEffectFocus >= 0 && mEffectFocus < static_cast(mEffectButtons.size()))
- mEffectButtons[mEffectFocus].first->setStateSelected(false);
- mEffectFocus = wrap(mEffectFocus - 1, mEffectButtons.size());
- mEffectButtons[mEffectFocus].first->setStateSelected(true);
- }
- else if (!mRightColumn && mAvailableButtons.size() > 0)
- {
- if (mAvailableFocus >= 0 && mAvailableFocus < static_cast(mAvailableButtons.size()))
- mAvailableButtons[mAvailableFocus]->setStateSelected(false);
- mAvailableFocus = wrap(mAvailableFocus - 1, mAvailableButtons.size());
- mAvailableButtons[mAvailableFocus]->setStateSelected(true);
- }
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- if (mRightColumn && mEffectButtons.size() > 0)
- {
- if (mEffectFocus >= 0 && mEffectFocus < static_cast(mEffectButtons.size()))
- mEffectButtons[mEffectFocus].first->setStateSelected(false);
- mEffectFocus = wrap(mEffectFocus + 1, mEffectButtons.size());
- mEffectButtons[mEffectFocus].first->setStateSelected(true);
- }
- else if (!mRightColumn && mAvailableButtons.size() > 0)
- {
- if (mAvailableFocus >= 0 && mAvailableFocus < static_cast(mAvailableButtons.size()))
- mAvailableButtons[mAvailableFocus]->setStateSelected(false);
- mAvailableFocus = wrap(mAvailableFocus + 1, mAvailableButtons.size());
- mAvailableButtons[mAvailableFocus]->setStateSelected(true);
- }
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT && mRightColumn)
- {
- mRightColumn = false;
- if (mEffectFocus >= 0 && mEffectFocus < static_cast(mEffectButtons.size()))
- mEffectButtons[mEffectFocus].first->setStateSelected(false);
- if (mAvailableFocus >= 0 && mAvailableFocus < static_cast(mAvailableButtons.size()))
- mAvailableButtons[mAvailableFocus]->setStateSelected(true);
-
- winMgr->setControllerTooltip(Settings::gui().mControllerTooltips);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT && !mRightColumn && mEffectButtons.size() > 0)
- {
- mRightColumn = true;
- if (mAvailableFocus >= 0 && mAvailableFocus < static_cast(mAvailableButtons.size()))
- mAvailableButtons[mAvailableFocus]->setStateSelected(false);
- if (mEffectFocus >= 0 && mEffectFocus < static_cast(mEffectButtons.size()))
- mEffectButtons[mEffectFocus].first->setStateSelected(true);
-
- winMgr->setControllerTooltip(false);
- }
-
- // Scroll the list to keep the active item in view
- if (mAvailableFocus <= 5)
- mAvailableEffectsList->setViewOffset(0);
- else
- {
- const int lineHeight = Settings::gui().mFontSize + 3;
- mAvailableEffectsList->setViewOffset(-lineHeight * (mAvailableFocus - 5));
- }
-
- if (!mRightColumn && mAvailableFocus >= 0 && mAvailableFocus < static_cast(mAvailableButtons.size()))
- {
- // Warp the mouse to the selected spell to show the tooltip
- if (winMgr->getControllerTooltip())
- MWBase::Environment::get().getInputManager()->warpMouseToWidget(mAvailableButtons[mAvailableFocus]);
- }
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/spellcreationdialog.hpp b/apps/openmw/mwgui/spellcreationdialog.hpp
index 2a4f5dcbb3..6dfe61fc57 100644
--- a/apps/openmw/mwgui/spellcreationdialog.hpp
+++ b/apps/openmw/mwgui/spellcreationdialog.hpp
@@ -1,15 +1,12 @@
#ifndef MWGUI_SPELLCREATION_H
#define MWGUI_SPELLCREATION_H
-#include
#include
#include
#include
-#include
#include "referenceinterface.hpp"
-#include "widgets.hpp"
#include "windowbase.hpp"
namespace Gui
@@ -60,10 +57,10 @@ namespace MWGui
MyGUI::TextBox* mDurationValue;
MyGUI::TextBox* mAreaValue;
- Gui::ScrollBar* mMagnitudeMinSlider;
- Gui::ScrollBar* mMagnitudeMaxSlider;
- Gui::ScrollBar* mDurationSlider;
- Gui::ScrollBar* mAreaSlider;
+ MyGUI::ScrollBar* mMagnitudeMinSlider;
+ MyGUI::ScrollBar* mMagnitudeMaxSlider;
+ MyGUI::ScrollBar* mDurationSlider;
+ MyGUI::ScrollBar* mAreaSlider;
MyGUI::TextBox* mAreaText;
@@ -86,18 +83,13 @@ namespace MWGui
void updateBoxes();
- private:
+ protected:
ESM::ENAMstruct mEffect;
ESM::ENAMstruct mOldEffect;
const ESM::MagicEffect* mMagicEffect;
bool mConstantEffect;
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- void updateControllerFocus(int prevFocus, int newFocus);
- int mControllerFocus;
- std::vector mButtons;
};
class EffectEditorBase
@@ -150,16 +142,8 @@ namespace MWGui
virtual void notifyEffectsChanged() {}
- virtual bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg);
-
private:
Type mType;
-
- int mAvailableFocus;
- int mEffectFocus;
- bool mRightColumn;
- std::vector mAvailableButtons;
- std::vector> mEffectButtons;
};
class SpellCreationDialog : public WindowBase, public ReferenceInterface, public EffectEditorBase
@@ -182,7 +166,6 @@ namespace MWGui
void onCancelButtonClicked(MyGUI::Widget* sender);
void onBuyButtonClicked(MyGUI::Widget* sender);
void onAccept(MyGUI::EditBox* sender);
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
void notifyEffectsChanged() override;
diff --git a/apps/openmw/mwgui/spellview.cpp b/apps/openmw/mwgui/spellview.cpp
index a3eef23092..678f6ffe1f 100644
--- a/apps/openmw/mwgui/spellview.cpp
+++ b/apps/openmw/mwgui/spellview.cpp
@@ -9,10 +9,6 @@
#include
#include
-#include "../mwbase/environment.hpp"
-#include "../mwbase/inputmanager.hpp"
-#include "../mwbase/windowmanager.hpp"
-
#include "tooltips.hpp"
namespace MWGui
@@ -32,8 +28,6 @@ namespace MWGui
: mScrollView(nullptr)
, mShowCostColumn(true)
, mHighlightSelected(true)
- , mControllerActiveWindow(false)
- , mControllerFocus(0)
{
}
@@ -94,8 +88,6 @@ namespace MWGui
const int spellHeight = Settings::gui().mFontSize + 2;
mLines.clear();
- mButtons.clear();
- mGroupIndices.clear();
while (mScrollView->getChildCount())
MyGUI::Gui::getInstance().destroyWidget(mScrollView->getChildAt(0));
@@ -114,9 +106,7 @@ namespace MWGui
curType = spell.mType;
}
- std::string skin = spell.mActive ? "SandTextButton" : "SpellTextUnequipped";
- if (Settings::gui().mControllerMenus)
- skin = spell.mActive ? "SpellTextEquippedController" : "SpellTextUnequippedController";
+ const std::string skin = spell.mActive ? "SandTextButton" : "SpellTextUnequipped";
const std::string captionSuffix = MWGui::ToolTips::getCountString(spell.mCount);
Gui::SharedStateButton* t = mScrollView->createWidget(
@@ -125,7 +115,6 @@ namespace MWGui
t->setCaption(spell.mName + captionSuffix);
t->setTextAlign(MyGUI::Align::Left);
adjustSpellWidget(spell, i, t);
- mButtons.emplace_back(std::make_pair(t, i));
if (!spell.mCostColumn.empty() && mShowCostColumn)
{
@@ -232,12 +221,6 @@ namespace MWGui
height += lineHeight;
}
- if (Settings::gui().mControllerMenus)
- {
- mControllerFocus = wrap(mControllerFocus, mButtons.size());
- updateControllerFocus(-1, mControllerFocus);
- }
-
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the
// scrollbar is hidden
mScrollView->setVisibleVScroll(false);
@@ -273,8 +256,6 @@ namespace MWGui
}
else
mLines.emplace_back(groupWidget, (MyGUI::Widget*)nullptr, NoSpellIndex);
-
- mGroupIndices.push_back(mButtons.size());
}
void SpellView::setSize(const MyGUI::IntSize& _value)
@@ -335,110 +316,4 @@ namespace MWGui
{
mScrollView->setViewOffset(MyGUI::IntPoint(0, 0));
}
-
- void SpellView::setActiveControllerWindow(bool active)
- {
- mControllerActiveWindow = active;
- if (active)
- update();
- }
-
- void SpellView::onControllerButton(const unsigned char button)
- {
- if (mButtons.empty())
- return;
-
- int prevFocus = mControllerFocus;
-
- if (button == SDL_CONTROLLER_BUTTON_A)
- {
- // Select the focused item, if any.
- if (mControllerFocus >= 0 && mControllerFocus < static_cast(mButtons.size()))
- {
- onSpellSelected(mButtons[mControllerFocus].first);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- }
- else if (button == SDL_CONTROLLER_BUTTON_RIGHTSTICK)
- {
- // Toggle info tooltip
- MWBase::Environment::get().getWindowManager()->setControllerTooltip(
- !MWBase::Environment::get().getWindowManager()->getControllerTooltip());
- }
- else if (button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- mControllerFocus--;
- else if (button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- mControllerFocus++;
- else if (button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
- mControllerFocus = std::max(0, mControllerFocus - 10);
- else if (button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- mControllerFocus = std::min(mControllerFocus + 10, static_cast(mButtons.size()) - 1);
- else if (button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
- {
- // Jump to first item in previous group
- int prevGroupIndex = 0;
- for (int groupIndex : mGroupIndices)
- {
- if (groupIndex >= mControllerFocus)
- break;
- else
- prevGroupIndex = groupIndex;
- }
- mControllerFocus = prevGroupIndex;
- }
- else if (button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
- {
- // Jump to first item in next group
- for (int groupIndex : mGroupIndices)
- {
- if (groupIndex > mControllerFocus)
- {
- mControllerFocus = groupIndex;
- break;
- }
- }
- }
-
- mControllerFocus = wrap(mControllerFocus, mButtons.size());
-
- if (prevFocus != mControllerFocus)
- updateControllerFocus(prevFocus, mControllerFocus);
- else
- updateControllerFocus(-1, mControllerFocus);
- }
-
- void SpellView::updateControllerFocus(int prevFocus, int newFocus)
- {
- if (mButtons.empty())
- return;
-
- if (prevFocus >= 0 && prevFocus < static_cast(mButtons.size()))
- {
- Gui::SharedStateButton* prev = mButtons[prevFocus].first;
- if (prev)
- prev->onMouseLostFocus(nullptr);
- }
-
- if (mControllerActiveWindow && newFocus >= 0 && newFocus < static_cast(mButtons.size()))
- {
- Gui::SharedStateButton* focused = mButtons[newFocus].first;
- if (focused)
- {
- focused->onMouseSetFocus(nullptr);
-
- // Scroll the list to keep the active item in view
- int line = mButtons[newFocus].second;
- if (line <= 5)
- mScrollView->setViewOffset(MyGUI::IntPoint(0, 0));
- else
- {
- const int lineHeight = focused->getHeight();
- mScrollView->setViewOffset(MyGUI::IntPoint(0, -lineHeight * (line - 5)));
- }
-
- if (MWBase::Environment::get().getWindowManager()->getControllerTooltip())
- MWBase::Environment::get().getInputManager()->warpMouseToWidget(focused);
- }
- }
- }
}
diff --git a/apps/openmw/mwgui/spellview.hpp b/apps/openmw/mwgui/spellview.hpp
index a2571cd822..caff43a33e 100644
--- a/apps/openmw/mwgui/spellview.hpp
+++ b/apps/openmw/mwgui/spellview.hpp
@@ -5,9 +5,6 @@
#include
#include
-#include
-
-#include
#include "spellmodel.hpp"
@@ -57,9 +54,6 @@ namespace MWGui
void resetScrollbars();
- void setActiveControllerWindow(bool active);
- void onControllerButton(const unsigned char button);
-
private:
MyGUI::ScrollView* mScrollView;
@@ -95,15 +89,6 @@ namespace MWGui
void addGroup(const std::string& label1, const std::string& label2);
void adjustSpellWidget(const Spell& spell, SpellModel::ModelIndex index, MyGUI::Widget* widget);
- /// Keep a list of buttons for controller navigation and their index in the full list.
- std::vector> mButtons;
- /// Keep a list of group offsets for controller navigation
- std::vector mGroupIndices;
-
- bool mControllerActiveWindow;
- int mControllerFocus;
- void updateControllerFocus(int prevFocus, int newFocus);
-
void onSpellSelected(MyGUI::Widget* _sender);
void onMouseWheelMoved(MyGUI::Widget* _sender, int _rel);
diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp
index c8d9b2acd9..566b7f4ccd 100644
--- a/apps/openmw/mwgui/spellwindow.cpp
+++ b/apps/openmw/mwgui/spellwindow.cpp
@@ -2,8 +2,6 @@
#include
#include
-#include
-#include
#include
#include
@@ -57,14 +55,6 @@ namespace MWGui
// Adjust the spell filtering widget size because of MyGUI limitations.
int filterWidth = mSpellView->getSize().width - deleteButton->getSize().width - 3;
mFilterEdit->setSize(filterWidth, mFilterEdit->getSize().height);
-
- if (Settings::gui().mControllerMenus)
- {
- setPinButtonVisible(false);
- mControllerButtons.a = "#{sSelect}";
- mControllerButtons.b = "#{sBack}";
- mControllerButtons.r3 = "#{sInfo}";
- }
}
void SpellWindow::onPinToggled()
@@ -298,38 +288,4 @@ namespace MWGui
onSpellSelected(selectedSpell.mId);
}
}
-
- bool SpellWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_B)
- MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
- else
- mSpellView->onControllerButton(arg.button);
-
- return true;
- }
-
- void SpellWindow::setActiveControllerWindow(bool active)
- {
- if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Inventory)
- {
- // Fill the screen, or limit to a certain size on large screens. Size chosen to
- // match the size of the stats window.
- MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
- int width = std::min(viewSize.width, 600);
- int height = std::min(viewSize.height - 48 - 48, 750);
- int x = (viewSize.width - width) / 2;
- int y = (viewSize.height - height) / 2;
-
- MyGUI::Window* window = mMainWidget->castType();
- window->setCoord(x, active ? y : viewSize.height + 1, width, height);
-
- MWBase::Environment::get().getWindowManager()->setControllerTooltip(
- active && Settings::gui().mControllerTooltips);
- }
-
- mSpellView->setActiveControllerWindow(active);
-
- WindowBase::setActiveControllerWindow(active);
- }
}
diff --git a/apps/openmw/mwgui/spellwindow.hpp b/apps/openmw/mwgui/spellwindow.hpp
index c27ec276a3..e35c5cdc4c 100644
--- a/apps/openmw/mwgui/spellwindow.hpp
+++ b/apps/openmw/mwgui/spellwindow.hpp
@@ -41,8 +41,6 @@ namespace MWGui
void onPinToggled() override;
void onTitleDoubleClicked() override;
void onOpen() override;
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- void setActiveControllerWindow(bool active) override;
SpellView* mSpellView;
std::unique_ptr mSpellIcons;
diff --git a/apps/openmw/mwgui/statswindow.cpp b/apps/openmw/mwgui/statswindow.cpp
index 430101f069..69f0b4b449 100644
--- a/apps/openmw/mwgui/statswindow.cpp
+++ b/apps/openmw/mwgui/statswindow.cpp
@@ -6,7 +6,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -81,14 +80,6 @@ namespace MWGui
MyGUI::Window* t = mMainWidget->castType();
t->eventWindowChangeCoord += MyGUI::newDelegate(this, &StatsWindow::onWindowResize);
- if (Settings::gui().mControllerMenus)
- {
- setPinButtonVisible(false);
- mControllerButtons.lStick = "#{sMouse}";
- mControllerButtons.rStick = "#{sScrolldown}";
- mControllerButtons.b = "#{sBack}";
- }
-
onWindowResize(t);
}
@@ -732,34 +723,4 @@ namespace MWGui
else if (!mPinned)
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Stats);
}
-
- bool StatsWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_B)
- MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
-
- return true;
- }
-
- void StatsWindow::setActiveControllerWindow(bool active)
- {
- if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Inventory)
- {
- // Fill the screen, or limit to a certain size on large screens. Size chosen to
- // show all stats.
- MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
- int width = std::min(viewSize.width, 600);
- int height = std::min(viewSize.height - 48 - 48, 750);
- int x = (viewSize.width - width) / 2;
- int y = (viewSize.height - height) / 2;
-
- MyGUI::Window* window = mMainWidget->castType();
- window->setCoord(x, active ? y : viewSize.height + 1, width, height);
-
- if (active)
- onWindowResize(window);
- }
-
- WindowBase::setActiveControllerWindow(active);
- }
}
diff --git a/apps/openmw/mwgui/statswindow.hpp b/apps/openmw/mwgui/statswindow.hpp
index 3021873aa8..a3fc3157c5 100644
--- a/apps/openmw/mwgui/statswindow.hpp
+++ b/apps/openmw/mwgui/statswindow.hpp
@@ -47,10 +47,6 @@ namespace MWGui
std::string_view getWindowIdForLua() const override { return "Stats"; }
- protected:
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- void setActiveControllerWindow(bool active) override;
-
private:
void addSkills(const std::vector& skills, const std::string& titleId,
const std::string& titleDefault, MyGUI::IntCoord& coord1, MyGUI::IntCoord& coord2);
diff --git a/apps/openmw/mwgui/textinput.cpp b/apps/openmw/mwgui/textinput.cpp
index 7612cf4c67..5f47b96f03 100644
--- a/apps/openmw/mwgui/textinput.cpp
+++ b/apps/openmw/mwgui/textinput.cpp
@@ -25,8 +25,6 @@ namespace MWGui
// Make sure the edit box has focus
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mTextEdit);
-
- mControllerButtons.a = "#{sOk}";
}
void TextInputDialog::setNextButtonShow(bool shown)
@@ -85,15 +83,4 @@ namespace MWGui
mTextEdit->setCaption(text);
}
- bool TextInputDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- onOkClicked(nullptr);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- return true;
- }
-
- return false;
- }
}
diff --git a/apps/openmw/mwgui/textinput.hpp b/apps/openmw/mwgui/textinput.hpp
index ad7896ff27..c11d40f1a9 100644
--- a/apps/openmw/mwgui/textinput.hpp
+++ b/apps/openmw/mwgui/textinput.hpp
@@ -27,7 +27,6 @@ namespace MWGui
protected:
void onOkClicked(MyGUI::Widget* _sender);
void onTextAccepted(MyGUI::EditBox* _sender);
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
private:
MyGUI::EditBox* mTextEdit;
diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp
index 67c10b980f..28f0b80010 100644
--- a/apps/openmw/mwgui/tooltips.cpp
+++ b/apps/openmw/mwgui/tooltips.cpp
@@ -94,7 +94,7 @@ namespace MWGui
if (guiMode)
{
- if (!winMgr->getCursorVisible() && !winMgr->getControllerTooltip())
+ if (!winMgr->getCursorVisible())
return;
const MyGUI::IntPoint& mousePos = MyGUI::InputManager::getInstance().getMousePosition();
diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp
index c26a7f030a..ba752303d2 100644
--- a/apps/openmw/mwgui/tradewindow.cpp
+++ b/apps/openmw/mwgui/tradewindow.cpp
@@ -168,25 +168,6 @@ namespace MWGui
std::numeric_limits::min() + 1); // disallow INT_MIN since abs(INT_MIN) is undefined
setCoord(400, 0, 400, 300);
-
- if (Settings::gui().mControllerMenus)
- {
- // Show L1 and R1 buttons next to tabs
- MyGUI::Widget* image;
- getWidget(image, "BtnL1Image");
- image->setVisible(true);
- image->setUserString("Hidden", "false");
-
- getWidget(image, "BtnR1Image");
- image->setVisible(true);
- image->setUserString("Hidden", "false");
-
- mControllerButtons.a = "#{sBuy}";
- mControllerButtons.b = "#{sCancel}";
- mControllerButtons.x = "#{sOffer}";
- mControllerButtons.r3 = "#{sInfo}";
- mControllerButtons.l2 = "#{sInventory}";
- }
}
void TradeWindow::setPtr(const MWWorld::Ptr& actor)
@@ -220,10 +201,6 @@ namespace MWGui
onFilterChanged(mFilterAll);
mFilterEdit->setCaption({});
-
- // Cycle to the buy window if it's not active.
- if (Settings::gui().mControllerMenus && !mActiveControllerWindow)
- MWBase::Environment::get().getWindowManager()->cycleActiveControllerWindow(true);
}
void TradeWindow::onFrame(float dt)
@@ -362,13 +339,6 @@ namespace MWGui
}
}
- void TradeWindow::onOfferSubmitted(MyGUI::Widget* _sender, int offerAmount)
- {
- mCurrentBalance = mCurrentBalance < 0 ? -offerAmount : offerAmount;
- updateLabels();
- onOfferButtonClicked(mOfferButton);
- }
-
void TradeWindow::onOfferButtonClicked(MyGUI::Widget* _sender)
{
TradeItemModel* playerItemModel
@@ -673,89 +643,4 @@ namespace MWGui
if (mTradeModel && mTradeModel->usesContainer(ptr))
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
}
-
- bool TradeWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- int index = mItemView->getControllerFocus();
- if (index >= 0 && index < mItemView->getItemCount())
- onItemSelected(index);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onCancelButtonClicked(mCancelButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_X)
- {
- if (mCurrentBalance == 0)
- return true;
- // Show a count dialog to allow for bartering.
- CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
- if (mCurrentBalance < 0)
- {
- // Buying from the merchant
- dialog->openCountDialog("#{sTotalcost}:", "#{sOffer}", -mCurrentMerchantOffer);
- dialog->setCount(-mCurrentBalance);
- }
- else
- {
- // Selling to the merchant
- dialog->openCountDialog("#{sTotalsold}:", "#{sOffer}", getMerchantGold());
- dialog->setCount(mCurrentBalance);
- }
- dialog->eventOkClicked.clear();
- dialog->eventOkClicked += MyGUI::newDelegate(this, &TradeWindow::onOfferSubmitted);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
- {
- if (mFilterAll->getStateSelected())
- onFilterChanged(mFilterMisc);
- else if (mFilterWeapon->getStateSelected())
- onFilterChanged(mFilterAll);
- else if (mFilterApparel->getStateSelected())
- onFilterChanged(mFilterWeapon);
- else if (mFilterMagic->getStateSelected())
- onFilterChanged(mFilterApparel);
- else if (mFilterMisc->getStateSelected())
- onFilterChanged(mFilterMagic);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
- {
- if (mFilterAll->getStateSelected())
- onFilterChanged(mFilterWeapon);
- else if (mFilterWeapon->getStateSelected())
- onFilterChanged(mFilterApparel);
- else if (mFilterApparel->getStateSelected())
- onFilterChanged(mFilterMagic);
- else if (mFilterMagic->getStateSelected())
- onFilterChanged(mFilterMisc);
- else if (mFilterMisc->getStateSelected())
- onFilterChanged(mFilterAll);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK || arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP
- || arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN || arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT
- || arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- {
- mItemView->onControllerButton(arg.button);
- }
-
- return true;
- }
-
- void TradeWindow::setActiveControllerWindow(bool active)
- {
- // Show L1 and R1 buttons next to tabs
- MyGUI::Widget* image;
- getWidget(image, "BtnL1Image");
- image->setVisible(active);
-
- getWidget(image, "BtnR1Image");
- image->setVisible(active);
-
- mItemView->setActiveControllerWindow(active);
- WindowBase::setActiveControllerWindow(active);
- }
}
diff --git a/apps/openmw/mwgui/tradewindow.hpp b/apps/openmw/mwgui/tradewindow.hpp
index afd271ed2f..33c39cb269 100644
--- a/apps/openmw/mwgui/tradewindow.hpp
+++ b/apps/openmw/mwgui/tradewindow.hpp
@@ -47,9 +47,6 @@ namespace MWGui
std::string_view getWindowIdForLua() const override { return "Trade"; }
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- void setActiveControllerWindow(bool active) override;
-
private:
ItemView* mItemView;
SortFilterItemModel* mSortModel;
@@ -105,7 +102,6 @@ namespace MWGui
void onBalanceButtonReleased(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
void onBalanceValueChanged(int value);
void onRepeatClick(MyGUI::Widget* widget, MyGUI::ControllerItem* controller);
- void onOfferSubmitted(MyGUI::Widget* _sender, int offerAmount);
void addRepeatController(MyGUI::Widget* widget);
diff --git a/apps/openmw/mwgui/trainingwindow.cpp b/apps/openmw/mwgui/trainingwindow.cpp
index 5b4d355e61..890aa0ba68 100644
--- a/apps/openmw/mwgui/trainingwindow.cpp
+++ b/apps/openmw/mwgui/trainingwindow.cpp
@@ -37,13 +37,6 @@ namespace MWGui
mTimeAdvancer.eventProgressChanged += MyGUI::newDelegate(this, &TrainingWindow::onTrainingProgressChanged);
mTimeAdvancer.eventFinished += MyGUI::newDelegate(this, &TrainingWindow::onTrainingFinished);
-
- if (Settings::gui().mControllerMenus)
- {
- mDisableGamepadCursor = true;
- mControllerButtons.a = "#{sBuy}";
- mControllerButtons.b = "#{sCancel}";
- }
}
void TrainingWindow::onOpen()
@@ -112,7 +105,6 @@ namespace MWGui
const int lineHeight = Settings::gui().mFontSize + 2;
- mTrainingButtons.clear();
for (size_t i = 0; i < skills.size(); ++i)
{
const ESM::Skill* skill = skills[i].first;
@@ -136,16 +128,6 @@ namespace MWGui
button->setSize(button->getTextSize().width + 12, button->getSize().height);
ToolTips::createSkillToolTip(button, skill->mId);
-
- if (price <= playerGold)
- mTrainingButtons.emplace_back(button);
- }
-
- if (Settings::gui().mControllerMenus)
- {
- mControllerFocus = 0;
- if (mTrainingButtons.size() > 0)
- mTrainingButtons[0]->setStateSelected(true);
}
center();
@@ -247,36 +229,4 @@ namespace MWGui
return !mTimeAdvancer.isRunning();
}
- bool TrainingWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mControllerFocus >= 0 && mControllerFocus < static_cast(mTrainingButtons.size()))
- onTrainingSelected(mTrainingButtons[mControllerFocus]);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onCancelButtonClicked(mCancelButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- if (mTrainingButtons.size() <= 1)
- return true;
-
- setControllerFocus(mTrainingButtons, mControllerFocus, false);
- mControllerFocus = wrap(mControllerFocus - 1, mTrainingButtons.size());
- setControllerFocus(mTrainingButtons, mControllerFocus, true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- if (mTrainingButtons.size() <= 1)
- return true;
-
- setControllerFocus(mTrainingButtons, mControllerFocus, false);
- mControllerFocus = wrap(mControllerFocus + 1, mTrainingButtons.size());
- setControllerFocus(mTrainingButtons, mControllerFocus, true);
- }
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/trainingwindow.hpp b/apps/openmw/mwgui/trainingwindow.hpp
index 4f866f820e..ee13f24b23 100644
--- a/apps/openmw/mwgui/trainingwindow.hpp
+++ b/apps/openmw/mwgui/trainingwindow.hpp
@@ -49,13 +49,9 @@ namespace MWGui
MyGUI::Widget* mTrainingOptions;
MyGUI::Button* mCancelButton;
MyGUI::TextBox* mPlayerGold;
- std::vector mTrainingButtons;
WaitDialogProgressBar mProgressBar;
TimeAdvancer mTimeAdvancer;
-
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- int mControllerFocus;
};
}
diff --git a/apps/openmw/mwgui/travelwindow.cpp b/apps/openmw/mwgui/travelwindow.cpp
index 726e623eb3..e001cf9b43 100644
--- a/apps/openmw/mwgui/travelwindow.cpp
+++ b/apps/openmw/mwgui/travelwindow.cpp
@@ -37,13 +37,6 @@ namespace MWGui
getWidget(mDestinationsView, "DestinationsView");
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TravelWindow::onCancelButtonClicked);
-
- if (Settings::gui().mControllerMenus)
- {
- mDisableGamepadCursor = true;
- mControllerButtons.a = "#{sTravel}";
- mControllerButtons.b = "#{sCancel}";
- }
}
void TravelWindow::addDestination(const ESM::RefId& name, const ESM::Position& pos, bool interior)
@@ -101,8 +94,6 @@ namespace MWGui
toAdd->setUserString("Destination", nameString);
toAdd->setUserData(pos);
toAdd->eventMouseButtonClick += MyGUI::newDelegate(this, &TravelWindow::onTravelButtonClick);
- if (price <= playerGold)
- mDestinationButtons.emplace_back(toAdd);
}
void TravelWindow::clearDestinations()
@@ -111,7 +102,6 @@ namespace MWGui
mCurrentY = 0;
while (mDestinationsView->getChildCount())
MyGUI::Gui::getInstance().destroyWidget(mDestinationsView->getChildAt(0));
- mDestinationButtons.clear();
}
void TravelWindow::setPtr(const MWWorld::Ptr& actor)
@@ -156,14 +146,6 @@ namespace MWGui
}
updateLabels();
-
- if (Settings::gui().mControllerMenus)
- {
- mControllerFocus = 0;
- if (mDestinationButtons.size() > 0)
- mDestinationButtons[0]->setStateSelected(true);
- }
-
// Canvas size must be expressed with VScroll disabled, otherwise MyGUI would expand the scroll area when the
// scrollbar is hidden
mDestinationsView->setVisibleVScroll(false);
@@ -258,49 +240,4 @@ namespace MWGui
mDestinationsView->setViewOffset(
MyGUI::IntPoint(0, static_cast(mDestinationsView->getViewOffset().top + _rel * 0.3f)));
}
-
- bool TravelWindow::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- if (mControllerFocus >= 0 && mControllerFocus < static_cast(mDestinationButtons.size()))
- {
- onTravelButtonClick(mDestinationButtons[mControllerFocus]);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- {
- onCancelButtonClicked(mCancelButton);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_UP)
- {
- if (mDestinationButtons.size() <= 1)
- return true;
-
- setControllerFocus(mDestinationButtons, mControllerFocus, false);
- mControllerFocus = wrap(mControllerFocus - 1, mDestinationButtons.size());
- setControllerFocus(mDestinationButtons, mControllerFocus, true);
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_DOWN)
- {
- if (mDestinationButtons.size() <= 1)
- return true;
-
- setControllerFocus(mDestinationButtons, mControllerFocus, false);
- mControllerFocus = wrap(mControllerFocus + 1, mDestinationButtons.size());
- setControllerFocus(mDestinationButtons, mControllerFocus, true);
- }
-
- // Scroll the list to keep the active item in view
- if (mControllerFocus <= 5)
- mDestinationsView->setViewOffset(MyGUI::IntPoint(0, 0));
- else
- {
- const int lineHeight = Settings::gui().mFontSize + 2;
- mDestinationsView->setViewOffset(MyGUI::IntPoint(0, -lineHeight * (mControllerFocus - 5)));
- }
-
- return true;
- }
}
diff --git a/apps/openmw/mwgui/travelwindow.hpp b/apps/openmw/mwgui/travelwindow.hpp
index 79f5f9abc8..630e27518a 100644
--- a/apps/openmw/mwgui/travelwindow.hpp
+++ b/apps/openmw/mwgui/travelwindow.hpp
@@ -25,8 +25,6 @@ namespace MWGui
MyGUI::Button* mCancelButton;
MyGUI::TextBox* mPlayerGold;
- std::vector mDestinationButtons;
-
MyGUI::ScrollView* mDestinationsView;
void onCancelButtonClicked(MyGUI::Widget* _sender);
@@ -39,10 +37,6 @@ namespace MWGui
void updateLabels();
void onReferenceUnavailable() override;
-
- private:
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
- int mControllerFocus;
};
}
diff --git a/apps/openmw/mwgui/waitdialog.cpp b/apps/openmw/mwgui/waitdialog.cpp
index f33695a982..222a34e53b 100644
--- a/apps/openmw/mwgui/waitdialog.cpp
+++ b/apps/openmw/mwgui/waitdialog.cpp
@@ -80,9 +80,6 @@ namespace MWGui
mTimeAdvancer.eventProgressChanged += MyGUI::newDelegate(this, &WaitDialog::onWaitingProgressChanged);
mTimeAdvancer.eventInterrupted += MyGUI::newDelegate(this, &WaitDialog::onWaitingInterrupted);
mTimeAdvancer.eventFinished += MyGUI::newDelegate(this, &WaitDialog::onWaitingFinished);
-
- mControllerButtons.b = "#{sCancel}";
- mDisableGamepadCursor = Settings::gui().mControllerMenus;
}
void WaitDialog::setPtr(const MWWorld::Ptr& ptr)
@@ -329,45 +326,6 @@ namespace MWGui
}
}
- ControllerButtonStr* WaitDialog::getControllerButtons()
- {
- mControllerButtons.a = mSleeping ? "#{sRest}" : "#{sWait}";
- mControllerButtons.x = mSleeping && mUntilHealedButton->getVisible() ? "#{sUntilHealed}" : "";
- return &mControllerButtons;
- }
-
- bool WaitDialog::onControllerButtonEvent(const SDL_ControllerButtonEvent& arg)
- {
- if (arg.button == SDL_CONTROLLER_BUTTON_A)
- {
- onWaitButtonClicked(mWaitButton);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_B)
- onCancelButtonClicked(mCancelButton);
- else if (arg.button == SDL_CONTROLLER_BUTTON_X && mUntilHealedButton->getVisible())
- {
- onUntilHealedButtonClicked(mUntilHealedButton);
- MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Menu Click"));
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_LEFT)
- MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::ArrowDown, 0, false);
- else if (arg.button == SDL_CONTROLLER_BUTTON_DPAD_RIGHT)
- MWBase::Environment::get().getWindowManager()->injectKeyPress(MyGUI::KeyCode::ArrowUp, 0, false);
- else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
- {
- mHourSlider->setScrollPosition(0);
- onHourSliderChangedPosition(mHourSlider, mHourSlider->getScrollPosition());
- }
- else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER)
- {
- mHourSlider->setScrollPosition(mHourSlider->getScrollRange() - 1);
- onHourSliderChangedPosition(mHourSlider, mHourSlider->getScrollPosition());
- }
-
- return true;
- }
-
void WaitDialog::stopWaiting()
{
MWBase::Environment::get().getWindowManager()->fadeScreenIn(0.2f);
diff --git a/apps/openmw/mwgui/waitdialog.hpp b/apps/openmw/mwgui/waitdialog.hpp
index 4a7ccfcd00..3d66584f54 100644
--- a/apps/openmw/mwgui/waitdialog.hpp
+++ b/apps/openmw/mwgui/waitdialog.hpp
@@ -4,7 +4,6 @@
#include "timeadvancer.hpp"
#include "windowbase.hpp"
#include
-#include
namespace MWGui
{
@@ -37,7 +36,6 @@ namespace MWGui
void clear() override;
void onFrame(float dt) override;
- bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
bool getSleeping() { return mTimeAdvancer.isRunning() && mSleeping; }
void wakeUp();
@@ -47,8 +45,6 @@ namespace MWGui
std::string_view getWindowIdForLua() const override { return "WaitDialog"; }
- ControllerButtonStr* getControllerButtons() override;
-
protected:
MyGUI::TextBox* mDateTimeText;
MyGUI::TextBox* mRestText;
@@ -56,7 +52,7 @@ namespace MWGui
MyGUI::Button* mUntilHealedButton;
MyGUI::Button* mWaitButton;
MyGUI::Button* mCancelButton;
- Gui::ScrollBar* mHourSlider;
+ MyGUI::ScrollBar* mHourSlider;
TimeAdvancer mTimeAdvancer;
bool mSleeping;
diff --git a/apps/openmw/mwgui/widgets.cpp b/apps/openmw/mwgui/widgets.cpp
index 8995f04b92..6cc5bdfdf5 100644
--- a/apps/openmw/mwgui/widgets.cpp
+++ b/apps/openmw/mwgui/widgets.cpp
@@ -14,8 +14,6 @@
#include
#include
-#include "textcolours.hpp"
-
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
@@ -68,12 +66,6 @@ namespace MWGui::Widgets
}
}
- void MWSkill::setStateSelected(bool selected)
- {
- const TextColours& textColours{ MWBase::Environment::get().getWindowManager()->getTextColours() };
- mSkillNameWidget->setTextColour(selected ? textColours.link : textColours.normal);
- }
-
void MWSkill::onClicked(MyGUI::Widget* _sender)
{
eventClicked(this);
@@ -158,12 +150,6 @@ namespace MWGui::Widgets
}
}
- void MWAttribute::setStateSelected(bool selected)
- {
- const TextColours& textColours{ MWBase::Environment::get().getWindowManager()->getTextColours() };
- mAttributeNameWidget->setTextColour(selected ? textColours.link : textColours.normal);
- }
-
void MWAttribute::initialiseOverride()
{
Base::initialiseOverride();
@@ -245,12 +231,6 @@ namespace MWGui::Widgets
}
}
- void MWSpell::setStateSelected(bool selected)
- {
- const TextColours& textColours{ MWBase::Environment::get().getWindowManager()->getTextColours() };
- mSpellNameWidget->setTextColour(selected ? textColours.link : textColours.normal);
- }
-
void MWSpell::initialiseOverride()
{
Base::initialiseOverride();
@@ -481,12 +461,6 @@ namespace MWGui::Widgets
MWSpellEffect::~MWSpellEffect() {}
- void MWSpellEffect::setStateSelected(bool selected)
- {
- const TextColours& textColours{ MWBase::Environment::get().getWindowManager()->getTextColours() };
- mTextWidget->setTextColour(selected ? textColours.link : textColours.normal);
- }
-
void MWSpellEffect::initialiseOverride()
{
Base::initialiseOverride();
diff --git a/apps/openmw/mwgui/widgets.hpp b/apps/openmw/mwgui/widgets.hpp
index c51846d9df..d562e4e07f 100644
--- a/apps/openmw/mwgui/widgets.hpp
+++ b/apps/openmw/mwgui/widgets.hpp
@@ -110,8 +110,6 @@ namespace MWGui
*/
EventHandle_SkillVoid eventClicked;
- void setStateSelected(bool selected);
-
protected:
virtual ~MWSkill();
@@ -151,8 +149,6 @@ namespace MWGui
*/
EventHandle_AttributeVoid eventClicked;
- void setStateSelected(bool selected);
-
protected:
~MWAttribute() override = default;
@@ -195,8 +191,6 @@ namespace MWGui
const ESM::RefId& getSpellId() const { return mId; }
- void setStateSelected(bool selected);
-
protected:
virtual ~MWSpell();
@@ -262,8 +256,6 @@ namespace MWGui
int getRequestedWidth() const { return mRequestedWidth; }
- void setStateSelected(bool selected);
-
protected:
virtual ~MWSpellEffect();
diff --git a/apps/openmw/mwgui/windowbase.cpp b/apps/openmw/mwgui/windowbase.cpp
index b607ec50b2..f5d90590f8 100644
--- a/apps/openmw/mwgui/windowbase.cpp
+++ b/apps/openmw/mwgui/windowbase.cpp
@@ -7,7 +7,6 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
-#include