CHANGED: #1471 Broke up CViewPointer into a generic and a Ryzom game related class.
This commit is contained in:
parent
66293a4fd9
commit
923695fe70
10 changed files with 260 additions and 212 deletions
|
@ -377,6 +377,9 @@ namespace NLGUI
|
||||||
const SInterfaceTimes& getInterfaceTimes() const{ return interfaceTimes; }
|
const SInterfaceTimes& getInterfaceTimes() const{ return interfaceTimes; }
|
||||||
void updateInterfaceTimes( const SInterfaceTimes × ){ interfaceTimes = times; }
|
void updateInterfaceTimes( const SInterfaceTimes × ){ interfaceTimes = times; }
|
||||||
|
|
||||||
|
void setIngame( bool i ){ inGame = i; }
|
||||||
|
bool isIngame() const{ return inGame; }
|
||||||
|
|
||||||
static IParser *parser;
|
static IParser *parser;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -436,6 +439,8 @@ namespace NLGUI
|
||||||
NLMISC::CRGBA _OverExtendViewTextBackColor;
|
NLMISC::CRGBA _OverExtendViewTextBackColor;
|
||||||
|
|
||||||
SInterfaceTimes interfaceTimes;
|
SInterfaceTimes interfaceTimes;
|
||||||
|
|
||||||
|
bool inGame;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1508,6 +1508,7 @@ namespace NLGUI
|
||||||
_AlphaRolloverSpeedDB = NULL;
|
_AlphaRolloverSpeedDB = NULL;
|
||||||
|
|
||||||
_MouseHandlingEnabled = true;
|
_MouseHandlingEnabled = true;
|
||||||
|
inGame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWidgetManager::~CWidgetManager()
|
CWidgetManager::~CWidgetManager()
|
||||||
|
|
|
@ -96,6 +96,7 @@ bool InitMouseWithCursor (bool hardware)
|
||||||
|
|
||||||
// Get the new mouse state
|
// Get the new mouse state
|
||||||
MouseHardware = hardware;
|
MouseHardware = hardware;
|
||||||
|
CViewPointer::setHWMouse( hardware );
|
||||||
|
|
||||||
// Reinit ?
|
// Reinit ?
|
||||||
if (MouseDevice == NULL)
|
if (MouseDevice == NULL)
|
||||||
|
|
|
@ -443,7 +443,7 @@ CInterfaceManager::CInterfaceManager( NL3D::UDriver *driver, NL3D::UTextContext
|
||||||
|
|
||||||
_CurrentMode = 0;
|
_CurrentMode = 0;
|
||||||
|
|
||||||
_InGame = false;
|
setInGame( false );
|
||||||
|
|
||||||
_LocalSyncActionCounter= 0;
|
_LocalSyncActionCounter= 0;
|
||||||
// 4Bits counter.
|
// 4Bits counter.
|
||||||
|
@ -537,6 +537,12 @@ void CInterfaceManager::releaseServerToLocalAutoCopyObservers()
|
||||||
ServerToLocalAutoCopySkillPoints.release();
|
ServerToLocalAutoCopySkillPoints.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CInterfaceManager::setInGame( bool i )
|
||||||
|
{
|
||||||
|
_InGame = i;
|
||||||
|
CWidgetManager::getInstance()->setIngame( i );
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void CInterfaceManager::resetShardSpecificData()
|
void CInterfaceManager::resetShardSpecificData()
|
||||||
{
|
{
|
||||||
|
@ -925,7 +931,7 @@ void CInterfaceManager::initInGame()
|
||||||
|
|
||||||
initActions();
|
initActions();
|
||||||
}
|
}
|
||||||
_InGame = true;
|
setInGame( true );
|
||||||
|
|
||||||
// Init bubble manager
|
// Init bubble manager
|
||||||
InSceneBubbleManager.init();
|
InSceneBubbleManager.init();
|
||||||
|
@ -1324,7 +1330,7 @@ void CInterfaceManager::uninitInGame1 ()
|
||||||
// Close LUA Scripting
|
// Close LUA Scripting
|
||||||
uninitLUA();
|
uninitLUA();
|
||||||
|
|
||||||
_InGame = false;
|
setInGame( false );
|
||||||
_NeutralColor = NULL;
|
_NeutralColor = NULL;
|
||||||
_WarningColor = NULL;
|
_WarningColor = NULL;
|
||||||
_ErrorColor = NULL;
|
_ErrorColor = NULL;
|
||||||
|
|
|
@ -143,6 +143,7 @@ public:
|
||||||
// release all of the global db autocopy observers
|
// release all of the global db autocopy observers
|
||||||
void releaseServerToLocalAutoCopyObservers();
|
void releaseServerToLocalAutoCopyObservers();
|
||||||
|
|
||||||
|
void setInGame( bool i );
|
||||||
bool isInGame() const { return _InGame; }
|
bool isInGame() const { return _InGame; }
|
||||||
|
|
||||||
/// initialize the whole login interface
|
/// initialize the whole login interface
|
||||||
|
|
|
@ -60,10 +60,14 @@
|
||||||
#include "../r2/tool.h"
|
#include "../r2/tool.h"
|
||||||
#include "../r2/tool_pick.h"
|
#include "../r2/tool_pick.h"
|
||||||
|
|
||||||
|
#include "view_pointer_ryzom.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void registerInterfaceElements()
|
void registerInterfaceElements()
|
||||||
{
|
{
|
||||||
|
CViewPointerRyzom::forceLinking();
|
||||||
|
|
||||||
REGISTER_REFLECTABLE_CLASS(CInterfaceElement, CReflectable);
|
REGISTER_REFLECTABLE_CLASS(CInterfaceElement, CReflectable);
|
||||||
REGISTER_REFLECTABLE_CLASS(CViewBase, CInterfaceElement);
|
REGISTER_REFLECTABLE_CLASS(CViewBase, CInterfaceElement);
|
||||||
REGISTER_REFLECTABLE_CLASS(CViewText, CViewBase);
|
REGISTER_REFLECTABLE_CLASS(CViewText, CViewBase);
|
||||||
|
|
|
@ -15,30 +15,19 @@
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "../input.h"
|
|
||||||
#include "view_pointer.h"
|
#include "view_pointer.h"
|
||||||
#include "interface_manager.h"
|
#include "nel/gui/widget_manager.h"
|
||||||
#include "nel/gui/view_renderer.h"
|
#include "nel/gui/view_renderer.h"
|
||||||
#include "nel/gui/ctrl_col_pick.h"
|
|
||||||
#include "nel/gui/group_paragraph.h"
|
#include "nel/gui/group_paragraph.h"
|
||||||
#include "nel/gui/group_html.h"
|
|
||||||
#include "group_map.h"
|
|
||||||
//
|
|
||||||
#include "nel/misc/xml_auto_ptr.h"
|
#include "nel/misc/xml_auto_ptr.h"
|
||||||
//
|
|
||||||
#include "nel/gui/group_container.h"
|
#include "nel/gui/group_container.h"
|
||||||
#include "interface_3d_scene.h"
|
|
||||||
//
|
|
||||||
#include "../r2/editor.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace NLMISC;
|
using namespace NLMISC;
|
||||||
|
|
||||||
NLMISC_REGISTER_OBJECT(CViewBase, CViewPointer, std::string, "pointer");
|
NLMISC_REGISTER_OBJECT(CViewBase, CViewPointer, std::string, "generic_pointer");
|
||||||
|
|
||||||
|
bool CViewPointer::hwMouse = true;
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
CViewPointer::CViewPointer (const TCtorParam ¶m)
|
CViewPointer::CViewPointer (const TCtorParam ¶m)
|
||||||
|
@ -125,16 +114,13 @@ bool CViewPointer::parse (xmlNodePtr cur,CInterfaceGroup * parentGroup)
|
||||||
if (prop) _TxCanPan = (const char *) prop;
|
if (prop) _TxCanPan = (const char *) prop;
|
||||||
_TxCanPan = NLMISC::strlwr (_TxCanPan);
|
_TxCanPan = NLMISC::strlwr (_TxCanPan);
|
||||||
|
|
||||||
if (ClientCfg.R2EDEnabled)
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_pan_r2");
|
||||||
{
|
if (prop) _TxPanR2 = (const char *) prop;
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_pan_r2");
|
_TxPanR2 = NLMISC::strlwr (_TxPanR2);
|
||||||
if (prop) _TxPanR2 = (const char *) prop;
|
|
||||||
_TxPanR2 = NLMISC::strlwr (_TxPanR2);
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_can_pan_r2");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"tx_can_pan_r2");
|
||||||
if (prop) _TxCanPanR2 = (const char *) prop;
|
if (prop) _TxCanPanR2 = (const char *) prop;
|
||||||
_TxCanPanR2 = NLMISC::strlwr (_TxCanPanR2);
|
_TxCanPanR2 = NLMISC::strlwr (_TxCanPanR2);
|
||||||
}
|
|
||||||
|
|
||||||
prop = (char*) xmlGetProp (cur, (xmlChar*)"color");
|
prop = (char*) xmlGetProp (cur, (xmlChar*)"color");
|
||||||
if (prop) _Color = convertColor(prop);
|
if (prop) _Color = convertColor(prop);
|
||||||
|
@ -162,23 +148,22 @@ void CViewPointer::draw ()
|
||||||
if(!_PointerVisible)
|
if(!_PointerVisible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
||||||
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||||
|
|
||||||
if (pIM->isInGame())
|
if ( CWidgetManager::getInstance()->isIngame() )
|
||||||
if (!_StringCursor)
|
if (!_StringCursor)
|
||||||
{
|
{
|
||||||
// Create the string cursor instance
|
// Create the string cursor instance
|
||||||
std::vector<std::pair<std::string,std::string> > templateParams;
|
std::vector<std::pair<std::string,std::string> > templateParams;
|
||||||
templateParams.push_back (std::pair<std::string,std::string>("id", "string_cursor"));
|
templateParams.push_back (std::pair<std::string,std::string>("id", "string_cursor"));
|
||||||
|
|
||||||
_StringCursor = pIM->createGroupInstance("string_cursor", "", templateParams);
|
_StringCursor = CWidgetManager::parser->createGroupInstance("string_cursor", "", templateParams);
|
||||||
if (_StringCursor)
|
if (_StringCursor)
|
||||||
_StringCursor->setParentPos(CWidgetManager::getInstance()->getElementFromId("ui:interface"));
|
_StringCursor->setParentPos(CWidgetManager::getInstance()->getElementFromId("ui:interface"));
|
||||||
|
|
||||||
templateParams.clear();
|
templateParams.clear();
|
||||||
templateParams.push_back (std::pair<std::string,std::string>("id", "string_cursor_hardware"));
|
templateParams.push_back (std::pair<std::string,std::string>("id", "string_cursor_hardware"));
|
||||||
_StringCursorHardware = pIM->createGroupInstance("string_cursor_hardware", "", templateParams);
|
_StringCursorHardware = CWidgetManager::parser->createGroupInstance("string_cursor_hardware", "", templateParams);
|
||||||
if (_StringCursorHardware)
|
if (_StringCursorHardware)
|
||||||
_StringCursorHardware->setParentPos(CWidgetManager::getInstance()->getElementFromId("ui:interface"));
|
_StringCursorHardware->setParentPos(CWidgetManager::getInstance()->getElementFromId("ui:interface"));
|
||||||
}
|
}
|
||||||
|
@ -225,11 +210,9 @@ void CViewPointer::draw ()
|
||||||
_TxIdColPick = rVR.getTextureIdFromName (_TxColPick);
|
_TxIdColPick = rVR.getTextureIdFromName (_TxColPick);
|
||||||
_TxIdPan = rVR.getTextureIdFromName (_TxPan);
|
_TxIdPan = rVR.getTextureIdFromName (_TxPan);
|
||||||
_TxIdCanPan = rVR.getTextureIdFromName (_TxCanPan);
|
_TxIdCanPan = rVR.getTextureIdFromName (_TxCanPan);
|
||||||
if (ClientCfg.R2EDEnabled)
|
_TxIdPanR2 = rVR.getTextureIdFromName (_TxPanR2);
|
||||||
{
|
_TxIdCanPanR2 = rVR.getTextureIdFromName (_TxCanPanR2);
|
||||||
_TxIdPanR2 = rVR.getTextureIdFromName (_TxPanR2);
|
|
||||||
_TxIdCanPanR2 = rVR.getTextureIdFromName (_TxCanPanR2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const vector<CCtrlBase *> &rICL = CWidgetManager::getInstance()->getCtrlsUnderPointer ();
|
const vector<CCtrlBase *> &rICL = CWidgetManager::getInstance()->getCtrlsUnderPointer ();
|
||||||
|
@ -240,7 +223,6 @@ void CViewPointer::draw ()
|
||||||
if (pCB != NULL)
|
if (pCB != NULL)
|
||||||
{
|
{
|
||||||
if (drawResizer(pCB,col)) return;
|
if (drawResizer(pCB,col)) return;
|
||||||
//if (drawMover(pCB,col)) return;
|
|
||||||
if (drawColorPicker(pCB,col)) return;
|
if (drawColorPicker(pCB,col)) return;
|
||||||
if (drawRotate(pCB,col)) return;
|
if (drawRotate(pCB,col)) return;
|
||||||
if (drawPan(pCB,col)) return;
|
if (drawPan(pCB,col)) return;
|
||||||
|
@ -264,7 +246,7 @@ void CViewPointer::draw ()
|
||||||
setString(ucstring(tooltip));
|
setString(ucstring(tooltip));
|
||||||
sint32 texId = rVR.getTextureIdFromName ("curs_pick.tga");
|
sint32 texId = rVR.getTextureIdFromName ("curs_pick.tga");
|
||||||
|
|
||||||
CInterfaceGroup *stringCursor = IsMouseCursorHardware() ? _StringCursorHardware : _StringCursor;
|
CInterfaceGroup *stringCursor = hwMouse ? _StringCursorHardware : _StringCursor;
|
||||||
if (stringCursor)
|
if (stringCursor)
|
||||||
{
|
{
|
||||||
stringCursor->setX(_PointerX);
|
stringCursor->setX(_PointerX);
|
||||||
|
@ -272,7 +254,7 @@ void CViewPointer::draw ()
|
||||||
stringCursor->updateCoords();
|
stringCursor->updateCoords();
|
||||||
stringCursor->draw();
|
stringCursor->draw();
|
||||||
// if in hardware mode, force to draw the default cursor no matter what..
|
// if in hardware mode, force to draw the default cursor no matter what..
|
||||||
if (IsMouseCursorHardware())
|
if ( hwMouse )
|
||||||
drawCursor(texId, col, 0);
|
drawCursor(texId, col, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -357,8 +339,6 @@ void CViewPointer::draw ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (drawMover(pCB,col)) return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,7 +362,7 @@ void CViewPointer::draw ()
|
||||||
|
|
||||||
if (_StringMode && CWidgetManager::getInstance()->isMouseHandlingEnabled())
|
if (_StringMode && CWidgetManager::getInstance()->isMouseHandlingEnabled())
|
||||||
{
|
{
|
||||||
CInterfaceGroup *stringCursor = IsMouseCursorHardware() ? _StringCursorHardware : _StringCursor;
|
CInterfaceGroup *stringCursor = hwMouse ? _StringCursorHardware : _StringCursor;
|
||||||
if (stringCursor)
|
if (stringCursor)
|
||||||
{
|
{
|
||||||
stringCursor->setX(_PointerX);
|
stringCursor->setX(_PointerX);
|
||||||
|
@ -390,7 +370,7 @@ void CViewPointer::draw ()
|
||||||
stringCursor->updateCoords();
|
stringCursor->updateCoords();
|
||||||
stringCursor->draw();
|
stringCursor->draw();
|
||||||
// if in hardware mode, force to draw the default cursor no matter what..
|
// if in hardware mode, force to draw the default cursor no matter what..
|
||||||
if (IsMouseCursorHardware())
|
if ( hwMouse )
|
||||||
{
|
{
|
||||||
drawCursor(_TxIdDefault, col, 0);
|
drawCursor(_TxIdDefault, col, 0);
|
||||||
}
|
}
|
||||||
|
@ -403,150 +383,6 @@ void CViewPointer::draw ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool CViewPointer::drawResizer(CCtrlBase* pCB, CRGBA col)
|
|
||||||
{
|
|
||||||
CCtrlResizer *pCR = dynamic_cast<CCtrlResizer*>(pCB);
|
|
||||||
if (pCR != NULL)
|
|
||||||
{
|
|
||||||
CGroupContainer *parent = dynamic_cast<CGroupContainer *>(pCR->getParent());
|
|
||||||
if (parent && !parent->isLocked())
|
|
||||||
{
|
|
||||||
sint32 texID= -1;
|
|
||||||
switch(pCR->getRealResizerPos())
|
|
||||||
{
|
|
||||||
case Hotspot_BR:
|
|
||||||
case Hotspot_TL:
|
|
||||||
texID = _TxIdResizeBRTL;
|
|
||||||
break;
|
|
||||||
case Hotspot_BL:
|
|
||||||
case Hotspot_TR:
|
|
||||||
texID = _TxIdResizeBLTR;
|
|
||||||
break;
|
|
||||||
case Hotspot_MR:
|
|
||||||
case Hotspot_ML:
|
|
||||||
texID = _TxIdResizeLR;
|
|
||||||
break;
|
|
||||||
case Hotspot_TM:
|
|
||||||
case Hotspot_BM:
|
|
||||||
texID = _TxIdResizeTB;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
drawCursor(texID, col, false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool CViewPointer::drawMover(CCtrlBase* pCB, CRGBA col)
|
|
||||||
{
|
|
||||||
CCtrlMover *pCM = dynamic_cast<CCtrlMover*>(pCB);
|
|
||||||
if ((pCM != NULL) && (pCM->canMove() == true))
|
|
||||||
{
|
|
||||||
drawCursor(_TxIdMoveWindow, col, 0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool CViewPointer::drawRotate (CCtrlBase* pCB, CRGBA col)
|
|
||||||
{
|
|
||||||
CInterface3DScene *pI3DS = dynamic_cast<CInterface3DScene *>(pCB);
|
|
||||||
if (pI3DS != NULL)
|
|
||||||
{
|
|
||||||
drawCursor(_TxIdRotate, col, 0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool CViewPointer::drawScale (CCtrlBase* pCB, CRGBA col)
|
|
||||||
{
|
|
||||||
CInterface3DScene *pI3DS = dynamic_cast<CInterface3DScene *>(pCB);
|
|
||||||
if (pI3DS != NULL)
|
|
||||||
{
|
|
||||||
drawCursor(_TxIdScale, col, 0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool CViewPointer::drawColorPicker (CCtrlBase* pCB, CRGBA col)
|
|
||||||
{
|
|
||||||
CCtrlColPick *pCCP = dynamic_cast<CCtrlColPick*>(pCB);
|
|
||||||
if (pCCP != NULL)
|
|
||||||
{
|
|
||||||
drawCursor(_TxIdColPick, col, 0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool CViewPointer::drawLink (CCtrlBase* pCB, CRGBA col)
|
|
||||||
{
|
|
||||||
CCtrlLink *pCCP = dynamic_cast<CCtrlLink*>(pCB);
|
|
||||||
if (pCCP != NULL)
|
|
||||||
{
|
|
||||||
drawCursor(_TxIdColPick, col, 0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool CViewPointer::drawBrowse (CCtrlBase* pCB, CRGBA col)
|
|
||||||
{
|
|
||||||
CGroupHTML *pCGH = dynamic_cast<CGroupHTML *>(pCB);
|
|
||||||
if (pCGH != NULL)
|
|
||||||
{
|
|
||||||
if (pCGH->isBrowsing())
|
|
||||||
{
|
|
||||||
static uint8 rot =0;
|
|
||||||
drawCursor(_TxIdRotate, col, rot>>3);
|
|
||||||
rot = (rot+1) & 0x1f;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool CViewPointer::drawPan(CCtrlBase* pCB, NLMISC::CRGBA col)
|
|
||||||
{
|
|
||||||
CGroupMap *gm = dynamic_cast<CGroupMap *>(pCB);
|
|
||||||
if (gm)
|
|
||||||
{
|
|
||||||
sint32 texId;
|
|
||||||
if (ClientCfg.R2EDEnabled && R2::getEditor().getCurrentTool())
|
|
||||||
{
|
|
||||||
/** If cursor is set to anything other than the default cursor, use that cursor (because action can be performed on the map
|
|
||||||
* by the current tool
|
|
||||||
*/
|
|
||||||
if (_TxDefault == "curs_default.tga")
|
|
||||||
{
|
|
||||||
texId = gm->isPanning() ? _TxIdPanR2 : _TxIdCanPanR2;
|
|
||||||
}
|
|
||||||
else return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
texId = gm->isPanning() ? _TxIdPan : _TxIdCanPan;
|
|
||||||
}
|
|
||||||
drawCursor(texId, col, 0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
bool CViewPointer::drawCustom(CCtrlBase* pCB)
|
bool CViewPointer::drawCustom(CCtrlBase* pCB)
|
||||||
{
|
{
|
||||||
|
@ -565,11 +401,10 @@ bool CViewPointer::drawCustom(CCtrlBase* pCB)
|
||||||
tooltip = tooltipInfosList[1];
|
tooltip = tooltipInfosList[1];
|
||||||
nlinfo(tooltip.c_str());
|
nlinfo(tooltip.c_str());
|
||||||
setString(ucstring(tooltip));
|
setString(ucstring(tooltip));
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
||||||
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||||
sint32 texId = rVR.getTextureIdFromName (texName);
|
sint32 texId = rVR.getTextureIdFromName (texName);
|
||||||
|
|
||||||
CInterfaceGroup *stringCursor = IsMouseCursorHardware() ? _StringCursorHardware : _StringCursor;
|
CInterfaceGroup *stringCursor = hwMouse ? _StringCursorHardware : _StringCursor;
|
||||||
if (stringCursor)
|
if (stringCursor)
|
||||||
{
|
{
|
||||||
stringCursor->setX(_PointerX);
|
stringCursor->setX(_PointerX);
|
||||||
|
@ -577,7 +412,7 @@ bool CViewPointer::drawCustom(CCtrlBase* pCB)
|
||||||
stringCursor->updateCoords();
|
stringCursor->updateCoords();
|
||||||
stringCursor->draw();
|
stringCursor->draw();
|
||||||
// if in hardware mode, force to draw the default cursor no matter what..
|
// if in hardware mode, force to draw the default cursor no matter what..
|
||||||
if (IsMouseCursorHardware())
|
if ( hwMouse )
|
||||||
drawCursor(texId, col, 0);
|
drawCursor(texId, col, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -588,7 +423,6 @@ bool CViewPointer::drawCustom(CCtrlBase* pCB)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
||||||
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||||
sint32 texId = rVR.getTextureIdFromName (texName);
|
sint32 texId = rVR.getTextureIdFromName (texName);
|
||||||
drawCursor(texId, col, 0);
|
drawCursor(texId, col, 0);
|
||||||
|
@ -647,11 +481,10 @@ void CViewPointer::setString (const ucstring &str)
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
void CViewPointer::drawCursor(sint32 texId, NLMISC::CRGBA col, uint8 rot)
|
void CViewPointer::drawCursor(sint32 texId, NLMISC::CRGBA col, uint8 rot)
|
||||||
{
|
{
|
||||||
CInterfaceManager *pIM = CInterfaceManager::getInstance();
|
|
||||||
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
CViewRenderer &rVR = *CViewRenderer::getInstance();
|
||||||
sint32 xPos = _XReal + _OffsetX;
|
sint32 xPos = _XReal + _OffsetX;
|
||||||
sint32 yPos = _YReal + _OffsetY;
|
sint32 yPos = _YReal + _OffsetY;
|
||||||
if (!IsMouseCursorHardware())
|
if ( !hwMouse )
|
||||||
{
|
{
|
||||||
rVR.draw11RotFlipBitmap (_RenderLayer, xPos, yPos, rot, false, texId, col);
|
rVR.draw11RotFlipBitmap (_RenderLayer, xPos, yPos, rot, false, texId, col);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,13 +38,15 @@ namespace NLGUI
|
||||||
|
|
||||||
class CViewPointer : public CViewPointerBase
|
class CViewPointer : public CViewPointerBase
|
||||||
{
|
{
|
||||||
friend void SetMouseFreeLook ();
|
|
||||||
friend void SetMouseCursor (bool updateMousePos);
|
|
||||||
public:
|
public:
|
||||||
DECLARE_UI_CLASS( CViewPointerBase )
|
DECLARE_UI_CLASS( CViewPointer )
|
||||||
CViewPointer (const TCtorParam ¶m);
|
|
||||||
|
CViewPointer( const TCtorParam ¶m );
|
||||||
|
virtual ~CViewPointer(){}
|
||||||
|
|
||||||
bool parse (xmlNodePtr cur,CInterfaceGroup * parentGroup);
|
bool parse (xmlNodePtr cur,CInterfaceGroup * parentGroup);
|
||||||
void draw ();
|
void draw();
|
||||||
|
|
||||||
// Set cursor mode
|
// Set cursor mode
|
||||||
void setStringMode (bool stringCursor);
|
void setStringMode (bool stringCursor);
|
||||||
|
@ -53,7 +55,6 @@ public:
|
||||||
// Set cursor string
|
// Set cursor string
|
||||||
void setString (const ucstring &str);
|
void setString (const ucstring &str);
|
||||||
|
|
||||||
public:
|
|
||||||
// TEMP PATCH
|
// TEMP PATCH
|
||||||
void setCursor (const std::string &name)
|
void setCursor (const std::string &name)
|
||||||
{
|
{
|
||||||
|
@ -62,24 +63,25 @@ public:
|
||||||
}
|
}
|
||||||
// TEMP PATCH
|
// TEMP PATCH
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
/// Show or hide the pointer. Please, use SetMouseMode (bool freelook) instead.
|
/// Show or hide the pointer. Please, use SetMouseMode (bool freelook) instead.
|
||||||
void show(bool s) {_PointerVisible = s;}
|
void show(bool s) {_PointerVisible = s;}
|
||||||
|
|
||||||
/// Drawing helpers
|
static void setHWMouse( bool hw ){ hwMouse = hw; }
|
||||||
bool drawResizer (CCtrlBase* pCB, NLMISC::CRGBA col);
|
|
||||||
bool drawMover (CCtrlBase* pCB, NLMISC::CRGBA col);
|
|
||||||
bool drawRotate (CCtrlBase* pCB, NLMISC::CRGBA col);
|
|
||||||
bool drawScale (CCtrlBase* pCB, NLMISC::CRGBA col);
|
|
||||||
bool drawColorPicker (CCtrlBase* pCB, NLMISC::CRGBA col);
|
|
||||||
bool drawLink (CCtrlBase* pCB, NLMISC::CRGBA col);
|
|
||||||
bool drawBrowse (CCtrlBase* pCB, NLMISC::CRGBA col);
|
|
||||||
bool drawPan (CCtrlBase* pCB, NLMISC::CRGBA col);
|
|
||||||
bool drawCustom (CCtrlBase* pCB);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
/// Drawing helpers
|
||||||
|
virtual bool drawResizer(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; }
|
||||||
|
virtual bool drawRotate(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; }
|
||||||
|
virtual bool drawScale(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; }
|
||||||
|
virtual bool drawColorPicker(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; }
|
||||||
|
virtual bool drawLink(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; }
|
||||||
|
virtual bool drawBrowse(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; }
|
||||||
|
virtual bool drawPan(CCtrlBase* pCB, NLMISC::CRGBA col){ return false; }
|
||||||
|
virtual bool drawCustom(CCtrlBase* pCB);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
// Look of the cursor in different situation
|
// Look of the cursor in different situation
|
||||||
std::string _TxDefault;
|
std::string _TxDefault;
|
||||||
std::string _TxMoveWindow;
|
std::string _TxMoveWindow;
|
||||||
|
@ -123,12 +125,15 @@ private:
|
||||||
CInterfaceGroup *_StringCursorHardware;
|
CInterfaceGroup *_StringCursorHardware;
|
||||||
ucstring _ContextString;
|
ucstring _ContextString;
|
||||||
|
|
||||||
private:
|
|
||||||
// draw current cursor with the given texture, or, if in hardware mode, change the hardware cursor shape
|
// draw current cursor with the given texture, or, if in hardware mode, change the hardware cursor shape
|
||||||
void drawCursor(sint32 texId, NLMISC::CRGBA col, uint8 rot);
|
void drawCursor(sint32 texId, NLMISC::CRGBA col, uint8 rot);
|
||||||
|
|
||||||
|
private:
|
||||||
// set the string into frame for software or hardware version
|
// set the string into frame for software or hardware version
|
||||||
void setString (const ucstring &str, CInterfaceGroup *target);
|
void setString (const ucstring &str, CInterfaceGroup *target);
|
||||||
|
|
||||||
|
static bool hwMouse;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
161
code/ryzom/client/src/interface_v3/view_pointer_ryzom.cpp
Normal file
161
code/ryzom/client/src/interface_v3/view_pointer_ryzom.cpp
Normal file
|
@ -0,0 +1,161 @@
|
||||||
|
#include "view_pointer_ryzom.h"
|
||||||
|
#include "group_map.h"
|
||||||
|
#include "nel/gui/group_html.h"
|
||||||
|
#include "interface_3d_scene.h"
|
||||||
|
#include "../r2/editor.h"
|
||||||
|
#include "nel/gui/ctrl_col_pick.h"
|
||||||
|
#include "nel/gui/widget_manager.h"
|
||||||
|
#include "nel/gui/view_renderer.h"
|
||||||
|
#include "nel/gui/group_paragraph.h"
|
||||||
|
#include "nel/misc/xml_auto_ptr.h"
|
||||||
|
#include "nel/gui/group_container.h"
|
||||||
|
|
||||||
|
|
||||||
|
NLMISC_REGISTER_OBJECT( CViewBase, CViewPointerRyzom, std::string, "pointer");
|
||||||
|
|
||||||
|
CViewPointerRyzom::CViewPointerRyzom( const TCtorParam ¶m ) :
|
||||||
|
CViewPointer( param )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CViewPointerRyzom::~CViewPointerRyzom()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CViewPointerRyzom::forceLinking()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool CViewPointerRyzom::drawResizer(CCtrlBase* pCB, CRGBA col)
|
||||||
|
{
|
||||||
|
CCtrlResizer *pCR = dynamic_cast<CCtrlResizer*>(pCB);
|
||||||
|
if (pCR != NULL)
|
||||||
|
{
|
||||||
|
CGroupContainer *parent = dynamic_cast<CGroupContainer *>(pCR->getParent());
|
||||||
|
if (parent && !parent->isLocked())
|
||||||
|
{
|
||||||
|
sint32 texID= -1;
|
||||||
|
switch(pCR->getRealResizerPos())
|
||||||
|
{
|
||||||
|
case Hotspot_BR:
|
||||||
|
case Hotspot_TL:
|
||||||
|
texID = _TxIdResizeBRTL;
|
||||||
|
break;
|
||||||
|
case Hotspot_BL:
|
||||||
|
case Hotspot_TR:
|
||||||
|
texID = _TxIdResizeBLTR;
|
||||||
|
break;
|
||||||
|
case Hotspot_MR:
|
||||||
|
case Hotspot_ML:
|
||||||
|
texID = _TxIdResizeLR;
|
||||||
|
break;
|
||||||
|
case Hotspot_TM:
|
||||||
|
case Hotspot_BM:
|
||||||
|
texID = _TxIdResizeTB;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
drawCursor(texID, col, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool CViewPointerRyzom::drawRotate (CCtrlBase* pCB, CRGBA col)
|
||||||
|
{
|
||||||
|
CInterface3DScene *pI3DS = dynamic_cast<CInterface3DScene *>(pCB);
|
||||||
|
if (pI3DS != NULL)
|
||||||
|
{
|
||||||
|
drawCursor(_TxIdRotate, col, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool CViewPointerRyzom::drawScale (CCtrlBase* pCB, CRGBA col)
|
||||||
|
{
|
||||||
|
CInterface3DScene *pI3DS = dynamic_cast<CInterface3DScene *>(pCB);
|
||||||
|
if (pI3DS != NULL)
|
||||||
|
{
|
||||||
|
drawCursor(_TxIdScale, col, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool CViewPointerRyzom::drawColorPicker (CCtrlBase* pCB, CRGBA col)
|
||||||
|
{
|
||||||
|
CCtrlColPick *pCCP = dynamic_cast<CCtrlColPick*>(pCB);
|
||||||
|
if (pCCP != NULL)
|
||||||
|
{
|
||||||
|
drawCursor(_TxIdColPick, col, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool CViewPointerRyzom::drawLink (CCtrlBase* pCB, CRGBA col)
|
||||||
|
{
|
||||||
|
CCtrlLink *pCCP = dynamic_cast<CCtrlLink*>(pCB);
|
||||||
|
if (pCCP != NULL)
|
||||||
|
{
|
||||||
|
drawCursor(_TxIdColPick, col, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool CViewPointerRyzom::drawBrowse (CCtrlBase* pCB, CRGBA col)
|
||||||
|
{
|
||||||
|
CGroupHTML *pCGH = dynamic_cast<CGroupHTML *>(pCB);
|
||||||
|
if (pCGH != NULL)
|
||||||
|
{
|
||||||
|
if (pCGH->isBrowsing())
|
||||||
|
{
|
||||||
|
static uint8 rot =0;
|
||||||
|
drawCursor(_TxIdRotate, col, rot>>3);
|
||||||
|
rot = (rot+1) & 0x1f;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool CViewPointerRyzom::drawPan(CCtrlBase* pCB, NLMISC::CRGBA col)
|
||||||
|
{
|
||||||
|
CGroupMap *gm = dynamic_cast<CGroupMap *>(pCB);
|
||||||
|
if (gm)
|
||||||
|
{
|
||||||
|
sint32 texId;
|
||||||
|
if (ClientCfg.R2EDEnabled && R2::getEditor().getCurrentTool())
|
||||||
|
{
|
||||||
|
/** If cursor is set to anything other than the default cursor, use that cursor (because action can be performed on the map
|
||||||
|
* by the current tool
|
||||||
|
*/
|
||||||
|
if (_TxDefault == "curs_default.tga")
|
||||||
|
{
|
||||||
|
texId = gm->isPanning() ? _TxIdPanR2 : _TxIdCanPanR2;
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
texId = gm->isPanning() ? _TxIdPan : _TxIdCanPan;
|
||||||
|
}
|
||||||
|
drawCursor(texId, col, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
31
code/ryzom/client/src/interface_v3/view_pointer_ryzom.h
Normal file
31
code/ryzom/client/src/interface_v3/view_pointer_ryzom.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
#ifndef VIEW_POINTER_RYZOM_H
|
||||||
|
#define VIEW_POINTER_RYZOM_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "view_pointer.h"
|
||||||
|
|
||||||
|
class CViewPointerRyzom : public CViewPointer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_UI_CLASS( CViewPointerRyzom )
|
||||||
|
CViewPointerRyzom( const TCtorParam ¶m );
|
||||||
|
~CViewPointerRyzom();
|
||||||
|
|
||||||
|
static void forceLinking();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool drawResizer(CCtrlBase* pCB, NLMISC::CRGBA col);
|
||||||
|
bool drawRotate(CCtrlBase* pCB, NLMISC::CRGBA col);
|
||||||
|
bool drawScale(CCtrlBase* pCB, NLMISC::CRGBA col);
|
||||||
|
bool drawColorPicker(CCtrlBase* pCB, NLMISC::CRGBA col);
|
||||||
|
bool drawLink(CCtrlBase* pCB, NLMISC::CRGBA col);
|
||||||
|
bool drawBrowse(CCtrlBase* pCB, NLMISC::CRGBA col);
|
||||||
|
bool drawPan(CCtrlBase* pCB, NLMISC::CRGBA col);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue