From ddb4cce71260cbc8d47e52b2ee100e77db5b38e6 Mon Sep 17 00:00:00 2001 From: bensaine Date: Wed, 23 Feb 2022 23:34:38 -0500 Subject: [PATCH 1/3] initial draft --- nel/include/nel/gui/interface_group.h | 1 + nel/include/nel/gui/widget_manager.h | 6 ++++++ nel/src/gui/interface_group.cpp | 12 ++++++++++++ nel/src/gui/widget_manager.cpp | 11 +++++++++++ 4 files changed, 30 insertions(+) diff --git a/nel/include/nel/gui/interface_group.h b/nel/include/nel/gui/interface_group.h index 672e52e6a..3948ebcaf 100644 --- a/nel/include/nel/gui/interface_group.h +++ b/nel/include/nel/gui/interface_group.h @@ -271,6 +271,7 @@ namespace NLGUI virtual sint32 getAlpha() const; virtual void setAlpha (sint32 a); + virtual void setContainerAlpha (sint32 a); /// Eval current clip coords. This is not incremental as with makeNewClip, and thus more slow. This also doesn't change the current clip window. void getClip(sint32 &x, sint32 &y, sint32 &w, sint32 &h) const; diff --git a/nel/include/nel/gui/widget_manager.h b/nel/include/nel/gui/widget_manager.h index 090bca02d..e27fab56f 100644 --- a/nel/include/nel/gui/widget_manager.h +++ b/nel/include/nel/gui/widget_manager.h @@ -489,6 +489,8 @@ namespace NLGUI uint8 getGlobalContainerAlpha() const { return _GlobalContainerAlpha; } uint8 getGlobalRolloverFactorContent() const { return _GlobalRolloverFactorContent; } uint8 getGlobalRolloverFactorContainer() const { return _GlobalRolloverFactorContainer; } + uint8 getContextHelpContentAlpha() const { return _ContextHelpContentAlpha; } + uint8 getContextHelpContainerAlpha() const { return _ContextHelpContainerAlpha; } void updateGlobalAlphas(); void resetGlobalAlphasProps(); @@ -608,12 +610,16 @@ namespace NLGUI NLMISC::CCDBNodeLeaf *_GlobalContainerAlphaDB; NLMISC::CCDBNodeLeaf *_GlobalContentRolloverFactorDB; NLMISC::CCDBNodeLeaf *_GlobalContainerRolloverFactorDB; + NLMISC::CCDBNodeLeaf * _ContextHelpContentAlphaDB; + NLMISC::CCDBNodeLeaf * _ContextHelpContainerAlphaDB; uint8 _ContainerAlpha; uint8 _GlobalContentAlpha; uint8 _GlobalContainerAlpha; uint8 _GlobalRolloverFactorContent; uint8 _GlobalRolloverFactorContainer; + uint8 _ContextHelpContentAlpha; + uint8 _ContextHelpContainerAlpha; bool _MouseHandlingEnabled; diff --git a/nel/src/gui/interface_group.cpp b/nel/src/gui/interface_group.cpp index 87504cf24..77f4fa056 100644 --- a/nel/src/gui/interface_group.cpp +++ b/nel/src/gui/interface_group.cpp @@ -2153,6 +2153,18 @@ namespace NLGUI } } + // ------------------------------------------------------------------------------------------------ + void CInterfaceGroup::setContainerAlpha (sint32 a) + { + vector::const_iterator itv; + for (itv = _Views.begin(); itv != _Views.end(); itv++) + { + CViewBase *pVB = *itv; + nlwarning("setContainerAlpha: %s %s", pVB->getShortID().c_str(), std::to_string(pVB->getRenderLayer()).c_str()); + pVB->setAlpha(a); + } + } + // ------------------------------------------------------------------------------------------------ void CInterfaceGroup::setLeftClickHandler(const std::string &handler) { diff --git a/nel/src/gui/widget_manager.cpp b/nel/src/gui/widget_manager.cpp index c052f4c18..60ffc22e6 100644 --- a/nel/src/gui/widget_manager.cpp +++ b/nel/src/gui/widget_manager.cpp @@ -1780,6 +1780,7 @@ namespace NLGUI if(groupContextHelp) { + groupContextHelp->setContainerAlpha(100); /** If there's a modal box around, should be sure that the context help doesn't intersect it. * If this is the case, we just disable it, unless the tooltip was generated by the current modal window */ @@ -3338,11 +3339,17 @@ namespace NLGUI nlassert(_GlobalContentRolloverFactorDB); _GlobalContainerRolloverFactorDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTAINER_ROLLOVER_FACTOR"); nlassert(_GlobalContainerRolloverFactorDB); + _ContextHelpContentAlphaDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTEXT_HELP_CONTENT_ALPHA"); + nlassert(_ContextHelpContentAlphaDB); + _ContextHelpContainerAlphaDB = CDBManager::getInstance()->getDbProp("UI:SAVE:CONTEXT_HELP_CONTAINER_ALPHA"); + nlassert(_ContextHelpContainerAlphaDB); } _GlobalContentAlpha = (uint8)_GlobalContentAlphaDB->getValue32(); _GlobalContainerAlpha = (uint8)_GlobalContainerAlphaDB->getValue32(); _GlobalRolloverFactorContent = (uint8)_GlobalContentRolloverFactorDB->getValue32(); _GlobalRolloverFactorContainer = (uint8)_GlobalContainerRolloverFactorDB->getValue32(); + _ContextHelpContentAlpha = (uint8)_ContextHelpContentAlphaDB->getValue32(); + _ContextHelpContainerAlpha = (uint8)_ContextHelpContainerAlphaDB->getValue32(); } void CWidgetManager::resetGlobalAlphasProps() @@ -3351,6 +3358,8 @@ namespace NLGUI _GlobalContainerAlphaDB = NULL; _GlobalContentRolloverFactorDB = NULL; _GlobalContainerRolloverFactorDB = NULL; + _ContextHelpContentAlphaDB = NULL; + _ContextHelpContainerAlphaDB = NULL; } void CWidgetManager::registerNewScreenSizeHandler( INewScreenSizeHandler *handler ) @@ -3884,6 +3893,8 @@ namespace NLGUI _GlobalRolloverFactorContent = 255; _GlobalRolloverFactorContainer = 255; _AlphaRolloverSpeedDB = NULL; + _ContextHelpContentAlpha = 255; + _ContextHelpContainerAlpha = 255; _MouseHandlingEnabled = true; _MouseOverWindow = false; From 1c65914b1097b0c449ba97284aa68ce407b95f5a Mon Sep 17 00:00:00 2001 From: bensaine Date: Sat, 26 Feb 2022 02:50:56 -0500 Subject: [PATCH 2/3] fix: tooltip opacity --- nel/include/nel/gui/interface_group.h | 1 - nel/src/gui/interface_group.cpp | 12 --------- nel/src/gui/widget_manager.cpp | 37 ++++++++++++++++----------- 3 files changed, 22 insertions(+), 28 deletions(-) diff --git a/nel/include/nel/gui/interface_group.h b/nel/include/nel/gui/interface_group.h index 3948ebcaf..672e52e6a 100644 --- a/nel/include/nel/gui/interface_group.h +++ b/nel/include/nel/gui/interface_group.h @@ -271,7 +271,6 @@ namespace NLGUI virtual sint32 getAlpha() const; virtual void setAlpha (sint32 a); - virtual void setContainerAlpha (sint32 a); /// Eval current clip coords. This is not incremental as with makeNewClip, and thus more slow. This also doesn't change the current clip window. void getClip(sint32 &x, sint32 &y, sint32 &w, sint32 &h) const; diff --git a/nel/src/gui/interface_group.cpp b/nel/src/gui/interface_group.cpp index 77f4fa056..87504cf24 100644 --- a/nel/src/gui/interface_group.cpp +++ b/nel/src/gui/interface_group.cpp @@ -2153,18 +2153,6 @@ namespace NLGUI } } - // ------------------------------------------------------------------------------------------------ - void CInterfaceGroup::setContainerAlpha (sint32 a) - { - vector::const_iterator itv; - for (itv = _Views.begin(); itv != _Views.end(); itv++) - { - CViewBase *pVB = *itv; - nlwarning("setContainerAlpha: %s %s", pVB->getShortID().c_str(), std::to_string(pVB->getRenderLayer()).c_str()); - pVB->setAlpha(a); - } - } - // ------------------------------------------------------------------------------------------------ void CInterfaceGroup::setLeftClickHandler(const std::string &handler) { diff --git a/nel/src/gui/widget_manager.cpp b/nel/src/gui/widget_manager.cpp index 60ffc22e6..d1f8c2a09 100644 --- a/nel/src/gui/widget_manager.cpp +++ b/nel/src/gui/widget_manager.cpp @@ -1779,34 +1779,41 @@ namespace NLGUI getWindowForActiveMasterGroup(_CurCtrlContextHelp->getContextHelpWindowName()); if(groupContextHelp) - { - groupContextHelp->setContainerAlpha(100); + { /** If there's a modal box around, should be sure that the context help doesn't intersect it. * If this is the case, we just disable it, unless the tooltip was generated by the current modal window */ + + bool draw = false; if ( hasModal() ) { CInterfaceGroup *mw = getModal().ModalWindow; if (mw && mw->isIn(*groupContextHelp)) { if (_CurCtrlContextHelp->isSonOf(mw)) - { - groupContextHelp->executeLuaScriptOnDraw(); - groupContextHelp->draw (); - // flush layers - CViewRenderer::getInstance()->flush(); - } + draw = true; } else - { - groupContextHelp->executeLuaScriptOnDraw(); - groupContextHelp->draw (); - // flush layers - CViewRenderer::getInstance()->flush(); - } + draw = true; } else - { + draw = true; + + if (draw) { + // apply opacity settings + const std::vector< CViewBase* > &vs = groupContextHelp->getViews(); + // content opacity: only target views or else breaks + for( std::vector< CViewBase* >::const_iterator itr = vs.begin(); itr != vs.end(); ++itr ) + { + CViewBase *pVB = *itr; + pVB->setAlpha(_ContextHelpContentAlpha); + } + // container opacity + CInterfaceGroup* container = dynamic_cast(groupContextHelp->findFromShortId("border")) + if (container) + container->setAlpha(_ContextHelpContainerAlpha); + + // draw the tooltip groupContextHelp->executeLuaScriptOnDraw(); groupContextHelp->draw (); // flush layers From 85a8c956fbf142702eaba08391d7ac15580c9411 Mon Sep 17 00:00:00 2001 From: bensaine Date: Sat, 26 Feb 2022 15:56:43 -0500 Subject: [PATCH 3/3] fixes --- nel/src/gui/widget_manager.cpp | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/nel/src/gui/widget_manager.cpp b/nel/src/gui/widget_manager.cpp index d1f8c2a09..f1fb0b0f4 100644 --- a/nel/src/gui/widget_manager.cpp +++ b/nel/src/gui/widget_manager.cpp @@ -1803,13 +1803,41 @@ namespace NLGUI // apply opacity settings const std::vector< CViewBase* > &vs = groupContextHelp->getViews(); // content opacity: only target views or else breaks - for( std::vector< CViewBase* >::const_iterator itr = vs.begin(); itr != vs.end(); ++itr ) + for( uint i = 0; i < vs.size(); ++i) { - CViewBase *pVB = *itr; + CViewBase *pVB = vs[i]; pVB->setAlpha(_ContextHelpContentAlpha); } + // go into sub groups and apply opacity to views and controls (this is mainly for crystallized_spell_context_help) + const std::vector &rG = groupContextHelp->getGroups(); + if (!rG.empty()) { + for(uint i = 0; i < rG.size(); ++i) { + const std::vector< CInterfaceGroup* > &vs = rG[i]->getGroups(); + if (!vs.empty()) { + for( uint j = 0; j < vs.size(); ++j) + { + const std::vector< CViewBase* > &vb = vs[j]->getViews(); + if (!vb.empty()) { + for( uint k = 0; k < vb.size(); ++k) + { + CViewBase *pVB = vb[k]; + pVB->setAlpha(_ContextHelpContentAlpha); + } + } + } + } + const std::vector< CViewBase* > &vb = rG[i]->getViews(); + if (!vb.empty()) { + for( uint k = 0; k < vb.size(); ++k) + { + CViewBase *pVB = vb[k]; + pVB->setAlpha(_ContextHelpContentAlpha); + } + } + } + } // container opacity - CInterfaceGroup* container = dynamic_cast(groupContextHelp->findFromShortId("border")) + CInterfaceGroup* container = dynamic_cast(groupContextHelp->findFromShortId("border")); if (container) container->setAlpha(_ContextHelpContainerAlpha);