bool LLFloaterGesture::updateItem( LLUUID const &aItem, LLSD const &aData )
{
	std::map< LLUUID, LLScrollListItem * >::iterator itr = mItems.find( aItem );

	if( mItems.end() == itr )
		return false;

	LLScrollListItem* pItem( itr->second );

	if( !pItem )
		return false;

	std::string	sDummyShortcut = "---";
	std::string	sDummyKey = "~~~";

	if( aData[ "columns" ][ COL_NAME ][ "value" ] != "" )
		pItem->getColumn( UI_COL_NAME )->setValue( aData[ "columns" ][ COL_NAME ][ "value" ] );
	
	if( aData[ "columns" ][ COL_SHORTCUT ][ "value" ] != sDummyShortcut )
		pItem->getColumn( UI_COL_SHORTCUT )->setValue( aData[ "columns" ][ COL_SHORTCUT ][ "value" ] );

	if( aData[ "columns" ][ COL_KEY ][ "value" ] != sDummyKey )
		pItem->getColumn( UI_COL_KEY )->setValue( aData[ "columns" ][ COL_KEY ][ "value" ] );
	
	pItem->getColumn( UI_COL_NAME )->setValue( aData[ "columns" ][ COL_NAME ][ "value" ] );

	LLFontGL::StyleFlags oStyle = LLGestureMgr::getInstance()->isGestureActive(aItem) ? LLFontGL::BOLD : LLFontGL::NORMAL;

	LLScrollListText *pTextItem = dynamic_cast< LLScrollListText* >( pItem->getColumn( UI_COL_NAME ) );

	if( pTextItem )
		pTextItem->setFontStyle( oStyle );

	return true;
}
// static
void LLFloaterMessageBuilder::onClickSend(void* user_data)
{
	LLFloaterMessageBuilder* floaterp = (LLFloaterMessageBuilder*)user_data;

	LLScrollListCtrl* scrollp = floaterp->getChild<LLScrollListCtrl>("net_list");
	LLScrollListItem* selected_itemp = scrollp->getFirstSelected();

	//if a specific circuit is selected, send it to that, otherwise send it to the current sim
	if(selected_itemp)
	{
		LLNetListItem* itemp = findNetListItem(selected_itemp->getUUID());
		LLScrollListText* textColumn = (LLScrollListText*)selected_itemp->getColumn(1);

		//why would you send data through a dead circuit?
		if(textColumn->getValue().asString() == "Dead")
		{
			LLFloaterChat::addChat(LLChat("No sending messages through dead circuits!"));
			return;
		}

		floaterp->mSpoofer.spoofMessage(itemp->mCircuitData->getHost(), floaterp->childGetText("message_edit"));
	}
	else
	{
		floaterp->mSpoofer.spoofMessage(gAgent.getRegionHost(), floaterp->childGetText("message_edit"));
	}
}
Пример #3
0
void	LLNameListCtrl::mouseOverHighlightNthItem( S32 target_index )
{
	S32 cur_index = getHighlightedItemInx();
	if (cur_index != target_index)
	{
		if(0 <= cur_index && cur_index < (S32)getItemList().size())
		{
			LLScrollListItem* item = getItemList()[cur_index];
			LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex));
			if(cell)
				cell->setTextWidth(cell->getTextWidth() + info_icon_size);
		}
		if(target_index != -1)
		{
			LLScrollListItem* item = getItemList()[target_index];
			LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex));
			if(cell)
				cell->setTextWidth(cell->getTextWidth() - info_icon_size);
		}
	}

	LLScrollListCtrl::mouseOverHighlightNthItem(target_index);
}
void LLFloaterVoiceEffect::refreshEffectList()
{
	if (!mVoiceEffectList)
	{
		return;
	}

	LLVoiceEffectInterface* effect_interface = LLVoiceClient::instance().getVoiceEffectInterface();
	if (!effect_interface)
	{
		mVoiceEffectList->setEnabled(false);
		return;
	}

	LL_DEBUGS("Voice")<< "Rebuilding Voice Morph list."<< LL_ENDL;

	// Preserve selected items and scroll position
	S32 scroll_pos = mVoiceEffectList->getScrollPos();
	uuid_vec_t selected_items;
	std::vector<LLScrollListItem*> items = mVoiceEffectList->getAllSelected();
	for(std::vector<LLScrollListItem*>::const_iterator it = items.begin(); it != items.end(); it++)
	{
		selected_items.push_back((*it)->getUUID());
	}

	mVoiceEffectList->deleteAllItems();

	{
		// Add the "No Voice Morph" entry
		LLSD element;

		element["id"] = LLUUID::null;
		element["columns"][NAME_COLUMN]["column"] = "name";
		element["columns"][NAME_COLUMN]["value"] = getString("no_voice_effect");
		element["columns"][NAME_COLUMN]["font"]["style"] = "BOLD";

		LLScrollListItem* sl_item = mVoiceEffectList->addElement(element, ADD_BOTTOM);
		// *HACK: Copied from llfloatergesture.cpp : ["font"]["style"] does not affect font style :(
		if(sl_item)
		{
			((LLScrollListText*)sl_item->getColumn(0))->setFontStyle(LLFontGL::BOLD);
		}
	}

	// Add each Voice Morph template, if there are any (template list includes all usable effects)
	const voice_effect_list_t& template_list = effect_interface->getVoiceEffectTemplateList();
	if (!template_list.empty())
	{
		for (voice_effect_list_t::const_iterator it = template_list.begin(); it != template_list.end(); ++it)
		{
			const LLUUID& effect_id = it->second;
			std::string effect_name = getString("effect_" + it->first); // will throw an error if the effect is not listed in the XML

			LLSD effect_properties = effect_interface->getVoiceEffectProperties(effect_id);

			// Tag the active effect.
			if (effect_id == LLVoiceClient::instance().getVoiceEffectDefault())
			{
				effect_name += " " + getString("active_voice_effect");
			}

			// Tag available effects that are new this session
			if (effect_properties["is_new"].asBoolean())
			{
				effect_name += " " + getString("new_voice_effect");
			}

			LLDate expiry_date = effect_properties["expiry_date"].asDate();
			bool is_template_only = effect_properties["template_only"].asBoolean();

			std::string font_style = "NORMAL";
			if (!is_template_only)
			{
				font_style = "BOLD";
			}

			LLSD element;
			element["id"] = effect_id;

			element["columns"][NAME_COLUMN]["column"] = "name";
			element["columns"][NAME_COLUMN]["value"] = effect_name;
			element["columns"][NAME_COLUMN]["font"]["style"] = font_style;

			element["columns"][1]["column"] = "expires";
			if (!is_template_only)
			{
				element["columns"][DATE_COLUMN]["value"] = expiry_date;
				element["columns"][DATE_COLUMN]["type"] = "date";
			}
			else {
				element["columns"][DATE_COLUMN]["value"] = getString("unsubscribed_voice_effect");
			}
//			element["columns"][DATE_COLUMN]["font"]["style"] = "NORMAL";

			LLScrollListItem* sl_item = mVoiceEffectList->addElement(element, ADD_BOTTOM);
			// *HACK: Copied from llfloatergesture.cpp : ["font"]["style"] does not affect font style :(
			if(sl_item)
			{
				LLFontGL::StyleFlags style = is_template_only ? LLFontGL::NORMAL : LLFontGL::BOLD;
				LLScrollListText* slt = dynamic_cast<LLScrollListText*>(sl_item->getColumn(0));
				llassert(slt);
				if (slt)
				{
					slt->setFontStyle(style);
				}
			}
		}
	}

	// Re-select items that were selected before, and restore the scroll position
	for(uuid_vec_t::iterator it = selected_items.begin(); it != selected_items.end(); it++)
	{
		mVoiceEffectList->selectByID(*it);
	}
	mVoiceEffectList->setScrollPos(scroll_pos);
	mVoiceEffectList->setEnabled(true);
}
Пример #5
0
void	LLNameListCtrl::mouseOverHighlightNthItem( S32 target_index )
{
	S32 cur_index = getHighlightedItemInx();
	if (cur_index != target_index)
	{
		bool is_mouse_over_name_cell = false;

		S32 mouse_x, mouse_y;
		LLUI::getMousePositionLocal(this, &mouse_x, &mouse_y);

		S32 column_index = getColumnIndexFromOffset(mouse_x);
		LLScrollListItem* hit_item = hitItem(mouse_x, mouse_y);
		if (hit_item && column_index == mNameColumnIndex)
		{
			// Get the name cell which is currently under the mouse pointer.
			LLScrollListCell* hit_cell = hit_item->getColumn(column_index);
			if (hit_cell)
			{
				is_mouse_over_name_cell = getCellRect(cur_index, column_index).pointInRect(mouse_x, mouse_y);
			}
		}

		// If the tool tip is visible and the mouse is over the currently highlighted item's name cell,
		// we should not reset the highlighted item index i.e. set mHighlightedItem = -1
		// and should not increase the width of the text inside the cell because it may
		// overlap the tool tip icon.
		if (LLToolTipMgr::getInstance()->toolTipVisible() && is_mouse_over_name_cell)
			return;

		if(0 <= cur_index && cur_index < (S32)getItemList().size())
		{
			LLScrollListItem* item = getItemList()[cur_index];
			if (item)
			{
				LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex));
				if (cell)
					cell->setTextWidth(cell->getTextWidth() + info_icon_size);
			}
			else
			{
				llwarns << "highlighted name list item is NULL" << llendl;
			}
		}
		if(target_index != -1)
		{
			LLScrollListItem* item = getItemList()[target_index];
			LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex));
			if (item)
			{
				if (cell)
					cell->setTextWidth(cell->getTextWidth() - info_icon_size);
			}
			else
			{
				llwarns << "target name item is NULL" << llendl;
			}
		}
	}

	LLScrollListCtrl::mouseOverHighlightNthItem(target_index);
}
void LLFloaterMessageBuilder::refreshNetList()
{
	LLScrollListCtrl* scrollp = getChild<LLScrollListCtrl>("net_list");
	// Update circuit data of net list items
	std::vector<LLCircuitData*> circuits = gMessageSystem->getCircuit()->getCircuitDataList();
	std::vector<LLCircuitData*>::iterator circuits_end = circuits.end();
	for(std::vector<LLCircuitData*>::iterator iter = circuits.begin(); iter != circuits_end; ++iter)
	{
		LLNetListItem* itemp = findNetListItem((*iter)->getHost());
		if(!itemp)
		{
			LLUUID id; id.generate();
			itemp = new LLNetListItem(id);
			sNetListItems.push_back(itemp);
		}
		itemp->mCircuitData = (*iter);
	}
	// Clear circuit data of items whose circuits are gone
	std::list<LLNetListItem*>::iterator items_end = sNetListItems.end();
	for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != items_end; ++iter)
	{
		if(std::find(circuits.begin(), circuits.end(), (*iter)->mCircuitData) == circuits.end())
			(*iter)->mCircuitData = NULL;
	}
	// Remove net list items that are totally useless now
	for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != sNetListItems.end();)
	{
		if((*iter)->mCircuitData == NULL)
			iter = sNetListItems.erase(iter);
		else ++iter;
	}
	// Update names of net list items
	items_end = sNetListItems.end();
	for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != items_end; ++iter)
	{
		LLNetListItem* itemp = (*iter);
		if(itemp->mAutoName)
		{
			if(itemp->mCircuitData)
			{
				LLViewerRegion* regionp = LLWorld::getInstance()->getRegion(itemp->mCircuitData->getHost());
				if(regionp)
				{
					std::string name = regionp->getName();
					if(name == "") name = llformat("%s (awaiting region name)", itemp->mCircuitData->getHost().getString().c_str());
					itemp->mName = name;
					itemp->mPreviousRegionName = name;
				}
				else
				{
					itemp->mName = itemp->mCircuitData->getHost().getString();
					if(itemp->mPreviousRegionName != "")
						itemp->mName.append(llformat(" (was %s)", itemp->mPreviousRegionName.c_str()));
				}
			}
			else
			{
				// an item just for an event queue, not handled yet
				itemp->mName = "Something else";
			}
		}
	}
	// Rebuild scroll list from scratch
	LLUUID selected_id = scrollp->getFirstSelected() ? scrollp->getFirstSelected()->getUUID() : LLUUID::null;
	S32 scroll_pos = scrollp->getScrollPos();
	scrollp->clearRows();
	for(std::list<LLNetListItem*>::iterator iter = sNetListItems.begin(); iter != items_end; ++iter)
	{
		LLNetListItem* itemp = (*iter);
		LLSD element;
		element["id"] = itemp->mID;
		LLSD& text_column = element["columns"][0];
		text_column["column"] = "text";
		text_column["value"] = itemp->mName + (itemp->mCircuitData->getHost() == gAgent.getRegionHost() ? " (main)" : "");

		LLSD& state_column = element["columns"][ 1];
		state_column["column"] = "state";
		state_column["value"] = "";

		LLScrollListItem* scroll_itemp = scrollp->addElement(element);
		BOOL has_live_circuit = itemp->mCircuitData && itemp->mCircuitData->isAlive();

		LLScrollListText* state = (LLScrollListText*)scroll_itemp->getColumn(1);

		if(has_live_circuit)
			state->setText(std::string("Alive"));
		else
			state->setText(std::string("Alive"));
	}
	if(selected_id.notNull()) scrollp->selectByID(selected_id);
	if(scroll_pos < scrollp->getItemCount()) scrollp->setScrollPos(scroll_pos);
}