Ejemplo n.º 1
0
BOOL LLFloaterAvatarList::handleKeyHere(KEY key, MASK mask)
{
	LLFloaterAvatarList* self = getInstance();
	LLScrollListItem* item = self->mAvatarList->getFirstSelected();
	if(item)
	{
		LLUUID agent_id = item->getUUID();
		if (( KEY_RETURN == key ) && (MASK_NONE == mask))
		{
			self->mFocusedAvatar = agent_id;
			self->focusOnCurrent();
			return TRUE;
		}
		else if (( KEY_RETURN == key ) && (MASK_CONTROL == mask))
		{
			LLAvatarListEntry* entry = self->getAvatarEntry(agent_id);
			if (entry)
			{
//				llinfos << "Trying to teleport to " << entry->getName() << " at " << entry->getPosition() << llendl;
				gAgent.teleportViaLocation(entry->getPosition());
			}
			return TRUE;
		}
	}

	if (( KEY_RETURN == key ) && (MASK_SHIFT == mask))
	{
		LLDynamicArray<LLUUID> ids = self->mAvatarList->getSelectedIDs();
		if (ids.size() > 0)
		{
			if (ids.size() == 1)
			{
				// Single avatar
				LLUUID agent_id = ids[0];

				// [Ansariel: Display name support]
				LLAvatarName avatar_name;
				if (LLAvatarNameCache::get(agent_id, &avatar_name))
				{
					gIMMgr->setFloaterOpen(TRUE);
					gIMMgr->addSession(LLCacheName::cleanFullName(avatar_name.getLegacyName()),IM_NOTHING_SPECIAL,agent_id);
				}
				// [Ansariel: Display name support]
			}
			else
			{
				// Group IM
				LLUUID session_id;
				session_id.generate();
				gIMMgr->setFloaterOpen(TRUE);
				gIMMgr->addSession("Avatars Conference", IM_SESSION_CONFERENCE_START, ids[0], ids);
			}
		}
	}
	return LLPanel::handleKeyHere(key, mask);
}
//static
void LLFloaterAvatarList::onClickAR(void *userdata)
{
	LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata;
 	LLScrollListItem *item = self->mAvatarList->getFirstSelected();
	if (item)
	{
		LLUUID agent_id = item->getUUID();
		LLAvatarListEntry *entry = self->getAvatarEntry(agent_id);
		if (entry)
		{
			LLFloaterReporter::showFromObject(entry->getID());
		}
	}
}
//static
void LLFloaterAvatarList::onClickMark(void *userdata)
{
	LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata;
	LLDynamicArray<LLUUID> ids = self->mAvatarList->getSelectedIDs();

	for (LLDynamicArray<LLUUID>::iterator itr = ids.begin(); itr != ids.end(); ++itr)
	{
		LLUUID avid = *itr;
		LLAvatarListEntry *entry = self->getAvatarEntry(avid);
		if (entry != NULL)
		{
			entry->toggleMark();
		}
	}
}
//static
void LLFloaterAvatarList::onClickTeleport(void* userdata)
{
	LLFloaterAvatarList *self = (LLFloaterAvatarList*)userdata;
 	LLScrollListItem *item = self->mAvatarList->getFirstSelected();
	if (item)
	{
		LLUUID agent_id = item->getUUID();
		LLAvatarListEntry *entry = self->getAvatarEntry(agent_id);
		if (entry)
		{
//			llinfos << "Trying to teleport to " << entry->getName() << " at " << entry->getPosition() << llendl;
			gAgent.teleportViaLocation(entry->getPosition());
		}
	}
}
void LLFloaterAvatarList::onSelectName(LLUICtrl*, void* userdata)
{
	LLFloaterAvatarList* self = (LLFloaterAvatarList*)userdata;

 	LLScrollListItem *item = self->mAvatarList->getFirstSelected();
	if (item)
	{
		LLUUID agent_id = item->getUUID();
		LLAvatarListEntry *entry = self->getAvatarEntry(agent_id);
		if (entry)
		{
			BOOL enabled = entry->isDrawn();
			self->childSetEnabled("focus_btn", enabled);
			self->childSetEnabled("prev_in_list_btn", enabled);
			self->childSetEnabled("next_in_list_btn", enabled);
		}
	}
}