summaryrefslogtreecommitdiff
path: root/indra/newview/lltoolpie.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltoolpie.cpp')
-rw-r--r--indra/newview/lltoolpie.cpp935
1 files changed, 726 insertions, 209 deletions
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 92c9f3f553..5c210c5c28 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -36,16 +36,16 @@
#include "indra_constants.h"
#include "llclickaction.h"
-#include "llmediabase.h" // for status codes
#include "llparcel.h"
#include "llagent.h"
#include "llviewercontrol.h"
+#include "llfocusmgr.h"
#include "llfirstuse.h"
-#include "llfloateravatarinfo.h"
#include "llfloaterland.h"
+#include "llfloaterreg.h"
#include "llfloaterscriptdebug.h"
-#include "llhoverview.h"
+#include "lltooltip.h"
#include "llhudeffecttrail.h"
#include "llhudmanager.h"
#include "llmenugl.h"
@@ -55,6 +55,7 @@
#include "lltoolgrab.h"
#include "lltoolmgr.h"
#include "lltoolselect.h"
+#include "lltrans.h"
#include "llviewercamera.h"
#include "llviewerparcelmedia.h"
#include "llviewermenu.h"
@@ -63,23 +64,26 @@
#include "llviewerparcelmgr.h"
#include "llviewerwindow.h"
#include "llviewermedia.h"
-#include "llvoavatar.h"
+#include "llvoavatarself.h"
+#include "llviewermediafocus.h"
#include "llworld.h"
#include "llui.h"
#include "llweb.h"
+#include "llinspectavatar.h"
extern void handle_buy(void*);
extern BOOL gDebugClicks;
+static bool handle_media_click(const LLPickInfo& info);
+static bool handle_media_hover(const LLPickInfo& info);
static void handle_click_action_play();
static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp);
static ECursorType cursor_from_parcel_media(U8 click_action);
LLToolPie::LLToolPie()
-: LLTool(std::string("Select")),
- mPieMouseButtonDown( FALSE ),
+: LLTool(std::string("Pie")),
mGrabMouseButtonDown( FALSE ),
mMouseOutsideSlop( FALSE ),
mClickAction(0)
@@ -89,7 +93,7 @@ LLToolPie::LLToolPie()
BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask)
{
//left mouse down always picks transparent
- gViewerWindow->pickAsync(x, y, mask, leftMouseCallback, TRUE, TRUE);
+ gViewerWindow->pickAsync(x, y, mask, leftMouseCallback, TRUE);
mGrabMouseButtonDown = TRUE;
return TRUE;
}
@@ -98,32 +102,44 @@ BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask)
void LLToolPie::leftMouseCallback(const LLPickInfo& pick_info)
{
LLToolPie::getInstance()->mPick = pick_info;
- LLToolPie::getInstance()->pickAndShowMenu(FALSE);
+ LLToolPie::getInstance()->pickLeftMouseDownCallback();
}
+// Spawn context menus on right mouse down so you can drag over and select
+// an item.
BOOL LLToolPie::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
// don't pick transparent so users can't "pay" transparent objects
- gViewerWindow->pickAsync(x, y, mask, rightMouseCallback, FALSE, TRUE);
- mPieMouseButtonDown = TRUE;
- // don't steal focus from UI
+ gViewerWindow->pickAsync(x, y, mask, rightMouseCallback, FALSE);
+ // claim not handled so UI focus stays same
return FALSE;
}
+BOOL LLToolPie::handleRightMouseUp(S32 x, S32 y, MASK mask)
+{
+ LLToolMgr::getInstance()->clearTransientTool();
+ return LLTool::handleRightMouseUp(x, y, mask);
+}
+
+BOOL LLToolPie::handleScrollWheel(S32 x, S32 y, S32 clicks)
+{
+ return LLViewerMediaFocus::getInstance()->handleScrollWheel(x, y, clicks);
+}
+
// static
void LLToolPie::rightMouseCallback(const LLPickInfo& pick_info)
{
LLToolPie::getInstance()->mPick = pick_info;
- LLToolPie::getInstance()->pickAndShowMenu(TRUE);
+ LLToolPie::getInstance()->pickRightMouseDownCallback();
}
// True if you selected an object.
-BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
+BOOL LLToolPie::pickLeftMouseDownCallback()
{
S32 x = mPick.mMousePt.mX;
S32 y = mPick.mMousePt.mY;
MASK mask = mPick.mKeyMask;
- if (!always_show && mPick.mPickType == LLPickInfo::PICK_PARCEL_WALL)
+ if (mPick.mPickType == LLPickInfo::PICK_PARCEL_WALL)
{
LLParcel* parcel = LLViewerParcelMgr::getInstance()->getCollisionParcel();
if (parcel)
@@ -139,10 +155,11 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
else
{
// not selling passes, get info
- LLFloaterLand::showInstance();
+ LLFloaterReg::showInstance("about_land");
}
}
+ gFocusMgr.setKeyboardFocus(NULL);
return LLTool::handleMouseDown(x, y, mask);
}
@@ -160,11 +177,13 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
parent = object->getRootEdit();
}
+
BOOL touchable = (object && object->flagHandleTouch())
|| (parent && parent->flagHandleTouch());
+
// If it's a left-click, and we have a special action, do it.
- if (useClickAction(always_show, mask, object, parent))
+ if (useClickAction(mask, object, parent))
{
mClickAction = 0;
if (object && object->getClickAction())
@@ -182,9 +201,11 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
// touch behavior down below...
break;
case CLICK_ACTION_SIT:
- if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->mIsSitting)) // agent not already sitting
+ if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // agent not already sitting
{
handle_sit_or_stand();
+ // put focus in world when sitting on an object
+ gFocusMgr.setKeyboardFocus(NULL);
return TRUE;
} // else nothing (fall through to touch)
@@ -237,11 +258,19 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
}
}
+ if (handle_media_click(mPick))
+ {
+ return FALSE;
+ }
+
+ // put focus back "in world"
+ gFocusMgr.setKeyboardFocus(NULL);
+
// Switch to grab tool if physical or triggerable
if (object &&
!object->isAvatar() &&
- ((object->usePhysics() || (parent && !parent->isAvatar() && parent->usePhysics())) || touchable) &&
- !always_show)
+ ((object->usePhysics() || (parent && !parent->isAvatar() && parent->usePhysics())) || touchable)
+ )
{
gGrabTransientTool = this;
LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolGrab::getInstance() );
@@ -256,8 +285,7 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
// If left-click never selects or spawns a menu
// Eat the event.
- if (!gSavedSettings.getBOOL("LeftClickShowMenu")
- && !always_show)
+ if (!gSavedSettings.getBOOL("LeftClickShowMenu"))
{
// mouse already released
if (!mGrabMouseButtonDown)
@@ -285,14 +313,16 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
return TRUE;
}
- // Could be first left-click on nothing
- LLFirstUse::useLeftClickNoHit();
-
+ //////////
+ // // Could be first left-click on nothing
+ // LLFirstUse::useLeftClickNoHit();
+ /////////
+
// Eat the event
return LLTool::handleMouseDown(x, y, mask);
}
- if (!always_show && gAgent.leftButtonGrabbed())
+ if (gAgent.leftButtonGrabbed())
{
// if the left button is grabbed, don't put up the pie menu
return LLTool::handleMouseDown(x, y, mask);
@@ -302,116 +332,15 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show)
LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE);
// Spawn pie menu
- if (mPick.mPickType == LLPickInfo::PICK_LAND)
- {
- LLParcelSelectionHandle selection = LLViewerParcelMgr::getInstance()->selectParcelAt( mPick.mPosGlobal );
- gMenuHolder->setParcelSelection(selection);
- gPieLand->show(x, y, mPieMouseButtonDown);
-
- // VEFFECT: ShowPie
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE);
- effectp->setPositionGlobal(mPick.mPosGlobal);
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- effectp->setDuration(0.25f);
- }
- else if (mPick.mObjectID == gAgent.getID() )
- {
- if(!gPieSelf)
- {
- //either at very early startup stage or at late quitting stage,
- //this event is ignored.
- return TRUE ;
- }
-
- gPieSelf->show(x, y, mPieMouseButtonDown);
- }
- else if (object)
- {
- gMenuHolder->setObjectSelection(LLSelectMgr::getInstance()->getSelection());
-
- if (object->isAvatar()
- || (object->isAttachment() && !object->isHUDAttachment() && !object->permYouOwner()))
- {
- // Find the attachment's avatar
- while( object && object->isAttachment())
- {
- object = (LLViewerObject*)object->getParent();
- }
-
- // Object is an avatar, so check for mute by id.
- LLVOAvatar* avatar = (LLVOAvatar*)object;
- std::string name = avatar->getFullname();
- if (LLMuteList::getInstance()->isMuted(avatar->getID(), name))
- {
- gMenuHolder->childSetText("Avatar Mute", std::string("Unmute")); // *TODO:Translate
- //gMutePieMenu->setLabel("Unmute");
- }
- else
- {
- gMenuHolder->childSetText("Avatar Mute", std::string("Mute")); // *TODO:Translate
- //gMutePieMenu->setLabel("Mute");
- }
-
- gPieAvatar->show(x, y, mPieMouseButtonDown);
- }
- else if (object->isAttachment())
- {
- gPieAttachment->show(x, y, mPieMouseButtonDown);
- }
- else
- {
- // BUG: What about chatting child objects?
- std::string name;
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- if (node)
- {
- name = node->mName;
- }
- if (LLMuteList::getInstance()->isMuted(object->getID(), name))
- {
- gMenuHolder->childSetText("Object Mute", std::string("Unmute")); // *TODO:Translate
- //gMuteObjectPieMenu->setLabel("Unmute");
- }
- else
- {
- gMenuHolder->childSetText("Object Mute", std::string("Mute")); // *TODO:Translate
- //gMuteObjectPieMenu->setLabel("Mute");
- }
-
- gPieObject->show(x, y, mPieMouseButtonDown);
-
- // VEFFECT: ShowPie object
- // Don't show when you click on someone else, it freaks them
- // out.
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE);
- effectp->setPositionGlobal(mPick.mPosGlobal);
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- effectp->setDuration(0.25f);
- }
- }
-
- if (always_show)
- {
- // ignore return value
- LLTool::handleRightMouseDown(x, y, mask);
- }
- else
- {
- // ignore return value
- LLTool::handleMouseDown(x, y, mask);
- }
-
- // We handled the event.
+ LLTool::handleRightMouseDown(x, y, mask);
return TRUE;
}
-BOOL LLToolPie::useClickAction(BOOL always_show,
- MASK mask,
+BOOL LLToolPie::useClickAction(MASK mask,
LLViewerObject* object,
LLViewerObject* parent)
{
- return !always_show
- && mask == MASK_NONE
+ return mask == MASK_NONE
&& object
&& !object->isAttachment()
&& LLPrimitive::isPrimitive(object->getPCode())
@@ -454,7 +383,7 @@ ECursorType cursor_from_object(LLViewerObject* object)
switch(click_action)
{
case CLICK_ACTION_SIT:
- if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->mIsSitting)) // not already sitting?
+ if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // not already sitting?
{
cursor = UI_CURSOR_TOOLSIT;
}
@@ -524,7 +453,7 @@ void LLToolPie::selectionPropertiesReceived()
handle_give_money_dialog();
break;
case CLICK_ACTION_OPEN:
- handle_object_open();
+ LLFloaterReg::showInstance("openobject");
break;
default:
break;
@@ -536,59 +465,55 @@ void LLToolPie::selectionPropertiesReceived()
BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
{
- /*
- // If auto-rotate occurs, tag mouse-outside-slop to make sure the drag
- // gets started.
- const S32 ROTATE_H_MARGIN = (S32) (0.1f * gViewerWindow->getWindowWidth() );
- const F32 ROTATE_ANGLE_PER_SECOND = 30.f * DEG_TO_RAD;
- const F32 rotate_angle = ROTATE_ANGLE_PER_SECOND / gFPSClamped;
- // ...normal modes can only yaw
- if (x < ROTATE_H_MARGIN)
- {
- gAgent.yaw(rotate_angle);
- mMouseOutsideSlop = TRUE;
- }
- else if (x > gViewerWindow->getWindowWidth() - ROTATE_H_MARGIN)
- {
- gAgent.yaw(-rotate_angle);
- mMouseOutsideSlop = TRUE;
- }
- */
-
- LLViewerObject *object = NULL;
+ mHoverPick = gViewerWindow->pickImmediate(x, y, FALSE);
+
+ // FIXME: This was in the pluginapi branch, but I don't think it's correct.
+// gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
+
LLViewerObject *parent = NULL;
- if (gHoverView)
- {
- object = gViewerWindow->getHoverPick().getObject();
- }
+ LLViewerObject *object = mHoverPick.getObject();
if (object)
{
parent = object->getRootEdit();
}
- if (object && useClickAction(FALSE, mask, object, parent))
+ if (object && useClickAction(mask, object, parent))
{
ECursorType cursor = cursor_from_object(object);
- gViewerWindow->getWindow()->setCursor(cursor);
+ gViewerWindow->setCursor(cursor);
+ lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
+ }
+ else if (handle_media_hover(mHoverPick))
+ {
+ // cursor set by media object
lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
}
else if ((object && !object->isAvatar() && object->usePhysics())
|| (parent && !parent->isAvatar() && parent->usePhysics()))
{
- gViewerWindow->getWindow()->setCursor(UI_CURSOR_TOOLGRAB);
+ gViewerWindow->setCursor(UI_CURSOR_TOOLGRAB);
lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
}
else if ( (object && object->flagHandleTouch())
|| (parent && parent->flagHandleTouch()))
{
- gViewerWindow->getWindow()->setCursor(UI_CURSOR_HAND);
+ gViewerWindow->setCursor(UI_CURSOR_HAND);
lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
}
else
{
- gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
+
+ if(!object)
+ {
+ // We need to clear media hover flag
+ if (LLViewerMediaFocus::getInstance()->getMouseOverFlag())
+ {
+ LLViewerMediaFocus::getInstance()->setMouseOverFlag(false);
+ }
+ }
}
return TRUE;
@@ -610,9 +535,9 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask)
// the world. Keep the cursor an arrow, assuming that
// after the user moves off the UI, they won't be on the
// same object anymore.
- gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW);
+ gViewerWindow->setCursor(UI_CURSOR_ARROW);
// Make sure the hover-picked object is ignored.
- gHoverView->resetLastHoverObject();
+ //gToolTipView->resetLastHoverObject();
break;
default:
break;
@@ -624,13 +549,6 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask)
return LLTool::handleMouseUp(x, y, mask);
}
-BOOL LLToolPie::handleRightMouseUp(S32 x, S32 y, MASK mask)
-{
- mPieMouseButtonDown = FALSE;
- LLToolMgr::getInstance()->clearTransientTool();
- return LLTool::handleRightMouseUp(x, y, mask);
-}
-
BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask)
{
@@ -650,41 +568,439 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask)
else if (mPick.mObjectID.notNull()
&& !mPick.mPosGlobal.isExactlyZero())
{
- // Hit an object
- // HACK: Call the last hit position the point we hit on the object
- //gLastHitPosGlobal += gLastHitObjectOffset;
handle_go_to();
return TRUE;
}
}
return FALSE;
+}
- /* JC - don't do go-there, because then double-clicking on physical
- objects gets you into trouble.
+//FIXME - RN: get this in LLToolSelectLand too or share some other way?
+const char* DEFAULT_DESC = "(No Description)";
- // If double-click on object or land, go there.
- LLViewerObject *object = gViewerWindow->getLastPick().getObject();
- if (object)
+BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, std::string& msg, LLRect& sticky_rect_screen)
+{
+ 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)
+ {
+ LLViewerParcelMgr::getInstance()->setHoverParcel( mHoverPick.mPosGlobal );
+ }
+
+ std::string tooltip_msg;
+ std::string line;
+
+ if ( hover_object )
{
- if (object->isAvatar())
+ if ( hover_object->isHUDAttachment() )
{
- LLFloaterAvatarInfo::showFromAvatar(object->getID());
+ // 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 inspector not already open
+ if (!LLFloaterReg::instanceVisible("inspect_avatar"))
+ {
+ 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");
+ }
+ LLToolTipParams params;
+ params.message(avatar_name);
+ params.image.name("Info");
+ params.sticky_rect(gViewerWindow->getVirtualWorldViewRect());
+ params.click_callback(boost::bind(showAvatarInspector, hover_object->getID()));
+ LLToolTipMgr::instance().show(params);
+ }
}
else
{
- handle_go_to(NULL);
+ //
+ // We have hit a regular object (not an avatar or attachment)
+ //
+
+ //
+ // Default prefs will suppress display unless the object is interactive
+ //
+ BOOL suppressObjectHoverDisplay = !gSavedSettings.getBOOL("ShowAllObjectHoverTip");
+
+ LLSelectNode *nodep = LLSelectMgr::getInstance()->getHoverNode();
+ if (nodep)
+ {
+ line.clear();
+ if (nodep->mName.empty())
+ {
+ line.append(LLTrans::getString("TooltipNoName"));
+ }
+ else
+ {
+ line.append( nodep->mName );
+ }
+ tooltip_msg.append(line);
+ tooltip_msg.push_back('\n');
+
+ if (!nodep->mDescription.empty()
+ && nodep->mDescription != DEFAULT_DESC)
+ {
+ tooltip_msg.append( nodep->mDescription );
+ tooltip_msg.push_back('\n');
+ }
+
+ // Line: "Owner: James Linden"
+ line.clear();
+ line.append(LLTrans::getString("TooltipOwner") + " ");
+
+ if (nodep->mValid)
+ {
+ LLUUID owner;
+ std::string name;
+ if (!nodep->mPermissions->isGroupOwned())
+ {
+ owner = nodep->mPermissions->getOwner();
+ if (LLUUID::null == owner)
+ {
+ line.append(LLTrans::getString("TooltipPublic"));
+ }
+ else if(gCacheName->getFullName(owner, name))
+ {
+ line.append(name);
+ }
+ else
+ {
+ line.append(LLTrans::getString("RetrievingData"));
+ }
+ }
+ else
+ {
+ std::string name;
+ owner = nodep->mPermissions->getGroup();
+ if (gCacheName->getGroupName(owner, name))
+ {
+ line.append(name);
+ line.append(LLTrans::getString("TooltipIsGroup"));
+ }
+ else
+ {
+ line.append(LLTrans::getString("RetrievingData"));
+ }
+ }
+ }
+ else
+ {
+ line.append(LLTrans::getString("RetrievingData"));
+ }
+ tooltip_msg.append(line);
+ tooltip_msg.push_back('\n');
+
+ // Build a line describing any special properties of this object.
+ LLViewerObject *object = hover_object;
+ LLViewerObject *parent = (LLViewerObject *)object->getParent();
+
+ if (object &&
+ (object->usePhysics() ||
+ object->flagScripted() ||
+ object->flagHandleTouch() || (parent && parent->flagHandleTouch()) ||
+ object->flagTakesMoney() || (parent && parent->flagTakesMoney()) ||
+ object->flagAllowInventoryAdd() ||
+ object->flagTemporary() ||
+ object->flagPhantom()) )
+ {
+ line.clear();
+ if (object->flagScripted())
+ {
+ line.append(LLTrans::getString("TooltipFlagScript") + " ");
+ }
+
+ if (object->usePhysics())
+ {
+ line.append(LLTrans::getString("TooltipFlagPhysics") + " ");
+ }
+
+ if (object->flagHandleTouch() || (parent && parent->flagHandleTouch()) )
+ {
+ line.append(LLTrans::getString("TooltipFlagTouch") + " ");
+ suppressObjectHoverDisplay = FALSE; // Show tip
+ }
+
+ if (object->flagTakesMoney() || (parent && parent->flagTakesMoney()) )
+ {
+ line.append(LLTrans::getString("TooltipFlagL$") + " ");
+ suppressObjectHoverDisplay = FALSE; // Show tip
+ }
+
+ if (object->flagAllowInventoryAdd())
+ {
+ line.append(LLTrans::getString("TooltipFlagDropInventory") + " ");
+ suppressObjectHoverDisplay = FALSE; // Show tip
+ }
+
+ if (object->flagPhantom())
+ {
+ line.append(LLTrans::getString("TooltipFlagPhantom") + " ");
+ }
+
+ if (object->flagTemporary())
+ {
+ line.append(LLTrans::getString("TooltipFlagTemporary") + " ");
+ }
+
+ if (object->usePhysics() ||
+ object->flagHandleTouch() ||
+ (parent && parent->flagHandleTouch()) )
+ {
+ line.append(LLTrans::getString("TooltipFlagRightClickMenu") + " ");
+ }
+ tooltip_msg.append(line);
+ tooltip_msg.push_back('\n');
+ }
+
+ // Free to copy / For Sale: L$
+ line.clear();
+ if (nodep->mValid)
+ {
+ BOOL for_copy = nodep->mPermissions->getMaskEveryone() & PERM_COPY && object->permCopy();
+ BOOL for_sale = nodep->mSaleInfo.isForSale() &&
+ nodep->mPermissions->getMaskOwner() & PERM_TRANSFER &&
+ (nodep->mPermissions->getMaskOwner() & PERM_COPY ||
+ nodep->mSaleInfo.getSaleType() != LLSaleInfo::FS_COPY);
+ if (for_copy)
+ {
+ line.append(LLTrans::getString("TooltipFreeToCopy"));
+ suppressObjectHoverDisplay = FALSE; // Show tip
+ }
+ else if (for_sale)
+ {
+ LLStringUtil::format_map_t args;
+ args["[AMOUNT]"] = llformat("%d", nodep->mSaleInfo.getSalePrice());
+ line.append(LLTrans::getString("TooltipForSaleL$", args));
+ suppressObjectHoverDisplay = FALSE; // Show tip
+ }
+ else
+ {
+ // Nothing if not for sale
+ // line.append("Not for sale");
+ }
+ }
+ else
+ {
+ LLStringUtil::format_map_t args;
+ args["[MESSAGE]"] = LLTrans::getString("RetrievingData");
+ line.append(LLTrans::getString("TooltipForSaleMsg", args));
+ }
+ tooltip_msg.append(line);
+ tooltip_msg.push_back('\n');
+
+ if (!suppressObjectHoverDisplay)
+ {
+ LLToolTipMgr::instance().show(tooltip_msg);
+ }
+ }
}
}
- else if (!gLastHitPosGlobal.isExactlyZero())
+ else if ( mHoverPick.mPickType == LLPickInfo::PICK_LAND )
{
- handle_go_to(NULL);
+ //
+ // 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 )
+ {
+ 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 )
+ {
+ std::string name;
+ if (LLUUID::null == owner)
+ {
+ line.append(LLTrans::getString("TooltipPublic"));
+ }
+ else if (hover_parcel->getIsGroupOwned())
+ {
+ if (gCacheName->getGroupName(owner, name))
+ {
+ line.append(name);
+ line.append(LLTrans::getString("TooltipIsGroup"));
+ }
+ else
+ {
+ line.append(LLTrans::getString("RetrievingData"));
+ }
+ }
+ else if(gCacheName->getFullName(owner, name))
+ {
+ line.append(name);
+ }
+ else
+ {
+ line.append(LLTrans::getString("RetrievingData"));
+ }
+ }
+ else
+ {
+ 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;
+
+ line.clear();
+ // JC - Keep this in the same order as the checkboxes
+ // on the land info panel
+ if ( !hover_parcel->getAllowModify() )
+ {
+ if ( hover_parcel->getAllowGroupModify() )
+ {
+ line.append(LLTrans::getString("TooltipFlagGroupBuild"));
+ }
+ else
+ {
+ line.append(LLTrans::getString("TooltipFlagNoBuild"));
+ }
+ 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(LLTrans::getString("TooltipFlagGroupScripts"));
+ }
+ else
+ {
+ line.append(LLTrans::getString("TooltipFlagNoScripts"));
+ }
+
+ words++;
+ }
+
+ if (words)
+ {
+ 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');
+ }
+ LLToolTipMgr::instance().show(tooltip_msg);
}
+
return TRUE;
- */
}
+// static
+void LLToolPie::showAvatarInspector(const LLUUID& avatar_id)
+{
+ LLSD params;
+ params["avatar_id"] = avatar_id;
+ if (LLToolTipMgr::instance().toolTipVisible())
+ {
+ LLRect rect = LLToolTipMgr::instance().getToolTipRect();
+ params["pos"]["x"] = rect.mLeft;
+ params["pos"]["y"] = rect.mTop;
+ }
+
+ LLFloaterReg::showInstance("inspect_avatar", params);
+}
void LLToolPie::handleDeselect()
{
@@ -693,6 +1009,7 @@ void LLToolPie::handleDeselect()
setMouseCapture( FALSE ); // Calls onMouseCaptureLost() indirectly
}
// remove temporary selection for pie menu
+ LLSelectMgr::getInstance()->setHoverObject(NULL);
LLSelectMgr::getInstance()->validateSelection();
}
@@ -744,14 +1061,14 @@ static void handle_click_action_play()
LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
if (!parcel) return;
- LLMediaBase::EStatus status = LLViewerParcelMedia::getStatus();
+ LLViewerMediaImpl::EMediaStatus status = LLViewerParcelMedia::getStatus();
switch(status)
{
- case LLMediaBase::STATUS_STARTED:
+ case LLViewerMediaImpl::MEDIA_PLAYING:
LLViewerParcelMedia::pause();
break;
- case LLMediaBase::STATUS_PAUSED:
+ case LLViewerMediaImpl::MEDIA_PAUSED:
LLViewerParcelMedia::start();
break;
@@ -761,6 +1078,111 @@ static void handle_click_action_play()
}
}
+static bool handle_media_click(const LLPickInfo& pick)
+{
+ //FIXME: how do we handle object in different parcel than us?
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ LLPointer<LLViewerObject> objectp = pick.getObject();
+
+
+ if (!parcel ||
+ objectp.isNull() ||
+ pick.mObjectFace < 0 ||
+ pick.mObjectFace >= objectp->getNumTEs())
+ {
+ LLSelectMgr::getInstance()->deselect();
+ LLViewerMediaFocus::getInstance()->clearFocus();
+
+ return false;
+ }
+
+
+
+ // HACK: This is directly referencing an impl name. BAD!
+ // This can be removed when we have a truly generic media browser that only
+ // builds an impl based on the type of url it is passed.
+
+ // is media playing on this face?
+ const LLTextureEntry* tep = objectp->getTE(pick.mObjectFace);
+
+ viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(tep->getID());
+ if (tep
+ && media_impl.notNull()
+ && media_impl->hasMedia()
+ && gSavedSettings.getBOOL("MediaOnAPrimUI"))
+ {
+ LLObjectSelectionHandle selection = LLViewerMediaFocus::getInstance()->getSelection();
+ if (! selection->contains(pick.getObject(), pick.mObjectFace))
+ {
+ LLViewerMediaFocus::getInstance()->setFocusFace(TRUE, pick.getObject(), pick.mObjectFace, media_impl);
+ }
+ else
+ {
+ media_impl->mouseDown(pick.mXYCoords.mX, pick.mXYCoords.mY);
+ media_impl->mouseCapture(); // the mouse-up will happen when capture is lost
+ }
+
+ return true;
+ }
+
+ LLSelectMgr::getInstance()->deselect();
+ LLViewerMediaFocus::getInstance()->clearFocus();
+
+ return false;
+}
+
+static bool handle_media_hover(const LLPickInfo& pick)
+{
+ //FIXME: how do we handle object in different parcel than us?
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (!parcel) return false;
+
+ LLPointer<LLViewerObject> objectp = pick.getObject();
+
+ // Early out cases. Must clear mouse over media focus flag
+ // did not hit an object or did not hit a valid face
+ if ( objectp.isNull() ||
+ pick.mObjectFace < 0 ||
+ pick.mObjectFace >= objectp->getNumTEs() )
+ {
+ LLViewerMediaFocus::getInstance()->setMouseOverFlag(false);
+ return false;
+ }
+
+
+ // HACK: This is directly referencing an impl name. BAD!
+ // This can be removed when we have a truly generic media browser that only
+ // builds an impl based on the type of url it is passed.
+
+ // is media playing on this face?
+ const LLTextureEntry* tep = objectp->getTE(pick.mObjectFace);
+ viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(tep->getID());
+ if (tep
+ && media_impl.notNull()
+ && media_impl->hasMedia()
+ && gSavedSettings.getBOOL("MediaOnAPrimUI"))
+ {
+ if(LLViewerMediaFocus::getInstance()->getFocus())
+ {
+ media_impl->mouseMove(pick.mXYCoords.mX, pick.mXYCoords.mY);
+ }
+
+ // Set mouse over flag if unset
+ if (! LLViewerMediaFocus::getInstance()->getMouseOverFlag())
+ {
+ LLSelectMgr::getInstance()->setHoverObject(objectp, pick.mObjectFace);
+ LLViewerMediaFocus::getInstance()->setMouseOverFlag(true, media_impl);
+ LLViewerMediaFocus::getInstance()->setPickInfo(pick);
+ }
+
+ return true;
+ }
+ LLViewerMediaFocus::getInstance()->setMouseOverFlag(false);
+
+ return false;
+}
+
+
static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp)
{
//FIXME: how do we handle object in different parcel than us?
@@ -775,7 +1197,7 @@ static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp)
if( face < 0 || face >= objectp->getNumTEs() ) return;
// is media playing on this face?
- if (!LLViewerMedia::isActiveMediaTexture(objectp->getTE(face)->getID()))
+ if (LLViewerMedia::getMediaImplFromTextureID(objectp->getTE(face)->getID()) != NULL)
{
handle_click_action_play();
return;
@@ -785,18 +1207,7 @@ static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp)
std::string media_type = std::string ( parcel->getMediaType() );
LLStringUtil::trim(media_url);
- // Get the scheme, see if that is handled as well.
- LLURI uri(media_url);
- std::string media_scheme = uri.scheme() != "" ? uri.scheme() : "http";
-
- // HACK: This is directly referencing an impl name. BAD!
- // This can be removed when we have a truly generic media browser that only
- // builds an impl based on the type of url it is passed.
-
- if( LLMediaManager::getInstance()->supportsMediaType( "LLMediaImplLLMozLib", media_scheme, media_type ) )
- {
- LLWeb::loadURL(media_url);
- }
+ LLWeb::loadURL(media_url);
}
static ECursorType cursor_from_parcel_media(U8 click_action)
@@ -814,21 +1225,127 @@ static ECursorType cursor_from_parcel_media(U8 click_action)
std::string media_type = std::string ( parcel->getMediaType() );
LLStringUtil::trim(media_url);
- // Get the scheme, see if that is handled as well.
- LLURI uri(media_url);
- std::string media_scheme = uri.scheme() != "" ? uri.scheme() : "http";
-
- if( LLMediaManager::getInstance()->supportsMediaType( "LLMediaImplLLMozLib", media_scheme, media_type ) )
- {
- open_cursor = UI_CURSOR_TOOLMEDIAOPEN;
- }
+ open_cursor = UI_CURSOR_TOOLMEDIAOPEN;
- LLMediaBase::EStatus status = LLViewerParcelMedia::getStatus();
+ LLViewerMediaImpl::EMediaStatus status = LLViewerParcelMedia::getStatus();
switch(status)
{
- case LLMediaBase::STATUS_STARTED:
+ case LLViewerMediaImpl::MEDIA_PLAYING:
return click_action == CLICK_ACTION_PLAY ? UI_CURSOR_TOOLPAUSE : open_cursor;
default:
return UI_CURSOR_TOOLPLAY;
}
}
+
+
+// True if we handled the event.
+BOOL LLToolPie::pickRightMouseDownCallback()
+{
+ S32 x = mPick.mMousePt.mX;
+ S32 y = mPick.mMousePt.mY;
+ MASK mask = mPick.mKeyMask;
+
+ if (mPick.mPickType != LLPickInfo::PICK_LAND)
+ {
+ LLViewerParcelMgr::getInstance()->deselectLand();
+ }
+
+ // didn't click in any UI object, so must have clicked in the world
+ LLViewerObject *object = mPick.getObject();
+ LLViewerObject *parent = NULL;
+ if(object)
+ parent = object->getRootEdit();
+
+ // Can't ignore children here.
+ LLToolSelect::handleObjectSelection(mPick, FALSE, TRUE);
+
+ // Spawn pie menu
+ if (mPick.mPickType == LLPickInfo::PICK_LAND)
+ {
+ LLParcelSelectionHandle selection = LLViewerParcelMgr::getInstance()->selectParcelAt( mPick.mPosGlobal );
+ gMenuHolder->setParcelSelection(selection);
+ gPieLand->show(x, y);
+
+ showVisualContextMenuEffect();
+
+ }
+ else if (mPick.mObjectID == gAgent.getID() )
+ {
+ if(!gPieSelf)
+ {
+ //either at very early startup stage or at late quitting stage,
+ //this event is ignored.
+ return TRUE ;
+ }
+
+ gPieSelf->show(x, y);
+ }
+ else if (object)
+ {
+ gMenuHolder->setObjectSelection(LLSelectMgr::getInstance()->getSelection());
+
+ if (object->isAvatar()
+ || (object->isAttachment() && !object->isHUDAttachment() && !object->permYouOwner()))
+ {
+ // Find the attachment's avatar
+ while( object && object->isAttachment())
+ {
+ object = (LLViewerObject*)object->getParent();
+ }
+
+ // Object is an avatar, so check for mute by id.
+ LLVOAvatar* avatar = (LLVOAvatar*)object;
+ std::string name = avatar->getFullname();
+ if (LLMuteList::getInstance()->isMuted(avatar->getID(), avatar->getFullname()))
+ {
+ gMenuHolder->childSetText("Avatar Mute", std::string("Unmute")); // *TODO:Translate
+ }
+ else
+ {
+ gMenuHolder->childSetText("Avatar Mute", std::string("Mute")); // *TODO:Translate
+ }
+
+ gPieAvatar->show(x, y);
+ }
+ else if (object->isAttachment())
+ {
+ gPieAttachment->show(x, y);
+ }
+ else
+ {
+ // BUG: What about chatting child objects?
+ std::string name;
+ LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
+ if (node)
+ {
+ name = node->mName;
+ }
+ if (LLMuteList::getInstance()->isMuted(object->getID(), name))
+ {
+ gMenuHolder->childSetText("Object Mute", std::string("Unmute")); // *TODO:Translate
+ }
+ else
+ {
+ gMenuHolder->childSetText("Object Mute", std::string("Mute")); // *TODO:Translate
+ }
+
+ gPieObject->show(x, y);
+
+ showVisualContextMenuEffect();
+ }
+ }
+
+ LLTool::handleRightMouseDown(x, y, mask);
+ // We handled the event.
+ return TRUE;
+}
+
+void LLToolPie::showVisualContextMenuEffect()
+{
+ // VEFFECT: ShowPie
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE);
+ effectp->setPositionGlobal(mPick.mPosGlobal);
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ effectp->setDuration(0.25f);
+
+}