Esempio n. 1
0
	virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params)
	{
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(pIM->getElementFromId(Params));
		if (pGC != NULL)
		{
			pGC->setUseGlobalAlpha(false);
			pGC->setContainerAlpha((uint8) 0);
			pGC->setContentAlpha((uint8) 255);
			pGC->setRolloverAlphaContainer((uint8) 255);
			pGC->setRolloverAlphaContent((uint8) 0);
		}
	}
Esempio n. 2
0
	virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
	{
		string sVDesk = getParam(Params,"vdesk");

		if (sVDesk.empty()) return;
		sint32 nVDesk;
		fromString(sVDesk, nVDesk);

		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		pIM->resetMode((uint8)nVDesk);

		PeopleInterraction.refreshActiveUserChats();
	}
Esempio n. 3
0
// ***************************************************************************
void	CGroupTab::addTab(CCtrlTabButton * tabB)
{
	addCtrl(tabB);
	_Setuped = false;
	updateCoords();
	selectFromCtrl(tabB);

	if(_HideOutTabs && !_AHOnChange.empty())
	{
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		pIM->runActionHandler(_AHOnChange, this, _ParamsOnChange);
	}
}
Esempio n. 4
0
	void execute (CCtrlBase * /* pCaller */, const std::string &sParams)
	{
		// Param
		uint mode;
		fromString(getParam (sParams, "mode"), mode);
		ucstring text;
		text.fromUtf8 (getParam (sParams, "text"));
//		text = getParam (sParams, "text");

		// Parse any tokens in the text
		if ( ! CInterfaceManager::parseTokens(text))
		{
			return;
		}

		// Find the base group
		if ((mode<CChatGroup::nbChatMode) && !text.empty())
		{
			if(text[0] == '/')
			{
				string str = text.toUtf8();
				string cmdWithArgs = str.substr(1);

				// Get the command name from the string, can contain spaces
				string cmd = cmdWithArgs.substr(0, cmdWithArgs.find(' '));
				if (cmdWithArgs.find('"') == 0)
				{
					string::size_type pos = cmdWithArgs.find('"', 1);
					if (string::npos != pos)
					{
						cmd = cmdWithArgs.substr(1, pos - 1);
					}
				}

				if ( NLMISC::ICommand::exists( cmd ) )
				{
					NLMISC::ICommand::execute( cmdWithArgs, g_log );
				} 
				else
				{
					CInterfaceManager *im = CInterfaceManager::getInstance();
					im->displaySystemInfo (ucstring(cmd+": ")+CI18N::get ("uiCommandNotExists"));
				}
			}
			else
			{
				ChatMngr.setChatMode((CChatGroup::TGroupType)mode);
				ChatMngr.chat(text, mode == CChatGroup::team);
			}
		}
	}
Esempio n. 5
0
	virtual void execute(CCtrlBase *pCaller, const std::string &/* sParams */)
	{
		CInterfaceManager *im = CInterfaceManager::getInstance();
		CCtrlBaseButton *but = dynamic_cast<CCtrlBaseButton *>(pCaller);
		if (but)
		{
			im->getDbProp("UI:TEMP:R2_DRAW_ARRAY")->setValueBool(but->getPushed());
			CToolCreateEntity *tce = dynamic_cast<CToolCreateEntity *>(getEditor().getCurrentTool());
			if (tce)
			{
				im->runActionHandler("r2ed_create_entity", NULL, "PaletteId=" + tce->getPaletteId());
			}
		}
	}
