Пример #1
0
BOOL LLNetMap::handleToolTipAgent(const LLUUID& avatar_id)
{
	LLAvatarName av_name;
	if (avatar_id.isNull() || !LLAvatarNameCache::get(avatar_id, &av_name))
	{
		return FALSE;
	}

	// only show tooltip if same inspector not already open
	LLFloater* existing_inspector = LLFloaterReg::findInstance("inspect_avatar");
	if (!existing_inspector
		|| !existing_inspector->getVisible()
		|| existing_inspector->getKey()["avatar_id"].asUUID() != avatar_id)
	{
		LLInspector::Params p;
		p.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
		p.message(av_name.getCompleteName());
		p.image.name("Inspector_I");
		p.click_callback(boost::bind(showAvatarInspector, avatar_id));
		p.visible_time_near(6.f);
		p.visible_time_far(3.f);
		p.delay_time(0.35f);
		p.wrap(false);

		LLToolTipMgr::instance().show(p);
	}
	return TRUE;
}
Пример #2
0
BOOL LLInspect::handleToolTip(S32 x, S32 y, MASK mask)
{
	BOOL handled = FALSE;


	//delegate handling of tooltip to the hovered child
	LLView* child_handler = childFromPoint(x,y);
	if (child_handler && !child_handler->getToolTip().empty())// show tooltip if a view has non-empty tooltip message
	{
		//build LLInspector params to get correct tooltip setting, etc. background image
		LLInspector::Params params;
		params.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
		params.message = child_handler->getToolTip();
		//set up delay if there is no visible tooltip at this moment
		params.delay_time =  LLToolTipMgr::instance().toolTipVisible() ? 0.f : LLUI::sSettingGroups["config"]->getF32( "ToolTipDelay" );
		LLToolTipMgr::instance().show(params);
		handled = TRUE;
	}
	return handled;
}
Пример #3
0
BOOL LLNetMap::handleToolTipAgent(const LLUUID& avatar_id)
{
	LLAvatarName av_name;
	if (avatar_id.isNull() || !LLAvatarNameCache::get(avatar_id, &av_name))
	{
		return FALSE;
	}

	// only show tooltip if same inspector not already open
	LLFloater* existing_inspector = LLFloaterReg::findInstance("inspect_avatar");
	if (!existing_inspector
		|| !existing_inspector->getVisible()
		|| existing_inspector->getKey()["avatar_id"].asUUID() != avatar_id)
	{
		LLInspector::Params p;
		p.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
		
		// Add distance to avatars in hovertip for minimap
		if (avatar_id != gAgent.getID())
		{
			LLVector3d myPosition = gAgent.getPositionGlobal();
			LLVector3d otherPosition = mClosestAgentPosition;
			LLVector3d delta = otherPosition - myPosition;
			F32 distance = (F32)delta.magVec();

			// If avatar is >=1020, the value for Z might be returned as AVATAR_UNKNOWN_Z_OFFSET
			bool isHigher1020mBug = (otherPosition[VZ] == AVATAR_UNKNOWN_Z_OFFSET);

			// Ansariel: Try to get distance from the nearby people panel
			//           aka radar when above 1020m.
			if (isHigher1020mBug)
			{
				LLPanel* panel_people = LLFloaterSidePanelContainer::getPanel("people", "panel_people");
				if (panel_people != NULL)
				{
					LLAvatarListItem* avatar_list_item = ((LLPanelPeople*)panel_people)->getNearbyList()->getAvatarListItem(avatar_id);
					if (avatar_list_item != NULL)
					{
						F32 radar_distance = avatar_list_item->getRange();

						if (radar_distance > -1.f)
						{
							distance = radar_distance;
							isHigher1020mBug = false;
						}
					}
				}
			}

			LLStringUtil::format_map_t args;

			if (!isHigher1020mBug)
			{
				args["DISTANCE"] = llformat("%.02f", distance);
			}
			else
			{
				static LLCachedControl<F32> farClip(gSavedSettings, "RenderFarClip");
				args["DISTANCE"] = llformat("> %.02f", F32(farClip));
			}
			std::string distanceLabel = LLTrans::getString("minimap_distance");
			LLStringUtil::format(distanceLabel, args);
			p.message(av_name.getCompleteName() + "\n" + distanceLabel);
		}
		else
		{
			p.message(av_name.getCompleteName());
		}
		
		// Ansariel: Get rid of the useless and clumsy I-button on the hovertip
		//p.image.name("Inspector_I");
		p.click_callback(boost::bind(showAvatarInspector, avatar_id));
		p.visible_time_near(6.f);
		p.visible_time_far(3.f);
		p.delay_time(0.35f);
		p.wrap(false);

		LLToolTipMgr::instance().show(p);
	}
	return TRUE;
}
Пример #4
0
BOOL LLToolPie::handleTooltipObject( LLViewerObject* hover_object, std::string line, std::string tooltip_msg)
{
	if ( hover_object->isHUDAttachment() )
	{
		// no hover tips for HUD elements, since they can obscure
		// what the HUD is displaying
		return TRUE;
	}
	
	if ( hover_object->isAttachment() )
	{
		// get root of attachment then parent, which is avatar
		LLViewerObject* root_edit = hover_object->getRootEdit();
		if (!root_edit)
		{
			// Strange parenting issue, don't show any text
			return TRUE;
		}
		hover_object = (LLViewerObject*)root_edit->getParent();
		if (!hover_object)
		{
			// another strange parenting issue, bail out
			return TRUE;
		}
	}
	
	line.clear();
	if (hover_object->isAvatar())
	{
		// only show tooltip if same inspector not already open
		LLFloater* existing_inspector = LLFloaterReg::findInstance("inspect_avatar");
		if (!existing_inspector 
			|| !existing_inspector->getVisible()
			|| existing_inspector->getKey()["avatar_id"].asUUID() != hover_object->getID())
		{
			std::string avatar_name;
			LLNameValue* firstname = hover_object->getNVPair("FirstName");
			LLNameValue* lastname =  hover_object->getNVPair("LastName");
			if (firstname && lastname)
			{
				avatar_name = llformat("%s %s", firstname->getString(), lastname->getString());
			}
			else
			{
				avatar_name = LLTrans::getString("TooltipPerson");
			}
			
			// *HACK: We may select this object, so pretend it was clicked
			mPick = mHoverPick;
			LLInspector::Params p;
			p.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
			p.message(avatar_name);
			p.image.name("Inspector_I");
			p.click_callback(boost::bind(showAvatarInspector, hover_object->getID()));
			p.visible_time_near(6.f);
			p.visible_time_far(3.f);
			p.delay_time(0.35f);
			p.wrap(false);
			
			LLToolTipMgr::instance().show(p);
		}
	}
	else
	{
		//
		//  We have hit a regular object (not an avatar or attachment)
		// 
		
		//
		//  Default prefs will suppress display unless the object is interactive
		//
		bool show_all_object_tips =
		(bool)gSavedSettings.getBOOL("ShowAllObjectHoverTip");			
		LLSelectNode *nodep = LLSelectMgr::getInstance()->getHoverNode();
		
		// only show tooltip if same inspector not already open
		LLFloater* existing_inspector = LLFloaterReg::findInstance("inspect_object");
		if (nodep &&
			(!existing_inspector 
			 || !existing_inspector->getVisible()
			 || existing_inspector->getKey()["object_id"].asUUID() != hover_object->getID()))
		{

			// Add price to tooltip for items on sale
			bool for_sale = for_sale_selection(nodep);
			if(for_sale)
			{
				LLStringUtil::format_map_t args;
				S32 price = nodep->mSaleInfo.getSalePrice();
				args["[AMOUNT]"] = LLResMgr::getInstance()->getMonetaryString(price);
				tooltip_msg.append(LLTrans::getString("TooltipPrice", args) );
			}

			if (nodep->mName.empty())
			{
				tooltip_msg.append(LLTrans::getString("TooltipNoName"));
			}
			else
			{
				tooltip_msg.append( nodep->mName );
			}
			
			bool has_media = false;
			bool is_time_based_media = false;
			bool is_web_based_media = false;
			bool is_media_playing = false;
			bool is_media_displaying = false;
			
			// Does this face have media?
			const LLTextureEntry* tep = hover_object->getTE(mHoverPick.mObjectFace);
			
			if(tep)
			{
				has_media = tep->hasMedia();
				const LLMediaEntry* mep = has_media ? tep->getMediaData() : NULL;
				if (mep)
				{
					viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID());
					LLPluginClassMedia* media_plugin = NULL;
					
					if (media_impl.notNull() && (media_impl->hasMedia()))
					{
						is_media_displaying = true;
						//LLStringUtil::format_map_t args;
						
						media_plugin = media_impl->getMediaPlugin();
						if(media_plugin)
						{	
							if(media_plugin->pluginSupportsMediaTime())
							{
								is_time_based_media = true;
								is_web_based_media = false;
								//args["[CurrentURL]"] =  media_impl->getMediaURL();
								is_media_playing = media_impl->isMediaPlaying();
							}
							else
							{
								is_time_based_media = false;
								is_web_based_media = true;
								//args["[CurrentURL]"] =  media_plugin->getLocation();
							}
							//tooltip_msg.append(LLTrans::getString("CurrentURL", args));
						}
					}
				}
			}
			

			// Avoid showing tip over media that's displaying unless it's for sale
			// also check the primary node since sometimes it can have an action even though
			// the root node doesn't
			
			bool needs_tip = (!is_media_displaying || 
				              for_sale) &&
				(has_media || 
				 needs_tooltip(nodep) || 
				 needs_tooltip(LLSelectMgr::getInstance()->getPrimaryHoverNode()));
			
			if (show_all_object_tips || needs_tip)
			{
				// We may select this object, so pretend it was clicked
				mPick = mHoverPick;
				LLInspector::Params p;
				p.fillFrom(LLUICtrlFactory::instance().getDefaultParams<LLInspector>());
				p.message(tooltip_msg);
				p.image.name("Inspector_I");
				p.click_callback(boost::bind(showObjectInspector, hover_object->getID(), mHoverPick.mObjectFace));
				p.time_based_media(is_time_based_media);
				p.web_based_media(is_web_based_media);
				p.media_playing(is_media_playing);
				p.click_playmedia_callback(boost::bind(playCurrentMedia, mHoverPick));
				p.click_homepage_callback(boost::bind(VisitHomePage, mHoverPick));
				p.visible_time_near(6.f);
				p.visible_time_far(3.f);
				p.delay_time(0.35f);
				p.wrap(false);
				
				LLToolTipMgr::instance().show(p);
			}
		}
	}
	
	return TRUE;
}