summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/lltoolpie.cpp569
-rw-r--r--indra/newview/lltoolpie.h4
2 files changed, 293 insertions, 280 deletions
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index da7e8cd767..cd44b04abd 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -661,341 +661,352 @@ static bool needs_tooltip(LLSelectNode* nodep)
return false;
}
-BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask)
-{
- if (!LLUI::sSettingGroups["config"]->getBOOL("ShowHoverTips")) return TRUE;
- if (!mHoverPick.isValid()) return TRUE;
-
- LLViewerObject* hover_object = mHoverPick.getObject();
-
- // update hover object and hover parcel
- LLSelectMgr::getInstance()->setHoverObject(hover_object, mHoverPick.mObjectFace);
- if (mHoverPick.mPickType == LLPickInfo::PICK_LAND)
+BOOL LLToolPie::handleTooltipLand(std::string line, std::string tooltip_msg)
+{
+ LLViewerParcelMgr::getInstance()->setHoverParcel( mHoverPick.mPosGlobal );
+ //
+ // Do not show hover for land unless prefs are set to allow it.
+ //
+
+ if (!gSavedSettings.getBOOL("ShowLandHoverTip")) return TRUE;
+
+ // Didn't hit an object, but since we have a land point we
+ // must be hovering over land.
+
+ LLParcel* hover_parcel = LLViewerParcelMgr::getInstance()->getHoverParcel();
+ LLUUID owner;
+ S32 width = 0;
+ S32 height = 0;
+
+ if ( hover_parcel )
{
- LLViewerParcelMgr::getInstance()->setHoverParcel( mHoverPick.mPosGlobal );
+ owner = hover_parcel->getOwnerID();
+ width = S32(LLViewerParcelMgr::getInstance()->getHoverParcelWidth());
+ height = S32(LLViewerParcelMgr::getInstance()->getHoverParcelHeight());
}
-
- std::string tooltip_msg;
- std::string line;
-
- if ( hover_object )
+
+ // Line: "Land"
+ line.clear();
+ line.append(LLTrans::getString("TooltipLand"));
+ if (hover_parcel)
+ {
+ line.append(hover_parcel->getName());
+ }
+ tooltip_msg.append(line);
+ tooltip_msg.push_back('\n');
+
+ // Line: "Owner: James Linden"
+ line.clear();
+ line.append(LLTrans::getString("TooltipOwner") + " ");
+
+ if ( hover_parcel )
{
- if ( hover_object->isHUDAttachment() )
+ std::string name;
+ if (LLUUID::null == owner)
{
- // no hover tips for HUD elements, since they can obscure
- // what the HUD is displaying
- return TRUE;
+ line.append(LLTrans::getString("TooltipPublic"));
}
-
- if ( hover_object->isAttachment() )
+ else if (hover_parcel->getIsGroupOwned())
{
- // get root of attachment then parent, which is avatar
- LLViewerObject* root_edit = hover_object->getRootEdit();
- if (!root_edit)
+ if (gCacheName->getGroupName(owner, name))
{
- // Strange parenting issue, don't show any text
- return TRUE;
+ line.append(name);
+ line.append(LLTrans::getString("TooltipIsGroup"));
}
- hover_object = (LLViewerObject*)root_edit->getParent();
- if (!hover_object)
+ else
{
- // another strange parenting issue, bail out
- return TRUE;
+ line.append(LLTrans::getString("RetrievingData"));
}
}
-
- line.clear();
- if (hover_object->isAvatar())
+ else if(gCacheName->getFullName(owner, name))
{
- // 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);
- }
+ line.append(name);
}
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()))
- {
- if (nodep->mName.empty())
- {
- tooltip_msg.append(LLTrans::getString("TooltipNoName"));
- }
- else
- {
- tooltip_msg.append( nodep->mName );
- }
-
- bool is_time_based_media = false;
- bool is_web_based_media = false;
- bool is_media_playing = false;
-
- // Does this face have media?
- const LLTextureEntry* tep = hover_object->getTE(mHoverPick.mObjectFace);
-
- if(tep)
- {
- const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
- if (mep)
- {
- viewer_media_t media_impl = mep ? LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()) : NULL;
- LLPluginClassMedia* media_plugin = NULL;
-
- if (media_impl.notNull() && (media_impl->hasMedia()))
- {
- 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));
- }
- }
- }
- }
-
- // also check the primary node since sometimes it can have an action even though
- // the root node doesn't
- bool needs_tip = 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);
- }
- }
+ line.append(LLTrans::getString("RetrievingData"));
}
}
- else if ( mHoverPick.mPickType == LLPickInfo::PICK_LAND )
+ else
{
- //
- // Do not show hover for land unless prefs are set to allow it.
- //
+ line.append(LLTrans::getString("RetrievingData"));
+ }
+ tooltip_msg.append(line);
+ tooltip_msg.push_back('\n');
+
+ // Line: "no fly, not safe, no build"
+
+ // Don't display properties for your land. This is just
+ // confusing, because you can do anything on your own land.
+ if ( hover_parcel && owner != gAgent.getID() )
+ {
+ S32 words = 0;
- if (!gSavedSettings.getBOOL("ShowLandHoverTip")) return TRUE;
-
- // Didn't hit an object, but since we have a land point we
- // must be hovering over land.
-
- LLParcel* hover_parcel = LLViewerParcelMgr::getInstance()->getHoverParcel();
- LLUUID owner;
- S32 width = 0;
- S32 height = 0;
-
- if ( hover_parcel )
- {
- owner = hover_parcel->getOwnerID();
- width = S32(LLViewerParcelMgr::getInstance()->getHoverParcelWidth());
- height = S32(LLViewerParcelMgr::getInstance()->getHoverParcelHeight());
- }
-
- // Line: "Land"
- line.clear();
- line.append(LLTrans::getString("TooltipLand"));
- if (hover_parcel)
- {
- line.append(hover_parcel->getName());
- }
- tooltip_msg.append(line);
- tooltip_msg.push_back('\n');
-
- // Line: "Owner: James Linden"
line.clear();
- line.append(LLTrans::getString("TooltipOwner") + " ");
-
- if ( hover_parcel )
+ // JC - Keep this in the same order as the checkboxes
+ // on the land info panel
+ if ( !hover_parcel->getAllowModify() )
{
- std::string name;
- if (LLUUID::null == owner)
+ if ( hover_parcel->getAllowGroupModify() )
{
- line.append(LLTrans::getString("TooltipPublic"));
+ line.append(LLTrans::getString("TooltipFlagGroupBuild"));
}
- else if (hover_parcel->getIsGroupOwned())
+ else
{
- if (gCacheName->getGroupName(owner, name))
- {
- line.append(name);
- line.append(LLTrans::getString("TooltipIsGroup"));
- }
- else
- {
- line.append(LLTrans::getString("RetrievingData"));
- }
+ line.append(LLTrans::getString("TooltipFlagNoBuild"));
}
- else if(gCacheName->getFullName(owner, name))
+ words++;
+ }
+
+ if ( !hover_parcel->getAllowTerraform() )
+ {
+ if (words) line.append(", ");
+ line.append(LLTrans::getString("TooltipFlagNoEdit"));
+ words++;
+ }
+
+ if ( hover_parcel->getAllowDamage() )
+ {
+ if (words) line.append(", ");
+ line.append(LLTrans::getString("TooltipFlagNotSafe"));
+ words++;
+ }
+
+ // Maybe we should reflect the estate's block fly bit here as well? DK 12/1/04
+ if ( !hover_parcel->getAllowFly() )
+ {
+ if (words) line.append(", ");
+ line.append(LLTrans::getString("TooltipFlagNoFly"));
+ words++;
+ }
+
+ if ( !hover_parcel->getAllowOtherScripts() )
+ {
+ if (words) line.append(", ");
+ if ( hover_parcel->getAllowGroupScripts() )
{
- line.append(name);
+ line.append(LLTrans::getString("TooltipFlagGroupScripts"));
}
else
{
- line.append(LLTrans::getString("RetrievingData"));
+ line.append(LLTrans::getString("TooltipFlagNoScripts"));
}
+
+ words++;
}
- else
+
+ if (words)
{
- line.append(LLTrans::getString("RetrievingData"));
+ tooltip_msg.append(line);
+ tooltip_msg.push_back('\n');
}
+ }
+
+ if (hover_parcel && hover_parcel->getParcelFlag(PF_FOR_SALE))
+ {
+ LLStringUtil::format_map_t args;
+ args["[AMOUNT]"] = llformat("%d", hover_parcel->getSalePrice());
+ line = LLTrans::getString("TooltipForSaleL$", args);
tooltip_msg.append(line);
tooltip_msg.push_back('\n');
+ }
+
+ // trim last newlines
+ if (!tooltip_msg.empty())
+ {
+ tooltip_msg.erase(tooltip_msg.size() - 1);
+ LLToolTipMgr::instance().show(tooltip_msg);
+ }
+
+ return TRUE;
+}
- // Line: "no fly, not safe, no build"
-
- // Don't display properties for your land. This is just
- // confusing, because you can do anything on your own land.
- if ( hover_parcel && owner != gAgent.getID() )
+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)
{
- S32 words = 0;
-
- line.clear();
- // JC - Keep this in the same order as the checkboxes
- // on the land info panel
- if ( !hover_parcel->getAllowModify() )
+ // 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)
{
- if ( hover_parcel->getAllowGroupModify() )
- {
- line.append(LLTrans::getString("TooltipFlagGroupBuild"));
- }
- else
- {
- line.append(LLTrans::getString("TooltipFlagNoBuild"));
- }
- words++;
+ avatar_name = llformat("%s %s", firstname->getString(), lastname->getString());
}
-
- if ( !hover_parcel->getAllowTerraform() )
+ else
{
- if (words) line.append(", ");
- line.append(LLTrans::getString("TooltipFlagNoEdit"));
- words++;
+ avatar_name = LLTrans::getString("TooltipPerson");
}
-
- if ( hover_parcel->getAllowDamage() )
+
+ // *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()))
+ {
+ if (nodep->mName.empty())
{
- if (words) line.append(", ");
- line.append(LLTrans::getString("TooltipFlagNotSafe"));
- words++;
+ tooltip_msg.append(LLTrans::getString("TooltipNoName"));
}
-
- // Maybe we should reflect the estate's block fly bit here as well? DK 12/1/04
- if ( !hover_parcel->getAllowFly() )
+ else
{
- if (words) line.append(", ");
- line.append(LLTrans::getString("TooltipFlagNoFly"));
- words++;
+ tooltip_msg.append( nodep->mName );
}
-
- if ( !hover_parcel->getAllowOtherScripts() )
+
+ bool is_time_based_media = false;
+ bool is_web_based_media = false;
+ bool is_media_playing = false;
+
+ // Does this face have media?
+ const LLTextureEntry* tep = hover_object->getTE(mHoverPick.mObjectFace);
+
+ if(tep)
{
- if (words) line.append(", ");
- if ( hover_parcel->getAllowGroupScripts() )
+ const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL;
+ if (mep)
{
- line.append(LLTrans::getString("TooltipFlagGroupScripts"));
- }
- else
- {
- line.append(LLTrans::getString("TooltipFlagNoScripts"));
+ viewer_media_t media_impl = mep ? LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()) : NULL;
+ LLPluginClassMedia* media_plugin = NULL;
+
+ if (media_impl.notNull() && (media_impl->hasMedia()))
+ {
+ 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));
+ }
+ }
}
-
- words++;
}
-
- if (words)
+
+ // also check the primary node since sometimes it can have an action even though
+ // the root node doesn't
+ bool needs_tip = needs_tooltip(nodep) ||
+ needs_tooltip(LLSelectMgr::getInstance()->getPrimaryHoverNode());
+
+ if (show_all_object_tips || needs_tip)
{
- tooltip_msg.append(line);
- tooltip_msg.push_back('\n');
+ // 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;
+}
- if (hover_parcel && hover_parcel->getParcelFlag(PF_FOR_SALE))
- {
- LLStringUtil::format_map_t args;
- args["[AMOUNT]"] = llformat("%d", hover_parcel->getSalePrice());
- line = LLTrans::getString("TooltipForSaleL$", args);
- tooltip_msg.append(line);
- tooltip_msg.push_back('\n');
- }
+BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask)
+{
+ if (!LLUI::sSettingGroups["config"]->getBOOL("ShowHoverTips")) return TRUE;
+ if (!mHoverPick.isValid()) return TRUE;
- // trim last newlines
- if (!tooltip_msg.empty())
- {
- tooltip_msg.erase(tooltip_msg.size() - 1);
- LLToolTipMgr::instance().show(tooltip_msg);
- }
- }
+ LLViewerObject* hover_object = mHoverPick.getObject();
+
+ // update hover object and hover parcel
+ LLSelectMgr::getInstance()->setHoverObject(hover_object, mHoverPick.mObjectFace);
+
+
+ std::string tooltip_msg;
+ std::string line;
+ if ( hover_object )
+ {
+ handleTooltipObject(hover_object, line, tooltip_msg );
+ }
+ else if (mHoverPick.mPickType == LLPickInfo::PICK_LAND)
+ {
+ handleTooltipLand(line, tooltip_msg);
+ }
return TRUE;
}
diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h
index 5f0e28fa95..8a4c949aef 100644
--- a/indra/newview/lltoolpie.h
+++ b/indra/newview/lltoolpie.h
@@ -89,7 +89,9 @@ private:
bool handleMediaClick(const LLPickInfo& info);
bool handleMediaHover(const LLPickInfo& info);
- bool handleMediaMouseUp();
+ bool handleMediaMouseUp();
+ BOOL handleTooltipLand(std::string line, std::string tooltip_msg);
+ BOOL handleTooltipObject( LLViewerObject* hover_object, std::string line, std::string tooltip_msg);
private:
BOOL mGrabMouseButtonDown;