Esempio n. 6
0
//=============================================================================================================
void CChatTargetFilter::setTargetGroup(CChatGroup::TGroupType groupType, uint32 dynamicChannelDbIndex, bool allowUniverseWarning)
{
	_TargetPlayer.resize(0);
	if (_TargetPartyChat)
	{
		_TargetPartyChat->removeObserver(this);
		_TargetPartyChat = NULL;
	}
	_TargetGroup = groupType;
	_TargetDynamicChannelDbIndex = dynamicChannelDbIndex;

	if (_Chat)
	{
		// set the prompt
		const ucstring prompt("");
		_Chat->setPrompt(prompt + (ucchar) '>');

		// set the color
		string entry="UI:SAVE:CHAT:COLORS:";
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		const bool teamActive = pIM->getDbProp("SERVER:GROUP:0:NAME")->getValueBool();
		const bool guildActive = pIM->getDbProp("SERVER:GUILD:NAME")->getValueBool();
		switch(groupType)
		{
			case CChatGroup::dyn_chat: entry+="DYN:" + NLMISC::toString(dynamicChannelDbIndex); break;
			case CChatGroup::say:	entry+="SAY";	break;
			case CChatGroup::shout:	entry+="SHOUT";	break;
			case CChatGroup::team:	if(!teamActive) return; entry+="GROUP";	break;
			case CChatGroup::guild:	entry+="CLADE";	break;
			case CChatGroup::civilization:	entry+="CIVILIZATION";	break;
			case CChatGroup::territory:	entry+="TERRITORY";	break;
			case CChatGroup::universe:
				{
					entry+="UNIVERSE_NEW";
					if(allowUniverseWarning)
						pIM->getDbProp("UI:VARIABLES:UNIVERSE_CHANEL_WARNING_WANTED")->setValue64(1);
				}
				break;
			case CChatGroup::region:	entry+="REGION";	break;
			case CChatGroup::tell:	entry+="TELL";	break;
			case CChatGroup::system: return;	// return with no warning
			default:	nlwarning("unknown CChatGroup type");	return;
		}

		// read DB
		CInterfaceProperty prop;
		prop.readRGBA(entry.c_str()," ");
		_Chat->setPromptColor(prop.getRGBA());
	}
}
	virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
	{
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(pIM->getElementFromId("ui:interface", Params));
		if (pGC == NULL)
		{
			nlwarning("%s is not a container", Params.c_str());
			return;
		}
		if (!isContainerAuthorized(pGC)) return;

		pGC->setActive(true);
		pIM->setTopWindow(pGC);
	}
Esempio n. 8
0
	virtual void execute (CCtrlBase * /* pCaller */, const string& Params)
	{
		// get param
		string mode;
		fromString(getParam(Params, "mode"), mode);

		// run procedure
		vector<string> v;
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		if (mode == "R2TestMode")
			pIM->runProcedure ("proc_reset_r2ed_interface", NULL, v);
		else
			pIM->runProcedure("proc_reset_interface", NULL, v);
	}
