diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llinspectobject.cpp | 8 | ||||
-rw-r--r-- | indra/newview/lltoolpie.cpp | 140 | ||||
-rw-r--r-- | indra/newview/lltoolpie.h | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/inspect_object.xml | 54 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 4 |
5 files changed, 182 insertions, 26 deletions
diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp index 29cca14a7b..81544904e3 100644 --- a/indra/newview/llinspectobject.cpp +++ b/indra/newview/llinspectobject.cpp @@ -106,12 +106,14 @@ private: private: LLUUID mObjectID; + S32 mObjectFace; LLSafeHandle<LLObjectSelection> mObjectSelection; }; LLInspectObject::LLInspectObject(const LLSD& sd) : LLInspect( LLSD() ), // single_instance, doesn't really need key mObjectID(), // set in onOpen() + mObjectFace(0), mObjectSelection() { // can't make the properties request until the widgets are constructed @@ -182,7 +184,11 @@ void LLInspectObject::onOpen(const LLSD& data) // Extract appropriate avatar id mObjectID = data["object_id"]; - + + if(data.has("object_face")) + { + mObjectFace = data["object_face"]; + } // Position the inspector relative to the mouse cursor // Similar to how tooltips are positioned // See LLToolTipMgr::createToolTip diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 7c17699bf9..2ba4d97674 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -732,7 +732,44 @@ BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask) { tooltip_msg.append( nodep->mName ); } - + + bool is_time_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; + args["[CurrentURL]"] = media_impl->getMediaURL(); + is_media_playing = media_impl->isMediaPlaying(); + } + else + { + is_time_based_media = false; + args["[CurrentURL]"] = media_plugin->getLocation(); + } + //tooltip_msg.append(LLTrans::getString("CurrentURL", args)); + } + } + } + } + bool needs_tip = needs_tooltip(nodep); if (show_all_object_tips || needs_tip) @@ -741,8 +778,11 @@ BOOL LLToolPie::handleToolTip(S32 local_x, S32 local_y, MASK mask) mPick = mHoverPick; LLToolTipMgr::instance().show(LLToolTip::Params() .message(tooltip_msg) - .image(LLUI::getUIImage("Info")) - .click_callback(boost::bind(showObjectInspector, hover_object->getID())) + .image(LLUI::getUIImage("Info_Off")) + .click_callback(boost::bind(showObjectInspector, hover_object->getID(), mHoverPick.mObjectFace)) + .time_based_media(is_time_based_media) + .media_playing(is_media_playing) + .click_playmedia_callback(boost::bind(playCurrentMedia, mHoverPick)) .visible_time_near(6.f) .visible_time_far(3.f) .wrap(false)); @@ -925,6 +965,20 @@ static void show_inspector(const char* inspector, const char* param, const LLUUI LLFloaterReg::showInstance(inspector, params); } + +static void show_inspector(const char* inspector, LLSD& params) +{ + if (LLToolTipMgr::instance().toolTipVisible()) + { + LLRect rect = LLToolTipMgr::instance().getToolTipRect(); + params["pos"]["x"] = rect.mLeft; + params["pos"]["y"] = rect.mTop; + } + + LLFloaterReg::showInstance(inspector, params); +} + + // static void LLToolPie::showAvatarInspector(const LLUUID& avatar_id) { @@ -937,6 +991,72 @@ void LLToolPie::showObjectInspector(const LLUUID& object_id) show_inspector("inspect_object", "object_id", object_id); } + +// static +void LLToolPie::showObjectInspector(const LLUUID& object_id, const S32& object_face) +{ + LLSD params; + params["object_id"] = object_id; + params["object_face"] = object_face; + show_inspector("inspect_object", params); +} + +// static +void LLToolPie::playCurrentMedia(const LLPickInfo& info) +{ + //FIXME: how do we handle object in different parcel than us? + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + if (!parcel) return; + + LLPointer<LLViewerObject> objectp = info.getObject(); + + // Early out cases. Must clear media hover. + // did not hit an object or did not hit a valid face + if ( objectp.isNull() || + info.mObjectFace < 0 || + info.mObjectFace >= objectp->getNumTEs() ) + { + return; + } + + // Does this face have media? + const LLTextureEntry* tep = objectp->getTE(info.mObjectFace); + if (!tep) + return; + + const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL; + if(!mep) + return; + + LLPluginClassMedia* media_plugin = NULL; + + if (gSavedSettings.getBOOL("MediaOnAPrimUI")) + { + viewer_media_t media_impl = LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()); + + if(media_impl.notNull() && media_impl->hasMedia()) + { + media_plugin = media_impl->getMediaPlugin(); + + if (media_plugin && media_plugin->pluginSupportsMediaTime()) + { + if(media_impl->isMediaPlaying()) + { + media_impl->pause(); + } + else //if(media_impl->isMediaPaused()) + { + media_impl->play(); + } + + } + + } + } + +} + + void LLToolPie::handleDeselect() { if( hasMouseCapture() ) @@ -1035,12 +1155,17 @@ bool LLToolPie::handleMediaClick(const LLPickInfo& pick) // Does this face have media? const LLTextureEntry* tep = objectp->getTE(pick.mObjectFace); + if(!tep) + return false; + LLMediaEntry* mep = (tep->hasMedia()) ? tep->getMediaData() : NULL; + + if(!mep) + return false; + viewer_media_t media_impl = mep ? LLViewerMedia::getMediaImplFromTextureID(mep->getMediaID()) : NULL; - if (tep - && mep - && gSavedSettings.getBOOL("MediaOnAPrimUI") + if (gSavedSettings.getBOOL("MediaOnAPrimUI") && media_impl.notNull()) { if (!LLViewerMediaFocus::getInstance()->isFocusedOnFace(pick.getObject(), pick.mObjectFace) ) @@ -1085,6 +1210,9 @@ bool LLToolPie::handleMediaHover(const LLPickInfo& pick) // Does this face have media? const LLTextureEntry* tep = objectp->getTE(pick.mObjectFace); + if(!tep) + return false; + const LLMediaEntry* mep = tep->hasMedia() ? tep->getMediaData() : NULL; if (mep && gSavedSettings.getBOOL("MediaOnAPrimUI")) diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h index 5faedbec5a..3cf9cbde55 100644 --- a/indra/newview/lltoolpie.h +++ b/indra/newview/lltoolpie.h @@ -78,6 +78,8 @@ public: static void showAvatarInspector(const LLUUID& avatar_id); static void showObjectInspector(const LLUUID& object_id); + static void showObjectInspector(const LLUUID& object_id, const S32& object_face); + static void playCurrentMedia(const LLPickInfo& info); private: BOOL outsideSlop (S32 x, S32 y, S32 start_x, S32 start_y); BOOL pickLeftMouseDownCallback(); diff --git a/indra/newview/skins/default/xui/en/inspect_object.xml b/indra/newview/skins/default/xui/en/inspect_object.xml index 603ff55e6d..76b6e2c173 100644 --- a/indra/newview/skins/default/xui/en/inspect_object.xml +++ b/indra/newview/skins/default/xui/en/inspect_object.xml @@ -71,7 +71,7 @@ owner James Linden width="150"> L$300,000 </text> - <text + <text follows="all" height="30" left="8" @@ -85,23 +85,23 @@ This is a really long description for an object being as how it is at least 80 c <!-- Overlapping buttons for all default actions. Show "Buy" if for sale, "Sit" if can sit, etc. --> <button - follows="top|left" - font="SansSerif" - height="23" - label="Buy" - left="10" - name="buy_btn" - top="114" - width="100" /> + follows="top|left" + font="SansSerif" + height="20" + label="Buy" + left="10" + name="buy_btn" + top="114" + width="75" /> <button follows="top|left" font="SansSerif" - height="23" + height="20" label="Pay" left_delta="0" name="pay_btn" top_delta="0" - width="100" /> + width="75" /> <button follows="top|left" font="SansSerif" @@ -110,16 +110,16 @@ This is a really long description for an object being as how it is at least 80 c left_delta="0" name="take_free_copy_btn" top_delta="0" - width="100" /> + width="75" /> <button follows="top|left" font="SansSerifSmall" - height="23" + height="20" label="Touch" left_delta="0" name="touch_btn" top_delta="0" - width="100" /> + width="75" /> <button follows="top|left" font="SansSerif" @@ -128,17 +128,35 @@ This is a really long description for an object being as how it is at least 80 c left_delta="0" name="sit_btn" top_delta="0" - width="100" /> + width="75" /> <button follows="top|left" font="SansSerifSmall" - height="23" + height="20" label="Open" left_delta="0" name="open_btn" top_delta="0" - width="100" /> - <!-- non-overlapping buttons here --> + width="75" /> + <icon + name="secure_icon" + image_name="map_infohub.tga" + left_delta="80" + width="16" + height="16" + top_delta="0" + follows="left|top"/> + <!-- <text + follows="left|top" + height="30" + left_delta="20" + name="object_media_url" + top_pad="-20" + width="150" + use_ellipses="true" + word_wrap="true"> + + non-overlapping buttons here --> <menu_button follows="top|left" height="18" diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 4eacd72a7d..e842517853 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -74,6 +74,7 @@ <string name="TooltipTeleportUrl">Click to teleport to this location</string> <string name="TooltipObjectIMUrl">Click to view this object's description</string> <string name="TooltipSLAPP">Click to run the secondlife:// command</string> + <string name="CurrentURL" value=" CurrentURL: [CurrentURL]" /> <!-- ButtonToolTips, llfloater.cpp --> <string name="BUTTON_CLOSE_DARWIN">Close (⌘W)</string> @@ -636,7 +637,7 @@ Sets the script timer to zero float llGetAndResetTime() Returns the script time in seconds and then resets the script timer to zero </string> - <string name="LSLTipText_llSound" translate="false"> + <string name="LSLTipText_llSoplayund" translate="false"> llSound(string sound, float volume, integer queue, integer loop) Plays sound at volume and whether it should loop or not </string> @@ -2187,6 +2188,7 @@ Expected .wav, .tga, .bmp, .jpg, .jpeg, or .bvh <!-- media --> <string name="Multiple Media">Multiple Media</string> + <string name="Play Media">Play/Pause Media</string> <!-- OSMessageBox messages --> <string name="MBCmdLineError"> |