mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
added tooltip delay option
This commit is contained in:
parent
14f4f09f83
commit
6014a90002
7 changed files with 64 additions and 0 deletions
|
@ -37,6 +37,7 @@ namespace MWGui
|
||||||
getWidget(mOkButton, "OkButton");
|
getWidget(mOkButton, "OkButton");
|
||||||
getWidget(mResolutionList, "ResolutionList");
|
getWidget(mResolutionList, "ResolutionList");
|
||||||
getWidget(mMenuTransparencySlider, "MenuTransparencySlider");
|
getWidget(mMenuTransparencySlider, "MenuTransparencySlider");
|
||||||
|
getWidget(mToolTipDelaySlider, "ToolTipDelaySlider");
|
||||||
getWidget(mViewDistanceSlider, "ViewDistanceSlider");
|
getWidget(mViewDistanceSlider, "ViewDistanceSlider");
|
||||||
getWidget(mFullscreenButton, "FullscreenButton");
|
getWidget(mFullscreenButton, "FullscreenButton");
|
||||||
getWidget(mVSyncButton, "VSyncButton");
|
getWidget(mVSyncButton, "VSyncButton");
|
||||||
|
@ -52,6 +53,7 @@ namespace MWGui
|
||||||
mVSyncButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
|
mVSyncButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onButtonToggled);
|
||||||
mFPSButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onFpsToggled);
|
mFPSButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SettingsWindow::onFpsToggled);
|
||||||
mMenuTransparencySlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
|
mMenuTransparencySlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
|
||||||
|
mToolTipDelaySlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
|
||||||
mViewDistanceSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
|
mViewDistanceSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onSliderChangePosition);
|
||||||
mResolutionList->eventListChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onResolutionSelected);
|
mResolutionList->eventListChangePosition += MyGUI::newDelegate(this, &SettingsWindow::onResolutionSelected);
|
||||||
|
|
||||||
|
@ -79,6 +81,8 @@ namespace MWGui
|
||||||
// read settings
|
// read settings
|
||||||
int menu_transparency = (mMenuTransparencySlider->getScrollRange()-1) * Settings::Manager::getFloat("menu transparency", "GUI");
|
int menu_transparency = (mMenuTransparencySlider->getScrollRange()-1) * Settings::Manager::getFloat("menu transparency", "GUI");
|
||||||
mMenuTransparencySlider->setScrollPosition(menu_transparency);
|
mMenuTransparencySlider->setScrollPosition(menu_transparency);
|
||||||
|
int tooltip_delay = (mToolTipDelaySlider->getScrollRange()-1) * Settings::Manager::getFloat("tooltip delay", "GUI");
|
||||||
|
mToolTipDelaySlider->setScrollPosition(tooltip_delay);
|
||||||
|
|
||||||
float val = (Settings::Manager::getFloat("max viewing distance", "Viewing distance")-2000)/(5600-2000);
|
float val = (Settings::Manager::getFloat("max viewing distance", "Viewing distance")-2000)/(5600-2000);
|
||||||
int viewdist = (mViewDistanceSlider->getScrollRange()-1) * val;
|
int viewdist = (mViewDistanceSlider->getScrollRange()-1) * val;
|
||||||
|
@ -170,6 +174,8 @@ namespace MWGui
|
||||||
float val = pos / float(scroller->getScrollRange()-1);
|
float val = pos / float(scroller->getScrollRange()-1);
|
||||||
if (scroller == mMenuTransparencySlider)
|
if (scroller == mMenuTransparencySlider)
|
||||||
Settings::Manager::setFloat("menu transparency", "GUI", val);
|
Settings::Manager::setFloat("menu transparency", "GUI", val);
|
||||||
|
else if (scroller == mToolTipDelaySlider)
|
||||||
|
Settings::Manager::setFloat("tooltip delay", "GUI", val);
|
||||||
else if (scroller == mViewDistanceSlider)
|
else if (scroller == mViewDistanceSlider)
|
||||||
Settings::Manager::setFloat("max viewing distance", "Viewing distance", (1-val) * 2000 + val * 5600);
|
Settings::Manager::setFloat("max viewing distance", "Viewing distance", (1-val) * 2000 + val * 5600);
|
||||||
else if (scroller == mMasterVolumeSlider)
|
else if (scroller == mMasterVolumeSlider)
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace MWGui
|
||||||
MyGUI::Button* mOkButton;
|
MyGUI::Button* mOkButton;
|
||||||
|
|
||||||
MyGUI::ScrollBar* mMenuTransparencySlider;
|
MyGUI::ScrollBar* mMenuTransparencySlider;
|
||||||
|
MyGUI::ScrollBar* mToolTipDelaySlider;
|
||||||
|
|
||||||
// graphics
|
// graphics
|
||||||
MyGUI::ListBox* mResolutionList;
|
MyGUI::ListBox* mResolutionList;
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
#include <components/settings/settings.hpp>
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
using namespace MyGUI;
|
using namespace MyGUI;
|
||||||
|
|
||||||
|
@ -19,6 +21,10 @@ ToolTips::ToolTips(WindowManager* windowManager) :
|
||||||
, mEnabled(true)
|
, mEnabled(true)
|
||||||
, mFocusToolTipX(0.0)
|
, mFocusToolTipX(0.0)
|
||||||
, mFocusToolTipY(0.0)
|
, mFocusToolTipY(0.0)
|
||||||
|
, mDelay(0.0)
|
||||||
|
, mRemainingDelay(0.0)
|
||||||
|
, mLastMouseX(0)
|
||||||
|
, mLastMouseY(0)
|
||||||
{
|
{
|
||||||
getWidget(mDynamicToolTipBox, "DynamicToolTipBox");
|
getWidget(mDynamicToolTipBox, "DynamicToolTipBox");
|
||||||
|
|
||||||
|
@ -28,6 +34,9 @@ ToolTips::ToolTips(WindowManager* windowManager) :
|
||||||
// even if the mouse is over the tooltip
|
// even if the mouse is over the tooltip
|
||||||
mDynamicToolTipBox->setNeedMouseFocus(false);
|
mDynamicToolTipBox->setNeedMouseFocus(false);
|
||||||
mMainWidget->setNeedMouseFocus(false);
|
mMainWidget->setNeedMouseFocus(false);
|
||||||
|
|
||||||
|
mDelay = Settings::Manager::getFloat("tooltip delay", "GUI");
|
||||||
|
mRemainingDelay = mDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolTips::setEnabled(bool enabled)
|
void ToolTips::setEnabled(bool enabled)
|
||||||
|
@ -57,6 +66,21 @@ void ToolTips::onFrame(float frameDuration)
|
||||||
|
|
||||||
if (!mGameMode)
|
if (!mGameMode)
|
||||||
{
|
{
|
||||||
|
const MyGUI::IntPoint& mousePos = InputManager::getInstance().getMousePosition();
|
||||||
|
if (mousePos.left == mLastMouseX && mousePos.top == mLastMouseY)
|
||||||
|
{
|
||||||
|
mRemainingDelay -= frameDuration;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mRemainingDelay = mDelay;
|
||||||
|
}
|
||||||
|
mLastMouseX = mousePos.left;
|
||||||
|
mLastMouseY = mousePos.top;
|
||||||
|
|
||||||
|
if (mRemainingDelay > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
Widget* focus = InputManager::getInstance().getMouseFocusWidget();
|
Widget* focus = InputManager::getInstance().getMouseFocusWidget();
|
||||||
if (focus == 0)
|
if (focus == 0)
|
||||||
{
|
{
|
||||||
|
@ -621,3 +645,9 @@ void ToolTips::createClassToolTip(MyGUI::Widget* widget, const ESM::Class& playe
|
||||||
widget->setUserString("ToolTipType", "Layout");
|
widget->setUserString("ToolTipType", "Layout");
|
||||||
widget->setUserString("ToolTipLayout", "ClassToolTip");
|
widget->setUserString("ToolTipLayout", "ClassToolTip");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ToolTips::setDelay(float delay)
|
||||||
|
{
|
||||||
|
mDelay = delay;
|
||||||
|
mRemainingDelay = mDelay;
|
||||||
|
}
|
||||||
|
|
|
@ -41,6 +41,8 @@ namespace MWGui
|
||||||
void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
void toggleFullHelp(); ///< show extra info in item tooltips (owner, script)
|
||||||
bool getFullHelp() const;
|
bool getFullHelp() const;
|
||||||
|
|
||||||
|
void setDelay(float delay);
|
||||||
|
|
||||||
void setFocusObject(const MWWorld::Ptr& focus);
|
void setFocusObject(const MWWorld::Ptr& focus);
|
||||||
void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
void setFocusObjectScreenCoords(float min_x, float min_y, float max_x, float max_y);
|
||||||
///< set the screen-space position of the tooltip for focused object
|
///< set the screen-space position of the tooltip for focused object
|
||||||
|
@ -84,6 +86,12 @@ namespace MWGui
|
||||||
float mFocusToolTipX;
|
float mFocusToolTipX;
|
||||||
float mFocusToolTipY;
|
float mFocusToolTipY;
|
||||||
|
|
||||||
|
float mDelay;
|
||||||
|
float mRemainingDelay; // remaining time until tooltip will show
|
||||||
|
|
||||||
|
int mLastMouseX;
|
||||||
|
int mLastMouseY;
|
||||||
|
|
||||||
bool mGameMode;
|
bool mGameMode;
|
||||||
|
|
||||||
bool mEnabled;
|
bool mEnabled;
|
||||||
|
|
|
@ -605,6 +605,7 @@ void WindowManager::onRetrieveTag(const MyGUI::UString& _tag, MyGUI::UString& _r
|
||||||
void WindowManager::processChangedSettings(const Settings::CategorySettingVector& changed)
|
void WindowManager::processChangedSettings(const Settings::CategorySettingVector& changed)
|
||||||
{
|
{
|
||||||
hud->setFpsLevel(Settings::Manager::getInt("fps", "HUD"));
|
hud->setFpsLevel(Settings::Manager::getInt("fps", "HUD"));
|
||||||
|
mToolTips->setDelay(Settings::Manager::getFloat("tooltip delay", "GUI"));
|
||||||
|
|
||||||
bool changeRes = false;
|
bool changeRes = false;
|
||||||
for (Settings::CategorySettingVector::const_iterator it = changed.begin();
|
for (Settings::CategorySettingVector::const_iterator it = changed.begin();
|
||||||
|
|
|
@ -23,6 +23,21 @@
|
||||||
<Property key="Caption" value="#{sNone}"/>
|
<Property key="Caption" value="#{sNone}"/>
|
||||||
<Property key="TextAlign" value="Right"/>
|
<Property key="TextAlign" value="Right"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="TextBox" skin="NormalText" position="4 78 352 18" align="Left Top">
|
||||||
|
<Property key="Caption" value="#{sMenu_Help_Delay}"/>
|
||||||
|
</Widget>
|
||||||
|
<Widget type="ScrollBar" skin="MW_HSlider" position="4 102 352 18" align="Left Top" name="ToolTipDelaySlider">
|
||||||
|
<Property key="Range" value="1000000"/>
|
||||||
|
</Widget>
|
||||||
|
<Widget type="TextBox" skin="SandText" position="4 126 352 18" align="Left Top">
|
||||||
|
<Property key="Caption" value="#{sFast}"/>
|
||||||
|
<Property key="TextAlign" value="Left"/>
|
||||||
|
</Widget>
|
||||||
|
<Widget type="TextBox" skin="SandText" position="4 126 352 18" align="Left Top">
|
||||||
|
<Property key="Caption" value="#{sSlow}"/>
|
||||||
|
<Property key="TextAlign" value="Right"/>
|
||||||
|
</Widget>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget type="TabItem" skin="" position="4 28 360 312">
|
<Widget type="TabItem" skin="" position="4 28 360 312">
|
||||||
<Property key="Caption" value=" #{sAudio} "/>
|
<Property key="Caption" value=" #{sAudio} "/>
|
||||||
|
|
|
@ -28,6 +28,9 @@ vsync = false
|
||||||
# 1 is fully opaque
|
# 1 is fully opaque
|
||||||
menu transparency = 0.84
|
menu transparency = 0.84
|
||||||
|
|
||||||
|
# 0 - instantly, 1 - max. delay
|
||||||
|
tooltip delay = 0.2
|
||||||
|
|
||||||
[General]
|
[General]
|
||||||
# Camera field of view
|
# Camera field of view
|
||||||
field of view = 55
|
field of view = 55
|
||||||
|
|
Loading…
Reference in a new issue