Esempio n. 9
0
// --------------------------------------------------------------------------------------------------------------------
bool CViewPointer::drawCustom(CCtrlBase* pCB)
{
	string texName;
	uint8 rot;
	NLMISC::CRGBA col;
	if (pCB->getMouseOverShape(texName, rot, col))
	{
		if (texName[0] == '@')
		{
			const string &tooltipInfos = texName.substr(1);
			string tooltip;
			vector<string> tooltipInfosList;
			splitString(tooltipInfos, "@", tooltipInfosList);
			texName = tooltipInfosList[0];
			tooltip = tooltipInfosList[1];
			nlinfo(tooltip.c_str());
			setString(ucstring(tooltip));
			CInterfaceManager *pIM = CInterfaceManager::getInstance();
			CViewRenderer &rVR = pIM->getViewRenderer();
			sint32 texId = rVR.getTextureIdFromName (texName);

			CInterfaceGroup *stringCursor = IsMouseCursorHardware() ? _StringCursorHardware : _StringCursor;
			if (stringCursor)
			{
				stringCursor->setX(_PointerX);
				stringCursor->setY(_PointerY);
				stringCursor->updateCoords();
				stringCursor->draw();
				// if in hardware mode, force to draw the default cursor no matter what..
				if (IsMouseCursorHardware())
					drawCursor(texId, col, 0);
			}
			else
			{
				drawCursor(texId, col, 0);
			}
			return true;
		}
		else
		{
			CInterfaceManager *pIM = CInterfaceManager::getInstance();
			CViewRenderer &rVR = pIM->getViewRenderer();
			sint32 texId = rVR.getTextureIdFromName (texName);
			drawCursor(texId, col, 0);
			return true;
		}
	}
	return false;
}
Esempio n. 10
0
// ----------------------------------------------------------------------------
bool COptionsContainerInsertion::parse(xmlNodePtr cur)
{
	if (!CInterfaceOptions::parse (cur))
		return false;

	CInterfaceManager *pIM = CInterfaceManager::getInstance();
	CViewRenderer &rVR = pIM->getViewRenderer();
	TxId_T_Arrow =  rVR.getTextureIdFromName (getValStr("arrow_top"));
	TxId_B_Arrow =  rVR.getTextureIdFromName (getValStr("arrow_down"));
	TxId_L_Arrow =  rVR.getTextureIdFromName (getValStr("arrow_left"));
	TxId_R_Arrow =  rVR.getTextureIdFromName (getValStr("arrow_right"));
	TxId_InsertionBar =  rVR.getTextureIdFromName (getValStr("insertion_bar"));

	return true;
}
//**********************************************************************************
void CDBGroupListSheetMission::CSheetChildMission::init(CDBGroupListSheetText *pFather, uint index)
{
	// init my parent
	CSheetChild::init(pFather, index);

	// init the link to the database requesites
	CInterfaceManager *pIM = CInterfaceManager::getInstance();
	CCDBNodeLeaf *pNL;
	string sTmp = Ctrl->getSheet()+":PREREQ_STATE";
	sTmp = "LOCAL:" + sTmp.substr(6,sTmp.size());
	pNL = pIM->getDbProp(sTmp, false);
	nlassert(pNL != NULL);
	CurrentPreReqState.link ( sTmp.c_str() );

}
// ****************************************************************************
void CSessionBrowserImpl::on_joinSessionResult(NLNET::TSockId /* from */, uint32 /* userId */, TSessionId sessionId, uint32 result, const std::string &shardAddr, const RSMGR::TSessionPartStatus &participantStatus)
{
    nldebug("SB: on_joinSessionResult : result = %u; msg = '%s'", result, shardAddr.c_str());
    _LastJoinSessionResult = result;
    _LastJoinSessionId = sessionId;
    _LastJoinSessionShardAddr = shardAddr;
    _LastJoinSessionPartStatus = participantStatus;

    // trigger the far tp action
    if (result == 0)
    {
        CInterfaceManager *pIM = CInterfaceManager::getInstance();
        pIM->runActionHandler("on_connect_to_shard", NULL, string("cookie=")+NetMngr.getLoginCookie().toString()+"|fsAddr="+shardAddr);
    }
}
Esempio n. 13
0
	virtual void execute (CCtrlBase *pCaller, const string &Params)
	{
		string sTarget = getParam(Params,"target");

		if (sTarget.empty()) return;

		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CInterfaceElement *pIE;
		if (pCaller != NULL)
			pIE = pIM->getElementFromId(pCaller->getId(), sTarget);
		else
			pIE = pIM->getElementFromId(sTarget);
		CInterface3DCamera *pCam = dynamic_cast<CInterface3DCamera*>(pIE);
		if (pCam == NULL) return;
		pCam->reset();
	}
Esempio n. 14
0
// *********************************************************
void CPrimRender::setLook(const CPrimLook &look)
{
	//H_AUTO(R2_CPrimRender_setLook)
	if (look == _Look) return;
	_Look = look;
	if (!look.EdgeLook.WorldMapTexture.empty())
	{
		CInterfaceManager *im = CInterfaceManager::getInstance();
		CViewRenderer &vr = im->getViewRenderer();
		sint32 width, height;
		sint32 id = vr.getTextureIdFromName(look.EdgeLook.WorldMapTexture);
		vr.getTextureSizeFromId(id, width, height);
		_InvWorldTextureWidth = width > 0 ? 1.f / width : 0.f;
	}
	update();
}
Esempio n. 15
0
// ***************************************************************************
bool CMissionIconList::parse(xmlNodePtr cur)
{
	bool result = CInterfaceOptions::parse(cur);
	if (!result) return false;
	CInterfaceManager *im = CInterfaceManager::getInstance();
	CViewRenderer &vr = im->getViewRenderer();
	for(std::map<std::string, CInterfaceOptionValue>::iterator it = _ParamValue.begin(); it != _ParamValue.end(); ++it)
	{
		int index;
		if (fromString(it->first, index))
		{
			if (index > 255)
			{
				nlwarning("bad index for texture");
			}
			else
			{
				string sTmp = it->second.getValStr();
				string sBack, sIcon;
				if (sTmp.find('|') != string::npos)
				{
					sBack = sTmp.substr(0,sTmp.find('|'));
					sIcon = sTmp.substr(sTmp.find('|')+1,sTmp.size());
				}
				else
				{
					sBack = sTmp;
				}

				sint32 texID = vr.getTextureIdFromName(sBack);
				if (texID != -1)
				{
					IconBackTexID.resize(std::max((int) IconBackTexID.size(), index + 1), -1);
					IconBackTexID[index] = texID;
				}
				texID = vr.getTextureIdFromName(sIcon);
				if (texID != -1)
				{
					IconTexID.resize(std::max((int) IconTexID.size(), index + 1), -1);
					IconTexID[index] = texID;
				}
			}
		}
	}
	NLMISC::contReset(_ParamValue); // not needed anymore
	return true;
}
Esempio n. 16
0
// --------------------------------------------------------------------------------------------------------------------
void CViewPointer::drawCursor(sint32 texId, NLMISC::CRGBA col, uint8 rot)
{
	CInterfaceManager *pIM = CInterfaceManager::getInstance();
	CViewRenderer &rVR = pIM->getViewRenderer();
	sint32 xPos = _XReal + _OffsetX;
	sint32 yPos = _YReal + _OffsetY;
	if (!IsMouseCursorHardware())
	{
		rVR.draw11RotFlipBitmap (_RenderLayer, xPos, yPos, rot, false, texId, col);
	}
	else
	{
		// set new cursor for the hardware mouse
		std::string name = rVR.getTextureNameFromId(texId);
		Driver->setCursor(name, col, rot, (uint32) std::max(getX() - xPos, (sint32) 0), (uint32) std::max(getY() - yPos, (sint32) 0));
	}
}
// *************************************************************************************************
void CBotChatPageDynamicMission::begin()
{
	CBotChatPage::begin();
	// clear db entries for dynamic missions
	CInterfaceManager *im = CInterfaceManager::getInstance();
	invalidateMission();
	// clear all choices options
	for(uint k = 0; k < DYNAMIC_MISSION_NUM_CHOICES; ++k)
	{
		im->getDbProp(toString(DM_CHOICE "%d:TITLE", (int) k))->setValue32(0);
		for(uint l = 0; l < DYNAMIC_MISSION_MAX_NUM_OPTIONS; ++l)
		{
			im->getDbProp(toString(DM_CHOICE "%d:%d:TEXT", (int) k, (int) l))->setValue32(0);
		}
	}
	activateWindow(WIN_BOT_CHAT_PAGE_DYNAMIC_MISSION, true);
	CInterfaceGroup *ig = dynamic_cast<CInterfaceGroup *>(im->getElementFromId(WIN_BOT_CHAT_PAGE_DYNAMIC_MISSION));
	if (!ig)
	{
		std::fill(_ChoiceCB, _ChoiceCB + DYNAMIC_MISSION_NUM_CHOICES, (CDBGroupComboBox *) NULL);
	}
	else
	{
		for(uint k = 0; k < DYNAMIC_MISSION_NUM_CHOICES; ++k)
		{
			// get pointers on combo boxs
			_ChoiceCB[k] = dynamic_cast<CDBGroupComboBox *>(ig->getGroup(toString("choice%d", (int) k)));
			// empty the choice list (no datas received yet)
			if (_ChoiceCB[k])
			{
				_ChoiceCB[k]->setActive(false);
				_ChoiceCB[k]->resetTexts();
			}
			for(uint l = 0; l < DYNAMIC_MISSION_MAX_NUM_OPTIONS; ++l)
			{
				_TextReceived[k][l] = false;
			}
		}
	}
	std::fill(_Choice, _Choice + DYNAMIC_MISSION_NUM_CHOICES, -1);
	for(uint k = 0; k < DYNAMIC_MISSION_NUM_CHOICES; ++k)
	{
		im->getDbProp(toString("UI:TEMP:DYNAMIC_MISSION:CHOICE%d", (int) k))->setValue32(-1);
	}
}
Esempio n. 18
0
	virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
	{
		uint32 i;
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		const vector<CInterfaceManager::SMasterGroup> &rVMG = pIM->getAllMasterGroup();
		for (uint32 nMasterGroup = 0; nMasterGroup < rVMG.size(); nMasterGroup++)
		{
			const CInterfaceManager::SMasterGroup &rMG = rVMG[nMasterGroup];
			const vector<CInterfaceGroup*> &rV = rMG.Group->getGroups();
			// Active all containers (that can be activated)
			for (i = 0; i < rV.size(); ++i)
			{
				CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(rV[i]);
				if (pGC == NULL) continue;
				if (pGC->isSavable())
				{
					// Yoyo: DO NOT force activation of containers who don't want to save their Active state.
					// Usually driven by server.
					if(pGC->isActiveSavable())
						pGC->setActive(true);
				}
			}

			pIM->checkCoords();
			pIM->getMasterGroup((uint8)nMasterGroup).centerAllContainers();

			// Pop in and close all containers
			for (i = 0; i < rV.size(); ++i)
			{
				CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(rV[i]);
				if (pGC == NULL) continue;
				if (pGC->isSavable())
				{
					if (pGC->isPopable()&&pGC->isPopuped())
						pGC->popin();

					// Can close ?
					if (pGC->isOpenable()&&pGC->isOpen())
						pGC->close();
				}
			}

			pIM->getMasterGroup((uint8)nMasterGroup).deactiveAllContainers();
		}
	}
	// Init the action manager
	void init ()
	{
		// Get the current edit box
		_GroupEdit = NULL;
		_LooseSelection = false;

		// Get the interface manager
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		if (pIM)
		{
			CCtrlBase *basectrl = pIM->getCaptureKeyboard();
			if (basectrl)
				_GroupEdit = dynamic_cast<CGroupEditBox*>(basectrl);
		}

		if (_GroupEdit)
			_GroupEdit->stopParentBlink();
	}
