LLTeleportHistoryFlatItem*
LLTeleportHistoryFlatItemStorage::getFlatItemForPersistentItem (
	LLTeleportHistoryPanel::ContextMenu *context_menu,
	const LLTeleportHistoryPersistentItem& persistent_item,
	const S32 cur_item_index,
	const std::string &hl)
{
	// <FS:Ansariel> Extended TP history
	LLVector3 local_pos((F32)fmod(persistent_item.mGlobalPos.mdV[VX], (F64)REGION_WIDTH_METERS),
						(F32)fmod(persistent_item.mGlobalPos.mdV[VY], (F64)REGION_WIDTH_METERS),
						(F32)persistent_item.mGlobalPos.mdV[VZ]);
	// </FS:Ansariel>

	LLTeleportHistoryFlatItem* item = NULL;
	if ( cur_item_index < (S32) mItems.size() )
	{
		item = mItems[cur_item_index].get();
		if (item->getParent() == NULL)
		{
			item->setIndex(cur_item_index);
			item->setRegionName(persistent_item.mTitle);
			item->setDate(persistent_item.mDate);
			// <FS:Ansariel> Extended TP history
			item->setLocalPos(local_pos);
			// </FS:Ansariel>
			item->setHighlightedText(hl);
			item->setVisible(TRUE);
			item->updateTitle();
			item->updateTimestamp();
		}
		else
		{
			// Item already added to parent
			item = NULL;
		}
	}

	if ( !item )
	{
		item = new LLTeleportHistoryFlatItem(cur_item_index,
											 context_menu,
											 persistent_item.mTitle,
											 persistent_item.mDate,
											 // <FS:Ansariel> Extended TP history
											 local_pos,
											 // </FS:Ansariel>
											 hl);
		mItems.push_back(item->getItemHandle());
	}

	return item;
}
Example #2
0
void LLTeleportHistoryFlatItemStorage::removeItem(LLTeleportHistoryFlatItem* item)
{
	if (item)
	{
		flat_item_list_t::iterator item_iter = std::find(mItems.begin(),
														 mItems.end(),
														 item->getItemHandle());
		if (item_iter != mItems.end())
		{
			mItems.erase(item_iter);
		}
	}
}
Example #3
0
void LLTeleportHistoryFlatItemStorage::purge()
{
	for ( flat_item_list_t::iterator
			  it = mItems.begin(),
			  it_end = mItems.end();
		  it != it_end; ++it )
	{
		LLHandle <LLTeleportHistoryFlatItem> item_handle = *it;
		if ( !item_handle.isDead() && item_handle.get()->getParent() == NULL )
		{
			item_handle.get()->die();
		}
	}
	mItems.clear();
}
Example #4
0
LLTeleportHistoryFlatItem*
LLTeleportHistoryFlatItemStorage::getFlatItemForPersistentItem (
	LLTeleportHistoryPanel::ContextMenu *context_menu,
	const LLTeleportHistoryPersistentItem& persistent_item,
	const S32 cur_item_index,
	const std::string &hl)
{
	LLTeleportHistoryFlatItem* item = NULL;
	if ( cur_item_index < (S32) mItems.size() )
	{
		item = mItems[cur_item_index].get();
		if (item->getParent() == NULL)
		{
			item->setIndex(cur_item_index);
			item->setRegionName(persistent_item.mTitle);
			item->setHighlightedText(hl);
			item->setVisible(TRUE);
			item->updateTitle();
		}
		else
		{
			// Item already added to parent
			item = NULL;
		}
	}

	if ( !item )
	{
		item = new LLTeleportHistoryFlatItem(cur_item_index,
											 context_menu,
											 persistent_item.mTitle,
											 hl);
		mItems.push_back(item->getItemHandle());
	}

	return item;
}