CHANGED: #1471 Moved the contexthelp drawing/controlling code to the GUI library.

This commit is contained in:
dfighter1985 2012-07-10 06:25:15 +02:00
parent 736e529ce9
commit 8b36d60fad
10 changed files with 628 additions and 630 deletions

View file

@ -216,6 +216,9 @@ namespace NLGUI
CCtrlBase* getCurContextHelp(){ return curContextHelp; }
float _DeltaTimeStopingContextHelp;
float _MaxTimeStopingContextHelp;
sint _LastXContextHelp;
sint _LastYContextHelp;
CViewPointerBase* getPointer(){ return _Pointer; }
void setPointer( CViewPointerBase *pointer ){ _Pointer = pointer; }
@ -256,6 +259,38 @@ namespace NLGUI
void reset();
void checkCoords();
CInterfaceGroup* getWindowForActiveMasterGroup( const std::string &windowName );
void drawOverExtendViewText();
// Internal : adjust a tooltip with respect to its parent. Returns the number of coordinate that were clamped
// against the screen border
uint adjustTooltipPosition( CCtrlBase *newCtrl, CInterfaceGroup *win, THotSpot ttParentRef,
THotSpot ttPosRef, sint32 xParent, sint32 yParent,
sint32 wParent, sint32 hParent );
void updateTooltipCoords();
// Update tooltip coordinate if they need to be (getInvalidCoords() returns a value != 0)
void updateTooltipCoords(CCtrlBase *newCtrl);
/// for ContextHelp action handler only: set the result name
void setContextHelpText( const ucstring &text ){ _ContextHelpText = text; }
ucstring& getContextHelpText(){ return _ContextHelpText; }
/// force disable the context help
void disableContextHelp();
/// force disable the context help, if it is issued from the given control
void disableContextHelpForControl(CCtrlBase *pCtrl);
CCtrlBase* getNewContextHelpCtrl();
void drawContextHelp();
void setContextHelpActive(bool active);
// Relative move of pointer
void movePointer (sint32 dx, sint32 dy);
// Set absolute coordinates of pointer
@ -284,7 +319,7 @@ namespace NLGUI
void resetCaptureKeyboard();
// True if the keyboard is captured
bool isKeyboardCaptured() const {return _CaptureKeyboard!=NULL;}
bool isKeyboardCaptured() const {return _CaptureKeyboard!=NULL;}
// register a view that wants to be notified at each frame (receive the msg 'clocktick')
void registerClockMsgTarget(CCtrlBase *vb);
@ -295,10 +330,10 @@ namespace NLGUI
void notifyElementCaptured(CCtrlBase *c);
// Add a group into the windows list of its master goup
void makeWindow( CInterfaceGroup *group );
void makeWindow( CInterfaceGroup *group );
// Remove a group from the windows list of its master group
void unMakeWindow( CInterfaceGroup *group, bool noWarning = false );
void unMakeWindow( CInterfaceGroup *group, bool noWarning = false );
void setGlobalColor( NLMISC::CRGBA col );
NLMISC::CRGBA getGlobalColor() const{ return _GlobalColor; }
@ -440,6 +475,9 @@ namespace NLGUI
SInterfaceTimes interfaceTimes;
ucstring _ContextHelpText;
bool _ContextHelpActive;
bool inGame;
};

View file

@ -24,6 +24,8 @@
#include "nel/gui/group_modal.h"
#include "nel/gui/group_editbox_base.h"
#include "nel/gui/interface_options.h"
#include "nel/gui/view_text.h"
#include "nel/gui/view_bitmap.h"
namespace NLGUI
{
@ -1075,6 +1077,559 @@ namespace NLGUI
}
}
// ----------------------------------------------------------------------------
CInterfaceGroup* CWidgetManager::getWindowForActiveMasterGroup( const std::string &window )
{
// Search for all elements
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
const SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
CInterfaceElement *pEL= getElementFromId( rMG.Group->getId() + ":" + window);
if(pEL && pEL->isGroup())
return (CInterfaceGroup*)pEL;
}
}
return NULL;
}
// ***************************************************************************
void CWidgetManager::drawOverExtendViewText()
{
if( getOverExtendViewText() )
{
CViewText *vtSrc= dynamic_cast<CViewText*>( getOverExtendViewText() );
CInterfaceGroup *groupOver = getWindowForActiveMasterGroup("over_extend_view_text");
if(groupOver)
{
CViewText *vtDst = dynamic_cast<CViewText*>(groupOver->getView("text"));
if (vtDst != NULL)
{
// Copy all aspects to the view
vtDst->setText (vtSrc->getText());
vtDst->setFontSize (vtSrc->getFontSize());
vtDst->setColor (vtSrc->getColor());
vtDst->setModulateGlobalColor(vtSrc->getModulateGlobalColor());
vtDst->setShadow(vtSrc->getShadow());
vtDst->setShadowColor(vtSrc->getShadowColor());
vtDst->setCaseMode(vtSrc->getCaseMode());
vtDst->setUnderlined(vtSrc->getUnderlined());
// setup background
CViewBitmap *pBack= dynamic_cast<CViewBitmap*>(groupOver->getView("midback"));
CViewBitmap *pOutline= dynamic_cast<CViewBitmap*>(groupOver->getView("midoutline"));
if(pBack)
pBack->setColor( getOverExtendViewTextBackColor() );
if(pOutline)
{
pOutline->setColor(vtSrc->getColor());
pOutline->setModulateGlobalColor(vtSrc->getModulateGlobalColor());
}
// the group is the position of the overed text, but apply the delta of borders (vtDst X/Y)
sint32 x = vtSrc->getXReal() - vtDst->getX();
sint32 y = vtSrc->getYReal() - vtDst->getY();
// update one time only to get correct W/H
groupOver->updateCoords ();
if(!vtSrc->isClampRight())
{
// clamped from the left part
x += vtSrc->getWReal() - vtDst->getWReal();
}
// clamp to screen coords, and set
if ((x+groupOver->getW()) > groupOver->getParent()->getWReal())
x = groupOver->getParent()->getWReal() - groupOver->getW();
if (x < 0)
x = 0;
if ((y+groupOver->getH()) > groupOver->getParent()->getHReal())
y = groupOver->getParent()->getHReal() - groupOver->getH();
if (y < 0)
y = 0;
// set pos
groupOver->setX (x);
groupOver->setY (y);
// update coords 3 times is required
groupOver->updateCoords ();
groupOver->updateCoords ();
groupOver->updateCoords ();
// draw
groupOver->draw ();
// flush layers
CViewRenderer::getInstance()->flush();
}
}
// Reset the ptr so at next frame, won't be rendered (but if reset)
setOverExtendViewText( NULL, getOverExtendViewTextBackColor() );
}
}
uint CWidgetManager::adjustTooltipPosition( CCtrlBase *newCtrl, CInterfaceGroup *win, THotSpot ttParentRef,
THotSpot ttPosRef, sint32 xParent, sint32 yParent,
sint32 wParent, sint32 hParent )
{
CCtrlBase::TToolTipParentType parentType= newCtrl->getToolTipParent();
CInterfaceGroup *groupContextHelp =
getWindowForActiveMasterGroup(newCtrl->getContextHelpWindowName());
uint32 _ScreenH, _ScreenW;
CViewRenderer::getInstance()->getScreenSize( _ScreenH, _ScreenW );
if(ttPosRef==Hotspot_TTAuto || ttParentRef==Hotspot_TTAuto)
{
// NB: keep the special window if type is specialwindow (defined above)
if(!win)
win= newCtrl->getRootWindow();
sint32 xWin= 0;
sint32 yWin= 0;
sint32 wWin= 0;
sint32 hWin= 0;
if(win)
{
xWin = win->getXReal();
yWin = win->getYReal();
wWin = win->getWReal();
hWin = win->getHReal();
}
// for Window, display top or bottom according to window pos/size
if(parentType==CCtrlBase::TTWindow || parentType==CCtrlBase::TTSpecialWindow)
{
sint32 top= (sint32)_ScreenH - (yWin+hWin);
sint32 bottom= yWin;
if(top>bottom)
{
ttParentRef= Hotspot_TL;
ttPosRef= Hotspot_BL;
}
else
{
ttParentRef= Hotspot_BL;
ttPosRef= Hotspot_TL;
}
}
// for Ctrl, display top, left or right according to window pos/size
else if(parentType==CCtrlBase::TTCtrl)
{
sint32 right= (sint32)_ScreenW - (xWin+wWin);
sint32 left= xWin;
if(right>left)
{
ttParentRef= Hotspot_TR;
ttPosRef= Hotspot_BL;
}
else
{
ttParentRef= Hotspot_TL;
ttPosRef= Hotspot_BR;
}
}
else
{
// default (mouse)
ttParentRef= Hotspot_BL;
ttPosRef= Hotspot_BL;
}
}
// **** compute coordinates of the tooltip
sint32 x= xParent;
sint32 y= yParent;
if (ttParentRef & Hotspot_Mx)
y += hParent/2;
if (ttParentRef & Hotspot_Tx)
y += hParent;
if (ttParentRef & Hotspot_xM)
x += wParent/2;
if (ttParentRef & Hotspot_xR)
x += wParent;
// adjust according to self posref
if (ttPosRef & Hotspot_Mx)
y -= groupContextHelp->getHReal()/2;
if (ttPosRef & Hotspot_Tx)
y -= groupContextHelp->getHReal();
if (ttPosRef & Hotspot_xM)
x -= groupContextHelp->getWReal()/2;
if (ttPosRef & Hotspot_xR)
x -= groupContextHelp->getWReal();
// **** clamp to screen coords, and set
uint clampCount = 0;
if ((x+groupContextHelp->getW()) > groupContextHelp->getParent()->getWReal())
{
++ clampCount;
x = groupContextHelp->getParent()->getWReal() - groupContextHelp->getW();
}
if (x < 0)
{
x = 0;
++ clampCount;
}
if ((y+groupContextHelp->getH()) > groupContextHelp->getParent()->getHReal())
{
y = groupContextHelp->getParent()->getHReal() - groupContextHelp->getH();
++ clampCount;
}
if (y < 0)
{
y = 0;
++ clampCount;
}
// update coords 3 times is required
groupContextHelp->setX (x);
groupContextHelp->setY (y);
groupContextHelp->updateCoords ();
groupContextHelp->updateCoords ();
groupContextHelp->updateCoords ();
return clampCount;
}
// ----------------------------------------------------------------------------
void CWidgetManager::updateTooltipCoords()
{
updateTooltipCoords( getCurContextHelp() );
}
void CWidgetManager::updateTooltipCoords( CCtrlBase *newCtrl )
{
if (!newCtrl) return;
if (!newCtrl->getInvalidCoords()) return;
CInterfaceGroup *groupContextHelp =
getWindowForActiveMasterGroup(newCtrl->getContextHelpWindowName());
if(groupContextHelp)
{
CViewText *pTxt = (CViewText*)groupContextHelp->getView("text");
if (pTxt != NULL)
{
pTxt->setTextFormatTaged(_ContextHelpText);
// update only to get correct W/H
groupContextHelp->updateCoords ();
// **** Compute parent coordinates
CCtrlBase::TToolTipParentType parentType= newCtrl->getToolTipParent();
CInterfaceGroup *win= NULL;
// adjust to the mouse by default
sint32 xParent= getPointer()->getX();
sint32 yParent= getPointer()->getY();
sint32 wParent= 0;
sint32 hParent= 0;
// adjust to the window
if(parentType==CCtrlBase::TTWindow || parentType==CCtrlBase::TTSpecialWindow)
{
if(parentType==CCtrlBase::TTWindow)
win= newCtrl->getRootWindow();
else
win =
dynamic_cast<CInterfaceGroup*>( getElementFromId(newCtrl->getToolTipSpecialParent()));
if(win)
{
xParent = win->getXReal();
yParent = win->getYReal();
wParent = win->getWReal();
hParent = win->getHReal();
}
// Bug...: leave default to pointer
}
// adjust to the ctrl
else if (parentType==CCtrlBase::TTCtrl)
{
xParent = newCtrl->getXReal();
yParent = newCtrl->getYReal();
wParent = newCtrl->getWReal();
hParent = newCtrl->getHReal();
// Additionaly, must clip this ctrl with its parent
// (else animals are buggy for instance)
CInterfaceGroup *parent= newCtrl->getParent();
if(parent)
{
sint32 xClip,yClip,wClip,hClip;
parent->getClip(xClip,yClip,wClip,hClip);
// clip bottom left
xParent= std::max(xParent, xClip);
yParent= std::max(yParent, yClip);
// clip top right
sint32 xrParent= std::min(xParent+ wParent, xClip+wClip);
sint32 ytParent= std::min(yParent+ hParent, yClip+hClip);
wParent= std::max((sint32)0, xrParent-xParent);
hParent= std::max((sint32)0, ytParent-yParent);
}
}
// **** resolve auto posref
uint clampCount =
adjustTooltipPosition( newCtrl, win, newCtrl->getToolTipParentPosRef(),
newCtrl->getToolTipPosRef(), xParent, yParent,
wParent, hParent);
if (clampCount != 0)
{
// try to fallback on alternate tooltip posref
uint altClampCount =
adjustTooltipPosition( newCtrl, win, newCtrl->getToolTipParentPosRefAlt(),
newCtrl->getToolTipPosRefAlt(), xParent, yParent,
wParent, hParent);
if (altClampCount > clampCount)
{
// worst ? resume to first posref
adjustTooltipPosition( newCtrl, win, newCtrl->getToolTipParentPosRef(),
newCtrl->getToolTipPosRef(), xParent, yParent,
wParent, hParent);
}
}
}
}
}
// ------------------------------------------------------------------------------------------------
void CWidgetManager::disableContextHelp()
{
setCurContextHelp( NULL );
_DeltaTimeStopingContextHelp = 0;
}
// ------------------------------------------------------------------------------------------------
void CWidgetManager::disableContextHelpForControl( CCtrlBase *pCtrl )
{
if( pCtrl == NULL )
return;
if( getCurContextHelp() == pCtrl )
disableContextHelp();
}
// ----------------------------------------------------------------------------
CCtrlBase* CWidgetManager::getNewContextHelpCtrl()
{
// get the top most ctrl under us
CCtrlBase *best = NULL;
sint8 bestRenderLayer = -128;
for (sint i = (sint32)_CtrlsUnderPointer.size()-1; i>=0; i--)
{
CCtrlBase *pICL = _CtrlsUnderPointer[i];
if (pICL->getRenderLayer() > bestRenderLayer)
{
if ((pICL->getActive()) && (!pICL->emptyContextHelp()))
{
if (!getPointer()) return pICL;
sint32 mx, my;
getPointer()->getPointerPos(mx, my);
if (pICL->preciseHitTest(mx, my))
{
best = pICL;
bestRenderLayer = pICL->getRenderLayer();
}
}
}
}
if (!best)
{
// if a control was not found, try with the groups
sint8 bestRenderLayer = -128;
for (sint i = (sint32)_GroupsUnderPointer.size()-1; i>=0; i--)
{
CCtrlBase *pICL = _GroupsUnderPointer[i];
if (pICL->getRenderLayer() > bestRenderLayer)
{
if ((pICL->getActive()) && (!pICL->emptyContextHelp()))
{
if (!getPointer()) return pICL;
sint32 mx, my;
getPointer()->getPointerPos(mx, my);
if (pICL->preciseHitTest(mx, my))
{
best = pICL;
bestRenderLayer = pICL->getRenderLayer();
}
}
}
}
}
return best;
}
// ----------------------------------------------------------------------------
void CWidgetManager::drawContextHelp ()
{
if (!getPointer() || !_ContextHelpActive)
return;
sint32 x = getPointer()->getX();
sint32 y = getPointer()->getY();
// ***************
// **** try to disable
// ***************
// test disable first, so can recheck asap if another present. see below
CCtrlBase *_CurCtrlContextHelp = getCurContextHelp();
if( _CurCtrlContextHelp)
{
if(x!=_LastXContextHelp || y!=_LastYContextHelp)
{
// May change of ctrl!! => disable context help
CCtrlBase *newCtrl= getNewContextHelpCtrl();
if(newCtrl!=_CurCtrlContextHelp)
{
// disable
disableContextHelp();
}
}
// Check if _CurCtrlContextHelp is visible
if (_CurCtrlContextHelp == NULL)
{
disableContextHelp();
}
else
{
bool bVisible = true;
if (_CurCtrlContextHelp->getActive() == false)
bVisible = false;
CInterfaceGroup *pParent = _CurCtrlContextHelp->getParent();
while (pParent != NULL)
{
if (pParent->getActive() == false)
bVisible = false;
pParent = pParent->getParent();
}
if (!bVisible)
disableContextHelp();
}
}
// ***************
// **** try to acquire
// ***************
if(!_CurCtrlContextHelp)
{
// get the ctrl of interset
CCtrlBase *newCtrl= getNewContextHelpCtrl();
if(x==_LastXContextHelp && y==_LastYContextHelp)
_DeltaTimeStopingContextHelp += ( interfaceTimes.frameDiffMs / 1000.0f );
else
_DeltaTimeStopingContextHelp = 0;
// If reach the time limit
if( ( _DeltaTimeStopingContextHelp > _MaxTimeStopingContextHelp )
|| (newCtrl && newCtrl->wantInstantContextHelp()))
{
// if present, get the ctx help text.
if(newCtrl)
{
// get the text
//newCtrl->getContextHelpToolTip(_ContextHelpText);
newCtrl->getContextHelp( getContextHelpText() );
// UserDefined context help
if( !newCtrl->getContextHelpActionHandler().empty() )
{
CAHManager::getInstance()->runActionHandler(newCtrl->getContextHelpActionHandler(), newCtrl, newCtrl->getContextHelpAHParams() );
}
// If the text is finally empty (Special AH case), abort
if( getContextHelpText().empty() )
newCtrl= NULL;
}
// not present? wait furthermore to move the mouse.
if(!newCtrl)
_DeltaTimeStopingContextHelp= 0;
else
{
// enable
setCurContextHelp( newCtrl );
newCtrl->invalidateCoords();
}
}
}
updateTooltipCoords(_CurCtrlContextHelp);
// ***************
// **** display
// ***************
if(_CurCtrlContextHelp)
{
CInterfaceGroup *groupContextHelp =
getWindowForActiveMasterGroup(_CurCtrlContextHelp->getContextHelpWindowName());
if(groupContextHelp)
{
/** 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
*/
if ( hasModal() )
{
CInterfaceGroup *mw = getModal().ModalWindow;
if (mw && mw->isIn(*groupContextHelp))
{
if (_CurCtrlContextHelp->isSonOf(mw))
{
groupContextHelp->executeLuaScriptOnDraw();
groupContextHelp->draw ();
// flush layers
CViewRenderer::getInstance()->flush();
}
}
else
{
groupContextHelp->executeLuaScriptOnDraw();
groupContextHelp->draw ();
// flush layers
CViewRenderer::getInstance()->flush();
}
}
else
{
groupContextHelp->executeLuaScriptOnDraw();
groupContextHelp->draw ();
// flush layers
CViewRenderer::getInstance()->flush();
}
}
}
// Bkup movement
_LastXContextHelp= x;
_LastYContextHelp= y;
}
void CWidgetManager::setContextHelpActive(bool active)
{
if (!active)
{
disableContextHelp();
}
_ContextHelpActive = active;
}
// ------------------------------------------------------------------------------------------------
void CWidgetManager::movePointer (sint32 dx, sint32 dy)
{
@ -1494,6 +2049,11 @@ namespace NLGUI
{
_Pointer = NULL;
curContextHelp = NULL;
_ContextHelpActive = true;
_DeltaTimeStopingContextHelp = 0;
_MaxTimeStopingContextHelp= 0.2f;
_LastXContextHelp= -10000;
_LastYContextHelp= -10000;
resetColorProps();

View file

@ -3705,7 +3705,7 @@ public:
ucstring str;
fillPlayerBarText(str, "HP", SCORES::hit_points, "uittPlayerLifeFormat");
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER(CHandlerPlayerTTLife, "player_tt_life");
@ -3722,7 +3722,7 @@ public:
ucstring str;
fillPlayerBarText(str, "STA", SCORES::stamina, "uittPlayerStaminaFormat");
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER(CHandlerPlayerTTStamina, "player_tt_stamina");
@ -3739,7 +3739,7 @@ public:
ucstring str;
fillPlayerBarText(str, "SAP", SCORES::sap, "uittPlayerSapFormat");
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER(CHandlerPlayerTTSap, "player_tt_sap");
@ -3756,7 +3756,7 @@ public:
ucstring str;
fillPlayerBarText(str, "FOCUS", SCORES::focus, "uittPlayerFocusFormat");
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER(CHandlerPlayerTTFocus, "player_tt_focus");
@ -3786,7 +3786,7 @@ public:
ucstring str= CI18N::get("uittBulkFormat");
strFindReplace(str, "%v", toString(val) );
strFindReplace(str, "%m", toString(maxVal) );
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER(CHandlerGetTTBulk, "get_tt_bulk");

View file

@ -3546,7 +3546,7 @@ void setConsoModSuccessTooltip( CDBCtrlSheet *cs )
strFindReplace(ustr, "%modifier", "@{0F0F}"+toString(nodeSM->getValue32())+"@{FFFF}");
// replace the context help that is required.
pIM->setContextHelpText(ustr);
CWidgetManager::getInstance()->setContextHelpText(ustr);
}
}
@ -3568,13 +3568,13 @@ public:
// special tooltip? (pvp outpost and xp catalyzer)
sint specialTTId= getBonusMalusSpecialTT(cs);
if(specialTTId==BONUS_MALUS::XpCatalyser)
pIM->setContextHelpText(CI18N::get("uittXpBonus"));
CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittXpBonus"));
else if(specialTTId==BONUS_MALUS::OutpostPVPOn)
pIM->setContextHelpText(CI18N::get("uittPvpOutpostOn"));
CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostOn"));
else if(specialTTId==BONUS_MALUS::OutpostPVPOutOfZone)
pIM->setContextHelpText(CI18N::get("uittPvpOutpostOutOfZone"));
CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostOutOfZone"));
else if(specialTTId==BONUS_MALUS::OutpostPVPInRound)
pIM->setContextHelpText(CI18N::get("uittPvpOutpostInRound"));
CWidgetManager::getInstance()->setContextHelpText(CI18N::get("uittPvpOutpostInRound"));
else if(specialTTId==BONUS_MALUS::DeathPenalty)
{
CCDBNodeLeaf * node = NLGUI::CDBManager::getInstance()->getDbProp("SERVER:USER:DEATH_XP_MALUS", false);
@ -3582,7 +3582,7 @@ public:
{
ucstring txt = CI18N::get("uittDeathPenalty");
strFindReplace(txt, "%dp", toString((100*node->getValue16())/254));
pIM->setContextHelpText(txt);
CWidgetManager::getInstance()->setContextHelpText(txt);
}
}
// if disabled.
@ -3595,7 +3595,7 @@ public:
str+= CI18N::get("uittAuraDisabled");
// and replace the context help that is required.
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
// else keep the default one
}
@ -3622,7 +3622,7 @@ public:
CCDBNodeLeaf *node = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:PACK_ANIMAL:BEAST%d:NAME", index));
if (node && CStringManagerClient::instance()->getDynString(node->getValue32(), txt))
{
pIM->setContextHelpText(CEntityCL::removeTitleFromName(txt));
CWidgetManager::getInstance()->setContextHelpText(CEntityCL::removeTitleFromName(txt));
}
}
};
@ -3668,7 +3668,7 @@ public:
str += toString(minTimeRemaining);
// replace the context help that is required.
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER( CHandlerAnimalDeadPopupTooltip, "animal_dead_popup_tooltip");

View file

@ -1652,7 +1652,7 @@ public:
else
strFindReplace(str, "%comp", CI18N::get("uittPhraseCombatRestrictOK"));
pIM->setContextHelpText(str);
CWidgetManager::getInstance()->setContextHelpText(str);
}
};
REGISTER_ACTION_HANDLER( CHandlerCombatRestrictTooltip, "phrase_combat_restrict_tooltip");

View file

@ -2426,10 +2426,8 @@ class CHandlerBotChatTTItemType : public IActionHandler
public:
void execute (CCtrlBase * /* pCaller */, const std::string &/* sParams */)
{
CInterfaceManager *pIM= CInterfaceManager::getInstance();
// \todo yoyo: for now disable tooltip
pIM->setContextHelpText(ucstring());
CWidgetManager::getInstance()->setContextHelpText(ucstring());
}
};
REGISTER_ACTION_HANDLER(CHandlerBotChatTTItemType, "botchat_tt_item_type");

View file

@ -439,11 +439,6 @@ CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext
_ErrorColor = NULL;
_EmotesInitialized = false;
// context help
CWidgetManager::getInstance()->_DeltaTimeStopingContextHelp = 0;
_MaxTimeStopingContextHelp= 0.2f;
_LastXContextHelp= -10000;
_LastYContextHelp= -10000;
// Global initialization
// *********************
@ -469,8 +464,6 @@ CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext
_CheckForumNode = NULL;
_UpdateWeatherTime = 0;
_ContextHelpActive = true;
_DBB_UI_DUMMY = NULL;
_DB_UI_DUMMY_QUANTITY = NULL;
_DB_UI_DUMMY_QUALITY = NULL;
@ -2060,10 +2053,10 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
NLGUI::CDBManager::getInstance()->flushObserverCalls();
// draw the special over extend text
drawOverExtendViewText();
CWidgetManager::getInstance()->drawOverExtendViewText();
// draw the context help
drawContextHelp ();
CWidgetManager::getInstance()->drawContextHelp ();
// Draw the pointer and DND Item
if ( CWidgetManager::getInstance()->getPointer() != NULL)
@ -2111,448 +2104,6 @@ void CInterfaceManager::drawViews(NL3D::UCamera camera)
}
// ----------------------------------------------------------------------------
CCtrlBase* CInterfaceManager::getNewContextHelpCtrl()
{
// get the top most ctrl under us
CCtrlBase *best = NULL;
sint8 bestRenderLayer = -128;
const std::vector< CCtrlBase* >& _CtrlsUnderPointer = CWidgetManager::getInstance()->getCtrlsUnderPointer();
for (sint i = (sint32)_CtrlsUnderPointer.size()-1; i>=0; i--)
{
CCtrlBase *pICL = _CtrlsUnderPointer[i];
if (pICL->getRenderLayer() > bestRenderLayer)
{
if ((pICL->getActive()) && (!pICL->emptyContextHelp()))
{
if (!CWidgetManager::getInstance()->getPointer()) return pICL;
sint32 mx, my;
CWidgetManager::getInstance()->getPointer()->getPointerPos(mx, my);
if (pICL->preciseHitTest(mx, my))
{
best = pICL;
bestRenderLayer = pICL->getRenderLayer();
}
}
}
}
if (!best)
{
// if a control was not found, try with the groups
sint8 bestRenderLayer = -128;
const std::vector< CInterfaceGroup* >& _GroupsUnderPointer = CWidgetManager::getInstance()->getGroupsUnderPointer();
for (sint i = (sint32)_GroupsUnderPointer.size()-1; i>=0; i--)
{
CCtrlBase *pICL = _GroupsUnderPointer[i];
if (pICL->getRenderLayer() > bestRenderLayer)
{
if ((pICL->getActive()) && (!pICL->emptyContextHelp()))
{
if (!CWidgetManager::getInstance()->getPointer()) return pICL;
sint32 mx, my;
CWidgetManager::getInstance()->getPointer()->getPointerPos(mx, my);
if (pICL->preciseHitTest(mx, my))
{
best = pICL;
bestRenderLayer = pICL->getRenderLayer();
}
}
}
}
}
return best;
}
// ----------------------------------------------------------------------------
CInterfaceGroup *CInterfaceManager::getWindowForActiveMasterGroup(const std::string &window)
{
std::vector< CWidgetManager::SMasterGroup > &_MasterGroups = CWidgetManager::getInstance()->getAllMasterGroup();
// Search for all elements
for (uint32 nMasterGroup = 0; nMasterGroup < _MasterGroups.size(); nMasterGroup++)
{
const CWidgetManager::SMasterGroup &rMG = _MasterGroups[nMasterGroup];
if (rMG.Group->getActive())
{
CInterfaceElement *pEL= CWidgetManager::getInstance()->getElementFromId( rMG.Group->getId() + ":" + window);
if(pEL && pEL->isGroup())
return (CInterfaceGroup*)pEL;
}
}
return NULL;
}
// ----------------------------------------------------------------------------
void CInterfaceManager::updateTooltipCoords()
{
updateTooltipCoords( CWidgetManager::getInstance()->getCurContextHelp() );
}
// ----------------------------------------------------------------------------
void CInterfaceManager::updateTooltipCoords(CCtrlBase *newCtrl)
{
if (!newCtrl) return;
if (!newCtrl->getInvalidCoords()) return;
CInterfaceGroup *groupContextHelp = getWindowForActiveMasterGroup(newCtrl->getContextHelpWindowName());
if(groupContextHelp)
{
CViewText *pTxt = (CViewText*)groupContextHelp->getView("text");
if (pTxt != NULL)
{
pTxt->setTextFormatTaged(_ContextHelpText);
// update only to get correct W/H
groupContextHelp->updateCoords ();
// **** Compute parent coordinates
CCtrlBase::TToolTipParentType parentType= newCtrl->getToolTipParent();
CInterfaceGroup *win= NULL;
// adjust to the mouse by default
sint32 xParent= CWidgetManager::getInstance()->getPointer()->getX();
sint32 yParent= CWidgetManager::getInstance()->getPointer()->getY();
sint32 wParent= 0;
sint32 hParent= 0;
// adjust to the window
if(parentType==CCtrlBase::TTWindow || parentType==CCtrlBase::TTSpecialWindow)
{
if(parentType==CCtrlBase::TTWindow)
win= newCtrl->getRootWindow();
else
win= dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(newCtrl->getToolTipSpecialParent()));
if(win)
{
xParent = win->getXReal();
yParent = win->getYReal();
wParent = win->getWReal();
hParent = win->getHReal();
}
// Bug...: leave default to pointer
}
// adjust to the ctrl
else if (parentType==CCtrlBase::TTCtrl)
{
xParent = newCtrl->getXReal();
yParent = newCtrl->getYReal();
wParent = newCtrl->getWReal();
hParent = newCtrl->getHReal();
// Additionaly, must clip this ctrl with its parent
// (else animals are buggy for instance)
CInterfaceGroup *parent= newCtrl->getParent();
if(parent)
{
sint32 xClip,yClip,wClip,hClip;
parent->getClip(xClip,yClip,wClip,hClip);
// clip bottom left
xParent= max(xParent, xClip);
yParent= max(yParent, yClip);
// clip top right
sint32 xrParent= min(xParent+ wParent, xClip+wClip);
sint32 ytParent= min(yParent+ hParent, yClip+hClip);
wParent= max((sint32)0, xrParent-xParent);
hParent= max((sint32)0, ytParent-yParent);
}
}
// **** resolve auto posref
uint clampCount = adjustTooltipPosition(newCtrl, win, newCtrl->getToolTipParentPosRef(), newCtrl->getToolTipPosRef(), xParent, yParent, wParent, hParent);
if (clampCount != 0)
{
// try to fallback on alternate tooltip posref
uint altClampCount = adjustTooltipPosition(newCtrl, win, newCtrl->getToolTipParentPosRefAlt(), newCtrl->getToolTipPosRefAlt(), xParent, yParent, wParent, hParent);
if (altClampCount > clampCount)
{
// worst ? resume to first posref
adjustTooltipPosition(newCtrl, win, newCtrl->getToolTipParentPosRef(), newCtrl->getToolTipPosRef(), xParent, yParent, wParent, hParent);
}
}
}
}
}
// ----------------------------------------------------------------------------
void CInterfaceManager::drawContextHelp ()
{
if (!CWidgetManager::getInstance()->getPointer() || !_ContextHelpActive)
return;
sint32 x = CWidgetManager::getInstance()->getPointer()->getX();
sint32 y = CWidgetManager::getInstance()->getPointer()->getY();
// ***************
// **** try to disable
// ***************
// test disable first, so can recheck asap if another present. see below
CCtrlBase *_CurCtrlContextHelp = CWidgetManager::getInstance()->getCurContextHelp();
if( _CurCtrlContextHelp)
{
if(x!=_LastXContextHelp || y!=_LastYContextHelp)
{
// May change of ctrl!! => disable context help
CCtrlBase *newCtrl= getNewContextHelpCtrl();
if(newCtrl!=_CurCtrlContextHelp)
{
// disable
disableContextHelp();
}
}
// Check if _CurCtrlContextHelp is visible
if (_CurCtrlContextHelp == NULL)
{
disableContextHelp();
}
else
{
bool bVisible = true;
if (_CurCtrlContextHelp->getActive() == false)
bVisible = false;
CInterfaceGroup *pParent = _CurCtrlContextHelp->getParent();
while (pParent != NULL)
{
if (pParent->getActive() == false)
bVisible = false;
pParent = pParent->getParent();
}
if (!bVisible)
disableContextHelp();
}
}
// ***************
// **** try to acquire
// ***************
if(!_CurCtrlContextHelp)
{
// get the ctrl of interset
CCtrlBase *newCtrl= getNewContextHelpCtrl();
if(x==_LastXContextHelp && y==_LastYContextHelp)
CWidgetManager::getInstance()->_DeltaTimeStopingContextHelp+= DT;
else
CWidgetManager::getInstance()->_DeltaTimeStopingContextHelp = 0;
// If reach the time limit
if( CWidgetManager::getInstance()->_DeltaTimeStopingContextHelp > _MaxTimeStopingContextHelp || (newCtrl && newCtrl->wantInstantContextHelp()))
{
// if present, get the ctx help text.
if(newCtrl)
{
// get the text
//newCtrl->getContextHelpToolTip(_ContextHelpText);
newCtrl->getContextHelp(_ContextHelpText);
// UserDefined context help
if( !newCtrl->getContextHelpActionHandler().empty() )
{
CAHManager::getInstance()->runActionHandler(newCtrl->getContextHelpActionHandler(), newCtrl, newCtrl->getContextHelpAHParams() );
}
// If the text is finally empty (Special AH case), abort
if(_ContextHelpText.empty())
newCtrl= NULL;
}
// not present? wait furthermore to move the mouse.
if(!newCtrl)
CWidgetManager::getInstance()->_DeltaTimeStopingContextHelp= 0;
else
{
// enable
CWidgetManager::getInstance()->setCurContextHelp( newCtrl );
newCtrl->invalidateCoords();
}
}
}
updateTooltipCoords(_CurCtrlContextHelp);
// ***************
// **** display
// ***************
if(_CurCtrlContextHelp)
{
CInterfaceGroup *groupContextHelp = getWindowForActiveMasterGroup(_CurCtrlContextHelp->getContextHelpWindowName());
if(groupContextHelp)
{
/** 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
*/
if ( CWidgetManager::getInstance()->hasModal() )
{
CInterfaceGroup *mw = CWidgetManager::getInstance()->getModal().ModalWindow;
if (mw && mw->isIn(*groupContextHelp))
{
if (_CurCtrlContextHelp->isSonOf(mw))
{
groupContextHelp->executeLuaScriptOnDraw();
groupContextHelp->draw ();
// flush layers
CViewRenderer::getInstance()->flush();
}
}
else
{
groupContextHelp->executeLuaScriptOnDraw();
groupContextHelp->draw ();
// flush layers
CViewRenderer::getInstance()->flush();
}
}
else
{
groupContextHelp->executeLuaScriptOnDraw();
groupContextHelp->draw ();
// flush layers
CViewRenderer::getInstance()->flush();
}
}
}
// Bkup movement
_LastXContextHelp= x;
_LastYContextHelp= y;
}
void CInterfaceManager::setContextHelpActive(bool active)
{
if (!active)
{
disableContextHelp();
}
_ContextHelpActive = active;
}
uint CInterfaceManager::adjustTooltipPosition(CCtrlBase *newCtrl,
CInterfaceGroup *win,
THotSpot ttParentRef,
THotSpot ttPosRef,
sint32 xParent,
sint32 yParent,
sint32 wParent,
sint32 hParent
)
{
CCtrlBase::TToolTipParentType parentType= newCtrl->getToolTipParent();
CInterfaceGroup *groupContextHelp = getWindowForActiveMasterGroup(newCtrl->getContextHelpWindowName());
if(ttPosRef==Hotspot_TTAuto || ttParentRef==Hotspot_TTAuto)
{
// NB: keep the special window if type is specialwindow (defined above)
if(!win)
win= newCtrl->getRootWindow();
sint32 xWin= 0;
sint32 yWin= 0;
sint32 wWin= 0;
sint32 hWin= 0;
if(win)
{
xWin = win->getXReal();
yWin = win->getYReal();
wWin = win->getWReal();
hWin = win->getHReal();
}
// for Window, display top or bottom according to window pos/size
if(parentType==CCtrlBase::TTWindow || parentType==CCtrlBase::TTSpecialWindow)
{
sint32 top= (sint32)_ScreenH - (yWin+hWin);
sint32 bottom= yWin;
if(top>bottom)
{
ttParentRef= Hotspot_TL;
ttPosRef= Hotspot_BL;
}
else
{
ttParentRef= Hotspot_BL;
ttPosRef= Hotspot_TL;
}
}
// for Ctrl, display top, left or right according to window pos/size
else if(parentType==CCtrlBase::TTCtrl)
{
sint32 right= (sint32)_ScreenW - (xWin+wWin);
sint32 left= xWin;
if(right>left)
{
ttParentRef= Hotspot_TR;
ttPosRef= Hotspot_BL;
}
else
{
ttParentRef= Hotspot_TL;
ttPosRef= Hotspot_BR;
}
}
else
{
// default (mouse)
ttParentRef= Hotspot_BL;
ttPosRef= Hotspot_BL;
}
}
// **** compute coordinates of the tooltip
sint32 x= xParent;
sint32 y= yParent;
if (ttParentRef & Hotspot_Mx)
y += hParent/2;
if (ttParentRef & Hotspot_Tx)
y += hParent;
if (ttParentRef & Hotspot_xM)
x += wParent/2;
if (ttParentRef & Hotspot_xR)
x += wParent;
// adjust according to self posref
if (ttPosRef & Hotspot_Mx)
y -= groupContextHelp->getHReal()/2;
if (ttPosRef & Hotspot_Tx)
y -= groupContextHelp->getHReal();
if (ttPosRef & Hotspot_xM)
x -= groupContextHelp->getWReal()/2;
if (ttPosRef & Hotspot_xR)
x -= groupContextHelp->getWReal();
// **** clamp to screen coords, and set
uint clampCount = 0;
if ((x+groupContextHelp->getW()) > groupContextHelp->getParent()->getWReal())
{
++ clampCount;
x = groupContextHelp->getParent()->getWReal() - groupContextHelp->getW();
}
if (x < 0)
{
x = 0;
++ clampCount;
}
if ((y+groupContextHelp->getH()) > groupContextHelp->getParent()->getHReal())
{
y = groupContextHelp->getParent()->getHReal() - groupContextHelp->getH();
++ clampCount;
}
if (y < 0)
{
y = 0;
++ clampCount;
}
// update coords 3 times is required
groupContextHelp->setX (x);
groupContextHelp->setY (y);
groupContextHelp->updateCoords ();
groupContextHelp->updateCoords ();
groupContextHelp->updateCoords ();
return clampCount;
}
// ------------------------------------------------------------------------------------------------
bool CInterfaceManager::isControlInWindow (CCtrlBase *ctrl, CInterfaceGroup *pNewCurrentWnd)
{
@ -2623,7 +2174,7 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
_LastEventKeyDesc = eventDesc;
// Any Key event disable the ContextHelp
disableContextHelp();
CWidgetManager::getInstance()->disableContextHelp();
// Hide menu if the key is pushed
// if ((eventDesc.getKeyEventType() == NLGUI::CEventDescriptorKey::keydown) && !_ModalStack.empty() && !eventDesc.getKeyAlt() && !eventDesc.getKeyCtrl() && !eventDesc.getKeyShift())
@ -2776,7 +2327,7 @@ bool CInterfaceManager::handleEvent (const NLGUI::CEventDescriptor& event)
// Any Mouse event but move disable the ContextHelp
if(eventDesc.getEventTypeExtended() != NLGUI::CEventDescriptorMouse::mousemove)
{
disableContextHelp();
CWidgetManager::getInstance()->disableContextHelp();
}
// get the group under the mouse
@ -3584,30 +3135,6 @@ bool CInterfaceManager::getCurrentValidMessageBoxOnOk(string &ahOnOk, const std:
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::setContextHelpText(const ucstring &text)
{
_ContextHelpText = text;
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::disableContextHelp()
{
CWidgetManager::getInstance()->setCurContextHelp( NULL );
CWidgetManager::getInstance()->_DeltaTimeStopingContextHelp = 0;
}
// ------------------------------------------------------------------------------------------------
void CInterfaceManager::disableContextHelpForControl(CCtrlBase *pCtrl)
{
if(!pCtrl)
return;
if( CWidgetManager::getInstance()->getCurContextHelp() == pCtrl )
disableContextHelp();
}
// ***************************************************************************
void CInterfaceManager::displayDebugInfo(const ucstring &str, TSystemInfoMode mode /*=InfoMsg*/)
{
@ -3690,7 +3217,7 @@ CRGBA CInterfaceManager::getSystemInfoColor(const std::string &cat)
void CInterfaceManager::launchContextMenuInGame (const std::string &nameOfCM)
{
// Launch the context menu in-game: can't appear while dragging an item
if (CDBCtrlSheet::getDraggedSheet() == NULL)
if (CCtrlDraggable::getDraggedSheet() == NULL)
{
if ( !CWidgetManager::getInstance()->hasModal() )
{
@ -4138,86 +3665,6 @@ void CInterfaceManager::incLocalSyncActionCounter()
}
// ***************************************************************************
void CInterfaceManager::drawOverExtendViewText()
{
// CViewRenderer &rVR= getViewRenderer();
if( CWidgetManager::getInstance()->getOverExtendViewText() )
{
CViewText *vtSrc= safe_cast<CViewText*>( CWidgetManager::getInstance()->getOverExtendViewText() );
CInterfaceGroup *groupOver = getWindowForActiveMasterGroup("over_extend_view_text");
if(groupOver)
{
CViewText *vtDst = dynamic_cast<CViewText*>(groupOver->getView("text"));
if (vtDst != NULL)
{
// Copy all aspects to the view
vtDst->setText (vtSrc->getText());
vtDst->setFontSize (vtSrc->getFontSize());
vtDst->setColor (vtSrc->getColor());
vtDst->setModulateGlobalColor(vtSrc->getModulateGlobalColor());
vtDst->setShadow(vtSrc->getShadow());
vtDst->setShadowColor(vtSrc->getShadowColor());
vtDst->setCaseMode(vtSrc->getCaseMode());
vtDst->setUnderlined(vtSrc->getUnderlined());
// setup background
CViewBitmap *pBack= dynamic_cast<CViewBitmap*>(groupOver->getView("midback"));
CViewBitmap *pOutline= dynamic_cast<CViewBitmap*>(groupOver->getView("midoutline"));
if(pBack)
pBack->setColor( CWidgetManager::getInstance()->getOverExtendViewTextBackColor() );
if(pOutline)
{
pOutline->setColor(vtSrc->getColor());
pOutline->setModulateGlobalColor(vtSrc->getModulateGlobalColor());
}
// the group is the position of the overed text, but apply the delta of borders (vtDst X/Y)
sint32 x = vtSrc->getXReal() - vtDst->getX();
sint32 y = vtSrc->getYReal() - vtDst->getY();
// update one time only to get correct W/H
groupOver->updateCoords ();
if(!vtSrc->isClampRight())
{
// clamped from the left part
x += vtSrc->getWReal() - vtDst->getWReal();
}
// clamp to screen coords, and set
if ((x+groupOver->getW()) > groupOver->getParent()->getWReal())
x = groupOver->getParent()->getWReal() - groupOver->getW();
if (x < 0)
x = 0;
if ((y+groupOver->getH()) > groupOver->getParent()->getHReal())
y = groupOver->getParent()->getHReal() - groupOver->getH();
if (y < 0)
y = 0;
// set pos
groupOver->setX (x);
groupOver->setY (y);
// update coords 3 times is required
groupOver->updateCoords ();
groupOver->updateCoords ();
groupOver->updateCoords ();
// draw
groupOver->draw ();
// flush layers
CViewRenderer::getInstance()->flush();
}
}
// Reset the ptr so at next frame, won't be rendered (but if reset)
CWidgetManager::getInstance()->setOverExtendViewText( NULL, CWidgetManager::getInstance()->getOverExtendViewTextBackColor() );
}
}
#if !FINAL_VERSION

View file

@ -287,7 +287,6 @@ public:
*/
void drawViews (NL3D::UCamera camera);
void drawAutoAdd ();
void drawContextHelp ();
//void drawContextMenu ();
/// Update all the elements
@ -331,15 +330,6 @@ public:
*/
bool getCurrentValidMessageBoxOnOk(std::string &ahOnOk, const std::string &masterGroup="ui:interface");
/// force disable the context help
void disableContextHelp();
/// force disable the context help, if it is issued from the given control
void disableContextHelpForControl(CCtrlBase *pCtrl);
/// for ContextHelp action handler only: set the result name
void setContextHelpText(const ucstring &text);
void setContextHelpActive(bool active);
bool isMouseOverWindow() const {return _MouseOverWindow;}
// Modes
@ -465,8 +455,6 @@ public:
void notifyMailAvailable();
void notifyForumUpdated();
void updateTooltipCoords();
/** Returns a human readable timestamp with the given format.
*/
static char* getTimestampHuman(const char* format = "[%H:%M:%S] ");
@ -636,16 +624,6 @@ private:
bool _MouseOverWindow;
// Context Help
bool _ContextHelpActive;
//CCtrlBasePtr _CurCtrlContextHelp;
//Delay before displaying ContextHelp on a ctrl having wantInstantContextHelp set to false (in seconds)
float _MaxTimeStopingContextHelp;
sint _LastXContextHelp;
sint _LastYContextHelp;
ucstring _ContextHelpText;
CCtrlBase *getNewContextHelpCtrl();
/// Current waiting id and string from server
struct SIDStringWaiter
{
@ -690,10 +668,6 @@ private:
NLMISC::CCDBNodeLeaf *_WarningColor;
NLMISC::CCDBNodeLeaf *_ErrorColor;
void drawOverExtendViewText();
CInterfaceGroup *getWindowForActiveMasterGroup(const std::string &windowName);
CDBLandmarkObs _LandmarkObs;
/// \name LUA
@ -729,21 +703,6 @@ private:
// Pop a new message box. If the message box was found, returns a pointer on it
void messageBoxInternal(const std::string &msgBoxGroup, const ucstring &text, const std::string &masterGroup, TCaseMode caseMode);
// Internal : adjust a tooltip with respect to its parent. Returns the number of coordinate that were clamped
// against the screen border
uint adjustTooltipPosition(CCtrlBase *newCtrl,
CInterfaceGroup *win,
THotSpot ttParentRef,
THotSpot ttPosRef,
sint32 xParent,
sint32 yParent,
sint32 wParent,
sint32 hParent
);
// Update tooltip coordinate if they need to be (getInvalidCoords() returns a value != 0)
void updateTooltipCoords(CCtrlBase *newCtrl);
NL3D::UDriver *driver;
NL3D::UTextContext *textcontext;
CInterfaceLink::CInterfaceLinkUpdater *interfaceLinkUpdater;

View file

@ -1255,8 +1255,7 @@ int CLuaIHMRyzom::disableContextHelp(CLuaState &ls)
//H_AUTO(Lua_CLuaIHM_disableContextHelp)
CLuaStackChecker lsc(&ls, 0);
CLuaIHM::checkArgCount(ls, "disableContextHelp", 0);
CInterfaceManager *pIM= CInterfaceManager::getInstance();
pIM->disableContextHelp();
CWidgetManager::getInstance()->disableContextHelp();
return 0;
}
@ -1275,8 +1274,7 @@ int CLuaIHMRyzom::disableContextHelpForControl(CLuaState &ls)
CInterfaceElement *pIE= CLuaIHM::getUIOnStack(ls, 1);
// go
CInterfaceManager *pIM= CInterfaceManager::getInstance();
pIM->disableContextHelpForControl(dynamic_cast<CCtrlBase*>(pIE));
CWidgetManager::getInstance()->disableContextHelpForControl(dynamic_cast<CCtrlBase*>(pIE));
return 0;
}
@ -1971,9 +1969,7 @@ std::string CLuaIHMRyzom::getDefine(const std::string &def)
// ***************************************************************************
void CLuaIHMRyzom::setContextHelpText(const ucstring &text)
{
//H_AUTO(Lua_CLuaIHM_setContextHelpText)
CInterfaceManager *pIM= CInterfaceManager::getInstance();
pIM->setContextHelpText(text);
CWidgetManager::getInstance()->setContextHelpText(text);
}
// ***************************************************************************
@ -2645,7 +2641,7 @@ bool CLuaIHMRyzom::isRingAccessPointInReach()
// ***************************************************************************
void CLuaIHMRyzom::updateTooltipCoords()
{
CInterfaceManager::getInstance()->updateTooltipCoords();
CWidgetManager::getInstance()->updateTooltipCoords();
}
// ***************************************************************************

View file

@ -727,7 +727,7 @@ void CTool::captureMouse()
UserControls.captureMouse();
CWidgetManager::getInstance()->enableMouseHandling(false);
}
getUI().setContextHelpActive(false);
CWidgetManager::getInstance()->setContextHelpActive(false);
_MouseCaptured = true;
}
@ -738,7 +738,7 @@ void CTool::releaseMouse()
CWidgetManager::getInstance()->setCapturePointerLeft(NULL);
UserControls.releaseMouse();
CWidgetManager::getInstance()->enableMouseHandling(true);
getUI().setContextHelpActive(true);
CWidgetManager::getInstance()->setContextHelpActive(true);
_MouseCaptured = false;
}