Esempio n. 20
0
void resetTextContext (const char *font, bool resetInterfaceManager)
{
	if (TextContext != NULL)
		Driver->deleteTextContext(TextContext);
	TextContext = Driver->createTextContext(CPath::lookup(font));
	if (TextContext != NULL)
		TextContext->setKeep800x600Ratio(false);
	else
		nlerror("Cannot create a TextContext with font %s.", font);

	// Reset the text indexes
	if (resetInterfaceManager)
	{
		CInterfaceManager *im = CInterfaceManager::getInstance();
		CViewRenderer::setTextContext( TextContext );
		im->resetTextIndex();
	}
}
Esempio n. 21
0
CViewRadar::CViewRadar(const TCtorParam &param)
	: CViewBase(param)
{
	CInterfaceManager *pIM = CInterfaceManager::getInstance();
	CCDBNodeLeaf *pUIMI = pIM->getDbProp( "UI:SAVE:INSCENE:FRIEND:MISSION_ICON" );
	if (pUIMI)
	{
		ICDBNode::CTextId textId;
		pUIMI->addObserver( &_MissionIconsObs, textId);
	}

	CCDBNodeLeaf *pUIMMI = pIM->getDbProp( "UI:SAVE:INSCENE:FRIEND:MINI_MISSION_ICON" );
	if (pUIMMI)
	{
		ICDBNode::CTextId textId;
		pUIMMI->addObserver( &_MiniMissionSpotsObs, textId);
	}
}
// ------------------------------------------------------------------------------------------------
bool CCharacter3D::init (UScene *pScene)
{
//	DEBUG_DumpClothes();

	if (_Scene != NULL) return true;
	_Scene = pScene;

	_PlayListManager = _Scene->createPlayListManager();
	if (!_PlayListManager)
	{
		nlwarning ("CCharacter3D : couldn't create playlist manager");
		return false;
	}


	// ANIMATIONS
	CInterfaceManager *pIM = CInterfaceManager::getInstance();
	COptionsAnimationSet	*pOAS= dynamic_cast<COptionsAnimationSet*>(pIM->getOptions("character_animations"));
	if(!pOAS || !pOAS->AnimationSet)
	{
		nlwarning("Not found <options> 'character_animations', or not of type 'animation_set'");
		return false;
	}

	if(ClientCfg.Light || !ClientCfg.EAMEnabled)
		_CopyAnim = false;

	// Retrieve the animation info
	if(!_CopyAnim)
	{
		resetAnimation (pOAS->AnimationSet);
		_AnimMale= pOAS->AnimMale;
		_AnimFemale= pOAS->AnimFemale;
	}
	else
	{
		if (EAM)
		{
			resetAnimation (EAM->getAnimationSet());
		}
	}

	return true;
}
	virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
	{
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		if(pIM == NULL) return;
		CEntityCL *selection = EntitiesMngr.entity(UserEntity->selection());

		if(UserEntity->mode()==MBEHAV::COMBAT
		|| UserEntity->mode()==MBEHAV::COMBAT_FLOAT)
		{
			return; // Cant exchange
		}
		// Mount
		else
		{
			if (selection && selection->properties().canExchangeItem())
				if (!UserEntity->isBusy())
					pIM->runActionHandler("context_exchange",NULL);
		}
	}
