mirror of
https://github.com/OpenMW/openmw.git
synced 2025-11-29 08:04:30 +00:00
Revert "Merge branch 'master' into 'master'"
This reverts merge request !4710
This commit is contained in:
parent
b29850f4c6
commit
38efdd2fd8
153 changed files with 94 additions and 5012 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1398,29 +1398,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QCheckBox" name="controllerMenusCheckBox">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Make it easier to use game menus with a controller.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable Controller Menus</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="controllerMenuTooltipsCheckBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>When using controller menus, make tooltips visible by default.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show Controller Tooltips By Default</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="showOwnedLabel">
|
||||
<property name="text">
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <MyGUI_Widget.h>
|
||||
#include <SDL_gamecontroller.h>
|
||||
#include <cstdint>
|
||||
|
||||
|
|
@ -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<int>& getActionKeySorting() = 0;
|
||||
|
|
|
|||
|
|
@ -11,9 +11,7 @@
|
|||
|
||||
#include <MyGUI_KeyCode.h>
|
||||
|
||||
#include "../mwgui/hud.hpp"
|
||||
#include "../mwgui/mode.hpp"
|
||||
#include "../mwgui/windowbase.hpp"
|
||||
|
||||
#include <components/sdlutil/events.hpp>
|
||||
|
||||
|
|
@ -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<MWGui::WindowBase*> 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<MWGui::GuiMode>& getGuiModeStack() const = 0;
|
||||
virtual void setDisabledByLua(std::string_view windowId, bool disabled) = 0;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#include <MyGUI_ControllerRepeatClick.h>
|
||||
#include <MyGUI_EditBox.h>
|
||||
#include <MyGUI_Gui.h>
|
||||
#include <MyGUI_InputManager.h>
|
||||
#include <MyGUI_UString.h>
|
||||
|
||||
#include <components/esm3/loadappa.hpp>
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,8 +99,6 @@ namespace MWGui
|
|||
|
||||
std::vector<ItemWidget*> mApparatus;
|
||||
std::vector<ItemWidget*> mIngredients;
|
||||
|
||||
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,12 +53,8 @@ namespace MWGui
|
|||
MyGUI::ScrollView* mSpellArea;
|
||||
MyGUI::ImageBox* mBirthImage;
|
||||
std::vector<MyGUI::Widget*> mSpellItems;
|
||||
MyGUI::Button* mBackButton;
|
||||
MyGUI::Button* mOkButton;
|
||||
|
||||
ESM::RefId mCurrentBirthId;
|
||||
|
||||
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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(InteractiveId)>(); }
|
||||
|
||||
void setFocusItem(BookTypesetter::Style* itemStyle) override
|
||||
{
|
||||
mPageDisplay->mFocusItem = (TypesetBookImpl::StyleImpl*)itemStyle;
|
||||
mPageDisplay->dirtyFocusItem();
|
||||
}
|
||||
|
||||
protected:
|
||||
void initialiseOverride() override
|
||||
{
|
||||
|
|
|
|||
|
|
@ -31,9 +31,6 @@ namespace MWGui
|
|||
/// text combined prior to pagination.
|
||||
virtual std::pair<unsigned int, unsigned int> 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;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
#include <components/esm3/loadnpc.hpp>
|
||||
#include <components/misc/resourcehelpers.hpp>
|
||||
#include <components/resource/resourcesystem.hpp>
|
||||
#include <components/settings/values.hpp>
|
||||
#include <components/vfs/manager.hpp>
|
||||
|
||||
#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<int>(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<int>(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<int>(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<int>(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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<MyGUI::Button*> 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<Widgets::MWAttribute*> 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<Widgets::MWSkill*> 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<MyGUI::Button*> mButtons;
|
||||
Widgets::MWAttributePtr mFavoriteAttribute0, mFavoriteAttribute1;
|
||||
std::array<Widgets::MWSkillPtr, 5> mMajorSkill;
|
||||
std::array<Widgets::MWSkillPtr, 5> mMinorSkill;
|
||||
|
|
@ -348,9 +329,6 @@ namespace MWGui
|
|||
|
||||
Widgets::MWAttributePtr mAffectedAttribute;
|
||||
Widgets::MWSkillPtr mAffectedSkill;
|
||||
|
||||
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
|
||||
int mControllerFocus = 2;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@
|
|||
#include <MyGUI_EditBox.h>
|
||||
#include <MyGUI_InputManager.h>
|
||||
|
||||
#include <components/settings/values.hpp>
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
#include <MyGUI_Button.h>
|
||||
#include <MyGUI_EditBox.h>
|
||||
|
||||
#include <components/settings/values.hpp>
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
#include <MyGUI_Button.h>
|
||||
#include <MyGUI_InputManager.h>
|
||||
|
||||
#include <components/settings/values.hpp>
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
#ifndef MWGUI_CONTROLLERBUTTONSOVERLAY_H
|
||||
#define MWGUI_CONTROLLERBUTTONSOVERLAY_H
|
||||
|
||||
#include <MyGUI_ImageBox.h>
|
||||
#include <MyGUI_TextBox.h>
|
||||
|
||||
#include <components/widgets/box.hpp>
|
||||
|
||||
#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
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
#include "windowbase.hpp"
|
||||
|
||||
#include <components/widgets/scrollbar.hpp>
|
||||
|
||||
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<MyGUI::Widget*, int> 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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<MyGUI::Window>()->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<int>(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<std::string, int>& choice : mChoices)
|
||||
{
|
||||
auto link = std::make_unique<Choice>(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<int>(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<int>(mChoices.size()))
|
||||
onChoiceActivated(mChoices[mControllerChoice].second);
|
||||
}
|
||||
else if (mControllerFocus == static_cast<int>(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<int>(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<int>(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<int>(mTopicsList->getItemCount()))
|
||||
mControllerFocus = 0;
|
||||
else if (mControllerFocus == static_cast<int>(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<int>(mTopicsList->getItemCount()));
|
||||
setControllerFocus(mControllerFocus, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,9 +49,6 @@ namespace MWGui
|
|||
|
||||
MyGUI::Widget* getDefaultKeyFocus() override;
|
||||
|
||||
protected:
|
||||
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<ResponseCallback> mCallback;
|
||||
|
||||
|
|
@ -68,9 +65,6 @@ namespace MWGui
|
|||
MyGUI::Widget* mActionsBox;
|
||||
Gui::AutoSizedTextBox* mGoldLabel;
|
||||
|
||||
std::vector<MyGUI::Button*> 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<std::unique_ptr<DialogueText>> mHistoryContents;
|
||||
std::vector<std::pair<std::string, int>> mChoices;
|
||||
std::vector<BookTypesetter::Style*> mChoiceStyles;
|
||||
bool mGoodbye;
|
||||
|
||||
std::vector<std::unique_ptr<Link>> mLinks;
|
||||
|
|
@ -229,10 +220,6 @@ namespace MWGui
|
|||
std::unique_ptr<ResponseCallback> mCallback;
|
||||
std::unique_ptr<ResponseCallback> mGreetingCallback;
|
||||
|
||||
void setControllerFocus(size_t index, bool focused);
|
||||
int mControllerFocus = 0;
|
||||
int mControllerChoice = -1;
|
||||
|
||||
void updateTopicFormat();
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,8 +73,6 @@ namespace MWGui
|
|||
|
||||
MWMechanics::Enchanting mEnchanting;
|
||||
ESM::EffectList mEffectList;
|
||||
|
||||
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<int>(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<int>(mTabs.size()); i++)
|
||||
mTabs[i]->setStateSelected(i == index);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
#ifndef MWGUI_INVENTORYTABSSOVERLAY_H
|
||||
#define MWGUI_INVENTORYTABSSOVERLAY_H
|
||||
|
||||
#include <MyGUI_Button.h>
|
||||
|
||||
#include "windowbase.hpp"
|
||||
|
||||
namespace MWGui
|
||||
{
|
||||
class InventoryTabsOverlay : public WindowBase
|
||||
{
|
||||
public:
|
||||
InventoryTabsOverlay();
|
||||
|
||||
void setTab(int index);
|
||||
|
||||
private:
|
||||
std::vector<MyGUI::Button*> mTabs;
|
||||
|
||||
void onTabClicked(MyGUI::Widget* sender);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -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<MyGUI::Window>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#include "itemchargeview.hpp"
|
||||
|
||||
#include <SDL.h>
|
||||
#include <set>
|
||||
|
||||
#include <MyGUI_FactoryManager.h>
|
||||
|
|
@ -10,11 +9,8 @@
|
|||
#include <MyGUI_UString.h>
|
||||
|
||||
#include <components/esm3/loadench.hpp>
|
||||
#include <components/settings/values.hpp>
|
||||
|
||||
#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<int>(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<int>(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<int>(mLines.size()))
|
||||
{
|
||||
mLines[prevFocus].mText->setTextColour(textColours.normal);
|
||||
mLines[prevFocus].mIcon->setControllerFocus(false);
|
||||
}
|
||||
|
||||
if (newFocus >= 0 && newFocus < static_cast<int>(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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,8 +52,6 @@ namespace MWGui
|
|||
|
||||
MyGUI::delegates::MultiDelegate<MyGUI::Widget*, const MWWorld::Ptr&> eventItemClicked;
|
||||
|
||||
void onControllerButton(const unsigned char button);
|
||||
|
||||
private:
|
||||
struct Line
|
||||
{
|
||||
|
|
@ -74,9 +72,6 @@ namespace MWGui
|
|||
std::unique_ptr<ItemModel> mModel;
|
||||
MyGUI::ScrollView* mScrollView;
|
||||
DisplayMode mDisplayMode;
|
||||
|
||||
int mControllerFocus;
|
||||
void updateControllerFocus(int prevFocus, int newFocus);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
#include <MyGUI_Button.h>
|
||||
#include <MyGUI_TextBox.h>
|
||||
|
||||
#include <components/settings/values.hpp>
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ namespace MWGui
|
|||
void onSelectedItem(int index);
|
||||
|
||||
void onCancelButtonClicked(MyGUI::Widget* sender);
|
||||
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,12 +7,6 @@
|
|||
#include <MyGUI_ImageBox.h>
|
||||
#include <MyGUI_ScrollView.h>
|
||||
|
||||
#include <components/settings/values.hpp>
|
||||
|
||||
#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<MWGui::ItemView>("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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#define MWGUI_ITEMVIEW_H
|
||||
|
||||
#include <MyGUI_Widget.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#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<ItemModel> mModel;
|
||||
MyGUI::ScrollView* mScrollView;
|
||||
|
||||
int mItemCount = 0;
|
||||
int mRows;
|
||||
int mControllerFocus = 0;
|
||||
bool mControllerActiveWindow;
|
||||
void updateControllerFocus(int prevFocus, int newFocus);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<MyGUI::Widget>(CloseBTN));
|
||||
}
|
||||
|
||||
|
|
@ -282,8 +275,6 @@ namespace
|
|||
|
||||
updateShowingPages();
|
||||
updateCloseJournalButton();
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
|
||||
}
|
||||
|
||||
void setOptionsMode()
|
||||
|
|
@ -316,8 +307,6 @@ namespace
|
|||
notifyQuests(getWidget<MyGUI::Widget>(QuestsList));
|
||||
else
|
||||
notifyTopics(getWidget<MyGUI::Widget>(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<Gui::MWList>(QuestsList);
|
||||
notifyQuestClicked(list->getItemNameAt(mSelectedQuest), 0);
|
||||
}
|
||||
else if (mOptionsMode && mTopicsMode)
|
||||
{
|
||||
// Choose a topic
|
||||
Gui::MWList* list = getWidget<Gui::MWList>(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<MyGUI::Widget>(CancelBTN));
|
||||
mQuestMode = false;
|
||||
}
|
||||
else if (mStates.size() > 1)
|
||||
{
|
||||
// Pop the current book. If in quest mode, reopen the quest list.
|
||||
notifyJournal(getWidget<MyGUI::Widget>(JournalBTN));
|
||||
if (mQuestMode)
|
||||
{
|
||||
notifyOptions(getWidget<MyGUI::Widget>(OptionsBTN));
|
||||
notifyQuests(getWidget<MyGUI::Widget>(QuestsBTN));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Close the journal window
|
||||
notifyClose(getWidget<MyGUI::Widget>(CloseBTN));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (arg.button == SDL_CONTROLLER_BUTTON_X) // X: Quests
|
||||
{
|
||||
if (mOptionsMode && mQuestMode)
|
||||
{
|
||||
// Hide the quest overlay if visible
|
||||
notifyCancel(getWidget<MyGUI::Widget>(CancelBTN));
|
||||
mQuestMode = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Show the quest overlay if viewing a journal entry or the topics
|
||||
if (!mOptionsMode)
|
||||
notifyOptions(getWidget<MyGUI::Widget>(OptionsBTN));
|
||||
if (!mQuestMode)
|
||||
notifyQuests(getWidget<MyGUI::Widget>(QuestsBTN));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (arg.button == SDL_CONTROLLER_BUTTON_Y) // Y: Topics
|
||||
{
|
||||
if (mOptionsMode && !mQuestMode)
|
||||
{
|
||||
// Hide the topics overlay if visible
|
||||
notifyCancel(getWidget<MyGUI::Widget>(CancelBTN));
|
||||
mQuestMode = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Show the topics overlay if viewing a journal entry or the quest list
|
||||
if (!mOptionsMode)
|
||||
notifyOptions(getWidget<MyGUI::Widget>(OptionsBTN));
|
||||
if (mQuestMode)
|
||||
notifyTopics(getWidget<MyGUI::Widget>(TopicsBTN));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSTICK) // R3: Show All/Some
|
||||
{
|
||||
if (mAllQuests)
|
||||
notifyShowActive(getWidget<MyGUI::Widget>(ShowActiveBTN));
|
||||
else
|
||||
notifyShowAll(getWidget<MyGUI::Widget>(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<MyGUI::Widget>(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<MyGUI::Widget>(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<MyGUI::Widget>(PrevPageBTN));
|
||||
return true;
|
||||
}
|
||||
else if (arg.button == SDL_CONTROLLER_BUTTON_RIGHTSHOULDER) // RB: Next Page
|
||||
{
|
||||
if (!mOptionsMode)
|
||||
notifyNextPage(getWidget<MyGUI::Widget>(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<Gui::MWList>(mQuestMode ? QuestsList : TopicsList);
|
||||
if (mSelectedQuest <= 3)
|
||||
list->setViewOffset(0);
|
||||
else
|
||||
{
|
||||
int offset = 0;
|
||||
for (int i = 0; i < static_cast<int>(mSelectedQuest) - 3; i++)
|
||||
offset += mButtons[i]->getHeight() + 3;
|
||||
list->setViewOffset(-offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,12 +31,6 @@ namespace MWGui
|
|||
void setVisible(bool newValue) override = 0;
|
||||
|
||||
std::string_view getWindowIdForLua() const override { return "Journal"; }
|
||||
|
||||
std::vector<MyGUI::Button*> mButtons;
|
||||
size_t mSelectedQuest = 0;
|
||||
size_t mSelectedIndex = 0;
|
||||
void setIndexControllerFocus(bool focused);
|
||||
void setControllerFocusedQuest(size_t index);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
#include <MyGUI_UString.h>
|
||||
|
||||
#include <components/fallback/fallback.hpp>
|
||||
#include <components/settings/values.hpp>
|
||||
#include <components/widgets/box.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
|
@ -73,7 +72,6 @@ namespace MWGui
|
|||
widgets.mButton->setCaption(attribute.mName);
|
||||
widgets.mValue = hbox->createWidget<Gui::AutoSizedTextBox>("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<int>(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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<MyGUI::Button*> mAttributeButtons;
|
||||
int mControllerFocus;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include "mainmenu.hpp"
|
||||
|
||||
#include <MyGUI_Gui.h>
|
||||
#include <MyGUI_InputManager.h>
|
||||
#include <MyGUI_RenderManager.h>
|
||||
#include <MyGUI_TextBox.h>
|
||||
|
||||
|
|
@ -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<std::string>();
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
#include <MyGUI_RotatingSkin.h>
|
||||
#include <MyGUI_ScrollView.h>
|
||||
#include <MyGUI_TextIterator.h>
|
||||
#include <MyGUI_Window.h>
|
||||
|
||||
#include <components/esm3/esmwriter.hpp>
|
||||
#include <components/esm3/globalmap.hpp>
|
||||
|
|
@ -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::Window>();
|
||||
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<MyGUI::Window>();
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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<int>(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<int>(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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<std::pair<MyGUI::Button*, int>> 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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/misc/strings/algorithm.hpp>
|
||||
#include <components/settings/values.hpp>
|
||||
|
||||
#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<int>(mButtons.size()))
|
||||
mControllerFocus = mDefaultFocus;
|
||||
for (int i = 0; i < static_cast<int>(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<int>(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<int>(mButtons.size()) - 1)
|
||||
return true;
|
||||
|
||||
setControllerFocus(mButtons, mControllerFocus, false);
|
||||
mControllerFocus = wrap(mControllerFocus + 1, mButtons.size());
|
||||
setControllerFocus(mButtons, mControllerFocus, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<int>(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<int>(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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<ESM::RefId, std::string>& left, const std::pair<ESM::RefId, std::string>& 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();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "windowbase.hpp"
|
||||
#include <components/esm/refid.hpp>
|
||||
#include <components/widgets/scrollbar.hpp>
|
||||
#include <memory>
|
||||
|
||||
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<MyGUI::Widget*> mSkillItems;
|
||||
|
|
@ -121,9 +118,6 @@ namespace MWGui
|
|||
std::unique_ptr<MyGUI::ITexture> mPreviewTexture;
|
||||
|
||||
bool mPreviewDirty;
|
||||
|
||||
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
|
||||
bool onControllerThumbstickEvent(const SDL_ControllerAxisEvent& arg) override;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<int>(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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<ESM::RefId>& skills, const std::string& titleId,
|
||||
|
|
@ -101,10 +100,6 @@ namespace MWGui
|
|||
std::vector<MyGUI::Widget*> mSkillWidgets; //< Skills and other information
|
||||
|
||||
bool mUpdateSkillArea;
|
||||
|
||||
// 0 = Name, 1 = Race, 2 = Class, 3 = BirthSign, 4 = Back, 5 = OK
|
||||
std::vector<MyGUI::Button*> mButtons;
|
||||
int mControllerFocus = 5;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
#include <components/files/conversion.hpp>
|
||||
#include <components/files/memorystream.hpp>
|
||||
#include <components/l10n/manager.hpp>
|
||||
#include <components/misc/strings/format.hpp>
|
||||
#include <components/misc/strings/lower.hpp>
|
||||
#include <components/misc/timeconvert.hpp>
|
||||
#include <components/myguiplatform/myguitexture.hpp>
|
||||
|
|
@ -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<int>(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<osgMyGUI::OSGTexture>(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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#include <components/widgets/imagebutton.hpp>
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
#include <components/settings/values.hpp>
|
||||
|
||||
#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<int>(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<int>(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<int>(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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@ namespace MWGui
|
|||
MyGUI::ScrollView* mSpellsView;
|
||||
|
||||
std::map<MyGUI::Widget*, ESM::RefId> mSpellsWidgetMap;
|
||||
/// List of enabled/purchasable spells and their index in the full list.
|
||||
std::vector<std::pair<MyGUI::Button*, int>> 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;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,13 +7,11 @@
|
|||
|
||||
#include <components/misc/resourcehelpers.hpp>
|
||||
#include <components/resource/resourcesystem.hpp>
|
||||
#include <components/settings/values.hpp>
|
||||
#include <components/widgets/list.hpp>
|
||||
|
||||
#include <components/esm3/loadgmst.hpp>
|
||||
|
||||
#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<int>(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<int>(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<int>(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<int>(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<ESM::GameSetting>()
|
||||
.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<int>(mAvailableButtons.size()))
|
||||
{
|
||||
onAvailableEffectClicked(mAvailableButtons[mAvailableFocus]);
|
||||
winMgr->playSound(ESM::RefId::stringRefId("Menu Click"));
|
||||
}
|
||||
else if (mRightColumn && mEffectFocus >= 0 && mEffectFocus < static_cast<int>(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<int>(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<int>(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<int>(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<int>(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<int>(mEffectButtons.size()))
|
||||
mEffectButtons[mEffectFocus].first->setStateSelected(false);
|
||||
if (mAvailableFocus >= 0 && mAvailableFocus < static_cast<int>(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<int>(mAvailableButtons.size()))
|
||||
mAvailableButtons[mAvailableFocus]->setStateSelected(false);
|
||||
if (mEffectFocus >= 0 && mEffectFocus < static_cast<int>(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<int>(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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
#ifndef MWGUI_SPELLCREATION_H
|
||||
#define MWGUI_SPELLCREATION_H
|
||||
|
||||
#include <SDL.h>
|
||||
#include <memory>
|
||||
|
||||
#include <components/esm3/loadmgef.hpp>
|
||||
#include <components/esm3/loadspel.hpp>
|
||||
#include <components/widgets/scrollbar.hpp>
|
||||
|
||||
#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<MyGUI::TextBox*> 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<MyGUI::Button*> mAvailableButtons;
|
||||
std::vector<std::pair<Widgets::MWSpellEffectPtr, MyGUI::Button*>> 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;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,6 @@
|
|||
#include <components/widgets/box.hpp>
|
||||
#include <components/widgets/sharedstatebutton.hpp>
|
||||
|
||||
#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<Gui::SharedStateButton>(
|
||||
|
|
@ -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<int>(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<int>(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<int>(mButtons.size()))
|
||||
{
|
||||
Gui::SharedStateButton* prev = mButtons[prevFocus].first;
|
||||
if (prev)
|
||||
prev->onMouseLostFocus(nullptr);
|
||||
}
|
||||
|
||||
if (mControllerActiveWindow && newFocus >= 0 && newFocus < static_cast<int>(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@
|
|||
#include <tuple>
|
||||
|
||||
#include <MyGUI_Widget.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include <components/widgets/sharedstatebutton.hpp>
|
||||
|
||||
#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<std::pair<Gui::SharedStateButton*, int>> mButtons;
|
||||
/// Keep a list of group offsets for controller navigation
|
||||
std::vector<int> mGroupIndices;
|
||||
|
||||
bool mControllerActiveWindow;
|
||||
int mControllerFocus;
|
||||
void updateControllerFocus(int prevFocus, int newFocus);
|
||||
|
||||
void onSpellSelected(MyGUI::Widget* _sender);
|
||||
void onMouseWheelMoved(MyGUI::Widget* _sender, int _rel);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
#include <MyGUI_EditBox.h>
|
||||
#include <MyGUI_InputManager.h>
|
||||
#include <MyGUI_RenderManager.h>
|
||||
#include <MyGUI_Window.h>
|
||||
|
||||
#include <components/esm3/loadbsgn.hpp>
|
||||
#include <components/esm3/loadrace.hpp>
|
||||
|
|
@ -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<MyGUI::Window>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<SpellIcons> mSpellIcons;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#include <MyGUI_InputManager.h>
|
||||
#include <MyGUI_LanguageManager.h>
|
||||
#include <MyGUI_ProgressBar.h>
|
||||
#include <MyGUI_RenderManager.h>
|
||||
#include <MyGUI_ScrollView.h>
|
||||
#include <MyGUI_TextIterator.h>
|
||||
#include <MyGUI_Window.h>
|
||||
|
|
@ -81,14 +80,6 @@ namespace MWGui
|
|||
MyGUI::Window* t = mMainWidget->castType<MyGUI::Window>();
|
||||
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<MyGUI::Window>();
|
||||
window->setCoord(x, active ? y : viewSize.height + 1, width, height);
|
||||
|
||||
if (active)
|
||||
onWindowResize(window);
|
||||
}
|
||||
|
||||
WindowBase::setActiveControllerWindow(active);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<ESM::RefId>& skills, const std::string& titleId,
|
||||
const std::string& titleDefault, MyGUI::IntCoord& coord1, MyGUI::IntCoord& coord2);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -168,25 +168,6 @@ namespace MWGui
|
|||
std::numeric_limits<int>::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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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<int>(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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,13 +49,9 @@ namespace MWGui
|
|||
MyGUI::Widget* mTrainingOptions;
|
||||
MyGUI::Button* mCancelButton;
|
||||
MyGUI::TextBox* mPlayerGold;
|
||||
std::vector<MyGUI::Button*> mTrainingButtons;
|
||||
|
||||
WaitDialogProgressBar mProgressBar;
|
||||
TimeAdvancer mTimeAdvancer;
|
||||
|
||||
bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) override;
|
||||
int mControllerFocus;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<int>(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<int>(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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ namespace MWGui
|
|||
MyGUI::Button* mCancelButton;
|
||||
MyGUI::TextBox* mPlayerGold;
|
||||
|
||||
std::vector<MyGUI::Button*> 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;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
#include "timeadvancer.hpp"
|
||||
#include "windowbase.hpp"
|
||||
#include <components/esm/refid.hpp>
|
||||
#include <components/widgets/scrollbar.hpp>
|
||||
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@
|
|||
#include <components/misc/resourcehelpers.hpp>
|
||||
#include <components/resource/resourcesystem.hpp>
|
||||
|
||||
#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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
|
||||
#include <components/settings/values.hpp>
|
||||
#include <components/widgets/imagebutton.hpp>
|
||||
|
||||
#include "draganddrop.hpp"
|
||||
|
|
@ -15,22 +14,6 @@
|
|||
|
||||
using namespace MWGui;
|
||||
|
||||
int MWGui::wrap(int index, int max)
|
||||
{
|
||||
if (index < 0)
|
||||
return max - 1;
|
||||
else if (index >= max)
|
||||
return 0;
|
||||
else
|
||||
return index;
|
||||
}
|
||||
|
||||
void MWGui::setControllerFocus(std::vector<MyGUI::Button*> buttons, int index, bool focused)
|
||||
{
|
||||
if (index >= 0 && index < static_cast<int>(buttons.size()))
|
||||
buttons[index]->setStateSelected(focused);
|
||||
}
|
||||
|
||||
WindowBase::WindowBase(std::string_view parLayout)
|
||||
: Layout(parLayout)
|
||||
{
|
||||
|
|
@ -139,7 +122,6 @@ void WindowModal::onOpen()
|
|||
void WindowModal::onClose()
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeCurrentModal(this);
|
||||
MWBase::Environment::get().getWindowManager()->updateControllerButtonsOverlay();
|
||||
|
||||
MyGUI::InputManager::getInstance().removeWidgetModal(mMainWidget);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef MWGUI_WINDOW_BASE_H
|
||||
#define MWGUI_WINDOW_BASE_H
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "layout.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
|
|
@ -14,28 +12,6 @@ namespace MWGui
|
|||
{
|
||||
class DragAndDrop;
|
||||
|
||||
int wrap(int index, int max);
|
||||
void setControllerFocus(std::vector<MyGUI::Button*> buttons, int index, bool selected);
|
||||
|
||||
struct ControllerButtonStr
|
||||
{
|
||||
std::string a;
|
||||
std::string b;
|
||||
std::string dpad;
|
||||
std::string l1;
|
||||
std::string l2;
|
||||
std::string l3;
|
||||
std::string lStick;
|
||||
std::string menu;
|
||||
std::string r1;
|
||||
std::string r2;
|
||||
std::string r3;
|
||||
std::string rStick;
|
||||
std::string view;
|
||||
std::string x;
|
||||
std::string y;
|
||||
};
|
||||
|
||||
class WindowBase : public Layout
|
||||
{
|
||||
public:
|
||||
|
|
@ -78,21 +54,9 @@ namespace MWGui
|
|||
|
||||
static void clampWindowCoordinates(MyGUI::Window* window);
|
||||
|
||||
virtual ControllerButtonStr* getControllerButtons() { return &mControllerButtons; }
|
||||
MyGUI::Widget* getControllerScrollWidget() { return mControllerScrollWidget; }
|
||||
bool isGamepadCursorAllowed() { return !mDisableGamepadCursor; }
|
||||
virtual bool onControllerButtonEvent(const SDL_ControllerButtonEvent& arg) { return true; }
|
||||
virtual bool onControllerThumbstickEvent(const SDL_ControllerAxisEvent& arg) { return true; }
|
||||
virtual void setActiveControllerWindow(bool active) { mActiveControllerWindow = active; }
|
||||
|
||||
protected:
|
||||
virtual void onTitleDoubleClicked();
|
||||
|
||||
ControllerButtonStr mControllerButtons;
|
||||
bool mActiveControllerWindow = false;
|
||||
bool mDisableGamepadCursor = false;
|
||||
MyGUI::Widget* mControllerScrollWidget = nullptr;
|
||||
|
||||
private:
|
||||
void onDoubleClick(MyGUI::Widget* _sender);
|
||||
|
||||
|
|
|
|||
|
|
@ -181,8 +181,6 @@ namespace MWGui
|
|||
, mPostProcessorHud(nullptr)
|
||||
, mJailScreen(nullptr)
|
||||
, mContainerWindow(nullptr)
|
||||
, mControllerButtonsOverlay(nullptr)
|
||||
, mInventoryTabsOverlay(nullptr)
|
||||
, mTranslationDataStorage(translationDataStorage)
|
||||
, mInputBlocker(nullptr)
|
||||
, mHudEnabled(true)
|
||||
|
|
@ -507,15 +505,6 @@ namespace MWGui
|
|||
mWindows.push_back(std::move(postProcessorHud));
|
||||
trackWindow(mPostProcessorHud, makePostprocessorWindowSettingValues());
|
||||
|
||||
auto controllerButtonsOverlay = std::make_unique<ControllerButtonsOverlay>();
|
||||
mControllerButtonsOverlay = controllerButtonsOverlay.get();
|
||||
mWindows.push_back(std::move(controllerButtonsOverlay));
|
||||
|
||||
auto inventoryTabsOverlay = std::make_unique<InventoryTabsOverlay>();
|
||||
mInventoryTabsOverlay = inventoryTabsOverlay.get();
|
||||
mWindows.push_back(std::move(inventoryTabsOverlay));
|
||||
mActiveControllerWindows[GM_Inventory] = 1; // Start on Inventory page
|
||||
|
||||
mInputBlocker = MyGUI::Gui::getInstance().createWidget<MyGUI::Widget>(
|
||||
{}, 0, 0, w, h, MyGUI::Align::Stretch, "InputBlocker");
|
||||
|
||||
|
|
@ -673,14 +662,6 @@ namespace MWGui
|
|||
&& !(mForceHidden & GW_Inventory) && (mAllowed & GW_Inventory));
|
||||
mSpellWindow->setVisible(
|
||||
mSpellWindow->pinned() && !isConsoleMode() && !(mForceHidden & GW_Magic) && (mAllowed & GW_Magic));
|
||||
|
||||
if (Settings::gui().mControllerMenus)
|
||||
{
|
||||
if (mControllerButtonsOverlay)
|
||||
mControllerButtonsOverlay->setVisible(false);
|
||||
if (mInventoryTabsOverlay)
|
||||
mInventoryTabsOverlay->setVisible(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (getMode() != GM_Inventory)
|
||||
|
|
@ -710,8 +691,6 @@ namespace MWGui
|
|||
mStatsWindow->setVisible(eff & GW_Stats);
|
||||
}
|
||||
|
||||
updateControllerButtonsOverlay();
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
// FIXME: refactor chargen windows to use modes properly (or not use them at all)
|
||||
|
|
@ -741,7 +720,6 @@ namespace MWGui
|
|||
return;
|
||||
dialog->setVisible(false);
|
||||
mGarbageDialogs.push_back(std::move(dialog));
|
||||
updateControllerButtonsOverlay();
|
||||
}
|
||||
|
||||
void WindowManager::exitCurrentGuiMode()
|
||||
|
|
@ -881,95 +859,6 @@ namespace MWGui
|
|||
mHud->setPlayerPos(x, y, u, v);
|
||||
}
|
||||
|
||||
WindowBase* WindowManager::getActiveControllerWindow()
|
||||
{
|
||||
if (!mCurrentModals.empty())
|
||||
return mCurrentModals.back();
|
||||
|
||||
if (isSettingsWindowVisible())
|
||||
return mSettingsWindow;
|
||||
|
||||
if (!mGuiModes.empty())
|
||||
{
|
||||
GuiMode mode = mGuiModes.back();
|
||||
GuiModeState& state = mGuiModeStates[mode];
|
||||
if (state.mWindows.size() == 0)
|
||||
return nullptr;
|
||||
|
||||
int activeIndex = std::clamp(mActiveControllerWindows[mode], 0, (int)state.mWindows.size() - 1);
|
||||
|
||||
Log(Debug::Debug) << "Getting active controller window: mode=" << mode << ", " << state.mWindows.size()
|
||||
<< " window(s), activeIndex=" << activeIndex;
|
||||
|
||||
// If the active window is no longer visible, find the next visible window.
|
||||
if (!state.mWindows[activeIndex]->isVisible())
|
||||
cycleActiveControllerWindow(true);
|
||||
|
||||
return state.mWindows[activeIndex];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void WindowManager::cycleActiveControllerWindow(bool next)
|
||||
{
|
||||
if (!Settings::gui().mControllerMenus || mGuiModes.empty())
|
||||
return;
|
||||
|
||||
GuiMode mode = mGuiModes.back();
|
||||
int winCount = mGuiModeStates[mode].mWindows.size();
|
||||
|
||||
int activeIndex = 0;
|
||||
if (winCount > 1)
|
||||
{
|
||||
// Find next/previous visible window
|
||||
activeIndex = mActiveControllerWindows[mode];
|
||||
int delta = next ? 1 : -1;
|
||||
|
||||
for (int i = 0; i < winCount; i++)
|
||||
{
|
||||
activeIndex = wrap(activeIndex + delta, winCount);
|
||||
if (mGuiModeStates[mode].mWindows[activeIndex]->isVisible())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Log(Debug::Debug) << "Cycling active controller window: mode=" << mode << ", activeIndex=" << activeIndex;
|
||||
|
||||
if (mActiveControllerWindows[mode] != activeIndex)
|
||||
setActiveControllerWindow(mode, activeIndex);
|
||||
}
|
||||
|
||||
void WindowManager::setActiveControllerWindow(GuiMode mode, int activeIndex)
|
||||
{
|
||||
if (!Settings::gui().mControllerMenus)
|
||||
return;
|
||||
|
||||
int winCount = mGuiModeStates[mode].mWindows.size();
|
||||
if (winCount == 0)
|
||||
return;
|
||||
|
||||
activeIndex = std::clamp(activeIndex, 0, winCount - 1);
|
||||
mActiveControllerWindows[mode] = activeIndex;
|
||||
|
||||
// Set active window last so inactive windows don't stomp on changes it makes, e.g. to tooltips.
|
||||
for (int i = 0; i < winCount; i++)
|
||||
{
|
||||
if (i != activeIndex)
|
||||
mGuiModeStates[mode].mWindows[i]->setActiveControllerWindow(false);
|
||||
}
|
||||
mGuiModeStates[mode].mWindows[activeIndex]->setActiveControllerWindow(true);
|
||||
|
||||
MWBase::Environment::get().getInputManager()->setGamepadGuiCursorEnabled(
|
||||
mGuiModeStates[mode].mWindows[activeIndex]->isGamepadCursorAllowed());
|
||||
|
||||
updateControllerButtonsOverlay();
|
||||
setCursorActive(false);
|
||||
|
||||
if (winCount > 1)
|
||||
playSound(ESM::RefId::stringRefId("Menu Size"));
|
||||
}
|
||||
|
||||
void WindowManager::update(float frameDuration)
|
||||
{
|
||||
handleScheduledMessageBoxes();
|
||||
|
|
@ -1033,12 +922,6 @@ namespace MWGui
|
|||
if (isSettingsWindowVisible())
|
||||
mSettingsWindow->onFrame(frameDuration);
|
||||
|
||||
if (mControllerButtonsOverlay && mControllerButtonsOverlay->isVisible())
|
||||
mControllerButtonsOverlay->onFrame(frameDuration);
|
||||
|
||||
if (mInventoryTabsOverlay && mInventoryTabsOverlay->isVisible())
|
||||
mInventoryTabsOverlay->onFrame(frameDuration);
|
||||
|
||||
if (!gameRunning)
|
||||
return;
|
||||
|
||||
|
|
@ -1410,15 +1293,6 @@ namespace MWGui
|
|||
|
||||
updateVisible();
|
||||
MWBase::Environment::get().getLuaManager()->uiModeChanged(arg);
|
||||
|
||||
if (Settings::gui().mControllerMenus)
|
||||
{
|
||||
if (mode == GM_Container)
|
||||
mActiveControllerWindows[mode] = 0; // Ensure controller focus is on container
|
||||
// Activate first visible window. This needs to be called after updateVisible.
|
||||
mActiveControllerWindows[mode] = std::max(mActiveControllerWindows[mode] - 1, -1);
|
||||
cycleActiveControllerWindow(true);
|
||||
}
|
||||
}
|
||||
|
||||
void WindowManager::setCullMask(uint32_t mask)
|
||||
|
|
@ -1473,25 +1347,6 @@ namespace MWGui
|
|||
// To make sure that console window get focus again
|
||||
if (mConsole && mConsole->isVisible())
|
||||
mConsole->onOpen();
|
||||
|
||||
if (Settings::gui().mControllerMenus)
|
||||
{
|
||||
if (mGuiModes.empty())
|
||||
setControllerTooltip(false);
|
||||
else
|
||||
{
|
||||
// Re-apply any controller-specific window changes.
|
||||
const GuiMode mode = mGuiModes.back();
|
||||
int winCount = mGuiModeStates[mode].mWindows.size();
|
||||
|
||||
for (int i = 0; i < winCount; i++)
|
||||
{
|
||||
if (i != mActiveControllerWindows[mode])
|
||||
mGuiModeStates[mode].mWindows[i]->setActiveControllerWindow(false);
|
||||
}
|
||||
mGuiModeStates[mode].mWindows[mActiveControllerWindows[mode]]->setActiveControllerWindow(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WindowManager::removeGuiMode(GuiMode mode)
|
||||
|
|
@ -1617,10 +1472,6 @@ namespace MWGui
|
|||
mConsole->executeFile(path);
|
||||
}
|
||||
|
||||
std::vector<MWGui::WindowBase*> WindowManager::getGuiModeWindows(GuiMode mode)
|
||||
{
|
||||
return mGuiModeStates[mode].mWindows;
|
||||
}
|
||||
MWGui::InventoryWindow* WindowManager::getInventoryWindow()
|
||||
{
|
||||
return mInventoryWindow;
|
||||
|
|
@ -1633,10 +1484,6 @@ namespace MWGui
|
|||
{
|
||||
return mConfirmationDialog;
|
||||
}
|
||||
MWGui::HUD* WindowManager::getHud()
|
||||
{
|
||||
return mHud;
|
||||
}
|
||||
MWGui::TradeWindow* WindowManager::getTradeWindow()
|
||||
{
|
||||
return mTradeWindow;
|
||||
|
|
@ -1920,12 +1767,6 @@ namespace MWGui
|
|||
|
||||
void WindowManager::onWindowChangeCoord(MyGUI::Window* window)
|
||||
{
|
||||
// If using controller menus, don't persist changes to size of the stats or magic
|
||||
// windows.
|
||||
if (Settings::gui().mControllerMenus
|
||||
&& (window == (MyGUI::Window*)mStatsWindow || window == (MyGUI::Window*)mSpellWindow))
|
||||
return;
|
||||
|
||||
const auto it = mTrackedWindows.find(window);
|
||||
if (it == mTrackedWindows.end())
|
||||
return;
|
||||
|
|
@ -2119,7 +1960,6 @@ namespace MWGui
|
|||
if (!window->exit())
|
||||
return;
|
||||
window->setVisible(false);
|
||||
updateControllerButtonsOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2133,8 +1973,6 @@ namespace MWGui
|
|||
|
||||
mKeyboardNavigation->setModalWindow(input->mMainWidget);
|
||||
mKeyboardNavigation->setDefaultFocus(input->mMainWidget, input->getDefaultKeyFocus());
|
||||
|
||||
updateControllerButtonsOverlay();
|
||||
}
|
||||
|
||||
void WindowManager::removeCurrentModal(WindowModal* input)
|
||||
|
|
@ -2172,16 +2010,6 @@ namespace MWGui
|
|||
|
||||
void WindowManager::updatePinnedWindows()
|
||||
{
|
||||
if (Settings::gui().mControllerMenus)
|
||||
{
|
||||
// In controller mode, don't hide any menus and only allow pinning the map.
|
||||
mInventoryWindow->setPinned(false);
|
||||
mMap->setPinned(Settings::windows().mMapPin);
|
||||
mSpellWindow->setPinned(false);
|
||||
mStatsWindow->setPinned(false);
|
||||
return;
|
||||
}
|
||||
|
||||
mInventoryWindow->setPinned(Settings::windows().mInventoryPin);
|
||||
if (Settings::windows().mInventoryHidden)
|
||||
mShown = (GuiWindow)(mShown ^ GW_Inventory);
|
||||
|
|
@ -2612,36 +2440,4 @@ namespace MWGui
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void WindowManager::setControllerTooltip(bool enabled)
|
||||
{
|
||||
if (!Settings::gui().mControllerMenus)
|
||||
return;
|
||||
|
||||
mControllerTooltip = enabled;
|
||||
}
|
||||
|
||||
void WindowManager::updateControllerButtonsOverlay()
|
||||
{
|
||||
if (!Settings::gui().mControllerMenus || !mControllerButtonsOverlay)
|
||||
return;
|
||||
|
||||
WindowBase* topWin = this->getActiveControllerWindow();
|
||||
if (!topWin || !topWin->isVisible())
|
||||
{
|
||||
mControllerButtonsOverlay->setVisible(false);
|
||||
mInventoryTabsOverlay->setVisible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// setButtons will handle setting visibility based on if any buttons are defined.
|
||||
mControllerButtonsOverlay->setButtons(topWin->getControllerButtons());
|
||||
if (getMode() == GM_Inventory)
|
||||
{
|
||||
mInventoryTabsOverlay->setVisible(true);
|
||||
mInventoryTabsOverlay->setTab(mActiveControllerWindows[GM_Inventory]);
|
||||
}
|
||||
else
|
||||
mInventoryTabsOverlay->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue