mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-18 05:42:40 +00:00
Merge pull request #2349 from akortunov/pinning
Allow to maximize windows via Shift + Double Click
This commit is contained in:
commit
632e7b973b
@ -91,6 +91,7 @@
|
|||||||
Feature #3610: Option to invert X axis
|
Feature #3610: Option to invert X axis
|
||||||
Feature #3893: Implicit target for "set" function in console
|
Feature #3893: Implicit target for "set" function in console
|
||||||
Feature #3980: In-game option to disable controller
|
Feature #3980: In-game option to disable controller
|
||||||
|
Feature #3999: Shift + Double Click should maximize/restore menu size
|
||||||
Feature #4001: Toggle sneak controller shortcut
|
Feature #4001: Toggle sneak controller shortcut
|
||||||
Feature #4209: Editor: Faction rank sub-table
|
Feature #4209: Editor: Faction rank sub-table
|
||||||
Feature #4360: Improve default controller bindings
|
Feature #4360: Improve default controller bindings
|
||||||
|
@ -322,6 +322,7 @@ namespace MWBase
|
|||||||
virtual void removeCurrentModal(MWGui::WindowModal* input) = 0;
|
virtual void removeCurrentModal(MWGui::WindowModal* input) = 0;
|
||||||
|
|
||||||
virtual void pinWindow (MWGui::GuiWindow window) = 0;
|
virtual void pinWindow (MWGui::GuiWindow window) = 0;
|
||||||
|
virtual void toggleMaximized(MWGui::Layout *layout) = 0;
|
||||||
|
|
||||||
/// Fade the screen in, over \a time seconds
|
/// Fade the screen in, over \a time seconds
|
||||||
virtual void fadeScreenIn(const float time, bool clearQueue=true, float delay=0.f) = 0;
|
virtual void fadeScreenIn(const float time, bool clearQueue=true, float delay=0.f) = 0;
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
MyGUI::VectorWidgetPtr ExposedWindow::getSkinWidgetsByName (const std::string &name)
|
MyGUI::VectorWidgetPtr Window::getSkinWidgetsByName (const std::string &name)
|
||||||
{
|
{
|
||||||
return MyGUI::Widget::getSkinWidgetsByName (name);
|
return MyGUI::Widget::getSkinWidgetsByName (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
MyGUI::Widget* ExposedWindow::getSkinWidget(const std::string & _name, bool _throw)
|
MyGUI::Widget* Window::getSkinWidget(const std::string & _name, bool _throw)
|
||||||
{
|
{
|
||||||
MyGUI::VectorWidgetPtr widgets = getSkinWidgetsByName (_name);
|
MyGUI::VectorWidgetPtr widgets = getSkinWidgetsByName (_name);
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@ namespace MWGui
|
|||||||
/**
|
/**
|
||||||
* @brief subclass to provide access to some Widget internals.
|
* @brief subclass to provide access to some Widget internals.
|
||||||
*/
|
*/
|
||||||
class ExposedWindow : public MyGUI::Window
|
class Window : public MyGUI::Window
|
||||||
{
|
{
|
||||||
MYGUI_RTTI_DERIVED(ExposedWindow)
|
MYGUI_RTTI_DERIVED(Window)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MyGUI::VectorWidgetPtr getSkinWidgetsByName (const std::string &name);
|
MyGUI::VectorWidgetPtr getSkinWidgetsByName (const std::string &name);
|
||||||
|
@ -162,28 +162,39 @@ namespace MWGui
|
|||||||
mItemView->setModel(nullptr);
|
mItemView->setModel(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InventoryWindow::toggleMaximized()
|
||||||
|
{
|
||||||
|
std::string setting = getModeSetting();
|
||||||
|
|
||||||
|
bool maximized = !Settings::Manager::getBool(setting + " maximized", "Windows");
|
||||||
|
if (maximized)
|
||||||
|
setting += " maximized";
|
||||||
|
|
||||||
|
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||||
|
float x = Settings::Manager::getFloat(setting + " x", "Windows") * float(viewSize.width);
|
||||||
|
float y = Settings::Manager::getFloat(setting + " y", "Windows") * float(viewSize.height);
|
||||||
|
float w = Settings::Manager::getFloat(setting + " w", "Windows") * float(viewSize.width);
|
||||||
|
float h = Settings::Manager::getFloat(setting + " h", "Windows") * float(viewSize.height);
|
||||||
|
MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>();
|
||||||
|
window->setCoord(x, y, w, h);
|
||||||
|
|
||||||
|
if (maximized)
|
||||||
|
Settings::Manager::setBool(setting, "Windows", maximized);
|
||||||
|
else
|
||||||
|
Settings::Manager::setBool(setting + " maximized", "Windows", maximized);
|
||||||
|
|
||||||
|
adjustPanes();
|
||||||
|
updatePreviewSize();
|
||||||
|
}
|
||||||
|
|
||||||
void InventoryWindow::setGuiMode(GuiMode mode)
|
void InventoryWindow::setGuiMode(GuiMode mode)
|
||||||
{
|
{
|
||||||
std::string setting = "inventory";
|
|
||||||
mGuiMode = mode;
|
mGuiMode = mode;
|
||||||
switch(mode) {
|
std::string setting = getModeSetting();
|
||||||
case GM_Container:
|
setPinButtonVisible(mode == GM_Inventory);
|
||||||
setPinButtonVisible(false);
|
|
||||||
setting += " container";
|
if (Settings::Manager::getBool(setting + " maximized", "Windows"))
|
||||||
break;
|
setting += " maximized";
|
||||||
case GM_Companion:
|
|
||||||
setPinButtonVisible(false);
|
|
||||||
setting += " companion";
|
|
||||||
break;
|
|
||||||
case GM_Barter:
|
|
||||||
setPinButtonVisible(false);
|
|
||||||
setting += " barter";
|
|
||||||
break;
|
|
||||||
case GM_Inventory:
|
|
||||||
default:
|
|
||||||
setPinButtonVisible(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||||
MyGUI::IntPoint pos(static_cast<int>(Settings::Manager::getFloat(setting + " x", "Windows") * viewSize.width),
|
MyGUI::IntPoint pos(static_cast<int>(Settings::Manager::getFloat(setting + " x", "Windows") * viewSize.width),
|
||||||
@ -386,11 +397,11 @@ namespace MWGui
|
|||||||
adjustPanes();
|
adjustPanes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InventoryWindow::onWindowResize(MyGUI::Window* _sender)
|
std::string InventoryWindow::getModeSetting() const
|
||||||
{
|
{
|
||||||
adjustPanes();
|
|
||||||
std::string setting = "inventory";
|
std::string setting = "inventory";
|
||||||
switch(mGuiMode) {
|
switch(mGuiMode)
|
||||||
|
{
|
||||||
case GM_Container:
|
case GM_Container:
|
||||||
setting += " container";
|
setting += " container";
|
||||||
break;
|
break;
|
||||||
@ -404,6 +415,14 @@ namespace MWGui
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return setting;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InventoryWindow::onWindowResize(MyGUI::Window* _sender)
|
||||||
|
{
|
||||||
|
adjustPanes();
|
||||||
|
std::string setting = getModeSetting();
|
||||||
|
|
||||||
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||||
float x = _sender->getPosition().left / float(viewSize.width);
|
float x = _sender->getPosition().left / float(viewSize.width);
|
||||||
float y = _sender->getPosition().top / float(viewSize.height);
|
float y = _sender->getPosition().top / float(viewSize.height);
|
||||||
@ -413,6 +432,9 @@ namespace MWGui
|
|||||||
Settings::Manager::setFloat(setting + " y", "Windows", y);
|
Settings::Manager::setFloat(setting + " y", "Windows", y);
|
||||||
Settings::Manager::setFloat(setting + " w", "Windows", w);
|
Settings::Manager::setFloat(setting + " w", "Windows", w);
|
||||||
Settings::Manager::setFloat(setting + " h", "Windows", h);
|
Settings::Manager::setFloat(setting + " h", "Windows", h);
|
||||||
|
bool maximized = Settings::Manager::getBool(setting + " maximized", "Windows");
|
||||||
|
if (maximized)
|
||||||
|
Settings::Manager::setBool(setting + " maximized", "Windows", false);
|
||||||
|
|
||||||
if (mMainWidget->getSize().width != mLastXSize || mMainWidget->getSize().height != mLastYSize)
|
if (mMainWidget->getSize().width != mLastXSize || mMainWidget->getSize().height != mLastYSize)
|
||||||
{
|
{
|
||||||
@ -476,7 +498,9 @@ namespace MWGui
|
|||||||
|
|
||||||
void InventoryWindow::onTitleDoubleClicked()
|
void InventoryWindow::onTitleDoubleClicked()
|
||||||
{
|
{
|
||||||
if (!mPinned)
|
if (MyGUI::InputManager::getInstance().isShiftPressed())
|
||||||
|
toggleMaximized();
|
||||||
|
else if (!mPinned)
|
||||||
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Inventory);
|
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Inventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,9 @@ namespace MWGui
|
|||||||
/// Cycle to previous/next weapon
|
/// Cycle to previous/next weapon
|
||||||
void cycle(bool next);
|
void cycle(bool next);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void onTitleDoubleClicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DragAndDrop* mDragAndDrop;
|
DragAndDrop* mDragAndDrop;
|
||||||
|
|
||||||
@ -104,11 +107,15 @@ namespace MWGui
|
|||||||
float mScaleFactor;
|
float mScaleFactor;
|
||||||
float mUpdateTimer;
|
float mUpdateTimer;
|
||||||
|
|
||||||
|
void toggleMaximized();
|
||||||
|
|
||||||
void onItemSelected(int index);
|
void onItemSelected(int index);
|
||||||
void onItemSelectedFromSourceModel(int index);
|
void onItemSelectedFromSourceModel(int index);
|
||||||
|
|
||||||
void onBackgroundSelected();
|
void onBackgroundSelected();
|
||||||
|
|
||||||
|
std::string getModeSetting() const;
|
||||||
|
|
||||||
void sellItem(MyGUI::Widget* sender, int count);
|
void sellItem(MyGUI::Widget* sender, int count);
|
||||||
void dragItem(MyGUI::Widget* sender, int count);
|
void dragItem(MyGUI::Widget* sender, int count);
|
||||||
|
|
||||||
@ -116,7 +123,6 @@ namespace MWGui
|
|||||||
void onFilterChanged(MyGUI::Widget* _sender);
|
void onFilterChanged(MyGUI::Widget* _sender);
|
||||||
void onAvatarClicked(MyGUI::Widget* _sender);
|
void onAvatarClicked(MyGUI::Widget* _sender);
|
||||||
void onPinToggled();
|
void onPinToggled();
|
||||||
void onTitleDoubleClicked();
|
|
||||||
|
|
||||||
void updateEncumbranceBar();
|
void updateEncumbranceBar();
|
||||||
void notifyContentChanged();
|
void notifyContentChanged();
|
||||||
|
@ -931,7 +931,9 @@ namespace MWGui
|
|||||||
|
|
||||||
void MapWindow::onTitleDoubleClicked()
|
void MapWindow::onTitleDoubleClicked()
|
||||||
{
|
{
|
||||||
if (!mPinned)
|
if (MyGUI::InputManager::getInstance().isShiftPressed())
|
||||||
|
MWBase::Environment::get().getWindowManager()->toggleMaximized(this);
|
||||||
|
else if (!mPinned)
|
||||||
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Map);
|
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,9 @@ namespace MWGui
|
|||||||
|
|
||||||
void SpellWindow::onTitleDoubleClicked()
|
void SpellWindow::onTitleDoubleClicked()
|
||||||
{
|
{
|
||||||
if (!mPinned)
|
if (MyGUI::InputManager::getInstance().isShiftPressed())
|
||||||
|
MWBase::Environment::get().getWindowManager()->toggleMaximized(this);
|
||||||
|
else if (!mPinned)
|
||||||
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Magic);
|
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Magic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <MyGUI_ScrollView.h>
|
#include <MyGUI_ScrollView.h>
|
||||||
#include <MyGUI_ProgressBar.h>
|
#include <MyGUI_ProgressBar.h>
|
||||||
#include <MyGUI_ImageBox.h>
|
#include <MyGUI_ImageBox.h>
|
||||||
|
#include <MyGUI_InputManager.h>
|
||||||
#include <MyGUI_Gui.h>
|
#include <MyGUI_Gui.h>
|
||||||
|
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
@ -652,7 +653,13 @@ namespace MWGui
|
|||||||
|
|
||||||
void StatsWindow::onTitleDoubleClicked()
|
void StatsWindow::onTitleDoubleClicked()
|
||||||
{
|
{
|
||||||
if (!mPinned)
|
if (MyGUI::InputManager::getInstance().isShiftPressed())
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager()->toggleMaximized(this);
|
||||||
|
MyGUI::Window* t = mMainWidget->castType<MyGUI::Window>();
|
||||||
|
onWindowResize(t);
|
||||||
|
}
|
||||||
|
else if (!mPinned)
|
||||||
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Stats);
|
MWBase::Environment::get().getWindowManager()->toggleVisible(GW_Stats);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "windowbase.hpp"
|
#include "windowbase.hpp"
|
||||||
|
|
||||||
|
#include <MyGUI_Button.h>
|
||||||
#include <MyGUI_InputManager.h>
|
#include <MyGUI_InputManager.h>
|
||||||
#include <MyGUI_RenderManager.h>
|
#include <MyGUI_RenderManager.h>
|
||||||
|
|
||||||
@ -9,6 +10,7 @@
|
|||||||
#include <components/widgets/imagebutton.hpp>
|
#include <components/widgets/imagebutton.hpp>
|
||||||
|
|
||||||
#include "draganddrop.hpp"
|
#include "draganddrop.hpp"
|
||||||
|
#include "exposedwindow.hpp"
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
|
|
||||||
@ -16,6 +18,32 @@ WindowBase::WindowBase(const std::string& parLayout)
|
|||||||
: Layout(parLayout)
|
: Layout(parLayout)
|
||||||
{
|
{
|
||||||
mMainWidget->setVisible(false);
|
mMainWidget->setVisible(false);
|
||||||
|
|
||||||
|
Window* window = mMainWidget->castType<Window>(false);
|
||||||
|
if (!window)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MyGUI::Button* button = nullptr;
|
||||||
|
MyGUI::VectorWidgetPtr widgets = window->getSkinWidgetsByName("Action");
|
||||||
|
for (MyGUI::Widget* widget : widgets)
|
||||||
|
{
|
||||||
|
if (widget->isUserString("SupportDoubleClick"))
|
||||||
|
button = widget->castType<MyGUI::Button>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (button)
|
||||||
|
button->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &WindowBase::onDoubleClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowBase::onTitleDoubleClicked()
|
||||||
|
{
|
||||||
|
if (MyGUI::InputManager::getInstance().isShiftPressed())
|
||||||
|
MWBase::Environment::get().getWindowManager()->toggleMaximized(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowBase::onDoubleClick(MyGUI::Widget *_sender)
|
||||||
|
{
|
||||||
|
onTitleDoubleClicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowBase::setVisible(bool visible)
|
void WindowBase::setVisible(bool visible)
|
||||||
|
@ -20,7 +20,7 @@ namespace MWGui
|
|||||||
|
|
||||||
class WindowBase: public Layout
|
class WindowBase: public Layout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WindowBase(const std::string& parLayout);
|
WindowBase(const std::string& parLayout);
|
||||||
|
|
||||||
virtual MyGUI::Widget* getDefaultKeyFocus() { return nullptr; }
|
virtual MyGUI::Widget* getDefaultKeyFocus() { return nullptr; }
|
||||||
@ -52,8 +52,13 @@ namespace MWGui
|
|||||||
|
|
||||||
/// Called when GUI viewport changes size
|
/// Called when GUI viewport changes size
|
||||||
virtual void onResChange(int width, int height) {}
|
virtual void onResChange(int width, int height) {}
|
||||||
};
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void onTitleDoubleClicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void onDoubleClick(MyGUI::Widget* _sender);
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "Modal" windows cause the rest of the interface to be inaccessible while they are visible
|
* "Modal" windows cause the rest of the interface to be inaccessible while they are visible
|
||||||
|
@ -216,7 +216,7 @@ namespace MWGui
|
|||||||
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWEffectList>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWEffectList>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWSpellEffect>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWSpellEffect>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWDynamicStat>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWDynamicStat>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::ExposedWindow>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Window>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWScrollBar>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWScrollBar>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<VideoWidget>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<VideoWidget>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<BackgroundImage>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<BackgroundImage>("Widget");
|
||||||
@ -1235,10 +1235,14 @@ namespace MWGui
|
|||||||
|
|
||||||
for (std::map<MyGUI::Window*, std::string>::iterator it = mTrackedWindows.begin(); it != mTrackedWindows.end(); ++it)
|
for (std::map<MyGUI::Window*, std::string>::iterator it = mTrackedWindows.begin(); it != mTrackedWindows.end(); ++it)
|
||||||
{
|
{
|
||||||
MyGUI::IntPoint pos(static_cast<int>(Settings::Manager::getFloat(it->second + " x", "Windows") * x),
|
std::string settingName = it->second;
|
||||||
static_cast<int>( Settings::Manager::getFloat(it->second+ " y", "Windows") * y));
|
if (Settings::Manager::getBool(settingName + " maximized", "Windows"))
|
||||||
MyGUI::IntSize size(static_cast<int>(Settings::Manager::getFloat(it->second + " w", "Windows") * x),
|
settingName += " maximized";
|
||||||
static_cast<int>(Settings::Manager::getFloat(it->second + " h", "Windows") * y));
|
|
||||||
|
MyGUI::IntPoint pos(static_cast<int>(Settings::Manager::getFloat(settingName + " x", "Windows") * x),
|
||||||
|
static_cast<int>(Settings::Manager::getFloat(settingName + " y", "Windows") * y));
|
||||||
|
MyGUI::IntSize size(static_cast<int>(Settings::Manager::getFloat(settingName + " w", "Windows") * x),
|
||||||
|
static_cast<int>(Settings::Manager::getFloat(settingName + " h", "Windows") * y));
|
||||||
it->first->setPosition(pos);
|
it->first->setPosition(pos);
|
||||||
it->first->setSize(size);
|
it->first->setSize(size);
|
||||||
}
|
}
|
||||||
@ -1709,11 +1713,16 @@ namespace MWGui
|
|||||||
|
|
||||||
void WindowManager::trackWindow(Layout *layout, const std::string &name)
|
void WindowManager::trackWindow(Layout *layout, const std::string &name)
|
||||||
{
|
{
|
||||||
|
std::string settingName = name;
|
||||||
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||||
MyGUI::IntPoint pos(static_cast<int>(Settings::Manager::getFloat(name + " x", "Windows") * viewSize.width),
|
bool isMaximized = Settings::Manager::getBool(name + " maximized", "Windows");
|
||||||
static_cast<int>(Settings::Manager::getFloat(name + " y", "Windows") * viewSize.height));
|
if (isMaximized)
|
||||||
MyGUI::IntSize size (static_cast<int>(Settings::Manager::getFloat(name + " w", "Windows") * viewSize.width),
|
settingName += " maximized";
|
||||||
static_cast<int>(Settings::Manager::getFloat(name + " h", "Windows") * viewSize.height));
|
|
||||||
|
MyGUI::IntPoint pos(static_cast<int>(Settings::Manager::getFloat(settingName + " x", "Windows") * viewSize.width),
|
||||||
|
static_cast<int>(Settings::Manager::getFloat(settingName + " y", "Windows") * viewSize.height));
|
||||||
|
MyGUI::IntSize size (static_cast<int>(Settings::Manager::getFloat(settingName + " w", "Windows") * viewSize.width),
|
||||||
|
static_cast<int>(Settings::Manager::getFloat(settingName + " h", "Windows") * viewSize.height));
|
||||||
layout->mMainWidget->setPosition(pos);
|
layout->mMainWidget->setPosition(pos);
|
||||||
layout->mMainWidget->setSize(size);
|
layout->mMainWidget->setSize(size);
|
||||||
|
|
||||||
@ -1722,6 +1731,26 @@ namespace MWGui
|
|||||||
mTrackedWindows[window] = name;
|
mTrackedWindows[window] = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::toggleMaximized(Layout *layout)
|
||||||
|
{
|
||||||
|
MyGUI::Window* window = layout->mMainWidget->castType<MyGUI::Window>();
|
||||||
|
std::string setting = mTrackedWindows[window];
|
||||||
|
if (setting.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool maximized = !Settings::Manager::getBool(setting + " maximized", "Windows");
|
||||||
|
if (maximized)
|
||||||
|
setting += " maximized";
|
||||||
|
|
||||||
|
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||||
|
float x = Settings::Manager::getFloat(setting + " x", "Windows") * float(viewSize.width);
|
||||||
|
float y = Settings::Manager::getFloat(setting + " y", "Windows") * float(viewSize.height);
|
||||||
|
float w = Settings::Manager::getFloat(setting + " w", "Windows") * float(viewSize.width);
|
||||||
|
float h = Settings::Manager::getFloat(setting + " h", "Windows") * float(viewSize.height);
|
||||||
|
window->setCoord(x, y, w, h);
|
||||||
|
Settings::Manager::setBool(mTrackedWindows[window] + " maximized", "Windows", maximized);
|
||||||
|
}
|
||||||
|
|
||||||
void WindowManager::onWindowChangeCoord(MyGUI::Window *_sender)
|
void WindowManager::onWindowChangeCoord(MyGUI::Window *_sender)
|
||||||
{
|
{
|
||||||
std::string setting = mTrackedWindows[_sender];
|
std::string setting = mTrackedWindows[_sender];
|
||||||
@ -1734,6 +1763,9 @@ namespace MWGui
|
|||||||
Settings::Manager::setFloat(setting + " y", "Windows", y);
|
Settings::Manager::setFloat(setting + " y", "Windows", y);
|
||||||
Settings::Manager::setFloat(setting + " w", "Windows", w);
|
Settings::Manager::setFloat(setting + " w", "Windows", w);
|
||||||
Settings::Manager::setFloat(setting + " h", "Windows", h);
|
Settings::Manager::setFloat(setting + " h", "Windows", h);
|
||||||
|
bool maximized = Settings::Manager::getBool(setting + " maximized", "Windows");
|
||||||
|
if (maximized)
|
||||||
|
Settings::Manager::setBool(setting + " maximized", "Windows", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::clear()
|
void WindowManager::clear()
|
||||||
|
@ -350,6 +350,7 @@ namespace MWGui
|
|||||||
virtual void removeCurrentModal(WindowModal* input);
|
virtual void removeCurrentModal(WindowModal* input);
|
||||||
|
|
||||||
virtual void pinWindow (MWGui::GuiWindow window);
|
virtual void pinWindow (MWGui::GuiWindow window);
|
||||||
|
virtual void toggleMaximized(Layout *layout);
|
||||||
|
|
||||||
/// Fade the screen in, over \a time seconds
|
/// Fade the screen in, over \a time seconds
|
||||||
virtual void fadeScreenIn(const float time, bool clearQueue, float delay);
|
virtual void fadeScreenIn(const float time, bool clearQueue, float delay);
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "windowpinnablebase.hpp"
|
#include "windowpinnablebase.hpp"
|
||||||
|
|
||||||
#include <MyGUI_Button.h>
|
|
||||||
|
|
||||||
#include "exposedwindow.hpp"
|
#include "exposedwindow.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
@ -9,21 +7,10 @@ namespace MWGui
|
|||||||
WindowPinnableBase::WindowPinnableBase(const std::string& parLayout)
|
WindowPinnableBase::WindowPinnableBase(const std::string& parLayout)
|
||||||
: WindowBase(parLayout), mPinned(false)
|
: WindowBase(parLayout), mPinned(false)
|
||||||
{
|
{
|
||||||
ExposedWindow* window = mMainWidget->castType<ExposedWindow>();
|
Window* window = mMainWidget->castType<Window>();
|
||||||
mPinButton = window->getSkinWidget ("Button");
|
mPinButton = window->getSkinWidget ("Button");
|
||||||
|
|
||||||
mPinButton->eventMouseButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onPinButtonPressed);
|
mPinButton->eventMouseButtonPressed += MyGUI::newDelegate(this, &WindowPinnableBase::onPinButtonPressed);
|
||||||
|
|
||||||
MyGUI::Button* button = nullptr;
|
|
||||||
MyGUI::VectorWidgetPtr widgets = window->getSkinWidgetsByName("Action");
|
|
||||||
for (MyGUI::Widget* widget : widgets)
|
|
||||||
{
|
|
||||||
if (widget->isUserString("HideWindowOnDoubleClick"))
|
|
||||||
button = widget->castType<MyGUI::Button>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (button)
|
|
||||||
button->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &WindowPinnableBase::onDoubleClick);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowPinnableBase::onPinButtonPressed(MyGUI::Widget* _sender, int left, int top, MyGUI::MouseButton id)
|
void WindowPinnableBase::onPinButtonPressed(MyGUI::Widget* _sender, int left, int top, MyGUI::MouseButton id)
|
||||||
@ -41,11 +28,6 @@ namespace MWGui
|
|||||||
onPinToggled();
|
onPinToggled();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowPinnableBase::onDoubleClick(MyGUI::Widget *_sender)
|
|
||||||
{
|
|
||||||
onTitleDoubleClicked();
|
|
||||||
}
|
|
||||||
|
|
||||||
void WindowPinnableBase::setPinned(bool pinned)
|
void WindowPinnableBase::setPinned(bool pinned)
|
||||||
{
|
{
|
||||||
if (pinned != mPinned)
|
if (pinned != mPinned)
|
||||||
|
@ -17,11 +17,9 @@ namespace MWGui
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void onPinButtonPressed(MyGUI::Widget* _sender, int left, int top, MyGUI::MouseButton id);
|
void onPinButtonPressed(MyGUI::Widget* _sender, int left, int top, MyGUI::MouseButton id);
|
||||||
void onDoubleClick(MyGUI::Widget* _sender);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void onPinToggled() = 0;
|
virtual void onPinToggled() = 0;
|
||||||
virtual void onTitleDoubleClicked() = 0;
|
|
||||||
|
|
||||||
MyGUI::Widget* mPinButton;
|
MyGUI::Widget* mPinButton;
|
||||||
bool mPinned;
|
bool mPinned;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<MyGUI type="Layout">
|
<MyGUI type="Layout">
|
||||||
<Widget type="ExposedWindow" skin="MW_Window_Pinnable" layer="Windows" position="0 0 600 300" name="_Main">
|
<Widget type="Window" skin="MW_Window_Pinnable" layer="Windows" position="0 0 600 300" name="_Main">
|
||||||
<Property key="MinSize" value="40 40"/>
|
<Property key="MinSize" value="40 40"/>
|
||||||
|
|
||||||
<Widget type="Widget" skin="" position="0 0 224 223" align="Left Top" name="LeftPane">
|
<Widget type="Widget" skin="" position="0 0 224 223" align="Left Top" name="LeftPane">
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<MyGUI type="Layout">
|
<MyGUI type="Layout">
|
||||||
<Widget type="ExposedWindow" skin="MW_Window_Pinnable" layer="Windows" position="0 0 300 300" name="_Main">
|
<Widget type="Window" skin="MW_Window_Pinnable" layer="Windows" position="0 0 300 300" name="_Main">
|
||||||
<Property key="MinSize" value="40 40"/>
|
<Property key="MinSize" value="40 40"/>
|
||||||
|
|
||||||
<!-- Local map -->
|
<!-- Local map -->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<MyGUI type="Layout">
|
<MyGUI type="Layout">
|
||||||
<Widget type="ExposedWindow" skin="MW_Window_Pinnable" layer="Windows" position="0 0 300 600" name="_Main">
|
<Widget type="Window" skin="MW_Window_Pinnable" layer="Windows" position="0 0 300 600" name="_Main">
|
||||||
<Property key="MinSize" value="40 40"/>
|
<Property key="MinSize" value="40 40"/>
|
||||||
|
|
||||||
<!-- Effect box-->
|
<!-- Effect box-->
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<MyGUI type="Layout">
|
<MyGUI type="Layout">
|
||||||
<Widget type="ExposedWindow" skin="MW_Window_Pinnable" layer="Windows" position="0 0 500 342" name="_Main">
|
<Widget type="Window" skin="MW_Window_Pinnable" layer="Windows" position="0 0 500 342" name="_Main">
|
||||||
<Property key="MinSize" value="40 40"/>
|
<Property key="MinSize" value="40 40"/>
|
||||||
|
|
||||||
<Widget type="Widget" skin="" name="LeftPane" position="0 0 220 342">
|
<Widget type="Widget" skin="" name="LeftPane" position="0 0 220 342">
|
||||||
|
@ -589,6 +589,7 @@
|
|||||||
<!-- This invisible button makes it possible to move the
|
<!-- This invisible button makes it possible to move the
|
||||||
window by dragging the caption. -->
|
window by dragging the caption. -->
|
||||||
<Child type="Button" offset="4 4 248 20" align="HStretch Top" name="Action">
|
<Child type="Button" offset="4 4 248 20" align="HStretch Top" name="Action">
|
||||||
|
<Property key="SupportDoubleClick" value="1"/>
|
||||||
<Property key="Scale" value="1 1 0 0"/>
|
<Property key="Scale" value="1 1 0 0"/>
|
||||||
</Child>
|
</Child>
|
||||||
</Resource>
|
</Resource>
|
||||||
@ -725,6 +726,7 @@
|
|||||||
<!-- This invisible button makes it possible to move the
|
<!-- This invisible button makes it possible to move the
|
||||||
window by dragging the caption. -->
|
window by dragging the caption. -->
|
||||||
<Child type="Button" offset="4 4 248 20" align="HStretch Top" name="Action">
|
<Child type="Button" offset="4 4 248 20" align="HStretch Top" name="Action">
|
||||||
|
<Property key="SupportDoubleClick" value="1"/>
|
||||||
<Property key="Scale" value="1 1 0 0"/>
|
<Property key="Scale" value="1 1 0 0"/>
|
||||||
</Child>
|
</Child>
|
||||||
</Resource>
|
</Resource>
|
||||||
@ -860,8 +862,8 @@
|
|||||||
<!-- This invisible button makes it possible to move the
|
<!-- This invisible button makes it possible to move the
|
||||||
window by dragging the caption. -->
|
window by dragging the caption. -->
|
||||||
<Child type="Button" offset="4 4 248 20" align="HStretch Top" name="Action">
|
<Child type="Button" offset="4 4 248 20" align="HStretch Top" name="Action">
|
||||||
|
<Property key="SupportDoubleClick" value="1"/>
|
||||||
<Property key="Scale" value="1 1 0 0"/>
|
<Property key="Scale" value="1 1 0 0"/>
|
||||||
<Property key="HideWindowOnDoubleClick" value="1"/>
|
|
||||||
</Child>
|
</Child>
|
||||||
|
|
||||||
<Child type="Button" skin="PinUp" offset="232 4 19 19" align="Right Top" name="Button"/>
|
<Child type="Button" skin="PinUp" offset="232 4 19 19" align="Right Top" name="Button"/>
|
||||||
|
@ -484,86 +484,151 @@ stats x = 0.015
|
|||||||
stats y = 0.015
|
stats y = 0.015
|
||||||
stats w = 0.4275
|
stats w = 0.4275
|
||||||
stats h = 0.45
|
stats h = 0.45
|
||||||
|
stats maximized x = 0.0
|
||||||
|
stats maximized y = 0.0
|
||||||
|
stats maximized w = 1.0
|
||||||
|
stats maximized h = 1.0
|
||||||
stats pin = false
|
stats pin = false
|
||||||
stats hidden = false
|
stats hidden = false
|
||||||
|
stats maximized = false
|
||||||
|
|
||||||
# Spells window displaying powers, spells, and magical items.
|
# Spells window displaying powers, spells, and magical items.
|
||||||
spells x = 0.63
|
spells x = 0.63
|
||||||
spells y = 0.39
|
spells y = 0.39
|
||||||
spells w = 0.36
|
spells w = 0.36
|
||||||
spells h = 0.51
|
spells h = 0.51
|
||||||
|
spells maximized x = 0.0
|
||||||
|
spells maximized y = 0.0
|
||||||
|
spells maximized w = 1.0
|
||||||
|
spells maximized h = 1.0
|
||||||
spells pin = false
|
spells pin = false
|
||||||
spells hidden = false
|
spells hidden = false
|
||||||
|
spells maximized = false
|
||||||
|
|
||||||
# Local and world map window.
|
# Local and world map window.
|
||||||
map x = 0.63
|
map x = 0.63
|
||||||
map y = 0.015
|
map y = 0.015
|
||||||
map w = 0.36
|
map w = 0.36
|
||||||
map h = 0.37
|
map h = 0.37
|
||||||
|
map maximized x = 0.0
|
||||||
|
map maximized y = 0.0
|
||||||
|
map maximized w = 1.0
|
||||||
|
map maximized h = 1.0
|
||||||
map pin = false
|
map pin = false
|
||||||
map hidden = false
|
map hidden = false
|
||||||
|
map maximized = false
|
||||||
|
|
||||||
# Player inventory window when explicitly opened.
|
# Player inventory window when explicitly opened.
|
||||||
inventory x = 0.015
|
inventory x = 0.0
|
||||||
inventory y = 0.54
|
inventory y = 0.54
|
||||||
inventory w = 0.45
|
inventory w = 0.45
|
||||||
inventory h = 0.38
|
inventory h = 0.38
|
||||||
|
inventory maximized x = 0.0
|
||||||
|
inventory maximized y = 0.0
|
||||||
|
inventory maximized w = 1.0
|
||||||
|
inventory maximized h = 1.0
|
||||||
inventory pin = false
|
inventory pin = false
|
||||||
inventory hidden = false
|
inventory hidden = false
|
||||||
|
inventory maximized = false
|
||||||
# Dialog window for talking with NPCs.
|
|
||||||
dialogue x = 0.15
|
|
||||||
dialogue y = 0.5
|
|
||||||
dialogue w = 0.7
|
|
||||||
dialogue h = 0.45
|
|
||||||
|
|
||||||
# Alchemy window for crafting potions.
|
|
||||||
alchemy x = 0.25
|
|
||||||
alchemy y = 0.25
|
|
||||||
alchemy w = 0.5
|
|
||||||
alchemy h = 0.5
|
|
||||||
|
|
||||||
# Console command window for debugging commands.
|
|
||||||
console x = 0.015
|
|
||||||
console y = 0.015
|
|
||||||
console w = 1.0
|
|
||||||
console h = 0.5
|
|
||||||
|
|
||||||
# Player inventory window when searching a container.
|
# Player inventory window when searching a container.
|
||||||
inventory container x = 0.015
|
inventory container x = 0.015
|
||||||
inventory container y = 0.54
|
inventory container y = 0.54
|
||||||
inventory container w = 0.45
|
inventory container w = 0.45
|
||||||
inventory container h = 0.38
|
inventory container h = 0.38
|
||||||
|
inventory container maximized x = 0.0
|
||||||
|
inventory container maximized y = 0.5
|
||||||
|
inventory container maximized w = 1.0
|
||||||
|
inventory container maximized h = 0.5
|
||||||
|
inventory container maximized = false
|
||||||
|
|
||||||
# Player inventory window when bartering with a shopkeeper.
|
# Player inventory window when bartering with a shopkeeper.
|
||||||
inventory barter x = 0.015
|
inventory barter x = 0.015
|
||||||
inventory barter y = 0.54
|
inventory barter y = 0.54
|
||||||
inventory barter w = 0.45
|
inventory barter w = 0.45
|
||||||
inventory barter h = 0.38
|
inventory barter h = 0.38
|
||||||
|
inventory barter maximized x = 0.0
|
||||||
|
inventory barter maximized y = 0.5
|
||||||
|
inventory barter maximized w = 1.0
|
||||||
|
inventory barter maximized h = 0.5
|
||||||
|
inventory barter maximized = false
|
||||||
|
|
||||||
# Player inventory window when trading with a companion.
|
# Player inventory window when trading with a companion.
|
||||||
inventory companion x = 0.015
|
inventory companion x = 0.015
|
||||||
inventory companion y = 0.54
|
inventory companion y = 0.54
|
||||||
inventory companion w = 0.45
|
inventory companion w = 0.45
|
||||||
inventory companion h = 0.38
|
inventory companion h = 0.38
|
||||||
|
inventory companion maximized x = 0.0
|
||||||
|
inventory companion maximized y = 0.5
|
||||||
|
inventory companion maximized w = 1.0
|
||||||
|
inventory companion maximized h = 0.5
|
||||||
|
inventory companion maximized = false
|
||||||
|
|
||||||
|
# Dialog window for talking with NPCs.
|
||||||
|
dialogue x = 0.15
|
||||||
|
dialogue y = 0.5
|
||||||
|
dialogue w = 0.7
|
||||||
|
dialogue h = 0.45
|
||||||
|
dialogue maximized x = 0.0
|
||||||
|
dialogue maximized y = 0.0
|
||||||
|
dialogue maximized w = 1.0
|
||||||
|
dialogue maximized h = 1.0
|
||||||
|
dialogue maximized = false
|
||||||
|
|
||||||
|
# Alchemy window for crafting potions.
|
||||||
|
alchemy x = 0.25
|
||||||
|
alchemy y = 0.25
|
||||||
|
alchemy w = 0.5
|
||||||
|
alchemy h = 0.5
|
||||||
|
alchemy maximized x = 0.0
|
||||||
|
alchemy maximized y = 0.0
|
||||||
|
alchemy maximized w = 1.0
|
||||||
|
alchemy maximized h = 1.0
|
||||||
|
alchemy maximized = false
|
||||||
|
|
||||||
|
# Console command window for debugging commands.
|
||||||
|
console x = 0.015
|
||||||
|
console y = 0.015
|
||||||
|
console w = 1.0
|
||||||
|
console h = 0.5
|
||||||
|
console maximized x = 0.0
|
||||||
|
console maximized y = 0.0
|
||||||
|
console maximized w = 1.0
|
||||||
|
console maximized h = 1.0
|
||||||
|
console maximized = false
|
||||||
|
|
||||||
# Container inventory when searching a container.
|
# Container inventory when searching a container.
|
||||||
container x = 0.49
|
container x = 0.49
|
||||||
container y = 0.54
|
container y = 0.54
|
||||||
container w = 0.39
|
container w = 0.39
|
||||||
container h = 0.38
|
container h = 0.38
|
||||||
|
container maximized x = 0.0
|
||||||
|
container maximized y = 0.0
|
||||||
|
container maximized w = 1.0
|
||||||
|
container maximized h = 0.5
|
||||||
|
container maximized = false
|
||||||
|
|
||||||
# NPC inventory window when bartering with a shopkeeper.
|
# NPC inventory window when bartering with a shopkeeper.
|
||||||
barter x = 0.6
|
barter x = 0.6
|
||||||
barter y = 0.27
|
barter y = 0.27
|
||||||
barter w = 0.38
|
barter w = 0.38
|
||||||
barter h = 0.63
|
barter h = 0.63
|
||||||
|
barter maximized x = 0.0
|
||||||
|
barter maximized y = 0.0
|
||||||
|
barter maximized w = 1.0
|
||||||
|
barter maximized h = 0.5
|
||||||
|
barter maximized = false
|
||||||
|
|
||||||
# NPC inventory window when trading with a companion.
|
# NPC inventory window when trading with a companion.
|
||||||
companion x = 0.6
|
companion x = 0.6
|
||||||
companion y = 0.27
|
companion y = 0.27
|
||||||
companion w = 0.38
|
companion w = 0.38
|
||||||
companion h = 0.63
|
companion h = 0.63
|
||||||
|
companion maximized x = 0.0
|
||||||
|
companion maximized y = 0.0
|
||||||
|
companion maximized w = 1.0
|
||||||
|
companion maximized h = 0.5
|
||||||
|
companion maximized = false
|
||||||
|
|
||||||
[Navigator]
|
[Navigator]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user