Esempio n. 24
0
// ***************************************************************************
int CGroupTab::luaAddTab(CLuaState &ls)
{
	CLuaIHM::checkArgCount(ls, "CGroupTab::addTab", 1);
	CCtrlTabButton *tabB = dynamic_cast<CCtrlTabButton *>(CLuaIHM::getUIOnStack(ls, 1));
	if (tabB)
	{
		// don't use addTab to avoid selection of new tab
		addCtrl(tabB);

		_Setuped = false;
		updateCoords();

		if(_HideOutTabs && !_AHOnChange.empty())
		{
			CInterfaceManager *pIM = CInterfaceManager::getInstance();
			pIM->runActionHandler(_AHOnChange, this, _ParamsOnChange);
		}
	}
	return 0;
}
	virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
	{
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(pIM->getElementFromId("ui:interface", Params));
		if (pGC == NULL)
		{
			nlwarning("%s is not a container", Params.c_str());
			return;
		}
		if (!pGC->isPopable())
		{
			nlwarning("%s cannot be popup/popin", Params.c_str());
			return;
		}
		if (!isContainerAuthorized(pGC)) return;
		if (pGC->isPopuped())
			pIM->runActionHandler("popin", NULL, Params);
		else
			pIM->runActionHandler("popup", NULL, Params);
	}
	virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
	{
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(pIM->getElementFromId("ui:interface", Params));
		if (pGC == NULL)
		{
			nlwarning("%s is not a container", Params.c_str());
			return;
		}
		if (!pGC->isPopable())
		{
			nlwarning("%s cannot be popup", Params.c_str());
			return;
		}
		if (!isContainerAuthorized(pGC)) return;
		//
		pGC->popup();
		//
		pIM->setCapturePointerLeft(NULL);
		pIM->setCapturePointerRight(NULL);
	}
Esempio n. 27
0
	virtual void execute (CCtrlBase *pCaller, const string &Params)
	{
		CInterfaceManager *im = CInterfaceManager::getInstance();

		// get the parent container
		CGroupContainer *gc = NULL;
		CCtrlBase *cb = pCaller;
		while (cb)
		{
			gc = dynamic_cast<CGroupContainer *>(cb);
			if (gc) break;
			cb = cb->getParent();
		}

		// update GC_POPUP flag
		if (gc)
		{
			im->getDbProp("UI:VARIABLES:GC_POPUP")->setValue64((gc->isPopuped() || gc->getLayerSetup() == 0) ? 1 : 0);
		}
		else
		{
			im->getDbProp("UI:VARIABLES:GC_POPUP")->setValue64(0);
		}

		// update GC_HAS_HELP flag
		if(gc && !gc->getHelpPage().empty())
		{
			im->getDbProp("UI:VARIABLES:GC_HAS_HELP")->setValue64(1);
		}
		else
		{
			im->getDbProp("UI:VARIABLES:GC_HAS_HELP")->setValue64(0);
		}

		// open the menu
		if (CDBCtrlSheet::getDraggedSheet() == NULL)
		{
			CInterfaceManager::getInstance()->enableModalWindow (pCaller, getParam(Params, "menu"));
		}
	}
// ***************************************************************************************
void CBotChatPageMission::selectMission(CDBCtrlSheet *missionSheet)
{
	if (!missionSheet) return;
	if (missionSheet->getGrayed()) return;
	// show the dialog with good infos
	CInterfaceManager *im = CInterfaceManager::getInstance();
	CGroupContainer *gc = dynamic_cast<CGroupContainer *>(im->getElementFromId(WIN_BOT_CHAT_ACCEPT_MISSION));

	// copy text id for title
	{
		CCDBNodeLeaf *titleTextLeaf = dynamic_cast<CCDBNodeLeaf *>(missionSheet->getRootBranch()->getNode(ICDBNode::CTextId("TEXT")));
		//
		CViewTextID	*viewTitleTextID = dynamic_cast<CViewTextID *>(gc->getView("text_title_id"));
		if (viewTitleTextID && titleTextLeaf)
			viewTitleTextID->setTextId(titleTextLeaf->getValue32());
	}

	// copy text id for details
	CCDBNodeLeaf *detailTextLeaf = dynamic_cast<CCDBNodeLeaf *>(missionSheet->getRootBranch()->getNode(ICDBNode::CTextId("DETAIL_TEXT")));
	//
	CViewTextID	*viewTextID = dynamic_cast<CViewTextID *>(gc->getView("text_id"));
	if(viewTextID && detailTextLeaf)
	{
		viewTextID->setTextId(detailTextLeaf->getValue32());
	}
	// copy icon
	CCDBNodeLeaf *iconLeaf = im->getDbProp("UI:TEMP:MISSION:ICON");
	if (iconLeaf)
	{
		iconLeaf->setValue32(missionSheet->getSheetId());
	}
	//
	if (!gc) return;
	im->setTopWindow(gc);
	gc->setActive(true);
	gc->updateCoords();
	gc->center();
	gc->setModalParentList(WIN_BOT_CHAT_PAGE_MISSION);
	_CurrSel = missionSheet;
}
Esempio n. 29
0
//---------------------------------------------------
// load :
// To call after a read from a stream to re-initialize the entity.
//---------------------------------------------------
void CPlayerR2CL::load()	// virtual
{
	CInterfaceManager *IM = CInterfaceManager::getInstance ();

	// If the entity should be in the world already
	if(_First_Pos == false)
	{
		// Insert the primitive into the world.
		if(_Primitive)
			_Primitive->insertInWorldImage(dynamicWI);
		// Insert the entity into PACS
		pacsPos(pos());
	}

	// update
	if(!_WaitForAppearance)
	{
		// Visual properties A
		sint64 prop = IM->getDbProp("SERVER:Entities:E"+toString("%d", _Slot)+":P"+toString("%d", CLFECOMMON::PROPERTY_VPA))->getValue64();
		updateVisualPropertyVpa(0, prop);	// Vpa udapte vpb and vpc too.
	}
}// load //
Esempio n. 30
0
	virtual void execute (CCtrlBase *pCaller, const string &Params)
	{
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		string target = getParam (Params, "target");
		CGroupEditBox *geb;
		if (pCaller == NULL)
			geb = dynamic_cast<CGroupEditBox *>(pIM->getElementFromId (target));
		else
			geb = dynamic_cast<CGroupEditBox *>(pIM->getElementFromId (pCaller->getId(), target));
		if (geb == NULL)
		{
			nlwarning("<CAHSetKeyboardFocus::execute> Can't get target edit box %s, or bad type", target.c_str());
			return;
		}
		pIM->setCaptureKeyboard(geb);
		string selectAllStr = getParam (Params, "select_all");
		bool selectAll = CInterfaceElement::convertBool(selectAllStr.c_str());
		if (selectAll)
		{
			geb->setSelectionAll();
		}
	}