diff options
232 files changed, 9916 insertions, 6557 deletions
@@ -55,3 +55,8 @@ glob:*.cpp.orig glob:*.cpp.bak glob:*.h.bak glob:*.h.orig +glob:indra/newview/typed_locations.txt +glob:indra/newview/teleport_history.txt +glob:indra/newview/search_history.txt +glob:indra/newview/filters.xml +glob:indra/newview/avatar_icons_cache.txt diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 920d8c0977..37370e44e7 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -291,8 +291,8 @@ LLMutex::LLMutex(apr_pool_t *poolp) : LLMutex::~LLMutex() { -#if _DEBUG - llassert(!isLocked()); // better not be locked! +#if MUTEX_DEBUG + llassert_always(!isLocked()); // better not be locked! #endif apr_thread_mutex_destroy(mAPRMutexp); mAPRMutexp = NULL; @@ -306,10 +306,24 @@ LLMutex::~LLMutex() void LLMutex::lock() { apr_thread_mutex_lock(mAPRMutexp); +#if MUTEX_DEBUG + // Have to have the lock before we can access the debug info + U32 id = LLThread::currentID(); + if (mIsLocked[id] != FALSE) + llerrs << "Already locked in Thread: " << id << llendl; + mIsLocked[id] = TRUE; +#endif } void LLMutex::unlock() { +#if MUTEX_DEBUG + // Access the debug info while we have the lock + U32 id = LLThread::currentID(); + if (mIsLocked[id] != TRUE) + llerrs << "Not locked in Thread: " << id << llendl; + mIsLocked[id] = FALSE; +#endif apr_thread_mutex_unlock(mAPRMutexp); } diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index 932d96d940..d8aa90de2e 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -128,6 +128,8 @@ protected: //============================================================================ +#define MUTEX_DEBUG (LL_DEBUG || LL_RELEASE_WITH_DEBUG_INFO) + class LL_COMMON_API LLMutex { public: @@ -142,6 +144,9 @@ protected: apr_thread_mutex_t *mAPRMutexp; apr_pool_t *mAPRPoolp; BOOL mIsLocalPool; +#if MUTEX_DEBUG + std::map<U32, BOOL> mIsLocked; +#endif }; // Actually a condition/mutex pair (since each condition needs to be associated with a mutex). diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index a403c44b71..3078d80552 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -189,6 +189,7 @@ typedef std::set<LLUUID> AskQueue; typedef std::list<PendingReply*> ReplyQueue; typedef std::map<LLUUID,U32> PendingQueue; typedef std::map<LLUUID, LLCacheNameEntry*> Cache; +typedef std::map<std::string, LLUUID> ReverseCache; class LLCacheName::Impl { @@ -198,7 +199,9 @@ public: Cache mCache; // the map of UUIDs to names - + ReverseCache mReverseCache; + // map of names to UUIDs + AskQueue mAskNameQueue; AskQueue mAskGroupQueue; // UUIDs to ask our upstream host about @@ -371,7 +374,9 @@ void LLCacheName::importFile(LLFILE* fp) entry->mFirstName = firstname; entry->mLastName = lastname; impl.mCache[id] = entry; - + std::string fullname = entry->mFirstName + " " + entry->mLastName; + impl.mReverseCache[fullname] = id; + count++; } @@ -407,6 +412,8 @@ bool LLCacheName::importFile(std::istream& istr) entry->mFirstName = agent[FIRST].asString(); entry->mLastName = agent[LAST].asString(); impl.mCache[id] = entry; + std::string fullname = entry->mFirstName + " " + entry->mLastName; + impl.mReverseCache[fullname] = id; ++count; } @@ -428,6 +435,7 @@ bool LLCacheName::importFile(std::istream& istr) entry->mCreateTime = ctime; entry->mGroupName = group[NAME].asString(); impl.mCache[id] = entry; + impl.mReverseCache[entry->mGroupName] = id; ++count; } llinfos << "LLCacheName loaded " << count << " group names" << llendl; @@ -548,6 +556,27 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group) return FALSE; } } + +BOOL LLCacheName::getUUID(const std::string& first, const std::string& last, LLUUID& id) +{ + std::string fullname = first + " " + last; + return getUUID(fullname, id); +} + +BOOL LLCacheName::getUUID(const std::string& fullname, LLUUID& id) +{ + ReverseCache::iterator iter = impl.mReverseCache.find(fullname); + if (iter != impl.mReverseCache.end()) + { + id = iter->second; + return TRUE; + } + else + { + return FALSE; + } +} + // This is a little bit kludgy. LLCacheNameCallback is a slot instead of a function pointer. // The reason it is a slot is so that the legacy get() function below can bind an old callback // and pass it as a slot. The reason it isn't a boost::function is so that trackable behavior @@ -897,10 +926,13 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup) if (!isGroup) { mSignal(id, entry->mFirstName, entry->mLastName, FALSE); + std::string fullname = entry->mFirstName + " " + entry->mLastName; + mReverseCache[fullname] = id; } else { mSignal(id, entry->mGroupName, "", TRUE); + mReverseCache[entry->mGroupName] = id; } } } diff --git a/indra/llmessage/llcachename.h b/indra/llmessage/llcachename.h index 8641437d86..111cc8b650 100644 --- a/indra/llmessage/llcachename.h +++ b/indra/llmessage/llcachename.h @@ -86,6 +86,10 @@ public: BOOL getName(const LLUUID& id, std::string& first, std::string& last); BOOL getFullName(const LLUUID& id, std::string& fullname); + // Reverse lookup of UUID from name + BOOL getUUID(const std::string& first, const std::string& last, LLUUID& id); + BOOL getUUID(const std::string& fullname, LLUUID& id); + // If available, this method copies the group name into the string // provided. The caller must allocate at least // DB_GROUP_NAME_BUF_SIZE characters. If not available, this diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index f0df3bcf90..d9520b3bf6 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -61,11 +61,8 @@ BOOL LLRenderTarget::sUseFBO = FALSE; LLRenderTarget::LLRenderTarget() : mResX(0), mResY(0), - mViewportWidth(0), - mViewportHeight(0), mTex(0), mFBO(0), - mColorFmt(0), mDepth(0), mStencil(0), mUseDepth(FALSE), @@ -89,31 +86,13 @@ void LLRenderTarget::setSampleBuffer(LLMultisampleBuffer* buffer) void LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage, BOOL use_fbo) { - // only reallocate if something changed - if (mResX == resx - && mResY == resy - && mUseDepth == depth - && mStencil == stencil - && mUsage == usage - && (mFBO != 0) == ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject) - && mColorFmt == color_fmt) - { - // nothing to do - return; - } - stop_glerror(); mResX = resx; mResY = resy; - // default viewport to entire texture - mViewportWidth = mResX; - mViewportHeight = mResY; mStencil = stencil; mUsage = usage; mUseDepth = depth; - mFBO = 0; - mColorFmt = color_fmt; release(); @@ -333,7 +312,7 @@ void LLRenderTarget::bindTarget() } } - glViewport(0, 0, mViewportWidth, mViewportHeight); + glViewport(0, 0, mResX, mResY); sBoundTarget = this; } @@ -536,18 +515,12 @@ BOOL LLRenderTarget::isComplete() const return (!mTex.empty() || mDepth) ? TRUE : FALSE; } -void LLRenderTarget::setViewport(U32 width, U32 height) -{ - mViewportWidth = llmin(width, mResX); - mViewportHeight = llmin(height, mResY); -} - void LLRenderTarget::getViewport(S32* viewport) { viewport[0] = 0; viewport[1] = 0; - viewport[2] = mViewportWidth; - viewport[3] = mViewportHeight; + viewport[2] = mResX; + viewport[3] = mResY; } //================================================== @@ -608,7 +581,7 @@ void LLMultisampleBuffer::bindTarget(LLRenderTarget* ref) check_framebuffer_status(); - glViewport(0, 0, mViewportWidth, mViewportHeight); + glViewport(0, 0, mResX, mResY); sBoundTarget = this; } @@ -620,30 +593,13 @@ void LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth void LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, BOOL stencil, LLTexUnit::eTextureType usage, BOOL use_fbo, U32 samples ) { - if (mResX == resx - && mResY == resy - && mUseDepth == depth - && mStencil == stencil - && mUsage == usage - && (mFBO != 0) == ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject) - && mColorFmt == color_fmt - && mSamples == samples) - { - // nothing to do - return; - } - stop_glerror(); mResX = resx; mResY = resy; - mViewportWidth = mResX; - mViewportHeight = mResY; mUsage = usage; mUseDepth = depth; mStencil = stencil; - mFBO = 0; - mColorFmt = color_fmt; releaseSampleBuffer(); diff --git a/indra/llrender/llrendertarget.h b/indra/llrender/llrendertarget.h index 125747424c..b7ebfc8f7f 100644 --- a/indra/llrender/llrendertarget.h +++ b/indra/llrender/llrendertarget.h @@ -107,9 +107,6 @@ public: //uses scissor rect if in copy-to-texture mode void clear(U32 mask = 0xFFFFFFFF); - // override default viewport to a smaller size - void setViewport(U32 width, U32 height); - //get applied viewport void getViewport(S32* viewport); @@ -153,16 +150,12 @@ protected: friend class LLMultisampleBuffer; U32 mResX; U32 mResY; - U32 mViewportWidth; - U32 mViewportHeight; std::vector<U32> mTex; U32 mFBO; - U32 mColorFmt; U32 mDepth; BOOL mStencil; BOOL mUseDepth; BOOL mRenderDepth; - LLTexUnit::eTextureType mUsage; U32 mSamples; LLMultisampleBuffer* mSampleBuffer; diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index b65f248db2..8930e32055 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -147,7 +147,11 @@ LLButton::LLButton(const LLButton::Params& p) mCommitOnReturn(p.commit_on_return), mFadeWhenDisabled(FALSE), mForcePressedState(false), - mLastDrawCharsCount(0) + mLastDrawCharsCount(0), + mMouseDownSignal(NULL), + mMouseUpSignal(NULL), + mHeldDownSignal(NULL) + { static LLUICachedControl<S32> llbutton_orig_h_pad ("UIButtonOrigHPad", 0); static Params default_params(LLUICtrlFactory::getDefaultParams<LLButton>()); @@ -215,13 +219,28 @@ LLButton::LLButton(const LLButton::Params& p) } if (p.click_callback.isProvided()) - initCommitCallback(p.click_callback, mCommitSignal); // alias -> commit_callback + { + setCommitCallback(initCommitCallback(p.click_callback)); // alias -> commit_callback + } if (p.mouse_down_callback.isProvided()) - initCommitCallback(p.mouse_down_callback, mMouseDownSignal); + { + setMouseDownCallback(initCommitCallback(p.mouse_down_callback)); + } if (p.mouse_up_callback.isProvided()) - initCommitCallback(p.mouse_up_callback, mMouseUpSignal); + { + setMouseUpCallback(initCommitCallback(p.mouse_up_callback)); + } if (p.mouse_held_callback.isProvided()) - initCommitCallback(p.mouse_held_callback, mHeldDownSignal); + { + setHeldDownCallback(initCommitCallback(p.mouse_held_callback)); + } +} + +LLButton::~LLButton() +{ + delete mMouseDownSignal; + delete mMouseUpSignal; + delete mHeldDownSignal; } // HACK: Committing a button is the same as instantly clicking it. @@ -232,9 +251,9 @@ void LLButton::onCommit() // panel containing it. Therefore we need to call LLUICtrl::onCommit() // LAST, otherwise this becomes deleted memory. - mMouseDownSignal(this, LLSD()); + if (mMouseDownSignal) (*mMouseDownSignal)(this, LLSD()); - mMouseUpSignal(this, LLSD()); + if (mMouseUpSignal) (*mMouseUpSignal)(this, LLSD()); if (getSoundFlags() & MOUSE_DOWN) { @@ -257,19 +276,23 @@ void LLButton::onCommit() boost::signals2::connection LLButton::setClickedCallback( const commit_signal_t::slot_type& cb ) { - return mCommitSignal.connect(cb); + if (!mCommitSignal) mCommitSignal = new commit_signal_t(); + return mCommitSignal->connect(cb); } boost::signals2::connection LLButton::setMouseDownCallback( const commit_signal_t::slot_type& cb ) { - return mMouseDownSignal.connect(cb); + if (!mMouseDownSignal) mMouseDownSignal = new commit_signal_t(); + return mMouseDownSignal->connect(cb); } boost::signals2::connection LLButton::setMouseUpCallback( const commit_signal_t::slot_type& cb ) { - return mMouseUpSignal.connect(cb); + if (!mMouseUpSignal) mMouseUpSignal = new commit_signal_t(); + return mMouseUpSignal->connect(cb); } boost::signals2::connection LLButton::setHeldDownCallback( const commit_signal_t::slot_type& cb ) { - return mHeldDownSignal.connect(cb); + if (!mHeldDownSignal) mHeldDownSignal = new commit_signal_t(); + return mHeldDownSignal->connect(cb); } @@ -351,7 +374,7 @@ BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask) */ LLUICtrl::handleMouseDown(x, y, mask); - mMouseDownSignal(this, LLSD()); + if(mMouseDownSignal) (*mMouseDownSignal)(this, LLSD()); mMouseDownTimer.start(); mMouseDownFrame = (S32) LLFrameTimer::getFrameCount(); @@ -383,7 +406,7 @@ BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask) LLUICtrl::handleMouseUp(x, y, mask); // Regardless of where mouseup occurs, handle callback - mMouseUpSignal(this, LLSD()); + if(mMouseUpSignal) (*mMouseUpSignal)(this, LLSD()); resetMouseDownTimer(); @@ -493,7 +516,7 @@ BOOL LLButton::handleHover(S32 x, S32 y, MASK mask) { LLSD param; param["count"] = mMouseHeldDownCount++; - mHeldDownSignal(this, param); + if (mHeldDownSignal) (*mHeldDownSignal)(this, param); } } diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 3c1b57c4be..8c3b4bd859 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -128,6 +128,8 @@ protected: LLButton(const Params&); public: + + ~LLButton(); // For backward compatability only typedef boost::function<void(void*)> button_callback_t; @@ -251,9 +253,9 @@ private: void resetMouseDownTimer(); private: - commit_signal_t mMouseDownSignal; - commit_signal_t mMouseUpSignal; - commit_signal_t mHeldDownSignal; + commit_signal_t* mMouseDownSignal; + commit_signal_t* mMouseUpSignal; + commit_signal_t* mHeldDownSignal; const LLFontGL* mGLFont; diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index 48c76cf105..fa0abd55d0 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -392,9 +392,4 @@ void LLConsole::addLine(const LLWString& wline, F32 size, const LLColor4 &color) Paragraph paragraph(wline, color, mTimer.getElapsedTimeF32(), mFont, (F32)getRect().getWidth() ); mParagraphs.push_back ( paragraph ); - -#if LL_WINDOWS && LL_LCD_COMPILE - // add to LCD screen - AddNewDebugConsoleToLCD(wline); -#endif } diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index eac947a0d7..3867e910c0 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -50,7 +50,7 @@ class LLTextBox; * is ignored. The option "keep_one_selected" forces at least one item to be selected at any time (only for mouse events on items) * since any item of the list was selected. * - * Examples of using this control are presented in Picks panel (Me Profile and Profile View), where this control is used to + * Examples of using this control are presented in Picks panel (My Profile and Profile View), where this control is used to * manage the list of pick items. * * ASSUMPTIONS AND STUFF diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index bf965e8e28..262afbe661 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2642,10 +2642,14 @@ void LLFloater::initFromParams(const LLFloater::Params& p) // open callback if (p.open_callback.isProvided()) - initCommitCallback(p.open_callback, mOpenSignal); + { + mOpenSignal.connect(initCommitCallback(p.open_callback)); + } // close callback if (p.close_callback.isProvided()) - initCommitCallback(p.close_callback, mCloseSignal); + { + mCloseSignal.connect(initCommitCallback(p.close_callback)); + } } LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build"); diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 95c8dd84f6..1b98dddddc 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -195,6 +195,7 @@ public: /// The static isShown() can accept a NULL pointer (which of course /// returns false). When non-NULL, it calls the non-static isShown(). static bool isShown(const LLFloater* floater); + BOOL isFirstLook() { return mFirstLook; } // EXT-2653: This function is necessary to prevent overlapping for secondary showed toasts BOOL isFrontmost(); BOOL isDependent() { return !mDependeeHandle.isDead(); } void setCanMinimize(BOOL can_minimize); diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp index 00a80478cf..35fbc7b0a8 100644 --- a/indra/llui/llfocusmgr.cpp +++ b/indra/llui/llfocusmgr.cpp @@ -41,6 +41,10 @@ const F32 FOCUS_FADE_TIME = 0.3f; // NOTE: the LLFocusableElement implementation has been moved here from lluictrl.cpp. LLFocusableElement::LLFocusableElement() +: mFocusLostCallback(NULL), + mFocusReceivedCallback(NULL), + mFocusChangedCallback(NULL), + mTopLostCallback(NULL) { } @@ -59,23 +63,27 @@ BOOL LLFocusableElement::handleUnicodeChar(llwchar uni_char, BOOL called_from_pa // virtual LLFocusableElement::~LLFocusableElement() { + delete mFocusLostCallback; + delete mFocusReceivedCallback; + delete mFocusChangedCallback; + delete mTopLostCallback; } void LLFocusableElement::onFocusReceived() { - mFocusReceivedCallback(this); - mFocusChangedCallback(this); + if (mFocusReceivedCallback) (*mFocusReceivedCallback)(this); + if (mFocusChangedCallback) (*mFocusChangedCallback)(this); } void LLFocusableElement::onFocusLost() { - mFocusLostCallback(this); - mFocusChangedCallback(this); + if (mFocusLostCallback) (*mFocusLostCallback)(this); + if (mFocusChangedCallback) (*mFocusChangedCallback)(this); } void LLFocusableElement::onTopLost() { - mTopLostCallback(this); + if (mTopLostCallback) (*mTopLostCallback)(this); } BOOL LLFocusableElement::hasFocus() const @@ -87,6 +95,31 @@ void LLFocusableElement::setFocus(BOOL b) { } +boost::signals2::connection LLFocusableElement::setFocusLostCallback( const focus_signal_t::slot_type& cb) +{ + if (!mFocusLostCallback) mFocusLostCallback = new focus_signal_t(); + return mFocusLostCallback->connect(cb); +} + +boost::signals2::connection LLFocusableElement::setFocusReceivedCallback(const focus_signal_t::slot_type& cb) +{ + if (!mFocusReceivedCallback) mFocusReceivedCallback = new focus_signal_t(); + return mFocusReceivedCallback->connect(cb); +} + +boost::signals2::connection LLFocusableElement::setFocusChangedCallback(const focus_signal_t::slot_type& cb) +{ + if (!mFocusChangedCallback) mFocusChangedCallback = new focus_signal_t(); + return mFocusChangedCallback->connect(cb); +} + +boost::signals2::connection LLFocusableElement::setTopLostCallback(const focus_signal_t::slot_type& cb) +{ + if (!mTopLostCallback) mTopLostCallback = new focus_signal_t(); + return mTopLostCallback->connect(cb); +} + + LLFocusMgr gFocusMgr; diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index 2fa4e124fb..83ecd1d301 100644 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h @@ -56,10 +56,10 @@ public: typedef boost::signals2::signal<void(LLFocusableElement*)> focus_signal_t; - boost::signals2::connection setFocusLostCallback( const focus_signal_t::slot_type& cb) { return mFocusLostCallback.connect(cb);} - boost::signals2::connection setFocusReceivedCallback(const focus_signal_t::slot_type& cb) { return mFocusReceivedCallback.connect(cb);} - boost::signals2::connection setFocusChangedCallback(const focus_signal_t::slot_type& cb) { return mFocusChangedCallback.connect(cb);} - void setTopLostCallback(const focus_signal_t::slot_type& cb) { mTopLostCallback.connect(cb);} + boost::signals2::connection setFocusLostCallback( const focus_signal_t::slot_type& cb); + boost::signals2::connection setFocusReceivedCallback(const focus_signal_t::slot_type& cb); + boost::signals2::connection setFocusChangedCallback(const focus_signal_t::slot_type& cb); + boost::signals2::connection setTopLostCallback(const focus_signal_t::slot_type& cb); // These were brought up the hierarchy from LLView so that we don't have to use dynamic_cast when dealing with keyboard focus. virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); @@ -69,10 +69,10 @@ protected: virtual void onFocusReceived(); virtual void onFocusLost(); virtual void onTopLost(); // called when registered as top ctrl and user clicks elsewhere - focus_signal_t mFocusLostCallback; - focus_signal_t mFocusReceivedCallback; - focus_signal_t mFocusChangedCallback; - focus_signal_t mTopLostCallback; + focus_signal_t* mFocusLostCallback; + focus_signal_t* mFocusReceivedCallback; + focus_signal_t* mFocusChangedCallback; + focus_signal_t* mTopLostCallback; }; diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index c2f91ff7e0..bd5734312a 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -323,6 +323,19 @@ void LLLineEditor::setMaxTextLength(S32 max_text_length) mMaxLengthBytes = max_len; } +void LLLineEditor::getTextPadding(S32 *left, S32 *right) +{ + *left = mTextPadLeft; + *right = mTextPadRight; +} + +void LLLineEditor::setTextPadding(S32 left, S32 right) +{ + mTextPadLeft = left; + mTextPadRight = right; + updateTextPadding(); +} + void LLLineEditor::updateTextPadding() { static LLUICachedControl<S32> line_editor_hpad ("UILineEditorHPad", 0); @@ -626,7 +639,8 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask) // delay cursor flashing mKeystrokeTimer.reset(); - mMouseDownSignal(this,x,y,mask); + if (mMouseDownSignal) + (*mMouseDownSignal)(this,x,y,mask); return TRUE; } @@ -742,7 +756,8 @@ BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask) } // We won't call LLUICtrl::handleMouseUp to avoid double calls of childrenHandleMouseUp().Just invoke the signal manually. - mMouseUpSignal(this,x,y, mask); + if (mMouseUpSignal) + (*mMouseUpSignal)(this,x,y, mask); return handled; } diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 4474963b1a..4c4b00094d 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -226,6 +226,9 @@ public: void setKeystrokeCallback(callback_t callback, void* user_data); void setMaxTextLength(S32 max_text_length); + // Manipulate left and right padding for text + void getTextPadding(S32 *left, S32 *right); + void setTextPadding(S32 left, S32 right); // Prevalidation controls which keystrokes can affect the editor void setPrevalidate( LLLinePrevalidateFunc func ); diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index de9a854f63..f8935d03ac 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -760,21 +760,25 @@ void LLMenuItemCallGL::initFromParams(const Params& p) { if (p.on_visible.isProvided()) { - initVisibleCallback(p.on_visible, mVisibleSignal); + mVisibleSignal.connect(initVisibleCallback(p.on_visible)); } if (p.on_enable.isProvided()) { - initEnableCallback(p.on_enable, mEnableSignal); + setEnableCallback(initEnableCallback(p.on_enable)); // Set the enabled control variable (for backwards compatability) if (p.on_enable.control_name.isProvided() && !p.on_enable.control_name().empty()) { LLControlVariable* control = findControl(p.on_enable.control_name()); if (control) + { setEnabledControlVariable(control); + } } } if (p.on_click.isProvided()) - initCommitCallback(p.on_click, mCommitSignal); + { + setCommitCallback(initCommitCallback(p.on_click)); + } LLUICtrl::initFromParams(p); } @@ -795,7 +799,10 @@ void LLMenuItemCallGL::updateEnabled( void ) if (mEnabledControlVariable) { if (!enabled) - mEnabledControlVariable->set(false); // callback overrides control variable; this will call setEnabled() + { + // callback overrides control variable; this will call setEnabled() + mEnabledControlVariable->set(false); + } } else { @@ -854,7 +861,7 @@ void LLMenuItemCheckGL::initFromParams(const Params& p) { if (p.on_check.isProvided()) { - initEnableCallback(p.on_check, mCheckSignal); + setCheckCallback(initEnableCallback(p.on_check)); // Set the control name (for backwards compatability) if (p.on_check.control_name.isProvided() && !p.on_check.control_name().empty()) { diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 68e496aed1..1891bca36c 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -84,17 +84,30 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p) mThumbCenterSelectedColor(p.thumb_center_selected_color()), mDisabledThumbColor(p.thumb_disabled_color()), mTriangleColor(p.triangle_color()), - mThumbWidth(p.thumb_width) + mThumbWidth(p.thumb_width), + mMouseDownSignal(NULL), + mMouseUpSignal(NULL) { mValue.emptyMap(); mCurSlider = LLStringUtil::null; if (p.mouse_down_callback.isProvided()) - initCommitCallback(p.mouse_down_callback, mMouseDownSignal); + { + setMouseDownCallback(initCommitCallback(p.mouse_down_callback)); + } if (p.mouse_up_callback.isProvided()) - initCommitCallback(p.mouse_up_callback, mMouseUpSignal); + { + setMouseUpCallback(initCommitCallback(p.mouse_up_callback)); + } +} + +LLMultiSlider::~LLMultiSlider() +{ + delete mMouseDownSignal; + delete mMouseUpSignal; } + void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from_event) { // exit if not there @@ -325,7 +338,8 @@ BOOL LLMultiSlider::handleMouseUp(S32 x, S32 y, MASK mask) { gFocusMgr.setMouseCapture( NULL ); - mMouseUpSignal( this, LLSD() ); + if (mMouseUpSignal) + (*mMouseUpSignal)( this, LLSD() ); handled = TRUE; make_ui_sound("UISndClickRelease"); @@ -345,7 +359,8 @@ BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask) { setFocus(TRUE); } - mMouseDownSignal( this, LLSD() ); + if (mMouseDownSignal) + (*mMouseDownSignal)( this, LLSD() ); if (MASK_CONTROL & mask) // if CTRL is modifying { @@ -557,3 +572,15 @@ void LLMultiSlider::draw() LLF32UICtrl::draw(); } + +boost::signals2::connection LLMultiSlider::setMouseDownCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMouseDownSignal) mMouseDownSignal = new commit_signal_t(); + return mMouseDownSignal->connect(cb); +} + +boost::signals2::connection LLMultiSlider::setMouseUpCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMouseUpSignal) mMouseUpSignal = new commit_signal_t(); + return mMouseUpSignal->connect(cb); +} diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index da633cc1cd..f8e43a0470 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -67,6 +67,7 @@ protected: LLMultiSlider(const Params&); friend class LLUICtrlFactory; public: + virtual ~LLMultiSlider(); void setSliderValue(const std::string& name, F32 value, BOOL from_event = FALSE); F32 getSliderValue(const std::string& name) const; @@ -78,8 +79,8 @@ public: /*virtual*/ void setValue(const LLSD& value); /*virtual*/ LLSD getValue() const { return mValue; } - boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ) { return mMouseDownSignal.connect(cb); } - boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ) { return mMouseUpSignal.connect(cb); } + boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ); + boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ); bool findUnusedValue(F32& initVal); const std::string& addSlider(); @@ -116,8 +117,8 @@ protected: LLUIColor mDisabledThumbColor; LLUIColor mTriangleColor; - commit_signal_t mMouseDownSignal; - commit_signal_t mMouseUpSignal; + commit_signal_t* mMouseDownSignal; + commit_signal_t* mMouseUpSignal; }; #endif // LL_MULTI_SLIDER_H diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index a9f462173d..87938c19d4 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -344,7 +344,7 @@ void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata) if( self->mMultiSlider->getMinValue() <= val && val <= self->mMultiSlider->getMaxValue() ) { self->setCurSliderValue( val ); // set the value temporarily so that the callback can retrieve it. - if( self->mValidateSignal( self, val ) ) + if( !self->mValidateSignal || (*(self->mValidateSignal))( self, val ) ) { success = TRUE; } @@ -378,7 +378,7 @@ void LLMultiSliderCtrl::onSliderCommit(LLUICtrl* ctrl, const LLSD& userdata) F32 new_val = self->mMultiSlider->getCurSliderValue(); self->mCurValue = new_val; // set the value temporarily so that the callback can retrieve it. - if( self->mValidateSignal( self, new_val ) ) + if( !self->mValidateSignal || (*(self->mValidateSignal))( self, new_val ) ) { success = TRUE; } diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 89c4656297..063822dd56 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -106,7 +106,8 @@ LLPanel::LLPanel(const LLPanel::Params& p) mHelpTopic(p.help_topic), mCommitCallbackRegistrar(false), mEnableCallbackRegistrar(false), - mXMLFilename(p.filename) + mXMLFilename(p.filename), + mVisibleSignal(NULL) // *NOTE: Be sure to also change LLPanel::initFromParams(). We have too // many classes derived from LLPanel to retrofit them all to pass in params. { @@ -118,6 +119,11 @@ LLPanel::LLPanel(const LLPanel::Params& p) mPanelHandle.bind(this); } +LLPanel::~LLPanel() +{ + delete mVisibleSignal; +} + // virtual BOOL LLPanel::isPanel() const { @@ -332,7 +338,8 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask ) void LLPanel::handleVisibilityChange ( BOOL new_visibility ) { LLUICtrl::handleVisibilityChange ( new_visibility ); - mVisibleSignal(this, LLSD(new_visibility) ); // Pass BOOL as LLSD + if (mVisibleSignal) + (*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass BOOL as LLSD } void LLPanel::setFocus(BOOL b) @@ -424,7 +431,9 @@ void LLPanel::initFromParams(const LLPanel::Params& p) // visible callback if (p.visible_callback.isProvided()) - initCommitCallback(p.visible_callback, mVisibleSignal); + { + setVisibleCallback(initCommitCallback(p.visible_callback)); + } for (LLInitParam::ParamIterator<LocalizedString>::const_iterator it = p.strings().begin(); it != p.strings().end(); @@ -907,3 +916,13 @@ void LLPanel::childSetControlName(const std::string& id, const std::string& cont view->setControlName(control_name, NULL); } } + +boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mVisibleSignal) + { + mVisibleSignal = new commit_signal_t(); + } + + return mVisibleSignal->connect(cb); +} diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index c213809d68..0a0fed82fb 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -109,7 +109,7 @@ protected: public: // LLPanel(const std::string& name, const LLRect& rect = LLRect(), BOOL bordered = TRUE); - /*virtual*/ ~LLPanel() {} + /*virtual*/ ~LLPanel(); // LLView interface /*virtual*/ BOOL isPanel() const; @@ -241,6 +241,8 @@ public: void setXMLFilename(std::string filename) { mXMLFilename = filename; }; std::string getXMLFilename() { return mXMLFilename; }; + boost::signals2::connection setVisibleCallback( const commit_signal_t::slot_type& cb ); + protected: // Override to set not found list LLButton* getDefaultButton() { return mDefaultBtn; } @@ -249,7 +251,7 @@ protected: EnableCallbackRegistry::ScopedRegistrar mEnableCallbackRegistrar; VisibleCallbackRegistry::ScopedRegistrar mVisibleCallbackRegistrar; - commit_signal_t mVisibleSignal; // Called when visibility changes, passes new visibility as LLSD() + commit_signal_t* mVisibleSignal; // Called when visibility changes, passes new visibility as LLSD() std::string mHelpTopic; // the name of this panel's help topic to display in the Help Viewer diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp index da2fc7c68b..a6f729b396 100644 --- a/indra/llui/llslider.cpp +++ b/indra/llui/llslider.cpp @@ -77,7 +77,9 @@ LLSlider::LLSlider(const LLSlider::Params& p) mTrackImageHorizontal(p.track_image_horizontal), mTrackImageVertical(p.track_image_vertical), mTrackHighlightHorizontalImage(p.track_highlight_horizontal_image), - mTrackHighlightVerticalImage(p.track_highlight_vertical_image) + mTrackHighlightVerticalImage(p.track_highlight_vertical_image), + mMouseDownSignal(NULL), + mMouseUpSignal(NULL) { mViewModel->setValue(p.initial_value); updateThumbRect(); @@ -86,9 +88,19 @@ LLSlider::LLSlider(const LLSlider::Params& p) setValue(getValueF32()); if (p.mouse_down_callback.isProvided()) - initCommitCallback(p.mouse_down_callback, mMouseDownSignal); + { + setMouseDownCallback(initCommitCallback(p.mouse_down_callback)); + } if (p.mouse_up_callback.isProvided()) - initCommitCallback(p.mouse_up_callback, mMouseUpSignal); + { + setMouseUpCallback(initCommitCallback(p.mouse_up_callback)); + } +} + +LLSlider::~LLSlider() +{ + delete mMouseDownSignal; + delete mMouseUpSignal; } void LLSlider::setValue(F32 value, BOOL from_event) @@ -202,7 +214,8 @@ BOOL LLSlider::handleMouseUp(S32 x, S32 y, MASK mask) { gFocusMgr.setMouseCapture( NULL ); - mMouseUpSignal( this, getValueF32() ); + if (mMouseUpSignal) + (*mMouseUpSignal)( this, getValueF32() ); handled = TRUE; make_ui_sound("UISndClickRelease"); @@ -222,7 +235,8 @@ BOOL LLSlider::handleMouseDown(S32 x, S32 y, MASK mask) { setFocus(TRUE); } - mMouseDownSignal( this, getValueF32() ); + if (mMouseDownSignal) + (*mMouseDownSignal)( this, getValueF32() ); if (MASK_CONTROL & mask) // if CTRL is modifying { @@ -364,3 +378,15 @@ void LLSlider::draw() LLUICtrl::draw(); } + +boost::signals2::connection LLSlider::setMouseDownCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMouseDownSignal) mMouseDownSignal = new commit_signal_t(); + return mMouseDownSignal->connect(cb); +} + +boost::signals2::connection LLSlider::setMouseUpCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMouseUpSignal) mMouseUpSignal = new commit_signal_t(); + return mMouseUpSignal->connect(cb); +} diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h index 6ab0ed7922..45f8f81e40 100644 --- a/indra/llui/llslider.h +++ b/indra/llui/llslider.h @@ -67,6 +67,7 @@ protected: LLSlider(const Params&); friend class LLUICtrlFactory; public: + virtual ~LLSlider(); void setValue( F32 value, BOOL from_event = FALSE ); // overrides for LLF32UICtrl methods virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), TRUE); } @@ -76,8 +77,8 @@ public: virtual void setMinValue(F32 min_value) { LLF32UICtrl::setMinValue(min_value); updateThumbRect(); } virtual void setMaxValue(F32 max_value) { LLF32UICtrl::setMaxValue(max_value); updateThumbRect(); } - boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ) { return mMouseDownSignal.connect(cb); } - boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ) { return mMouseUpSignal.connect(cb); } + boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ); + boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ); virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); @@ -109,8 +110,8 @@ private: LLUIColor mThumbOutlineColor; LLUIColor mThumbCenterColor; - commit_signal_t mMouseDownSignal; - commit_signal_t mMouseUpSignal; + commit_signal_t* mMouseDownSignal; + commit_signal_t* mMouseUpSignal; }; #endif // LL_LLSLIDER_H diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index ed22c0a47f..01c274bb4e 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -122,7 +122,8 @@ LLSliderCtrl::LLSliderCtrl(const LLSliderCtrl::Params& p) slider_p.min_value.setIfNotProvided(p.min_value); slider_p.max_value.setIfNotProvided(p.max_value); slider_p.increment.setIfNotProvided(p.increment); - + slider_p.orientation.setIfNotProvided(p.orientation); + slider_p.commit_callback.function(&LLSliderCtrl::onSliderCommit); slider_p.control_name(p.control_name); slider_p.mouse_down_callback( p.mouse_down_callback ); @@ -260,7 +261,7 @@ void LLSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata ) if( self->mSlider->getMinValue() <= val && val <= self->mSlider->getMaxValue() ) { self->setValue( val ); // set the value temporarily so that the callback can retrieve it. - if( self->mValidateSignal( self, val ) ) + if( !self->mValidateSignal || (*(self->mValidateSignal))( self, val ) ) { success = TRUE; } @@ -294,7 +295,7 @@ void LLSliderCtrl::onSliderCommit( LLUICtrl* ctrl, const LLSD& userdata ) F32 new_val = self->mSlider->getValueF32(); self->mValue = new_val; // set the value temporarily so that the callback can retrieve it. - if( self->mValidateSignal( self, new_val ) ) + if( !self->mValidateSignal || (*(self->mValidateSignal))( self, new_val ) ) { success = TRUE; } diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h index 4a1574d502..c425849782 100644 --- a/indra/llui/llsliderctrl.h +++ b/indra/llui/llsliderctrl.h @@ -46,6 +46,7 @@ class LLSliderCtrl : public LLF32UICtrl public: struct Params : public LLInitParam::Block<Params, LLF32UICtrl::Params> { + Optional<std::string> orientation; Optional<S32> label_width; Optional<S32> text_width; Optional<bool> show_text; @@ -78,7 +79,8 @@ public: value_text("value_text"), slider_label("slider_label"), mouse_down_callback("mouse_down_callback"), - mouse_up_callback("mouse_up_callback") + mouse_up_callback("mouse_up_callback"), + orientation("orientation", std::string ("horizontal")) {} }; protected: diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index bedf16a397..d6d46654d5 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -190,7 +190,7 @@ void LLSpinCtrl::onUpBtn( const LLSD& data ) F32 saved_val = (F32)getValue().asReal(); setValue(val); - if( !mValidateSignal( this, val ) ) + if( mValidateSignal && !(*mValidateSignal)( this, val ) ) { setValue( saved_val ); reportInvalidData(); @@ -224,7 +224,7 @@ void LLSpinCtrl::onDownBtn( const LLSD& data ) F32 saved_val = (F32)getValue().asReal(); setValue(val); - if( !mValidateSignal( this, val ) ) + if( mValidateSignal && !(*mValidateSignal)( this, val ) ) { setValue( saved_val ); reportInvalidData(); @@ -316,7 +316,7 @@ void LLSpinCtrl::onEditorCommit( const LLSD& data ) F32 saved_val = getValueF32(); setValue(val); - if( mValidateSignal( this, val ) ) + if( !mValidateSignal || (*mValidateSignal)( this, val ) ) { success = TRUE; onCommit(); diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index f5d8174820..d7d61cf6cb 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1339,12 +1339,12 @@ BOOL LLTabContainer::selectTab(S32 which) cbdata = selected_tuple->mTabPanel->getName(); BOOL res = FALSE; - if( mValidateSignal( this, cbdata ) ) + if( !mValidateSignal || (*mValidateSignal)( this, cbdata ) ) { res = setTab(which); - if (res) + if (res && mCommitSignal) { - mCommitSignal(this, cbdata); + (*mCommitSignal)(this, cbdata); } } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index e210667764..7bf10d774c 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -60,6 +60,11 @@ LLTextBase::line_info::line_info(S32 index_start, S32 index_end, LLRect rect, S3 bool LLTextBase::compare_segment_end::operator()(const LLTextSegmentPtr& a, const LLTextSegmentPtr& b) const { + // sort empty spans (e.g. 11-11) after previous non-empty spans (e.g. 5-11) + if (a->getEnd() == b->getEnd()) + { + return a->getStart() < b->getStart(); + } return a->getEnd() < b->getEnd(); } @@ -2060,16 +2065,16 @@ void LLTextBase::updateRects() mContentsRect.unionWith(line_iter->mRect); } - mContentsRect.mLeft = 0; + S32 delta_pos_x = -mContentsRect.mLeft; mContentsRect.mTop += mVPad; S32 delta_pos = -mContentsRect.mBottom; // move line segments to fit new document rect for (line_list_t::iterator it = mLineInfoList.begin(); it != mLineInfoList.end(); ++it) { - it->mRect.translate(0, delta_pos); + it->mRect.translate(delta_pos_x, delta_pos); } - mContentsRect.translate(0, delta_pos); + mContentsRect.translate(delta_pos_x, delta_pos); } // update document container dimensions according to text contents diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index 224f066968..3f4ef24f82 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -750,8 +750,10 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask) { if( mIsSelecting ) { - mScroller->autoScroll(x, y); - + if(mScroller) + { + mScroller->autoScroll(x, y); + } S32 clamped_x = llclamp(x, mTextRect.mLeft, mTextRect.mRight); S32 clamped_y = llclamp(y, mTextRect.mBottom, mTextRect.mTop); setCursorAtLocalPos( clamped_x, clamped_y, true ); @@ -799,7 +801,10 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask) { if( mIsSelecting ) { - mScroller->autoScroll(x, y); + if(mScroller) + { + mScroller->autoScroll(x, y); + } S32 clamped_x = llclamp(x, mTextRect.mLeft, mTextRect.mRight); S32 clamped_y = llclamp(y, mTextRect.mBottom, mTextRect.mTop); setCursorAtLocalPos( clamped_x, clamped_y, true ); @@ -1696,7 +1701,15 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask ) */ if (mReadOnly) { - handled = mScroller->handleKeyHere( key, mask ); + if(mScroller) + { + handled = mScroller->handleKeyHere( key, mask ); + } + else + { + handled = handleNavigationKey( key, mask ); + } + } else { @@ -2135,9 +2148,8 @@ void LLTextEditor::drawPreeditMarker() void LLTextEditor::drawLineNumbers() { LLGLSUIDefault gls_ui; - - LLRect scrolled_view_rect = mScroller->getVisibleContentRect(); - LLRect content_rect = mScroller->getContentWindowRect(); + LLRect scrolled_view_rect = getVisibleDocumentRect(); + LLRect content_rect = getTextRect(); LLLocalClipRect clip(content_rect); S32 first_line = getFirstVisibleLine(); S32 num_lines = getLineCount(); diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 08fc8fb784..a30d5b4651 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -78,7 +78,16 @@ LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel) mEnabledControlVariable(NULL), mDisabledControlVariable(NULL), mMakeVisibleControlVariable(NULL), - mMakeInvisibleControlVariable(NULL) + mMakeInvisibleControlVariable(NULL), + mCommitSignal(NULL), + mValidateSignal(NULL), + mMouseEnterSignal(NULL), + mMouseLeaveSignal(NULL), + mMouseDownSignal(NULL), + mMouseUpSignal(NULL), + mRightMouseDownSignal(NULL), + mRightMouseUpSignal(NULL), + mDoubleClickSignal(NULL) { mUICtrlHandle.bind(this); } @@ -129,10 +138,14 @@ void LLUICtrl::initFromParams(const Params& p) } if (p.commit_callback.isProvided()) - initCommitCallback(p.commit_callback, mCommitSignal); + { + setCommitCallback(initCommitCallback(p.commit_callback)); + } if (p.validate_callback.isProvided()) - initEnableCallback(p.validate_callback, mValidateSignal); + { + setValidateCallback(initEnableCallback(p.validate_callback)); + } if (p.init_callback.isProvided()) { @@ -151,10 +164,14 @@ void LLUICtrl::initFromParams(const Params& p) } if(p.mouseenter_callback.isProvided()) - initCommitCallback(p.mouseenter_callback, mMouseEnterSignal); + { + setMouseEnterCallback(initCommitCallback(p.mouseenter_callback)); + } if(p.mouseleave_callback.isProvided()) - initCommitCallback(p.mouseleave_callback, mMouseLeaveSignal); + { + setMouseLeaveCallback(initCommitCallback(p.mouseleave_callback)); + } } @@ -167,16 +184,40 @@ LLUICtrl::~LLUICtrl() llwarns << "UI Control holding top ctrl deleted: " << getName() << ". Top view removed." << llendl; gFocusMgr.removeTopCtrlWithoutCallback( this ); } + + delete mCommitSignal; + delete mValidateSignal; + delete mMouseEnterSignal; + delete mMouseLeaveSignal; + delete mMouseDownSignal; + delete mMouseUpSignal; + delete mRightMouseDownSignal; + delete mRightMouseUpSignal; + delete mDoubleClickSignal; } -void LLUICtrl::initCommitCallback(const CommitCallbackParam& cb, commit_signal_t& sig) +void default_commit_handler(LLUICtrl* ctrl, const LLSD& param) +{} + +bool default_enable_handler(LLUICtrl* ctrl, const LLSD& param) +{ + return true; +} + +bool default_visible_handler(LLUICtrl* ctrl, const LLSD& param) +{ + return true; +} + + +LLUICtrl::commit_signal_t::slot_type LLUICtrl::initCommitCallback(const CommitCallbackParam& cb) { if (cb.function.isProvided()) { if (cb.parameter.isProvided()) - sig.connect(boost::bind(cb.function(), _1, cb.parameter)); + return boost::bind(cb.function(), _1, cb.parameter); else - sig.connect(cb.function()); + return cb.function(); } else { @@ -185,26 +226,27 @@ void LLUICtrl::initCommitCallback(const CommitCallbackParam& cb, commit_signal_t if (func) { if (cb.parameter.isProvided()) - sig.connect(boost::bind((*func), _1, cb.parameter)); + return boost::bind((*func), _1, cb.parameter); else - sig.connect(*func); + return commit_signal_t::slot_type(*func); } else if (!function_name.empty()) { llwarns << "No callback found for: '" << function_name << "' in control: " << getName() << llendl; } } + return default_commit_handler; } -void LLUICtrl::initEnableCallback(const EnableCallbackParam& cb, enable_signal_t& sig) +LLUICtrl::enable_signal_t::slot_type LLUICtrl::initEnableCallback(const EnableCallbackParam& cb) { // Set the callback function if (cb.function.isProvided()) { if (cb.parameter.isProvided()) - sig.connect(boost::bind(cb.function(), this, cb.parameter)); + return boost::bind(cb.function(), this, cb.parameter); else - sig.connect(cb.function()); + return cb.function(); } else { @@ -212,22 +254,23 @@ void LLUICtrl::initEnableCallback(const EnableCallbackParam& cb, enable_signal_t if (func) { if (cb.parameter.isProvided()) - sig.connect(boost::bind((*func), this, cb.parameter)); + return boost::bind((*func), this, cb.parameter); else - sig.connect(*func); + return enable_signal_t::slot_type(*func); } } + return default_enable_handler; } -void LLUICtrl::initVisibleCallback(const VisibleCallbackParam& cb, visible_signal_t& sig) +LLUICtrl::visible_signal_t::slot_type LLUICtrl::initVisibleCallback(const VisibleCallbackParam& cb) { // Set the callback function if (cb.function.isProvided()) { if (cb.parameter.isProvided()) - sig.connect(boost::bind(cb.function(), this, cb.parameter)); + return boost::bind(cb.function(), this, cb.parameter); else - sig.connect(cb.function()); + return cb.function(); } else { @@ -235,30 +278,40 @@ void LLUICtrl::initVisibleCallback(const VisibleCallbackParam& cb, visible_signa if (func) { if (cb.parameter.isProvided()) - sig.connect(boost::bind((*func), this, cb.parameter)); + return boost::bind((*func), this, cb.parameter); else - sig.connect(*func); + return visible_signal_t::slot_type(*func); } } + return default_visible_handler; } // virtual void LLUICtrl::onMouseEnter(S32 x, S32 y, MASK mask) { - mMouseEnterSignal(this, getValue()); + if (mMouseEnterSignal) + { + (*mMouseEnterSignal)(this, getValue()); + } } // virtual void LLUICtrl::onMouseLeave(S32 x, S32 y, MASK mask) { - mMouseLeaveSignal(this, getValue()); + if(mMouseLeaveSignal) + { + (*mMouseLeaveSignal)(this, getValue()); + } } //virtual BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask) { BOOL handled = LLView::handleMouseDown(x,y,mask); - mMouseDownSignal(this,x,y,mask); + if (mMouseDownSignal) + { + (*mMouseDownSignal)(this,x,y,mask); + } return handled; } @@ -266,7 +319,10 @@ BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask) { BOOL handled = LLView::handleMouseUp(x,y,mask); - mMouseUpSignal(this,x,y,mask); + if (mMouseUpSignal) + { + (*mMouseUpSignal)(this,x,y,mask); + } return handled; } @@ -274,7 +330,10 @@ BOOL LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask) BOOL LLUICtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) { BOOL handled = LLView::handleRightMouseDown(x,y,mask); - mRightMouseDownSignal(this,x,y,mask); + if (mRightMouseDownSignal) + { + (*mRightMouseDownSignal)(this,x,y,mask); + } return handled; } @@ -282,14 +341,20 @@ BOOL LLUICtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) BOOL LLUICtrl::handleRightMouseUp(S32 x, S32 y, MASK mask) { BOOL handled = LLView::handleRightMouseUp(x,y,mask); - mRightMouseUpSignal(this,x,y,mask); + if(mRightMouseUpSignal) + { + (*mRightMouseUpSignal)(this,x,y,mask); + } return handled; } BOOL LLUICtrl::handleDoubleClick(S32 x, S32 y, MASK mask) { BOOL handled = LLView::handleDoubleClick(x, y, mask); - mDoubleClickSignal(this, x, y, mask); + if (mDoubleClickSignal) + { + (*mDoubleClickSignal)(this, x, y, mask); + } return handled; } @@ -302,7 +367,8 @@ BOOL LLUICtrl::canFocusChildren() const void LLUICtrl::onCommit() { - mCommitSignal(this, getValue()); + if (mCommitSignal) + (*mCommitSignal)(this, getValue()); } //virtual @@ -832,7 +898,8 @@ boost::signals2::connection LLUICtrl::setCommitCallback( boost::function<void (L } boost::signals2::connection LLUICtrl::setValidateBeforeCommit( boost::function<bool (const LLSD& data)> cb ) { - return mValidateSignal.connect(boost::bind(cb, _2)); + if (!mValidateSignal) mValidateSignal = new enable_signal_t(); + return mValidateSignal->connect(boost::bind(cb, _2)); } // virtual @@ -850,3 +917,57 @@ BOOL LLUICtrl::getTentative() const // virtual void LLUICtrl::setColor(const LLColor4& color) { } + +boost::signals2::connection LLUICtrl::setCommitCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mCommitSignal) mCommitSignal = new commit_signal_t(); + return mCommitSignal->connect(cb); +} + +boost::signals2::connection LLUICtrl::setValidateCallback( const enable_signal_t::slot_type& cb ) +{ + if (!mValidateSignal) mValidateSignal = new enable_signal_t(); + return mValidateSignal->connect(cb); +} + +boost::signals2::connection LLUICtrl::setMouseEnterCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMouseEnterSignal) mMouseEnterSignal = new commit_signal_t(); + return mMouseEnterSignal->connect(cb); +} + +boost::signals2::connection LLUICtrl::setMouseLeaveCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMouseLeaveSignal) mMouseLeaveSignal = new commit_signal_t(); + return mMouseLeaveSignal->connect(cb); +} + +boost::signals2::connection LLUICtrl::setMouseDownCallback( const mouse_signal_t::slot_type& cb ) +{ + if (!mMouseDownSignal) mMouseDownSignal = new mouse_signal_t(); + return mMouseDownSignal->connect(cb); +} + +boost::signals2::connection LLUICtrl::setMouseUpCallback( const mouse_signal_t::slot_type& cb ) +{ + if (!mMouseUpSignal) mMouseUpSignal = new mouse_signal_t(); + return mMouseUpSignal->connect(cb); +} + +boost::signals2::connection LLUICtrl::setRightMouseDownCallback( const mouse_signal_t::slot_type& cb ) +{ + if (!mRightMouseDownSignal) mRightMouseDownSignal = new mouse_signal_t(); + return mRightMouseDownSignal->connect(cb); +} + +boost::signals2::connection LLUICtrl::setRightMouseUpCallback( const mouse_signal_t::slot_type& cb ) +{ + if (!mRightMouseUpSignal) mRightMouseUpSignal = new mouse_signal_t(); + return mRightMouseUpSignal->connect(cb); +} + +boost::signals2::connection LLUICtrl::setDoubleClickCallback( const mouse_signal_t::slot_type& cb ) +{ + if (!mDoubleClickSignal) mDoubleClickSignal = new mouse_signal_t(); + return mDoubleClickSignal->connect(cb); +} diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index dd22851100..aef1bcd519 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -162,9 +162,9 @@ protected: LLUICtrl(const Params& p = getDefaultParams(), const LLViewModelPtr& viewmodel=LLViewModelPtr(new LLViewModel)); - void initCommitCallback(const CommitCallbackParam& cb, commit_signal_t& sig); - void initEnableCallback(const EnableCallbackParam& cb, enable_signal_t& sig); - void initVisibleCallback(const VisibleCallbackParam& cb, visible_signal_t& sig); + commit_signal_t::slot_type initCommitCallback(const CommitCallbackParam& cb); + enable_signal_t::slot_type initEnableCallback(const EnableCallbackParam& cb); + visible_signal_t::slot_type initVisibleCallback(const VisibleCallbackParam& cb); // We need this virtual so we can override it with derived versions virtual LLViewModel* getViewModel() const; @@ -254,18 +254,18 @@ public: // topic then put in help_topic_out bool findHelpTopic(std::string& help_topic_out); - boost::signals2::connection setCommitCallback( const commit_signal_t::slot_type& cb ) { return mCommitSignal.connect(cb); } - boost::signals2::connection setValidateCallback( const enable_signal_t::slot_type& cb ) { return mValidateSignal.connect(cb); } + boost::signals2::connection setCommitCallback( const commit_signal_t::slot_type& cb ); + boost::signals2::connection setValidateCallback( const enable_signal_t::slot_type& cb ); - boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb ) { return mMouseEnterSignal.connect(cb); } - boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb ) { return mMouseLeaveSignal.connect(cb); } + boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb ); + boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb ); - boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb ) { return mMouseDownSignal.connect(cb); } - boost::signals2::connection setMouseUpCallback( const mouse_signal_t::slot_type& cb ) { return mMouseUpSignal.connect(cb); } - boost::signals2::connection setRightMouseDownCallback( const mouse_signal_t::slot_type& cb ) { return mRightMouseDownSignal.connect(cb); } - boost::signals2::connection setRightMouseUpCallback( const mouse_signal_t::slot_type& cb ) { return mRightMouseUpSignal.connect(cb); } + boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb ); + boost::signals2::connection setMouseUpCallback( const mouse_signal_t::slot_type& cb ); + boost::signals2::connection setRightMouseDownCallback( const mouse_signal_t::slot_type& cb ); + boost::signals2::connection setRightMouseUpCallback( const mouse_signal_t::slot_type& cb ); - boost::signals2::connection setDoubleClickCallback( const mouse_signal_t::slot_type& cb ) { return mDoubleClickSignal.connect(cb); } + boost::signals2::connection setDoubleClickCallback( const mouse_signal_t::slot_type& cb ); // *TODO: Deprecate; for backwards compatability only: boost::signals2::connection setCommitCallback( boost::function<void (LLUICtrl*,void*)> cb, void* data); @@ -293,18 +293,18 @@ protected: static bool controlListener(const LLSD& newvalue, LLHandle<LLUICtrl> handle, std::string type); - commit_signal_t mCommitSignal; - enable_signal_t mValidateSignal; + commit_signal_t* mCommitSignal; + enable_signal_t* mValidateSignal; - commit_signal_t mMouseEnterSignal; - commit_signal_t mMouseLeaveSignal; + commit_signal_t* mMouseEnterSignal; + commit_signal_t* mMouseLeaveSignal; - mouse_signal_t mMouseDownSignal; - mouse_signal_t mMouseUpSignal; - mouse_signal_t mRightMouseDownSignal; - mouse_signal_t mRightMouseUpSignal; + mouse_signal_t* mMouseDownSignal; + mouse_signal_t* mMouseUpSignal; + mouse_signal_t* mRightMouseDownSignal; + mouse_signal_t* mRightMouseUpSignal; - mouse_signal_t mDoubleClickSignal; + mouse_signal_t* mDoubleClickSignal; LLViewModelPtr mViewModel; diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 219fae84be..b51709e208 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -34,6 +34,7 @@ #include "linden_common.h" #include "llurlentry.h" #include "lluri.h" + #include "llcachename.h" #include "lltrans.h" #include "lluicolortable.h" @@ -383,6 +384,38 @@ std::string LLUrlEntryGroup::getLabel(const std::string &url, const LLUrlLabelCa } } +// +// LLUrlEntryInventory Describes a Second Life inventory Url, e.g., +// secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/select +// +LLUrlEntryInventory::LLUrlEntryInventory() +{ + mPattern = boost::regex("secondlife:///app/inventory/[\\da-f-]+/\\w+", + boost::regex::perl|boost::regex::icase); + mMenuName = "menu_url_inventory.xml"; +} + +std::string LLUrlEntryInventory::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +{ + return unescapeUrl(url); + // TODO: Figure out if we can somehow access the inventory from here to get the actual item name + /* + std::string inventory_id_string = getIDStringFromUrl(url); + if (inventory_id_string.empty()) + { + // something went wrong, give raw url + return unescapeUrl(url); + } + LLUUID inventory_id(inventory_id_string); + LLInventoryItem* item = gInventory.getItem(inventory_id); + if(!item) + { + return unescapeUrl(url); + } + return item->getName(); */ +} + + /// /// LLUrlEntryParcel Describes a Second Life parcel Url, e.g., /// secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 7970b48eb5..b3fb333fdd 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -174,6 +174,19 @@ private: }; /// +/// LLUrlEntryInventory Describes a Second Life inventory Url, e.g., +/// secondlife:///app/inventory/0e346d8b-4433-4d66-a6b0-fd37083abc4c/select +/// +class LLUrlEntryInventory : public LLUrlEntryBase +{ +public: + LLUrlEntryInventory(); + /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); +private: +}; + + +/// /// LLUrlEntryParcel Describes a Second Life parcel Url, e.g., /// secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about /// diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index a6922b019b..b2f084e5ac 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -55,6 +55,7 @@ LLUrlRegistry::LLUrlRegistry() registerUrl(new LLUrlEntryPlace()); registerUrl(new LLUrlEntrySL()); registerUrl(new LLUrlEntrySLLabel()); + registerUrl(new LLUrlEntryInventory()); } LLUrlRegistry::~LLUrlRegistry() diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp index 318a0348a2..4c050844f8 100644 --- a/indra/llxuixml/llinitparam.cpp +++ b/indra/llxuixml/llinitparam.cpp @@ -46,7 +46,7 @@ namespace LLInitParam { const U8* my_addr = reinterpret_cast<const U8*>(this); const U8* block_addr = reinterpret_cast<const U8*>(enclosing_block); - mEnclosingBlockOffset = (S16)(block_addr - my_addr); + mEnclosingBlockOffset = (U16)(my_addr - block_addr); } // diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h index 9fb464ca7b..493ddaa378 100644 --- a/indra/llxuixml/llinitparam.h +++ b/indra/llxuixml/llinitparam.h @@ -300,14 +300,14 @@ namespace LLInitParam const U8* my_addr = reinterpret_cast<const U8*>(this); // get address of enclosing BLOCK class using stored offset to enclosing BaseBlock class return *const_cast<BaseBlock*>( - reinterpret_cast<const BaseBlock*>(my_addr + (ptrdiff_t)mEnclosingBlockOffset)); + reinterpret_cast<const BaseBlock*>(my_addr - (ptrdiff_t)(S32)mEnclosingBlockOffset)); } private: friend class BaseBlock; bool mIsProvided; - S16 mEnclosingBlockOffset; + U16 mEnclosingBlockOffset; }; // various callbacks and constraints associated with an individual param diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index f835950ee8..4d85a2f2cd 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -240,6 +240,7 @@ set(viewer_SOURCE_FILES llhudtext.cpp llhudview.cpp llimfloater.cpp + llimfloatercontainer.cpp llimhandler.cpp llimpanel.cpp llimview.cpp @@ -325,7 +326,7 @@ set(viewer_SOURCE_FILES llpanelmediasettingsgeneral.cpp llpanelmediasettingspermissions.cpp llpanelmediasettingssecurity.cpp - llpanelmeprofile.cpp + llpanelme.cpp llpanelobject.cpp llpanelobjectinventory.cpp llpaneloutfitsinventory.cpp @@ -365,6 +366,7 @@ set(viewer_SOURCE_FILES llremoteparcelrequest.cpp llsavedsettingsglue.cpp llscreenchannel.cpp + llscriptfloater.cpp llscrollingpanelparam.cpp llsearchcombobox.cpp llsearchhistory.cpp @@ -738,6 +740,7 @@ set(viewer_HEADER_FILES llhudtext.h llhudview.h llimfloater.h + llimfloatercontainer.h llimpanel.h llimview.h llinspect.h @@ -819,7 +822,7 @@ set(viewer_HEADER_FILES llpanelmediasettingsgeneral.h llpanelmediasettingspermissions.h llpanelmediasettingssecurity.h - llpanelmeprofile.h + llpanelme.h llpanelobject.h llpanelobjectinventory.h llpaneloutfitsinventory.h @@ -861,6 +864,7 @@ set(viewer_HEADER_FILES llrootview.h llsavedsettingsglue.h llscreenchannel.h + llscriptfloater.h llscrollingpanelparam.h llsearchcombobox.h llsearchhistory.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 7ac3a1b589..b0a6c62c16 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -3585,7 +3585,7 @@ <key>Type</key> <string>String</string> <key>Value</key> - <string>http://docs.lindenlab.com/help/helpfloater.php?topic=[TOPIC]&channel=[CHANNEL]&version=[VERSION]&os=[OS]&language=[LANGUAGE]&version_major=[VERSION_MAJOR]&version_minor=[VERSION_MINOR]&version_patch=[VERSION_PATCH]&version_build=[VERSION_BUILD]</string> + <string>http://viewer-help.secondlife.com/[LANGUAGE]/[CHANNEL]/[VERSION]/[TOPIC]</string> </map> <key>HighResSnapshot</key> <map> @@ -5371,6 +5371,19 @@ <key>Value</key> <real>1.0</real> </map> + + <key>PlainTextChatHistory</key> + <map> + <key>Comment</key> + <string>Enable/Disable plain text chat history style</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>PluginInstancesLow</key> <map> <key>Comment</key> @@ -7720,10 +7733,10 @@ <key>Value</key> <integer>0</integer> </map> - <key>ShowCoordinatesOption</key> + <key>NavBarShowCoordinates</key> <map> <key>Comment</key> - <string>Show Coordinates in Location Input Field</string> + <string>Show coordinates in navigation bar</string> <key>Persist</key> <integer>1</integer> <key>Type</key> @@ -7731,6 +7744,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>NavBarShowParcelProperties</key> + <map> + <key>Comment</key> + <string>Show parcel property icons in navigation bar</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>ShowCrosshairs</key> <map> <key>Comment</key> diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 4dd569e2fa..2644235114 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -734,6 +734,10 @@ BOOL LLAgent::canFly() return parcel->getAllowFly(); } +BOOL LLAgent::getFlying() const +{ + return mControlFlags & AGENT_CONTROL_FLY; +} //----------------------------------------------------------------------------- // setFlying() @@ -791,7 +795,7 @@ void LLAgent::setFlying(BOOL fly) // static void LLAgent::toggleFlying() { - BOOL fly = !(gAgent.mControlFlags & AGENT_CONTROL_FLY); + BOOL fly = !gAgent.getFlying(); gAgent.setFlying( fly ); gAgent.resetView(); @@ -2795,7 +2799,8 @@ void LLAgent::endAnimationUpdateUI() LLBottomTray::getInstance()->setVisible(TRUE); - LLSideTray::getInstance()->setVisible(TRUE); + LLSideTray::getInstance()->getButtonsPanel()->setVisible(TRUE); + LLSideTray::getInstance()->updateSidetrayVisibility(); LLPanelStandStopFlying::getInstance()->setVisible(TRUE); @@ -2893,7 +2898,8 @@ void LLAgent::endAnimationUpdateUI() LLBottomTray::getInstance()->setVisible(FALSE); - LLSideTray::getInstance()->setVisible(FALSE); + LLSideTray::getInstance()->getButtonsPanel()->setVisible(FALSE); + LLSideTray::getInstance()->updateSidetrayVisibility(); LLPanelStandStopFlying::getInstance()->setVisible(FALSE); diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 4162dfce1e..2e95dc72be 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -310,7 +310,7 @@ private: // Fly //-------------------------------------------------------------------- public: - BOOL getFlying() const { return mControlFlags & AGENT_CONTROL_FLY; } + BOOL getFlying() const; void setFlying(BOOL fly); static void toggleFlying(); static bool enableFlying(); diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp index 568ac4164a..7404fe5bc4 100644 --- a/indra/newview/llagentui.cpp +++ b/indra/newview/llagentui.cpp @@ -130,6 +130,7 @@ BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const // create a default name and description for the landmark std::string parcel_name = LLViewerParcelMgr::getInstance()->getAgentParcelName(); std::string region_name = region->getName(); + std::string sim_access_string = region->getSimAccessString(); std::string buffer; if( parcel_name.empty() ) { @@ -142,7 +143,13 @@ BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const case LOCATION_FORMAT_NORMAL: buffer = llformat("%s", region_name.c_str()); break; - case LOCATION_FORMAT_WITHOUT_SIM: + case LOCATION_FORMAT_NO_COORDS: + buffer = llformat("%s%s%s", + region_name.c_str(), + sim_access_string.empty() ? "" : " - ", + sim_access_string.c_str()); + break; + case LOCATION_FORMAT_NO_MATURITY: case LOCATION_FORMAT_FULL: buffer = llformat("%s (%d, %d, %d)", region_name.c_str(), @@ -161,14 +168,20 @@ BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const case LOCATION_FORMAT_NORMAL: buffer = llformat("%s, %s", parcel_name.c_str(), region_name.c_str()); break; - case LOCATION_FORMAT_WITHOUT_SIM: + case LOCATION_FORMAT_NO_MATURITY: buffer = llformat("%s, %s (%d, %d, %d)", parcel_name.c_str(), region_name.c_str(), pos_x, pos_y, pos_z); break; + case LOCATION_FORMAT_NO_COORDS: + buffer = llformat("%s, %s%s%s", + parcel_name.c_str(), + region_name.c_str(), + sim_access_string.empty() ? "" : " - ", + sim_access_string.c_str()); + break; case LOCATION_FORMAT_FULL: - std::string sim_access_string = region->getSimAccessString(); buffer = llformat("%s, %s (%d, %d, %d)%s%s", parcel_name.c_str(), region_name.c_str(), diff --git a/indra/newview/llagentui.h b/indra/newview/llagentui.h index c7aafb71e7..3478793e38 100644 --- a/indra/newview/llagentui.h +++ b/indra/newview/llagentui.h @@ -38,10 +38,11 @@ class LLAgentUI public: enum ELocationFormat { - LOCATION_FORMAT_NORMAL, - LOCATION_FORMAT_LANDMARK, - LOCATION_FORMAT_WITHOUT_SIM, - LOCATION_FORMAT_FULL, + LOCATION_FORMAT_NORMAL, // Parcel + LOCATION_FORMAT_LANDMARK, // Parcel, Region + LOCATION_FORMAT_NO_MATURITY, // Parcel, Region (x, y, z) + LOCATION_FORMAT_NO_COORDS, // Parcel, Region - Maturity + LOCATION_FORMAT_FULL, // Parcel, Region (x, y, z) - Maturity }; static void buildName(std::string& name); diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 538dcb6f3d..475f34dc2b 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -675,7 +675,7 @@ void LLAgentWearables::setWearable(const EWearableType type, U32 index, LLWearab { wearable_vec[index] = wearable; old_wearable->setLabelUpdated(); - mAvatarObject->wearableUpdated(wearable->getType()); + wearableUpdated(wearable); } } @@ -690,13 +690,32 @@ U32 LLAgentWearables::pushWearable(const EWearableType type, LLWearable *wearabl if (type < WT_COUNT || mWearableDatas[type].size() < MAX_WEARABLES_PER_TYPE) { mWearableDatas[type].push_back(wearable); - mAvatarObject->wearableUpdated(wearable->getType()); - wearable->setLabelUpdated(); + wearableUpdated(wearable); return mWearableDatas[type].size()-1; } return MAX_WEARABLES_PER_TYPE; } +void LLAgentWearables::wearableUpdated(LLWearable *wearable) +{ + mAvatarObject->wearableUpdated(wearable->getType()); + wearable->setLabelUpdated(); + + // Hack pt 2. If the wearable we just loaded has definition version 24, + // then force a re-save of this wearable after slamming the version number to 22. + // This number was incorrectly incremented for internal builds before release, and + // this fix will ensure that the affected wearables are re-saved with the right version number. + // the versions themselves are compatible. This code can be removed before release. + if( wearable->getDefinitionVersion() == 24 ) + { + wearable->setDefinitionVersion(22); + U32 index = getWearableIndex(wearable); + llinfos << "forcing werable type " << wearable->getType() << " to version 22 from 24" << llendl; + saveWearable(wearable->getType(),index,TRUE); + } + +} + void LLAgentWearables::popWearable(LLWearable *wearable) { if (wearable == NULL) @@ -1528,7 +1547,6 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it gInventory.notifyObservers(); - queryWearableCache(); std::vector<LLWearable*>::iterator wearable_iter; @@ -1551,6 +1569,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it // Start rendering & update the server mWearablesLoaded = TRUE; checkWearablesLoaded(); + queryWearableCache(); updateServer(); lldebugs << "setWearableOutfit() end" << llendl; @@ -2155,7 +2174,6 @@ void LLLibraryOutfitsFetch::contentsDone(void) LLInitialWearablesFetch::~LLInitialWearablesFetch() { - llinfos << "~LLInitialWearablesFetch" << llendl; } // virtual @@ -2185,17 +2203,50 @@ void LLInitialWearablesFetch::processContents() else { processWearablesMessage(); - // Create links for attachments that may have arrived before the COF existed. - LLAppearanceManager::instance().linkRegisteredAttachments(); } delete this; } +class LLFetchAndLinkObserver: public LLInventoryFetchObserver +{ +public: + LLFetchAndLinkObserver(LLInventoryFetchObserver::item_ref_t& ids): + m_ids(ids), + LLInventoryFetchObserver(true) + { + } + ~LLFetchAndLinkObserver() + { + } + virtual void done() + { + gInventory.removeObserver(this); + // Link to all fetched items in COF. + for (LLInventoryFetchObserver::item_ref_t::iterator it = m_ids.begin(); + it != m_ids.end(); + ++it) + { + LLUUID id = *it; + LLViewerInventoryItem *item = gInventory.getItem(*it); + if (!item) + { + llwarns << "fetch failed!" << llendl; + continue; + } + link_inventory_item(gAgent.getID(), item->getLinkedUUID(), LLAppearanceManager::instance().getCOF(), item->getName(), + LLAssetType::AT_LINK, LLPointer<LLInventoryCallback>(NULL)); + } + } +private: + LLInventoryFetchObserver::item_ref_t m_ids; +}; + void LLInitialWearablesFetch::processWearablesMessage() { if (!mAgentInitialWearables.empty()) // We have an empty current outfit folder, use the message data instead. { - const LLUUID current_outfit_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); + const LLUUID current_outfit_id = LLAppearanceManager::instance().getCOF(); + LLInventoryFetchObserver::item_ref_t ids; for (U8 i = 0; i < mAgentInitialWearables.size(); ++i) { // Populate the current outfit folder with links to the wearables passed in the message @@ -2204,9 +2255,7 @@ void LLInitialWearablesFetch::processWearablesMessage() if (wearable_data->mAssetID.notNull()) { #ifdef USE_CURRENT_OUTFIT_FOLDER - const std::string link_name = "WearableLink"; // Unimportant what this is named, it isn't exposed. - link_inventory_item(gAgent.getID(), wearable_data->mItemID, current_outfit_id, link_name, - LLAssetType::AT_LINK, LLPointer<LLInventoryCallback>(NULL)); + ids.push_back(wearable_data->mItemID); #endif // Fetch the wearables LLWearableList::instance().getAsset(wearable_data->mAssetID, @@ -2220,6 +2269,42 @@ void LLInitialWearablesFetch::processWearablesMessage() << wearable_data->mItemID << " assetID " << wearable_data->mAssetID << llendl; } } + + // Add all current attachments to the requested items as well. + LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); + if( avatar ) + { + for (LLVOAvatar::attachment_map_t::const_iterator iter = avatar->mAttachmentPoints.begin(); + iter != avatar->mAttachmentPoints.end(); ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + if (!attachment) continue; + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); + ++attachment_iter) + { + LLViewerObject* attached_object = (*attachment_iter); + if (!attached_object) continue; + const LLUUID& item_id = attached_object->getItemID(); + if (item_id.isNull()) continue; + ids.push_back(item_id); + } + } + } + + // Need to fetch the inventory items for ids, then create links to them after they arrive. + LLFetchAndLinkObserver *fetcher = new LLFetchAndLinkObserver(ids); + fetcher->fetchItems(ids); + // If no items to be fetched, done will never be triggered. + // TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition. + if (fetcher->isEverythingComplete()) + { + fetcher->done(); + } + else + { + gInventory.addObserver(fetcher); + } } else { diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index 8f3a16501e..b4f58674af 100644 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -107,6 +107,7 @@ private: // Low-level data structure setter - public access is via setWearableItem, etc. void setWearable(const EWearableType type, U32 index, LLWearable *wearable); U32 pushWearable(const EWearableType type, LLWearable *wearable); + void wearableUpdated(LLWearable *wearable); void popWearable(LLWearable *wearable); void popWearable(const EWearableType type, U32 index); diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 1050deaa27..6288088210 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -559,10 +559,9 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append) linkAll(cof, obj_items, link_waiter); linkAll(cof, gest_items, link_waiter); - // Add link to outfit if category is an outfit. - const LLViewerInventoryCategory* catp = gInventory.getCategory(category); LLSidepanelAppearance* panel_appearance = dynamic_cast<LLSidepanelAppearance *>(LLSideTray::getInstance()->getPanel("sidepanel_appearance")); - + // Add link to outfit if category is an outfit. + LLViewerInventoryCategory* catp = gInventory.getCategory(category); if (!append && catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT) { link_inventory_item(gAgent.getID(), category, cof, catp->getName(), @@ -576,10 +575,9 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append) } else { - // Update the current outfit name of the appearance sidepanel. if (panel_appearance) { - panel_appearance->refreshCurrentOutfitName(); + panel_appearance->refreshCurrentOutfitName(""); } } } @@ -858,7 +856,7 @@ bool areMatchingWearables(const LLViewerInventoryItem *a, const LLViewerInventor void LLAppearanceManager::addCOFItemLink(const LLUUID &item_id, bool do_update ) { const LLInventoryItem *item = gInventory.getItem(item_id); - addCOFItemLink(item); + addCOFItemLink(item, do_update); } void LLAppearanceManager::addCOFItemLink(const LLInventoryItem *item, bool do_update ) @@ -1029,7 +1027,6 @@ void LLAppearanceManager::registerAttachment(const LLUUID& item_id) if (mAttachmentInvLinkEnabled) { - //LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Adding attachment link:"); LLAppearanceManager::addCOFItemLink(item_id, false); // Add COF link for item. } else diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 4f2d3e9645..3e10c4b2b0 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -799,13 +799,6 @@ bool LLAppViewer::init() // call all self-registered classes LLInitClassList::instance().fireCallbacks(); - #if LL_LCD_COMPILE - // start up an LCD window on a logitech keyboard, if there is one - HINSTANCE hInstance = GetModuleHandle(NULL); - gLcdScreen = new LLLCD(hInstance); - CreateLCDDebugWindows(); -#endif - LLFolderViewItem::initClass(); // SJB: Needs to happen after initWindow(), not sure why but related to fonts gGLManager.getGLInfo(gDebugInfo); @@ -1360,19 +1353,25 @@ bool LLAppViewer::cleanup() llinfos << "Waiting for pending IO to finish: " << pending << llendflush; ms_sleep(100); } - llinfos << "Shutting down." << llendflush; + llinfos << "Shutting down Views" << llendflush; // Destroy the UI if( gViewerWindow) gViewerWindow->shutdownViews(); + + llinfos << "Cleaning up Inevntory" << llendflush; // Cleanup Inventory after the UI since it will delete any remaining observers // (Deleted observers should have already removed themselves) gInventory.cleanupInventory(); + + llinfos << "Cleaning up Selections" << llendflush; // Clean up selection managers after UI is destroyed, as UI may be observing them. // Clean up before GL is shut down because we might be holding on to objects with texture references LLSelectMgr::cleanupGlobals(); + + llinfos << "Shutting down OpenGL" << llendflush; // Shut down OpenGL if( gViewerWindow) @@ -1386,11 +1385,18 @@ bool LLAppViewer::cleanup() gViewerWindow = NULL; llinfos << "ViewerWindow deleted" << llendflush; } + + llinfos << "Cleaning up Keyboard & Joystick" << llendflush; // viewer UI relies on keyboard so keep it aound until viewer UI isa gone delete gKeyboard; gKeyboard = NULL; + // Turn off Space Navigator and similar devices + LLViewerJoystick::getInstance()->terminate(); + + llinfos << "Cleaning up Objects" << llendflush; + LLViewerObject::cleanupVOClasses(); LLWaterParamManager::cleanupClass(); @@ -1413,6 +1419,8 @@ bool LLAppViewer::cleanup() } LLPrimitive::cleanupVolumeManager(); + llinfos << "Additional Cleanup..." << llendflush; + LLViewerParcelMgr::cleanupGlobals(); // *Note: this is where gViewerStats used to be deleted. @@ -1432,9 +1440,11 @@ bool LLAppViewer::cleanup() // Also after shutting down the messaging system since it has VFS dependencies // + llinfos << "Cleaning up VFS" << llendflush; LLVFile::cleanupClass(); - llinfos << "VFS cleaned up" << llendflush; + llinfos << "Saving Data" << llendflush; + // Quitting with "Remember Password" turned off should always stomp your // saved password, whether or not you successfully logged in. JC if (!gSavedSettings.getBOOL("RememberPassword")) @@ -1476,13 +1486,16 @@ bool LLAppViewer::cleanup() gDirUtilp->deleteFilesInDir(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""),mask); } - // Turn off Space Navigator and similar devices - LLViewerJoystick::getInstance()->terminate(); - removeMarkerFile(); // Any crashes from here on we'll just have to ignore writeDebugInfo(); + LLLocationHistory::getInstance()->save(); + + LLAvatarIconIDCache::getInstance()->save(); + + llinfos << "Shutting down Threads" << llendflush; + // Let threads finish LLTimer idleTimer; idleTimer.reset(); @@ -1515,14 +1528,9 @@ bool LLAppViewer::cleanup() sTextureFetch = NULL; delete sImageDecodeThread; sImageDecodeThread = NULL; - - LLLocationHistory::getInstance()->save(); - - LLAvatarIconIDCache::getInstance()->save(); - delete mFastTimerLogThread; mFastTimerLogThread = NULL; - + if (LLFastTimerView::sAnalyzePerformance) { llinfos << "Analyzing performance" << llendl; @@ -1544,6 +1552,8 @@ bool LLAppViewer::cleanup() } LLMetricPerformanceTester::cleanClass() ; + llinfos << "Cleaning up Media and Textures" << llendflush; + //Note: //LLViewerMedia::cleanupClass() has to be put before gTextureList.shutdown() //because some new image might be generated during cleaning up media. --bao @@ -1557,13 +1567,13 @@ bool LLAppViewer::cleanup() LLVFSThread::cleanupClass(); LLLFSThread::cleanupClass(); - llinfos << "VFS Thread finished" << llendflush; - #ifndef LL_RELEASE_FOR_DOWNLOAD llinfos << "Auditing VFS" << llendl; gVFS->audit(); #endif + llinfos << "Misc Cleanup" << llendflush; + // For safety, the LLVFS has to be deleted *after* LLVFSThread. This should be cleaned up. // (LLVFS doesn't know about LLVFSThread so can't kill pending requests) -Steve delete gStaticVFS; @@ -1577,12 +1587,11 @@ bool LLAppViewer::cleanup() LLWatchdog::getInstance()->cleanup(); + llinfos << "Shutting down message system" << llendflush; end_messaging_system(); - llinfos << "Message system deleted." << llendflush; // *NOTE:Mani - The following call is not thread safe. LLCurl::cleanupClass(); - llinfos << "LLCurl cleaned up." << llendflush; // If we're exiting to launch an URL, do that here so the screen // is at the right resolution before we launch IE. @@ -1603,7 +1612,7 @@ bool LLAppViewer::cleanup() ll_close_fail_log(); - llinfos << "Goodbye" << llendflush; + llinfos << "Goodbye!" << llendflush; // return 0; return true; @@ -3537,7 +3546,7 @@ void LLAppViewer::idle() gEventNotifier.update(); gIdleCallbacks.callFunctions(); - gInventory.notifyObservers(); + gInventory.idleNotifyObservers(); } if (gDisconnected) diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 0844cca766..b08191ce15 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -297,7 +297,7 @@ void LLAvatarActions::showProfile(const LLUUID& id) //Show own profile if(gAgent.getID() == id) { - LLSideTray::getInstance()->showPanel("panel_me_profile", params); + LLSideTray::getInstance()->showPanel("panel_me", params); } //Show other user profile else @@ -324,6 +324,27 @@ void LLAvatarActions::pay(const LLUUID& id) } } +//static +void LLAvatarActions::share(const LLUUID& id) +{ + LLSD key; + LLSideTray::getInstance()->showPanel("sidepanel_inventory", key); + + + LLUUID session_id = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL,id); + + if (!gIMMgr->hasSession(session_id)) + { + startIM(id); + } + + if (gIMMgr->hasSession(session_id)) + { + // we should always get here, but check to verify anyways + LLIMModel::getInstance()->addMessage(session_id, SYSTEM_FROM, LLUUID::null, LLTrans::getString("share_alert"), false); + } +} + // static void LLAvatarActions::toggleBlock(const LLUUID& id) { @@ -347,9 +368,9 @@ void LLAvatarActions::inviteToGroup(const LLUUID& id) LLFloaterGroupPicker* widget = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(id)); if (widget) { - widget->removeNoneOption(); widget->center(); widget->setPowersMask(GP_MEMBER_INVITE); + widget->removeNoneOption(); widget->setSelectGroupCallback(boost::bind(callback_invite_to_group, _1, id)); } } diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index d9dab95a77..4c9851a48d 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -104,6 +104,11 @@ public: static void pay(const LLUUID& id); /** + * Share items with the avatar. + */ + static void share(const LLUUID& id); + + /** * Block/unblock the avatar. */ static void toggleBlock(const LLUUID& id); diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 4ce3b50ed5..2c9b38b82a 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -33,11 +33,9 @@ #include "llviewerprecompiledheaders.h" #include "llchathistory.h" #include "llpanel.h" -#include "lltextbox.h" #include "lluictrlfactory.h" #include "llscrollcontainer.h" #include "llavatariconctrl.h" - #include "llimview.h" #include "llcallingcard.h" //for LLAvatarTracker #include "llagentdata.h" @@ -185,11 +183,10 @@ public: mSourceType = CHAT_SOURCE_SYSTEM; } - LLTextBox* userName = getChild<LLTextBox>("user_name"); + LLTextEditor* userName = getChild<LLTextEditor>("user_name"); - LLUIColor color = style_params.color; - userName->setReadOnlyColor(color); - userName->setColor(color); + userName->setReadOnlyColor(style_params.readonly_color()); + userName->setColor(style_params.color()); if(!chat.mFromName.empty()) { @@ -202,10 +199,8 @@ public: userName->setValue(SL); } + setTimeField(chat.mTimeStr); - LLTextBox* timeBox = getChild<LLTextBox>("time_box"); - timeBox->setValue(chat.mTimeStr); - LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon"); if(mSourceType != CHAT_SOURCE_AGENT) @@ -271,7 +266,28 @@ protected: } } - +private: + void setTimeField(const std::string& time_value) + { + LLTextBox* time_box = getChild<LLTextBox>("time_box"); + + LLRect rect_before = time_box->getRect(); + time_box->setValue(time_value); + + // set necessary textbox width to fit all text + time_box->reshapeToFitText(); + LLRect rect_after = time_box->getRect(); + + // move rect to the left to correct position... + S32 delta_pos_x = rect_before.getWidth() - rect_after.getWidth(); + S32 delta_pos_y = rect_before.getHeight() - rect_after.getHeight(); + time_box->translate(delta_pos_x, delta_pos_y); + + //... & change width of the name control + LLTextBox* user_name = getChild<LLTextBox>("user_name"); + const LLRect& user_rect = user_name->getRect(); + user_name->reshape(user_rect.getWidth() + delta_pos_x, user_rect.getHeight()); + } protected: LLHandle<LLView> mPopupMenuHandleAvatar; @@ -334,20 +350,14 @@ LLView* LLChatHistory::getHeader(const LLChat& chat,const LLStyle::Params& style return header; } -void LLChatHistory::appendWidgetMessage(const LLChat& chat, const LLStyle::Params& input_append_params) +void LLChatHistory::clear() { - LLView* view = NULL; - std::string view_text = "\n[" + chat.mTimeStr + "] "; - if (utf8str_trim(chat.mFromName).size() != 0 && chat.mFromName != SYSTEM_FROM) - view_text += chat.mFromName + ": "; - - - LLInlineViewSegment::Params p; - p.force_newline = true; - p.left_pad = mLeftWidgetPad; - p.right_pad = mRightWidgetPad; + mLastFromName.clear(); + LLTextEditor::clear(); +} - +void LLChatHistory::appendMessage(const LLChat& chat, const bool use_plain_text_chat_history, const LLStyle::Params& input_append_params) +{ LLColor4 txt_color = LLUIColorTable::instance().getColor("White"); LLViewerChat::getChatColor(chat,txt_color); LLFontGL* fontp = LLViewerChat::getChatFont(); @@ -360,39 +370,63 @@ void LLChatHistory::appendWidgetMessage(const LLChat& chat, const LLStyle::Param style_params.font.size(font_size); style_params.font.style(input_append_params.font.style); - + std::string header_text = "[" + chat.mTimeStr + "] "; + if (utf8str_trim(chat.mFromName).size() != 0 && chat.mFromName != SYSTEM_FROM) + header_text += chat.mFromName + ": "; - if (mLastFromName == chat.mFromName) + if (use_plain_text_chat_history) { - view = getSeparator(); - p.top_pad = mTopSeparatorPad; - p.bottom_pad = mBottomSeparatorPad; + appendText(header_text, getText().size() != 0, style_params); } else { - view = getHeader(chat,style_params); - if (getText().size() == 0) - p.top_pad = 0; + LLView* view = NULL; + LLInlineViewSegment::Params p; + p.force_newline = true; + p.left_pad = mLeftWidgetPad; + p.right_pad = mRightWidgetPad; + + if (mLastFromName == chat.mFromName) + { + view = getSeparator(); + p.top_pad = mTopSeparatorPad; + p.bottom_pad = mBottomSeparatorPad; + } else - p.top_pad = mTopHeaderPad; - p.bottom_pad = mBottomHeaderPad; - + { + view = getHeader(chat, style_params); + if (getText().size() == 0) + p.top_pad = 0; + else + p.top_pad = mTopHeaderPad; + p.bottom_pad = mBottomHeaderPad; + + } + p.view = view; + + //Prepare the rect for the view + LLRect target_rect = getDocumentView()->getRect(); + // squeeze down the widget by subtracting padding off left and right + target_rect.mLeft += mLeftWidgetPad + mHPad; + target_rect.mRight -= mRightWidgetPad; + view->reshape(target_rect.getWidth(), view->getRect().getHeight()); + view->setOrigin(target_rect.mLeft, view->getRect().mBottom); + + appendWidget(p, header_text, false); + mLastFromName = chat.mFromName; } - p.view = view; - - //Prepare the rect for the view - LLRect target_rect = getDocumentView()->getRect(); - // squeeze down the widget by subtracting padding off left and right - target_rect.mLeft += mLeftWidgetPad + mHPad; - target_rect.mRight -= mRightWidgetPad; - view->reshape(target_rect.getWidth(), view->getRect().getHeight()); - view->setOrigin(target_rect.mLeft, view->getRect().mBottom); - - appendWidget(p, view_text, false); - - //Append the text message - appendText(chat.mText, FALSE, style_params); + //Handle IRC styled /me messages. + std::string prefix = chat.mText.substr(0, 4); + if (prefix == "/me " || prefix == "/me'") + { + style_params.font.style = "ITALIC"; - mLastFromName = chat.mFromName; + if (chat.mFromName.size() > 0) + appendText(chat.mFromName + " ", TRUE, style_params); + appendText(chat.mText.substr(4), FALSE, style_params); + } + else + appendText(chat.mText, FALSE, style_params); blockUndo(); } + diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h index c89d4b4ec6..ef5839ff2f 100644 --- a/indra/newview/llchathistory.h +++ b/indra/newview/llchathistory.h @@ -106,10 +106,11 @@ class LLChatHistory : public LLTextEditor * If last user appended message, concurs with current user, * separator is added before the message, otherwise header is added. * @param chat - base chat message. - * @param time time of a message. - * @param message message itself. + * @param use_plain_text_chat_history - whether to add message as plain text. + * @param input_append_params - font style. */ - void appendWidgetMessage(const LLChat& chat, const LLStyle::Params& input_append_params = LLStyle::Params()); + void appendMessage(const LLChat& chat, const bool use_plain_text_chat_history = false, const LLStyle::Params& input_append_params = LLStyle::Params()); + /*virtual*/ void clear(); private: std::string mLastFromName; diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 6a5877f673..90f246ddaf 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -43,6 +43,7 @@ #include "lllocalcliprect.h" #include "llmenugl.h" #include "lloutputmonitorctrl.h" +#include "llscriptfloater.h" #include "lltextbox.h" #include "llvoiceclient.h" #include "llvoicecontrolpanel.h" @@ -55,6 +56,7 @@ static LLDefaultChildRegistry::Register<LLNotificationChiclet> t2("chiclet_notif static LLDefaultChildRegistry::Register<LLIMP2PChiclet> t3("chiclet_im_p2p"); static LLDefaultChildRegistry::Register<LLIMGroupChiclet> t4("chiclet_im_group"); static LLDefaultChildRegistry::Register<LLAdHocChiclet> t5("chiclet_im_adhoc"); +static LLDefaultChildRegistry::Register<LLScriptChiclet> t6("chiclet_script"); static const LLRect CHICLET_RECT(0, 25, 25, 0); static const LLRect CHICLET_ICON_RECT(0, 22, 22, 0); @@ -163,7 +165,7 @@ LLChiclet::~LLChiclet() boost::signals2::connection LLChiclet::setLeftButtonClickCallback( const commit_callback_t& cb) { - return mCommitSignal.connect(cb); + return setCommitCallback(cb); } BOOL LLChiclet::handleMouseDown(S32 x, S32 y, MASK mask) @@ -983,7 +985,10 @@ void LLChicletPanel::onChicletSizeChanged(LLChiclet* ctrl, const LLSD& param) void LLChicletPanel::onChicletClick(LLUICtrl*ctrl,const LLSD¶m) { - mCommitSignal(ctrl,param); + if (mCommitSignal) + { + (*mCommitSignal)(ctrl,param); + } } void LLChicletPanel::removeChiclet(chiclet_list_t::iterator it) @@ -1288,7 +1293,7 @@ void LLChicletPanel::onRightScrollHeldDown() boost::signals2::connection LLChicletPanel::setChicletClickedCallback( const commit_callback_t& cb) { - return mCommitSignal.connect(cb); + return setCommitCallback(cb); } BOOL LLChicletPanel::handleScrollWheel(S32 x, S32 y, S32 clicks) @@ -1411,3 +1416,51 @@ LLChicletSpeakerCtrl::LLChicletSpeakerCtrl(const Params&p) : LLOutputMonitorCtrl(p) { } + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +LLScriptChiclet::Params::Params() + : icon("icon") +{ + // *TODO Vadim: Get rid of hardcoded values. + rect(CHICLET_RECT); + icon.rect(CHICLET_ICON_RECT); +} + +LLScriptChiclet::LLScriptChiclet(const Params&p) + : LLIMChiclet(p) + , mChicletIconCtrl(NULL) +{ + LLIconCtrl::Params icon_params = p.icon; + mChicletIconCtrl = LLUICtrlFactory::create<LLIconCtrl>(icon_params); + // Let "new message" icon be on top, else it will be hidden behind chiclet icon. + addChildInBack(mChicletIconCtrl); +} + +void LLScriptChiclet::setSessionId(const LLUUID& session_id) +{ + setShowNewMessagesIcon( getSessionId() != session_id ); + + LLIMChiclet::setSessionId(session_id); + LLUUID notification_id = LLScriptFloaterManager::getInstance()->findNotificationId(session_id); + LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id); + if(notification) + { + setToolTip(notification->getSubstitutions()["TITLE"].asString()); + } +} + +void LLScriptChiclet::onMouseDown() +{ + LLScriptFloaterManager::getInstance()->toggleScriptFloater(getSessionId()); +} + +BOOL LLScriptChiclet::handleMouseDown(S32 x, S32 y, MASK mask) +{ + onMouseDown(); + return LLChiclet::handleMouseDown(x, y, mask); +} + +// EOF diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 03935d21a6..1ea141e6c4 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -534,6 +534,46 @@ private: }; /** + * Chiclet for script floaters. + */ +class LLScriptChiclet : public LLIMChiclet +{ +public: + + struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params> + { + Optional<LLIconCtrl::Params> icon; + + Params(); + }; + + /*virtual*/ void setSessionId(const LLUUID& session_id); + + /*virtual*/ void setCounter(S32 counter){} + + /*virtual*/ S32 getCounter() { return 0; } + + /** + * Toggle script floater + */ + /*virtual*/ void onMouseDown(); + + /** + * Override default handler + */ + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + +protected: + + LLScriptChiclet(const Params&); + friend class LLUICtrlFactory; + +private: + + LLIconCtrl* mChicletIconCtrl; +}; + +/** * Implements Group chat chiclet. */ class LLIMGroupChiclet : public LLIMChiclet, public LLGroupMgrObserver diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index ae5be8cc7c..8406ddeeca 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -232,13 +232,15 @@ public: virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) { - mMouseDownSignal(this, x, y, mask); + if (mMouseDownSignal) + (*mMouseDownSignal)(this, x, y, mask); return LLMenuItemCallGL::handleMouseDown(x, y, mask); } virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) { - mMouseUpSignal(this, x, y, mask); + if (mMouseUpSignal) + (*mMouseUpSignal)(this, x, y, mask); return LLMenuItemCallGL::handleMouseUp(x, y, mask); } diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 467796b4a3..976aaf8044 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -903,7 +903,7 @@ void LLFloaterBuyLandUI::tellUserError( // virtual BOOL LLFloaterBuyLandUI::postBuild() { - mVisibleSignal.connect(boost::bind(&LLFloaterBuyLandUI::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLFloaterBuyLandUI::onVisibilityChange, this, _2)); mCurrency.prepare(); diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index 58025ef78b..57bb93d81a 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -129,7 +129,7 @@ void LLFloaterChat::draw() BOOL LLFloaterChat::postBuild() { // Hide the chat overlay when our history is visible. - mVisibleSignal.connect(boost::bind(&LLFloaterChat::updateConsoleVisibility, this)); + setVisibleCallback(boost::bind(&LLFloaterChat::updateConsoleVisibility, this)); mPanel = (LLPanelActiveSpeakers*)getChild<LLPanel>("active_speakers_panel"); diff --git a/indra/newview/llfloaterchatterbox.cpp b/indra/newview/llfloaterchatterbox.cpp index fbf09207fe..1b14ca573a 100644 --- a/indra/newview/llfloaterchatterbox.cpp +++ b/indra/newview/llfloaterchatterbox.cpp @@ -114,7 +114,7 @@ LLFloaterChatterBox::~LLFloaterChatterBox() BOOL LLFloaterChatterBox::postBuild() { - mVisibleSignal.connect(boost::bind(&LLFloaterChatterBox::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLFloaterChatterBox::onVisibilityChange, this, _2)); if (gSavedSettings.getBOOL("ContactsTornOff")) { diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 22d6098d5b..d855ab1dfa 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -239,7 +239,7 @@ LLFloaterLand::LLFloaterLand(const LLSD& seed) BOOL LLFloaterLand::postBuild() { - mVisibleSignal.connect(boost::bind(&LLFloaterLand::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLFloaterLand::onVisibilityChange, this, _2)); LLTabContainer* tab = getChild<LLTabContainer>("landtab"); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 6d2c35442a..e20249a737 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -56,6 +56,7 @@ #include "llfloaterabout.h" #include "llfloaterhardwaresettings.h" #include "llfloatervoicedevicesettings.h" +#include "llimfloater.h" #include "llkeyboard.h" #include "llmodaldialog.h" #include "llnavigationbar.h" @@ -357,6 +358,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) BOOL LLFloaterPreference::postBuild() { + gSavedSettings.getControl("PlainTextChatHistory")->getSignal()->connect(boost::bind(&LLIMFloater::processChatHistoryStyleUpdate, _2)); + LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core"); if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab"))) tabcontainer->selectFirstTab(); @@ -458,6 +461,8 @@ void LLFloaterPreference::apply() // LLWString busy_response = utf8str_to_wstring(getChild<LLUICtrl>("busy_response")->getValue().asString()); // LLWStringUtil::replaceTabsWithSpaces(busy_response, 4); + + gSavedSettings.setBOOL("PlainTextChatHistory", childGetValue("plain_text_chat_history").asBoolean()); if(mGotPersonalInfo) { @@ -1186,6 +1191,8 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im childSetLabelArg("online_visibility", "[DIR_VIS]", mDirectoryVisibility); childEnable("send_im_to_email"); childSetValue("send_im_to_email", im_via_email); + childEnable("plain_text_chat_history"); + childSetValue("plain_text_chat_history", gSavedSettings.getBOOL("PlainTextChatHistory")); childEnable("log_instant_messages"); // childEnable("log_chat"); // childEnable("busy_response"); diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 88a98c3350..dbd3643742 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -564,7 +564,8 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) mBtnEdit ->setToggleState( edit_visible ); mRadioGroupEdit->setVisible( edit_visible ); - childSetVisible("RenderingCost", edit_visible || focus_visible || move_visible); + bool linked_parts = gSavedSettings.getBOOL("EditLinkedParts"); + childSetVisible("RenderingCost", !linked_parts && (edit_visible || focus_visible || move_visible)); if (mCheckSelectIndividual) { @@ -976,6 +977,8 @@ void LLFloaterTools::onClickGridOptions() S32 LLFloaterTools::calcRenderCost() { S32 cost = 0; + std::set<LLUUID> textures; + for (LLObjectSelection::iterator selection_iter = LLSelectMgr::getInstance()->getSelection()->begin(); selection_iter != LLSelectMgr::getInstance()->getSelection()->end(); ++selection_iter) @@ -986,11 +989,14 @@ S32 LLFloaterTools::calcRenderCost() LLVOVolume *viewer_volume = (LLVOVolume*)select_node->getObject(); if (viewer_volume) { - cost += viewer_volume->getRenderCost(); + cost += viewer_volume->getRenderCost(textures); + cost += textures.size() * 5; + textures.clear(); } } } + return cost; } diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 955bc64e05..ab49739d58 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -39,11 +39,13 @@ #include "llinventoryclipboard.h" // *TODO: remove this once hack below gone. #include "llinventoryfilter.h" #include "llinventoryfunctions.h" +#include "llinventorypanel.h" #include "llfoldertype.h" #include "llfloaterinventory.h"// hacked in for the bonus context menu items. #include "llkeyboard.h" #include "lllineeditor.h" #include "llmenugl.h" +#include "llpanel.h" #include "llpreview.h" #include "llscrollcontainer.h" // hack to allow scrolling #include "lltooldraganddrop.h" @@ -2014,6 +2016,14 @@ static LLFastTimer::DeclareTimer FTM_INVENTORY("Inventory"); // Main idle routine void LLFolderView::doIdle() { + // If this is associated with the user's inventory, don't do anything + // until that inventory is loaded up. + const LLInventoryPanel *inventory_panel = dynamic_cast<LLInventoryPanel*>(mParentPanel); + if (inventory_panel && !inventory_panel->getIsViewsInitialized()) + { + return; + } + LLFastTimer t2(FTM_INVENTORY); BOOL debug_filters = gSavedSettings.getBOOL("DebugInventoryFilters"); diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 0bd65b5f90..a0e252ae88 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -41,25 +41,27 @@ #ifndef LL_LLFOLDERVIEW_H #define LL_LLFOLDERVIEW_H -// JAMESDEBUG - trim this list -#include <vector> -#include <map> -#include <deque> -#include <boost/function.hpp> -#include <boost/signals2.hpp> +#include "llfolderviewitem.h" // because LLFolderView is-a LLFolderViewFolder #include "lluictrl.h" #include "v4color.h" #include "lldarray.h" -//#include "llviewermenu.h" #include "stdenums.h" -#include "llfontgl.h" -#include "lleditmenuhandler.h" -#include "llviewertexture.h" #include "lldepthstack.h" +#include "lleditmenuhandler.h" +#include "llfontgl.h" #include "lltooldraganddrop.h" -// JAMESDEBUG - move this up -#include "llfolderviewitem.h" // because LLFolderView is-a LLFolderViewFolder +#include "llviewertexture.h" + +class LLFolderViewEventListener; +class LLFolderViewFolder; +class LLFolderViewItem; +class LLInventoryModel; +class LLPanel; +class LLLineEditor; +class LLMenuGL; +class LLScrollContainer; +class LLUICtrl; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLFolderViewFunctor @@ -70,8 +72,7 @@ // that later when it's determined to be too slow. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLFolderViewItem; -class LLFolderViewFolder; + class LLFolderViewFunctor { @@ -89,13 +90,6 @@ public: // manages the screen region of the folder view. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLFolderViewEventListener; -class LLInventoryModel; -class LLLineEditor; -class LLMenuGL; -class LLScrollContainer; -class LLUICtrl; - class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler { public: @@ -330,7 +324,7 @@ protected: LLUUID mSelectThisID; // if non null, select this item - LLPanel* mParentPanel; + LLPanel* mParentPanel; /** * Is used to determine if we need to cut text In LLFolderViewItem to avoid horizontal scroll. diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index a1260d1156..63511301b3 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -38,12 +38,12 @@ #include "llfoldervieweventlistener.h" #include "llinventorybridge.h" // for LLItemBridge in LLInventorySort::operator() #include "llinventoryfilter.h" +#include "llpanel.h" #include "llviewercontrol.h" // gSavedSettings #include "llviewerwindow.h" // Argh, only for setCursor() // linden library includes #include "llfocusmgr.h" // gFocusMgr -#include "llpanel.h" // panel->hasFocus() #include "lltrans.h" ///---------------------------------------------------------------------------- @@ -1290,9 +1290,10 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter) // now query children for (folders_t::iterator iter = mFolders.begin(); - iter != mFolders.end();) + iter != mFolders.end(); + ++iter) { - folders_t::iterator fit = iter++; + LLFolderViewFolder* folder = (*iter); // have we run out of iterations this frame? if (filter.getFilterCount() < 0) { @@ -1302,15 +1303,15 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter) // mMostFilteredDescendantGeneration might have been reset // in which case we need to update it even for folders that // don't need to be filtered anymore - if ((*fit)->getCompletedFilterGeneration() >= filter_generation) + if (folder->getCompletedFilterGeneration() >= filter_generation) { // track latest generation to pass any child items - if ((*fit)->getFiltered() || (*fit)->hasFilteredDescendants(filter.getMinRequiredGeneration())) + if (folder->getFiltered() || folder->hasFilteredDescendants(filter.getMinRequiredGeneration())) { mMostFilteredDescendantGeneration = filter_generation; if (getRoot()->needsAutoSelect() && autoopen_folders) { - (*fit)->setOpenArrangeRecursively(TRUE); + folder->setOpenArrangeRecursively(TRUE); } } // just skip it, it has already been filtered @@ -1318,48 +1319,49 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter) } // update this folders filter status (and children) - (*fit)->filter( filter ); + folder->filter( filter ); // track latest generation to pass any child items - if ((*fit)->getFiltered() || (*fit)->hasFilteredDescendants(filter_generation)) + if (folder->getFiltered() || folder->hasFilteredDescendants(filter_generation)) { mMostFilteredDescendantGeneration = filter_generation; if (getRoot()->needsAutoSelect() && autoopen_folders) { - (*fit)->setOpenArrangeRecursively(TRUE); + folder->setOpenArrangeRecursively(TRUE); } } } for (items_t::iterator iter = mItems.begin(); - iter != mItems.end();) + iter != mItems.end(); + ++iter) { - items_t::iterator iit = iter++; + LLFolderViewItem* item = (*iter); if (filter.getFilterCount() < 0) { break; } - if ((*iit)->getLastFilterGeneration() >= filter_generation) + if (item->getLastFilterGeneration() >= filter_generation) { - if ((*iit)->getFiltered()) + if (item->getFiltered()) { mMostFilteredDescendantGeneration = filter_generation; } continue; } - if ((*iit)->getLastFilterGeneration() >= must_pass_generation && - !(*iit)->getFiltered(must_pass_generation)) + if (item->getLastFilterGeneration() >= must_pass_generation && + !item->getFiltered(must_pass_generation)) { // failed to pass an earlier filter that was a subset of the current one // go ahead and flag this item as done - (*iit)->setFiltered(FALSE, filter_generation); + item->setFiltered(FALSE, filter_generation); continue; } - (*iit)->filter( filter ); + item->filter( filter ); - if ((*iit)->getFiltered(filter.getMinRequiredGeneration())) + if (item->getFiltered(filter.getMinRequiredGeneration())) { mMostFilteredDescendantGeneration = filter_generation; } @@ -2028,6 +2030,22 @@ void LLFolderViewFolder::openItem( void ) toggleOpen(); } +void LLFolderViewFolder::applyFunctorToChildren(LLFolderViewFunctor& functor) +{ + for (folders_t::iterator iter = mFolders.begin(); + iter != mFolders.end();) + { + folders_t::iterator fit = iter++; + functor.doItem((*fit)); + } + for (items_t::iterator iter = mItems.begin(); + iter != mItems.end();) + { + items_t::iterator iit = iter++; + functor.doItem((*iit)); + } +} + void LLFolderViewFolder::applyFunctorRecursively(LLFolderViewFunctor& functor) { functor.doFolder(this); diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h index 30387812a6..f6264ec968 100644 --- a/indra/newview/llfolderviewitem.h +++ b/indra/newview/llfolderviewitem.h @@ -501,6 +501,9 @@ public: void applyFunctorRecursively(LLFolderViewFunctor& functor); virtual void applyListenerFunctorRecursively(LLFolderViewListenerFunctor& functor); + // Just apply this functor to the folder's immediate children. + void applyFunctorToChildren(LLFolderViewFunctor& functor); + virtual void openItem( void ); virtual BOOL addItem(LLFolderViewItem* item); virtual BOOL addFolder( LLFolderViewFolder* folder); diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index 43fbe362d5..750a9d478f 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -67,7 +67,10 @@ #include "llresmgr.h" #include "pipeline.h" #include "llspatialpartition.h" - + +// Height of the yellow selection highlight posts for land +const F32 PARCEL_POST_HEIGHT = 0.666f; + BOOL LLAgent::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position) { if(object && object->isAttachment()) diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 0626a5c3d3..59537c1e65 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -52,6 +52,7 @@ #include "llviewerwindow.h" #include "llpanelgroup.h" #include "llgroupactions.h" +#include "llnotifications.h" #include "lluictrlfactory.h" #include <boost/regex.hpp> diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 4a487bd5a7..ee93a9349a 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -53,6 +53,10 @@ #include "lltransientfloatermgr.h" #include "llinventorymodel.h" +#ifdef USE_IM_CONTAINER + #include "llimfloatercontainer.h" // to replace separate IM Floaters with multifloater container +#endif + LLIMFloater::LLIMFloater(const LLUUID& session_id) @@ -257,7 +261,11 @@ BOOL LLIMFloater::postBuild() //*TODO if session is not initialized yet, add some sort of a warning message like "starting session...blablabla" //see LLFloaterIMPanel for how it is done (IB) +#ifdef USE_IM_CONTAINER + return LLFloater::postBuild(); +#else return LLDockableFloater::postBuild(); +#endif } // virtual @@ -318,6 +326,11 @@ void LLIMFloater::onSlide() //static LLIMFloater* LLIMFloater::show(const LLUUID& session_id) { +#ifdef USE_IM_CONTAINER + LLIMFloater* target_floater = findInstance(session_id); + bool not_existed = NULL == target_floater; + +#else //hide all LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel"); for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); @@ -329,12 +342,25 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) floater->setVisible(false); } } +#endif LLIMFloater* floater = LLFloaterReg::showTypedInstance<LLIMFloater>("impanel", session_id); floater->updateMessages(); floater->mInputEditor->setFocus(TRUE); +#ifdef USE_IM_CONTAINER + // do not add existed floaters to avoid adding torn off instances + if (not_existed) + { + // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END; + // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists + LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END; + + LLIMFloaterContainer* floater_container = LLFloaterReg::showTypedInstance<LLIMFloaterContainer>("im_container"); + floater_container->addFloater(floater, TRUE, i_pt); + } +#else if (floater->getDockControl() == NULL) { LLChiclet* chiclet = @@ -352,13 +378,14 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id) floater->setDockControl(new LLDockControl(chiclet, floater, floater->getDockTongue(), LLDockControl::TOP, boost::bind(&LLIMFloater::getAllowedRect, floater, _1))); } +#endif return floater; } void LLIMFloater::getAllowedRect(LLRect& rect) { - rect = gViewerWindow->getWorldViewRectScaled(); + rect = gViewerWindow->getWorldViewRectRaw(); } void LLIMFloater::setDocked(bool docked, bool pop_on_undock) @@ -368,7 +395,9 @@ void LLIMFloater::setDocked(bool docked, bool pop_on_undock) (LLNotificationsUI::LLChannelManager::getInstance()-> findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); +#ifndef USE_IM_CONTAINER LLTransientDockableFloater::setDocked(docked, pop_on_undock); +#endif // update notification channel state if(channel) @@ -394,6 +423,7 @@ void LLIMFloater::setVisible(BOOL visible) //static bool LLIMFloater::toggle(const LLUUID& session_id) { +#ifndef USE_IM_CONTAINER LLIMFloater* floater = LLFloaterReg::findTypedInstance<LLIMFloater>("impanel", session_id); if (floater && floater->getVisible() && floater->isDocked()) { @@ -409,6 +439,7 @@ bool LLIMFloater::toggle(const LLUUID& session_id) return true; } else +#endif { // ensure the list of messages is updated when floater is made visible show(session_id); @@ -451,6 +482,8 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) void LLIMFloater::updateMessages() { + bool use_plain_text_chat_history = gSavedSettings.getBOOL("PlainTextChatHistory"); + std::list<LLSD> messages; LLIMModel::instance().getMessages(mSessionID, messages, mLastMessageIndex+1); @@ -476,39 +509,7 @@ void LLIMFloater::updateMessages() chat.mText = message; chat.mTimeStr = time; - //Handle IRC styled /me messages. - std::string prefix = message.substr(0, 4); - if (prefix == "/me " || prefix == "/me'") - { - - LLColor4 txt_color = LLUIColorTable::instance().getColor("White"); - LLViewerChat::getChatColor(chat,txt_color); - LLFontGL* fontp = LLViewerChat::getChatFont(); - std::string font_name = LLFontGL::nameFromFont(fontp); - std::string font_size = LLFontGL::sizeFromFont(fontp); - LLStyle::Params append_style_params; - append_style_params.color(txt_color); - append_style_params.readonly_color(txt_color); - append_style_params.font.name(font_name); - append_style_params.font.size(font_size); - - if (from.size() > 0) - { - append_style_params.font.style = "ITALIC"; - chat.mText = from; - mChatHistory->appendWidgetMessage(chat, append_style_params); - } - - message = message.substr(3); - append_style_params.font.style = "ITALIC"; - mChatHistory->appendText(message, FALSE, append_style_params); - } - else - { - chat.mText = message; - mChatHistory->appendWidgetMessage(chat); - } - + mChatHistory->appendMessage(chat, use_plain_text_chat_history); mLastMessageIndex = msg["index"].asInteger(); } } @@ -639,6 +640,28 @@ void LLIMFloater::processAgentListUpdates(const LLSD& body) } } +void LLIMFloater::updateChatHistoryStyle() +{ + mChatHistory->clear(); + mLastMessageIndex = -1; + updateMessages(); +} + +void LLIMFloater::processChatHistoryStyleUpdate(const LLSD& newvalue) +{ + LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel"); + for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); + iter != inst_list.end(); ++iter) + { + LLIMFloater* floater = dynamic_cast<LLIMFloater*>(*iter); + if (floater) + { + floater->updateChatHistoryStyle(); + } + } + +} + void LLIMFloater::processSessionUpdate(const LLSD& session_update) { // *TODO : verify following code when moderated mode will be implemented diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index e2d500d821..9e1330ff49 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -33,6 +33,11 @@ #ifndef LL_IMFLOATER_H #define LL_IMFLOATER_H +// This variable is used to show floaters related to chiclets in a Multi Floater Container +// So, this functionality does not require to have IM Floaters as Dockable & Transient +// See EXT-2640. +#define USE_IM_CONTAINER + #include "lltransientdockablefloater.h" #include "lllogchat.h" #include "lltooldraganddrop.h" @@ -92,6 +97,9 @@ public: void processAgentListUpdates(const LLSD& body); void processSessionUpdate(const LLSD& session_update); + void updateChatHistoryStyle(); + static void processChatHistoryStyleUpdate(const LLSD& newvalue); + BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp new file mode 100644 index 0000000000..6e4b3ae214 --- /dev/null +++ b/indra/newview/llimfloatercontainer.cpp @@ -0,0 +1,96 @@ +/**
+ * @file llimfloatercontainer.cpp
+ * @brief Multifloater containing active IM sessions in separate tab container tabs
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llimfloatercontainer.h"
+
+//
+// LLIMFloaterContainer
+//
+LLIMFloaterContainer::LLIMFloaterContainer(const LLSD& seed)
+: LLMultiFloater(seed),
+ mActiveVoiceFloater(NULL)
+{
+ mAutoResize = FALSE;
+}
+
+LLIMFloaterContainer::~LLIMFloaterContainer()
+{
+}
+
+BOOL LLIMFloaterContainer::postBuild()
+{
+ // Do not call base postBuild to not connect to mCloseSignal to not close all floaters via Close button
+ // mTabContainer will be initialized in LLMultiFloater::addChild()
+ return TRUE;
+}
+
+void LLIMFloaterContainer::onOpen(const LLSD& key)
+{
+ LLMultiFloater::onOpen(key);
+/*
+ if (key.isDefined())
+ {
+ LLIMFloater* im_floater = LLIMFloater::findInstance(key.asUUID());
+ if (im_floater)
+ {
+ im_floater->openFloater();
+ }
+ }
+*/
+}
+
+void LLIMFloaterContainer::addFloater(LLFloater* floaterp,
+ BOOL select_added_floater,
+ LLTabContainer::eInsertionPoint insertion_point)
+{
+ if(!floaterp) return;
+
+ // already here
+ if (floaterp->getHost() == this)
+ {
+ openFloater(floaterp->getKey());
+ return;
+ }
+
+ LLMultiFloater::addFloater(floaterp, select_added_floater, insertion_point);
+
+ // make sure active voice icon shows up for new tab
+ if (floaterp == mActiveVoiceFloater)
+ {
+ mTabContainer->setTabImage(floaterp, "active_voice_tab.tga");
+ }
+}
+
+// EOF
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h new file mode 100644 index 0000000000..10cde56c6e --- /dev/null +++ b/indra/newview/llimfloatercontainer.h @@ -0,0 +1,61 @@ +/**
+ * @file llimfloatercontainer.h
+ * @brief Multifloater containing active IM sessions in separate tab container tabs
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLIMFLOATERCONTAINER_H
+#define LL_LLIMFLOATERCONTAINER_H
+
+#include "llfloater.h"
+#include "llmultifloater.h"
+
+class LLTabContainer;
+
+class LLIMFloaterContainer : public LLMultiFloater
+{
+public:
+ LLIMFloaterContainer(const LLSD& seed);
+ virtual ~LLIMFloaterContainer();
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+
+ /*virtual*/ void addFloater(LLFloater* floaterp,
+ BOOL select_added_floater,
+ LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END);
+
+ static LLFloater* getCurrentVoiceFloater();
+
+protected:
+
+ LLFloater* mActiveVoiceFloater;
+};
+
+#endif // LL_LLIMFLOATERCONTAINER_H
diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 87b801d73b..e6ded5f371 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -216,7 +216,7 @@ LLFloaterIMPanel::~LLFloaterIMPanel() BOOL LLFloaterIMPanel::postBuild() { - mVisibleSignal.connect(boost::bind(&LLFloaterIMPanel::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLFloaterIMPanel::onVisibilityChange, this, _2)); mInputEditor = getChild<LLLineEditor>("chat_editor"); mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) ); diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index c066f1f77a..ffa943092f 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -71,6 +71,7 @@ #include "llviewermessage.h" #include "llviewerwindow.h" #include "llnotify.h" +#include "llnearbychat.h" #include "llviewerregion.h" #include "llvoicechannel.h" #include "lltrans.h" @@ -1611,6 +1612,12 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess LLChat chat(message); chat.mSourceType = CHAT_SOURCE_SYSTEM; LLFloaterChat::addChatHistory(chat); + + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); + if(nearby_chat) + { + nearby_chat->addMessage(chat); + } } else // going to IM session { diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index a6a5ecb8e7..aa71904595 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1,5146 +1,5203 @@ -/** - * @file llinventorybridge.cpp - * @brief Implementation of the Inventory-Folder-View-Bridge classes. - * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" -#include "llinventorybridge.h" - -#include "llagent.h" -#include "llagentwearables.h" -#include "llappearancemgr.h" -#include "llavataractions.h" -#include "llfloatercustomize.h" -#include "llfloaterinventory.h" -#include "llfloateropenobject.h" -#include "llfloaterreg.h" -#include "llfloaterworldmap.h" -#include "llfriendcard.h" -#include "llgesturemgr.h" -#include "llimfloater.h" -#include "llimview.h" -#include "llinventoryclipboard.h" -#include "llinventoryfunctions.h" -#include "llinventorymodel.h" -#include "llinventorypanel.h" -#include "llpreviewanim.h" -#include "llpreviewgesture.h" -#include "llpreviewtexture.h" -#include "llselectmgr.h" -#include "llsidetray.h" -#include "lltrans.h" -#include "llviewerassettype.h" -#include "llviewermessage.h" -#include "llviewerobjectlist.h" -#include "llviewerwindow.h" -#include "llvoavatarself.h" -#include "llwearablelist.h" - -using namespace LLOldEvents; - -// Helpers -// bug in busy count inc/dec right now, logic is complex... do we really need it? -void inc_busy_count() -{ -// gViewerWindow->getWindow()->incBusyCount(); -// check balance of these calls if this code is changed to ever actually -// *do* something! -} -void dec_busy_count() -{ -// gViewerWindow->getWindow()->decBusyCount(); -// check balance of these calls if this code is changed to ever actually -// *do* something! -} - -// Function declarations -void wear_add_inventory_item_on_avatar(LLInventoryItem* item); -void remove_inventory_category_from_avatar(LLInventoryCategory* category); -void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_id); -bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, LLMoveInv*); -bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response); - -std::string ICON_NAME[ICON_NAME_COUNT] = -{ - "Inv_Texture", - "Inv_Sound", - "Inv_CallingCard", - "Inv_CallingCard", - "Inv_Landmark", - "Inv_Landmark", - "Inv_Script", - "Inv_Clothing", - "Inv_Object", - "Inv_Object", - "Inv_Notecard", - "Inv_Skin", - "Inv_Snapshot", - - "Inv_BodyShape", - "Inv_Skin", - "Inv_Hair", - "Inv_Eye", - "Inv_Shirt", - "Inv_Pants", - "Inv_Shoe", - "Inv_Socks", - "Inv_Jacket", - "Inv_Gloves", - "Inv_Undershirt", - "Inv_Underpants", - "Inv_Skirt", - "Inv_Alpha", - "Inv_Tattoo", - - "Inv_Animation", - "Inv_Gesture", - - "inv_item_linkitem.tga", - "inv_item_linkfolder.tga" -}; - -// +=================================================+ -// | LLInvFVBridge | -// +=================================================+ - -LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory, const LLUUID& uuid) : -mUUID(uuid), mInvType(LLInventoryType::IT_NONE) -{ - mInventoryPanel = inventory->getHandle(); -} - -const std::string& LLInvFVBridge::getName() const -{ - LLInventoryObject* obj = getInventoryObject(); - if(obj) - { - return obj->getName(); - } - return LLStringUtil::null; -} - -const std::string& LLInvFVBridge::getDisplayName() const -{ - return getName(); -} - -// Folders have full perms -PermissionMask LLInvFVBridge::getPermissionMask() const -{ - - return PERM_ALL; -} - -// virtual -LLFolderType::EType LLInvFVBridge::getPreferredType() const -{ - return LLFolderType::FT_NONE; -} - - -// Folders don't have creation dates. -time_t LLInvFVBridge::getCreationDate() const -{ - return 0; -} - -// Can be destoryed (or moved to trash) -BOOL LLInvFVBridge::isItemRemovable() -{ - LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; - if(model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID())) - { - return TRUE; - } - return FALSE; -} - -// Can be moved to another folder -BOOL LLInvFVBridge::isItemMovable() const -{ - return TRUE; -} - -/*virtual*/ -/** - * @brief Adds this item into clipboard storage - */ -void LLInvFVBridge::cutToClipboard() -{ - if(isItemMovable()) - { - LLInventoryClipboard::instance().cut(mUUID); - } -} -// *TODO: make sure this does the right thing -void LLInvFVBridge::showProperties() -{ - LLSD key; - key["id"] = mUUID; - LLSideTray::getInstance()->showPanel("sidepanel_inventory", key); - - // Disable old properties floater; this is replaced by the sidepanel. - /* - LLFloaterReg::showInstance("properties", mUUID); - */ -} - -void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch) -{ - // Deactivate gestures when moving them into Trash - LLInvFVBridge* bridge; - LLInventoryModel* model = getInventoryModel(); - LLViewerInventoryItem* item = NULL; - LLViewerInventoryCategory* cat = NULL; - LLInventoryModel::cat_array_t descendent_categories; - LLInventoryModel::item_array_t descendent_items; - S32 count = batch.count(); - S32 i,j; - for(i = 0; i < count; ++i) - { - bridge = (LLInvFVBridge*)(batch.get(i)); - if(!bridge || !bridge->isItemRemovable()) continue; - item = (LLViewerInventoryItem*)model->getItem(bridge->getUUID()); - if (item) - { - if(LLAssetType::AT_GESTURE == item->getType()) - { - LLGestureManager::instance().deactivateGesture(item->getUUID()); - } - } - } - for(i = 0; i < count; ++i) - { - bridge = (LLInvFVBridge*)(batch.get(i)); - if(!bridge || !bridge->isItemRemovable()) continue; - cat = (LLViewerInventoryCategory*)model->getCategory(bridge->getUUID()); - if (cat) - { - gInventory.collectDescendents( cat->getUUID(), descendent_categories, descendent_items, FALSE ); - for (j=0; j<descendent_items.count(); j++) - { - if(LLAssetType::AT_GESTURE == descendent_items[j]->getType()) - { - LLGestureManager::instance().deactivateGesture(descendent_items[j]->getUUID()); - } - } - } - } - removeBatchNoCheck(batch); -} - -void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*>& batch) -{ - // this method moves a bunch of items and folders to the trash. As - // per design guidelines for the inventory model, the message is - // built and the accounting is performed first. After all of that, - // we call LLInventoryModel::moveObject() to move everything - // around. - LLInvFVBridge* bridge; - LLInventoryModel* model = getInventoryModel(); - if(!model) return; - LLMessageSystem* msg = gMessageSystem; - const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - LLViewerInventoryItem* item = NULL; - LLViewerInventoryCategory* cat = NULL; - std::vector<LLUUID> move_ids; - LLInventoryModel::update_map_t update; - bool start_new_message = true; - S32 count = batch.count(); - S32 i; - for(i = 0; i < count; ++i) - { - bridge = (LLInvFVBridge*)(batch.get(i)); - if(!bridge || !bridge->isItemRemovable()) continue; - item = (LLViewerInventoryItem*)model->getItem(bridge->getUUID()); - if(item) - { - if(item->getParentUUID() == trash_id) continue; - move_ids.push_back(item->getUUID()); - LLPreview::hide(item->getUUID()); - --update[item->getParentUUID()]; - ++update[trash_id]; - if(start_new_message) - { - start_new_message = false; - msg->newMessageFast(_PREHASH_MoveInventoryItem); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addBOOLFast(_PREHASH_Stamp, TRUE); - } - msg->nextBlockFast(_PREHASH_InventoryData); - msg->addUUIDFast(_PREHASH_ItemID, item->getUUID()); - msg->addUUIDFast(_PREHASH_FolderID, trash_id); - msg->addString("NewName", NULL); - if(msg->isSendFullFast(_PREHASH_InventoryData)) - { - start_new_message = true; - gAgent.sendReliableMessage(); - gInventory.accountForUpdate(update); - update.clear(); - } - } - } - if(!start_new_message) - { - start_new_message = true; - gAgent.sendReliableMessage(); - gInventory.accountForUpdate(update); - update.clear(); - } - for(i = 0; i < count; ++i) - { - bridge = (LLInvFVBridge*)(batch.get(i)); - if(!bridge || !bridge->isItemRemovable()) continue; - cat = (LLViewerInventoryCategory*)model->getCategory(bridge->getUUID()); - if(cat) - { - if(cat->getParentUUID() == trash_id) continue; - move_ids.push_back(cat->getUUID()); - --update[cat->getParentUUID()]; - ++update[trash_id]; - if(start_new_message) - { - start_new_message = false; - msg->newMessageFast(_PREHASH_MoveInventoryFolder); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addBOOL("Stamp", TRUE); - } - msg->nextBlockFast(_PREHASH_InventoryData); - msg->addUUIDFast(_PREHASH_FolderID, cat->getUUID()); - msg->addUUIDFast(_PREHASH_ParentID, trash_id); - if(msg->isSendFullFast(_PREHASH_InventoryData)) - { - start_new_message = true; - gAgent.sendReliableMessage(); - gInventory.accountForUpdate(update); - update.clear(); - } - } - } - if(!start_new_message) - { - gAgent.sendReliableMessage(); - gInventory.accountForUpdate(update); - } - - // move everything. - std::vector<LLUUID>::iterator it = move_ids.begin(); - std::vector<LLUUID>::iterator end = move_ids.end(); - for(; it != end; ++it) - { - gInventory.moveObject((*it), trash_id); - } - - // notify inventory observers. - model->notifyObservers(); -} - -BOOL LLInvFVBridge::isClipboardPasteable() const -{ - if (!LLInventoryClipboard::instance().hasContents() || !isAgentInventory()) - { - return FALSE; - } - LLInventoryModel* model = getInventoryModel(); - if (!model) - { - return FALSE; - } - - const LLUUID &agent_id = gAgent.getID(); - - LLDynamicArray<LLUUID> objects; - LLInventoryClipboard::instance().retrieve(objects); - S32 count = objects.count(); - for(S32 i = 0; i < count; i++) - { - const LLUUID &item_id = objects.get(i); - - // Can't paste folders - const LLInventoryCategory *cat = model->getCategory(item_id); - if (cat) - { - return FALSE; - } - - const LLInventoryItem *item = model->getItem(item_id); - if (item) - { - if (!item->getPermissions().allowCopyBy(agent_id)) - { - return FALSE; - } - } - } - return TRUE; -} - -BOOL LLInvFVBridge::isClipboardPasteableAsLink() const -{ - if (!LLInventoryClipboard::instance().hasContents() || !isAgentInventory()) - { - return FALSE; - } - const LLInventoryModel* model = getInventoryModel(); - if (!model) - { - return FALSE; - } - - LLDynamicArray<LLUUID> objects; - LLInventoryClipboard::instance().retrieve(objects); - S32 count = objects.count(); - for(S32 i = 0; i < count; i++) - { - const LLInventoryItem *item = model->getItem(objects.get(i)); - if (item) - { - if (!LLAssetType::lookupCanLink(item->getActualType())) - { - return FALSE; - } - } - const LLViewerInventoryCategory *cat = model->getCategory(objects.get(i)); - if (cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType())) - { - return FALSE; - } - } - return TRUE; -} - -void hide_context_entries(LLMenuGL& menu, - const std::vector<std::string> &entries_to_show, - const std::vector<std::string> &disabled_entries) -{ - const LLView::child_list_t *list = menu.getChildList(); - - LLView::child_list_t::const_iterator itor; - for (itor = list->begin(); itor != list->end(); ++itor) - { - std::string name = (*itor)->getName(); - - // descend into split menus: - LLMenuItemBranchGL* branchp = dynamic_cast<LLMenuItemBranchGL*>(*itor); - if ((name == "More") && branchp) - { - hide_context_entries(*branchp->getBranch(), entries_to_show, disabled_entries); - } - - - bool found = false; - std::vector<std::string>::const_iterator itor2; - for (itor2 = entries_to_show.begin(); itor2 != entries_to_show.end(); ++itor2) - { - if (*itor2 == name) - { - found = true; - } - } - if (!found) - { - (*itor)->setVisible(FALSE); - } - else - { - for (itor2 = disabled_entries.begin(); itor2 != disabled_entries.end(); ++itor2) - { - if (*itor2 == name) - { - (*itor)->setEnabled(FALSE); - } - } - } - } -} - -// Helper for commonly-used entries -void LLInvFVBridge::getClipboardEntries(bool show_asset_id, - std::vector<std::string> &items, - std::vector<std::string> &disabled_items, U32 flags) -{ - items.push_back(std::string("Rename")); - if (!isItemRenameable() || (flags & FIRST_SELECTED_ITEM) == 0) - { - disabled_items.push_back(std::string("Rename")); - } - - if (show_asset_id) - { - items.push_back(std::string("Copy Asset UUID")); - if ( (! ( isItemPermissive() || gAgent.isGodlike() ) ) - || (flags & FIRST_SELECTED_ITEM) == 0) - { - disabled_items.push_back(std::string("Copy Asset UUID")); - } - } - - items.push_back(std::string("Copy Separator")); - - items.push_back(std::string("Copy")); - if (!isItemCopyable()) - { - disabled_items.push_back(std::string("Copy")); - } - - items.push_back(std::string("Paste")); - if (!isClipboardPasteable() || (flags & FIRST_SELECTED_ITEM) == 0) - { - disabled_items.push_back(std::string("Paste")); - } - - items.push_back(std::string("Paste As Link")); - if (!isClipboardPasteableAsLink() || (flags & FIRST_SELECTED_ITEM) == 0) - { - disabled_items.push_back(std::string("Paste As Link")); - } - items.push_back(std::string("Paste Separator")); - - items.push_back(std::string("Delete")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Delete")); - } - - // If multiple items are selected, disable properties (if it exists). - if ((flags & FIRST_SELECTED_ITEM) == 0) - { - disabled_items.push_back(std::string("Properties")); - } -} - -void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) -{ - lldebugs << "LLInvFVBridge::buildContextMenu()" << llendl; - std::vector<std::string> items; - std::vector<std::string> disabled_items; - if(isInTrash()) - { - items.push_back(std::string("PurgeItem")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("PurgeItem")); - } - items.push_back(std::string("RestoreItem")); - } - else - { - items.push_back(std::string("Open")); - items.push_back(std::string("Properties")); - - getClipboardEntries(true, items, disabled_items, flags); - } - hide_context_entries(menu, items, disabled_items); -} - -// *TODO: remove this -BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const -{ - BOOL rv = FALSE; - - const LLInventoryObject* obj = getInventoryObject(); - - if(obj) - { - *type = LLViewerAssetType::lookupDragAndDropType(obj->getActualType()); - if(*type == DAD_NONE) - { - return FALSE; - } - - *id = obj->getUUID(); - //object_ids.put(obj->getUUID()); - - if (*type == DAD_CATEGORY) - { - gInventory.startBackgroundFetch(obj->getUUID()); - } - - rv = TRUE; - } - - return rv; -} - -LLInventoryObject* LLInvFVBridge::getInventoryObject() const -{ - LLInventoryObject* obj = NULL; - LLInventoryModel* model = getInventoryModel(); - if(model) - { - obj = (LLInventoryObject*)model->getObject(mUUID); - } - return obj; -} - -LLInventoryModel* LLInvFVBridge::getInventoryModel() const -{ - LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get()); - return panel ? panel->getModel() : NULL; -} - -BOOL LLInvFVBridge::isInTrash() const -{ - LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; - const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - return model->isObjectDescendentOf(mUUID, trash_id); -} - -BOOL LLInvFVBridge::isLinkedObjectInTrash() const -{ - if (isInTrash()) return TRUE; - - const LLInventoryObject *obj = getInventoryObject(); - if (obj && obj->getIsLinkType()) - { - LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; - const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - return model->isObjectDescendentOf(obj->getLinkedUUID(), trash_id); - } - return FALSE; -} - -BOOL LLInvFVBridge::isAgentInventory() const -{ - const LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; - if(gInventory.getRootFolderID() == mUUID) return TRUE; - return model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID()); -} - -BOOL LLInvFVBridge::isCOFFolder() const -{ - const LLInventoryModel* model = getInventoryModel(); - if(!model) return TRUE; - const LLUUID cof_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); - if (mUUID == cof_id || model->isObjectDescendentOf(mUUID, cof_id)) - { - return TRUE; - } - return FALSE; -} - -BOOL LLInvFVBridge::isItemPermissive() const -{ - return FALSE; -} - -// static -void LLInvFVBridge::changeItemParent(LLInventoryModel* model, - LLViewerInventoryItem* item, - const LLUUID& new_parent, - BOOL restamp) -{ - if(item->getParentUUID() != new_parent) - { - LLInventoryModel::update_list_t update; - LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1); - update.push_back(old_folder); - LLInventoryModel::LLCategoryUpdate new_folder(new_parent, 1); - update.push_back(new_folder); - gInventory.accountForUpdate(update); - - LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); - new_item->setParent(new_parent); - new_item->updateParentOnServer(restamp); - model->updateItem(new_item); - model->notifyObservers(); - } -} - -// static -void LLInvFVBridge::changeCategoryParent(LLInventoryModel* model, - LLViewerInventoryCategory* cat, - const LLUUID& new_parent, - BOOL restamp) -{ - if(cat->getParentUUID() != new_parent) - { - LLInventoryModel::update_list_t update; - LLInventoryModel::LLCategoryUpdate old_folder(cat->getParentUUID(), -1); - update.push_back(old_folder); - LLInventoryModel::LLCategoryUpdate new_folder(new_parent, 1); - update.push_back(new_folder); - gInventory.accountForUpdate(update); - - LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat); - new_cat->setParent(new_parent); - new_cat->updateParentOnServer(restamp); - model->updateCategory(new_cat); - model->notifyObservers(); - } -} - - -const std::string safe_inv_type_lookup(LLInventoryType::EType inv_type) -{ - const std::string rv= LLInventoryType::lookup(inv_type); - if(rv.empty()) - { - return std::string("<invalid>"); - } - return rv; -} - -LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type, - LLAssetType::EType actual_asset_type, - LLInventoryType::EType inv_type, - LLInventoryPanel* inventory, - const LLUUID& uuid, - U32 flags) -{ - LLInvFVBridge* new_listener = NULL; - switch(asset_type) - { - case LLAssetType::AT_TEXTURE: - if(!(inv_type == LLInventoryType::IT_TEXTURE || inv_type == LLInventoryType::IT_SNAPSHOT)) - { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; - } - new_listener = new LLTextureBridge(inventory, uuid, inv_type); - break; - - case LLAssetType::AT_SOUND: - if(!(inv_type == LLInventoryType::IT_SOUND)) - { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; - } - new_listener = new LLSoundBridge(inventory, uuid); - break; - - case LLAssetType::AT_LANDMARK: - if(!(inv_type == LLInventoryType::IT_LANDMARK)) - { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; - } - new_listener = new LLLandmarkBridge(inventory, uuid, flags); - break; - - case LLAssetType::AT_CALLINGCARD: - if(!(inv_type == LLInventoryType::IT_CALLINGCARD)) - { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; - } - new_listener = new LLCallingCardBridge(inventory, uuid); - break; - - case LLAssetType::AT_SCRIPT: - if(!(inv_type == LLInventoryType::IT_LSL)) - { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; - } - new_listener = new LLScriptBridge(inventory, uuid); - break; - - case LLAssetType::AT_OBJECT: - if(!(inv_type == LLInventoryType::IT_OBJECT || inv_type == LLInventoryType::IT_ATTACHMENT)) - { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; - } - new_listener = new LLObjectBridge(inventory, uuid, inv_type, flags); - break; - - case LLAssetType::AT_NOTECARD: - if(!(inv_type == LLInventoryType::IT_NOTECARD)) - { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; - } - new_listener = new LLNotecardBridge(inventory, uuid); - break; - - case LLAssetType::AT_ANIMATION: - if(!(inv_type == LLInventoryType::IT_ANIMATION)) - { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; - } - new_listener = new LLAnimationBridge(inventory, uuid); - break; - - case LLAssetType::AT_GESTURE: - if(!(inv_type == LLInventoryType::IT_GESTURE)) - { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; - } - new_listener = new LLGestureBridge(inventory, uuid); - break; - - case LLAssetType::AT_LSL_TEXT: - if(!(inv_type == LLInventoryType::IT_LSL)) - { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; - } - new_listener = new LLLSLTextBridge(inventory, uuid); - break; - - case LLAssetType::AT_CLOTHING: - case LLAssetType::AT_BODYPART: - if(!(inv_type == LLInventoryType::IT_WEARABLE)) - { - llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl; - } - new_listener = new LLWearableBridge(inventory, uuid, asset_type, inv_type, (EWearableType)flags); - break; - case LLAssetType::AT_CATEGORY: - if (actual_asset_type == LLAssetType::AT_LINK_FOLDER) - { - // Create a link folder handler instead. - new_listener = new LLLinkFolderBridge(inventory, uuid); - break; - } - new_listener = new LLFolderBridge(inventory, uuid); - break; - case LLAssetType::AT_LINK: - // Only should happen for broken links. - new_listener = new LLLinkItemBridge(inventory, uuid); - break; - case LLAssetType::AT_LINK_FOLDER: - // Only should happen for broken links. - new_listener = new LLLinkItemBridge(inventory, uuid); - break; - default: - llinfos << "Unhandled asset type (llassetstorage.h): " - << (S32)asset_type << llendl; - break; - } - - if (new_listener) - { - new_listener->mInvType = inv_type; - } - - return new_listener; -} - -void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid) -{ - LLInventoryCategory* cat = model->getCategory(uuid); - if (cat) - { - model->purgeDescendentsOf(uuid); - model->notifyObservers(); - } - LLInventoryObject* obj = model->getObject(uuid); - if (obj) - { - model->purgeObject(uuid); - model->notifyObservers(); - } -} - -// +=================================================+ -// | InventoryFVBridgeBuilder | -// +=================================================+ -LLInvFVBridge* LLInventoryFVBridgeBuilder::createBridge(LLAssetType::EType asset_type, - LLAssetType::EType actual_asset_type, - LLInventoryType::EType inv_type, - LLInventoryPanel* inventory, - const LLUUID& uuid, - U32 flags /* = 0x00 */) const -{ - return LLInvFVBridge::createBridge(asset_type, - actual_asset_type, - inv_type, - inventory, - uuid, - flags); -} - -// +=================================================+ -// | LLItemBridge | -// +=================================================+ - -void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) -{ - if ("goto" == action) - { - gotoItem(folder); - } - if ("open" == action) - { - openItem(); - return; - } - else if ("properties" == action) - { - showProperties(); - return; - } - else if ("purge" == action) - { - purgeItem(model, mUUID); - return; - } - else if ("restoreToWorld" == action) - { - restoreToWorld(); - return; - } - else if ("restore" == action) - { - restoreItem(); - return; - } - else if ("copy_uuid" == action) - { - // Single item only - LLInventoryItem* item = model->getItem(mUUID); - if(!item) return; - LLUUID asset_id = item->getAssetUUID(); - std::string buffer; - asset_id.toString(buffer); - - gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(buffer)); - return; - } - else if ("copy" == action) - { - copyToClipboard(); - return; - } - else if ("paste" == action) - { - // Single item only - LLInventoryItem* itemp = model->getItem(mUUID); - if (!itemp) return; - - LLFolderViewItem* folder_view_itemp = folder->getItemByID(itemp->getParentUUID()); - if (!folder_view_itemp) return; - - folder_view_itemp->getListener()->pasteFromClipboard(); - return; - } - else if ("paste_link" == action) - { - // Single item only - LLInventoryItem* itemp = model->getItem(mUUID); - if (!itemp) return; - - LLFolderViewItem* folder_view_itemp = folder->getItemByID(itemp->getParentUUID()); - if (!folder_view_itemp) return; - - folder_view_itemp->getListener()->pasteLinkFromClipboard(); - return; - } -} - -void LLItemBridge::selectItem() -{ - LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem(); - if(item && !item->isComplete()) - { - item->fetchFromServer(); - } -} - -void LLItemBridge::restoreItem() -{ - LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem(); - if(item) - { - LLInventoryModel* model = getInventoryModel(); - const LLUUID new_parent = model->findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(item->getType())); - // do not restamp on restore. - LLInvFVBridge::changeItemParent(model, item, new_parent, FALSE); - } -} - -void LLItemBridge::restoreToWorld() -{ - LLViewerInventoryItem* itemp = (LLViewerInventoryItem*)getItem(); - if (itemp) - { - LLMessageSystem* msg = gMessageSystem; - msg->newMessage("RezRestoreToWorld"); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - - msg->nextBlockFast(_PREHASH_InventoryData); - itemp->packMessage(msg); - msg->sendReliable(gAgent.getRegion()->getHost()); - } - - //Similar functionality to the drag and drop rez logic - BOOL remove_from_inventory = FALSE; - - //remove local inventory copy, sim will deal with permissions and removing the item - //from the actual inventory if its a no-copy etc - if(!itemp->getPermissions().allowCopyBy(gAgent.getID())) - { - remove_from_inventory = TRUE; - } - - // Check if it's in the trash. (again similar to the normal rez logic) - const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if(gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id)) - { - remove_from_inventory = TRUE; - } - - if(remove_from_inventory) - { - gInventory.deleteObject(itemp->getUUID()); - gInventory.notifyObservers(); - } -} - -void LLItemBridge::gotoItem(LLFolderView *folder) -{ - LLInventoryObject *obj = getInventoryObject(); - if (obj && obj->getIsLinkType()) - { - LLInventoryPanel* active_panel = LLFloaterInventory::getActiveInventory()->getPanel(); - if (active_panel) - { - active_panel->setSelection(obj->getLinkedUUID(), TAKE_FOCUS_NO); - } - } -} - -LLUIImagePtr LLItemBridge::getIcon() const -{ - return LLUI::getUIImage(ICON_NAME[OBJECT_ICON_NAME]); -} - -PermissionMask LLItemBridge::getPermissionMask() const -{ - LLViewerInventoryItem* item = getItem(); - PermissionMask perm_mask = 0; - if(item) - { - BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID()); - BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID()); - BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER, - gAgent.getID()); - - if (copy) perm_mask |= PERM_COPY; - if (mod) perm_mask |= PERM_MODIFY; - if (xfer) perm_mask |= PERM_TRANSFER; - - } - return perm_mask; -} - -const std::string& LLItemBridge::getDisplayName() const -{ - if(mDisplayName.empty()) - { - buildDisplayName(getItem(), mDisplayName); - } - return mDisplayName; -} - -void LLItemBridge::buildDisplayName(LLInventoryItem* item, std::string& name) -{ - if(item) - { - name.assign(item->getName()); - } - else - { - name.assign(LLStringUtil::null); - } -} - -LLFontGL::StyleFlags LLItemBridge::getLabelStyle() const -{ - U8 font = LLFontGL::NORMAL; - - if( gAgentWearables.isWearingItem( mUUID ) ) - { - // llinfos << "BOLD" << llendl; - font |= LLFontGL::BOLD; - } - - const LLViewerInventoryItem* item = getItem(); - if (item && item->getIsLinkType()) - { - font |= LLFontGL::ITALIC; - } - return (LLFontGL::StyleFlags)font; -} - -std::string LLItemBridge::getLabelSuffix() const -{ - // String table is loaded before login screen and inventory items are - // loaded after login, so LLTrans should be ready. - static std::string NO_COPY =LLTrans::getString("no_copy"); - static std::string NO_MOD = LLTrans::getString("no_modify"); - static std::string NO_XFER = LLTrans::getString("no_transfer"); - static std::string LINK = LLTrans::getString("link"); - static std::string BROKEN_LINK = LLTrans::getString("broken_link"); - std::string suffix; - LLInventoryItem* item = getItem(); - if(item) - { - // it's a bit confusing to put nocopy/nomod/etc on calling cards. - if(LLAssetType::AT_CALLINGCARD != item->getType() - && item->getPermissions().getOwner() == gAgent.getID()) - { - BOOL broken_link = LLAssetType::lookupIsLinkType(item->getType()); - if (broken_link) return BROKEN_LINK; - - BOOL link = item->getIsLinkType(); - if (link) return LINK; - - BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID()); - if (!copy) - { - suffix += NO_COPY; - } - BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID()); - if (!mod) - { - suffix += NO_MOD; - } - BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER, - gAgent.getID()); - if (!xfer) - { - suffix += NO_XFER; - } - } - } - return suffix; -} - -time_t LLItemBridge::getCreationDate() const -{ - LLViewerInventoryItem* item = getItem(); - if (item) - { - return item->getCreationDate(); - } - return 0; -} - - -BOOL LLItemBridge::isItemRenameable() const -{ - LLViewerInventoryItem* item = getItem(); - if(item) - { - // (For now) Don't allow calling card rename since that may confuse users as to - // what the calling card points to. - if (item->getInventoryType() == LLInventoryType::IT_CALLINGCARD) - { - return FALSE; - } - return (item->getPermissions().allowModifyBy(gAgent.getID())); - } - return FALSE; -} - -BOOL LLItemBridge::renameItem(const std::string& new_name) -{ - if(!isItemRenameable()) - return FALSE; - LLPreview::dirty(mUUID); - LLInventoryModel* model = getInventoryModel(); - if(!model) - return FALSE; - LLViewerInventoryItem* item = getItem(); - if(item && (item->getName() != new_name)) - { - LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); - new_item->rename(new_name); - buildDisplayName(new_item, mDisplayName); - new_item->updateServer(FALSE); - model->updateItem(new_item); - - model->notifyObservers(); - } - // return FALSE because we either notified observers (& therefore - // rebuilt) or we didn't update. - return FALSE; -} - - -BOOL LLItemBridge::removeItem() -{ - if(!isItemRemovable()) - { - return FALSE; - } - // move it to the trash - LLPreview::hide(mUUID, TRUE); - LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; - const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - LLViewerInventoryItem* item = getItem(); - - // if item is not already in trash - if(item && !model->isObjectDescendentOf(mUUID, trash_id)) - { - // move to trash, and restamp - LLInvFVBridge::changeItemParent(model, item, trash_id, TRUE); - // delete was successful - return TRUE; - } - else - { - // tried to delete already item in trash (should purge?) - return FALSE; - } -} - -BOOL LLItemBridge::isItemCopyable() const -{ - LLViewerInventoryItem* item = getItem(); - if (item) - { - // can't copy worn objects. DEV-15183 - LLVOAvatarSelf *avatarp = gAgent.getAvatarObject(); - if( !avatarp ) - { - return FALSE; - } - - if(avatarp->isWearingAttachment(mUUID)) - { - return FALSE; - } - - // All items can be copied, not all can be pasted. - // The only time an item can't be copied is if it's a link - // return (item->getPermissions().allowCopyBy(gAgent.getID())); - if (item->getIsLinkType()) - { - return FALSE; - } - return TRUE; - } - return FALSE; -} -BOOL LLItemBridge::copyToClipboard() const -{ - if(isItemCopyable()) - { - LLInventoryClipboard::instance().add(mUUID); - return TRUE; - } - return FALSE; -} - -LLViewerInventoryItem* LLItemBridge::getItem() const -{ - LLViewerInventoryItem* item = NULL; - LLInventoryModel* model = getInventoryModel(); - if(model) - { - item = (LLViewerInventoryItem*)model->getItem(mUUID); - } - return item; -} - -BOOL LLItemBridge::isItemPermissive() const -{ - LLViewerInventoryItem* item = getItem(); - if(item) - { - U32 mask = item->getPermissions().getMaskBase(); - if((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) - { - return TRUE; - } - } - return FALSE; -} - -// +=================================================+ -// | LLFolderBridge | -// +=================================================+ - -LLFolderBridge* LLFolderBridge::sSelf=NULL; - -// Can be moved to another folder -BOOL LLFolderBridge::isItemMovable() const -{ - LLInventoryObject* obj = getInventoryObject(); - if(obj) - { - return (!LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType())); - } - return FALSE; -} - -void LLFolderBridge::selectItem() -{ -} - - -// Can be destroyed (or moved to trash) -BOOL LLFolderBridge::isItemRemovable() -{ - LLInventoryModel* model = getInventoryModel(); - if(!model) - { - return FALSE; - } - - if(!model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID())) - { - return FALSE; - } - - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if( !avatar ) - { - return FALSE; - } - - LLInventoryCategory* category = model->getCategory(mUUID); - if( !category ) - { - return FALSE; - } - - if(LLFolderType::lookupIsProtectedType(category->getPreferredType())) - { - return FALSE; - } - - LLInventoryModel::cat_array_t descendent_categories; - LLInventoryModel::item_array_t descendent_items; - gInventory.collectDescendents( mUUID, descendent_categories, descendent_items, FALSE ); - - S32 i; - for( i = 0; i < descendent_categories.count(); i++ ) - { - LLInventoryCategory* category = descendent_categories[i]; - if(LLFolderType::lookupIsProtectedType(category->getPreferredType())) - { - return FALSE; - } - } - - for( i = 0; i < descendent_items.count(); i++ ) - { - LLInventoryItem* item = descendent_items[i]; - if( (item->getType() == LLAssetType::AT_CLOTHING) || - (item->getType() == LLAssetType::AT_BODYPART) ) - { - if(gAgentWearables.isWearingItem(item->getUUID())) - { - return FALSE; - } - } - else - if( item->getType() == LLAssetType::AT_OBJECT ) - { - if(avatar->isWearingAttachment(item->getUUID())) - { - return FALSE; - } - } - } - - return TRUE; -} - -BOOL LLFolderBridge::isUpToDate() const -{ - LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; - LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID); - if( !category ) - { - return FALSE; - } - - return category->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN; -} - -BOOL LLFolderBridge::isItemCopyable() const -{ - return TRUE; -} - -BOOL LLFolderBridge::copyToClipboard() const -{ - if(isItemCopyable()) - { - LLInventoryClipboard::instance().add(mUUID); - return TRUE; - } - return FALSE; -} - -BOOL LLFolderBridge::isClipboardPasteable() const -{ - if ( ! LLInvFVBridge::isClipboardPasteable() ) - return FALSE; - - // Don't allow pasting duplicates to the Calling Card/Friends subfolders, see bug EXT-1599 - if ( LLFriendCardsManager::instance().isCategoryInFriendFolder( getCategory() ) ) - { - LLInventoryModel* model = getInventoryModel(); - if ( !model ) - { - return FALSE; - } - - LLDynamicArray<LLUUID> objects; - LLInventoryClipboard::instance().retrieve(objects); - const LLViewerInventoryCategory *current_cat = getCategory(); - - // Search for the direct descendent of current Friends subfolder among all pasted items, - // and return false if is found. - for(S32 i = objects.count() - 1; i >= 0; --i) - { - const LLUUID &obj_id = objects.get(i); - if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) ) - { - return FALSE; - } - } - - } - return TRUE; -} - -BOOL LLFolderBridge::isClipboardPasteableAsLink() const -{ - // Check normal paste-as-link permissions - if (!LLInvFVBridge::isClipboardPasteableAsLink()) - { - return FALSE; - } - - const LLInventoryModel* model = getInventoryModel(); - if (!model) - { - return FALSE; - } - - const LLViewerInventoryCategory *current_cat = getCategory(); - if (current_cat) - { - const BOOL is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat ); - const LLUUID ¤t_cat_id = current_cat->getUUID(); - LLDynamicArray<LLUUID> objects; - LLInventoryClipboard::instance().retrieve(objects); - S32 count = objects.count(); - for(S32 i = 0; i < count; i++) - { - const LLUUID &obj_id = objects.get(i); - const LLInventoryCategory *cat = model->getCategory(obj_id); - if (cat) - { - const LLUUID &cat_id = cat->getUUID(); - // Don't allow recursive pasting - if ((cat_id == current_cat_id) || - model->isObjectDescendentOf(current_cat_id, cat_id)) - { - return FALSE; - } - } - // Don't allow pasting duplicates to the Calling Card/Friends subfolders, see bug EXT-1599 - if ( is_in_friend_folder ) - { - // If object is direct descendent of current Friends subfolder than return false. - // Note: We can't use 'const LLInventoryCategory *cat', because it may be null - // in case type of obj_id is LLInventoryItem. - if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) ) - { - return FALSE; - } - } - } - } - return TRUE; - -} - -BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, - BOOL drop) -{ - // This should never happen, but if an inventory item is incorrectly parented, - // the UI will get confused and pass in a NULL. - if(!inv_cat) return FALSE; - - LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; - - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if(!avatar) return FALSE; - - // cannot drag categories into library - if(!isAgentInventory()) - { - return FALSE; - } - - // check to make sure source is agent inventory, and is represented there. - LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); - BOOL is_agent_inventory = (model->getCategory(inv_cat->getUUID()) != NULL) - && (LLToolDragAndDrop::SOURCE_AGENT == source); - - BOOL accept = FALSE; - S32 i; - LLInventoryModel::cat_array_t descendent_categories; - LLInventoryModel::item_array_t descendent_items; - if(is_agent_inventory) - { - const LLUUID& cat_id = inv_cat->getUUID(); - - // Is the destination the trash? - const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - BOOL move_is_into_trash = (mUUID == trash_id) - || model->isObjectDescendentOf(mUUID, trash_id); - BOOL is_movable = (!LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType())); - const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); - BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); - BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); - if (move_is_into_current_outfit || move_is_into_outfit) - { - // BAP - restrictions? - is_movable = true; - } - - if (mUUID == gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE)) - { - is_movable = FALSE; // It's generally movable but not into Favorites folder. EXT-1604 - } - - if( is_movable ) - { - gInventory.collectDescendents( cat_id, descendent_categories, descendent_items, FALSE ); - - for( i = 0; i < descendent_categories.count(); i++ ) - { - LLInventoryCategory* category = descendent_categories[i]; - if(LLFolderType::lookupIsProtectedType(category->getPreferredType())) - { - // ...can't move "special folders" like Textures - is_movable = FALSE; - break; - } - } - - if( is_movable ) - { - if( move_is_into_trash ) - { - for( i = 0; i < descendent_items.count(); i++ ) - { - LLInventoryItem* item = descendent_items[i]; - if( (item->getType() == LLAssetType::AT_CLOTHING) || - (item->getType() == LLAssetType::AT_BODYPART) ) - { - if( gAgentWearables.isWearingItem( item->getUUID() ) ) - { - is_movable = FALSE; // It's generally movable, but not into the trash! - break; - } - } - else - if( item->getType() == LLAssetType::AT_OBJECT ) - { - if( avatar->isWearingAttachment( item->getUUID() ) ) - { - is_movable = FALSE; // It's generally movable, but not into the trash! - break; - } - } - } - } - } - } - - - accept = is_movable - && (mUUID != cat_id) // Can't move a folder into itself - && (mUUID != inv_cat->getParentUUID()) // Avoid moves that would change nothing - && !(model->isObjectDescendentOf(mUUID, cat_id)); // Avoid circularity - if(accept && drop) - { - // Look for any gestures and deactivate them - if (move_is_into_trash) - { - for (i = 0; i < descendent_items.count(); i++) - { - LLInventoryItem* item = descendent_items[i]; - if (item->getType() == LLAssetType::AT_GESTURE - && LLGestureManager::instance().isGestureActive(item->getUUID())) - { - LLGestureManager::instance().deactivateGesture(item->getUUID()); - } - } - } - // if target is an outfit or current outfit folder we use link - if (move_is_into_current_outfit || move_is_into_outfit) - { - if (inv_cat->getPreferredType() == LLFolderType::FT_NONE) - { - if (move_is_into_current_outfit) - { - // traverse category and add all contents to currently worn. - BOOL append = true; - LLAppearanceManager::instance().wearInventoryCategory(inv_cat, false, append); - } - else - { - // Recursively create links in target outfit. - LLInventoryModel::cat_array_t cats; - LLInventoryModel::item_array_t items; - gInventory.collectDescendents(inv_cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH); - LLAppearanceManager::instance().linkAll(mUUID,items,NULL); - } - } - else - { -#if SUPPORT_ENSEMBLES - // BAP - should skip if dup. - if (move_is_into_current_outfit) - { - LLAppearanceManager::instance().addEnsembleLink(inv_cat); - } - else - { - LLPointer<LLInventoryCallback> cb = NULL; - link_inventory_item( - gAgent.getID(), - inv_cat->getUUID(), - mUUID, - inv_cat->getName(), - LLAssetType::AT_LINK_FOLDER, - cb); - } -#endif - } - } - else - { - - // Reparent the folder and restamp children if it's moving - // into trash. - LLInvFVBridge::changeCategoryParent( - model, - (LLViewerInventoryCategory*)inv_cat, - mUUID, - move_is_into_trash); - } - } - } - else if(LLToolDragAndDrop::SOURCE_WORLD == source) - { - // content category has same ID as object itself - LLUUID object_id = inv_cat->getUUID(); - LLUUID category_id = mUUID; - accept = move_inv_category_world_to_agent(object_id, category_id, drop); - } - return accept; -} - -void warn_move_inventory(LLViewerObject* object, LLMoveInv* move_inv) -{ - const char* dialog = NULL; - if (object->flagScripted()) - { - dialog = "MoveInventoryFromScriptedObject"; - } - else - { - dialog = "MoveInventoryFromObject"; - } - LLNotifications::instance().add(dialog, LLSD(), LLSD(), boost::bind(move_task_inventory_callback, _1, _2, move_inv)); -} - -// Move/copy all inventory items from the Contents folder of an in-world -// object to the agent's inventory, inside a given category. -BOOL move_inv_category_world_to_agent(const LLUUID& object_id, - const LLUUID& category_id, - BOOL drop, - void (*callback)(S32, void*), - void* user_data) -{ - // Make sure the object exists. If we allowed dragging from - // anonymous objects, it would be possible to bypass - // permissions. - // content category has same ID as object itself - LLViewerObject* object = gObjectList.findObject(object_id); - if(!object) - { - llinfos << "Object not found for drop." << llendl; - return FALSE; - } - - // this folder is coming from an object, as there is only one folder in an object, the root, - // we need to collect the entire contents and handle them as a group - InventoryObjectList inventory_objects; - object->getInventoryContents(inventory_objects); - - if (inventory_objects.empty()) - { - llinfos << "Object contents not found for drop." << llendl; - return FALSE; - } - - BOOL accept = TRUE; - BOOL is_move = FALSE; - - // coming from a task. Need to figure out if the person can - // move/copy this item. - InventoryObjectList::iterator it = inventory_objects.begin(); - InventoryObjectList::iterator end = inventory_objects.end(); - for ( ; it != end; ++it) - { - // coming from a task. Need to figure out if the person can - // move/copy this item. - LLPermissions perm(((LLInventoryItem*)((LLInventoryObject*)(*it)))->getPermissions()); - if((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID()) - && perm.allowTransferTo(gAgent.getID()))) -// || gAgent.isGodlike()) - { - accept = TRUE; - } - else if(object->permYouOwner()) - { - // If the object cannot be copied, but the object the - // inventory is owned by the agent, then the item can be - // moved from the task to agent inventory. - is_move = TRUE; - accept = TRUE; - } - else - { - accept = FALSE; - break; - } - } - - if(drop && accept) - { - it = inventory_objects.begin(); - InventoryObjectList::iterator first_it = inventory_objects.begin(); - LLMoveInv* move_inv = new LLMoveInv; - move_inv->mObjectID = object_id; - move_inv->mCategoryID = category_id; - move_inv->mCallback = callback; - move_inv->mUserData = user_data; - - for ( ; it != end; ++it) - { - two_uuids_t two(category_id, (*it)->getUUID()); - move_inv->mMoveList.push_back(two); - } - - if(is_move) - { - // Callback called from within here. - warn_move_inventory(object, move_inv); - } - else - { - LLNotification::Params params("MoveInventoryFromObject"); - params.functor.function(boost::bind(move_task_inventory_callback, _1, _2, move_inv)); - LLNotifications::instance().forceResponse(params, 0); - } - } - return accept; -} - -bool LLFindCOFValidItems::operator()(LLInventoryCategory* cat, - LLInventoryItem* item) -{ - // Valid COF items are: - // - links to wearables (body parts or clothing) - // - links to attachments - // - links to gestures - // - links to ensemble folders - LLViewerInventoryItem *linked_item = ((LLViewerInventoryItem*)item)->getLinkedItem(); // BAP - safe? - if (linked_item) - { - LLAssetType::EType type = linked_item->getType(); - return (type == LLAssetType::AT_CLOTHING || - type == LLAssetType::AT_BODYPART || - type == LLAssetType::AT_GESTURE || - type == LLAssetType::AT_OBJECT); - } - else - { - LLViewerInventoryCategory *linked_category = ((LLViewerInventoryItem*)item)->getLinkedCategory(); // BAP - safe? - // BAP remove AT_NONE support after ensembles are fully working? - return (linked_category && - ((linked_category->getPreferredType() == LLFolderType::FT_NONE) || - (LLFolderType::lookupIsEnsembleType(linked_category->getPreferredType())))); - } -} - - -bool LLFindWearables::operator()(LLInventoryCategory* cat, - LLInventoryItem* item) -{ - if(item) - { - if((item->getType() == LLAssetType::AT_CLOTHING) - || (item->getType() == LLAssetType::AT_BODYPART)) - { - return TRUE; - } - } - return FALSE; -} - - - -//Used by LLFolderBridge as callback for directory recursion. -class LLRightClickInventoryFetchObserver : public LLInventoryFetchObserver -{ -public: - LLRightClickInventoryFetchObserver() : - mCopyItems(false) - { }; - LLRightClickInventoryFetchObserver(const LLUUID& cat_id, bool copy_items) : - mCatID(cat_id), - mCopyItems(copy_items) - { }; - virtual void done() - { - // we've downloaded all the items, so repaint the dialog - LLFolderBridge::staticFolderOptionsMenu(); - - gInventory.removeObserver(this); - delete this; - } - - -protected: - LLUUID mCatID; - bool mCopyItems; - -}; - -//Used by LLFolderBridge as callback for directory recursion. -class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver -{ -public: - LLRightClickInventoryFetchDescendentsObserver(bool copy_items) : mCopyItems(copy_items) {} - ~LLRightClickInventoryFetchDescendentsObserver() {} - virtual void done(); -protected: - bool mCopyItems; -}; - -void LLRightClickInventoryFetchDescendentsObserver::done() -{ - // Avoid passing a NULL-ref as mCompleteFolders.front() down to - // gInventory.collectDescendents() - if( mCompleteFolders.empty() ) - { - llwarns << "LLRightClickInventoryFetchDescendentsObserver::done with empty mCompleteFolders" << llendl; - dec_busy_count(); - gInventory.removeObserver(this); - delete this; - return; - } - - // What we do here is get the complete information on the items in - // the library, and set up an observer that will wait for that to - // happen. - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t item_array; - gInventory.collectDescendents(mCompleteFolders.front(), - cat_array, - item_array, - LLInventoryModel::EXCLUDE_TRASH); - S32 count = item_array.count(); -#if 0 // HACK/TODO: Why? - // This early causes a giant menu to get produced, and doesn't seem to be needed. - if(!count) - { - llwarns << "Nothing fetched in category " << mCompleteFolders.front() - << llendl; - dec_busy_count(); - gInventory.removeObserver(this); - delete this; - return; - } -#endif - - LLRightClickInventoryFetchObserver* outfit; - outfit = new LLRightClickInventoryFetchObserver(mCompleteFolders.front(), mCopyItems); - LLInventoryFetchObserver::item_ref_t ids; - for(S32 i = 0; i < count; ++i) - { - ids.push_back(item_array.get(i)->getUUID()); - } - - // clean up, and remove this as an observer since the call to the - // outfit could notify observers and throw us into an infinite - // loop. - dec_busy_count(); - gInventory.removeObserver(this); - delete this; - - // increment busy count and either tell the inventory to check & - // call done, or add this object to the inventory for observation. - inc_busy_count(); - - // do the fetch - outfit->fetchItems(ids); - outfit->done(); //Not interested in waiting and this will be right 99% of the time. -//Uncomment the following code for laggy Inventory UI. -/* if(outfit->isEverythingComplete()) - { - // everything is already here - call done. - outfit->done(); - } - else - { - // it's all on it's way - add an observer, and the inventory - // will call done for us when everything is here. - gInventory.addObserver(outfit); - }*/ -} - - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLInventoryWearObserver -// -// Observer for "copy and wear" operation to support knowing -// when the all of the contents have been added to inventory. -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLInventoryCopyAndWearObserver : public LLInventoryObserver -{ -public: - LLInventoryCopyAndWearObserver(const LLUUID& cat_id, int count) :mCatID(cat_id), mContentsCount(count), mFolderAdded(FALSE) {} - virtual ~LLInventoryCopyAndWearObserver() {} - virtual void changed(U32 mask); - -protected: - LLUUID mCatID; - int mContentsCount; - BOOL mFolderAdded; -}; - - - -void LLInventoryCopyAndWearObserver::changed(U32 mask) -{ - if((mask & (LLInventoryObserver::ADD)) != 0) - { - if (!mFolderAdded) - { - const std::set<LLUUID>& changed_items = gInventory.getChangedIDs(); - - std::set<LLUUID>::const_iterator id_it = changed_items.begin(); - std::set<LLUUID>::const_iterator id_end = changed_items.end(); - for (;id_it != id_end; ++id_it) - { - if ((*id_it) == mCatID) - { - mFolderAdded = TRUE; - break; - } - } - } - - if (mFolderAdded) - { - LLViewerInventoryCategory* category = gInventory.getCategory(mCatID); - - if (NULL == category) - { - llwarns << "gInventory.getCategory(" << mCatID - << ") was NULL" << llendl; - } - else - { - if (category->getDescendentCount() == - mContentsCount) - { - gInventory.removeObserver(this); - LLAppearanceManager::instance().wearInventoryCategory(category, FALSE, TRUE); - delete this; - } - } - } - - } -} - - - -void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) -{ - if ("open" == action) - { - openItem(); - return; - } - else if ("paste" == action) - { - pasteFromClipboard(); - return; - } - else if ("paste_link" == action) - { - pasteLinkFromClipboard(); - return; - } - else if ("properties" == action) - { - showProperties(); - return; - } - else if ("replaceoutfit" == action) - { - modifyOutfit(FALSE); - return; - } -#if SUPPORT_ENSEMBLES - else if ("wearasensemble" == action) - { - LLInventoryModel* model = getInventoryModel(); - if(!model) return; - LLViewerInventoryCategory* cat = getCategory(); - if(!cat) return; - LLAppearanceManager::instance().addEnsembleLink(cat,true); - return; - } -#endif - else if ("addtooutfit" == action) - { - modifyOutfit(TRUE); - return; - } - else if ("copy" == action) - { - copyToClipboard(); - return; - } - else if ("removefromoutfit" == action) - { - LLInventoryModel* model = getInventoryModel(); - if(!model) return; - LLViewerInventoryCategory* cat = getCategory(); - if(!cat) return; - - remove_inventory_category_from_avatar ( cat ); - return; - } - else if ("purge" == action) - { - purgeItem(model, mUUID); - return; - } - else if ("restore" == action) - { - restoreItem(); - return; - } -} - -void LLFolderBridge::openItem() -{ - lldebugs << "LLFolderBridge::openItem()" << llendl; - LLInventoryModel* model = getInventoryModel(); - if(!model) return; - if(mUUID.isNull()) return; - bool fetching_inventory = model->fetchDescendentsOf(mUUID); - // Only change folder type if we have the folder contents. - if (!fetching_inventory) - { - // Disabling this for now, it's causing crash when new items are added to folders - // since folder type may change before new item item has finished processing. - // determineFolderType(); - } -} - -void LLFolderBridge::closeItem() -{ - determineFolderType(); -} - -void LLFolderBridge::determineFolderType() -{ - if (isUpToDate()) - { - LLInventoryModel* model = getInventoryModel(); - LLViewerInventoryCategory* category = model->getCategory(mUUID); - category->determineFolderType(); - } -} - -BOOL LLFolderBridge::isItemRenameable() const -{ - LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)getCategory(); - if(cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType()) - && (cat->getOwnerID() == gAgent.getID())) - { - return TRUE; - } - return FALSE; -} - -void LLFolderBridge::restoreItem() -{ - LLViewerInventoryCategory* cat; - cat = (LLViewerInventoryCategory*)getCategory(); - if(cat) - { - LLInventoryModel* model = getInventoryModel(); - const LLUUID new_parent = model->findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(cat->getType())); - // do not restamp children on restore - LLInvFVBridge::changeCategoryParent(model, cat, new_parent, FALSE); - } -} - -LLFolderType::EType LLFolderBridge::getPreferredType() const -{ - LLFolderType::EType preferred_type = LLFolderType::FT_NONE; - LLViewerInventoryCategory* cat = getCategory(); - if(cat) - { - preferred_type = cat->getPreferredType(); - } - - return preferred_type; -} - -// Icons for folders are based on the preferred type -LLUIImagePtr LLFolderBridge::getIcon() const -{ - LLFolderType::EType preferred_type = LLFolderType::FT_NONE; - LLViewerInventoryCategory* cat = getCategory(); - if(cat) - { - preferred_type = cat->getPreferredType(); - } - return getIcon(preferred_type); -} - -LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type) -{ - // we only have one folder image now - return LLUI::getUIImage("Inv_FolderClosed"); -} - -BOOL LLFolderBridge::renameItem(const std::string& new_name) -{ - if(!isItemRenameable()) - return FALSE; - LLInventoryModel* model = getInventoryModel(); - if(!model) - return FALSE; - LLViewerInventoryCategory* cat = getCategory(); - if(cat && (cat->getName() != new_name)) - { - LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat); - new_cat->rename(new_name); - new_cat->updateServer(FALSE); - model->updateCategory(new_cat); - - model->notifyObservers(); - } - // return FALSE because we either notified observers (& therefore - // rebuilt) or we didn't update. - return FALSE; -} - -BOOL LLFolderBridge::removeItem() -{ - if(!isItemRemovable()) - { - return FALSE; - } - // move it to the trash - LLPreview::hide(mUUID); - LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; - - const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - - // Look for any gestures and deactivate them - LLInventoryModel::cat_array_t descendent_categories; - LLInventoryModel::item_array_t descendent_items; - gInventory.collectDescendents( mUUID, descendent_categories, descendent_items, FALSE ); - - S32 i; - for (i = 0; i < descendent_items.count(); i++) - { - LLInventoryItem* item = descendent_items[i]; - if (item->getType() == LLAssetType::AT_GESTURE - && LLGestureManager::instance().isGestureActive(item->getUUID())) - { - LLGestureManager::instance().deactivateGesture(item->getUUID()); - } - } - - // go ahead and do the normal remove if no 'last calling - // cards' are being removed. - LLViewerInventoryCategory* cat = getCategory(); - if(cat) - { - LLInvFVBridge::changeCategoryParent(model, cat, trash_id, TRUE); - } - - return TRUE; -} - -void LLFolderBridge::pasteFromClipboard() -{ - LLInventoryModel* model = getInventoryModel(); - if(model && isClipboardPasteable()) - { - LLInventoryItem* item = NULL; - LLDynamicArray<LLUUID> objects; - LLInventoryClipboard::instance().retrieve(objects); - S32 count = objects.count(); - const LLUUID parent_id(mUUID); - for(S32 i = 0; i < count; i++) - { - item = model->getItem(objects.get(i)); - if (item) - { - if(LLInventoryClipboard::instance().isCutMode()) - { - // move_inventory_item() is not enough, - //we have to update inventory locally too - changeItemParent(model, dynamic_cast<LLViewerInventoryItem*>(item), parent_id, FALSE); - } - else - { - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - parent_id, - std::string(), - LLPointer<LLInventoryCallback>(NULL)); - } - } - } - } -} - -void LLFolderBridge::pasteLinkFromClipboard() -{ - const LLInventoryModel* model = getInventoryModel(); - if(model) - { - LLDynamicArray<LLUUID> objects; - LLInventoryClipboard::instance().retrieve(objects); - S32 count = objects.count(); - LLUUID parent_id(mUUID); - for(S32 i = 0; i < count; i++) - { - const LLUUID &object_id = objects.get(i); -#if SUPPORT_ENSEMBLES - if (LLInventoryCategory *cat = model->getCategory(object_id)) - { - link_inventory_item( - gAgent.getID(), - cat->getUUID(), - parent_id, - cat->getName(), - LLAssetType::AT_LINK_FOLDER, - LLPointer<LLInventoryCallback>(NULL)); - } - else -#endif - if (LLInventoryItem *item = model->getItem(object_id)) - { - link_inventory_item( - gAgent.getID(), - item->getLinkedUUID(), - parent_id, - item->getName(), - LLAssetType::AT_LINK, - LLPointer<LLInventoryCallback>(NULL)); - } - } - } -} - -void LLFolderBridge::staticFolderOptionsMenu() -{ - if (!sSelf) return; - sSelf->folderOptionsMenu(); -} - -void LLFolderBridge::folderOptionsMenu() -{ - std::vector<std::string> disabled_items; - - LLInventoryModel* model = getInventoryModel(); - if(!model) return; - - const LLInventoryCategory* category = model->getCategory(mUUID); - LLFolderType::EType type = category->getPreferredType(); - const bool is_default_folder = category && LLFolderType::lookupIsProtectedType(type); - // BAP change once we're no longer treating regular categories as ensembles. - const bool is_ensemble = category && (type == LLFolderType::FT_NONE || - LLFolderType::lookupIsEnsembleType(type)); - - // calling card related functionality for folders. - - // Only enable calling-card related options for non-default folders. - if (!is_default_folder) - { - LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD); - if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard)) - { - mItems.push_back(std::string("Calling Card Separator")); - mItems.push_back(std::string("Conference Chat Folder")); - mItems.push_back(std::string("IM All Contacts In Folder")); - } - } - - // wearables related functionality for folders. - //is_wearable - LLFindWearables is_wearable; - LLIsType is_object( LLAssetType::AT_OBJECT ); - LLIsType is_gesture( LLAssetType::AT_GESTURE ); - - if (mWearables || - checkFolderForContentsOfType(model, is_wearable) || - checkFolderForContentsOfType(model, is_object) || - checkFolderForContentsOfType(model, is_gesture) ) - { - mItems.push_back(std::string("Folder Wearables Separator")); - - // Only enable add/replace outfit for non-default folders. - if (!is_default_folder) - { - mItems.push_back(std::string("Add To Outfit")); - mItems.push_back(std::string("Replace Outfit")); - } - if (is_ensemble) - { - mItems.push_back(std::string("Wear As Ensemble")); - } - mItems.push_back(std::string("Remove From Outfit")); - } - hide_context_entries(*mMenu, mItems, disabled_items); -} - -BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& is_type) -{ - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t item_array; - model->collectDescendentsIf(mUUID, - cat_array, - item_array, - LLInventoryModel::EXCLUDE_TRASH, - is_type); - return ((item_array.count() > 0) ? TRUE : FALSE ); -} - -// Flags unused -void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) -{ - mItems.clear(); - mDisabledItems.clear(); - - lldebugs << "LLFolderBridge::buildContextMenu()" << llendl; -// std::vector<std::string> disabled_items; - LLInventoryModel* model = getInventoryModel(); - if(!model) return; - const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - const LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); - - mItems.clear(); //adding code to clear out member Items (which means Items should not have other data here at this point) - mDisabledItems.clear(); //adding code to clear out disabled members from previous - if (lost_and_found_id == mUUID) - { - // This is the lost+found folder. - mItems.push_back(std::string("Empty Lost And Found")); - } - - if(trash_id == mUUID) - { - // This is the trash. - mItems.push_back(std::string("Empty Trash")); - } - else if(model->isObjectDescendentOf(mUUID, trash_id)) - { - // This is a folder in the trash. - mItems.clear(); // clear any items that used to exist - mItems.push_back(std::string("Purge Item")); - if (!isItemRemovable()) - { - mDisabledItems.push_back(std::string("Purge Item")); - } - - mItems.push_back(std::string("Restore Item")); - } - else if(isAgentInventory()) // do not allow creating in library - { - LLViewerInventoryCategory *cat = getCategory(); - // BAP removed protected check to re-enable standard ops in untyped folders. - // Not sure what the right thing is to do here. - if (!isCOFFolder() && cat /*&& - LLAssetType::lookupIsProtectedCategoryType(cat->getPreferredType())*/) - { - // Do not allow to create 2-level subfolder in the Calling Card/Friends folder. EXT-694. - if (!LLFriendCardsManager::instance().isCategoryInFriendFolder(cat)) - mItems.push_back(std::string("New Folder")); - mItems.push_back(std::string("New Script")); - mItems.push_back(std::string("New Note")); - mItems.push_back(std::string("New Gesture")); - mItems.push_back(std::string("New Clothes")); - mItems.push_back(std::string("New Body Parts")); - mItems.push_back(std::string("Change Type")); - - LLViewerInventoryCategory *cat = getCategory(); - if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType())) - { - mDisabledItems.push_back(std::string("Change Type")); - } - - getClipboardEntries(false, mItems, mDisabledItems, flags); - } - else - { - // Want some but not all of the items from getClipboardEntries for outfits. - if (cat && cat->getPreferredType()==LLFolderType::FT_OUTFIT) - { - mItems.push_back(std::string("Rename")); - mItems.push_back(std::string("Delete")); - } - } - - //Added by spatters to force inventory pull on right-click to display folder options correctly. 07-17-06 - mCallingCards = mWearables = FALSE; - - LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD); - if (checkFolderForContentsOfType(model, is_callingcard)) - { - mCallingCards=TRUE; - } - - LLFindWearables is_wearable; - LLIsType is_object( LLAssetType::AT_OBJECT ); - LLIsType is_gesture( LLAssetType::AT_GESTURE ); - - if (checkFolderForContentsOfType(model, is_wearable) || - checkFolderForContentsOfType(model, is_object) || - checkFolderForContentsOfType(model, is_gesture) ) - { - mWearables=TRUE; - } - - mMenu = &menu; - sSelf = this; - LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(FALSE); - - LLInventoryFetchDescendentsObserver::folder_ref_t folders; - LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID); - if (category) - { - folders.push_back(category->getUUID()); - } - fetch->fetchDescendents(folders); - inc_busy_count(); - if(fetch->isEverythingComplete()) - { - // everything is already here - call done. - fetch->done(); - } - else - { - // it's all on it's way - add an observer, and the inventory - // will call done for us when everything is here. - gInventory.addObserver(fetch); - } - } - else - { - mItems.push_back(std::string("--no options--")); - mDisabledItems.push_back(std::string("--no options--")); - } - hide_context_entries(menu, mItems, mDisabledItems); -} - -BOOL LLFolderBridge::hasChildren() const -{ - LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; - LLInventoryModel::EHasChildren has_children; - has_children = gInventory.categoryHasChildren(mUUID); - return has_children != LLInventoryModel::CHILDREN_NO; -} - -BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data) -{ - //llinfos << "LLFolderBridge::dragOrDrop()" << llendl; - BOOL accept = FALSE; - switch(cargo_type) - { - case DAD_TEXTURE: - case DAD_SOUND: - case DAD_CALLINGCARD: - case DAD_LANDMARK: - case DAD_SCRIPT: - case DAD_OBJECT: - case DAD_NOTECARD: - case DAD_CLOTHING: - case DAD_BODYPART: - case DAD_ANIMATION: - case DAD_GESTURE: - case DAD_LINK: - accept = dragItemIntoFolder((LLInventoryItem*)cargo_data, - drop); - break; - case DAD_CATEGORY: - if (LLFriendCardsManager::instance().isAnyFriendCategory(mUUID)) - { - accept = FALSE; - } - else - { - accept = dragCategoryIntoFolder((LLInventoryCategory*)cargo_data, drop); - } - break; - default: - break; - } - return accept; -} - -LLViewerInventoryCategory* LLFolderBridge::getCategory() const -{ - LLViewerInventoryCategory* cat = NULL; - LLInventoryModel* model = getInventoryModel(); - if(model) - { - cat = (LLViewerInventoryCategory*)model->getCategory(mUUID); - } - return cat; -} - - -// static -void LLFolderBridge::pasteClipboard(void* user_data) -{ - LLFolderBridge* self = (LLFolderBridge*)user_data; - if(self) self->pasteFromClipboard(); -} - -void LLFolderBridge::createNewCategory(void* user_data) -{ - LLFolderBridge* bridge = (LLFolderBridge*)user_data; - if(!bridge) return; - LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(bridge->mInventoryPanel.get()); - if (!panel) return; - LLInventoryModel* model = panel->getModel(); - if(!model) return; - LLUUID id; - id = model->createNewCategory(bridge->getUUID(), - LLFolderType::FT_NONE, - LLStringUtil::null); - model->notifyObservers(); - - // At this point, the bridge has probably been deleted, but the - // view is still there. - panel->setSelection(id, TAKE_FOCUS_YES); -} - -void LLFolderBridge::createNewShirt(void* user_data) -{ - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHIRT); -} - -void LLFolderBridge::createNewPants(void* user_data) -{ - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_PANTS); -} - -void LLFolderBridge::createNewShoes(void* user_data) -{ - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHOES); -} - -void LLFolderBridge::createNewSocks(void* user_data) -{ - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SOCKS); -} - -void LLFolderBridge::createNewJacket(void* user_data) -{ - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_JACKET); -} - -void LLFolderBridge::createNewSkirt(void* user_data) -{ - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SKIRT); -} - -void LLFolderBridge::createNewGloves(void* user_data) -{ - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_GLOVES); -} - -void LLFolderBridge::createNewUndershirt(void* user_data) -{ - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_UNDERSHIRT); -} - -void LLFolderBridge::createNewUnderpants(void* user_data) -{ - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_UNDERPANTS); -} - -void LLFolderBridge::createNewShape(void* user_data) -{ - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHAPE); -} - -void LLFolderBridge::createNewSkin(void* user_data) -{ - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SKIN); -} - -void LLFolderBridge::createNewHair(void* user_data) -{ - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_HAIR); -} - -void LLFolderBridge::createNewEyes(void* user_data) -{ - LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_EYES); -} - -// static -void LLFolderBridge::createWearable(LLFolderBridge* bridge, EWearableType type) -{ - if(!bridge) return; - LLUUID parent_id = bridge->getUUID(); - createWearable(parent_id, type); -} - -// Separate function so can be called by global menu as well as right-click -// menu. -// static -void LLFolderBridge::createWearable(const LLUUID &parent_id, EWearableType type) -{ - LLWearable* wearable = LLWearableList::instance().createNewWearable(type); - LLAssetType::EType asset_type = wearable->getAssetType(); - LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE; - create_inventory_item(gAgent.getID(), gAgent.getSessionID(), - parent_id, wearable->getTransactionID(), wearable->getName(), - wearable->getDescription(), asset_type, inv_type, wearable->getType(), - wearable->getPermissions().getMaskNextOwner(), - LLPointer<LLInventoryCallback>(NULL)); -} - -void LLFolderBridge::modifyOutfit(BOOL append) -{ - LLInventoryModel* model = getInventoryModel(); - if(!model) return; - LLViewerInventoryCategory* cat = getCategory(); - if(!cat) return; - - // BAP - was: - // wear_inventory_category_on_avatar( cat, append ); - LLAppearanceManager::instance().wearInventoryCategory( cat, FALSE, append ); -} - -// helper stuff -bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, LLMoveInv* move_inv) -{ - LLFloaterOpenObject::LLCatAndWear* cat_and_wear = (LLFloaterOpenObject::LLCatAndWear* )move_inv->mUserData; - LLViewerObject* object = gObjectList.findObject(move_inv->mObjectID); - S32 option = LLNotification::getSelectedOption(notification, response); - - if(option == 0 && object) - { - if (cat_and_wear && cat_and_wear->mWear) - { - InventoryObjectList inventory_objects; - object->getInventoryContents(inventory_objects); - int contents_count = inventory_objects.size()-1; //subtract one for containing folder - - LLInventoryCopyAndWearObserver* inventoryObserver = new LLInventoryCopyAndWearObserver(cat_and_wear->mCatID, contents_count); - gInventory.addObserver(inventoryObserver); - } - - two_uuids_list_t::iterator move_it; - for (move_it = move_inv->mMoveList.begin(); - move_it != move_inv->mMoveList.end(); - ++move_it) - { - object->moveInventory(move_it->first, move_it->second); - } - - // update the UI. - dialog_refresh_all(); - } - - if (move_inv->mCallback) - { - move_inv->mCallback(option, move_inv->mUserData); - } - - delete move_inv; - return false; -} - -/* -Next functions intended to reorder items in the inventory folder and save order on server -Is now used for Favorites folder. - -*TODO: refactoring is needed with Favorites Bar functionality. Probably should be moved in LLInventoryModel -*/ -void saveItemsOrder(LLInventoryModel::item_array_t& items) -{ - int sortField = 0; - - // current order is saved by setting incremental values (1, 2, 3, ...) for the sort field - for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i) - { - LLViewerInventoryItem* item = *i; - - item->setSortField(++sortField); - item->setComplete(TRUE); - item->updateServer(FALSE); - - gInventory.updateItem(item); - } - - gInventory.notifyObservers(); -} - -LLInventoryModel::item_array_t::iterator findItemByUUID(LLInventoryModel::item_array_t& items, const LLUUID& id) -{ - LLInventoryModel::item_array_t::iterator result = items.end(); - - for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i) - { - if ((*i)->getUUID() == id) - { - result = i; - break; - } - } - - return result; -} - -void updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& srcItemId, const LLUUID& destItemId) -{ - LLViewerInventoryItem* srcItem = gInventory.getItem(srcItemId); - LLViewerInventoryItem* destItem = gInventory.getItem(destItemId); - - items.erase(findItemByUUID(items, srcItem->getUUID())); - items.insert(findItemByUUID(items, destItem->getUUID()), srcItem); -} - -BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, - BOOL drop) -{ - LLInventoryModel* model = getInventoryModel(); - if(!model) return FALSE; - - // cannot drag into library - if(!isAgentInventory()) - { - return FALSE; - } - - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if(!avatar) return FALSE; - - LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); - BOOL accept = FALSE; - LLViewerObject* object = NULL; - if(LLToolDragAndDrop::SOURCE_AGENT == source) - { - - BOOL is_movable = TRUE; - switch( inv_item->getActualType() ) - { - case LLAssetType::AT_CATEGORY: - is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType()); - break; - default: - break; - } - - const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); - BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id); - const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); - BOOL move_is_into_current_outfit = (mUUID == current_outfit_id); - BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT); - - if(is_movable && move_is_into_trash) - { - switch(inv_item->getType()) - { - case LLAssetType::AT_CLOTHING: - case LLAssetType::AT_BODYPART: - is_movable = !gAgentWearables.isWearingItem(inv_item->getUUID()); - break; - - case LLAssetType::AT_OBJECT: - is_movable = !avatar->isWearingAttachment(inv_item->getUUID()); - break; - default: - break; - } - } - - if ( is_movable ) - { - // Don't allow creating duplicates in the Calling Card/Friends - // subfolders, see bug EXT-1599. Check is item direct descendent - // of target folder and forbid item's movement if it so. - // Note: isItemDirectDescendentOfCategory checks if - // passed category is in the Calling Card/Friends folder - is_movable = ! LLFriendCardsManager::instance() - .isObjDirectDescendentOfCategory (inv_item, getCategory()); - } - - const LLUUID& favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE); - const LLUUID& landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK); - const BOOL folder_allows_reorder = ((mUUID == landmarks_id) || (mUUID == favorites_id)); - - // we can move item inside a folder only if this folder is Favorites. See EXT-719 - accept = is_movable && ((mUUID != inv_item->getParentUUID()) || folder_allows_reorder); - if(accept && drop) - { - if (inv_item->getType() == LLAssetType::AT_GESTURE - && LLGestureManager::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash) - { - LLGestureManager::instance().deactivateGesture(inv_item->getUUID()); - } - // If an item is being dragged between windows, unselect - // everything in the active window so that we don't follow - // the selection to its new location (which is very - // annoying). - if (LLFloaterInventory::getActiveInventory()) - { - LLInventoryPanel* active_panel = LLFloaterInventory::getActiveInventory()->getPanel(); - LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get()); - if (active_panel && (panel != active_panel)) - { - active_panel->unSelectAll(); - } - } - - // if dragging from/into favorites folder only reorder items - if ((mUUID == inv_item->getParentUUID()) && folder_allows_reorder) - { - LLInventoryModel::cat_array_t cats; - LLInventoryModel::item_array_t items; - LLIsType is_type(LLAssetType::AT_LANDMARK); - model->collectDescendentsIf(mUUID, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type); - - LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get()); - LLFolderViewItem* itemp = panel ? panel->getRootFolder()->getDraggingOverItem() : NULL; - if (itemp) - { - LLUUID srcItemId = inv_item->getUUID(); - LLUUID destItemId = itemp->getListener()->getUUID(); - - // update order - updateItemsOrder(items, srcItemId, destItemId); - - saveItemsOrder(items); - } - } - else if (favorites_id == mUUID) // if target is the favorites folder we use copy - { - copy_inventory_item( - gAgent.getID(), - inv_item->getPermissions().getOwner(), - inv_item->getUUID(), - mUUID, - std::string(), - LLPointer<LLInventoryCallback>(NULL)); - } - else if (move_is_into_current_outfit || move_is_into_outfit) - { - // BAP - should skip if dup. - if (move_is_into_current_outfit) - { - LLAppearanceManager::instance().addCOFItemLink(inv_item); - } - else - { - LLPointer<LLInventoryCallback> cb = NULL; - link_inventory_item( - gAgent.getID(), - inv_item->getLinkedUUID(), - mUUID, - inv_item->getName(), - LLAssetType::AT_LINK, - cb); - } - } - else - { - // restamp if the move is into the trash. - LLInvFVBridge::changeItemParent( - model, - (LLViewerInventoryItem*)inv_item, - mUUID, - move_is_into_trash); - } - } - } - else if(LLToolDragAndDrop::SOURCE_WORLD == source) - { - // Make sure the object exists. If we allowed dragging from - // anonymous objects, it would be possible to bypass - // permissions. - object = gObjectList.findObject(inv_item->getParentUUID()); - if(!object) - { - llinfos << "Object not found for drop." << llendl; - return FALSE; - } - - // coming from a task. Need to figure out if the person can - // move/copy this item. - LLPermissions perm(inv_item->getPermissions()); - BOOL is_move = FALSE; - if((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID()) - && perm.allowTransferTo(gAgent.getID()))) -// || gAgent.isGodlike()) - - { - accept = TRUE; - } - else if(object->permYouOwner()) - { - // If the object cannot be copied, but the object the - // inventory is owned by the agent, then the item can be - // moved from the task to agent inventory. - is_move = TRUE; - accept = TRUE; - } - if(drop && accept) - { - LLMoveInv* move_inv = new LLMoveInv; - move_inv->mObjectID = inv_item->getParentUUID(); - two_uuids_t item_pair(mUUID, inv_item->getUUID()); - move_inv->mMoveList.push_back(item_pair); - move_inv->mCallback = NULL; - move_inv->mUserData = NULL; - if(is_move) - { - warn_move_inventory(object, move_inv); - } - else - { - LLNotification::Params params("MoveInventoryFromObject"); - params.functor.function(boost::bind(move_task_inventory_callback, _1, _2, move_inv)); - LLNotifications::instance().forceResponse(params, 0); - } - } - - } - else if(LLToolDragAndDrop::SOURCE_NOTECARD == source) - { - accept = TRUE; - if(drop) - { - copy_inventory_from_notecard(LLToolDragAndDrop::getInstance()->getObjectID(), - LLToolDragAndDrop::getInstance()->getSourceID(), inv_item); - } - } - else if(LLToolDragAndDrop::SOURCE_LIBRARY == source) - { - LLViewerInventoryItem* item = (LLViewerInventoryItem*)inv_item; - if(item && item->isComplete()) - { - accept = TRUE; - if(drop) - { - copy_inventory_item( - gAgent.getID(), - inv_item->getPermissions().getOwner(), - inv_item->getUUID(), - mUUID, - std::string(), - LLPointer<LLInventoryCallback>(NULL)); - } - } - } - else - { - llwarns << "unhandled drag source" << llendl; - } - return accept; -} - -// +=================================================+ -// | LLScriptBridge (DEPRECTED) | -// +=================================================+ - -LLUIImagePtr LLScriptBridge::getIcon() const -{ - return get_item_icon(LLAssetType::AT_SCRIPT, LLInventoryType::IT_LSL, 0, FALSE); -} - -// +=================================================+ -// | LLTextureBridge | -// +=================================================+ - -LLUIImagePtr LLTextureBridge::getIcon() const -{ - return get_item_icon(LLAssetType::AT_TEXTURE, mInvType, 0, FALSE); -} - -void LLTextureBridge::openItem() -{ - LLViewerInventoryItem* item = getItem(); - - if (item) - { - LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); - } -} - -void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) -{ - lldebugs << "LLTextureBridge::buildContextMenu()" << llendl; - std::vector<std::string> items; - std::vector<std::string> disabled_items; - if(isInTrash()) - { - items.push_back(std::string("Purge Item")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Purge Item")); - } - - items.push_back(std::string("Restore Item")); - } - else - { - items.push_back(std::string("Open")); - items.push_back(std::string("Properties")); - - getClipboardEntries(true, items, disabled_items, flags); - - items.push_back(std::string("Texture Separator")); - items.push_back(std::string("Save As")); - } - hide_context_entries(menu, items, disabled_items); -} - -// virtual -void LLTextureBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) -{ - if ("save_as" == action) - { - LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES); - LLPreviewTexture* preview_texture = LLFloaterReg::findTypedInstance<LLPreviewTexture>("preview_texture", mUUID); - if (preview_texture) - { - preview_texture->openToSave(); - } - } - else LLItemBridge::performAction(folder, model, action); -} - -// +=================================================+ -// | LLSoundBridge | -// +=================================================+ - -LLUIImagePtr LLSoundBridge::getIcon() const -{ - return get_item_icon(LLAssetType::AT_SOUND, LLInventoryType::IT_SOUND, 0, FALSE); -} - -void LLSoundBridge::openItem() -{ - LLViewerInventoryItem* item = getItem(); - - if (item) - { - LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); - } -/* -// Changed this back to the way it USED to work: -// only open the preview dialog through the contextual right-click menu -// double-click just plays the sound - - LLViewerInventoryItem* item = getItem(); - if(item) - { - openSoundPreview((void*)this); - //send_uuid_sound_trigger(item->getAssetUUID(), 1.0); - } -*/ -} - -void LLSoundBridge::previewItem() -{ - LLViewerInventoryItem* item = getItem(); - if(item) - { - send_sound_trigger(item->getAssetUUID(), 1.0); - } -} - -void LLSoundBridge::openSoundPreview(void* which) -{ - LLSoundBridge *me = (LLSoundBridge *)which; - LLFloaterReg::showInstance("preview_sound", LLSD(me->mUUID), TAKE_FOCUS_YES); -} - -void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) -{ - lldebugs << "LLSoundBridge::buildContextMenu()" << llendl; - std::vector<std::string> items; - std::vector<std::string> disabled_items; - - if(isInTrash()) - { - items.push_back(std::string("Purge Item")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Purge Item")); - } - - items.push_back(std::string("Restore Item")); - } - else - { - items.push_back(std::string("Sound Open")); - items.push_back(std::string("Properties")); - - getClipboardEntries(true, items, disabled_items, flags); - } - - items.push_back(std::string("Sound Separator")); - items.push_back(std::string("Sound Play")); - - hide_context_entries(menu, items, disabled_items); -} - -// +=================================================+ -// | LLLandmarkBridge | -// +=================================================+ - -LLLandmarkBridge::LLLandmarkBridge(LLInventoryPanel* inventory, const LLUUID& uuid, U32 flags/* = 0x00*/) : -LLItemBridge(inventory, uuid) -{ - mVisited = FALSE; - if (flags & LLInventoryItem::II_FLAGS_LANDMARK_VISITED) - { - mVisited = TRUE; - } -} - -LLUIImagePtr LLLandmarkBridge::getIcon() const -{ - return get_item_icon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, mVisited, FALSE); -} - -void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags) -{ - std::vector<std::string> items; - std::vector<std::string> disabled_items; - - lldebugs << "LLLandmarkBridge::buildContextMenu()" << llendl; - if(isInTrash()) - { - items.push_back(std::string("Purge Item")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Purge Item")); - } - - items.push_back(std::string("Restore Item")); - } - else - { - items.push_back(std::string("Landmark Open")); - items.push_back(std::string("Properties")); - - getClipboardEntries(true, items, disabled_items, flags); - } - - items.push_back(std::string("Landmark Separator")); - items.push_back(std::string("About Landmark")); - - // Disable "About Landmark" menu item for - // multiple landmarks selected. Only one landmark - // info panel can be shown at a time. - if ((flags & FIRST_SELECTED_ITEM) == 0) - { - disabled_items.push_back(std::string("About Landmark")); - } - - hide_context_entries(menu, items, disabled_items); -} - -// Convenience function for the two functions below. -void teleport_via_landmark(const LLUUID& asset_id) -{ - gAgent.teleportViaLandmark( asset_id ); - - // we now automatically track the landmark you're teleporting to - // because you'll probably arrive at a telehub instead - LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance(); - if( floater_world_map ) - { - floater_world_map->trackLandmark( asset_id ); - } -} - -// virtual -void LLLandmarkBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) -{ - if ("teleport" == action) - { - LLViewerInventoryItem* item = getItem(); - if(item) - { - teleport_via_landmark(item->getAssetUUID()); - } - } - else if ("about" == action) - { - LLViewerInventoryItem* item = getItem(); - if(item) - { - LLSD key; - key["type"] = "landmark"; - key["id"] = item->getUUID(); - - LLSideTray::getInstance()->showPanel("panel_places", key); - } - } - else - { - LLItemBridge::performAction(folder, model, action); - } -} - -static bool open_landmark_callback(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - - LLUUID asset_id = notification["payload"]["asset_id"].asUUID(); - if (option == 0) - { - teleport_via_landmark(asset_id); - } - - return false; -} -static LLNotificationFunctorRegistration open_landmark_callback_reg("TeleportFromLandmark", open_landmark_callback); - - -void LLLandmarkBridge::openItem() -{ - LLViewerInventoryItem* item = getItem(); - - if (item) - { - LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); - } -/* - LLViewerInventoryItem* item = getItem(); - if( item ) - { - // Opening (double-clicking) a landmark immediately teleports, - // but warns you the first time. - // open_landmark(item); - LLSD payload; - payload["asset_id"] = item->getAssetUUID(); - LLNotifications::instance().add("TeleportFromLandmark", LLSD(), payload); - } -*/ -} - - -// +=================================================+ -// | LLCallingCardObserver | -// +=================================================+ -void LLCallingCardObserver::changed(U32 mask) -{ - mBridgep->refreshFolderViewItem(); -} - -// +=================================================+ -// | LLCallingCardBridge | -// +=================================================+ - -LLCallingCardBridge::LLCallingCardBridge( LLInventoryPanel* inventory, const LLUUID& uuid ) : - LLItemBridge(inventory, uuid) -{ - mObserver = new LLCallingCardObserver(this); - LLAvatarTracker::instance().addObserver(mObserver); -} - -LLCallingCardBridge::~LLCallingCardBridge() -{ - LLAvatarTracker::instance().removeObserver(mObserver); - delete mObserver; -} - -void LLCallingCardBridge::refreshFolderViewItem() -{ - LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get()); - LLFolderViewItem* itemp = panel ? panel->getRootFolder()->getItemByID(mUUID) : NULL; - if (itemp) - { - itemp->refresh(); - } -} - -// virtual -void LLCallingCardBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) -{ - if ("begin_im" == action) - { - LLViewerInventoryItem *item = getItem(); - if (item && (item->getCreatorUUID() != gAgent.getID()) && - (!item->getCreatorUUID().isNull())) - { - std::string callingcard_name; - gCacheName->getFullName(item->getCreatorUUID(), callingcard_name); - LLUUID session_id = gIMMgr->addSession(callingcard_name, IM_NOTHING_SPECIAL, item->getCreatorUUID()); - if (session_id != LLUUID::null) - { - LLIMFloater::show(session_id); - } - } - } - else if ("lure" == action) - { - LLViewerInventoryItem *item = getItem(); - if (item && (item->getCreatorUUID() != gAgent.getID()) && - (!item->getCreatorUUID().isNull())) - { - LLAvatarActions::offerTeleport(item->getCreatorUUID()); - } - } - else LLItemBridge::performAction(folder, model, action); -} - -LLUIImagePtr LLCallingCardBridge::getIcon() const -{ - BOOL online = FALSE; - LLViewerInventoryItem* item = getItem(); - if(item) - { - online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()); - } - return get_item_icon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, online, FALSE); -} - -std::string LLCallingCardBridge::getLabelSuffix() const -{ - LLViewerInventoryItem* item = getItem(); - if( item && LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()) ) - { - return LLItemBridge::getLabelSuffix() + " (online)"; - } - else - { - return LLItemBridge::getLabelSuffix(); - } -} - -void LLCallingCardBridge::openItem() -{ - LLViewerInventoryItem* item = getItem(); - - if (item) - { - LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); - } -/* - LLViewerInventoryItem* item = getItem(); - if(item && !item->getCreatorUUID().isNull()) - { - LLAvatarActions::showProfile(item->getCreatorUUID()); - } -*/ -} - -void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) -{ - lldebugs << "LLCallingCardBridge::buildContextMenu()" << llendl; - std::vector<std::string> items; - std::vector<std::string> disabled_items; - - if(isInTrash()) - { - items.push_back(std::string("Purge Item")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Purge Item")); - } - - items.push_back(std::string("Restore Item")); - } - else - { - items.push_back(std::string("Open")); - items.push_back(std::string("Properties")); - - getClipboardEntries(true, items, disabled_items, flags); - - LLInventoryItem* item = getItem(); - BOOL good_card = (item - && (LLUUID::null != item->getCreatorUUID()) - && (item->getCreatorUUID() != gAgent.getID())); - BOOL user_online = (LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID())); - items.push_back(std::string("Send Instant Message Separator")); - items.push_back(std::string("Send Instant Message")); - items.push_back(std::string("Offer Teleport...")); - items.push_back(std::string("Conference Chat")); - - if (!good_card) - { - disabled_items.push_back(std::string("Send Instant Message")); - } - if (!good_card || !user_online) - { - disabled_items.push_back(std::string("Offer Teleport...")); - disabled_items.push_back(std::string("Conference Chat")); - } - } - hide_context_entries(menu, items, disabled_items); -} - -BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data) -{ - LLViewerInventoryItem* item = getItem(); - BOOL rv = FALSE; - if(item) - { - // check the type - switch(cargo_type) - { - case DAD_TEXTURE: - case DAD_SOUND: - case DAD_LANDMARK: - case DAD_SCRIPT: - case DAD_CLOTHING: - case DAD_OBJECT: - case DAD_NOTECARD: - case DAD_BODYPART: - case DAD_ANIMATION: - case DAD_GESTURE: - { - LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data; - const LLPermissions& perm = inv_item->getPermissions(); - if(gInventory.getItem(inv_item->getUUID()) - && perm.allowOperationBy(PERM_TRANSFER, gAgent.getID())) - { - rv = TRUE; - if(drop) - { - LLToolDragAndDrop::giveInventory(item->getCreatorUUID(), - (LLInventoryItem*)cargo_data); - } - } - else - { - // It's not in the user's inventory (it's probably in - // an object's contents), so disallow dragging it here. - // You can't give something you don't yet have. - rv = FALSE; - } - break; - } - case DAD_CATEGORY: - { - LLInventoryCategory* inv_cat = (LLInventoryCategory*)cargo_data; - if( gInventory.getCategory( inv_cat->getUUID() ) ) - { - rv = TRUE; - if(drop) - { - LLToolDragAndDrop::giveInventoryCategory( - item->getCreatorUUID(), - inv_cat); - } - } - else - { - // It's not in the user's inventory (it's probably in - // an object's contents), so disallow dragging it here. - // You can't give something you don't yet have. - rv = FALSE; - } - break; - } - default: - break; - } - } - return rv; -} - -BOOL LLCallingCardBridge::removeItem() -{ - if (LLFriendCardsManager::instance().isItemInAnyFriendsList(getItem())) - { - LLAvatarActions::removeFriendDialog(getItem()->getCreatorUUID()); - return FALSE; - } - else - { - return LLItemBridge::removeItem(); - } -} -// +=================================================+ -// | LLNotecardBridge | -// +=================================================+ - -LLUIImagePtr LLNotecardBridge::getIcon() const -{ - return get_item_icon(LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, 0, FALSE); -} - -void LLNotecardBridge::openItem() -{ - LLViewerInventoryItem* item = getItem(); - - if (item) - { - LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); - } - -/* - LLViewerInventoryItem* item = getItem(); - if (item) - { - LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES); - } -*/ -} - - -// +=================================================+ -// | LLGestureBridge | -// +=================================================+ - -LLUIImagePtr LLGestureBridge::getIcon() const -{ - return get_item_icon(LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, 0, FALSE); -} - -LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const -{ - if( LLGestureManager::instance().isGestureActive(mUUID) ) - { - return LLFontGL::BOLD; - } - else - { - return LLFontGL::NORMAL; - } -} - -std::string LLGestureBridge::getLabelSuffix() const -{ - if( LLGestureManager::instance().isGestureActive(mUUID) ) - { - return LLItemBridge::getLabelSuffix() + " (active)"; - } - else - { - return LLItemBridge::getLabelSuffix(); - } -} - -// virtual -void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) -{ - if ("activate" == action) - { - LLGestureManager::instance().activateGesture(mUUID); - - LLViewerInventoryItem* item = gInventory.getItem(mUUID); - if (!item) return; - - // Since we just changed the suffix to indicate (active) - // the server doesn't need to know, just the viewer. - gInventory.updateItem(item); - gInventory.notifyObservers(); - } - else if ("deactivate" == action) - { - LLGestureManager::instance().deactivateGesture(mUUID); - - LLViewerInventoryItem* item = gInventory.getItem(mUUID); - if (!item) return; - - // Since we just changed the suffix to indicate (active) - // the server doesn't need to know, just the viewer. - gInventory.updateItem(item); - gInventory.notifyObservers(); - } - else LLItemBridge::performAction(folder, model, action); -} - -void LLGestureBridge::openItem() -{ - LLViewerInventoryItem* item = getItem(); - - if (item) - { - LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); - } -/* - LLViewerInventoryItem* item = getItem(); - if (item) - { - LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null); - preview->setFocus(TRUE); - } -*/ -} - -BOOL LLGestureBridge::removeItem() -{ - // Force close the preview window, if it exists - LLGestureManager::instance().deactivateGesture(mUUID); - return LLItemBridge::removeItem(); -} - -void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) -{ - lldebugs << "LLGestureBridge::buildContextMenu()" << llendl; - std::vector<std::string> items; - std::vector<std::string> disabled_items; - if(isInTrash()) - { - items.push_back(std::string("Purge Item")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Purge Item")); - } - - items.push_back(std::string("Restore Item")); - } - else - { - LLInventoryItem* item = getItem(); - if (item && item->getIsLinkType()) - { - items.push_back(std::string("Find Original")); - } - items.push_back(std::string("Open")); - items.push_back(std::string("Properties")); - - getClipboardEntries(true, items, disabled_items, flags); - - items.push_back(std::string("Gesture Separator")); - items.push_back(std::string("Activate")); - items.push_back(std::string("Deactivate")); - } - hide_context_entries(menu, items, disabled_items); -} - -// +=================================================+ -// | LLAnimationBridge | -// +=================================================+ - -LLUIImagePtr LLAnimationBridge::getIcon() const -{ - return get_item_icon(LLAssetType::AT_ANIMATION, LLInventoryType::IT_ANIMATION, 0, FALSE); -} - -void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags) -{ - std::vector<std::string> items; - std::vector<std::string> disabled_items; - - lldebugs << "LLAnimationBridge::buildContextMenu()" << llendl; - if(isInTrash()) - { - items.push_back(std::string("Purge Item")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Purge Item")); - } - - items.push_back(std::string("Restore Item")); - } - else - { - items.push_back(std::string("Animation Open")); - items.push_back(std::string("Properties")); - - getClipboardEntries(true, items, disabled_items, flags); - } - - items.push_back(std::string("Animation Separator")); - items.push_back(std::string("Animation Play")); - items.push_back(std::string("Animation Audition")); - - hide_context_entries(menu, items, disabled_items); - -} - -// virtual -void LLAnimationBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) -{ - if ((action == "playworld") || (action == "playlocal")) - { - if (getItem()) - { - LLPreviewAnim::e_activation_type activate = LLPreviewAnim::NONE; - if ("playworld" == action) activate = LLPreviewAnim::PLAY; - if ("playlocal" == action) activate = LLPreviewAnim::AUDITION; - - LLPreviewAnim* preview = LLFloaterReg::showTypedInstance<LLPreviewAnim>("preview_anim", LLSD(mUUID)); - if (preview) - { - preview->activate(activate); - } - } - } - else - { - LLItemBridge::performAction(folder, model, action); - } -} - -void LLAnimationBridge::openItem() -{ - LLViewerInventoryItem* item = getItem(); - - if (item) - { - LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); - } -/* - LLViewerInventoryItem* item = getItem(); - if (item) - { - LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES); - } -*/ -} - -// +=================================================+ -// | LLObjectBridge | -// +=================================================+ - -// static -LLUUID LLObjectBridge::sContextMenuItemID; - -LLObjectBridge::LLObjectBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLInventoryType::EType type, U32 flags) : -LLItemBridge(inventory, uuid), mInvType(type) -{ - mAttachPt = (flags & 0xff); // low bye of inventory flags - - mIsMultiObject = ( flags & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) ? TRUE: FALSE; -} - -BOOL LLObjectBridge::isItemRemovable() -{ - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if(!avatar) return FALSE; - if(avatar->isWearingAttachment(mUUID)) return FALSE; - return LLInvFVBridge::isItemRemovable(); -} - -LLUIImagePtr LLObjectBridge::getIcon() const -{ - return get_item_icon(LLAssetType::AT_OBJECT, mInvType, mAttachPt, mIsMultiObject ); -} - -LLInventoryObject* LLObjectBridge::getObject() const -{ - LLInventoryObject* object = NULL; - LLInventoryModel* model = getInventoryModel(); - if(model) - { - object = (LLInventoryObject*)model->getObject(mUUID); - } - return object; -} - -// virtual -void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) -{ - if ("attach" == action) - { - LLUUID object_id = mUUID; - LLViewerInventoryItem* item; - item = (LLViewerInventoryItem*)gInventory.getItem(object_id); - if(item && gInventory.isObjectDescendentOf(object_id, gInventory.getRootFolderID())) - { - rez_attachment(item, NULL); - } - else if(item && item->isComplete()) - { - // must be in library. copy it to our inventory and put it on. - LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(0); - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - LLUUID::null, - std::string(), - cb); - } - gFocusMgr.setKeyboardFocus(NULL); - } - else if ("detach" == action) - { - LLInventoryItem* item = gInventory.getItem(mUUID); - if(item) - { - gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv); - gMessageSystem->nextBlockFast(_PREHASH_ObjectData); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - gMessageSystem->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID()); - gMessageSystem->sendReliable( gAgent.getRegion()->getHost()); - } - // this object might have been selected, so let the selection manager know it's gone now - LLViewerObject *found_obj = gObjectList.findObject(item->getLinkedUUID()); - if (found_obj) - { - LLSelectMgr::getInstance()->remove(found_obj); - } - } - else LLItemBridge::performAction(folder, model, action); -} - -void LLObjectBridge::openItem() -{ - LLViewerInventoryItem* item = getItem(); - - if (item) - { - LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); - } - - LLSD key; - key["id"] = mUUID; - LLSideTray::getInstance()->showPanel("sidepanel_inventory", key); - - // Disable old properties floater; this is replaced by the sidepanel. - /* - LLFloaterReg::showInstance("properties", mUUID); - */ -} - -LLFontGL::StyleFlags LLObjectBridge::getLabelStyle() const -{ - U8 font = LLFontGL::NORMAL; - - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if( avatar && avatar->isWearingAttachment( mUUID ) ) - { - font |= LLFontGL::BOLD; - } - - LLInventoryItem* item = getItem(); - if (item && item->getIsLinkType()) - { - font |= LLFontGL::ITALIC; - } - - return (LLFontGL::StyleFlags)font; -} - -std::string LLObjectBridge::getLabelSuffix() const -{ - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if( avatar && avatar->isWearingAttachment( mUUID ) ) - { - std::string attachment_point_name = avatar->getAttachedPointName(mUUID); - - // e.g. "(worn on ...)" / "(attached to ...)" - LLStringUtil::format_map_t args; - args["[ATTACHMENT_POINT]"] = attachment_point_name.c_str(); - return LLItemBridge::getLabelSuffix() + LLTrans::getString("WornOnAttachmentPoint", args); - } - else - { - return LLItemBridge::getLabelSuffix(); - } -} - -void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment) -{ - LLSD payload; - payload["item_id"] = item->getLinkedUUID(); // Wear the base object in case this is a link. - - S32 attach_pt = 0; - if (gAgent.getAvatarObject() && attachment) - { - for (LLVOAvatar::attachment_map_t::iterator iter = gAgent.getAvatarObject()->mAttachmentPoints.begin(); - iter != gAgent.getAvatarObject()->mAttachmentPoints.end(); ++iter) - { - if (iter->second == attachment) - { - attach_pt = iter->first; - break; - } - } - } - - payload["attachment_point"] = attach_pt; - -#if !ENABLE_MULTIATTACHMENTS - if (attachment && attachment->getNumObjects() > 0) - { - LLNotifications::instance().add("ReplaceAttachment", LLSD(), payload, confirm_replace_attachment_rez); - } - else -#endif - { - LLNotifications::instance().forceResponse(LLNotification::Params("ReplaceAttachment").payload(payload), 0/*YES*/); - } -} - -bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response) -{ - LLVOAvatar *avatarp = gAgent.getAvatarObject(); - - if (!avatarp->canAttachMoreObjects()) - { - LLSD args; - args["MAX_ATTACHMENTS"] = llformat("%d", MAX_AGENT_ATTACHMENTS); - LLNotifications::instance().add("MaxAttachmentsOnOutfit", args); - return false; - } - - S32 option = LLNotification::getSelectedOption(notification, response); - if (option == 0/*YES*/) - { - LLViewerInventoryItem* itemp = gInventory.getItem(notification["payload"]["item_id"].asUUID()); - - if (itemp) - { - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_RezSingleAttachmentFromInv); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_ObjectData); - msg->addUUIDFast(_PREHASH_ItemID, itemp->getUUID()); - msg->addUUIDFast(_PREHASH_OwnerID, itemp->getPermissions().getOwner()); - U8 attachment_pt = notification["payload"]["attachment_point"].asInteger(); -#if ENABLE_MULTIATTACHMENTS - attachment_pt |= ATTACHMENT_ADD; -#endif - msg->addU8Fast(_PREHASH_AttachmentPt, attachment_pt); - pack_permissions_slam(msg, itemp->getFlags(), itemp->getPermissions()); - msg->addStringFast(_PREHASH_Name, itemp->getName()); - msg->addStringFast(_PREHASH_Description, itemp->getDescription()); - msg->sendReliable(gAgent.getRegion()->getHost()); - } - } - return false; -} -static LLNotificationFunctorRegistration confirm_replace_attachment_rez_reg("ReplaceAttachment", confirm_replace_attachment_rez); - -void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags) -{ - std::vector<std::string> items; - std::vector<std::string> disabled_items; - if(isInTrash()) - { - items.push_back(std::string("Purge Item")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Purge Item")); - } - - items.push_back(std::string("Restore Item")); - } - else - { - LLInventoryItem* item = getItem(); - if (item && item->getIsLinkType()) - { - items.push_back(std::string("Find Original")); - } - - items.push_back(std::string("Properties")); - - getClipboardEntries(true, items, disabled_items, flags); - - LLObjectBridge::sContextMenuItemID = mUUID; - - if(item) - { - LLVOAvatarSelf* avatarp = gAgent.getAvatarObject(); - if( !avatarp ) - { - return; - } - - if( avatarp->isWearingAttachment( mUUID ) ) - { - items.push_back(std::string("Detach From Yourself")); - } - else - if( !isInTrash() && !isLinkedObjectInTrash() ) - { - items.push_back(std::string("Attach Separator")); - items.push_back(std::string("Object Wear")); - items.push_back(std::string("Attach To")); - items.push_back(std::string("Attach To HUD")); - // commented out for DEV-32347 - //items.push_back(std::string("Restore to Last Position")); - - if (!avatarp->canAttachMoreObjects()) - { - disabled_items.push_back(std::string("Object Wear")); - disabled_items.push_back(std::string("Attach To")); - disabled_items.push_back(std::string("Attach To HUD")); - } - LLMenuGL* attach_menu = menu.findChildMenuByName("Attach To", TRUE); - LLMenuGL* attach_hud_menu = menu.findChildMenuByName("Attach To HUD", TRUE); - LLVOAvatar *avatarp = gAgent.getAvatarObject(); - if (attach_menu - && (attach_menu->getChildCount() == 0) - && attach_hud_menu - && (attach_hud_menu->getChildCount() == 0) - && avatarp) - { - for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); - iter != avatarp->mAttachmentPoints.end(); ) - { - LLVOAvatar::attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - LLMenuItemCallGL::Params p; - std::string submenu_name = attachment->getName(); - if (LLTrans::getString(submenu_name) != "") - { - p.name = (" ")+LLTrans::getString(submenu_name)+" "; - } - else - { - p.name = submenu_name; - } - LLSD cbparams; - cbparams["index"] = curiter->first; - cbparams["label"] = attachment->getName(); - p.on_click.function_name = "Inventory.AttachObject"; - p.on_click.parameter = LLSD(attachment->getName()); - p.on_enable.function_name = "Attachment.Label"; - p.on_enable.parameter = cbparams; - LLView* parent = attachment->getIsHUDAttachment() ? attach_hud_menu : attach_menu; - LLUICtrlFactory::create<LLMenuItemCallGL>(p, parent); - } - } - } - } - } - hide_context_entries(menu, items, disabled_items); -} - -BOOL LLObjectBridge::renameItem(const std::string& new_name) -{ - if(!isItemRenameable()) - return FALSE; - LLPreview::dirty(mUUID); - LLInventoryModel* model = getInventoryModel(); - if(!model) - return FALSE; - LLViewerInventoryItem* item = getItem(); - if(item && (item->getName() != new_name)) - { - LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item); - new_item->rename(new_name); - buildDisplayName(new_item, mDisplayName); - new_item->updateServer(FALSE); - model->updateItem(new_item); - - model->notifyObservers(); - - LLVOAvatarSelf* avatar = gAgent.getAvatarObject(); - if( avatar ) - { - LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() ); - if( obj ) - { - LLSelectMgr::getInstance()->deselectAll(); - LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, FALSE ); - LLSelectMgr::getInstance()->selectionSetObjectName( new_name ); - LLSelectMgr::getInstance()->deselectAll(); - } - } - } - // return FALSE because we either notified observers (& therefore - // rebuilt) or we didn't update. - return FALSE; -} - -// +=================================================+ -// | LLLSLTextBridge | -// +=================================================+ - -LLUIImagePtr LLLSLTextBridge::getIcon() const -{ - return get_item_icon(LLAssetType::AT_SCRIPT, LLInventoryType::IT_LSL, 0, FALSE); -} - -void LLLSLTextBridge::openItem() -{ - LLViewerInventoryItem* item = getItem(); - - if (item) - { - LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); - } - /* - LLViewerInventoryItem* item = getItem(); - if (item) - { - LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES); - } - */ -} - -// +=================================================+ -// | LLWearableBridge | -// +=================================================+ - -// *NOTE: hack to get from avatar inventory to avatar -void wear_inventory_item_on_avatar( LLInventoryItem* item ) -{ - if(item) - { - lldebugs << "wear_inventory_item_on_avatar( " << item->getName() - << " )" << llendl; - - LLAppearanceManager::instance().addCOFItemLink(item); - } -} - -void wear_add_inventory_item_on_avatar( LLInventoryItem* item ) -{ - if(item) - { - lldebugs << "wear_add_inventory_item_on_avatar( " << item->getName() - << " )" << llendl; - - LLWearableList::instance().getAsset(item->getAssetUUID(), - item->getName(), - item->getType(), - LLWearableBridge::onWearAddOnAvatarArrived, - new LLUUID(item->getUUID())); - } -} - -void remove_inventory_category_from_avatar( LLInventoryCategory* category ) -{ - if(!category) return; - lldebugs << "remove_inventory_category_from_avatar( " << category->getName() - << " )" << llendl; - - - if( gFloaterCustomize ) - { - gFloaterCustomize->askToSaveIfDirty( - boost::bind(remove_inventory_category_from_avatar_step2, _1, category->getUUID())); - } - else - { - remove_inventory_category_from_avatar_step2(TRUE, category->getUUID() ); - } -} - -struct OnRemoveStruct -{ - LLUUID mUUID; - OnRemoveStruct(const LLUUID& uuid): - mUUID(uuid) - { - } -}; - -void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_id) -{ - - // Find all the wearables that are in the category's subtree. - lldebugs << "remove_inventory_category_from_avatar_step2()" << llendl; - if(proceed) - { - LLInventoryModel::cat_array_t cat_array; - LLInventoryModel::item_array_t item_array; - LLFindWearables is_wearable; - gInventory.collectDescendentsIf(category_id, - cat_array, - item_array, - LLInventoryModel::EXCLUDE_TRASH, - is_wearable); - S32 i; - S32 wearable_count = item_array.count(); - - LLInventoryModel::cat_array_t obj_cat_array; - LLInventoryModel::item_array_t obj_item_array; - LLIsType is_object( LLAssetType::AT_OBJECT ); - gInventory.collectDescendentsIf(category_id, - obj_cat_array, - obj_item_array, - LLInventoryModel::EXCLUDE_TRASH, - is_object); - S32 obj_count = obj_item_array.count(); - - // Find all gestures in this folder - LLInventoryModel::cat_array_t gest_cat_array; - LLInventoryModel::item_array_t gest_item_array; - LLIsType is_gesture( LLAssetType::AT_GESTURE ); - gInventory.collectDescendentsIf(category_id, - gest_cat_array, - gest_item_array, - LLInventoryModel::EXCLUDE_TRASH, - is_gesture); - S32 gest_count = gest_item_array.count(); - - if (wearable_count > 0) //Loop through wearables. If worn, remove. - { - for(i = 0; i < wearable_count; ++i) - { - if( gAgentWearables.isWearingItem (item_array.get(i)->getUUID()) ) - { - LLWearableList::instance().getAsset(item_array.get(i)->getAssetUUID(), - item_array.get(i)->getName(), - item_array.get(i)->getType(), - LLWearableBridge::onRemoveFromAvatarArrived, - new OnRemoveStruct(item_array.get(i)->getUUID())); - - } - } - } - - - if (obj_count > 0) - { - for(i = 0; i < obj_count; ++i) - { - gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv); - gMessageSystem->nextBlockFast(_PREHASH_ObjectData ); - gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() ); - gMessageSystem->addUUIDFast(_PREHASH_ItemID, obj_item_array.get(i)->getUUID() ); - - gMessageSystem->sendReliable( gAgent.getRegion()->getHost() ); - - // this object might have been selected, so let the selection manager know it's gone now - LLViewerObject *found_obj = gObjectList.findObject( obj_item_array.get(i)->getUUID()); - if (found_obj) - { - LLSelectMgr::getInstance()->remove(found_obj); - } - } - } - - if (gest_count > 0) - { - for(i = 0; i < gest_count; ++i) - { - if ( LLGestureManager::instance().isGestureActive( gest_item_array.get(i)->getUUID()) ) - { - LLGestureManager::instance().deactivateGesture( gest_item_array.get(i)->getUUID() ); - gInventory.updateItem( gest_item_array.get(i) ); - gInventory.notifyObservers(); - } - - } - } - } -} - -BOOL LLWearableBridge::renameItem(const std::string& new_name) -{ - if( gAgentWearables.isWearingItem( mUUID ) ) - { - gAgentWearables.setWearableName( mUUID, new_name ); - } - return LLItemBridge::renameItem(new_name); -} - -BOOL LLWearableBridge::isItemRemovable() -{ - if (gAgentWearables.isWearingItem(mUUID)) return FALSE; - return LLInvFVBridge::isItemRemovable(); -} - -std::string LLWearableBridge::getLabelSuffix() const -{ - if( gAgentWearables.isWearingItem( mUUID ) ) - { - // e.g. "(worn)" - return LLItemBridge::getLabelSuffix() + LLTrans::getString("worn"); - } - else - { - return LLItemBridge::getLabelSuffix(); - } -} - -LLUIImagePtr LLWearableBridge::getIcon() const -{ - return get_item_icon(mAssetType, mInvType, mWearableType, FALSE); -} - -// virtual -void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) -{ - if ("wear" == action) - { - wearOnAvatar(); - } - else if ("wear_add" == action) - { - wearAddOnAvatar(); - } - else if ("edit" == action) - { - editOnAvatar(); - return; - } - else if ("take_off" == action) - { - if(gAgentWearables.isWearingItem(mUUID)) - { - LLViewerInventoryItem* item = getItem(); - if (item) - { - LLWearableList::instance().getAsset(item->getAssetUUID(), - item->getName(), - item->getType(), - LLWearableBridge::onRemoveFromAvatarArrived, - new OnRemoveStruct(mUUID)); - } - } - } - else LLItemBridge::performAction(folder, model, action); -} - -void LLWearableBridge::openItem() -{ - LLViewerInventoryItem* item = getItem(); - - if (item) - { - LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel()); - } - /* - if( isInTrash() ) - { - LLNotifications::instance().add("CannotWearTrash"); - } - else if(isAgentInventory()) - { - if( !gAgentWearables.isWearingItem( mUUID ) ) - { - wearOnAvatar(); - } - } - else - { - // must be in the inventory library. copy it to our inventory - // and put it on right away. - LLViewerInventoryItem* item = getItem(); - if(item && item->isComplete()) - { - LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback(); - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - LLUUID::null, - std::string(), - cb); - } - else if(item) - { - // *TODO: We should fetch the item details, and then do - // the operation above. - LLNotifications::instance().add("CannotWearInfoNotComplete"); - } - } - */ -} - -void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags) -{ - lldebugs << "LLWearableBridge::buildContextMenu()" << llendl; - std::vector<std::string> items; - std::vector<std::string> disabled_items; - if(isInTrash()) - { - items.push_back(std::string("Purge Item")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Purge Item")); - } - - items.push_back(std::string("Restore Item")); - } - else - { // FWIW, it looks like SUPPRESS_OPEN_ITEM is not set anywhere - BOOL no_open = ((flags & SUPPRESS_OPEN_ITEM) == SUPPRESS_OPEN_ITEM); - - // If we have clothing, don't add "Open" as it's the same action as "Wear" SL-18976 - LLViewerInventoryItem* item = getItem(); - if( !no_open && item ) - { - no_open = (item->getType() == LLAssetType::AT_CLOTHING) || - (item->getType() == LLAssetType::AT_BODYPART); - } - if (!no_open) - { - items.push_back(std::string("Open")); - } - - if (item && item->getIsLinkType()) - { - items.push_back(std::string("Find Original")); - } - - items.push_back(std::string("Properties")); - - getClipboardEntries(true, items, disabled_items, flags); - - items.push_back(std::string("Wearable Separator")); - - items.push_back(std::string("Wearable Wear")); - items.push_back(std::string("Wearable Add")); - items.push_back(std::string("Wearable Edit")); - - if ((flags & FIRST_SELECTED_ITEM) == 0) - { - disabled_items.push_back(std::string("Wearable Edit")); - } - // Don't allow items to be worn if their baseobj is in the trash. - if (isLinkedObjectInTrash()) - { - disabled_items.push_back(std::string("Wearable Wear")); - disabled_items.push_back(std::string("Wearable Add")); - disabled_items.push_back(std::string("Wearable Edit")); - } - - // Disable wear and take off based on whether the item is worn. - if(item) - { - switch (item->getType()) - { - case LLAssetType::AT_CLOTHING: - items.push_back(std::string("Take Off")); - case LLAssetType::AT_BODYPART: - if (gAgentWearables.isWearingItem(item->getUUID())) - { - disabled_items.push_back(std::string("Wearable Wear")); - disabled_items.push_back(std::string("Wearable Add")); - } - else - { - disabled_items.push_back(std::string("Take Off")); - } - break; - default: - break; - } - } - } - hide_context_entries(menu, items, disabled_items); -} - -// Called from menus -// static -BOOL LLWearableBridge::canWearOnAvatar(void* user_data) -{ - LLWearableBridge* self = (LLWearableBridge*)user_data; - if(!self) return FALSE; - if(!self->isAgentInventory()) - { - LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem(); - if(!item || !item->isComplete()) return FALSE; - } - return (!gAgentWearables.isWearingItem(self->mUUID)); -} - -// Called from menus -// static -void LLWearableBridge::onWearOnAvatar(void* user_data) -{ - LLWearableBridge* self = (LLWearableBridge*)user_data; - if(!self) return; - self->wearOnAvatar(); -} - -void LLWearableBridge::wearOnAvatar() -{ - // Don't wear anything until initial wearables are loaded, can - // destroy clothing items. - if (!gAgentWearables.areWearablesLoaded()) - { - LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded"); - return; - } - - LLViewerInventoryItem* item = getItem(); - if(item) - { - if(!isAgentInventory()) - { - LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback(); - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - LLUUID::null, - std::string(), - cb); - } - else - { - wear_inventory_item_on_avatar(item); - } - } -} - -void LLWearableBridge::wearAddOnAvatar() -{ - // Don't wear anything until initial wearables are loaded, can - // destroy clothing items. - if (!gAgentWearables.areWearablesLoaded()) - { - LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded"); - return; - } - - LLViewerInventoryItem* item = getItem(); - if(item) - { - if(!isAgentInventory()) - { - LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback(); - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - LLUUID::null, - std::string(), - cb); - } - else - { - wear_add_inventory_item_on_avatar(item); - } - } -} - -// static -void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userdata ) -{ - LLUUID* item_id = (LLUUID*) userdata; - if(wearable) - { - LLViewerInventoryItem* item = NULL; - item = (LLViewerInventoryItem*)gInventory.getItem(*item_id); - if(item) - { - if(item->getAssetUUID() == wearable->getAssetID()) - { - gAgentWearables.setWearableItem(item, wearable); - gInventory.notifyObservers(); - //self->getFolderItem()->refreshFromRoot(); - } - else - { - llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl; - } - } - } - delete item_id; -} - -// static -// BAP remove the "add" code path once everything is fully COF-ified. -void LLWearableBridge::onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata ) -{ - LLUUID* item_id = (LLUUID*) userdata; - if(wearable) - { - LLViewerInventoryItem* item = NULL; - item = (LLViewerInventoryItem*)gInventory.getItem(*item_id); - if(item) - { - if(item->getAssetUUID() == wearable->getAssetID()) - { - bool do_append = true; - gAgentWearables.setWearableItem(item, wearable, do_append); - gInventory.notifyObservers(); - //self->getFolderItem()->refreshFromRoot(); - } - else - { - llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl; - } - } - } - delete item_id; -} - -// static -BOOL LLWearableBridge::canEditOnAvatar(void* user_data) -{ - LLWearableBridge* self = (LLWearableBridge*)user_data; - if(!self) return FALSE; - - return (gAgentWearables.isWearingItem(self->mUUID)); -} - -// static -void LLWearableBridge::onEditOnAvatar(void* user_data) -{ - LLWearableBridge* self = (LLWearableBridge*)user_data; - if(self) - { - self->editOnAvatar(); - } -} - -void LLWearableBridge::editOnAvatar() -{ - const LLWearable* wearable = gAgentWearables.getWearableFromItemID(mUUID); - if( wearable ) - { - // Set the tab to the right wearable. - if (gFloaterCustomize) - gFloaterCustomize->setCurrentWearableType( wearable->getType() ); - - if( CAMERA_MODE_CUSTOMIZE_AVATAR != gAgent.getCameraMode() ) - { - // Start Avatar Customization - gAgent.changeCameraToCustomizeAvatar(); - } - } -} - -// static -BOOL LLWearableBridge::canRemoveFromAvatar(void* user_data) -{ - LLWearableBridge* self = (LLWearableBridge*)user_data; - if( self && (LLAssetType::AT_BODYPART != self->mAssetType) ) - { - return gAgentWearables.isWearingItem( self->mUUID ); - } - return FALSE; -} - -// static -void LLWearableBridge::onRemoveFromAvatar(void* user_data) -{ - LLWearableBridge* self = (LLWearableBridge*)user_data; - if(!self) return; - if(gAgentWearables.isWearingItem(self->mUUID)) - { - LLViewerInventoryItem* item = self->getItem(); - if (item) - { - LLUUID parent_id = item->getParentUUID(); - LLWearableList::instance().getAsset(item->getAssetUUID(), - item->getName(), - item->getType(), - onRemoveFromAvatarArrived, - new OnRemoveStruct(LLUUID(self->mUUID))); - } - } -} - -// static -void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable, - void* userdata) -{ - OnRemoveStruct *on_remove_struct = (OnRemoveStruct*) userdata; - const LLUUID &item_id = gInventory.getLinkedItemID(on_remove_struct->mUUID); - if(wearable) - { - if( gAgentWearables.isWearingItem( item_id ) ) - { - EWearableType type = wearable->getType(); - - if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES ) ) //&& - //!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) ) - { - // MULTI_WEARABLE: FIXME HACK - always remove all - bool do_remove_all = false; - gAgentWearables.removeWearable( type, do_remove_all, 0 ); - } - } - } - - // Find and remove this item from the COF. - LLInventoryModel::item_array_t items = gInventory.collectLinkedItems(item_id, LLAppearanceManager::instance().getCOF()); - llassert(items.size() == 1); // Should always have one and only one item linked to this in the COF. - for (LLInventoryModel::item_array_t::const_iterator iter = items.begin(); - iter != items.end(); - ++iter) - { - const LLViewerInventoryItem *linked_item = (*iter); - const LLUUID &item_id = linked_item->getUUID(); - gInventory.purgeObject(item_id); - } - gInventory.notifyObservers(); - - delete on_remove_struct; -} - -LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_type, - const LLUUID& uuid,LLInventoryModel* model) -{ - LLInvFVBridgeAction* action = NULL; - switch(asset_type) - { - case LLAssetType::AT_TEXTURE: - action = new LLTextureBridgeAction(uuid,model); - break; - - case LLAssetType::AT_SOUND: - action = new LLSoundBridgeAction(uuid,model); - break; - - case LLAssetType::AT_LANDMARK: - action = new LLLandmarkBridgeAction(uuid,model); - break; - - case LLAssetType::AT_CALLINGCARD: - action = new LLCallingCardBridgeAction(uuid,model); - break; - - case LLAssetType::AT_OBJECT: - action = new LLObjectBridgeAction(uuid,model); - break; - - case LLAssetType::AT_NOTECARD: - action = new LLNotecardBridgeAction(uuid,model); - break; - - case LLAssetType::AT_ANIMATION: - action = new LLAnimationBridgeAction(uuid,model); - break; - - case LLAssetType::AT_GESTURE: - action = new LLGestureBridgeAction(uuid,model); - break; - - case LLAssetType::AT_LSL_TEXT: - action = new LLLSLTextBridgeAction(uuid,model); - break; - - case LLAssetType::AT_CLOTHING: - case LLAssetType::AT_BODYPART: - action = new LLWearableBridgeAction(uuid,model); - - break; - - default: - break; - } - return action; -} - -//static -void LLInvFVBridgeAction::doAction(LLAssetType::EType asset_type, - const LLUUID& uuid,LLInventoryModel* model) -{ - LLInvFVBridgeAction* action = createAction(asset_type,uuid,model); - if(action) - { - action->doIt(); - delete action; - } -} - -//static -void LLInvFVBridgeAction::doAction(const LLUUID& uuid, LLInventoryModel* model) -{ - LLAssetType::EType asset_type = model->getItem(uuid)->getType(); - LLInvFVBridgeAction* action = createAction(asset_type,uuid,model); - if(action) - { - action->doIt(); - delete action; - } -} - -LLViewerInventoryItem* LLInvFVBridgeAction::getItem() const -{ - if(mModel) - return (LLViewerInventoryItem*)mModel->getItem(mUUID); - return NULL; -} - -//virtual -void LLTextureBridgeAction::doIt() -{ - if (getItem()) - { - LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES); - } - - LLInvFVBridgeAction::doIt(); -} - -//virtual -void LLSoundBridgeAction::doIt() -{ - LLViewerInventoryItem* item = getItem(); - if(item) - { - LLFloaterReg::showInstance("preview_sound", LLSD(mUUID), TAKE_FOCUS_YES); - } - - LLInvFVBridgeAction::doIt(); -} - - -//virtual -void LLLandmarkBridgeAction::doIt() -{ - LLViewerInventoryItem* item = getItem(); - if( item ) - { - // Opening (double-clicking) a landmark immediately teleports, - // but warns you the first time. - LLSD payload; - payload["asset_id"] = item->getAssetUUID(); - LLNotifications::instance().add("TeleportFromLandmark", LLSD(), payload); - } - - LLInvFVBridgeAction::doIt(); -} - - -//virtual -void LLCallingCardBridgeAction::doIt() -{ - LLViewerInventoryItem* item = getItem(); - if(item && item->getCreatorUUID().notNull()) - { - LLAvatarActions::showProfile(item->getCreatorUUID()); - } - - LLInvFVBridgeAction::doIt(); -} - -//virtual -void -LLNotecardBridgeAction::doIt() -{ - LLViewerInventoryItem* item = getItem(); - if (item) - { - LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES); - } - - LLInvFVBridgeAction::doIt(); -} - -//virtual -void LLGestureBridgeAction::doIt() -{ - LLViewerInventoryItem* item = getItem(); - if (item) - { - LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null); - preview->setFocus(TRUE); - } - - LLInvFVBridgeAction::doIt(); -} - -//virtual -void LLAnimationBridgeAction::doIt() -{ - LLViewerInventoryItem* item = getItem(); - if (item) - { - LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES); - } - - LLInvFVBridgeAction::doIt(); -} - - -//virtual -void LLObjectBridgeAction::doIt() -{ - LLFloaterReg::showInstance("properties", mUUID); - - LLInvFVBridgeAction::doIt(); -} - - -//virtual -void LLLSLTextBridgeAction::doIt() -{ - LLViewerInventoryItem* item = getItem(); - if (item) - { - LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES); - } - - LLInvFVBridgeAction::doIt(); -} - - -BOOL LLWearableBridgeAction::isInTrash() const -{ - if(!mModel) return FALSE; - const LLUUID trash_id = mModel->findCategoryUUIDForType(LLFolderType::FT_TRASH); - return mModel->isObjectDescendentOf(mUUID, trash_id); -} - -BOOL LLWearableBridgeAction::isAgentInventory() const -{ - if(!mModel) return FALSE; - if(gInventory.getRootFolderID() == mUUID) return TRUE; - return mModel->isObjectDescendentOf(mUUID, gInventory.getRootFolderID()); -} - -void LLWearableBridgeAction::wearOnAvatar() -{ - // Don't wear anything until initial wearables are loaded, can - // destroy clothing items. - if (!gAgentWearables.areWearablesLoaded()) - { - LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded"); - return; - } - - LLViewerInventoryItem* item = getItem(); - if(item) - { - if(!isAgentInventory()) - { - LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback(); - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - LLUUID::null, - std::string(), - cb); - } - else - { - wear_inventory_item_on_avatar(item); - } - } -} - -//virtual -void LLWearableBridgeAction::doIt() -{ - if(isInTrash()) - { - LLNotifications::instance().add("CannotWearTrash"); - } - else if(isAgentInventory()) - { - if(!gAgentWearables.isWearingItem(mUUID)) - { - wearOnAvatar(); - } - } - else - { - // must be in the inventory library. copy it to our inventory - // and put it on right away. - LLViewerInventoryItem* item = getItem(); - if(item && item->isComplete()) - { - LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback(); - copy_inventory_item( - gAgent.getID(), - item->getPermissions().getOwner(), - item->getUUID(), - LLUUID::null, - std::string(), - cb); - } - else if(item) - { - // *TODO: We should fetch the item details, and then do - // the operation above. - LLNotifications::instance().add("CannotWearInfoNotComplete"); - } - } - - LLInvFVBridgeAction::doIt(); -} - -// +=================================================+ -// | LLLinkItemBridge | -// +=================================================+ -// For broken links - -std::string LLLinkItemBridge::sPrefix("Link: "); - - -LLUIImagePtr LLLinkItemBridge::getIcon() const -{ - if (LLViewerInventoryItem *item = getItem()) - { - return get_item_icon(item->getActualType(), LLInventoryType::IT_NONE, 0, FALSE); - } - return get_item_icon(LLAssetType::AT_LINK, LLInventoryType::IT_NONE, 0, FALSE); -} - -void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags) -{ - // *TODO: Translate - lldebugs << "LLLink::buildContextMenu()" << llendl; - std::vector<std::string> items; - std::vector<std::string> disabled_items; - - if(isInTrash()) - { - items.push_back(std::string("Purge Item")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Purge Item")); - } - - items.push_back(std::string("Restore Item")); - } - else - { - items.push_back(std::string("Delete")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Delete")); - } - } - hide_context_entries(menu, items, disabled_items); -} - - -// +=================================================+ -// | LLLinkBridge | -// +=================================================+ -// For broken links. - -std::string LLLinkFolderBridge::sPrefix("Link: "); - - -LLUIImagePtr LLLinkFolderBridge::getIcon() const -{ - LLFolderType::EType preferred_type = LLFolderType::FT_NONE; - if (LLViewerInventoryItem *item = getItem()) - { - if (const LLViewerInventoryCategory* cat = item->getLinkedCategory()) - { - preferred_type = cat->getPreferredType(); - } - } - return LLFolderBridge::getIcon(preferred_type); -} - -void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) -{ - // *TODO: Translate - lldebugs << "LLLink::buildContextMenu()" << llendl; - std::vector<std::string> items; - std::vector<std::string> disabled_items; - - if(isInTrash()) - { - items.push_back(std::string("Purge Item")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Purge Item")); - } - - items.push_back(std::string("Restore Item")); - } - else - { - items.push_back(std::string("Find Original")); - items.push_back(std::string("Delete")); - if (!isItemRemovable()) - { - disabled_items.push_back(std::string("Delete")); - } - } - hide_context_entries(menu, items, disabled_items); -} - -void LLLinkFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) -{ - if ("goto" == action) - { - gotoItem(folder); - return; - } - LLItemBridge::performAction(folder,model,action); -} - -void LLLinkFolderBridge::gotoItem(LLFolderView *folder) -{ - const LLUUID &cat_uuid = getFolderID(); - if (!cat_uuid.isNull()) - { - if (LLFolderViewItem *base_folder = folder->getItemByID(cat_uuid)) - { - if (LLInventoryModel* model = getInventoryModel()) - { - model->fetchDescendentsOf(cat_uuid); - } - base_folder->setOpen(TRUE); - folder->setSelectionFromRoot(base_folder,TRUE); - folder->scrollToShowSelection(); - } - } -} - -const LLUUID &LLLinkFolderBridge::getFolderID() const -{ - if (LLViewerInventoryItem *link_item = getItem()) - { - if (const LLViewerInventoryCategory *cat = link_item->getLinkedCategory()) - { - const LLUUID& cat_uuid = cat->getUUID(); - return cat_uuid; - } - } - return LLUUID::null; -} +/**
+ * @file llinventorybridge.cpp
+ * @brief Implementation of the Inventory-Folder-View-Bridge classes.
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ *
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+#include "llinventorybridge.h"
+
+#include "llagent.h"
+#include "llagentwearables.h"
+#include "llappearancemgr.h"
+#include "llavataractions.h"
+#include "llfloatercustomize.h"
+#include "llfloaterinventory.h"
+#include "llfloateropenobject.h"
+#include "llfloaterreg.h"
+#include "llfloaterworldmap.h"
+#include "llfriendcard.h"
+#include "llgesturemgr.h"
+#include "llimfloater.h"
+#include "llimview.h"
+#include "llinventoryclipboard.h"
+#include "llinventoryfunctions.h"
+#include "llinventorymodel.h"
+#include "llinventorypanel.h"
+#include "llpreviewanim.h"
+#include "llpreviewgesture.h"
+#include "llpreviewtexture.h"
+#include "llselectmgr.h"
+#include "llsidetray.h"
+#include "lltrans.h"
+#include "llviewerassettype.h"
+#include "llviewermessage.h"
+#include "llviewerobjectlist.h"
+#include "llviewerwindow.h"
+#include "llvoavatarself.h"
+#include "llwearablelist.h"
+#include "llpaneloutfitsinventory.h"
+
+using namespace LLOldEvents;
+
+// Helpers
+// bug in busy count inc/dec right now, logic is complex... do we really need it?
+void inc_busy_count()
+{
+// gViewerWindow->getWindow()->incBusyCount();
+// check balance of these calls if this code is changed to ever actually
+// *do* something!
+}
+void dec_busy_count()
+{
+// gViewerWindow->getWindow()->decBusyCount();
+// check balance of these calls if this code is changed to ever actually
+// *do* something!
+}
+
+// Function declarations
+void wear_add_inventory_item_on_avatar(LLInventoryItem* item);
+void remove_inventory_category_from_avatar(LLInventoryCategory* category);
+void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_id);
+bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, LLMoveInv*);
+bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response);
+
+std::string ICON_NAME[ICON_NAME_COUNT] =
+{
+ "Inv_Texture",
+ "Inv_Sound",
+ "Inv_CallingCard",
+ "Inv_CallingCard",
+ "Inv_Landmark",
+ "Inv_Landmark",
+ "Inv_Script",
+ "Inv_Clothing",
+ "Inv_Object",
+ "Inv_Object",
+ "Inv_Notecard",
+ "Inv_Skin",
+ "Inv_Snapshot",
+
+ "Inv_BodyShape",
+ "Inv_Skin",
+ "Inv_Hair",
+ "Inv_Eye",
+ "Inv_Shirt",
+ "Inv_Pants",
+ "Inv_Shoe",
+ "Inv_Socks",
+ "Inv_Jacket",
+ "Inv_Gloves",
+ "Inv_Undershirt",
+ "Inv_Underpants",
+ "Inv_Skirt",
+ "Inv_Alpha",
+ "Inv_Tattoo",
+
+ "Inv_Animation",
+ "Inv_Gesture",
+
+ "inv_item_linkitem.tga",
+ "inv_item_linkfolder.tga"
+};
+
+// +=================================================+
+// | LLInvFVBridge |
+// +=================================================+
+
+LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
+mUUID(uuid), mInvType(LLInventoryType::IT_NONE)
+{
+ mInventoryPanel = inventory->getHandle();
+}
+
+const std::string& LLInvFVBridge::getName() const
+{
+ LLInventoryObject* obj = getInventoryObject();
+ if(obj)
+ {
+ return obj->getName();
+ }
+ return LLStringUtil::null;
+}
+
+const std::string& LLInvFVBridge::getDisplayName() const
+{
+ return getName();
+}
+
+// Folders have full perms
+PermissionMask LLInvFVBridge::getPermissionMask() const
+{
+
+ return PERM_ALL;
+}
+
+// virtual
+LLFolderType::EType LLInvFVBridge::getPreferredType() const
+{
+ return LLFolderType::FT_NONE;
+}
+
+
+// Folders don't have creation dates.
+time_t LLInvFVBridge::getCreationDate() const
+{
+ return 0;
+}
+
+// Can be destroyed (or moved to trash)
+BOOL LLInvFVBridge::isItemRemovable()
+{
+ const LLInventoryModel* model = getInventoryModel();
+ if(!model)
+ {
+ return FALSE;
+ }
+ if(!model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID()))
+ {
+ return FALSE;
+ }
+ const LLInventoryObject *obj = model->getItem(mUUID);
+ if (obj && obj->getIsLinkType())
+ {
+ return TRUE;
+ }
+ if (gAgentWearables.isWearingItem(mUUID))
+ {
+ return FALSE;
+ }
+ const LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
+ if (avatar && avatar->isWearingAttachment(mUUID))
+ {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+// Can be moved to another folder
+BOOL LLInvFVBridge::isItemMovable() const
+{
+ return TRUE;
+}
+
+/*virtual*/
+/**
+ * @brief Adds this item into clipboard storage
+ */
+void LLInvFVBridge::cutToClipboard()
+{
+ if(isItemMovable())
+ {
+ LLInventoryClipboard::instance().cut(mUUID);
+ }
+}
+// *TODO: make sure this does the right thing
+void LLInvFVBridge::showProperties()
+{
+ LLSD key;
+ key["id"] = mUUID;
+ LLSideTray::getInstance()->showPanel("sidepanel_inventory", key);
+
+ // Disable old properties floater; this is replaced by the sidepanel.
+ /*
+ LLFloaterReg::showInstance("properties", mUUID);
+ */
+}
+
+void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch)
+{
+ // Deactivate gestures when moving them into Trash
+ LLInvFVBridge* bridge;
+ LLInventoryModel* model = getInventoryModel();
+ LLViewerInventoryItem* item = NULL;
+ LLViewerInventoryCategory* cat = NULL;
+ LLInventoryModel::cat_array_t descendent_categories;
+ LLInventoryModel::item_array_t descendent_items;
+ S32 count = batch.count();
+ S32 i,j;
+ for(i = 0; i < count; ++i)
+ {
+ bridge = (LLInvFVBridge*)(batch.get(i));
+ if(!bridge || !bridge->isItemRemovable()) continue;
+ item = (LLViewerInventoryItem*)model->getItem(bridge->getUUID());
+ if (item)
+ {
+ if(LLAssetType::AT_GESTURE == item->getType())
+ {
+ LLGestureManager::instance().deactivateGesture(item->getUUID());
+ }
+ }
+ }
+ for(i = 0; i < count; ++i)
+ {
+ bridge = (LLInvFVBridge*)(batch.get(i));
+ if(!bridge || !bridge->isItemRemovable()) continue;
+ cat = (LLViewerInventoryCategory*)model->getCategory(bridge->getUUID());
+ if (cat)
+ {
+ gInventory.collectDescendents( cat->getUUID(), descendent_categories, descendent_items, FALSE );
+ for (j=0; j<descendent_items.count(); j++)
+ {
+ if(LLAssetType::AT_GESTURE == descendent_items[j]->getType())
+ {
+ LLGestureManager::instance().deactivateGesture(descendent_items[j]->getUUID());
+ }
+ }
+ }
+ }
+ removeBatchNoCheck(batch);
+}
+
+void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*>& batch)
+{
+ // this method moves a bunch of items and folders to the trash. As
+ // per design guidelines for the inventory model, the message is
+ // built and the accounting is performed first. After all of that,
+ // we call LLInventoryModel::moveObject() to move everything
+ // around.
+ LLInvFVBridge* bridge;
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return;
+ LLMessageSystem* msg = gMessageSystem;
+ const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ LLViewerInventoryItem* item = NULL;
+ LLViewerInventoryCategory* cat = NULL;
+ std::vector<LLUUID> move_ids;
+ LLInventoryModel::update_map_t update;
+ bool start_new_message = true;
+ S32 count = batch.count();
+ S32 i;
+ for(i = 0; i < count; ++i)
+ {
+ bridge = (LLInvFVBridge*)(batch.get(i));
+ if(!bridge || !bridge->isItemRemovable()) continue;
+ item = (LLViewerInventoryItem*)model->getItem(bridge->getUUID());
+ if(item)
+ {
+ if(item->getParentUUID() == trash_id) continue;
+ move_ids.push_back(item->getUUID());
+ LLPreview::hide(item->getUUID());
+ --update[item->getParentUUID()];
+ ++update[trash_id];
+ if(start_new_message)
+ {
+ start_new_message = false;
+ msg->newMessageFast(_PREHASH_MoveInventoryItem);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addBOOLFast(_PREHASH_Stamp, TRUE);
+ }
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ msg->addUUIDFast(_PREHASH_ItemID, item->getUUID());
+ msg->addUUIDFast(_PREHASH_FolderID, trash_id);
+ msg->addString("NewName", NULL);
+ if(msg->isSendFullFast(_PREHASH_InventoryData))
+ {
+ start_new_message = true;
+ gAgent.sendReliableMessage();
+ gInventory.accountForUpdate(update);
+ update.clear();
+ }
+ }
+ }
+ if(!start_new_message)
+ {
+ start_new_message = true;
+ gAgent.sendReliableMessage();
+ gInventory.accountForUpdate(update);
+ update.clear();
+ }
+ for(i = 0; i < count; ++i)
+ {
+ bridge = (LLInvFVBridge*)(batch.get(i));
+ if(!bridge || !bridge->isItemRemovable()) continue;
+ cat = (LLViewerInventoryCategory*)model->getCategory(bridge->getUUID());
+ if(cat)
+ {
+ if(cat->getParentUUID() == trash_id) continue;
+ move_ids.push_back(cat->getUUID());
+ --update[cat->getParentUUID()];
+ ++update[trash_id];
+ if(start_new_message)
+ {
+ start_new_message = false;
+ msg->newMessageFast(_PREHASH_MoveInventoryFolder);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addBOOL("Stamp", TRUE);
+ }
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ msg->addUUIDFast(_PREHASH_FolderID, cat->getUUID());
+ msg->addUUIDFast(_PREHASH_ParentID, trash_id);
+ if(msg->isSendFullFast(_PREHASH_InventoryData))
+ {
+ start_new_message = true;
+ gAgent.sendReliableMessage();
+ gInventory.accountForUpdate(update);
+ update.clear();
+ }
+ }
+ }
+ if(!start_new_message)
+ {
+ gAgent.sendReliableMessage();
+ gInventory.accountForUpdate(update);
+ }
+
+ // move everything.
+ std::vector<LLUUID>::iterator it = move_ids.begin();
+ std::vector<LLUUID>::iterator end = move_ids.end();
+ for(; it != end; ++it)
+ {
+ gInventory.moveObject((*it), trash_id);
+ }
+
+ // notify inventory observers.
+ model->notifyObservers();
+}
+
+BOOL LLInvFVBridge::isClipboardPasteable() const
+{
+ if (!LLInventoryClipboard::instance().hasContents() || !isAgentInventory())
+ {
+ return FALSE;
+ }
+ LLInventoryModel* model = getInventoryModel();
+ if (!model)
+ {
+ return FALSE;
+ }
+
+ const LLUUID &agent_id = gAgent.getID();
+
+ LLDynamicArray<LLUUID> objects;
+ LLInventoryClipboard::instance().retrieve(objects);
+ S32 count = objects.count();
+ for(S32 i = 0; i < count; i++)
+ {
+ const LLUUID &item_id = objects.get(i);
+
+ // Can't paste folders
+ const LLInventoryCategory *cat = model->getCategory(item_id);
+ if (cat)
+ {
+ return FALSE;
+ }
+
+ const LLInventoryItem *item = model->getItem(item_id);
+ if (item)
+ {
+ if (!item->getPermissions().allowCopyBy(agent_id))
+ {
+ return FALSE;
+ }
+ }
+ }
+ return TRUE;
+}
+
+BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
+{
+ if (!LLInventoryClipboard::instance().hasContents() || !isAgentInventory())
+ {
+ return FALSE;
+ }
+ const LLInventoryModel* model = getInventoryModel();
+ if (!model)
+ {
+ return FALSE;
+ }
+
+ LLDynamicArray<LLUUID> objects;
+ LLInventoryClipboard::instance().retrieve(objects);
+ S32 count = objects.count();
+ for(S32 i = 0; i < count; i++)
+ {
+ const LLInventoryItem *item = model->getItem(objects.get(i));
+ if (item)
+ {
+ if (!LLAssetType::lookupCanLink(item->getActualType()))
+ {
+ return FALSE;
+ }
+ }
+ const LLViewerInventoryCategory *cat = model->getCategory(objects.get(i));
+ if (cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+void hide_context_entries(LLMenuGL& menu,
+ const std::vector<std::string> &entries_to_show,
+ const std::vector<std::string> &disabled_entries)
+{
+ const LLView::child_list_t *list = menu.getChildList();
+
+ LLView::child_list_t::const_iterator itor;
+ for (itor = list->begin(); itor != list->end(); ++itor)
+ {
+ std::string name = (*itor)->getName();
+
+ // descend into split menus:
+ LLMenuItemBranchGL* branchp = dynamic_cast<LLMenuItemBranchGL*>(*itor);
+ if ((name == "More") && branchp)
+ {
+ hide_context_entries(*branchp->getBranch(), entries_to_show, disabled_entries);
+ }
+
+
+ bool found = false;
+ std::vector<std::string>::const_iterator itor2;
+ for (itor2 = entries_to_show.begin(); itor2 != entries_to_show.end(); ++itor2)
+ {
+ if (*itor2 == name)
+ {
+ found = true;
+ }
+ }
+ if (!found)
+ {
+ (*itor)->setVisible(FALSE);
+ }
+ else
+ {
+ (*itor)->setVisible(TRUE);
+ for (itor2 = disabled_entries.begin(); itor2 != disabled_entries.end(); ++itor2)
+ {
+ if (*itor2 == name)
+ {
+ (*itor)->setEnabled(FALSE);
+ }
+ }
+ }
+ }
+}
+
+// Helper for commonly-used entries
+void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
+ std::vector<std::string> &items,
+ std::vector<std::string> &disabled_items, U32 flags)
+{
+ const LLInventoryObject *obj = getInventoryObject();
+ if (obj && obj->getIsLinkType())
+ {
+ items.push_back(std::string("Find Original"));
+ if (LLAssetType::lookupIsLinkType(obj->getType()))
+ {
+ disabled_items.push_back(std::string("Find Original"));
+ }
+ }
+ else
+ {
+ items.push_back(std::string("Rename"));
+ if (!isItemRenameable() || (flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Rename"));
+ }
+
+ if (show_asset_id)
+ {
+ items.push_back(std::string("Copy Asset UUID"));
+ if ( (! ( isItemPermissive() || gAgent.isGodlike() ) )
+ || (flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Copy Asset UUID"));
+ }
+ }
+ items.push_back(std::string("Copy Separator"));
+
+ items.push_back(std::string("Copy"));
+ if (!isItemCopyable())
+ {
+ disabled_items.push_back(std::string("Copy"));
+ }
+ }
+
+ items.push_back(std::string("Paste"));
+ if (!isClipboardPasteable() || (flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Paste"));
+ }
+
+ items.push_back(std::string("Paste As Link"));
+ if (!isClipboardPasteableAsLink() || (flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Paste As Link"));
+ }
+ items.push_back(std::string("Paste Separator"));
+
+ items.push_back(std::string("Delete"));
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Delete"));
+ }
+
+ // If multiple items are selected, disable properties (if it exists).
+ if ((flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Properties"));
+ }
+}
+
+void LLInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ lldebugs << "LLInvFVBridge::buildContextMenu()" << llendl;
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
+ if(isInTrash())
+ {
+ items.push_back(std::string("PurgeItem"));
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("PurgeItem"));
+ }
+ items.push_back(std::string("RestoreItem"));
+ }
+ else
+ {
+ items.push_back(std::string("Open"));
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+ }
+ hide_context_entries(menu, items, disabled_items);
+}
+
+// *TODO: remove this
+BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
+{
+ BOOL rv = FALSE;
+
+ const LLInventoryObject* obj = getInventoryObject();
+
+ if(obj)
+ {
+ *type = LLViewerAssetType::lookupDragAndDropType(obj->getActualType());
+ if(*type == DAD_NONE)
+ {
+ return FALSE;
+ }
+
+ *id = obj->getUUID();
+ //object_ids.put(obj->getUUID());
+
+ if (*type == DAD_CATEGORY)
+ {
+ gInventory.startBackgroundFetch(obj->getUUID());
+ }
+
+ rv = TRUE;
+ }
+
+ return rv;
+}
+
+LLInventoryObject* LLInvFVBridge::getInventoryObject() const
+{
+ LLInventoryObject* obj = NULL;
+ LLInventoryModel* model = getInventoryModel();
+ if(model)
+ {
+ obj = (LLInventoryObject*)model->getObject(mUUID);
+ }
+ return obj;
+}
+
+LLInventoryModel* LLInvFVBridge::getInventoryModel() const
+{
+ LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+ return panel ? panel->getModel() : NULL;
+}
+
+BOOL LLInvFVBridge::isInTrash() const
+{
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return FALSE;
+ const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ return model->isObjectDescendentOf(mUUID, trash_id);
+}
+
+BOOL LLInvFVBridge::isLinkedObjectInTrash() const
+{
+ if (isInTrash()) return TRUE;
+
+ const LLInventoryObject *obj = getInventoryObject();
+ if (obj && obj->getIsLinkType())
+ {
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return FALSE;
+ const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ return model->isObjectDescendentOf(obj->getLinkedUUID(), trash_id);
+ }
+ return FALSE;
+}
+
+BOOL LLInvFVBridge::isAgentInventory() const
+{
+ const LLInventoryModel* model = getInventoryModel();
+ if(!model) return FALSE;
+ if(gInventory.getRootFolderID() == mUUID) return TRUE;
+ return model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID());
+}
+
+BOOL LLInvFVBridge::isCOFFolder() const
+{
+ const LLInventoryModel* model = getInventoryModel();
+ if(!model) return TRUE;
+ const LLUUID cof_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+ if (mUUID == cof_id || model->isObjectDescendentOf(mUUID, cof_id))
+ {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL LLInvFVBridge::isItemPermissive() const
+{
+ return FALSE;
+}
+
+// static
+void LLInvFVBridge::changeItemParent(LLInventoryModel* model,
+ LLViewerInventoryItem* item,
+ const LLUUID& new_parent,
+ BOOL restamp)
+{
+ if(item->getParentUUID() != new_parent)
+ {
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate old_folder(item->getParentUUID(),-1);
+ update.push_back(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(new_parent, 1);
+ update.push_back(new_folder);
+ gInventory.accountForUpdate(update);
+
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->setParent(new_parent);
+ new_item->updateParentOnServer(restamp);
+ model->updateItem(new_item);
+ model->notifyObservers();
+ }
+}
+
+// static
+void LLInvFVBridge::changeCategoryParent(LLInventoryModel* model,
+ LLViewerInventoryCategory* cat,
+ const LLUUID& new_parent,
+ BOOL restamp)
+{
+ if(cat->getParentUUID() != new_parent)
+ {
+ LLInventoryModel::update_list_t update;
+ LLInventoryModel::LLCategoryUpdate old_folder(cat->getParentUUID(), -1);
+ update.push_back(old_folder);
+ LLInventoryModel::LLCategoryUpdate new_folder(new_parent, 1);
+ update.push_back(new_folder);
+ gInventory.accountForUpdate(update);
+
+ LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat);
+ new_cat->setParent(new_parent);
+ new_cat->updateParentOnServer(restamp);
+ model->updateCategory(new_cat);
+ model->notifyObservers();
+ }
+}
+
+
+const std::string safe_inv_type_lookup(LLInventoryType::EType inv_type)
+{
+ const std::string rv= LLInventoryType::lookup(inv_type);
+ if(rv.empty())
+ {
+ return std::string("<invalid>");
+ }
+ return rv;
+}
+
+LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
+ LLAssetType::EType actual_asset_type,
+ LLInventoryType::EType inv_type,
+ LLInventoryPanel* inventory,
+ const LLUUID& uuid,
+ U32 flags)
+{
+ LLInvFVBridge* new_listener = NULL;
+ switch(asset_type)
+ {
+ case LLAssetType::AT_TEXTURE:
+ if(!(inv_type == LLInventoryType::IT_TEXTURE || inv_type == LLInventoryType::IT_SNAPSHOT))
+ {
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ }
+ new_listener = new LLTextureBridge(inventory, uuid, inv_type);
+ break;
+
+ case LLAssetType::AT_SOUND:
+ if(!(inv_type == LLInventoryType::IT_SOUND))
+ {
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ }
+ new_listener = new LLSoundBridge(inventory, uuid);
+ break;
+
+ case LLAssetType::AT_LANDMARK:
+ if(!(inv_type == LLInventoryType::IT_LANDMARK))
+ {
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ }
+ new_listener = new LLLandmarkBridge(inventory, uuid, flags);
+ break;
+
+ case LLAssetType::AT_CALLINGCARD:
+ if(!(inv_type == LLInventoryType::IT_CALLINGCARD))
+ {
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ }
+ new_listener = new LLCallingCardBridge(inventory, uuid);
+ break;
+
+ case LLAssetType::AT_SCRIPT:
+ if(!(inv_type == LLInventoryType::IT_LSL))
+ {
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ }
+ new_listener = new LLScriptBridge(inventory, uuid);
+ break;
+
+ case LLAssetType::AT_OBJECT:
+ if(!(inv_type == LLInventoryType::IT_OBJECT || inv_type == LLInventoryType::IT_ATTACHMENT))
+ {
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ }
+ new_listener = new LLObjectBridge(inventory, uuid, inv_type, flags);
+ break;
+
+ case LLAssetType::AT_NOTECARD:
+ if(!(inv_type == LLInventoryType::IT_NOTECARD))
+ {
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ }
+ new_listener = new LLNotecardBridge(inventory, uuid);
+ break;
+
+ case LLAssetType::AT_ANIMATION:
+ if(!(inv_type == LLInventoryType::IT_ANIMATION))
+ {
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ }
+ new_listener = new LLAnimationBridge(inventory, uuid);
+ break;
+
+ case LLAssetType::AT_GESTURE:
+ if(!(inv_type == LLInventoryType::IT_GESTURE))
+ {
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ }
+ new_listener = new LLGestureBridge(inventory, uuid);
+ break;
+
+ case LLAssetType::AT_LSL_TEXT:
+ if(!(inv_type == LLInventoryType::IT_LSL))
+ {
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ }
+ new_listener = new LLLSLTextBridge(inventory, uuid);
+ break;
+
+ case LLAssetType::AT_CLOTHING:
+ case LLAssetType::AT_BODYPART:
+ if(!(inv_type == LLInventoryType::IT_WEARABLE))
+ {
+ llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+ }
+ new_listener = new LLWearableBridge(inventory, uuid, asset_type, inv_type, (EWearableType)flags);
+ break;
+ case LLAssetType::AT_CATEGORY:
+ if (actual_asset_type == LLAssetType::AT_LINK_FOLDER)
+ {
+ // Create a link folder handler instead.
+ new_listener = new LLLinkFolderBridge(inventory, uuid);
+ break;
+ }
+ new_listener = new LLFolderBridge(inventory, uuid);
+ break;
+ case LLAssetType::AT_LINK:
+ // Only should happen for broken links.
+ new_listener = new LLLinkItemBridge(inventory, uuid);
+ break;
+ case LLAssetType::AT_LINK_FOLDER:
+ // Only should happen for broken links.
+ new_listener = new LLLinkItemBridge(inventory, uuid);
+ break;
+ default:
+ llinfos << "Unhandled asset type (llassetstorage.h): "
+ << (S32)asset_type << llendl;
+ break;
+ }
+
+ if (new_listener)
+ {
+ new_listener->mInvType = inv_type;
+ }
+
+ return new_listener;
+}
+
+void LLInvFVBridge::purgeItem(LLInventoryModel *model, const LLUUID &uuid)
+{
+ LLInventoryCategory* cat = model->getCategory(uuid);
+ if (cat)
+ {
+ model->purgeDescendentsOf(uuid);
+ model->notifyObservers();
+ }
+ LLInventoryObject* obj = model->getObject(uuid);
+ if (obj)
+ {
+ model->purgeObject(uuid);
+ model->notifyObservers();
+ }
+}
+
+// +=================================================+
+// | InventoryFVBridgeBuilder |
+// +=================================================+
+LLInvFVBridge* LLInventoryFVBridgeBuilder::createBridge(LLAssetType::EType asset_type,
+ LLAssetType::EType actual_asset_type,
+ LLInventoryType::EType inv_type,
+ LLInventoryPanel* inventory,
+ const LLUUID& uuid,
+ U32 flags /* = 0x00 */) const
+{
+ return LLInvFVBridge::createBridge(asset_type,
+ actual_asset_type,
+ inv_type,
+ inventory,
+ uuid,
+ flags);
+}
+
+// +=================================================+
+// | LLItemBridge |
+// +=================================================+
+
+void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+{
+ if ("goto" == action)
+ {
+ gotoItem(folder);
+ }
+ if ("open" == action)
+ {
+ openItem();
+ return;
+ }
+ else if ("properties" == action)
+ {
+ showProperties();
+ return;
+ }
+ else if ("purge" == action)
+ {
+ purgeItem(model, mUUID);
+ return;
+ }
+ else if ("restoreToWorld" == action)
+ {
+ restoreToWorld();
+ return;
+ }
+ else if ("restore" == action)
+ {
+ restoreItem();
+ return;
+ }
+ else if ("copy_uuid" == action)
+ {
+ // Single item only
+ LLInventoryItem* item = model->getItem(mUUID);
+ if(!item) return;
+ LLUUID asset_id = item->getAssetUUID();
+ std::string buffer;
+ asset_id.toString(buffer);
+
+ gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(buffer));
+ return;
+ }
+ else if ("copy" == action)
+ {
+ copyToClipboard();
+ return;
+ }
+ else if ("paste" == action)
+ {
+ // Single item only
+ LLInventoryItem* itemp = model->getItem(mUUID);
+ if (!itemp) return;
+
+ LLFolderViewItem* folder_view_itemp = folder->getItemByID(itemp->getParentUUID());
+ if (!folder_view_itemp) return;
+
+ folder_view_itemp->getListener()->pasteFromClipboard();
+ return;
+ }
+ else if ("paste_link" == action)
+ {
+ // Single item only
+ LLInventoryItem* itemp = model->getItem(mUUID);
+ if (!itemp) return;
+
+ LLFolderViewItem* folder_view_itemp = folder->getItemByID(itemp->getParentUUID());
+ if (!folder_view_itemp) return;
+
+ folder_view_itemp->getListener()->pasteLinkFromClipboard();
+ return;
+ }
+}
+
+void LLItemBridge::selectItem()
+{
+ LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem();
+ if(item && !item->isComplete())
+ {
+ item->fetchFromServer();
+ }
+}
+
+void LLItemBridge::restoreItem()
+{
+ LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem();
+ if(item)
+ {
+ LLInventoryModel* model = getInventoryModel();
+ const LLUUID new_parent = model->findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(item->getType()));
+ // do not restamp on restore.
+ LLInvFVBridge::changeItemParent(model, item, new_parent, FALSE);
+ }
+}
+
+void LLItemBridge::restoreToWorld()
+{
+ LLViewerInventoryItem* itemp = (LLViewerInventoryItem*)getItem();
+ if (itemp)
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessage("RezRestoreToWorld");
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ itemp->packMessage(msg);
+ msg->sendReliable(gAgent.getRegion()->getHost());
+ }
+
+ //Similar functionality to the drag and drop rez logic
+ BOOL remove_from_inventory = FALSE;
+
+ //remove local inventory copy, sim will deal with permissions and removing the item
+ //from the actual inventory if its a no-copy etc
+ if(!itemp->getPermissions().allowCopyBy(gAgent.getID()))
+ {
+ remove_from_inventory = TRUE;
+ }
+
+ // Check if it's in the trash. (again similar to the normal rez logic)
+ const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ if(gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id))
+ {
+ remove_from_inventory = TRUE;
+ }
+
+ if(remove_from_inventory)
+ {
+ gInventory.deleteObject(itemp->getUUID());
+ gInventory.notifyObservers();
+ }
+}
+
+void LLItemBridge::gotoItem(LLFolderView *folder)
+{
+ LLInventoryObject *obj = getInventoryObject();
+ if (obj && obj->getIsLinkType())
+ {
+ LLInventoryPanel* active_panel = LLFloaterInventory::getActiveInventory()->getPanel();
+ if (active_panel)
+ {
+ active_panel->setSelection(obj->getLinkedUUID(), TAKE_FOCUS_NO);
+ }
+ }
+}
+
+LLUIImagePtr LLItemBridge::getIcon() const
+{
+ return LLUI::getUIImage(ICON_NAME[OBJECT_ICON_NAME]);
+}
+
+PermissionMask LLItemBridge::getPermissionMask() const
+{
+ LLViewerInventoryItem* item = getItem();
+ PermissionMask perm_mask = 0;
+ if(item)
+ {
+ BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
+ BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
+ BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
+ gAgent.getID());
+
+ if (copy) perm_mask |= PERM_COPY;
+ if (mod) perm_mask |= PERM_MODIFY;
+ if (xfer) perm_mask |= PERM_TRANSFER;
+
+ }
+ return perm_mask;
+}
+
+const std::string& LLItemBridge::getDisplayName() const
+{
+ if(mDisplayName.empty())
+ {
+ buildDisplayName(getItem(), mDisplayName);
+ }
+ return mDisplayName;
+}
+
+void LLItemBridge::buildDisplayName(LLInventoryItem* item, std::string& name)
+{
+ if(item)
+ {
+ name.assign(item->getName());
+ }
+ else
+ {
+ name.assign(LLStringUtil::null);
+ }
+}
+
+LLFontGL::StyleFlags LLItemBridge::getLabelStyle() const
+{
+ U8 font = LLFontGL::NORMAL;
+
+ if( gAgentWearables.isWearingItem( mUUID ) )
+ {
+ // llinfos << "BOLD" << llendl;
+ font |= LLFontGL::BOLD;
+ }
+
+ const LLViewerInventoryItem* item = getItem();
+ if (item && item->getIsLinkType())
+ {
+ font |= LLFontGL::ITALIC;
+ }
+ return (LLFontGL::StyleFlags)font;
+}
+
+std::string LLItemBridge::getLabelSuffix() const
+{
+ // String table is loaded before login screen and inventory items are
+ // loaded after login, so LLTrans should be ready.
+ static std::string NO_COPY =LLTrans::getString("no_copy");
+ static std::string NO_MOD = LLTrans::getString("no_modify");
+ static std::string NO_XFER = LLTrans::getString("no_transfer");
+ static std::string LINK = LLTrans::getString("link");
+ static std::string BROKEN_LINK = LLTrans::getString("broken_link");
+ std::string suffix;
+ LLInventoryItem* item = getItem();
+ if(item)
+ {
+ // it's a bit confusing to put nocopy/nomod/etc on calling cards.
+ if(LLAssetType::AT_CALLINGCARD != item->getType()
+ && item->getPermissions().getOwner() == gAgent.getID())
+ {
+ BOOL broken_link = LLAssetType::lookupIsLinkType(item->getType());
+ if (broken_link) return BROKEN_LINK;
+
+ BOOL link = item->getIsLinkType();
+ if (link) return LINK;
+
+ BOOL copy = item->getPermissions().allowCopyBy(gAgent.getID());
+ if (!copy)
+ {
+ suffix += NO_COPY;
+ }
+ BOOL mod = item->getPermissions().allowModifyBy(gAgent.getID());
+ if (!mod)
+ {
+ suffix += NO_MOD;
+ }
+ BOOL xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER,
+ gAgent.getID());
+ if (!xfer)
+ {
+ suffix += NO_XFER;
+ }
+ }
+ }
+ return suffix;
+}
+
+time_t LLItemBridge::getCreationDate() const
+{
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ return item->getCreationDate();
+ }
+ return 0;
+}
+
+
+BOOL LLItemBridge::isItemRenameable() const
+{
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ // (For now) Don't allow calling card rename since that may confuse users as to
+ // what the calling card points to.
+ if (item->getInventoryType() == LLInventoryType::IT_CALLINGCARD)
+ {
+ return FALSE;
+ }
+ return (item->getPermissions().allowModifyBy(gAgent.getID()));
+ }
+ return FALSE;
+}
+
+BOOL LLItemBridge::renameItem(const std::string& new_name)
+{
+ if(!isItemRenameable())
+ return FALSE;
+ LLPreview::dirty(mUUID);
+ LLInventoryModel* model = getInventoryModel();
+ if(!model)
+ return FALSE;
+ LLViewerInventoryItem* item = getItem();
+ if(item && (item->getName() != new_name))
+ {
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->rename(new_name);
+ buildDisplayName(new_item, mDisplayName);
+ new_item->updateServer(FALSE);
+ model->updateItem(new_item);
+
+ model->notifyObservers();
+ }
+ // return FALSE because we either notified observers (& therefore
+ // rebuilt) or we didn't update.
+ return FALSE;
+}
+
+
+BOOL LLItemBridge::removeItem()
+{
+ if(!isItemRemovable())
+ {
+ return FALSE;
+ }
+ // move it to the trash
+ LLPreview::hide(mUUID, TRUE);
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return FALSE;
+ const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ LLViewerInventoryItem* item = getItem();
+
+ // if item is not already in trash
+ if(item && !model->isObjectDescendentOf(mUUID, trash_id))
+ {
+ // move to trash, and restamp
+ LLInvFVBridge::changeItemParent(model, item, trash_id, TRUE);
+ // delete was successful
+ return TRUE;
+ }
+ else
+ {
+ // tried to delete already item in trash (should purge?)
+ return FALSE;
+ }
+}
+
+BOOL LLItemBridge::isItemCopyable() const
+{
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ // can't copy worn objects. DEV-15183
+ LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
+ if( !avatarp )
+ {
+ return FALSE;
+ }
+
+ if(avatarp->isWearingAttachment(mUUID))
+ {
+ return FALSE;
+ }
+
+ // All items can be copied, not all can be pasted.
+ // The only time an item can't be copied is if it's a link
+ // return (item->getPermissions().allowCopyBy(gAgent.getID()));
+ if (item->getIsLinkType())
+ {
+ return FALSE;
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+BOOL LLItemBridge::copyToClipboard() const
+{
+ if(isItemCopyable())
+ {
+ LLInventoryClipboard::instance().add(mUUID);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+LLViewerInventoryItem* LLItemBridge::getItem() const
+{
+ LLViewerInventoryItem* item = NULL;
+ LLInventoryModel* model = getInventoryModel();
+ if(model)
+ {
+ item = (LLViewerInventoryItem*)model->getItem(mUUID);
+ }
+ return item;
+}
+
+BOOL LLItemBridge::isItemPermissive() const
+{
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ U32 mask = item->getPermissions().getMaskBase();
+ if((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED)
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+// +=================================================+
+// | LLFolderBridge |
+// +=================================================+
+
+LLFolderBridge* LLFolderBridge::sSelf=NULL;
+
+// Can be moved to another folder
+BOOL LLFolderBridge::isItemMovable() const
+{
+ LLInventoryObject* obj = getInventoryObject();
+ if(obj)
+ {
+ return (!LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)obj)->getPreferredType()));
+ }
+ return FALSE;
+}
+
+void LLFolderBridge::selectItem()
+{
+}
+
+
+// Iterate through a folder's children to determine if
+// all the children are removable.
+class LLIsItemRemovable : public LLFolderViewFunctor
+{
+public:
+ LLIsItemRemovable() : mPassed(TRUE) {}
+ virtual void doFolder(LLFolderViewFolder* folder)
+ {
+ mPassed &= folder->getListener()->isItemRemovable();
+ }
+ virtual void doItem(LLFolderViewItem* item)
+ {
+ mPassed &= item->getListener()->isItemRemovable();
+ }
+ BOOL mPassed;
+};
+
+// Can be destroyed (or moved to trash)
+BOOL LLFolderBridge::isItemRemovable()
+{
+ LLInventoryModel* model = getInventoryModel();
+ if(!model)
+ {
+ return FALSE;
+ }
+
+ if(!model->isObjectDescendentOf(mUUID, gInventory.getRootFolderID()))
+ {
+ return FALSE;
+ }
+
+ LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
+ if( !avatar )
+ {
+ return FALSE;
+ }
+
+ LLInventoryCategory* category = model->getCategory(mUUID);
+ if( !category )
+ {
+ return FALSE;
+ }
+ // Allow protected types to be removed, but issue a warning.
+ /*
+ if(LLFolderType::lookupIsProtectedType(category->getPreferredType()))
+ {
+ return FALSE;
+ }
+ */
+
+ LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+ LLFolderViewFolder* folderp = dynamic_cast<LLFolderViewFolder*>(panel ? panel->getRootFolder()->getItemByID(mUUID) : NULL);
+ if (folderp)
+ {
+ LLIsItemRemovable folder_test;
+ folderp->applyFunctorToChildren(folder_test);
+ if (!folder_test.mPassed)
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+BOOL LLFolderBridge::isUpToDate() const
+{
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return FALSE;
+ LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID);
+ if( !category )
+ {
+ return FALSE;
+ }
+
+ return category->getVersion() != LLViewerInventoryCategory::VERSION_UNKNOWN;
+}
+
+BOOL LLFolderBridge::isItemCopyable() const
+{
+ return TRUE;
+}
+
+BOOL LLFolderBridge::copyToClipboard() const
+{
+ if(isItemCopyable())
+ {
+ LLInventoryClipboard::instance().add(mUUID);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+BOOL LLFolderBridge::isClipboardPasteable() const
+{
+ if ( ! LLInvFVBridge::isClipboardPasteable() )
+ return FALSE;
+
+ // Don't allow pasting duplicates to the Calling Card/Friends subfolders, see bug EXT-1599
+ if ( LLFriendCardsManager::instance().isCategoryInFriendFolder( getCategory() ) )
+ {
+ LLInventoryModel* model = getInventoryModel();
+ if ( !model )
+ {
+ return FALSE;
+ }
+
+ LLDynamicArray<LLUUID> objects;
+ LLInventoryClipboard::instance().retrieve(objects);
+ const LLViewerInventoryCategory *current_cat = getCategory();
+
+ // Search for the direct descendent of current Friends subfolder among all pasted items,
+ // and return false if is found.
+ for(S32 i = objects.count() - 1; i >= 0; --i)
+ {
+ const LLUUID &obj_id = objects.get(i);
+ if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) )
+ {
+ return FALSE;
+ }
+ }
+
+ }
+ return TRUE;
+}
+
+BOOL LLFolderBridge::isClipboardPasteableAsLink() const
+{
+ // Check normal paste-as-link permissions
+ if (!LLInvFVBridge::isClipboardPasteableAsLink())
+ {
+ return FALSE;
+ }
+
+ const LLInventoryModel* model = getInventoryModel();
+ if (!model)
+ {
+ return FALSE;
+ }
+
+ const LLViewerInventoryCategory *current_cat = getCategory();
+ if (current_cat)
+ {
+ const BOOL is_in_friend_folder = LLFriendCardsManager::instance().isCategoryInFriendFolder( current_cat );
+ const LLUUID ¤t_cat_id = current_cat->getUUID();
+ LLDynamicArray<LLUUID> objects;
+ LLInventoryClipboard::instance().retrieve(objects);
+ S32 count = objects.count();
+ for(S32 i = 0; i < count; i++)
+ {
+ const LLUUID &obj_id = objects.get(i);
+ const LLInventoryCategory *cat = model->getCategory(obj_id);
+ if (cat)
+ {
+ const LLUUID &cat_id = cat->getUUID();
+ // Don't allow recursive pasting
+ if ((cat_id == current_cat_id) ||
+ model->isObjectDescendentOf(current_cat_id, cat_id))
+ {
+ return FALSE;
+ }
+ }
+ // Don't allow pasting duplicates to the Calling Card/Friends subfolders, see bug EXT-1599
+ if ( is_in_friend_folder )
+ {
+ // If object is direct descendent of current Friends subfolder than return false.
+ // Note: We can't use 'const LLInventoryCategory *cat', because it may be null
+ // in case type of obj_id is LLInventoryItem.
+ if ( LLFriendCardsManager::instance().isObjDirectDescendentOfCategory(model->getObject(obj_id), current_cat) )
+ {
+ return FALSE;
+ }
+ }
+ }
+ }
+ return TRUE;
+
+}
+
+BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
+ BOOL drop)
+{
+ // This should never happen, but if an inventory item is incorrectly parented,
+ // the UI will get confused and pass in a NULL.
+ if(!inv_cat) return FALSE;
+
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return FALSE;
+
+ LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
+ if(!avatar) return FALSE;
+
+ // cannot drag categories into library
+ if(!isAgentInventory())
+ {
+ return FALSE;
+ }
+
+ // check to make sure source is agent inventory, and is represented there.
+ LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
+ BOOL is_agent_inventory = (model->getCategory(inv_cat->getUUID()) != NULL)
+ && (LLToolDragAndDrop::SOURCE_AGENT == source);
+
+ BOOL accept = FALSE;
+ S32 i;
+ LLInventoryModel::cat_array_t descendent_categories;
+ LLInventoryModel::item_array_t descendent_items;
+ if(is_agent_inventory)
+ {
+ const LLUUID& cat_id = inv_cat->getUUID();
+
+ // Is the destination the trash?
+ const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ BOOL move_is_into_trash = (mUUID == trash_id)
+ || model->isObjectDescendentOf(mUUID, trash_id);
+ BOOL is_movable = (!LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType()));
+ const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+ BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
+ BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
+ if (move_is_into_current_outfit || move_is_into_outfit)
+ {
+ // BAP - restrictions?
+ is_movable = true;
+ }
+
+ if (mUUID == gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE))
+ {
+ is_movable = FALSE; // It's generally movable but not into Favorites folder. EXT-1604
+ }
+
+ if( is_movable )
+ {
+ gInventory.collectDescendents( cat_id, descendent_categories, descendent_items, FALSE );
+
+ for( i = 0; i < descendent_categories.count(); i++ )
+ {
+ LLInventoryCategory* category = descendent_categories[i];
+ if(LLFolderType::lookupIsProtectedType(category->getPreferredType()))
+ {
+ // ...can't move "special folders" like Textures
+ is_movable = FALSE;
+ break;
+ }
+ }
+
+ if( is_movable )
+ {
+ if( move_is_into_trash )
+ {
+ for( i = 0; i < descendent_items.count(); i++ )
+ {
+ LLInventoryItem* item = descendent_items[i];
+ if( (item->getType() == LLAssetType::AT_CLOTHING) ||
+ (item->getType() == LLAssetType::AT_BODYPART) )
+ {
+ if( gAgentWearables.isWearingItem( item->getUUID() ) )
+ {
+ is_movable = FALSE; // It's generally movable, but not into the trash!
+ break;
+ }
+ }
+ else
+ if( item->getType() == LLAssetType::AT_OBJECT )
+ {
+ if( avatar->isWearingAttachment( item->getUUID() ) )
+ {
+ is_movable = FALSE; // It's generally movable, but not into the trash!
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ accept = is_movable
+ && (mUUID != cat_id) // Can't move a folder into itself
+ && (mUUID != inv_cat->getParentUUID()) // Avoid moves that would change nothing
+ && !(model->isObjectDescendentOf(mUUID, cat_id)); // Avoid circularity
+ if(accept && drop)
+ {
+ // Look for any gestures and deactivate them
+ if (move_is_into_trash)
+ {
+ for (i = 0; i < descendent_items.count(); i++)
+ {
+ LLInventoryItem* item = descendent_items[i];
+ if (item->getType() == LLAssetType::AT_GESTURE
+ && LLGestureManager::instance().isGestureActive(item->getUUID()))
+ {
+ LLGestureManager::instance().deactivateGesture(item->getUUID());
+ }
+ }
+ }
+ // if target is an outfit or current outfit folder we use link
+ if (move_is_into_current_outfit || move_is_into_outfit)
+ {
+ if (inv_cat->getPreferredType() == LLFolderType::FT_NONE)
+ {
+ if (move_is_into_current_outfit)
+ {
+ // traverse category and add all contents to currently worn.
+ BOOL append = true;
+ LLAppearanceManager::instance().wearInventoryCategory(inv_cat, false, append);
+ }
+ else
+ {
+ // Recursively create links in target outfit.
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ gInventory.collectDescendents(inv_cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH);
+ LLAppearanceManager::instance().linkAll(mUUID,items,NULL);
+ }
+ }
+ else
+ {
+#if SUPPORT_ENSEMBLES
+ // BAP - should skip if dup.
+ if (move_is_into_current_outfit)
+ {
+ LLAppearanceManager::instance().addEnsembleLink(inv_cat);
+ }
+ else
+ {
+ LLPointer<LLInventoryCallback> cb = NULL;
+ link_inventory_item(
+ gAgent.getID(),
+ inv_cat->getUUID(),
+ mUUID,
+ inv_cat->getName(),
+ LLAssetType::AT_LINK_FOLDER,
+ cb);
+ }
+#endif
+ }
+ }
+ else
+ {
+
+ // Reparent the folder and restamp children if it's moving
+ // into trash.
+ LLInvFVBridge::changeCategoryParent(
+ model,
+ (LLViewerInventoryCategory*)inv_cat,
+ mUUID,
+ move_is_into_trash);
+ }
+ }
+ }
+ else if(LLToolDragAndDrop::SOURCE_WORLD == source)
+ {
+ // content category has same ID as object itself
+ LLUUID object_id = inv_cat->getUUID();
+ LLUUID category_id = mUUID;
+ accept = move_inv_category_world_to_agent(object_id, category_id, drop);
+ }
+ return accept;
+}
+
+void warn_move_inventory(LLViewerObject* object, LLMoveInv* move_inv)
+{
+ const char* dialog = NULL;
+ if (object->flagScripted())
+ {
+ dialog = "MoveInventoryFromScriptedObject";
+ }
+ else
+ {
+ dialog = "MoveInventoryFromObject";
+ }
+ LLNotifications::instance().add(dialog, LLSD(), LLSD(), boost::bind(move_task_inventory_callback, _1, _2, move_inv));
+}
+
+// Move/copy all inventory items from the Contents folder of an in-world
+// object to the agent's inventory, inside a given category.
+BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
+ const LLUUID& category_id,
+ BOOL drop,
+ void (*callback)(S32, void*),
+ void* user_data)
+{
+ // Make sure the object exists. If we allowed dragging from
+ // anonymous objects, it would be possible to bypass
+ // permissions.
+ // content category has same ID as object itself
+ LLViewerObject* object = gObjectList.findObject(object_id);
+ if(!object)
+ {
+ llinfos << "Object not found for drop." << llendl;
+ return FALSE;
+ }
+
+ // this folder is coming from an object, as there is only one folder in an object, the root,
+ // we need to collect the entire contents and handle them as a group
+ InventoryObjectList inventory_objects;
+ object->getInventoryContents(inventory_objects);
+
+ if (inventory_objects.empty())
+ {
+ llinfos << "Object contents not found for drop." << llendl;
+ return FALSE;
+ }
+
+ BOOL accept = TRUE;
+ BOOL is_move = FALSE;
+
+ // coming from a task. Need to figure out if the person can
+ // move/copy this item.
+ InventoryObjectList::iterator it = inventory_objects.begin();
+ InventoryObjectList::iterator end = inventory_objects.end();
+ for ( ; it != end; ++it)
+ {
+ // coming from a task. Need to figure out if the person can
+ // move/copy this item.
+ LLPermissions perm(((LLInventoryItem*)((LLInventoryObject*)(*it)))->getPermissions());
+ if((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
+ && perm.allowTransferTo(gAgent.getID())))
+// || gAgent.isGodlike())
+ {
+ accept = TRUE;
+ }
+ else if(object->permYouOwner())
+ {
+ // If the object cannot be copied, but the object the
+ // inventory is owned by the agent, then the item can be
+ // moved from the task to agent inventory.
+ is_move = TRUE;
+ accept = TRUE;
+ }
+ else
+ {
+ accept = FALSE;
+ break;
+ }
+ }
+
+ if(drop && accept)
+ {
+ it = inventory_objects.begin();
+ InventoryObjectList::iterator first_it = inventory_objects.begin();
+ LLMoveInv* move_inv = new LLMoveInv;
+ move_inv->mObjectID = object_id;
+ move_inv->mCategoryID = category_id;
+ move_inv->mCallback = callback;
+ move_inv->mUserData = user_data;
+
+ for ( ; it != end; ++it)
+ {
+ two_uuids_t two(category_id, (*it)->getUUID());
+ move_inv->mMoveList.push_back(two);
+ }
+
+ if(is_move)
+ {
+ // Callback called from within here.
+ warn_move_inventory(object, move_inv);
+ }
+ else
+ {
+ LLNotification::Params params("MoveInventoryFromObject");
+ params.functor.function(boost::bind(move_task_inventory_callback, _1, _2, move_inv));
+ LLNotifications::instance().forceResponse(params, 0);
+ }
+ }
+ return accept;
+}
+
+bool LLFindCOFValidItems::operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item)
+{
+ // Valid COF items are:
+ // - links to wearables (body parts or clothing)
+ // - links to attachments
+ // - links to gestures
+ // - links to ensemble folders
+ LLViewerInventoryItem *linked_item = ((LLViewerInventoryItem*)item)->getLinkedItem(); // BAP - safe?
+ if (linked_item)
+ {
+ LLAssetType::EType type = linked_item->getType();
+ return (type == LLAssetType::AT_CLOTHING ||
+ type == LLAssetType::AT_BODYPART ||
+ type == LLAssetType::AT_GESTURE ||
+ type == LLAssetType::AT_OBJECT);
+ }
+ else
+ {
+ LLViewerInventoryCategory *linked_category = ((LLViewerInventoryItem*)item)->getLinkedCategory(); // BAP - safe?
+ // BAP remove AT_NONE support after ensembles are fully working?
+ return (linked_category &&
+ ((linked_category->getPreferredType() == LLFolderType::FT_NONE) ||
+ (LLFolderType::lookupIsEnsembleType(linked_category->getPreferredType()))));
+ }
+}
+
+
+bool LLFindWearables::operator()(LLInventoryCategory* cat,
+ LLInventoryItem* item)
+{
+ if(item)
+ {
+ if((item->getType() == LLAssetType::AT_CLOTHING)
+ || (item->getType() == LLAssetType::AT_BODYPART))
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+
+
+//Used by LLFolderBridge as callback for directory recursion.
+class LLRightClickInventoryFetchObserver : public LLInventoryFetchObserver
+{
+public:
+ LLRightClickInventoryFetchObserver() :
+ mCopyItems(false)
+ { };
+ LLRightClickInventoryFetchObserver(const LLUUID& cat_id, bool copy_items) :
+ mCatID(cat_id),
+ mCopyItems(copy_items)
+ { };
+ virtual void done()
+ {
+ // we've downloaded all the items, so repaint the dialog
+ LLFolderBridge::staticFolderOptionsMenu();
+
+ gInventory.removeObserver(this);
+ delete this;
+ }
+
+
+protected:
+ LLUUID mCatID;
+ bool mCopyItems;
+
+};
+
+//Used by LLFolderBridge as callback for directory recursion.
+class LLRightClickInventoryFetchDescendentsObserver : public LLInventoryFetchDescendentsObserver
+{
+public:
+ LLRightClickInventoryFetchDescendentsObserver(bool copy_items) : mCopyItems(copy_items) {}
+ ~LLRightClickInventoryFetchDescendentsObserver() {}
+ virtual void done();
+protected:
+ bool mCopyItems;
+};
+
+void LLRightClickInventoryFetchDescendentsObserver::done()
+{
+ // Avoid passing a NULL-ref as mCompleteFolders.front() down to
+ // gInventory.collectDescendents()
+ if( mCompleteFolders.empty() )
+ {
+ llwarns << "LLRightClickInventoryFetchDescendentsObserver::done with empty mCompleteFolders" << llendl;
+ dec_busy_count();
+ gInventory.removeObserver(this);
+ delete this;
+ return;
+ }
+
+ // What we do here is get the complete information on the items in
+ // the library, and set up an observer that will wait for that to
+ // happen.
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ gInventory.collectDescendents(mCompleteFolders.front(),
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH);
+ S32 count = item_array.count();
+#if 0 // HACK/TODO: Why?
+ // This early causes a giant menu to get produced, and doesn't seem to be needed.
+ if(!count)
+ {
+ llwarns << "Nothing fetched in category " << mCompleteFolders.front()
+ << llendl;
+ dec_busy_count();
+ gInventory.removeObserver(this);
+ delete this;
+ return;
+ }
+#endif
+
+ LLRightClickInventoryFetchObserver* outfit;
+ outfit = new LLRightClickInventoryFetchObserver(mCompleteFolders.front(), mCopyItems);
+ LLInventoryFetchObserver::item_ref_t ids;
+ for(S32 i = 0; i < count; ++i)
+ {
+ ids.push_back(item_array.get(i)->getUUID());
+ }
+
+ // clean up, and remove this as an observer since the call to the
+ // outfit could notify observers and throw us into an infinite
+ // loop.
+ dec_busy_count();
+ gInventory.removeObserver(this);
+ delete this;
+
+ // increment busy count and either tell the inventory to check &
+ // call done, or add this object to the inventory for observation.
+ inc_busy_count();
+
+ // do the fetch
+ outfit->fetchItems(ids);
+ outfit->done(); //Not interested in waiting and this will be right 99% of the time.
+//Uncomment the following code for laggy Inventory UI.
+/* if(outfit->isEverythingComplete())
+ {
+ // everything is already here - call done.
+ outfit->done();
+ }
+ else
+ {
+ // it's all on it's way - add an observer, and the inventory
+ // will call done for us when everything is here.
+ gInventory.addObserver(outfit);
+ }*/
+}
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLInventoryWearObserver
+//
+// Observer for "copy and wear" operation to support knowing
+// when the all of the contents have been added to inventory.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+class LLInventoryCopyAndWearObserver : public LLInventoryObserver
+{
+public:
+ LLInventoryCopyAndWearObserver(const LLUUID& cat_id, int count) :mCatID(cat_id), mContentsCount(count), mFolderAdded(FALSE) {}
+ virtual ~LLInventoryCopyAndWearObserver() {}
+ virtual void changed(U32 mask);
+
+protected:
+ LLUUID mCatID;
+ int mContentsCount;
+ BOOL mFolderAdded;
+};
+
+
+
+void LLInventoryCopyAndWearObserver::changed(U32 mask)
+{
+ if((mask & (LLInventoryObserver::ADD)) != 0)
+ {
+ if (!mFolderAdded)
+ {
+ const std::set<LLUUID>& changed_items = gInventory.getChangedIDs();
+
+ std::set<LLUUID>::const_iterator id_it = changed_items.begin();
+ std::set<LLUUID>::const_iterator id_end = changed_items.end();
+ for (;id_it != id_end; ++id_it)
+ {
+ if ((*id_it) == mCatID)
+ {
+ mFolderAdded = TRUE;
+ break;
+ }
+ }
+ }
+
+ if (mFolderAdded)
+ {
+ LLViewerInventoryCategory* category = gInventory.getCategory(mCatID);
+
+ if (NULL == category)
+ {
+ llwarns << "gInventory.getCategory(" << mCatID
+ << ") was NULL" << llendl;
+ }
+ else
+ {
+ if (category->getDescendentCount() ==
+ mContentsCount)
+ {
+ gInventory.removeObserver(this);
+ LLAppearanceManager::instance().wearInventoryCategory(category, FALSE, TRUE);
+ delete this;
+ }
+ }
+ }
+
+ }
+}
+
+
+
+void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+{
+ if ("open" == action)
+ {
+ openItem();
+ return;
+ }
+ else if ("paste" == action)
+ {
+ pasteFromClipboard();
+ return;
+ }
+ else if ("paste_link" == action)
+ {
+ pasteLinkFromClipboard();
+ return;
+ }
+ else if ("properties" == action)
+ {
+ showProperties();
+ return;
+ }
+ else if ("replaceoutfit" == action)
+ {
+ modifyOutfit(FALSE);
+ return;
+ }
+#if SUPPORT_ENSEMBLES
+ else if ("wearasensemble" == action)
+ {
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return;
+ LLViewerInventoryCategory* cat = getCategory();
+ if(!cat) return;
+ LLAppearanceManager::instance().addEnsembleLink(cat,true);
+ return;
+ }
+#endif
+ else if ("addtooutfit" == action)
+ {
+ modifyOutfit(TRUE);
+ return;
+ }
+ else if ("copy" == action)
+ {
+ copyToClipboard();
+ return;
+ }
+ else if ("removefromoutfit" == action)
+ {
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return;
+ LLViewerInventoryCategory* cat = getCategory();
+ if(!cat) return;
+
+ remove_inventory_category_from_avatar ( cat );
+ return;
+ }
+ else if ("purge" == action)
+ {
+ purgeItem(model, mUUID);
+ return;
+ }
+ else if ("restore" == action)
+ {
+ restoreItem();
+ return;
+ }
+}
+
+void LLFolderBridge::openItem()
+{
+ lldebugs << "LLFolderBridge::openItem()" << llendl;
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return;
+ if(mUUID.isNull()) return;
+ bool fetching_inventory = model->fetchDescendentsOf(mUUID);
+ // Only change folder type if we have the folder contents.
+ if (!fetching_inventory)
+ {
+ // Disabling this for now, it's causing crash when new items are added to folders
+ // since folder type may change before new item item has finished processing.
+ // determineFolderType();
+ }
+}
+
+void LLFolderBridge::closeItem()
+{
+ determineFolderType();
+}
+
+void LLFolderBridge::determineFolderType()
+{
+ if (isUpToDate())
+ {
+ LLInventoryModel* model = getInventoryModel();
+ LLViewerInventoryCategory* category = model->getCategory(mUUID);
+ category->determineFolderType();
+ }
+}
+
+BOOL LLFolderBridge::isItemRenameable() const
+{
+ LLViewerInventoryCategory* cat = (LLViewerInventoryCategory*)getCategory();
+ if(cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType())
+ && (cat->getOwnerID() == gAgent.getID()))
+ {
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void LLFolderBridge::restoreItem()
+{
+ LLViewerInventoryCategory* cat;
+ cat = (LLViewerInventoryCategory*)getCategory();
+ if(cat)
+ {
+ LLInventoryModel* model = getInventoryModel();
+ const LLUUID new_parent = model->findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(cat->getType()));
+ // do not restamp children on restore
+ LLInvFVBridge::changeCategoryParent(model, cat, new_parent, FALSE);
+ }
+}
+
+LLFolderType::EType LLFolderBridge::getPreferredType() const
+{
+ LLFolderType::EType preferred_type = LLFolderType::FT_NONE;
+ LLViewerInventoryCategory* cat = getCategory();
+ if(cat)
+ {
+ preferred_type = cat->getPreferredType();
+ }
+
+ return preferred_type;
+}
+
+// Icons for folders are based on the preferred type
+LLUIImagePtr LLFolderBridge::getIcon() const
+{
+ LLFolderType::EType preferred_type = LLFolderType::FT_NONE;
+ LLViewerInventoryCategory* cat = getCategory();
+ if(cat)
+ {
+ preferred_type = cat->getPreferredType();
+ }
+ return getIcon(preferred_type);
+}
+
+LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type)
+{
+ // we only have one folder image now
+ return LLUI::getUIImage("Inv_FolderClosed");
+}
+
+BOOL LLFolderBridge::renameItem(const std::string& new_name)
+{
+ if(!isItemRenameable())
+ return FALSE;
+ LLInventoryModel* model = getInventoryModel();
+ if(!model)
+ return FALSE;
+ LLViewerInventoryCategory* cat = getCategory();
+ if(cat && (cat->getName() != new_name))
+ {
+ LLPointer<LLViewerInventoryCategory> new_cat = new LLViewerInventoryCategory(cat);
+ new_cat->rename(new_name);
+ new_cat->updateServer(FALSE);
+ model->updateCategory(new_cat);
+
+ model->notifyObservers();
+ }
+ // return FALSE because we either notified observers (& therefore
+ // rebuilt) or we didn't update.
+ return FALSE;
+}
+
+BOOL LLFolderBridge::removeItem()
+{
+ if(!isItemRemovable())
+ {
+ return FALSE;
+ }
+ const LLViewerInventoryCategory *cat = getCategory();
+
+ LLSD payload;
+ LLSD args;
+ args["FOLDERNAME"] = cat->getName();
+
+ LLNotification::Params params("ConfirmDeleteProtectedCategory");
+ params.payload(payload).substitutions(args).functor.function(boost::bind(&LLFolderBridge::removeItemResponse, this, _1, _2));
+ //params.functor.function(boost::bind(&LLFolderBridge::removeItemResponse, this, _1, _2));
+ /*
+ LLNotification::Params params("ChangeLindenEstate");
+ params.functor.function(boost::bind(&LLPanelEstateInfo::callbackChangeLindenEstate, this, _1, _2));
+ */
+ if (LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
+ {
+ LLNotifications::instance().add(params);
+ }
+ else
+ {
+ LLNotifications::instance().forceResponse(params, 0);
+ }
+ return TRUE;
+}
+
+bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotification::getSelectedOption(notification, response);
+
+ // if they choose delete, do it. Otherwise, don't do anything
+ if(option == 0)
+ {
+ // move it to the trash
+ LLPreview::hide(mUUID);
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return FALSE;
+
+ const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+
+ // Look for any gestures and deactivate them
+ LLInventoryModel::cat_array_t descendent_categories;
+ LLInventoryModel::item_array_t descendent_items;
+ gInventory.collectDescendents( mUUID, descendent_categories, descendent_items, FALSE );
+
+ S32 i;
+ for (i = 0; i < descendent_items.count(); i++)
+ {
+ LLInventoryItem* item = descendent_items[i];
+ if (item->getType() == LLAssetType::AT_GESTURE
+ && LLGestureManager::instance().isGestureActive(item->getUUID()))
+ {
+ LLGestureManager::instance().deactivateGesture(item->getUUID());
+ }
+ }
+
+ // go ahead and do the normal remove if no 'last calling
+ // cards' are being removed.
+ LLViewerInventoryCategory* cat = getCategory();
+ if(cat)
+ {
+ LLInvFVBridge::changeCategoryParent(model, cat, trash_id, TRUE);
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void LLFolderBridge::pasteFromClipboard()
+{
+ LLInventoryModel* model = getInventoryModel();
+ if(model && isClipboardPasteable())
+ {
+ LLInventoryItem* item = NULL;
+ LLDynamicArray<LLUUID> objects;
+ LLInventoryClipboard::instance().retrieve(objects);
+ S32 count = objects.count();
+ const LLUUID parent_id(mUUID);
+ for(S32 i = 0; i < count; i++)
+ {
+ item = model->getItem(objects.get(i));
+ if (item)
+ {
+ if(LLInventoryClipboard::instance().isCutMode())
+ {
+ // move_inventory_item() is not enough,
+ //we have to update inventory locally too
+ changeItemParent(model, dynamic_cast<LLViewerInventoryItem*>(item), parent_id, FALSE);
+ }
+ else
+ {
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ parent_id,
+ std::string(),
+ LLPointer<LLInventoryCallback>(NULL));
+ }
+ }
+ }
+ }
+}
+
+void LLFolderBridge::pasteLinkFromClipboard()
+{
+ const LLInventoryModel* model = getInventoryModel();
+ if(model)
+ {
+ LLDynamicArray<LLUUID> objects;
+ LLInventoryClipboard::instance().retrieve(objects);
+ S32 count = objects.count();
+ LLUUID parent_id(mUUID);
+ for(S32 i = 0; i < count; i++)
+ {
+ const LLUUID &object_id = objects.get(i);
+#if SUPPORT_ENSEMBLES
+ if (LLInventoryCategory *cat = model->getCategory(object_id))
+ {
+ link_inventory_item(
+ gAgent.getID(),
+ cat->getUUID(),
+ parent_id,
+ cat->getName(),
+ LLAssetType::AT_LINK_FOLDER,
+ LLPointer<LLInventoryCallback>(NULL));
+ }
+ else
+#endif
+ if (LLInventoryItem *item = model->getItem(object_id))
+ {
+ link_inventory_item(
+ gAgent.getID(),
+ item->getLinkedUUID(),
+ parent_id,
+ item->getName(),
+ LLAssetType::AT_LINK,
+ LLPointer<LLInventoryCallback>(NULL));
+ }
+ }
+ }
+}
+
+void LLFolderBridge::staticFolderOptionsMenu()
+{
+ if (!sSelf) return;
+ sSelf->folderOptionsMenu();
+}
+
+bool isInOutfitsSidePanel(LLPanel *panel)
+{
+ LLInventoryPanel *my_panel = dynamic_cast<LLInventoryPanel*>(panel);
+ LLPanelOutfitsInventory *outfit_panel =
+ dynamic_cast<LLPanelOutfitsInventory*>(LLSideTray::getInstance()->getPanel("panel_outfits_inventory"));
+ if (!outfit_panel)
+ return false;
+ return outfit_panel->isAccordionPanel(my_panel);
+
+ //LLInventoryPanel *outfit_inv_panel = outfit_panel ? outfit_panel->getActivePanel(): NULL;
+ //return (my_panel && (my_panel == outfit_inv_panel));
+}
+
+void LLFolderBridge::folderOptionsMenu()
+{
+ std::vector<std::string> disabled_items;
+
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return;
+
+ const LLInventoryCategory* category = model->getCategory(mUUID);
+ LLFolderType::EType type = category->getPreferredType();
+ const bool is_default_folder = category && LLFolderType::lookupIsProtectedType(type);
+ // BAP change once we're no longer treating regular categories as ensembles.
+ const bool is_ensemble = category && (type == LLFolderType::FT_NONE ||
+ LLFolderType::lookupIsEnsembleType(type));
+ const bool is_sidepanel = isInOutfitsSidePanel(mInventoryPanel.get());
+
+ // calling card related functionality for folders.
+
+ if (is_sidepanel)
+ {
+ mItems.clear();
+ }
+
+ // Only enable calling-card related options for non-default folders.
+ if (!is_sidepanel && !is_default_folder)
+ {
+ LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
+ if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard))
+ {
+ mItems.push_back(std::string("Calling Card Separator"));
+ mItems.push_back(std::string("Conference Chat Folder"));
+ mItems.push_back(std::string("IM All Contacts In Folder"));
+ }
+ }
+
+ // wearables related functionality for folders.
+ //is_wearable
+ LLFindWearables is_wearable;
+ LLIsType is_object( LLAssetType::AT_OBJECT );
+ LLIsType is_gesture( LLAssetType::AT_GESTURE );
+
+ if (mWearables ||
+ checkFolderForContentsOfType(model, is_wearable) ||
+ checkFolderForContentsOfType(model, is_object) ||
+ checkFolderForContentsOfType(model, is_gesture) )
+ {
+ mItems.push_back(std::string("Folder Wearables Separator"));
+
+ // Only enable add/replace outfit for non-default folders.
+ if (!is_default_folder)
+ {
+ mItems.push_back(std::string("Add To Outfit"));
+ mItems.push_back(std::string("Replace Outfit"));
+ }
+ if (is_ensemble)
+ {
+ mItems.push_back(std::string("Wear As Ensemble"));
+ }
+ mItems.push_back(std::string("Remove From Outfit"));
+ }
+ hide_context_entries(*mMenu, mItems, disabled_items);
+
+ // Reposition the menu, in case we're adding items to an existing menu.
+ mMenu->needsArrange();
+ mMenu->arrangeAndClear();
+}
+
+BOOL LLFolderBridge::checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& is_type)
+{
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ model->collectDescendentsIf(mUUID,
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_type);
+ return ((item_array.count() > 0) ? TRUE : FALSE );
+}
+
+// Flags unused
+void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ mItems.clear();
+ mDisabledItems.clear();
+
+ lldebugs << "LLFolderBridge::buildContextMenu()" << llendl;
+// std::vector<std::string> disabled_items;
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return;
+ const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ const LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
+
+ mItems.clear(); //adding code to clear out member Items (which means Items should not have other data here at this point)
+ mDisabledItems.clear(); //adding code to clear out disabled members from previous
+ if (lost_and_found_id == mUUID)
+ {
+ // This is the lost+found folder.
+ mItems.push_back(std::string("Empty Lost And Found"));
+ }
+
+ if(trash_id == mUUID)
+ {
+ // This is the trash.
+ mItems.push_back(std::string("Empty Trash"));
+ }
+ else if(model->isObjectDescendentOf(mUUID, trash_id))
+ {
+ // This is a folder in the trash.
+ mItems.clear(); // clear any items that used to exist
+ mItems.push_back(std::string("Purge Item"));
+ if (!isItemRemovable())
+ {
+ mDisabledItems.push_back(std::string("Purge Item"));
+ }
+
+ mItems.push_back(std::string("Restore Item"));
+ }
+ else if(isAgentInventory()) // do not allow creating in library
+ {
+ LLViewerInventoryCategory *cat = getCategory();
+ // BAP removed protected check to re-enable standard ops in untyped folders.
+ // Not sure what the right thing is to do here.
+ if (!isCOFFolder() && cat /*&&
+ LLAssetType::lookupIsProtectedCategoryType(cat->getPreferredType())*/)
+ {
+ // Do not allow to create 2-level subfolder in the Calling Card/Friends folder. EXT-694.
+ if (!LLFriendCardsManager::instance().isCategoryInFriendFolder(cat))
+ mItems.push_back(std::string("New Folder"));
+ mItems.push_back(std::string("New Script"));
+ mItems.push_back(std::string("New Note"));
+ mItems.push_back(std::string("New Gesture"));
+ mItems.push_back(std::string("New Clothes"));
+ mItems.push_back(std::string("New Body Parts"));
+ mItems.push_back(std::string("Change Type"));
+
+ LLViewerInventoryCategory *cat = getCategory();
+ if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
+ {
+ mDisabledItems.push_back(std::string("Change Type"));
+ }
+
+ getClipboardEntries(false, mItems, mDisabledItems, flags);
+ }
+ else
+ {
+ // Want some but not all of the items from getClipboardEntries for outfits.
+ if (cat && cat->getPreferredType()==LLFolderType::FT_OUTFIT)
+ {
+ mItems.push_back(std::string("Rename"));
+ mItems.push_back(std::string("Delete"));
+ }
+ }
+
+ //Added by spatters to force inventory pull on right-click to display folder options correctly. 07-17-06
+ mCallingCards = mWearables = FALSE;
+
+ LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
+ if (checkFolderForContentsOfType(model, is_callingcard))
+ {
+ mCallingCards=TRUE;
+ }
+
+ LLFindWearables is_wearable;
+ LLIsType is_object( LLAssetType::AT_OBJECT );
+ LLIsType is_gesture( LLAssetType::AT_GESTURE );
+
+ if (checkFolderForContentsOfType(model, is_wearable) ||
+ checkFolderForContentsOfType(model, is_object) ||
+ checkFolderForContentsOfType(model, is_gesture) )
+ {
+ mWearables=TRUE;
+ }
+
+ mMenu = &menu;
+ sSelf = this;
+ LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(FALSE);
+
+ LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+ LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID);
+ if (category)
+ {
+ folders.push_back(category->getUUID());
+ }
+ fetch->fetchDescendents(folders);
+ inc_busy_count();
+ if(fetch->isEverythingComplete())
+ {
+ // everything is already here - call done.
+ fetch->done();
+ }
+ else
+ {
+ // it's all on it's way - add an observer, and the inventory
+ // will call done for us when everything is here.
+ gInventory.addObserver(fetch);
+ }
+ }
+ else
+ {
+ mItems.push_back(std::string("--no options--"));
+ mDisabledItems.push_back(std::string("--no options--"));
+ }
+ hide_context_entries(menu, mItems, mDisabledItems);
+}
+
+BOOL LLFolderBridge::hasChildren() const
+{
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return FALSE;
+ LLInventoryModel::EHasChildren has_children;
+ has_children = gInventory.categoryHasChildren(mUUID);
+ return has_children != LLInventoryModel::CHILDREN_NO;
+}
+
+BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data)
+{
+ //llinfos << "LLFolderBridge::dragOrDrop()" << llendl;
+ BOOL accept = FALSE;
+ switch(cargo_type)
+ {
+ case DAD_TEXTURE:
+ case DAD_SOUND:
+ case DAD_CALLINGCARD:
+ case DAD_LANDMARK:
+ case DAD_SCRIPT:
+ case DAD_OBJECT:
+ case DAD_NOTECARD:
+ case DAD_CLOTHING:
+ case DAD_BODYPART:
+ case DAD_ANIMATION:
+ case DAD_GESTURE:
+ case DAD_LINK:
+ accept = dragItemIntoFolder((LLInventoryItem*)cargo_data,
+ drop);
+ break;
+ case DAD_CATEGORY:
+ if (LLFriendCardsManager::instance().isAnyFriendCategory(mUUID))
+ {
+ accept = FALSE;
+ }
+ else
+ {
+ accept = dragCategoryIntoFolder((LLInventoryCategory*)cargo_data, drop);
+ }
+ break;
+ default:
+ break;
+ }
+ return accept;
+}
+
+LLViewerInventoryCategory* LLFolderBridge::getCategory() const
+{
+ LLViewerInventoryCategory* cat = NULL;
+ LLInventoryModel* model = getInventoryModel();
+ if(model)
+ {
+ cat = (LLViewerInventoryCategory*)model->getCategory(mUUID);
+ }
+ return cat;
+}
+
+
+// static
+void LLFolderBridge::pasteClipboard(void* user_data)
+{
+ LLFolderBridge* self = (LLFolderBridge*)user_data;
+ if(self) self->pasteFromClipboard();
+}
+
+void LLFolderBridge::createNewCategory(void* user_data)
+{
+ LLFolderBridge* bridge = (LLFolderBridge*)user_data;
+ if(!bridge) return;
+ LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(bridge->mInventoryPanel.get());
+ if (!panel) return;
+ LLInventoryModel* model = panel->getModel();
+ if(!model) return;
+ LLUUID id;
+ id = model->createNewCategory(bridge->getUUID(),
+ LLFolderType::FT_NONE,
+ LLStringUtil::null);
+ model->notifyObservers();
+
+ // At this point, the bridge has probably been deleted, but the
+ // view is still there.
+ panel->setSelection(id, TAKE_FOCUS_YES);
+}
+
+void LLFolderBridge::createNewShirt(void* user_data)
+{
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHIRT);
+}
+
+void LLFolderBridge::createNewPants(void* user_data)
+{
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_PANTS);
+}
+
+void LLFolderBridge::createNewShoes(void* user_data)
+{
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHOES);
+}
+
+void LLFolderBridge::createNewSocks(void* user_data)
+{
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SOCKS);
+}
+
+void LLFolderBridge::createNewJacket(void* user_data)
+{
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_JACKET);
+}
+
+void LLFolderBridge::createNewSkirt(void* user_data)
+{
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SKIRT);
+}
+
+void LLFolderBridge::createNewGloves(void* user_data)
+{
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_GLOVES);
+}
+
+void LLFolderBridge::createNewUndershirt(void* user_data)
+{
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_UNDERSHIRT);
+}
+
+void LLFolderBridge::createNewUnderpants(void* user_data)
+{
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_UNDERPANTS);
+}
+
+void LLFolderBridge::createNewShape(void* user_data)
+{
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SHAPE);
+}
+
+void LLFolderBridge::createNewSkin(void* user_data)
+{
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_SKIN);
+}
+
+void LLFolderBridge::createNewHair(void* user_data)
+{
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_HAIR);
+}
+
+void LLFolderBridge::createNewEyes(void* user_data)
+{
+ LLFolderBridge::createWearable((LLFolderBridge*)user_data, WT_EYES);
+}
+
+// static
+void LLFolderBridge::createWearable(LLFolderBridge* bridge, EWearableType type)
+{
+ if(!bridge) return;
+ LLUUID parent_id = bridge->getUUID();
+ createWearable(parent_id, type);
+}
+
+// Separate function so can be called by global menu as well as right-click
+// menu.
+// static
+void LLFolderBridge::createWearable(const LLUUID &parent_id, EWearableType type)
+{
+ LLWearable* wearable = LLWearableList::instance().createNewWearable(type);
+ LLAssetType::EType asset_type = wearable->getAssetType();
+ LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE;
+ create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
+ parent_id, wearable->getTransactionID(), wearable->getName(),
+ wearable->getDescription(), asset_type, inv_type, wearable->getType(),
+ wearable->getPermissions().getMaskNextOwner(),
+ LLPointer<LLInventoryCallback>(NULL));
+}
+
+void LLFolderBridge::modifyOutfit(BOOL append)
+{
+ LLInventoryModel* model = getInventoryModel();
+ if(!model) return;
+ LLViewerInventoryCategory* cat = getCategory();
+ if(!cat) return;
+
+ // BAP - was:
+ // wear_inventory_category_on_avatar( cat, append );
+ LLAppearanceManager::instance().wearInventoryCategory( cat, FALSE, append );
+}
+
+// helper stuff
+bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, LLMoveInv* move_inv)
+{
+ LLFloaterOpenObject::LLCatAndWear* cat_and_wear = (LLFloaterOpenObject::LLCatAndWear* )move_inv->mUserData;
+ LLViewerObject* object = gObjectList.findObject(move_inv->mObjectID);
+ S32 option = LLNotification::getSelectedOption(notification, response);
+
+ if(option == 0 && object)
+ {
+ if (cat_and_wear && cat_and_wear->mWear)
+ {
+ InventoryObjectList inventory_objects;
+ object->getInventoryContents(inventory_objects);
+ int contents_count = inventory_objects.size()-1; //subtract one for containing folder
+
+ LLInventoryCopyAndWearObserver* inventoryObserver = new LLInventoryCopyAndWearObserver(cat_and_wear->mCatID, contents_count);
+ gInventory.addObserver(inventoryObserver);
+ }
+
+ two_uuids_list_t::iterator move_it;
+ for (move_it = move_inv->mMoveList.begin();
+ move_it != move_inv->mMoveList.end();
+ ++move_it)
+ {
+ object->moveInventory(move_it->first, move_it->second);
+ }
+
+ // update the UI.
+ dialog_refresh_all();
+ }
+
+ if (move_inv->mCallback)
+ {
+ move_inv->mCallback(option, move_inv->mUserData);
+ }
+
+ delete move_inv;
+ return false;
+}
+
+/*
+Next functions intended to reorder items in the inventory folder and save order on server
+Is now used for Favorites folder.
+
+*TODO: refactoring is needed with Favorites Bar functionality. Probably should be moved in LLInventoryModel
+*/
+void saveItemsOrder(LLInventoryModel::item_array_t& items)
+{
+ int sortField = 0;
+
+ // current order is saved by setting incremental values (1, 2, 3, ...) for the sort field
+ for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
+ {
+ LLViewerInventoryItem* item = *i;
+
+ item->setSortField(++sortField);
+ item->setComplete(TRUE);
+ item->updateServer(FALSE);
+
+ gInventory.updateItem(item);
+ }
+
+ gInventory.notifyObservers();
+}
+
+LLInventoryModel::item_array_t::iterator findItemByUUID(LLInventoryModel::item_array_t& items, const LLUUID& id)
+{
+ LLInventoryModel::item_array_t::iterator result = items.end();
+
+ for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
+ {
+ if ((*i)->getUUID() == id)
+ {
+ result = i;
+ break;
+ }
+ }
+
+ return result;
+}
+
+void updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& srcItemId, const LLUUID& destItemId)
+{
+ LLViewerInventoryItem* srcItem = gInventory.getItem(srcItemId);
+ LLViewerInventoryItem* destItem = gInventory.getItem(destItemId);
+
+ items.erase(findItemByUUID(items, srcItem->getUUID()));
+ items.insert(findItemByUUID(items, destItem->getUUID()), srcItem);
+}
+
+BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
+ BOOL drop)
+{
+ LLInventoryModel* model = getInventoryModel();
+ if(!model || !inv_item) return FALSE;
+
+ // cannot drag into library
+ if(!isAgentInventory())
+ {
+ return FALSE;
+ }
+
+ LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
+ if(!avatar) return FALSE;
+
+ LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
+ BOOL accept = FALSE;
+ LLViewerObject* object = NULL;
+ if(LLToolDragAndDrop::SOURCE_AGENT == source)
+ {
+
+ BOOL is_movable = TRUE;
+ switch( inv_item->getActualType() )
+ {
+ case LLAssetType::AT_CATEGORY:
+ is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType());
+ break;
+ default:
+ break;
+ }
+
+ const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id);
+ const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
+ BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
+ BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
+
+ if(is_movable && move_is_into_trash)
+ {
+ switch(inv_item->getType())
+ {
+ case LLAssetType::AT_CLOTHING:
+ case LLAssetType::AT_BODYPART:
+ is_movable = !gAgentWearables.isWearingItem(inv_item->getUUID());
+ break;
+
+ case LLAssetType::AT_OBJECT:
+ is_movable = !avatar->isWearingAttachment(inv_item->getUUID());
+ break;
+ default:
+ break;
+ }
+ }
+
+ if ( is_movable )
+ {
+ // Don't allow creating duplicates in the Calling Card/Friends
+ // subfolders, see bug EXT-1599. Check is item direct descendent
+ // of target folder and forbid item's movement if it so.
+ // Note: isItemDirectDescendentOfCategory checks if
+ // passed category is in the Calling Card/Friends folder
+ is_movable = ! LLFriendCardsManager::instance()
+ .isObjDirectDescendentOfCategory (inv_item, getCategory());
+ }
+
+ const LLUUID& favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+ const LLUUID& landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
+ const BOOL folder_allows_reorder = ((mUUID == landmarks_id) || (mUUID == favorites_id));
+
+ // we can move item inside a folder only if this folder is Favorites. See EXT-719
+ accept = is_movable && ((mUUID != inv_item->getParentUUID()) || folder_allows_reorder);
+ if(accept && drop)
+ {
+ if (inv_item->getType() == LLAssetType::AT_GESTURE
+ && LLGestureManager::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash)
+ {
+ LLGestureManager::instance().deactivateGesture(inv_item->getUUID());
+ }
+ // If an item is being dragged between windows, unselect
+ // everything in the active window so that we don't follow
+ // the selection to its new location (which is very
+ // annoying).
+ if (LLFloaterInventory::getActiveInventory())
+ {
+ LLInventoryPanel* active_panel = LLFloaterInventory::getActiveInventory()->getPanel();
+ LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+ if (active_panel && (panel != active_panel))
+ {
+ active_panel->unSelectAll();
+ }
+ }
+
+ // if dragging from/into favorites folder only reorder items
+ if ((mUUID == inv_item->getParentUUID()) && folder_allows_reorder)
+ {
+ LLInventoryModel::cat_array_t cats;
+ LLInventoryModel::item_array_t items;
+ LLIsType is_type(LLAssetType::AT_LANDMARK);
+ model->collectDescendentsIf(mUUID, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
+
+ LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+ LLFolderViewItem* itemp = panel ? panel->getRootFolder()->getDraggingOverItem() : NULL;
+ if (itemp)
+ {
+ LLUUID srcItemId = inv_item->getUUID();
+ LLUUID destItemId = itemp->getListener()->getUUID();
+
+ // update order
+ updateItemsOrder(items, srcItemId, destItemId);
+
+ saveItemsOrder(items);
+ }
+ }
+ else if (favorites_id == mUUID) // if target is the favorites folder we use copy
+ {
+ copy_inventory_item(
+ gAgent.getID(),
+ inv_item->getPermissions().getOwner(),
+ inv_item->getUUID(),
+ mUUID,
+ std::string(),
+ LLPointer<LLInventoryCallback>(NULL));
+ }
+ else if (move_is_into_current_outfit || move_is_into_outfit)
+ {
+ // BAP - should skip if dup.
+ if (move_is_into_current_outfit)
+ {
+ LLAppearanceManager::instance().addCOFItemLink(inv_item);
+ }
+ else
+ {
+ LLPointer<LLInventoryCallback> cb = NULL;
+ link_inventory_item(
+ gAgent.getID(),
+ inv_item->getLinkedUUID(),
+ mUUID,
+ inv_item->getName(),
+ LLAssetType::AT_LINK,
+ cb);
+ }
+ }
+ else
+ {
+ // restamp if the move is into the trash.
+ LLInvFVBridge::changeItemParent(
+ model,
+ (LLViewerInventoryItem*)inv_item,
+ mUUID,
+ move_is_into_trash);
+ }
+ }
+ }
+ else if(LLToolDragAndDrop::SOURCE_WORLD == source)
+ {
+ // Make sure the object exists. If we allowed dragging from
+ // anonymous objects, it would be possible to bypass
+ // permissions.
+ object = gObjectList.findObject(inv_item->getParentUUID());
+ if(!object)
+ {
+ llinfos << "Object not found for drop." << llendl;
+ return FALSE;
+ }
+
+ // coming from a task. Need to figure out if the person can
+ // move/copy this item.
+ LLPermissions perm(inv_item->getPermissions());
+ BOOL is_move = FALSE;
+ if((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID())
+ && perm.allowTransferTo(gAgent.getID())))
+// || gAgent.isGodlike())
+
+ {
+ accept = TRUE;
+ }
+ else if(object->permYouOwner())
+ {
+ // If the object cannot be copied, but the object the
+ // inventory is owned by the agent, then the item can be
+ // moved from the task to agent inventory.
+ is_move = TRUE;
+ accept = TRUE;
+ }
+ if(drop && accept)
+ {
+ LLMoveInv* move_inv = new LLMoveInv;
+ move_inv->mObjectID = inv_item->getParentUUID();
+ two_uuids_t item_pair(mUUID, inv_item->getUUID());
+ move_inv->mMoveList.push_back(item_pair);
+ move_inv->mCallback = NULL;
+ move_inv->mUserData = NULL;
+ if(is_move)
+ {
+ warn_move_inventory(object, move_inv);
+ }
+ else
+ {
+ LLNotification::Params params("MoveInventoryFromObject");
+ params.functor.function(boost::bind(move_task_inventory_callback, _1, _2, move_inv));
+ LLNotifications::instance().forceResponse(params, 0);
+ }
+ }
+
+ }
+ else if(LLToolDragAndDrop::SOURCE_NOTECARD == source)
+ {
+ accept = TRUE;
+ if(drop)
+ {
+ copy_inventory_from_notecard(LLToolDragAndDrop::getInstance()->getObjectID(),
+ LLToolDragAndDrop::getInstance()->getSourceID(), inv_item);
+ }
+ }
+ else if(LLToolDragAndDrop::SOURCE_LIBRARY == source)
+ {
+ LLViewerInventoryItem* item = (LLViewerInventoryItem*)inv_item;
+ if(item && item->isComplete())
+ {
+ accept = TRUE;
+ if(drop)
+ {
+ copy_inventory_item(
+ gAgent.getID(),
+ inv_item->getPermissions().getOwner(),
+ inv_item->getUUID(),
+ mUUID,
+ std::string(),
+ LLPointer<LLInventoryCallback>(NULL));
+ }
+ }
+ }
+ else
+ {
+ llwarns << "unhandled drag source" << llendl;
+ }
+ return accept;
+}
+
+// +=================================================+
+// | LLScriptBridge (DEPRECTED) |
+// +=================================================+
+
+LLUIImagePtr LLScriptBridge::getIcon() const
+{
+ return get_item_icon(LLAssetType::AT_SCRIPT, LLInventoryType::IT_LSL, 0, FALSE);
+}
+
+// +=================================================+
+// | LLTextureBridge |
+// +=================================================+
+
+LLUIImagePtr LLTextureBridge::getIcon() const
+{
+ return get_item_icon(LLAssetType::AT_TEXTURE, mInvType, 0, FALSE);
+}
+
+void LLTextureBridge::openItem()
+{
+ LLViewerInventoryItem* item = getItem();
+
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
+}
+
+void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ lldebugs << "LLTextureBridge::buildContextMenu()" << llendl;
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
+ if(isInTrash())
+ {
+ items.push_back(std::string("Purge Item"));
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Purge Item"));
+ }
+
+ items.push_back(std::string("Restore Item"));
+ }
+ else
+ {
+ items.push_back(std::string("Open"));
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+
+ items.push_back(std::string("Texture Separator"));
+ items.push_back(std::string("Save As"));
+ }
+ hide_context_entries(menu, items, disabled_items);
+}
+
+// virtual
+void LLTextureBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+{
+ if ("save_as" == action)
+ {
+ LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES);
+ LLPreviewTexture* preview_texture = LLFloaterReg::findTypedInstance<LLPreviewTexture>("preview_texture", mUUID);
+ if (preview_texture)
+ {
+ preview_texture->openToSave();
+ }
+ }
+ else LLItemBridge::performAction(folder, model, action);
+}
+
+// +=================================================+
+// | LLSoundBridge |
+// +=================================================+
+
+LLUIImagePtr LLSoundBridge::getIcon() const
+{
+ return get_item_icon(LLAssetType::AT_SOUND, LLInventoryType::IT_SOUND, 0, FALSE);
+}
+
+void LLSoundBridge::openItem()
+{
+ LLViewerInventoryItem* item = getItem();
+
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
+/*
+// Changed this back to the way it USED to work:
+// only open the preview dialog through the contextual right-click menu
+// double-click just plays the sound
+
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ openSoundPreview((void*)this);
+ //send_uuid_sound_trigger(item->getAssetUUID(), 1.0);
+ }
+*/
+}
+
+void LLSoundBridge::previewItem()
+{
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ send_sound_trigger(item->getAssetUUID(), 1.0);
+ }
+}
+
+void LLSoundBridge::openSoundPreview(void* which)
+{
+ LLSoundBridge *me = (LLSoundBridge *)which;
+ LLFloaterReg::showInstance("preview_sound", LLSD(me->mUUID), TAKE_FOCUS_YES);
+}
+
+void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ lldebugs << "LLSoundBridge::buildContextMenu()" << llendl;
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
+
+ if(isInTrash())
+ {
+ items.push_back(std::string("Purge Item"));
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Purge Item"));
+ }
+
+ items.push_back(std::string("Restore Item"));
+ }
+ else
+ {
+ items.push_back(std::string("Sound Open"));
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+ }
+
+ items.push_back(std::string("Sound Separator"));
+ items.push_back(std::string("Sound Play"));
+
+ hide_context_entries(menu, items, disabled_items);
+}
+
+// +=================================================+
+// | LLLandmarkBridge |
+// +=================================================+
+
+LLLandmarkBridge::LLLandmarkBridge(LLInventoryPanel* inventory, const LLUUID& uuid, U32 flags/* = 0x00*/) :
+LLItemBridge(inventory, uuid)
+{
+ mVisited = FALSE;
+ if (flags & LLInventoryItem::II_FLAGS_LANDMARK_VISITED)
+ {
+ mVisited = TRUE;
+ }
+}
+
+LLUIImagePtr LLLandmarkBridge::getIcon() const
+{
+ return get_item_icon(LLAssetType::AT_LANDMARK, LLInventoryType::IT_LANDMARK, mVisited, FALSE);
+}
+
+void LLLandmarkBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
+
+ lldebugs << "LLLandmarkBridge::buildContextMenu()" << llendl;
+ if(isInTrash())
+ {
+ items.push_back(std::string("Purge Item"));
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Purge Item"));
+ }
+
+ items.push_back(std::string("Restore Item"));
+ }
+ else
+ {
+ items.push_back(std::string("Landmark Open"));
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+ }
+
+ items.push_back(std::string("Landmark Separator"));
+ items.push_back(std::string("About Landmark"));
+
+ // Disable "About Landmark" menu item for
+ // multiple landmarks selected. Only one landmark
+ // info panel can be shown at a time.
+ if ((flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("About Landmark"));
+ }
+
+ hide_context_entries(menu, items, disabled_items);
+}
+
+// Convenience function for the two functions below.
+void teleport_via_landmark(const LLUUID& asset_id)
+{
+ gAgent.teleportViaLandmark( asset_id );
+
+ // we now automatically track the landmark you're teleporting to
+ // because you'll probably arrive at a telehub instead
+ LLFloaterWorldMap* floater_world_map = LLFloaterWorldMap::getInstance();
+ if( floater_world_map )
+ {
+ floater_world_map->trackLandmark( asset_id );
+ }
+}
+
+// virtual
+void LLLandmarkBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+{
+ if ("teleport" == action)
+ {
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ teleport_via_landmark(item->getAssetUUID());
+ }
+ }
+ else if ("about" == action)
+ {
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ LLSD key;
+ key["type"] = "landmark";
+ key["id"] = item->getUUID();
+
+ LLSideTray::getInstance()->showPanel("panel_places", key);
+ }
+ }
+ else
+ {
+ LLItemBridge::performAction(folder, model, action);
+ }
+}
+
+static bool open_landmark_callback(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotification::getSelectedOption(notification, response);
+
+ LLUUID asset_id = notification["payload"]["asset_id"].asUUID();
+ if (option == 0)
+ {
+ teleport_via_landmark(asset_id);
+ }
+
+ return false;
+}
+static LLNotificationFunctorRegistration open_landmark_callback_reg("TeleportFromLandmark", open_landmark_callback);
+
+
+void LLLandmarkBridge::openItem()
+{
+ LLViewerInventoryItem* item = getItem();
+
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
+/*
+ LLViewerInventoryItem* item = getItem();
+ if( item )
+ {
+ // Opening (double-clicking) a landmark immediately teleports,
+ // but warns you the first time.
+ // open_landmark(item);
+ LLSD payload;
+ payload["asset_id"] = item->getAssetUUID();
+ LLNotifications::instance().add("TeleportFromLandmark", LLSD(), payload);
+ }
+*/
+}
+
+
+// +=================================================+
+// | LLCallingCardObserver |
+// +=================================================+
+void LLCallingCardObserver::changed(U32 mask)
+{
+ mBridgep->refreshFolderViewItem();
+}
+
+// +=================================================+
+// | LLCallingCardBridge |
+// +=================================================+
+
+LLCallingCardBridge::LLCallingCardBridge( LLInventoryPanel* inventory, const LLUUID& uuid ) :
+ LLItemBridge(inventory, uuid)
+{
+ mObserver = new LLCallingCardObserver(this);
+ LLAvatarTracker::instance().addObserver(mObserver);
+}
+
+LLCallingCardBridge::~LLCallingCardBridge()
+{
+ LLAvatarTracker::instance().removeObserver(mObserver);
+ delete mObserver;
+}
+
+void LLCallingCardBridge::refreshFolderViewItem()
+{
+ LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+ LLFolderViewItem* itemp = panel ? panel->getRootFolder()->getItemByID(mUUID) : NULL;
+ if (itemp)
+ {
+ itemp->refresh();
+ }
+}
+
+// virtual
+void LLCallingCardBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+{
+ if ("begin_im" == action)
+ {
+ LLViewerInventoryItem *item = getItem();
+ if (item && (item->getCreatorUUID() != gAgent.getID()) &&
+ (!item->getCreatorUUID().isNull()))
+ {
+ std::string callingcard_name;
+ gCacheName->getFullName(item->getCreatorUUID(), callingcard_name);
+ LLUUID session_id = gIMMgr->addSession(callingcard_name, IM_NOTHING_SPECIAL, item->getCreatorUUID());
+ if (session_id != LLUUID::null)
+ {
+ LLIMFloater::show(session_id);
+ }
+ }
+ }
+ else if ("lure" == action)
+ {
+ LLViewerInventoryItem *item = getItem();
+ if (item && (item->getCreatorUUID() != gAgent.getID()) &&
+ (!item->getCreatorUUID().isNull()))
+ {
+ LLAvatarActions::offerTeleport(item->getCreatorUUID());
+ }
+ }
+ else LLItemBridge::performAction(folder, model, action);
+}
+
+LLUIImagePtr LLCallingCardBridge::getIcon() const
+{
+ BOOL online = FALSE;
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ online = LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID());
+ }
+ return get_item_icon(LLAssetType::AT_CALLINGCARD, LLInventoryType::IT_CALLINGCARD, online, FALSE);
+}
+
+std::string LLCallingCardBridge::getLabelSuffix() const
+{
+ LLViewerInventoryItem* item = getItem();
+ if( item && LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()) )
+ {
+ return LLItemBridge::getLabelSuffix() + " (online)";
+ }
+ else
+ {
+ return LLItemBridge::getLabelSuffix();
+ }
+}
+
+void LLCallingCardBridge::openItem()
+{
+ LLViewerInventoryItem* item = getItem();
+
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
+/*
+ LLViewerInventoryItem* item = getItem();
+ if(item && !item->getCreatorUUID().isNull())
+ {
+ LLAvatarActions::showProfile(item->getCreatorUUID());
+ }
+*/
+}
+
+void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ lldebugs << "LLCallingCardBridge::buildContextMenu()" << llendl;
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
+
+ if(isInTrash())
+ {
+ items.push_back(std::string("Purge Item"));
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Purge Item"));
+ }
+
+ items.push_back(std::string("Restore Item"));
+ }
+ else
+ {
+ items.push_back(std::string("Open"));
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+
+ LLInventoryItem* item = getItem();
+ BOOL good_card = (item
+ && (LLUUID::null != item->getCreatorUUID())
+ && (item->getCreatorUUID() != gAgent.getID()));
+ BOOL user_online = (LLAvatarTracker::instance().isBuddyOnline(item->getCreatorUUID()));
+ items.push_back(std::string("Send Instant Message Separator"));
+ items.push_back(std::string("Send Instant Message"));
+ items.push_back(std::string("Offer Teleport..."));
+ items.push_back(std::string("Conference Chat"));
+
+ if (!good_card)
+ {
+ disabled_items.push_back(std::string("Send Instant Message"));
+ }
+ if (!good_card || !user_online)
+ {
+ disabled_items.push_back(std::string("Offer Teleport..."));
+ disabled_items.push_back(std::string("Conference Chat"));
+ }
+ }
+ hide_context_entries(menu, items, disabled_items);
+}
+
+BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
+ EDragAndDropType cargo_type,
+ void* cargo_data)
+{
+ LLViewerInventoryItem* item = getItem();
+ BOOL rv = FALSE;
+ if(item)
+ {
+ // check the type
+ switch(cargo_type)
+ {
+ case DAD_TEXTURE:
+ case DAD_SOUND:
+ case DAD_LANDMARK:
+ case DAD_SCRIPT:
+ case DAD_CLOTHING:
+ case DAD_OBJECT:
+ case DAD_NOTECARD:
+ case DAD_BODYPART:
+ case DAD_ANIMATION:
+ case DAD_GESTURE:
+ {
+ LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;
+ const LLPermissions& perm = inv_item->getPermissions();
+ if(gInventory.getItem(inv_item->getUUID())
+ && perm.allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+ {
+ rv = TRUE;
+ if(drop)
+ {
+ LLToolDragAndDrop::giveInventory(item->getCreatorUUID(),
+ (LLInventoryItem*)cargo_data);
+ }
+ }
+ else
+ {
+ // It's not in the user's inventory (it's probably in
+ // an object's contents), so disallow dragging it here.
+ // You can't give something you don't yet have.
+ rv = FALSE;
+ }
+ break;
+ }
+ case DAD_CATEGORY:
+ {
+ LLInventoryCategory* inv_cat = (LLInventoryCategory*)cargo_data;
+ if( gInventory.getCategory( inv_cat->getUUID() ) )
+ {
+ rv = TRUE;
+ if(drop)
+ {
+ LLToolDragAndDrop::giveInventoryCategory(
+ item->getCreatorUUID(),
+ inv_cat);
+ }
+ }
+ else
+ {
+ // It's not in the user's inventory (it's probably in
+ // an object's contents), so disallow dragging it here.
+ // You can't give something you don't yet have.
+ rv = FALSE;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ return rv;
+}
+
+BOOL LLCallingCardBridge::removeItem()
+{
+ if (LLFriendCardsManager::instance().isItemInAnyFriendsList(getItem()))
+ {
+ LLAvatarActions::removeFriendDialog(getItem()->getCreatorUUID());
+ return FALSE;
+ }
+ else
+ {
+ return LLItemBridge::removeItem();
+ }
+}
+// +=================================================+
+// | LLNotecardBridge |
+// +=================================================+
+
+LLUIImagePtr LLNotecardBridge::getIcon() const
+{
+ return get_item_icon(LLAssetType::AT_NOTECARD, LLInventoryType::IT_NOTECARD, 0, FALSE);
+}
+
+void LLNotecardBridge::openItem()
+{
+ LLViewerInventoryItem* item = getItem();
+
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
+
+/*
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES);
+ }
+*/
+}
+
+
+// +=================================================+
+// | LLGestureBridge |
+// +=================================================+
+
+LLUIImagePtr LLGestureBridge::getIcon() const
+{
+ return get_item_icon(LLAssetType::AT_GESTURE, LLInventoryType::IT_GESTURE, 0, FALSE);
+}
+
+LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const
+{
+ if( LLGestureManager::instance().isGestureActive(mUUID) )
+ {
+ return LLFontGL::BOLD;
+ }
+ else
+ {
+ return LLFontGL::NORMAL;
+ }
+}
+
+std::string LLGestureBridge::getLabelSuffix() const
+{
+ if( LLGestureManager::instance().isGestureActive(mUUID) )
+ {
+ return LLItemBridge::getLabelSuffix() + " (active)";
+ }
+ else
+ {
+ return LLItemBridge::getLabelSuffix();
+ }
+}
+
+// virtual
+void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+{
+ if ("activate" == action)
+ {
+ LLGestureManager::instance().activateGesture(mUUID);
+
+ LLViewerInventoryItem* item = gInventory.getItem(mUUID);
+ if (!item) return;
+
+ // Since we just changed the suffix to indicate (active)
+ // the server doesn't need to know, just the viewer.
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+ }
+ else if ("deactivate" == action)
+ {
+ LLGestureManager::instance().deactivateGesture(mUUID);
+
+ LLViewerInventoryItem* item = gInventory.getItem(mUUID);
+ if (!item) return;
+
+ // Since we just changed the suffix to indicate (active)
+ // the server doesn't need to know, just the viewer.
+ gInventory.updateItem(item);
+ gInventory.notifyObservers();
+ }
+ else LLItemBridge::performAction(folder, model, action);
+}
+
+void LLGestureBridge::openItem()
+{
+ LLViewerInventoryItem* item = getItem();
+
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
+/*
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null);
+ preview->setFocus(TRUE);
+ }
+*/
+}
+
+BOOL LLGestureBridge::removeItem()
+{
+ // Force close the preview window, if it exists
+ LLGestureManager::instance().deactivateGesture(mUUID);
+ return LLItemBridge::removeItem();
+}
+
+void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ lldebugs << "LLGestureBridge::buildContextMenu()" << llendl;
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
+ if(isInTrash())
+ {
+ items.push_back(std::string("Purge Item"));
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Purge Item"));
+ }
+
+ items.push_back(std::string("Restore Item"));
+ }
+ else
+ {
+ items.push_back(std::string("Open"));
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+
+ items.push_back(std::string("Gesture Separator"));
+ items.push_back(std::string("Activate"));
+ items.push_back(std::string("Deactivate"));
+ }
+ hide_context_entries(menu, items, disabled_items);
+}
+
+// +=================================================+
+// | LLAnimationBridge |
+// +=================================================+
+
+LLUIImagePtr LLAnimationBridge::getIcon() const
+{
+ return get_item_icon(LLAssetType::AT_ANIMATION, LLInventoryType::IT_ANIMATION, 0, FALSE);
+}
+
+void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
+
+ lldebugs << "LLAnimationBridge::buildContextMenu()" << llendl;
+ if(isInTrash())
+ {
+ items.push_back(std::string("Purge Item"));
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Purge Item"));
+ }
+
+ items.push_back(std::string("Restore Item"));
+ }
+ else
+ {
+ items.push_back(std::string("Animation Open"));
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+ }
+
+ items.push_back(std::string("Animation Separator"));
+ items.push_back(std::string("Animation Play"));
+ items.push_back(std::string("Animation Audition"));
+
+ hide_context_entries(menu, items, disabled_items);
+
+}
+
+// virtual
+void LLAnimationBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+{
+ if ((action == "playworld") || (action == "playlocal"))
+ {
+ if (getItem())
+ {
+ LLPreviewAnim::e_activation_type activate = LLPreviewAnim::NONE;
+ if ("playworld" == action) activate = LLPreviewAnim::PLAY;
+ if ("playlocal" == action) activate = LLPreviewAnim::AUDITION;
+
+ LLPreviewAnim* preview = LLFloaterReg::showTypedInstance<LLPreviewAnim>("preview_anim", LLSD(mUUID));
+ if (preview)
+ {
+ preview->activate(activate);
+ }
+ }
+ }
+ else
+ {
+ LLItemBridge::performAction(folder, model, action);
+ }
+}
+
+void LLAnimationBridge::openItem()
+{
+ LLViewerInventoryItem* item = getItem();
+
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
+/*
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES);
+ }
+*/
+}
+
+// +=================================================+
+// | LLObjectBridge |
+// +=================================================+
+
+// static
+LLUUID LLObjectBridge::sContextMenuItemID;
+
+LLObjectBridge::LLObjectBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLInventoryType::EType type, U32 flags) :
+LLItemBridge(inventory, uuid), mInvType(type)
+{
+ mAttachPt = (flags & 0xff); // low bye of inventory flags
+
+ mIsMultiObject = ( flags & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) ? TRUE: FALSE;
+}
+
+LLUIImagePtr LLObjectBridge::getIcon() const
+{
+ return get_item_icon(LLAssetType::AT_OBJECT, mInvType, mAttachPt, mIsMultiObject );
+}
+
+LLInventoryObject* LLObjectBridge::getObject() const
+{
+ LLInventoryObject* object = NULL;
+ LLInventoryModel* model = getInventoryModel();
+ if(model)
+ {
+ object = (LLInventoryObject*)model->getObject(mUUID);
+ }
+ return object;
+}
+
+// virtual
+void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+{
+ if ("attach" == action)
+ {
+ LLUUID object_id = mUUID;
+ LLViewerInventoryItem* item;
+ item = (LLViewerInventoryItem*)gInventory.getItem(object_id);
+ if(item && gInventory.isObjectDescendentOf(object_id, gInventory.getRootFolderID()))
+ {
+ rez_attachment(item, NULL);
+ }
+ else if(item && item->isComplete())
+ {
+ // must be in library. copy it to our inventory and put it on.
+ LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(0);
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ LLUUID::null,
+ std::string(),
+ cb);
+ }
+ gFocusMgr.setKeyboardFocus(NULL);
+ }
+ else if ("detach" == action)
+ {
+ LLInventoryItem* item = gInventory.getItem(mUUID);
+ if(item)
+ {
+ gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv);
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ gMessageSystem->addUUIDFast(_PREHASH_ItemID, item->getLinkedUUID());
+ gMessageSystem->sendReliable( gAgent.getRegion()->getHost());
+ }
+ // this object might have been selected, so let the selection manager know it's gone now
+ LLViewerObject *found_obj = gObjectList.findObject(item->getLinkedUUID());
+ if (found_obj)
+ {
+ LLSelectMgr::getInstance()->remove(found_obj);
+ }
+ }
+ else LLItemBridge::performAction(folder, model, action);
+}
+
+void LLObjectBridge::openItem()
+{
+ LLViewerInventoryItem* item = getItem();
+
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
+
+ LLSD key;
+ key["id"] = mUUID;
+ LLSideTray::getInstance()->showPanel("sidepanel_inventory", key);
+
+ // Disable old properties floater; this is replaced by the sidepanel.
+ /*
+ LLFloaterReg::showInstance("properties", mUUID);
+ */
+}
+
+LLFontGL::StyleFlags LLObjectBridge::getLabelStyle() const
+{
+ U8 font = LLFontGL::NORMAL;
+
+ LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
+ if( avatar && avatar->isWearingAttachment( mUUID ) )
+ {
+ font |= LLFontGL::BOLD;
+ }
+
+ LLInventoryItem* item = getItem();
+ if (item && item->getIsLinkType())
+ {
+ font |= LLFontGL::ITALIC;
+ }
+
+ return (LLFontGL::StyleFlags)font;
+}
+
+std::string LLObjectBridge::getLabelSuffix() const
+{
+ LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
+ if( avatar && avatar->isWearingAttachment( mUUID ) )
+ {
+ std::string attachment_point_name = avatar->getAttachedPointName(mUUID);
+
+ // e.g. "(worn on ...)" / "(attached to ...)"
+ LLStringUtil::format_map_t args;
+ args["[ATTACHMENT_POINT]"] = attachment_point_name.c_str();
+ return LLItemBridge::getLabelSuffix() + LLTrans::getString("WornOnAttachmentPoint", args);
+ }
+ else
+ {
+ return LLItemBridge::getLabelSuffix();
+ }
+}
+
+void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment)
+{
+ LLSD payload;
+ payload["item_id"] = item->getLinkedUUID(); // Wear the base object in case this is a link.
+
+ S32 attach_pt = 0;
+ if (gAgent.getAvatarObject() && attachment)
+ {
+ for (LLVOAvatar::attachment_map_t::iterator iter = gAgent.getAvatarObject()->mAttachmentPoints.begin();
+ iter != gAgent.getAvatarObject()->mAttachmentPoints.end(); ++iter)
+ {
+ if (iter->second == attachment)
+ {
+ attach_pt = iter->first;
+ break;
+ }
+ }
+ }
+
+ payload["attachment_point"] = attach_pt;
+
+#if !ENABLE_MULTIATTACHMENTS
+ if (attachment && attachment->getNumObjects() > 0)
+ {
+ LLNotifications::instance().add("ReplaceAttachment", LLSD(), payload, confirm_replace_attachment_rez);
+ }
+ else
+#endif
+ {
+ LLNotifications::instance().forceResponse(LLNotification::Params("ReplaceAttachment").payload(payload), 0/*YES*/);
+ }
+}
+
+bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response)
+{
+ LLVOAvatar *avatarp = gAgent.getAvatarObject();
+
+ if (!avatarp->canAttachMoreObjects())
+ {
+ LLSD args;
+ args["MAX_ATTACHMENTS"] = llformat("%d", MAX_AGENT_ATTACHMENTS);
+ LLNotifications::instance().add("MaxAttachmentsOnOutfit", args);
+ return false;
+ }
+
+ S32 option = LLNotification::getSelectedOption(notification, response);
+ if (option == 0/*YES*/)
+ {
+ LLViewerInventoryItem* itemp = gInventory.getItem(notification["payload"]["item_id"].asUUID());
+
+ if (itemp)
+ {
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_RezSingleAttachmentFromInv);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_ObjectData);
+ msg->addUUIDFast(_PREHASH_ItemID, itemp->getUUID());
+ msg->addUUIDFast(_PREHASH_OwnerID, itemp->getPermissions().getOwner());
+ U8 attachment_pt = notification["payload"]["attachment_point"].asInteger();
+#if ENABLE_MULTIATTACHMENTS
+ attachment_pt |= ATTACHMENT_ADD;
+#endif
+ msg->addU8Fast(_PREHASH_AttachmentPt, attachment_pt);
+ pack_permissions_slam(msg, itemp->getFlags(), itemp->getPermissions());
+ msg->addStringFast(_PREHASH_Name, itemp->getName());
+ msg->addStringFast(_PREHASH_Description, itemp->getDescription());
+ msg->sendReliable(gAgent.getRegion()->getHost());
+ }
+ }
+ return false;
+}
+static LLNotificationFunctorRegistration confirm_replace_attachment_rez_reg("ReplaceAttachment", confirm_replace_attachment_rez);
+
+void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
+ if(isInTrash())
+ {
+ items.push_back(std::string("Purge Item"));
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Purge Item"));
+ }
+
+ items.push_back(std::string("Restore Item"));
+ }
+ else
+ {
+ items.push_back(std::string("Properties"));
+
+ LLInventoryItem *item = getItem();
+ getClipboardEntries(true, items, disabled_items, flags);
+
+ LLObjectBridge::sContextMenuItemID = mUUID;
+
+ if(item)
+ {
+ LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+ if( !avatarp )
+ {
+ return;
+ }
+
+ if( avatarp->isWearingAttachment( mUUID ) )
+ {
+ items.push_back(std::string("Detach From Yourself"));
+ }
+ else
+ if( !isInTrash() && !isLinkedObjectInTrash() )
+ {
+ items.push_back(std::string("Attach Separator"));
+ items.push_back(std::string("Object Wear"));
+ items.push_back(std::string("Attach To"));
+ items.push_back(std::string("Attach To HUD"));
+ // commented out for DEV-32347
+ //items.push_back(std::string("Restore to Last Position"));
+
+ if (!avatarp->canAttachMoreObjects())
+ {
+ disabled_items.push_back(std::string("Object Wear"));
+ disabled_items.push_back(std::string("Attach To"));
+ disabled_items.push_back(std::string("Attach To HUD"));
+ }
+ LLMenuGL* attach_menu = menu.findChildMenuByName("Attach To", TRUE);
+ LLMenuGL* attach_hud_menu = menu.findChildMenuByName("Attach To HUD", TRUE);
+ LLVOAvatar *avatarp = gAgent.getAvatarObject();
+ if (attach_menu
+ && (attach_menu->getChildCount() == 0)
+ && attach_hud_menu
+ && (attach_hud_menu->getChildCount() == 0)
+ && avatarp)
+ {
+ for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
+ iter != avatarp->mAttachmentPoints.end(); )
+ {
+ LLVOAvatar::attachment_map_t::iterator curiter = iter++;
+ LLViewerJointAttachment* attachment = curiter->second;
+ LLMenuItemCallGL::Params p;
+ std::string submenu_name = attachment->getName();
+ if (LLTrans::getString(submenu_name) != "")
+ {
+ p.name = (" ")+LLTrans::getString(submenu_name)+" ";
+ }
+ else
+ {
+ p.name = submenu_name;
+ }
+ LLSD cbparams;
+ cbparams["index"] = curiter->first;
+ cbparams["label"] = attachment->getName();
+ p.on_click.function_name = "Inventory.AttachObject";
+ p.on_click.parameter = LLSD(attachment->getName());
+ p.on_enable.function_name = "Attachment.Label";
+ p.on_enable.parameter = cbparams;
+ LLView* parent = attachment->getIsHUDAttachment() ? attach_hud_menu : attach_menu;
+ LLUICtrlFactory::create<LLMenuItemCallGL>(p, parent);
+ }
+ }
+ }
+ }
+ }
+ hide_context_entries(menu, items, disabled_items);
+}
+
+BOOL LLObjectBridge::renameItem(const std::string& new_name)
+{
+ if(!isItemRenameable())
+ return FALSE;
+ LLPreview::dirty(mUUID);
+ LLInventoryModel* model = getInventoryModel();
+ if(!model)
+ return FALSE;
+ LLViewerInventoryItem* item = getItem();
+ if(item && (item->getName() != new_name))
+ {
+ LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
+ new_item->rename(new_name);
+ buildDisplayName(new_item, mDisplayName);
+ new_item->updateServer(FALSE);
+ model->updateItem(new_item);
+
+ model->notifyObservers();
+
+ LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
+ if( avatar )
+ {
+ LLViewerObject* obj = avatar->getWornAttachment( item->getUUID() );
+ if( obj )
+ {
+ LLSelectMgr::getInstance()->deselectAll();
+ LLSelectMgr::getInstance()->addAsIndividual( obj, SELECT_ALL_TES, FALSE );
+ LLSelectMgr::getInstance()->selectionSetObjectName( new_name );
+ LLSelectMgr::getInstance()->deselectAll();
+ }
+ }
+ }
+ // return FALSE because we either notified observers (& therefore
+ // rebuilt) or we didn't update.
+ return FALSE;
+}
+
+// +=================================================+
+// | LLLSLTextBridge |
+// +=================================================+
+
+LLUIImagePtr LLLSLTextBridge::getIcon() const
+{
+ return get_item_icon(LLAssetType::AT_SCRIPT, LLInventoryType::IT_LSL, 0, FALSE);
+}
+
+void LLLSLTextBridge::openItem()
+{
+ LLViewerInventoryItem* item = getItem();
+
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
+ /*
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES);
+ }
+ */
+}
+
+// +=================================================+
+// | LLWearableBridge |
+// +=================================================+
+
+// *NOTE: hack to get from avatar inventory to avatar
+void wear_inventory_item_on_avatar( LLInventoryItem* item )
+{
+ if(item)
+ {
+ lldebugs << "wear_inventory_item_on_avatar( " << item->getName()
+ << " )" << llendl;
+
+ LLAppearanceManager::instance().addCOFItemLink(item);
+ }
+}
+
+void wear_add_inventory_item_on_avatar( LLInventoryItem* item )
+{
+ if(item)
+ {
+ lldebugs << "wear_add_inventory_item_on_avatar( " << item->getName()
+ << " )" << llendl;
+
+ LLWearableList::instance().getAsset(item->getAssetUUID(),
+ item->getName(),
+ item->getType(),
+ LLWearableBridge::onWearAddOnAvatarArrived,
+ new LLUUID(item->getUUID()));
+ }
+}
+
+void remove_inventory_category_from_avatar( LLInventoryCategory* category )
+{
+ if(!category) return;
+ lldebugs << "remove_inventory_category_from_avatar( " << category->getName()
+ << " )" << llendl;
+
+
+ if( gFloaterCustomize )
+ {
+ gFloaterCustomize->askToSaveIfDirty(
+ boost::bind(remove_inventory_category_from_avatar_step2, _1, category->getUUID()));
+ }
+ else
+ {
+ remove_inventory_category_from_avatar_step2(TRUE, category->getUUID() );
+ }
+}
+
+struct OnRemoveStruct
+{
+ LLUUID mUUID;
+ OnRemoveStruct(const LLUUID& uuid):
+ mUUID(uuid)
+ {
+ }
+};
+
+void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_id)
+{
+
+ // Find all the wearables that are in the category's subtree.
+ lldebugs << "remove_inventory_category_from_avatar_step2()" << llendl;
+ if(proceed)
+ {
+ LLInventoryModel::cat_array_t cat_array;
+ LLInventoryModel::item_array_t item_array;
+ LLFindWearables is_wearable;
+ gInventory.collectDescendentsIf(category_id,
+ cat_array,
+ item_array,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_wearable);
+ S32 i;
+ S32 wearable_count = item_array.count();
+
+ LLInventoryModel::cat_array_t obj_cat_array;
+ LLInventoryModel::item_array_t obj_item_array;
+ LLIsType is_object( LLAssetType::AT_OBJECT );
+ gInventory.collectDescendentsIf(category_id,
+ obj_cat_array,
+ obj_item_array,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_object);
+ S32 obj_count = obj_item_array.count();
+
+ // Find all gestures in this folder
+ LLInventoryModel::cat_array_t gest_cat_array;
+ LLInventoryModel::item_array_t gest_item_array;
+ LLIsType is_gesture( LLAssetType::AT_GESTURE );
+ gInventory.collectDescendentsIf(category_id,
+ gest_cat_array,
+ gest_item_array,
+ LLInventoryModel::EXCLUDE_TRASH,
+ is_gesture);
+ S32 gest_count = gest_item_array.count();
+
+ if (wearable_count > 0) //Loop through wearables. If worn, remove.
+ {
+ for(i = 0; i < wearable_count; ++i)
+ {
+ LLViewerInventoryItem *item = item_array.get(i);
+ if (item->getType() == LLAssetType::AT_BODYPART)
+ continue;
+ if (gAgent.isTeen() && item->isWearableType() &&
+ (item->getWearableType() == WT_UNDERPANTS || item->getWearableType() == WT_UNDERSHIRT))
+ continue;
+ if( gAgentWearables.isWearingItem (item->getLinkedUUID()) )
+ {
+ LLWearableList::instance().getAsset(item->getAssetUUID(),
+ item->getName(),
+ item->getType(),
+ LLWearableBridge::onRemoveFromAvatarArrived,
+ new OnRemoveStruct(item->getLinkedUUID()));
+ }
+ }
+ }
+
+ if (obj_count > 0)
+ {
+ for(i = 0; i < obj_count; ++i)
+ {
+ LLViewerInventoryItem *obj_item = obj_item_array.get(i);
+ gMessageSystem->newMessageFast(_PREHASH_DetachAttachmentIntoInv);
+ gMessageSystem->nextBlockFast(_PREHASH_ObjectData );
+ gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
+ gMessageSystem->addUUIDFast(_PREHASH_ItemID, obj_item->getLinkedUUID() );
+
+ gMessageSystem->sendReliable( gAgent.getRegion()->getHost() );
+
+ // this object might have been selected, so let the selection manager know it's gone now
+ LLViewerObject *found_obj = gObjectList.findObject( obj_item->getLinkedUUID());
+ if (found_obj)
+ {
+ LLSelectMgr::getInstance()->remove(found_obj);
+ }
+ }
+ }
+
+ if (gest_count > 0)
+ {
+ for(i = 0; i < gest_count; ++i)
+ {
+ LLViewerInventoryItem *gest_item = gest_item_array.get(i);
+ if ( LLGestureManager::instance().isGestureActive( gest_item->getLinkedUUID()) )
+ {
+ LLGestureManager::instance().deactivateGesture( gest_item->getLinkedUUID() );
+ gInventory.updateItem( gest_item );
+ gInventory.notifyObservers();
+ }
+
+ }
+ }
+ }
+}
+
+BOOL LLWearableBridge::renameItem(const std::string& new_name)
+{
+ if( gAgentWearables.isWearingItem( mUUID ) )
+ {
+ gAgentWearables.setWearableName( mUUID, new_name );
+ }
+ return LLItemBridge::renameItem(new_name);
+}
+
+std::string LLWearableBridge::getLabelSuffix() const
+{
+ if( gAgentWearables.isWearingItem( mUUID ) )
+ {
+ // e.g. "(worn)"
+ return LLItemBridge::getLabelSuffix() + LLTrans::getString("worn");
+ }
+ else
+ {
+ return LLItemBridge::getLabelSuffix();
+ }
+}
+
+LLUIImagePtr LLWearableBridge::getIcon() const
+{
+ return get_item_icon(mAssetType, mInvType, mWearableType, FALSE);
+}
+
+// virtual
+void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+{
+ if ("wear" == action)
+ {
+ wearOnAvatar();
+ }
+ else if ("wear_add" == action)
+ {
+ wearAddOnAvatar();
+ }
+ else if ("edit" == action)
+ {
+ editOnAvatar();
+ return;
+ }
+ else if ("take_off" == action)
+ {
+ if(gAgentWearables.isWearingItem(mUUID))
+ {
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLWearableList::instance().getAsset(item->getAssetUUID(),
+ item->getName(),
+ item->getType(),
+ LLWearableBridge::onRemoveFromAvatarArrived,
+ new OnRemoveStruct(mUUID));
+ }
+ }
+ }
+ else LLItemBridge::performAction(folder, model, action);
+}
+
+void LLWearableBridge::openItem()
+{
+ LLViewerInventoryItem* item = getItem();
+
+ if (item)
+ {
+ LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
+ }
+ /*
+ if( isInTrash() )
+ {
+ LLNotifications::instance().add("CannotWearTrash");
+ }
+ else if(isAgentInventory())
+ {
+ if( !gAgentWearables.isWearingItem( mUUID ) )
+ {
+ wearOnAvatar();
+ }
+ }
+ else
+ {
+ // must be in the inventory library. copy it to our inventory
+ // and put it on right away.
+ LLViewerInventoryItem* item = getItem();
+ if(item && item->isComplete())
+ {
+ LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ LLUUID::null,
+ std::string(),
+ cb);
+ }
+ else if(item)
+ {
+ // *TODO: We should fetch the item details, and then do
+ // the operation above.
+ LLNotifications::instance().add("CannotWearInfoNotComplete");
+ }
+ }
+ */
+}
+
+void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ lldebugs << "LLWearableBridge::buildContextMenu()" << llendl;
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
+ if(isInTrash())
+ {
+ items.push_back(std::string("Purge Item"));
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Purge Item"));
+ }
+
+ items.push_back(std::string("Restore Item"));
+ }
+ else
+ { // FWIW, it looks like SUPPRESS_OPEN_ITEM is not set anywhere
+ BOOL no_open = ((flags & SUPPRESS_OPEN_ITEM) == SUPPRESS_OPEN_ITEM);
+
+ // If we have clothing, don't add "Open" as it's the same action as "Wear" SL-18976
+ LLViewerInventoryItem* item = getItem();
+ if( !no_open && item )
+ {
+ no_open = (item->getType() == LLAssetType::AT_CLOTHING) ||
+ (item->getType() == LLAssetType::AT_BODYPART);
+ }
+ if (!no_open)
+ {
+ items.push_back(std::string("Open"));
+ }
+
+ items.push_back(std::string("Properties"));
+
+ getClipboardEntries(true, items, disabled_items, flags);
+
+ items.push_back(std::string("Wearable Separator"));
+
+ items.push_back(std::string("Wearable Wear"));
+ items.push_back(std::string("Wearable Add"));
+ items.push_back(std::string("Wearable Edit"));
+
+ if ((flags & FIRST_SELECTED_ITEM) == 0)
+ {
+ disabled_items.push_back(std::string("Wearable Edit"));
+ }
+ // Don't allow items to be worn if their baseobj is in the trash.
+ if (isLinkedObjectInTrash())
+ {
+ disabled_items.push_back(std::string("Wearable Wear"));
+ disabled_items.push_back(std::string("Wearable Add"));
+ disabled_items.push_back(std::string("Wearable Edit"));
+ }
+
+ // Disable wear and take off based on whether the item is worn.
+ if(item)
+ {
+ switch (item->getType())
+ {
+ case LLAssetType::AT_CLOTHING:
+ items.push_back(std::string("Take Off"));
+ case LLAssetType::AT_BODYPART:
+ if (gAgentWearables.isWearingItem(item->getUUID()))
+ {
+ disabled_items.push_back(std::string("Wearable Wear"));
+ disabled_items.push_back(std::string("Wearable Add"));
+ }
+ else
+ {
+ disabled_items.push_back(std::string("Take Off"));
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ hide_context_entries(menu, items, disabled_items);
+}
+
+// Called from menus
+// static
+BOOL LLWearableBridge::canWearOnAvatar(void* user_data)
+{
+ LLWearableBridge* self = (LLWearableBridge*)user_data;
+ if(!self) return FALSE;
+ if(!self->isAgentInventory())
+ {
+ LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem();
+ if(!item || !item->isComplete()) return FALSE;
+ }
+ return (!gAgentWearables.isWearingItem(self->mUUID));
+}
+
+// Called from menus
+// static
+void LLWearableBridge::onWearOnAvatar(void* user_data)
+{
+ LLWearableBridge* self = (LLWearableBridge*)user_data;
+ if(!self) return;
+ self->wearOnAvatar();
+}
+
+void LLWearableBridge::wearOnAvatar()
+{
+ // Don't wear anything until initial wearables are loaded, can
+ // destroy clothing items.
+ if (!gAgentWearables.areWearablesLoaded())
+ {
+ LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded");
+ return;
+ }
+
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ if(!isAgentInventory())
+ {
+ LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ LLUUID::null,
+ std::string(),
+ cb);
+ }
+ else
+ {
+ wear_inventory_item_on_avatar(item);
+ }
+ }
+}
+
+void LLWearableBridge::wearAddOnAvatar()
+{
+ // Don't wear anything until initial wearables are loaded, can
+ // destroy clothing items.
+ if (!gAgentWearables.areWearablesLoaded())
+ {
+ LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded");
+ return;
+ }
+
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ if(!isAgentInventory())
+ {
+ LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ LLUUID::null,
+ std::string(),
+ cb);
+ }
+ else
+ {
+ wear_add_inventory_item_on_avatar(item);
+ }
+ }
+}
+
+// static
+void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userdata )
+{
+ LLUUID* item_id = (LLUUID*) userdata;
+ if(wearable)
+ {
+ LLViewerInventoryItem* item = NULL;
+ item = (LLViewerInventoryItem*)gInventory.getItem(*item_id);
+ if(item)
+ {
+ if(item->getAssetUUID() == wearable->getAssetID())
+ {
+ gAgentWearables.setWearableItem(item, wearable);
+ gInventory.notifyObservers();
+ //self->getFolderItem()->refreshFromRoot();
+ }
+ else
+ {
+ llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl;
+ }
+ }
+ }
+ delete item_id;
+}
+
+// static
+// BAP remove the "add" code path once everything is fully COF-ified.
+void LLWearableBridge::onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata )
+{
+ LLUUID* item_id = (LLUUID*) userdata;
+ if(wearable)
+ {
+ LLViewerInventoryItem* item = NULL;
+ item = (LLViewerInventoryItem*)gInventory.getItem(*item_id);
+ if(item)
+ {
+ if(item->getAssetUUID() == wearable->getAssetID())
+ {
+ bool do_append = true;
+ gAgentWearables.setWearableItem(item, wearable, do_append);
+ gInventory.notifyObservers();
+ //self->getFolderItem()->refreshFromRoot();
+ }
+ else
+ {
+ llinfos << "By the time wearable asset arrived, its inv item already pointed to a different asset." << llendl;
+ }
+ }
+ }
+ delete item_id;
+}
+
+// static
+BOOL LLWearableBridge::canEditOnAvatar(void* user_data)
+{
+ LLWearableBridge* self = (LLWearableBridge*)user_data;
+ if(!self) return FALSE;
+
+ return (gAgentWearables.isWearingItem(self->mUUID));
+}
+
+// static
+void LLWearableBridge::onEditOnAvatar(void* user_data)
+{
+ LLWearableBridge* self = (LLWearableBridge*)user_data;
+ if(self)
+ {
+ self->editOnAvatar();
+ }
+}
+
+void LLWearableBridge::editOnAvatar()
+{
+ const LLWearable* wearable = gAgentWearables.getWearableFromItemID(mUUID);
+ if( wearable )
+ {
+ // Set the tab to the right wearable.
+ if (gFloaterCustomize)
+ gFloaterCustomize->setCurrentWearableType( wearable->getType() );
+
+ if( CAMERA_MODE_CUSTOMIZE_AVATAR != gAgent.getCameraMode() )
+ {
+ // Start Avatar Customization
+ gAgent.changeCameraToCustomizeAvatar();
+ }
+ }
+}
+
+// static
+BOOL LLWearableBridge::canRemoveFromAvatar(void* user_data)
+{
+ LLWearableBridge* self = (LLWearableBridge*)user_data;
+ if( self && (LLAssetType::AT_BODYPART != self->mAssetType) )
+ {
+ return gAgentWearables.isWearingItem( self->mUUID );
+ }
+ return FALSE;
+}
+
+// static
+void LLWearableBridge::onRemoveFromAvatar(void* user_data)
+{
+ LLWearableBridge* self = (LLWearableBridge*)user_data;
+ if(!self) return;
+ if(gAgentWearables.isWearingItem(self->mUUID))
+ {
+ LLViewerInventoryItem* item = self->getItem();
+ if (item)
+ {
+ LLUUID parent_id = item->getParentUUID();
+ LLWearableList::instance().getAsset(item->getAssetUUID(),
+ item->getName(),
+ item->getType(),
+ onRemoveFromAvatarArrived,
+ new OnRemoveStruct(LLUUID(self->mUUID)));
+ }
+ }
+}
+
+// static
+void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
+ void* userdata)
+{
+ OnRemoveStruct *on_remove_struct = (OnRemoveStruct*) userdata;
+ const LLUUID &item_id = gInventory.getLinkedItemID(on_remove_struct->mUUID);
+ if(wearable)
+ {
+ if( gAgentWearables.isWearingItem( item_id ) )
+ {
+ EWearableType type = wearable->getType();
+
+ if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES ) ) //&&
+ //!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) )
+ {
+ // MULTI_WEARABLE: FIXME HACK - always remove all
+ bool do_remove_all = false;
+ gAgentWearables.removeWearable( type, do_remove_all, 0 );
+ }
+ }
+ }
+
+ // Find and remove this item from the COF.
+ LLInventoryModel::item_array_t items = gInventory.collectLinkedItems(item_id, LLAppearanceManager::instance().getCOF());
+ llassert(items.size() == 1); // Should always have one and only one item linked to this in the COF.
+ for (LLInventoryModel::item_array_t::const_iterator iter = items.begin();
+ iter != items.end();
+ ++iter)
+ {
+ const LLViewerInventoryItem *linked_item = (*iter);
+ const LLUUID &item_id = linked_item->getUUID();
+ gInventory.purgeObject(item_id);
+ }
+ gInventory.notifyObservers();
+
+ delete on_remove_struct;
+}
+
+LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_type,
+ const LLUUID& uuid,LLInventoryModel* model)
+{
+ LLInvFVBridgeAction* action = NULL;
+ switch(asset_type)
+ {
+ case LLAssetType::AT_TEXTURE:
+ action = new LLTextureBridgeAction(uuid,model);
+ break;
+
+ case LLAssetType::AT_SOUND:
+ action = new LLSoundBridgeAction(uuid,model);
+ break;
+
+ case LLAssetType::AT_LANDMARK:
+ action = new LLLandmarkBridgeAction(uuid,model);
+ break;
+
+ case LLAssetType::AT_CALLINGCARD:
+ action = new LLCallingCardBridgeAction(uuid,model);
+ break;
+
+ case LLAssetType::AT_OBJECT:
+ action = new LLObjectBridgeAction(uuid,model);
+ break;
+
+ case LLAssetType::AT_NOTECARD:
+ action = new LLNotecardBridgeAction(uuid,model);
+ break;
+
+ case LLAssetType::AT_ANIMATION:
+ action = new LLAnimationBridgeAction(uuid,model);
+ break;
+
+ case LLAssetType::AT_GESTURE:
+ action = new LLGestureBridgeAction(uuid,model);
+ break;
+
+ case LLAssetType::AT_LSL_TEXT:
+ action = new LLLSLTextBridgeAction(uuid,model);
+ break;
+
+ case LLAssetType::AT_CLOTHING:
+ case LLAssetType::AT_BODYPART:
+ action = new LLWearableBridgeAction(uuid,model);
+
+ break;
+
+ default:
+ break;
+ }
+ return action;
+}
+
+//static
+void LLInvFVBridgeAction::doAction(LLAssetType::EType asset_type,
+ const LLUUID& uuid,LLInventoryModel* model)
+{
+ LLInvFVBridgeAction* action = createAction(asset_type,uuid,model);
+ if(action)
+ {
+ action->doIt();
+ delete action;
+ }
+}
+
+//static
+void LLInvFVBridgeAction::doAction(const LLUUID& uuid, LLInventoryModel* model)
+{
+ LLAssetType::EType asset_type = model->getItem(uuid)->getType();
+ LLInvFVBridgeAction* action = createAction(asset_type,uuid,model);
+ if(action)
+ {
+ action->doIt();
+ delete action;
+ }
+}
+
+LLViewerInventoryItem* LLInvFVBridgeAction::getItem() const
+{
+ if(mModel)
+ return (LLViewerInventoryItem*)mModel->getItem(mUUID);
+ return NULL;
+}
+
+//virtual
+void LLTextureBridgeAction::doIt()
+{
+ if (getItem())
+ {
+ LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES);
+ }
+
+ LLInvFVBridgeAction::doIt();
+}
+
+//virtual
+void LLSoundBridgeAction::doIt()
+{
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ LLFloaterReg::showInstance("preview_sound", LLSD(mUUID), TAKE_FOCUS_YES);
+ }
+
+ LLInvFVBridgeAction::doIt();
+}
+
+
+//virtual
+void LLLandmarkBridgeAction::doIt()
+{
+ LLViewerInventoryItem* item = getItem();
+ if( item )
+ {
+ // Opening (double-clicking) a landmark immediately teleports,
+ // but warns you the first time.
+ LLSD payload;
+ payload["asset_id"] = item->getAssetUUID();
+ LLNotifications::instance().add("TeleportFromLandmark", LLSD(), payload);
+ }
+
+ LLInvFVBridgeAction::doIt();
+}
+
+
+//virtual
+void LLCallingCardBridgeAction::doIt()
+{
+ LLViewerInventoryItem* item = getItem();
+ if(item && item->getCreatorUUID().notNull())
+ {
+ LLAvatarActions::showProfile(item->getCreatorUUID());
+ }
+
+ LLInvFVBridgeAction::doIt();
+}
+
+//virtual
+void
+LLNotecardBridgeAction::doIt()
+{
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES);
+ }
+
+ LLInvFVBridgeAction::doIt();
+}
+
+//virtual
+void LLGestureBridgeAction::doIt()
+{
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null);
+ preview->setFocus(TRUE);
+ }
+
+ LLInvFVBridgeAction::doIt();
+}
+
+//virtual
+void LLAnimationBridgeAction::doIt()
+{
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES);
+ }
+
+ LLInvFVBridgeAction::doIt();
+}
+
+
+//virtual
+void LLObjectBridgeAction::doIt()
+{
+ LLFloaterReg::showInstance("properties", mUUID);
+
+ LLInvFVBridgeAction::doIt();
+}
+
+
+//virtual
+void LLLSLTextBridgeAction::doIt()
+{
+ LLViewerInventoryItem* item = getItem();
+ if (item)
+ {
+ LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES);
+ }
+
+ LLInvFVBridgeAction::doIt();
+}
+
+
+BOOL LLWearableBridgeAction::isInTrash() const
+{
+ if(!mModel) return FALSE;
+ const LLUUID trash_id = mModel->findCategoryUUIDForType(LLFolderType::FT_TRASH);
+ return mModel->isObjectDescendentOf(mUUID, trash_id);
+}
+
+BOOL LLWearableBridgeAction::isAgentInventory() const
+{
+ if(!mModel) return FALSE;
+ if(gInventory.getRootFolderID() == mUUID) return TRUE;
+ return mModel->isObjectDescendentOf(mUUID, gInventory.getRootFolderID());
+}
+
+void LLWearableBridgeAction::wearOnAvatar()
+{
+ // Don't wear anything until initial wearables are loaded, can
+ // destroy clothing items.
+ if (!gAgentWearables.areWearablesLoaded())
+ {
+ LLNotifications::instance().add("CanNotChangeAppearanceUntilLoaded");
+ return;
+ }
+
+ LLViewerInventoryItem* item = getItem();
+ if(item)
+ {
+ if(!isAgentInventory())
+ {
+ LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ LLUUID::null,
+ std::string(),
+ cb);
+ }
+ else
+ {
+ wear_inventory_item_on_avatar(item);
+ }
+ }
+}
+
+//virtual
+void LLWearableBridgeAction::doIt()
+{
+ if(isInTrash())
+ {
+ LLNotifications::instance().add("CannotWearTrash");
+ }
+ else if(isAgentInventory())
+ {
+ if(!gAgentWearables.isWearingItem(mUUID))
+ {
+ wearOnAvatar();
+ }
+ }
+ else
+ {
+ // must be in the inventory library. copy it to our inventory
+ // and put it on right away.
+ LLViewerInventoryItem* item = getItem();
+ if(item && item->isComplete())
+ {
+ LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
+ copy_inventory_item(
+ gAgent.getID(),
+ item->getPermissions().getOwner(),
+ item->getUUID(),
+ LLUUID::null,
+ std::string(),
+ cb);
+ }
+ else if(item)
+ {
+ // *TODO: We should fetch the item details, and then do
+ // the operation above.
+ LLNotifications::instance().add("CannotWearInfoNotComplete");
+ }
+ }
+
+ LLInvFVBridgeAction::doIt();
+}
+
+// +=================================================+
+// | LLLinkItemBridge |
+// +=================================================+
+// For broken links
+
+std::string LLLinkItemBridge::sPrefix("Link: ");
+
+
+LLUIImagePtr LLLinkItemBridge::getIcon() const
+{
+ if (LLViewerInventoryItem *item = getItem())
+ {
+ return get_item_icon(item->getActualType(), LLInventoryType::IT_NONE, 0, FALSE);
+ }
+ return get_item_icon(LLAssetType::AT_LINK, LLInventoryType::IT_NONE, 0, FALSE);
+}
+
+void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ // *TODO: Translate
+ lldebugs << "LLLink::buildContextMenu()" << llendl;
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
+
+ if(isInTrash())
+ {
+ items.push_back(std::string("Purge Item"));
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Purge Item"));
+ }
+
+ items.push_back(std::string("Restore Item"));
+ }
+ else
+ {
+ items.push_back(std::string("Delete"));
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Delete"));
+ }
+ }
+ hide_context_entries(menu, items, disabled_items);
+}
+
+
+// +=================================================+
+// | LLLinkBridge |
+// +=================================================+
+// For broken links.
+
+std::string LLLinkFolderBridge::sPrefix("Link: ");
+
+
+LLUIImagePtr LLLinkFolderBridge::getIcon() const
+{
+ LLFolderType::EType preferred_type = LLFolderType::FT_NONE;
+ if (LLViewerInventoryItem *item = getItem())
+ {
+ if (const LLViewerInventoryCategory* cat = item->getLinkedCategory())
+ {
+ preferred_type = cat->getPreferredType();
+ }
+ }
+ return LLFolderBridge::getIcon(preferred_type);
+}
+
+void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+ // *TODO: Translate
+ lldebugs << "LLLink::buildContextMenu()" << llendl;
+ std::vector<std::string> items;
+ std::vector<std::string> disabled_items;
+
+ if(isInTrash())
+ {
+ items.push_back(std::string("Purge Item"));
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Purge Item"));
+ }
+
+ items.push_back(std::string("Restore Item"));
+ }
+ else
+ {
+ items.push_back(std::string("Find Original"));
+ items.push_back(std::string("Delete"));
+ if (!isItemRemovable())
+ {
+ disabled_items.push_back(std::string("Delete"));
+ }
+ }
+ hide_context_entries(menu, items, disabled_items);
+}
+
+void LLLinkFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+{
+ if ("goto" == action)
+ {
+ gotoItem(folder);
+ return;
+ }
+ LLItemBridge::performAction(folder,model,action);
+}
+
+void LLLinkFolderBridge::gotoItem(LLFolderView *folder)
+{
+ const LLUUID &cat_uuid = getFolderID();
+ if (!cat_uuid.isNull())
+ {
+ if (LLFolderViewItem *base_folder = folder->getItemByID(cat_uuid))
+ {
+ if (LLInventoryModel* model = getInventoryModel())
+ {
+ model->fetchDescendentsOf(cat_uuid);
+ }
+ base_folder->setOpen(TRUE);
+ folder->setSelectionFromRoot(base_folder,TRUE);
+ folder->scrollToShowSelection();
+ }
+ }
+}
+
+const LLUUID &LLLinkFolderBridge::getFolderID() const
+{
+ if (LLViewerInventoryItem *link_item = getItem())
+ {
+ if (const LLViewerInventoryCategory *cat = link_item->getLinkedCategory())
+ {
+ const LLUUID& cat_uuid = cat->getUUID();
+ return cat_uuid;
+ }
+ }
+ return LLUUID::null;
+}
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 49e64ebdde..6a284e0550 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -288,6 +288,8 @@ public: virtual BOOL renameItem(const std::string& new_name); virtual BOOL removeItem(); + bool removeItemResponse(const LLSD& notification, const LLSD& response); + virtual void pasteFromClipboard(); virtual void pasteLinkFromClipboard(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); @@ -508,7 +510,6 @@ public: virtual LLFontGL::StyleFlags getLabelStyle() const; virtual std::string getLabelSuffix() const; virtual void buildContextMenu(LLMenuGL& menu, U32 flags); - virtual BOOL isItemRemovable(); virtual BOOL renameItem(const std::string& new_name); LLInventoryObject* getObject() const; @@ -546,7 +547,6 @@ public: virtual void openItem(); virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual std::string getLabelSuffix() const; - virtual BOOL isItemRemovable(); virtual BOOL renameItem(const std::string& new_name); static void onWearOnAvatar( void* userdata ); // Access to wearOnAvatar() from menu diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index fbaab385fe..9e37c5be38 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1118,9 +1118,16 @@ BOOL LLInventoryModel::containsObserver(LLInventoryObserver* observer) const return mObservers.find(observer) != mObservers.end(); } -// Call this method when it's time to update everyone on a new state, -// by default, the inventory model will not update observers -// automatically. +void LLInventoryModel::idleNotifyObservers() +{ + if (mModifyMask == LLInventoryObserver::NONE && (mChangedItemIDs.size() == 0)) + { + return; + } + notifyObservers(""); +} + +// Call this method when it's time to update everyone on a new state. // The optional argument 'service_name' is used by Agent Inventory Service [DEV-20328] void LLInventoryModel::notifyObservers(const std::string service_name) { @@ -1133,13 +1140,6 @@ void LLInventoryModel::notifyObservers(const std::string service_name) return; } - if ((mModifyMask == LLInventoryObserver::NONE) && (service_name == "")) - { - mModifyMask = LLInventoryObserver::NONE; - mChangedItemIDs.clear(); - return; - } - mIsNotifyObservers = TRUE; for (observer_list_t::iterator iter = mObservers.begin(); iter != mObservers.end(); ) @@ -3308,8 +3308,7 @@ void LLInventoryModel::processInventoryDescendents(LLMessageSystem* msg,void**) msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); if(agent_id != gAgent.getID()) { - llwarns << "Got a UpdateInventoryItem for the wrong agent." - << llendl; + llwarns << "Got a UpdateInventoryItem for the wrong agent." << llendl; return; } LLUUID parent_id; @@ -3320,6 +3319,7 @@ void LLInventoryModel::processInventoryDescendents(LLMessageSystem* msg,void**) msg->getS32("AgentData", "Version", version); S32 descendents; msg->getS32("AgentData", "Descendents", descendents); + S32 i; S32 count = msg->getNumberOfBlocksFast(_PREHASH_FolderData); LLPointer<LLViewerInventoryCategory> tcategory = new LLViewerInventoryCategory(owner_id); @@ -3349,6 +3349,9 @@ void LLInventoryModel::processInventoryDescendents(LLMessageSystem* msg,void**) { cat->setVersion(version); cat->setDescendentCount(descendents); + // Get this UUID on the changed list so that whatever's listening for it + // will get triggered. + gInventory.addChangedMask(LLInventoryObserver::INTERNAL, cat->getUUID()); } gInventory.notifyObservers(); } diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index da12dbdf7f..50f54cb842 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -252,9 +252,12 @@ public: // multiple trash can bug. const LLUUID findCategoryUUIDForType(LLFolderType::EType preferred_type, bool create_folder = true, bool find_in_library = false); - // Call this method when it's time to update everyone on a new - // state, by default, the inventory model will not update - // observers automatically. + // This gets called by the idle loop. It only updates if new + // state is detected. Call notifyObservers() manually to update + // regardless of whether state change has been indicated. + void idleNotifyObservers(); + + // Call this method to explicitly update everyone on a new state. // The optional argument 'service_name' is used by Agent Inventory Service [DEV-20328] void notifyObservers(const std::string service_name=""); diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 3ccf593d27..06f4b36df3 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -112,10 +112,20 @@ void LLInventoryFetchObserver::changed(U32 mask) LLViewerInventoryItem* item = gInventory.getItem(*it); if(!item) { - // BUG: This can cause done() to get called prematurely below. - // This happens with the LLGestureInventoryFetchObserver that - // loads gestures at startup. JC - it = mIncomplete.erase(it); + if (mRetryIfMissing) + { + // BAP changed to skip these items, so we should keep retrying until they arrive. + // Did not make this the default behavior because of uncertainty about impact - + // could cause some observers that currently complete to wait forever. + ++it; + } + else + { + // BUG: This can cause done() to get called prematurely below. + // This happens with the LLGestureInventoryFetchObserver that + // loads gestures at startup. JC + it = mIncomplete.erase(it); + } continue; } if(item->isComplete()) diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index 384e6292e8..73b25a8ed0 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -106,16 +106,17 @@ protected: class LLInventoryFetchObserver : public LLInventoryObserver { public: - LLInventoryFetchObserver() {} + LLInventoryFetchObserver(bool retry_if_missing = false): mRetryIfMissing(retry_if_missing) {} virtual void changed(U32 mask); typedef std::vector<LLUUID> item_ref_t; bool isEverythingComplete() const; void fetchItems(const item_ref_t& ids); - virtual void done() = 0; + virtual void done() {}; protected: + bool mRetryIfMissing; item_ref_t mComplete; item_ref_t mIncomplete; }; diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 327a735f78..0c893dddd6 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -78,7 +78,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : mSortOrderSetting(p.sort_order_setting), mInventory(p.inventory), mAllowMultiSelect(p.allow_multi_select), - mHasInventoryConnection(false), + mViewsInitialized(false), mStartFolderString(p.start_folder), mBuildDefaultHierarchy(true), mInvFVBridgeBuilder(NULL) @@ -96,6 +96,11 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) : setBackgroundColor(LLUIColorTable::instance().getColor("InventoryBackgroundColor")); setBackgroundVisible(TRUE); setBackgroundOpaque(TRUE); + + if (mStartFolderString != "") + { + mBuildDefaultHierarchy = false; + } } BOOL LLInventoryPanel::postBuild() @@ -146,13 +151,13 @@ BOOL LLInventoryPanel::postBuild() mInventory->addObserver(mInventoryObserver); // build view of inventory if we need default full hierarchy and inventory ready, otherwise wait for modelChanged() callback - if (mBuildDefaultHierarchy && mInventory->isInventoryUsable() && !mHasInventoryConnection) + if (mBuildDefaultHierarchy && mInventory->isInventoryUsable() && !mViewsInitialized) { - rebuildViews(); - mHasInventoryConnection = true; - defaultOpenInventory(); + initializeViews(); } + gIdleCallbacks.addFunction(onIdle, (void*)this); + if (mSortOrderSetting != INHERIT_SORT_ORDER) { setSortOrder(gSavedSettings.getU32(mSortOrderSetting)); @@ -252,15 +257,11 @@ void LLInventoryPanel::modelChanged(U32 mask) bool handled = false; - // inventory just initialized, do complete build - if ((mask & LLInventoryObserver::ADD) && gInventory.getChangedIDs().empty() && !mHasInventoryConnection) + if (!mViewsInitialized) { - rebuildViews(); - mHasInventoryConnection = true; - defaultOpenInventory(); return; } - + if (mask & LLInventoryObserver::LABEL) { handled = true; @@ -327,22 +328,26 @@ void LLInventoryPanel::modelChanged(U32 mask) // around in the panel's directory structure (i.e. reparented). if (model_item && view_item) { - LLFolderViewFolder* new_parent = (LLFolderViewFolder*)mFolders->getItemByID(model_item->getParentUUID()); - - // Item has been moved. - if (view_item->getParentFolder() != new_parent) + // Don't process the item if it's hanging from the root, since its + // model_item's parent will be NULL. + if (view_item->getRoot() != view_item->getParent()) { - if (new_parent != NULL) + LLFolderViewFolder* new_parent = (LLFolderViewFolder*)mFolders->getItemByID(model_item->getParentUUID()); + // Item has been moved. + if (view_item->getParentFolder() != new_parent) { - // Item is to be moved and we found its new parent in the panel's directory, so move the item's UI. - view_item->getParentFolder()->extractItem(view_item); - view_item->addToFolder(new_parent, mFolders); - } - else - { - // Item is to be moved outside the panel's directory (e.g. moved to trash for a panel that - // doesn't include trash). Just remove the item's UI. - view_item->destroyView(); + if (new_parent != NULL) + { + // Item is to be moved and we found its new parent in the panel's directory, so move the item's UI. + view_item->getParentFolder()->extractItem(view_item); + view_item->addToFolder(new_parent, mFolders); + } + else + { + // Item is to be moved outside the panel's directory (e.g. moved to trash for a panel that + // doesn't include trash). Just remove the item's UI. + view_item->destroyView(); + } } } } @@ -366,11 +371,28 @@ void LLInventoryPanel::modelChanged(U32 mask) } } +// static +void LLInventoryPanel::onIdle(void *userdata) +{ + LLInventoryPanel *self = (LLInventoryPanel*)userdata; + // inventory just initialized, do complete build + if (!self->mViewsInitialized && gInventory.isInventoryUsable()) + { + self->initializeViews(); + } + if (self->mViewsInitialized) + { + gIdleCallbacks.deleteFunction(onIdle, (void*)self); + } +} -void LLInventoryPanel::rebuildViews() +void LLInventoryPanel::initializeViews() { - // Determine the root folder and rebuild the views starting - // at that folder. + if (!gInventory.isInventoryUsable()) + return; + + // Determine the root folder in case specified, and + // build the views starting with that folder. const LLFolderType::EType preferred_type = LLViewerFolderType::lookupTypeFromNewCategoryName(mStartFolderString); if ("LIBRARY" == mStartFolderString) @@ -381,16 +403,17 @@ void LLInventoryPanel::rebuildViews() { mStartFolderID = (preferred_type != LLFolderType::FT_NONE ? gInventory.findCategoryUUIDForType(preferred_type) : LLUUID::null); } - + llinfos << this << " Generating views for start folder " << mStartFolderString << llendl; rebuildViewsFor(mStartFolderID); + + mViewsInitialized = true; + defaultOpenInventory(); } void LLInventoryPanel::rebuildViewsFor(const LLUUID& id) { - LLFolderViewItem* old_view = NULL; - - // get old LLFolderViewItem - old_view = mFolders->getItemByID(id); + // Destroy the old view for this ID so we can rebuild it + LLFolderViewItem* old_view = mFolders->getItemByID(id); if (old_view && id.notNull()) { old_view->destroyView(); @@ -409,11 +432,13 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id) const LLUUID &parent_id = objectp->getParentUUID(); LLFolderViewFolder* parent_folder = (LLFolderViewFolder*)mFolders->getItemByID(parent_id); if (id == mStartFolderID) + { parent_folder = mFolders; - - if (!parent_folder) + } + else if ((mStartFolderID != LLUUID::null) && (!gInventory.isObjectDescendentOf(id, mStartFolderID))) { - // This item exists outside the inventory's hierarchy, so don't add it. + // This item exists outside the inventory's hierarchy, + // so don't add it. return; } @@ -520,19 +545,20 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id) // bit of a hack to make sure the inventory is open. void LLInventoryPanel::defaultOpenInventory() { - const LLFolderType::EType preferred_type = LLViewerFolderType::lookupTypeFromNewCategoryName(mStartFolderString); - if (preferred_type != LLFolderType::FT_NONE) + if (mStartFolderString != "") { - const std::string& top_level_folder_name = LLViewerFolderType::lookupNewCategoryName(preferred_type); - mFolders->openFolder(top_level_folder_name); + mFolders->openFolder(mStartFolderString); } else { // Get the first child (it should be "My Inventory") and // open it up by name (just to make sure the first child is actually a folder). LLView* first_child = mFolders->getFirstChild(); - const std::string& first_child_name = first_child->getName(); - mFolders->openFolder(first_child_name); + if (first_child) + { + const std::string& first_child_name = first_child->getName(); + mFolders->openFolder(first_child_name); + } } } @@ -640,13 +666,6 @@ void LLInventoryPanel::openAllFolders() mFolders->arrangeAll(); } -void LLInventoryPanel::openDefaultFolderForType(LLFolderType::EType type) -{ - LLUUID category_id = mInventory->findCategoryUUIDForType(type); - LLOpenFolderByID opener(category_id); - mFolders->applyFunctorRecursively(opener); -} - void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus) { // Don't select objects in COF (e.g. to prevent refocus when items are worn). diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 0ccee337c9..fd23b375fa 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -122,7 +122,6 @@ public: // Call this method to set the selection. void openAllFolders(); - void openDefaultFolderForType(LLFolderType::EType); void setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus); void setSelectCallback(const LLFolderView::signal_t::slot_type& cb) { if (mFolders) mFolders->setSelectCallback(cb); } void clearSelection(); @@ -161,40 +160,23 @@ public: void openSelected(); void unSelectAll() { mFolders->setSelection(NULL, FALSE, FALSE); } -protected: - // Destroys the old views, and regenerates them based on the - // start folder ID. - void rebuildViews(); + static void onIdle(void* user_data); + +private: // Given the id and the parent, build all of the folder views. void rebuildViewsFor(const LLUUID& id); virtual void buildNewViews(const LLUUID& id); // made virtual to support derived classes. EXT-719 - void defaultOpenInventory(); // open the first level of inventory protected: + void defaultOpenInventory(); // open the first level of inventory + LLInventoryModel* mInventory; LLInventoryObserver* mInventoryObserver; BOOL mAllowMultiSelect; std::string mSortOrderSetting; -//private: // Can not make these private - needed by llinventorysubtreepanel LLFolderView* mFolders; - std::string mStartFolderString; - - /** - * Contains UUID of Inventory item from which hierarchy should be built. - * Can be set with the "start_folder" xml property. - * Default is LLUUID::null that means total Inventory hierarchy. - */ - LLUUID mStartFolderID; LLScrollContainer* mScroller; - bool mHasInventoryConnection; - - /** - * Flag specified if default inventory hierarchy should be created in postBuild() - */ - bool mBuildDefaultHierarchy; - - LLUUID mRootInventoryItemUUID; /** * Pointer to LLInventoryFVBridgeBuilder. @@ -205,6 +187,21 @@ protected: */ const LLInventoryFVBridgeBuilder* mInvFVBridgeBuilder; + //-------------------------------------------------------------------- + // Initialization routines for building up the UI ("views") + //-------------------------------------------------------------------- +public: + BOOL getIsViewsInitialized() const { return mViewsInitialized; } +private: + // Builds the UI. Call this once the inventory is usable. + void initializeViews(); + BOOL mBuildDefaultHierarchy; // default inventory hierarchy should be created in postBuild() + BOOL mViewsInitialized; // Views have been generated + + // UUID of category from which hierarchy should be built. Set with the + // "start_folder" xml property. Default is LLUUID::null that means total Inventory hierarchy. + std::string mStartFolderString; + LLUUID mStartFolderID; }; #endif // LL_LLINVENTORYPANEL_H diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index 7e35cfa04c..6b28edf0b6 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -52,6 +52,7 @@ #include "llteleporthistory.h" #include "llsidetray.h" #include "llslurl.h" +#include "llstatusbar.h" // getHealth() #include "lltrans.h" #include "llviewerinventory.h" #include "llviewerparcelmgr.h" @@ -157,15 +158,22 @@ LLLocationInputCtrl::Params::Params() add_landmark_image_disabled("add_landmark_image_disabled"), add_landmark_image_hover("add_landmark_image_hover"), add_landmark_image_selected("add_landmark_image_selected"), + icon_hpad("icon_hpad", 0), add_landmark_button("add_landmark_button"), - add_landmark_hpad("add_landmark_hpad", 0), - info_button("info_button") + info_button("info_button"), + voice_icon("voice_icon"), + fly_icon("fly_icon"), + push_icon("push_icon"), + build_icon("build_icon"), + scripts_icon("scripts_icon"), + damage_icon("damage_icon"), + damage_text("damage_text") { } LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) : LLComboBox(p), - mAddLandmarkHPad(p.add_landmark_hpad), + mIconHPad(p.icon_hpad), mInfoBtn(NULL), mLocationContextMenu(NULL), mAddLandmarkBtn(NULL), @@ -188,13 +196,12 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) params.rect(text_entry_rect); params.default_text(LLStringUtil::null); params.max_length_bytes(p.max_chars); - params.commit_callback.function(boost::bind(&LLComboBox::onTextCommit, this, _2)); params.keystroke_callback(boost::bind(&LLComboBox::onTextEntry, this, _1)); params.handle_edit_keys_directly(true); params.commit_on_focus_lost(false); params.follows.flags(FOLLOWS_ALL); mTextEntry = LLUICtrlFactory::create<LLURLLineEditor>(params); - this->addChild(mTextEntry); + addChild(mTextEntry); // LLLineEditor is replaced with LLLocationLineEditor // "Place information" button. @@ -230,6 +237,35 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p) mAddLandmarkBtn = LLUICtrlFactory::create<LLButton>(al_params); enableAddLandmarkButton(true); addChild(mAddLandmarkBtn); + + // Parcel property icons + LLIconCtrl::Params voice_icon = p.voice_icon; + mParcelIcon[VOICE_ICON] = LLUICtrlFactory::create<LLIconCtrl>(voice_icon); + addChild(mParcelIcon[VOICE_ICON]); + + LLIconCtrl::Params fly_icon = p.fly_icon; + mParcelIcon[FLY_ICON] = LLUICtrlFactory::create<LLIconCtrl>(fly_icon); + addChild(mParcelIcon[FLY_ICON]); + + LLIconCtrl::Params push_icon = p.push_icon; + mParcelIcon[PUSH_ICON] = LLUICtrlFactory::create<LLIconCtrl>(push_icon); + addChild(mParcelIcon[PUSH_ICON]); + + LLIconCtrl::Params build_icon = p.build_icon; + mParcelIcon[BUILD_ICON] = LLUICtrlFactory::create<LLIconCtrl>(build_icon); + addChild(mParcelIcon[BUILD_ICON]); + + LLIconCtrl::Params scripts_icon = p.scripts_icon; + mParcelIcon[SCRIPTS_ICON] = LLUICtrlFactory::create<LLIconCtrl>(scripts_icon); + addChild(mParcelIcon[SCRIPTS_ICON]); + + LLIconCtrl::Params damage_icon = p.damage_icon; + mParcelIcon[DAMAGE_ICON] = LLUICtrlFactory::create<LLIconCtrl>(damage_icon); + addChild(mParcelIcon[DAMAGE_ICON]); + + LLTextBox::Params damage_text = p.damage_text; + mDamageText = LLUICtrlFactory::create<LLTextBox>(damage_text); + addChild(mDamageText); // Register callbacks and load the location field context menu (NB: the order matters). LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Navbar.Action", boost::bind(&LLLocationInputCtrl::onLocationContextMenuItemClicked, this, _2)); @@ -373,11 +409,8 @@ void LLLocationInputCtrl::onTextEntry(LLLineEditor* line_editor) */ void LLLocationInputCtrl::setText(const LLStringExplicit& text) { - if (mTextEntry) - { - mTextEntry->setText(text); - mHasAutocompletedText = FALSE; - } + mTextEntry->setText(text); + mHasAutocompletedText = FALSE; } void LLLocationInputCtrl::setFocus(BOOL b) @@ -410,11 +443,20 @@ void LLLocationInputCtrl::onFocusLost() mTextEntry->deselect(); } } -void LLLocationInputCtrl::draw(){ - - if(!hasFocus() && gSavedSettings.getBOOL("ShowCoordinatesOption")){ + +void LLLocationInputCtrl::draw() +{ + static LLUICachedControl<bool> show_coords("NavBarShowCoordinates", false); + if(!hasFocus() && show_coords) + { refreshLocation(); } + + static LLUICachedControl<bool> show_icons("NavBarShowParcelProperties", false); + if (show_icons) + { + refreshHealth(); + } LLComboBox::draw(); } @@ -511,10 +553,12 @@ void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data) mList->mouseOverHighlightNthItem(-1); // Clear highlight on the last selected item. } + bool LLLocationInputCtrl::findTeleportItemsByTitle(const LLTeleportHistoryItem& item, const std::string& filter) { return item.mTitle.find(filter) != std::string::npos; } + void LLLocationInputCtrl::onTextEditorRightClicked(S32 x, S32 y, MASK mask) { if (mLocationContextMenu) @@ -532,6 +576,7 @@ void LLLocationInputCtrl::onTextEditorRightClicked(S32 x, S32 y, MASK mask) void LLLocationInputCtrl::refresh() { refreshLocation(); // update location string + refreshParcelIcons(); updateAddLandmarkButton(); // indicate whether current parcel has been landmarked } @@ -548,13 +593,98 @@ void LLLocationInputCtrl::refreshLocation() // Update location field. std::string location_name; - LLAgentUI::ELocationFormat format = (gSavedSettings.getBOOL("ShowCoordinatesOption") ? - LLAgentUI::LOCATION_FORMAT_WITHOUT_SIM: LLAgentUI::LOCATION_FORMAT_NORMAL); + LLAgentUI::ELocationFormat format = + (gSavedSettings.getBOOL("NavBarShowCoordinates") + ? LLAgentUI::LOCATION_FORMAT_FULL + : LLAgentUI::LOCATION_FORMAT_NO_COORDS); - if (!LLAgentUI::buildLocationString(location_name, format)) location_name = "Unknown"; + if (!LLAgentUI::buildLocationString(location_name, format)) + { + location_name = "???"; + } setText(location_name); } +void LLLocationInputCtrl::refreshParcelIcons() +{ + // Our "cursor" moving right to left + S32 x = mAddLandmarkBtn->getRect().mLeft - mIconHPad; + + static LLUICachedControl<bool> show_properties("NavBarShowParcelProperties", false); + if (show_properties) + { + LLViewerParcelMgr* vpm = LLViewerParcelMgr::getInstance(); + // *TODO buy + //bool allow_buy = vpm->canAgentBuyParcel( vpm->getAgentParcel(), false); + bool allow_voice = vpm->allowAgentVoice(); + bool allow_fly = vpm->allowAgentFly(); + bool allow_push = vpm->allowAgentPush(); + bool allow_build = vpm->allowAgentBuild(); + bool allow_scripts = vpm->allowAgentScripts(); + bool allow_damage = vpm->allowAgentDamage(); + + // Most icons are "block this ability" + mParcelIcon[VOICE_ICON]->setVisible( !allow_voice ); + mParcelIcon[FLY_ICON]->setVisible( !allow_fly ); + mParcelIcon[PUSH_ICON]->setVisible( !allow_push ); + mParcelIcon[BUILD_ICON]->setVisible( !allow_build ); + mParcelIcon[SCRIPTS_ICON]->setVisible( !allow_scripts ); + mParcelIcon[DAMAGE_ICON]->setVisible( allow_damage ); + mDamageText->setVisible(allow_damage); + + // Slide the parcel icons rect from right to left, adjusting rectangles of + // visible icons. Assumes all icon rects are the same. + for (S32 i = 0; i < ICON_COUNT; ++i) + { + LLIconCtrl* icon = mParcelIcon[i]; + if (icon->getVisible()) + { + LLRect r = icon->getRect(); + r.mLeft = x - r.getWidth(); + r.mRight = x; + icon->setRect( r ); + x -= r.getWidth() + mIconHPad; + } + } + LLRect text_rect = mDamageText->getRect(); + text_rect.mLeft = x - text_rect.getWidth(); + text_rect.mRight = x; + mDamageText->setRect(text_rect); + x -= text_rect.getWidth() + mIconHPad; + } + else + { + for (S32 i = 0; i < ICON_COUNT; ++i) + { + mParcelIcon[i]->setVisible(false); + } + mDamageText->setVisible(false); + } + + S32 left_pad, right_pad; + mTextEntry->getTextPadding(&left_pad, &right_pad); + right_pad = mTextEntry->getRect().mRight - x; + llinfos << "JAMESDEBUG text entry rect " << mTextEntry->getRect() + << " x " << x << " left_pad " << left_pad << " right_pad " << right_pad << llendl; + mTextEntry->setTextPadding(left_pad, right_pad); +} + +void LLLocationInputCtrl::refreshHealth() +{ + // *FIXME: Status bar owns health information, should be in agent + if (gStatusBar) + { + static S32 last_health = -1; + S32 health = gStatusBar->getHealth(); + if (health != last_health) + { + std::string text = llformat("%d%%", health); + mDamageText->setText(text); + last_health = health; + } + } +} + void LLLocationInputCtrl::rebuildLocationHistory(std::string filter) { LLLocationHistory::location_list_t filtered_items; @@ -651,13 +781,11 @@ void LLLocationInputCtrl::updateWidgetlayout() mInfoBtn->setRect(info_btn_rect); // "Add Landmark" button - { - LLRect al_btn_rect = mAddLandmarkBtn->getRect(); - al_btn_rect.translate( - hist_btn_rect.mLeft - mAddLandmarkHPad - al_btn_rect.getWidth(), - (rect.getHeight() - al_btn_rect.getHeight()) / 2); - mAddLandmarkBtn->setRect(al_btn_rect); - } + LLRect al_btn_rect = mAddLandmarkBtn->getRect(); + al_btn_rect.translate( + hist_btn_rect.mLeft - mIconHPad - al_btn_rect.getWidth(), + (rect.getHeight() - al_btn_rect.getHeight()) / 2); + mAddLandmarkBtn->setRect(al_btn_rect); } void LLLocationInputCtrl::changeLocationPresentation() @@ -678,11 +806,17 @@ void LLLocationInputCtrl::onLocationContextMenuItemClicked(const LLSD& userdata) { std::string item = userdata.asString(); - if (item == std::string("show_coordinates")) + if (item == "show_coordinates") + { + gSavedSettings.setBOOL("NavBarShowCoordinates",!gSavedSettings.getBOOL("NavBarShowCoordinates")); + } + else if (item == "show_properties") { - gSavedSettings.setBOOL("ShowCoordinatesOption",!gSavedSettings.getBOOL("ShowCoordinatesOption")); + gSavedSettings.setBOOL("NavBarShowParcelProperties", + !gSavedSettings.getBOOL("NavBarShowParcelProperties")); + refreshParcelIcons(); } - else if (item == std::string("landmark")) + else if (item == "landmark") { LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos(); @@ -696,23 +830,23 @@ void LLLocationInputCtrl::onLocationContextMenuItemClicked(const LLSD& userdata) LLSD().insert("type", "landmark").insert("id",landmark->getUUID())); } } - else if (item == std::string("cut")) + else if (item == "cut") { mTextEntry->cut(); } - else if (item == std::string("copy")) + else if (item == "copy") { mTextEntry->copy(); } - else if (item == std::string("paste")) + else if (item == "paste") { mTextEntry->paste(); } - else if (item == std::string("delete")) + else if (item == "delete") { mTextEntry->deleteSelection(); } - else if (item == std::string("select_all")) + else if (item == "select_all") { mTextEntry->selectAll(); } @@ -722,29 +856,29 @@ bool LLLocationInputCtrl::onLocationContextMenuItemEnabled(const LLSD& userdata) { std::string item = userdata.asString(); - if (item == std::string("can_cut")) + if (item == "can_cut") { return mTextEntry->canCut(); } - else if (item == std::string("can_copy")) + else if (item == "can_copy") { return mTextEntry->canCopy(); } - else if (item == std::string("can_paste")) + else if (item == "can_paste") { return mTextEntry->canPaste(); } - else if (item == std::string("can_delete")) + else if (item == "can_delete") { return mTextEntry->canDeselect(); } - else if (item == std::string("can_select_all")) + else if (item == "can_select_all") { return mTextEntry->canSelectAll(); } - else if(item == std::string("show_coordinates")){ - - return gSavedSettings.getBOOL("ShowCoordinatesOption"); + else if(item == "show_coordinates") + { + return gSavedSettings.getBOOL("NavBarShowCoordinates"); } return false; diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index 44dc0cb251..3bd23e80a9 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -33,7 +33,9 @@ #ifndef LL_LLLOCATIONINPUTCTRL_H #define LL_LLLOCATIONINPUTCTRL_H -#include <llcombobox.h> +#include "llcombobox.h" +#include "lliconctrl.h" // Params +#include "lltextbox.h" // Params class LLLandmark; @@ -63,9 +65,16 @@ public: add_landmark_image_disabled, add_landmark_image_hover, add_landmark_image_selected; - Optional<S32> add_landmark_hpad; + Optional<S32> icon_hpad; Optional<LLButton::Params> add_landmark_button, info_button; + Optional<LLIconCtrl::Params> voice_icon, + fly_icon, + push_icon, + build_icon, + scripts_icon, + damage_icon; + Optional<LLTextBox::Params> damage_text; Params(); }; @@ -103,6 +112,10 @@ private: void enableAddLandmarkButton(bool val); void refresh(); void refreshLocation(); + void refreshParcelIcons(); + // Refresh the value in the health percentage text field + void refreshHealth(); + void rebuildLocationHistory(std::string filter = ""); bool findTeleportItemsByTitle(const LLTeleportHistoryItem& item, const std::string& filter); void setText(const LLStringExplicit& text); @@ -126,7 +139,20 @@ private: LLMenuGL* mLocationContextMenu; LLButton* mAddLandmarkBtn; LLButton* mInfoBtn; - S32 mAddLandmarkHPad; + S32 mIconHPad; + + enum EParcelIcon + { + VOICE_ICON = 0, + FLY_ICON, + PUSH_ICON, + BUILD_ICON, + SCRIPTS_ICON, + DAMAGE_ICON, + ICON_COUNT + }; + LLIconCtrl* mParcelIcon[ICON_COUNT]; + LLTextBox* mDamageText; LLAddLandmarkObserver* mAddLandmarkObserver; LLRemoveLandmarkObserver* mRemoveLandmarkObserver; diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 5cd40273f6..2376a3581d 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -356,7 +356,7 @@ void LLMediaCtrl::onFocusLost() // BOOL LLMediaCtrl::postBuild () { - mVisibleSignal.connect(boost::bind(&LLMediaCtrl::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChange, this, _2)); return TRUE; } diff --git a/indra/newview/llmediadataclient.cpp b/indra/newview/llmediadataclient.cpp index badef4c7ae..3c337961e1 100755 --- a/indra/newview/llmediadataclient.cpp +++ b/indra/newview/llmediadataclient.cpp @@ -260,7 +260,8 @@ void LLMediaDataClient::Responder::result(const LLSD& content) // ////////////////////////////////////////////////////////////////////////////////////// -bool LLMediaDataClient::Comparator::operator() (const request_ptr_t &o1, const request_ptr_t &o2) const +// static +bool LLMediaDataClient::compareRequests(const request_ptr_t &o1, const request_ptr_t &o2) { if (o2.isNull()) return true; if (o1.isNull()) return false; @@ -277,20 +278,13 @@ bool LLMediaDataClient::Comparator::operator() (const request_ptr_t &o1, const r // 3: One item with an impl, another without: item with impl wins // (XXX is that what we want?) // Calculate the scores for each. - F64 o1_score = Comparator::getObjectScore(o1->getObject()); - F64 o2_score = Comparator::getObjectScore(o2->getObject()); - - // XXX Weird: a higher score should go earlier, but by observation I notice - // that this causes further-away objects load first. This is counterintuitive - // to the priority_queue Comparator, which states that this function should - // return 'true' if o1 should be *before* o2. - // In other words, I'd have expected that the following should return - // ( o1_score > o2_score). - return ( o1_score < o2_score ); + F64 o1_score = getObjectScore(o1->getObject()); + F64 o2_score = getObjectScore(o2->getObject()); + return ( o1_score > o2_score ); } - + // static -F64 LLMediaDataClient::Comparator::getObjectScore(const LLMediaDataClientObject::ptr_t &obj) +F64 LLMediaDataClient::getObjectScore(const LLMediaDataClientObject::ptr_t &obj) { // *TODO: make this less expensive? F64 dist = obj->getDistanceFromAvatar() + 0.1; // avoids div by 0 @@ -310,12 +304,12 @@ F64 LLMediaDataClient::Comparator::getObjectScore(const LLMediaDataClientObject: ////////////////////////////////////////////////////////////////////////////////////// // dump the queue -std::ostream& operator<<(std::ostream &s, const LLMediaDataClient::PriorityQueue &q) +std::ostream& operator<<(std::ostream &s, const LLMediaDataClient::request_queue_t &q) { int i = 0; - std::vector<LLMediaDataClient::request_ptr_t>::const_iterator iter = q.c.begin(); - std::vector<LLMediaDataClient::request_ptr_t>::const_iterator end = q.c.end(); - while (iter < end) + LLMediaDataClient::request_queue_t::const_iterator iter = q.begin(); + LLMediaDataClient::request_queue_t::const_iterator end = q.end(); + while (iter != end) { s << "\t" << i << "]: " << (*iter)->getObject()->getID().asString(); iter++; @@ -325,11 +319,11 @@ std::ostream& operator<<(std::ostream &s, const LLMediaDataClient::PriorityQueue } // find the given object in the queue. -bool LLMediaDataClient::PriorityQueue::find(const LLMediaDataClientObject::ptr_t &obj) const +bool LLMediaDataClient::find(const LLMediaDataClientObject::ptr_t &obj) const { - std::vector<LLMediaDataClient::request_ptr_t>::const_iterator iter = c.begin(); - std::vector<LLMediaDataClient::request_ptr_t>::const_iterator end = c.end(); - while (iter < end) + request_queue_t::const_iterator iter = pRequestQueue->begin(); + request_queue_t::const_iterator end = pRequestQueue->end(); + while (iter != end) { if (obj->getID() == (*iter)->getObject()->getID()) { @@ -370,13 +364,17 @@ BOOL LLMediaDataClient::QueueTimer::tick() return TRUE; } - LLMediaDataClient::PriorityQueue &queue = *(mMDC->pRequestQueue); + request_queue_t &queue = *(mMDC->pRequestQueue); if(!queue.empty()) { LL_INFOS("LLMediaDataClient") << "QueueTimer::tick() started, queue is: " << queue << LL_ENDL; - } + // Re-sort the list every time... + // XXX Is this really what we want? + queue.sort(LLMediaDataClient::compareRequests); + } + // quick retry loop for cases where we shouldn't wait for the next timer tick while(true) { @@ -387,7 +385,7 @@ BOOL LLMediaDataClient::QueueTimer::tick() } // Peel one off of the items from the queue, and execute request - request_ptr_t request = queue.top(); + request_ptr_t request = queue.front(); llassert(!request.isNull()); const LLMediaDataClientObject *object = (request.isNull()) ? NULL : request->getObject(); bool performed_request = false; @@ -398,7 +396,7 @@ BOOL LLMediaDataClient::QueueTimer::tick() { // This object has been marked dead. Pop it and move on to the next item in the queue immediately. LL_INFOS("LLMediaDataClient") << "Skipping " << *request << ": object is dead!" << LL_ENDL; - queue.pop(); + queue.pop_front(); continue; // jump back to the start of the quick retry loop } @@ -442,7 +440,7 @@ BOOL LLMediaDataClient::QueueTimer::tick() << mMDC->mMaxNumRetries << " tries...popping object id " << object->getID() << LL_ENDL; // XXX Should we bring up a warning dialog?? } - queue.pop(); + queue.pop_front(); } else { request->incRetryCount(); @@ -451,7 +449,7 @@ BOOL LLMediaDataClient::QueueTimer::tick() // end of quick retry loop -- any cases where we want to loop will use 'continue' to jump back to the start. break; } - + LL_DEBUGS("LLMediaDataClient") << "QueueTimer::tick() finished, queue is now: " << (*(mMDC->pRequestQueue)) << LL_ENDL; return queue.empty(); @@ -488,7 +486,7 @@ void LLMediaDataClient::enqueue(const Request *request) LL_INFOS("LLMediaDataClient") << "Queuing request for " << *request << LL_ENDL; // Push the request on the priority queue // Sadly, we have to const-cast because items put into the queue are not const - pRequestQueue->push(const_cast<LLMediaDataClient::Request*>(request)); + pRequestQueue->push_back(const_cast<LLMediaDataClient::Request*>(request)); LL_DEBUGS("LLMediaDataClient") << "Queue:" << (*pRequestQueue) << LL_ENDL; // Start the timer if not already running startQueueTimer(); @@ -508,7 +506,7 @@ LLMediaDataClient::LLMediaDataClient(F32 queue_timer_delay, mMaxNumRetries(max_retries), mQueueTimerIsRunning(false) { - pRequestQueue = new PriorityQueue(); + pRequestQueue = new request_queue_t(); } LLMediaDataClient::~LLMediaDataClient() @@ -529,7 +527,7 @@ bool LLMediaDataClient::isEmpty() const bool LLMediaDataClient::isInQueue(const LLMediaDataClientObject::ptr_t &object) const { - return (NULL == pRequestQueue) ? false : pRequestQueue->find(object); + return (NULL == pRequestQueue) ? false : find(object); } ////////////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llmediadataclient.h b/indra/newview/llmediadataclient.h index d5dd050111..812e9cbdec 100755 --- a/indra/newview/llmediadataclient.h +++ b/indra/newview/llmediadataclient.h @@ -195,30 +195,14 @@ protected: private: - // Comparator for PriorityQueue - class Comparator - { - public: - bool operator() (const request_ptr_t &o1, const request_ptr_t &o2) const; - private: - static F64 getObjectScore(const LLMediaDataClientObject::ptr_t &obj); - }; + typedef std::list<request_ptr_t> request_queue_t; - // PriorityQueue - class PriorityQueue : public std::priority_queue< - request_ptr_t, - std::vector<request_ptr_t>, - Comparator > - { - public: - // Return whether the given object is in the queue - bool find(const LLMediaDataClientObject::ptr_t &obj) const; - - friend std::ostream& operator<<(std::ostream &s, const PriorityQueue &q); - }; + // Comparator for sorting + static bool compareRequests(const request_ptr_t &o1, const request_ptr_t &o2); + static F64 getObjectScore(const LLMediaDataClientObject::ptr_t &obj); friend std::ostream& operator<<(std::ostream &s, const Request &q); - friend std::ostream& operator<<(std::ostream &s, const PriorityQueue &q); + friend std::ostream& operator<<(std::ostream &s, const request_queue_t &q); class QueueTimer : public LLEventTimer { @@ -232,6 +216,9 @@ private: LLPointer<LLMediaDataClient> mMDC; }; + // Return whether the given object is in the queue + bool find(const LLMediaDataClientObject::ptr_t &obj) const; + void startQueueTimer(); void stopQueueTimer(); void setIsRunning(bool val) { mQueueTimerIsRunning = val; } @@ -242,7 +229,7 @@ private: bool mQueueTimerIsRunning; - PriorityQueue *pRequestQueue; + request_queue_t *pRequestQueue; }; diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp index 93db337053..9e46a4422a 100644 --- a/indra/newview/llmoveview.cpp +++ b/indra/newview/llmoveview.cpp @@ -586,7 +586,8 @@ void LLPanelStandStopFlying::setVisible(BOOL visible) updatePosition(); } - LLPanel::setVisible(visible); + //change visibility of parent layout_panel to animate in/out + if (getParent()) getParent()->setVisible(visible); } BOOL LLPanelStandStopFlying::handleToolTip(S32 x, S32 y, MASK mask) diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp index 114d26af8a..41376c4c09 100644 --- a/indra/newview/llnavigationbar.cpp +++ b/indra/newview/llnavigationbar.cpp @@ -172,7 +172,8 @@ LLNavigationBar::LLNavigationBar() mBtnHome(NULL), mCmbLocation(NULL), mSearchComboBox(NULL), - mPurgeTPHistoryItems(false) + mPurgeTPHistoryItems(false), + mSaveToLocationHistory(false) { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_navigation_bar.xml"); @@ -186,6 +187,7 @@ LLNavigationBar::LLNavigationBar() LLNavigationBar::~LLNavigationBar() { mTeleportFinishConnection.disconnect(); + mTeleportFailedConnection.disconnect(); } BOOL LLNavigationBar::postBuild() @@ -220,6 +222,12 @@ BOOL LLNavigationBar::postBuild() mSearchComboBox->setCommitCallback(boost::bind(&LLNavigationBar::onSearchCommit, this)); + mTeleportFinishConnection = LLViewerParcelMgr::getInstance()-> + setTeleportFinishedCallback(boost::bind(&LLNavigationBar::onTeleportFinished, this, _1)); + + mTeleportFailedConnection = LLViewerParcelMgr::getInstance()-> + setTeleportFailedCallback(boost::bind(&LLNavigationBar::onTeleportFailed, this)); + mDefaultNbRect = getRect(); mDefaultFpRect = getChild<LLFavoritesBarCtrl>("favorite")->getRect(); @@ -230,6 +238,16 @@ BOOL LLNavigationBar::postBuild() return TRUE; } +void LLNavigationBar::setVisible(BOOL visible) +{ + // change visibility of grandparent layout_panel to animate in and out + if (getParent() && getParent()->getParent()) + { + getParent()->getParent()->setVisible(visible); + } +} + + void LLNavigationBar::fillSearchComboBox() { if(!mSearchComboBox) @@ -395,15 +413,19 @@ void LLNavigationBar::onLocationSelection() LLWorldMapMessage::url_callback_t cb = boost::bind( &LLNavigationBar::onRegionNameResponse, this, typed_location, region_name, local_coords, _1, _2, _3, _4); - // connect the callback each time, when user enter new location to get real location of agent after teleport - mTeleportFinishConnection = LLViewerParcelMgr::getInstance()-> - setTeleportFinishedCallback(boost::bind(&LLNavigationBar::onTeleportFinished, this, _1,typed_location)); + mSaveToLocationHistory = true; LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name, cb, std::string("unused"), false); } -void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos, const std::string& typed_location) +void LLNavigationBar::onTeleportFailed() { - // Location is valid. Add it to the typed locations history. + mSaveToLocationHistory = false; +} + +void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos) +{ + if (!mSaveToLocationHistory) + return; LLLocationHistory* lh = LLLocationHistory::getInstance(); //TODO*: do we need convert surl into readable format? @@ -413,7 +435,7 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos, con * At this moment gAgent.getPositionAgent() contains previous coordinates. * according to EXT-65 agent position is being reseted on each frame. */ - LLAgentUI::buildLocationString(location, LLAgentUI::LOCATION_FORMAT_WITHOUT_SIM, + LLAgentUI::buildLocationString(location, LLAgentUI::LOCATION_FORMAT_NO_MATURITY, gAgent.getPosAgentFromGlobal(global_agent_pos)); std::string tooltip (LLSLURL::buildSLURLfromPosGlobal(gAgent.getRegion()->getName(), global_agent_pos, false)); @@ -426,8 +448,7 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos, con lh->save(); - if(mTeleportFinishConnection.connected()) - mTeleportFinishConnection.disconnect(); + mSaveToLocationHistory = false; } diff --git a/indra/newview/llnavigationbar.h b/indra/newview/llnavigationbar.h index 52f5a827e4..9d0687f193 100644 --- a/indra/newview/llnavigationbar.h +++ b/indra/newview/llnavigationbar.h @@ -56,6 +56,7 @@ public: /*virtual*/ void draw(); /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL postBuild(); + /*virtual*/ void setVisible(BOOL visible); void handleLoginComplete(); void clearHistoryCache(); @@ -81,7 +82,8 @@ private: void onLocationSelection(); void onLocationPrearrange(const LLSD& data); void onSearchCommit(); - void onTeleportFinished(const LLVector3d& global_agent_pos, const std::string& typed_location); + void onTeleportFinished(const LLVector3d& global_agent_pos); + void onTeleportFailed(); void onRegionNameResponse( std::string typed_location, std::string region_name, @@ -99,8 +101,11 @@ private: LLLocationInputCtrl* mCmbLocation; LLRect mDefaultNbRect; LLRect mDefaultFpRect; + boost::signals2::connection mTeleportFailedConnection; boost::signals2::connection mTeleportFinishConnection; bool mPurgeTPHistoryItems; + // if true, save location to location history when teleport finishes + bool mSaveToLocationHistory; }; #endif diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 09fd9b2949..80a6cc343f 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -173,7 +173,7 @@ void LLNearbyChat::addMessage(const LLChat& chat) append_style_params.font.style = "ITALIC"; LLChat add_chat=chat; add_chat.mText = chat.mFromName + " "; - mChatHistory->appendWidgetMessage(add_chat, append_style_params); + mChatHistory->appendMessage(add_chat, false, append_style_params); } message = message.substr(3); @@ -182,7 +182,7 @@ void LLNearbyChat::addMessage(const LLChat& chat) } else { - mChatHistory->appendWidgetMessage(chat); + mChatHistory->appendMessage(chat); } } } diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp index 4be98201d1..f01f2e4441 100644 --- a/indra/newview/llnotificationscripthandler.cpp +++ b/indra/newview/llnotificationscripthandler.cpp @@ -38,9 +38,13 @@ #include "llviewercontrol.h" #include "llviewerwindow.h" #include "llnotificationmanager.h" +#include "llscriptfloater.h" using namespace LLNotificationsUI; +static const std::string SCRIPT_DIALOG ("ScriptDialog"); +static const std::string SCRIPT_DIALOG_GROUP ("ScriptDialogGroup"); + //-------------------------------------------------------------------------- LLScriptHandler::LLScriptHandler(e_notification_type type, const LLSD& id) { @@ -90,25 +94,40 @@ bool LLScriptHandler::processNotification(const LLSD& notify) if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change") { - LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification); - - LLToast::Params p; - p.notif_id = notification->getID(); - p.notification = notification; - p.panel = notify_box; - p.on_delete_toast = boost::bind(&LLScriptHandler::onDeleteToast, this, _1); - - LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel); - if(channel) - channel->addToast(p); - - // send a signal to the counter manager - mNewNotificationSignal(); - + if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName()) + { + LLScriptFloaterManager::getInstance()->onAddNotification(notification->getID()); + } + else + { + LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification); + + LLToast::Params p; + p.notif_id = notification->getID(); + p.notification = notification; + p.panel = notify_box; + p.on_delete_toast = boost::bind(&LLScriptHandler::onDeleteToast, this, _1); + + LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel); + if(channel) + { + channel->addToast(p); + } + + // send a signal to the counter manager + mNewNotificationSignal(); + } } else if (notify["sigtype"].asString() == "delete") { - mChannel->killToastByNotificationID(notification->getID()); + if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName()) + { + LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID()); + } + else + { + mChannel->killToastByNotificationID(notification->getID()); + } } return true; } @@ -123,6 +142,14 @@ void LLScriptHandler::onDeleteToast(LLToast* toast) // send a signal to a listener to let him perform some action // in this case listener is a SysWellWindow and it will remove a corresponding item from its list mNotificationIDSignal(toast->getNotificationID()); + + LLNotificationPtr notification = LLNotifications::getInstance()->find(toast->getNotificationID()); + + if( notification && + (SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName()) ) + { + LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID()); + } } //-------------------------------------------------------------------------- diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 03401d934f..f29a7b25a7 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -120,7 +120,7 @@ BOOL LLDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, static LLDefaultChildRegistry::Register<LLDropTarget> r("drop_target"); static LLRegisterPanelClassWrapper<LLPanelAvatarProfile> t_panel_profile("panel_profile"); -static LLRegisterPanelClassWrapper<LLPanelAvatarMeProfile> t_panel_me_profile("panel_me_profile"); +static LLRegisterPanelClassWrapper<LLPanelMyProfile> t_panel_my_profile("panel_my_profile"); static LLRegisterPanelClassWrapper<LLPanelAvatarNotes> t_panel_notes("panel_notes"); //----------------------------------------------------------------------------- @@ -340,6 +340,7 @@ BOOL LLPanelAvatarProfile::postBuild() LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; registrar.add("Profile.Pay", boost::bind(&LLPanelAvatarProfile::pay, this)); + registrar.add("Profile.Share", boost::bind(&LLPanelAvatarProfile::share, this)); mProfileMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_profile_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); @@ -359,7 +360,7 @@ void LLPanelAvatarProfile::onOpen(const LLSD& key) { LLPanelProfileTab::onOpen(key); - mGroups.erase(); + mGroups.clear(); //Disable "Add Friend" button for friends. childSetEnabled("add_friend", !LLAvatarActions::isFriend(getAvatarId())); @@ -391,7 +392,7 @@ void LLPanelAvatarProfile::resetControls() void LLPanelAvatarProfile::resetData() { - mGroups.erase(); + mGroups.clear(); childSetValue("2nd_life_pic",LLUUID::null); childSetValue("real_world_pic",LLUUID::null); childSetValue("online_status",LLStringUtil::null); @@ -443,23 +444,29 @@ void LLPanelAvatarProfile::processGroupProperties(const LLAvatarGroups* avatar_g // Group properties may arrive in two callbacks, we need to save them across // different calls. We can't do that in textbox as textbox may change the text. - std::string groups = mGroups; LLAvatarGroups::group_list_t::const_iterator it = avatar_groups->group_list.begin(); const LLAvatarGroups::group_list_t::const_iterator it_end = avatar_groups->group_list.end(); - if(groups.empty() && it_end != it) - { - groups = (*it).group_name; - ++it; - } for(; it_end != it; ++it) { LLAvatarGroups::LLGroupData group_data = *it; - groups += ", "; - groups += group_data.group_name; + + // Check if there is no duplicates for this group + if (std::find(mGroups.begin(), mGroups.end(), group_data.group_name) == mGroups.end()) + mGroups.push_back(group_data.group_name); } - mGroups = groups; - childSetValue("sl_groups",mGroups); + + // Creating string, containing group list + std::string groups = ""; + for (group_list_t::const_iterator it = mGroups.begin(); it != mGroups.end(); ++it) + { + if (it != mGroups.begin()) + groups += ", "; + + groups += *it; + } + + childSetValue("sl_groups", groups); } void LLPanelAvatarProfile::fillCommonData(const LLAvatarData* avatar_data) @@ -529,6 +536,11 @@ void LLPanelAvatarProfile::pay() LLAvatarActions::pay(getAvatarId()); } +void LLPanelAvatarProfile::share() +{ + LLAvatarActions::share(getAvatarId()); +} + void LLPanelAvatarProfile::onUrlTextboxClicked(const std::string& url) { LLWeb::loadURL(url); @@ -589,19 +601,19 @@ void LLPanelAvatarProfile::onOverflowButtonClicked() ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// -LLPanelAvatarMeProfile::LLPanelAvatarMeProfile() +LLPanelMyProfile::LLPanelMyProfile() : LLPanelAvatarProfile() { } -BOOL LLPanelAvatarMeProfile::postBuild() +BOOL LLPanelMyProfile::postBuild() { LLPanelAvatarProfile::postBuild(); mStatusCombobox = getChild<LLComboBox>("status_combo"); - childSetCommitCallback("status_combo", boost::bind(&LLPanelAvatarMeProfile::onStatusChanged, this), NULL); - childSetCommitCallback("status_me_message_text", boost::bind(&LLPanelAvatarMeProfile::onStatusMessageChanged, this), NULL); + childSetCommitCallback("status_combo", boost::bind(&LLPanelMyProfile::onStatusChanged, this), NULL); + childSetCommitCallback("status_me_message_text", boost::bind(&LLPanelMyProfile::onStatusMessageChanged, this), NULL); resetControls(); resetData(); @@ -609,12 +621,12 @@ BOOL LLPanelAvatarMeProfile::postBuild() return TRUE; } -void LLPanelAvatarMeProfile::onOpen(const LLSD& key) +void LLPanelMyProfile::onOpen(const LLSD& key) { LLPanelProfileTab::onOpen(key); } -void LLPanelAvatarMeProfile::processProfileProperties(const LLAvatarData* avatar_data) +void LLPanelMyProfile::processProfileProperties(const LLAvatarData* avatar_data) { fillCommonData(avatar_data); @@ -625,7 +637,7 @@ void LLPanelAvatarMeProfile::processProfileProperties(const LLAvatarData* avatar fillAccountStatus(avatar_data); } -void LLPanelAvatarMeProfile::fillStatusData(const LLAvatarData* avatar_data) +void LLPanelMyProfile::fillStatusData(const LLAvatarData* avatar_data) { std::string status; if (gAgent.getAFK()) @@ -644,7 +656,7 @@ void LLPanelAvatarMeProfile::fillStatusData(const LLAvatarData* avatar_data) mStatusCombobox->setValue(status); } -void LLPanelAvatarMeProfile::resetControls() +void LLPanelMyProfile::resetControls() { childSetVisible("status_panel", false); childSetVisible("profile_buttons_panel", false); @@ -654,7 +666,7 @@ void LLPanelAvatarMeProfile::resetControls() childSetVisible("profile_me_buttons_panel", true); } -void LLPanelAvatarMeProfile::onStatusChanged() +void LLPanelMyProfile::onStatusChanged() { LLSD::String status = mStatusCombobox->getValue().asString(); @@ -676,7 +688,7 @@ void LLPanelAvatarMeProfile::onStatusChanged() } } -void LLPanelAvatarMeProfile::onStatusMessageChanged() +void LLPanelMyProfile::onStatusMessageChanged() { updateData(); } diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index a0caf0c915..527e1c0d34 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -47,7 +47,7 @@ enum EOnlineStatus }; /** -* Base class for any Profile View or Me Profile Panel. +* Base class for any Profile View or My Profile Panel. */ class LLPanelProfileTab : public LLPanel @@ -148,7 +148,7 @@ protected: virtual void processGroupProperties(const LLAvatarGroups* avatar_groups); /** - * Fills common for Avatar profile and Me Profile fields. + * Fills common for Avatar profile and My Profile fields. */ virtual void fillCommonData(const LLAvatarData* avatar_data); @@ -172,6 +172,11 @@ protected: */ void pay(); + /** + * opens inventory and IM for sharing items + */ + void share(); + void onUrlTextboxClicked(const std::string& url); void onHomepageTextboxClicked(); void onAddFriendButtonClick(); @@ -183,18 +188,20 @@ protected: private: - std::string mGroups; + typedef std::list<std::string> group_list_t; + group_list_t mGroups; + LLToggleableMenu* mProfileMenu; }; /** * Panel for displaying own first and second life related info. */ -class LLPanelAvatarMeProfile +class LLPanelMyProfile : public LLPanelAvatarProfile { public: - LLPanelAvatarMeProfile(); + LLPanelMyProfile(); /*virtual*/ BOOL postBuild(); diff --git a/indra/newview/llpanelavatartag.cpp b/indra/newview/llpanelavatartag.cpp index 03ad19f911..7563cc7f61 100644 --- a/indra/newview/llpanelavatartag.cpp +++ b/indra/newview/llpanelavatartag.cpp @@ -92,7 +92,7 @@ void LLPanelAvatarTag::setAvatarId(const LLUUID& avatar_id) boost::signals2::connection LLPanelAvatarTag::setLeftButtonClickCallback( const commit_callback_t& cb) { - return mCommitSignal.connect(cb); + return setCommitCallback(cb); } BOOL LLPanelAvatarTag::handleMouseDown(S32 x, S32 y, MASK mask) diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp index 40319d949d..fa6d16cfb1 100644 --- a/indra/newview/llpanelimcontrolpanel.cpp +++ b/indra/newview/llpanelimcontrolpanel.cpp @@ -160,13 +160,7 @@ void LLPanelIMControlPanel::onAddFriendButtonClicked() void LLPanelIMControlPanel::onShareButtonClicked() { - LLSD key; - LLSideTray::getInstance()->showPanel("sidepanel_inventory", key); - - if (gIMMgr->hasSession(getSessionId())) - { - LLIMModel::getInstance()->addMessage(getSessionId(), SYSTEM_FROM, LLUUID::null, LLTrans::getString("share_alert"), false); - } + LLAvatarActions::share(mAvatarID); } void LLPanelIMControlPanel::setSessionId(const LLUUID& session_id) diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 10b419dfdb..e24fa14e1e 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -67,6 +67,27 @@ static const std::string TRASH_BUTTON_NAME = "trash_btn"; // helper functions static void filter_list(LLInventorySubTreePanel* inventory_list, const std::string& string); +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLLandmarksPanelObserver +// +// Bridge to support knowing when the inventory has changed to update +// landmarks accordions visibility. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLLandmarksPanelObserver : public LLInventoryObserver +{ +public: + LLLandmarksPanelObserver(LLLandmarksPanel* lp) : mLP(lp) {} + virtual ~LLLandmarksPanelObserver() {} + /*virtual*/ void changed(U32 mask); + +private: + LLLandmarksPanel* mLP; +}; + +void LLLandmarksPanelObserver::changed(U32 mask) +{ + mLP->updateFilteredAccordions(); +} LLLandmarksPanel::LLLandmarksPanel() : LLPanelPlacesTab() @@ -80,11 +101,16 @@ LLLandmarksPanel::LLLandmarksPanel() , mGearLandmarkMenu(NULL) , mDirtyFilter(false) { + mInventoryObserver = new LLLandmarksPanelObserver(this); + gInventory.addObserver(mInventoryObserver); + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_landmarks.xml"); } LLLandmarksPanel::~LLLandmarksPanel() { + if (gInventory.containsObserver(mInventoryObserver)) + gInventory.removeObserver(mInventoryObserver); } BOOL LLLandmarksPanel::postBuild() @@ -135,8 +161,14 @@ void LLLandmarksPanel::onSearchEdit(const std::string& string) LLAccordionCtrlTab* tab = *iter; tab->setVisible(true); - // expand accordion to see matched items in all ones. See EXT-2014. + // expand accordion to see matched items in each one. See EXT-2014. tab->changeOpenClose(false); + + // refresh all accordions to display their contents in case of less restrictive filter + LLInventorySubTreePanel* inventory_list = dynamic_cast<LLInventorySubTreePanel*>(tab->getAccordionView()); + if (NULL == inventory_list) continue; + LLFolderView* fv = inventory_list->getRootFolder(); + fv->refresh(); } } @@ -223,6 +255,31 @@ void LLLandmarksPanel::onSelectorButtonClicked() } } +void LLLandmarksPanel::updateFilteredAccordions() +{ + LLInventoryPanel* inventory_list = NULL; + LLAccordionCtrlTab* accordion_tab = NULL; + for (accordion_tabs_t::const_iterator iter = mAccordionTabs.begin(); iter != mAccordionTabs.end(); ++iter) + { + accordion_tab = *iter; + inventory_list = dynamic_cast<LLInventorySubTreePanel*> (accordion_tab->getAccordionView()); + if (NULL == inventory_list) continue; + LLFolderView* fv = inventory_list->getRootFolder(); + + bool has_descendants = fv->hasFilteredDescendants(); + + accordion_tab->setVisible(has_descendants); + } + + // we have to arrange accordion tabs for cases when filter string is less restrictive but + // all items are still filtered. + static LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("landmarks_accordion"); + accordion->arrange(); + + // now filter state is applied to accordion tabs + mDirtyFilter = false; +} + ////////////////////////////////////////////////////////////////////////// // PROTECTED METHODS ////////////////////////////////////////////////////////////////////////// @@ -833,31 +890,6 @@ void LLLandmarksPanel::doIdle(void* landmarks_panel) } -void LLLandmarksPanel::updateFilteredAccordions() -{ - LLInventoryPanel* inventory_list = NULL; - LLAccordionCtrlTab* accordion_tab = NULL; - for (accordion_tabs_t::const_iterator iter = mAccordionTabs.begin(); iter != mAccordionTabs.end(); ++iter) - { - accordion_tab = *iter; - inventory_list = dynamic_cast<LLInventorySubTreePanel*> (accordion_tab->getAccordionView()); - if (NULL == inventory_list) continue; - LLFolderView* fv = inventory_list->getRootFolder(); - - bool has_visible_children = fv->hasVisibleChildren(); - - accordion_tab->setVisible(has_visible_children); - } - - // we have to arrange accordion tabs for cases when filter string is less restrictive but - // all items are still filtered. - static LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("landmarks_accordion"); - accordion->arrange(); - - // now filter state is applied to accordion tabs - mDirtyFilter = false; -} - void LLLandmarksPanel::doShowOnMap(LLLandmark* landmark) { LLVector3d landmark_global_pos; diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h index 777ee562d2..c65abc178b 100644 --- a/indra/newview/llpanellandmarks.h +++ b/indra/newview/llpanellandmarks.h @@ -46,6 +46,7 @@ class LLAccordionCtrlTab; class LLFolderViewItem; class LLMenuGL; class LLInventoryPanel; +class LLInventoryObserver; class LLInventorySubTreePanel; class LLLandmarksPanel : public LLPanelPlacesTab, LLRemoteParcelInfoObserver @@ -62,7 +63,14 @@ public: void onSelectionChange(LLInventorySubTreePanel* inventory_list, const std::deque<LLFolderViewItem*> &items, BOOL user_action); void onSelectorButtonClicked(); - + + /** + * Updates accordions according to filtered items in lists. + * + * It hides accordion for empty lists + */ + void updateFilteredAccordions(); + protected: /** * @return true - if current selected panel is not null and selected item is a landmark @@ -122,13 +130,6 @@ private: static void doIdle(void* landmarks_panel); /** - * Updates accordions according to filtered items in lists. - * - * It hides accordion for empty lists - */ - void updateFilteredAccordions(); - - /** * Landmark actions callbacks. Fire when a landmark is loaded from the list. */ void doShowOnMap(LLLandmark* landmark); @@ -147,6 +148,7 @@ private: LLMenuGL* mGearFolderMenu; LLMenuGL* mMenuAdd; LLInventorySubTreePanel* mCurrentSelectedList; + LLInventoryObserver* mInventoryObserver; LLPanel* mListCommands; bool mSortByDate; diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 78f3469f0e..ec0f8e303c 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -391,6 +391,10 @@ LLPanelLogin::~LLPanelLogin() //// We know we're done with the image, so be rid of it. //gTextureList.deleteImage( mLogoImage ); + + // Controls having keyboard focus by default + // must reset it on destroy. (EXT-2748) + gFocusMgr.setDefaultKeyboardFocus(NULL); } // virtual @@ -682,8 +686,6 @@ void LLPanelLogin::closePanel() if (sInstance) { gViewerWindow->getRootView()->removeChild( LLPanelLogin::sInstance ); - - gFocusMgr.setDefaultKeyboardFocus(NULL); delete sInstance; sInstance = NULL; diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp new file mode 100644 index 0000000000..046118cf75 --- /dev/null +++ b/indra/newview/llpanelme.cpp @@ -0,0 +1,272 @@ +/** + * @file llpanelme.cpp + * @brief Side tray "Me" (My Profile) panel + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llpanelprofile.h" +#include "llavatarconstants.h" +#include "llpanelme.h" +#include "llagent.h" +#include "llagentwearables.h" +#include "lliconctrl.h" +#include "llsidetray.h" +#include "lltabcontainer.h" +#include "lltexturectrl.h" + +#define PICKER_SECOND_LIFE "2nd_life_pic" +#define PICKER_FIRST_LIFE "real_world_pic" +#define PANEL_PROFILE "panel_profile" + +static LLRegisterPanelClassWrapper<LLPanelMyProfileEdit> t_panel_me_profile_edit("edit_profile_panel"); +static LLRegisterPanelClassWrapper<LLPanelMe> t_panel_me_profile("panel_me"); + +LLPanelMe::LLPanelMe(void) + : LLPanelProfile() + , mEditPanel(NULL) +{ + setAvatarId(gAgent.getID()); +} + +BOOL LLPanelMe::postBuild() +{ + LLPanelProfile::postBuild(); + + getTabContainer()[PANEL_PROFILE]->childSetAction("edit_profile_btn", boost::bind(&LLPanelMe::onEditProfileClicked, this), this); + getTabContainer()[PANEL_PROFILE]->childSetAction("edit_appearance_btn", boost::bind(&LLPanelMe::onEditAppearanceClicked, this), this); + + return TRUE; +} + +void LLPanelMe::onOpen(const LLSD& key) +{ + LLPanelProfile::onOpen(key); +} + +void LLPanelMe::notifyChildren(const LLSD& info) +{ + if (info.has("task-panel-action") && info["task-panel-action"].asString() == "handle-tri-state") + { + // Implement task panel tri-state behavior. + // + // When the button of an active open task panel is clicked, side tray + // calls notifyChildren() on the panel, passing task-panel-action=>handle-tri-state as an argument. + // The task panel is supposed to handle this by reverting to the default view, + // i.e. closing any dependent panels like "pick info" or "profile edit". + + bool on_default_view = true; + + const LLRect& task_panel_rect = getRect(); + for (LLView* child = getFirstChild(); child; child = findNextSibling(child)) + { + LLPanel* panel = dynamic_cast<LLPanel*>(child); + if (!panel) + continue; + + // *HACK: implement panel stack instead (e.g. me->pick_info->pick_edit). + if (panel->getRect().getWidth() == task_panel_rect.getWidth() && + panel->getRect().getHeight() == task_panel_rect.getHeight() && + panel->getVisible()) + { + panel->setVisible(FALSE); + on_default_view = false; + } + } + + if (on_default_view) + LLSideTray::getInstance()->collapseSideBar(); + + return; // this notification is only supposed to be handled by task panels + } + + LLPanel::notifyChildren(info); +} + +void LLPanelMe::buildEditPanel() +{ + if (NULL == mEditPanel) + { + mEditPanel = new LLPanelMyProfileEdit(); + mEditPanel->childSetAction("save_btn", boost::bind(&LLPanelMe::onSaveChangesClicked, this), this); + mEditPanel->childSetAction("cancel_btn", boost::bind(&LLPanelMe::onCancelClicked, this), this); + } +} + + +void LLPanelMe::onEditProfileClicked() +{ + buildEditPanel(); + togglePanel(mEditPanel, getAvatarId()); // open +} + +void LLPanelMe::onEditAppearanceClicked() +{ + if (gAgentWearables.areWearablesLoaded()) + { + gAgent.changeCameraToCustomizeAvatar(); + } +} + +void LLPanelMe::onSaveChangesClicked() +{ + LLAvatarData data = LLAvatarData(); + data.avatar_id = gAgent.getID(); + data.image_id = mEditPanel->getChild<LLTextureCtrl>(PICKER_SECOND_LIFE)->getImageAssetID(); + data.fl_image_id = mEditPanel->getChild<LLTextureCtrl>(PICKER_FIRST_LIFE)->getImageAssetID(); + data.about_text = mEditPanel->childGetValue("sl_description_edit").asString(); + data.fl_about_text = mEditPanel->childGetValue("fl_description_edit").asString(); + data.profile_url = mEditPanel->childGetValue("homepage_edit").asString(); + data.allow_publish = mEditPanel->childGetValue("show_in_search_checkbox"); + + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate(&data); + togglePanel(mEditPanel); // close + onOpen(getAvatarId()); +} + +void LLPanelMe::onCancelClicked() +{ + togglePanel(mEditPanel); // close +} + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +LLPanelMyProfileEdit::LLPanelMyProfileEdit() + : LLPanelMyProfile() +{ + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_edit_profile.xml"); + + setAvatarId(gAgent.getID()); +} + +void LLPanelMyProfileEdit::onOpen(const LLSD& key) +{ + resetData(); + + // Disable editing until data is loaded, or edited fields will be overwritten when data + // is loaded. + enableEditing(false); + LLPanelMyProfile::onOpen(getAvatarId()); +} + +void LLPanelMyProfileEdit::processProperties(void* data, EAvatarProcessorType type) +{ + if(APT_PROPERTIES == type) + { + const LLAvatarData* avatar_data = static_cast<const LLAvatarData*>(data); + if(avatar_data && getAvatarId() == avatar_data->avatar_id) + { + // *TODO dzaporozhan + // Workaround for ticket EXT-1099, waiting for fix for ticket EXT-1128 + enableEditing(true); + processProfileProperties(avatar_data); + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); + } + } +} + +void LLPanelMyProfileEdit::processProfileProperties(const LLAvatarData* avatar_data) +{ + fillCommonData(avatar_data); + + fillOnlineStatus(avatar_data); + + fillPartnerData(avatar_data); + + fillAccountStatus(avatar_data); + + childSetValue("show_in_search_checkbox", (BOOL)(avatar_data->flags & AVATAR_ALLOW_PUBLISH)); + + std::string first, last; + BOOL found = gCacheName->getName(avatar_data->avatar_id, first, last); + if (found) + { + childSetTextArg("name_text", "[FIRST]", first); + childSetTextArg("name_text", "[LAST]", last); + } +} + +BOOL LLPanelMyProfileEdit::postBuild() +{ + initTexturePickerMouseEvents(); + + childSetTextArg("partner_edit_link", "[URL]", getString("partner_edit_link_url")); + + return LLPanelAvatarProfile::postBuild(); +} +/** + * Inits map with texture picker and appropriate edit icon. + * Sets callbacks of Mouse Enter and Mouse Leave signals of Texture Pickers + */ +void LLPanelMyProfileEdit::initTexturePickerMouseEvents() +{ + LLTextureCtrl* text_pic = getChild<LLTextureCtrl>(PICKER_SECOND_LIFE); + LLIconCtrl* text_icon = getChild<LLIconCtrl>("2nd_life_edit_icon"); + mTextureEditIconMap[text_pic->getName()] = text_icon; + text_pic->setMouseEnterCallback(boost::bind(&LLPanelMyProfileEdit::onTexturePickerMouseEnter, this, _1)); + text_pic->setMouseLeaveCallback(boost::bind(&LLPanelMyProfileEdit::onTexturePickerMouseLeave, this, _1)); + text_icon->setVisible(FALSE); + + text_pic = getChild<LLTextureCtrl>(PICKER_FIRST_LIFE); + text_icon = getChild<LLIconCtrl>("real_world_edit_icon"); + mTextureEditIconMap[text_pic->getName()] = text_icon; + text_pic->setMouseEnterCallback(boost::bind(&LLPanelMyProfileEdit::onTexturePickerMouseEnter, this, _1)); + text_pic->setMouseLeaveCallback(boost::bind(&LLPanelMyProfileEdit::onTexturePickerMouseLeave, this, _1)); + text_icon->setVisible(FALSE); +} + +void LLPanelMyProfileEdit::resetData() +{ + LLPanelMyProfile::resetData(); + + childSetTextArg("name_text", "[FIRST]", LLStringUtil::null); + childSetTextArg("name_text", "[LAST]", LLStringUtil::null); +} + +void LLPanelMyProfileEdit::onTexturePickerMouseEnter(LLUICtrl* ctrl) +{ + mTextureEditIconMap[ctrl->getName()]->setVisible(TRUE); +} +void LLPanelMyProfileEdit::onTexturePickerMouseLeave(LLUICtrl* ctrl) +{ + mTextureEditIconMap[ctrl->getName()]->setVisible(FALSE); +} + +void LLPanelMyProfileEdit::enableEditing(bool enable) +{ + childSetEnabled("2nd_life_pic", enable); + childSetEnabled("real_world_pic", enable); + childSetEnabled("sl_description_edit", enable); + childSetEnabled("fl_description_edit", enable); + childSetEnabled("homepage_edit", enable); + childSetEnabled("show_in_search_checkbox", enable); +} diff --git a/indra/newview/llpanelme.h b/indra/newview/llpanelme.h new file mode 100644 index 0000000000..17d367132e --- /dev/null +++ b/indra/newview/llpanelme.h @@ -0,0 +1,111 @@ +/** + * @file llpanelme.h + * @brief Side tray "Me" (My Profile) panel + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLPANELMEPROFILE_H +#define LL_LLPANELMEPROFILE_H + +#include "llpanel.h" +#include "llpanelavatar.h" + +class LLPanelMyProfileEdit; +class LLPanelProfile; +class LLIconCtrl; + +/** +* Panel for displaying Agent's profile, it consists of two sub panels - Profile +* and Picks. +* LLPanelMe allows user to edit his profile and picks. +*/ +class LLPanelMe : public LLPanelProfile +{ + LOG_CLASS(LLPanelMe); + +public: + + LLPanelMe(); + + /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void notifyChildren(const LLSD& info); + + /*virtual*/ BOOL postBuild(); + +private: + + void buildEditPanel(); + + void onEditProfileClicked(); + void onEditAppearanceClicked(); + void onSaveChangesClicked(); + void onCancelClicked(); + + LLPanelMyProfileEdit * mEditPanel; + +}; + +class LLPanelMyProfileEdit : public LLPanelMyProfile +{ + LOG_CLASS(LLPanelMyProfileEdit); + +public: + + LLPanelMyProfileEdit(); + + /*virtual*/void processProperties(void* data, EAvatarProcessorType type); + + /*virtual*/BOOL postBuild(); + + /*virtual*/ void onOpen(const LLSD& key); + +protected: + + /*virtual*/void resetData(); + + void processProfileProperties(const LLAvatarData* avatar_data); + +private: + void initTexturePickerMouseEvents(); + void onTexturePickerMouseEnter(LLUICtrl* ctrl); + void onTexturePickerMouseLeave(LLUICtrl* ctrl); + + /** + * Enabled/disables controls to prevent overwriting edited data upon receiving + * current data from server. + */ + void enableEditing(bool enable); + +private: + // map TexturePicker name => Edit Icon pointer should be visible while hovering Texture Picker + typedef std::map<std::string, LLIconCtrl*> texture_edit_icon_map_t; + texture_edit_icon_map_t mTextureEditIconMap; +}; + +#endif // LL_LLPANELMEPROFILE_H diff --git a/indra/newview/llpanelmediasettingsgeneral.cpp b/indra/newview/llpanelmediasettingsgeneral.cpp index ad8a379cc1..9b1f71a9a9 100644 --- a/indra/newview/llpanelmediasettingsgeneral.cpp +++ b/indra/newview/llpanelmediasettingsgeneral.cpp @@ -387,17 +387,19 @@ void LLPanelMediaSettingsGeneral::preApply() // void LLPanelMediaSettingsGeneral::getValues( LLSD &fill_me_in ) { - fill_me_in[LLMediaEntry::AUTO_LOOP_KEY] = mAutoLoop->getValue(); - fill_me_in[LLMediaEntry::AUTO_PLAY_KEY] = mAutoPlay->getValue(); - fill_me_in[LLMediaEntry::AUTO_SCALE_KEY] = mAutoScale->getValue(); - fill_me_in[LLMediaEntry::AUTO_ZOOM_KEY] = mAutoZoom->getValue(); - fill_me_in[LLMediaEntry::CONTROLS_KEY] = mControls->getCurrentIndex(); - //Don't fill in current URL: this is only supposed to get changed via navigate + fill_me_in[LLMediaEntry::AUTO_LOOP_KEY] = mAutoLoop->getValue(); + fill_me_in[LLMediaEntry::AUTO_PLAY_KEY] = mAutoPlay->getValue(); + fill_me_in[LLMediaEntry::AUTO_SCALE_KEY] = mAutoScale->getValue(); + fill_me_in[LLMediaEntry::AUTO_ZOOM_KEY] = mAutoZoom->getValue(); + fill_me_in[LLMediaEntry::CONTROLS_KEY] = mControls->getCurrentIndex(); + //Don't fill in current URL: this is only supposed to get changed via navigate // fill_me_in[LLMediaEntry::CURRENT_URL_KEY] = mCurrentURL->getValue(); - fill_me_in[LLMediaEntry::HEIGHT_PIXELS_KEY] = mHeightPixels->getValue(); - fill_me_in[LLMediaEntry::HOME_URL_KEY] = mHomeURL->getValue(); - fill_me_in[LLMediaEntry::FIRST_CLICK_INTERACT_KEY] = mFirstClick->getValue(); - fill_me_in[LLMediaEntry::WIDTH_PIXELS_KEY] = mWidthPixels->getValue(); + fill_me_in[LLMediaEntry::HEIGHT_PIXELS_KEY] = mHeightPixels->getValue(); + // Don't fill in the home URL if it is the special "Multiple Media" string! + if (LLTrans::getString("Multiple Media") != mHomeURL->getValue()) + fill_me_in[LLMediaEntry::HOME_URL_KEY] = mHomeURL->getValue(); + fill_me_in[LLMediaEntry::FIRST_CLICK_INTERACT_KEY] = mFirstClick->getValue(); + fill_me_in[LLMediaEntry::WIDTH_PIXELS_KEY] = mWidthPixels->getValue(); } //////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index dbe0ec3b86..4237681c80 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -41,6 +41,7 @@ #include "llpanelobjectinventory.h" +#include "llmenugl.h" #include "roles_constants.h" #include "llagent.h" diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp index 5ad9bf056e..5af26c1ad9 100644 --- a/indra/newview/llpaneloutfitsinventory.cpp +++ b/indra/newview/llpaneloutfitsinventory.cpp @@ -59,7 +59,7 @@ static LLRegisterPanelClassWrapper<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory"); LLPanelOutfitsInventory::LLPanelOutfitsInventory() : - mInventoryPanel(NULL), + mActivePanel(NULL), mParent(NULL) { mSavedFolderState = new LLSaveFolderState(); @@ -74,12 +74,8 @@ LLPanelOutfitsInventory::~LLPanelOutfitsInventory() // virtual BOOL LLPanelOutfitsInventory::postBuild() { - mInventoryPanel = getChild<LLInventoryPanel>("outfits_list"); - mInventoryPanel->setFilterTypes(1LL << LLFolderType::FT_OUTFIT, TRUE); - mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); - mInventoryPanel->openDefaultFolderForType(LLFolderType::FT_MY_OUTFITS); - mInventoryPanel->setSelectCallback(boost::bind(&LLPanelOutfitsInventory::onSelectionChange, this, _1, _2)); + initAccordionPanels(); initListCommandsHandlers(); return TRUE; } @@ -102,7 +98,7 @@ void LLPanelOutfitsInventory::onSearchEdit(const std::string& string) { if (string == "") { - mInventoryPanel->setFilterSubString(LLStringUtil::null); + mActivePanel->setFilterSubString(LLStringUtil::null); // re-open folders that were initially open mSavedFolderState->setApply(TRUE); @@ -114,7 +110,7 @@ void LLPanelOutfitsInventory::onSearchEdit(const std::string& string) gInventory.startBackgroundFetch(); - if (mInventoryPanel->getFilterSubString().empty() && string.empty()) + if (mActivePanel->getFilterSubString().empty() && string.empty()) { // current filter and new filter empty, do nothing return; @@ -128,7 +124,7 @@ void LLPanelOutfitsInventory::onSearchEdit(const std::string& string) } // set new filter string - mInventoryPanel->setFilterSubString(string); + mActivePanel->setFilterSubString(string); } void LLPanelOutfitsInventory::onWear() @@ -148,13 +144,20 @@ void LLPanelOutfitsInventory::onNew() { const std::string& outfit_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_OUTFIT); LLUUID outfit_folder = gAgentWearables.makeNewOutfitLinks(outfit_name); + getRootFolder()->setSelectionByID(outfit_folder, TRUE); getRootFolder()->setNeedsAutoRename(TRUE); } void LLPanelOutfitsInventory::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action) { + updateListCommands(); updateParent(); + if (getRootFolder()->needsAutoRename()) + { + getRootFolder()->startRenamingSelectedItem(); + getRootFolder()->setNeedsAutoRename(FALSE); + } } void LLPanelOutfitsInventory::onSelectorButtonClicked() @@ -203,7 +206,7 @@ bool LLPanelOutfitsInventory::getIsCorrectType(const LLFolderViewEventListener * LLFolderView *LLPanelOutfitsInventory::getRootFolder() { - return mInventoryPanel->getRootFolder(); + return mActivePanel->getRootFolder(); } ////////////////////////////////////////////////////////////////////////////////// @@ -345,3 +348,67 @@ bool LLPanelOutfitsInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropTy // List Commands // //////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////// +// Accordion // + +void LLPanelOutfitsInventory::initAccordionPanels() +{ + mAccordionPanels.resize(2); + + LLInventoryPanel *myoutfits_panel = getChild<LLInventoryPanel>("outfitslist_accordionpanel"); + myoutfits_panel->setFilterTypes(1LL << LLFolderType::FT_OUTFIT, TRUE); + myoutfits_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); + mAccordionPanels[0] = myoutfits_panel; + mActivePanel = myoutfits_panel; + + LLInventoryPanel *cof_panel = getChild<LLInventoryPanel>("cof_accordionpanel"); + cof_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); + mAccordionPanels[1] = cof_panel; + + for (accordionpanels_vec_t::iterator iter = mAccordionPanels.begin(); + iter != mAccordionPanels.end(); + ++iter) + { + LLInventoryPanel *panel = (*iter); + panel->setSelectCallback(boost::bind(&LLPanelOutfitsInventory::onAccordionSelectionChange, this, panel, _1, _2)); + } +} + +void LLPanelOutfitsInventory::onAccordionSelectionChange(LLInventoryPanel* accordion_panel, const std::deque<LLFolderViewItem*> &items, BOOL user_action) +{ + if (user_action && items.size() > 0) + { + for (accordionpanels_vec_t::iterator iter = mAccordionPanels.begin(); + iter != mAccordionPanels.end(); + ++iter) + { + LLInventoryPanel *panel = (*iter); + if (panel == accordion_panel) + { + mActivePanel = panel; + } + else + { + panel->getRootFolder()->clearSelection(); + } + } + } + onSelectionChange(items, user_action); +} + +LLInventoryPanel* LLPanelOutfitsInventory::getActivePanel() +{ + return mActivePanel; +} + +bool LLPanelOutfitsInventory::isAccordionPanel(LLInventoryPanel *panel) +{ + for(accordionpanels_vec_t::iterator it = mAccordionPanels.begin(); + it != mAccordionPanels.end(); + ++it) + { + if (*it == panel) + return true; + } + return false; +} diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h index 4d903a389b..7769a7d172 100644 --- a/indra/newview/llpaneloutfitsinventory.h +++ b/indra/newview/llpaneloutfitsinventory.h @@ -61,8 +61,6 @@ public: void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action); void onSelectorButtonClicked(); - LLInventoryPanel* getActivePanel() { return mInventoryPanel; } - // If a compatible listener type is selected, then return a pointer to that. // Otherwise, return NULL. LLFolderViewEventListener* getCorrectListenerForAction(); @@ -74,9 +72,26 @@ protected: private: LLSidepanelAppearance* mParent; - LLInventoryPanel* mInventoryPanel; LLSaveFolderState* mSavedFolderState; +public: + ////////////////////////////////////////////////////////////////////////////////// + // Accordion // + LLInventoryPanel* getActivePanel(); + bool isAccordionPanel(LLInventoryPanel *panel); + +protected: + void initAccordionPanels(); + void onAccordionSelectionChange(LLInventoryPanel* accordion_panel, const std::deque<LLFolderViewItem*> &items, BOOL user_action); + +private: + LLInventoryPanel* mActivePanel; + typedef std::vector<LLInventoryPanel *> accordionpanels_vec_t; + accordionpanels_vec_t mAccordionPanels; + + // Accordion // + //////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////// // List Commands // @@ -95,7 +110,7 @@ private: LLPanel* mListCommands; LLMenuGL* mMenuGearDefault; LLMenuGL* mMenuAdd; - // // + // List Commands // //////////////////////////////////////////////////////////////////////////////// }; diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 29f7cc1851..e6b6ec64bd 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -56,6 +56,8 @@ #include "llgrouplist.h" #include "llinventoryobserver.h" #include "llpanelpeoplemenus.h" +#include "llsidetray.h" +#include "llsidetraypanelcontainer.h" #include "llrecentpeople.h" #include "llviewercontrol.h" // for gSavedSettings #include "llviewermenu.h" // for gMenuHolder @@ -483,7 +485,7 @@ void LLPanelPeople::onFriendsAccordionExpandedCollapsed(const LLSD& param, LLAva BOOL LLPanelPeople::postBuild() { - mVisibleSignal.connect(boost::bind(&LLPanelPeople::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLPanelPeople::onVisibilityChange, this, _2)); mFilterEditor = getChild<LLFilterEditor>("filter_input"); mFilterEditor->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2)); @@ -765,7 +767,7 @@ void LLPanelPeople::updateButtons() buttonSetEnabled("view_profile_btn", item_selected); buttonSetEnabled("im_btn", multiple_selected); // allow starting the friends conference for multiple selection buttonSetEnabled("call_btn", multiple_selected); - buttonSetEnabled("share_btn", item_selected && false); // not implemented yet + buttonSetEnabled("share_btn", item_selected); // not implemented yet bool none_group_selected = item_selected && selected_id.isNull(); buttonSetEnabled("group_info_btn", !none_group_selected); @@ -1218,7 +1220,7 @@ void LLPanelPeople::onTeleportButtonClicked() void LLPanelPeople::onShareButtonClicked() { - // *TODO: not implemented yet + LLAvatarActions::share(getCurrentItemID()); } void LLPanelPeople::onMoreButtonClicked() @@ -1270,6 +1272,31 @@ void LLPanelPeople::onOpen(const LLSD& key) reSelectedCurrentTab(); } +void LLPanelPeople::notifyChildren(const LLSD& info) +{ + if (info.has("task-panel-action") && info["task-panel-action"].asString() == "handle-tri-state") + { + LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(getParent()); + if (!container) + { + llwarns << "Cannot find People panel container" << llendl; + return; + } + + if (container->getCurrentPanelIndex() > 0) + { + // if not on the default panel, switch to it + container->onOpen(LLSD().insert(LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME, getName())); + } + else + LLSideTray::getInstance()->collapseSideBar(); + + return; // this notification is only supposed to be handled by task panels + } + + LLPanel::notifyChildren(info); +} + void LLPanelPeople::showAccordion(const std::string name, bool show) { if(name.empty()) diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index a369bcd3e2..d9dd76f3ac 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -50,8 +50,8 @@ public: virtual ~LLPanelPeople(); /*virtual*/ BOOL postBuild(); - - virtual void onOpen(const LLSD& key); + /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void notifyChildren(const LLSD& info); // internals class Updater; diff --git a/indra/newview/llpanelpicks.h b/indra/newview/llpanelpicks.h index 4b90ea5048..b17b6d6fe9 100644 --- a/indra/newview/llpanelpicks.h +++ b/indra/newview/llpanelpicks.h @@ -83,7 +83,7 @@ public: LLClassifiedItem* getSelectedClassifiedItem(); //*NOTE top down approch when panel toggling is done only by - // parent panels failed to work (picks related code was in me profile panel) + // parent panels failed to work (picks related code was in my profile panel) void setProfilePanel(LLPanelProfile* profile_panel); private: diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 529912929d..71c1b0cbb9 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -510,7 +510,7 @@ void LLPanelPrimMediaControls::updateShape() mMediaProgressBar->setPercent(media_plugin->getProgressPercent()); gFocusMgr.setTopCtrl(mMediaProgressPanel); } - else + else if (mMediaProgressPanel->getVisible()) { mMediaProgressPanel->setVisible(false); gFocusMgr.setTopCtrl(NULL); diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 02f45c1b48..4d152a13f3 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -158,28 +158,14 @@ void LLPanelProfile::onOpen(const LLSD& key) } //*TODO redo panel toggling -void LLPanelProfile::togglePanel(LLPanel* panel) +void LLPanelProfile::togglePanel(LLPanel* panel, const LLSD& key) { // TRUE - we need to open/expand "panel" bool expand = getChildList()->front() != panel; // mTabCtrl->getVisible(); if (expand) { - if (panel->getParent() != this) - { - addChild(panel); - } - else - { - sendChildToFront(panel); - } - - panel->setVisible(TRUE); - - LLRect new_rect = getRect(); - panel->reshape(new_rect.getWidth(), new_rect.getHeight()); - new_rect.setLeftTopAndSize(0, new_rect.getHeight(), new_rect.getWidth(), new_rect.getHeight()); - panel->setRect(new_rect); + openPanel(panel, key); } else { diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index e0b827c986..067beb248b 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -40,7 +40,7 @@ class LLTabContainer; /** -* Base class for Profile View and Me Profile. +* Base class for Profile View and My Profile. */ class LLPanelProfile : public LLPanel { @@ -51,7 +51,7 @@ public: /*virtual*/ void onOpen(const LLSD& key); - virtual void togglePanel(LLPanel*); + virtual void togglePanel(LLPanel*, const LLSD& key = LLSD()); virtual void openPanel(LLPanel* panel, const LLSD& params); diff --git a/indra/newview/llpanelprofileview.cpp b/indra/newview/llpanelprofileview.cpp index d4ab5013f9..7832f63e6a 100644 --- a/indra/newview/llpanelprofileview.cpp +++ b/indra/newview/llpanelprofileview.cpp @@ -190,11 +190,13 @@ void LLPanelProfileView::processOnlineStatus(bool online) void LLPanelProfileView::onAvatarNameCached(const LLUUID& id, const std::string& first_name, const std::string& last_name, BOOL is_group) { llassert(getAvatarId() == id); - getChild<LLTextBox>("user_name", FALSE)->setValue(first_name + " " + last_name); + getChild<LLUICtrl>("user_name", FALSE)->setValue(first_name + " " + last_name); } -void LLPanelProfileView::togglePanel(LLPanel* panel) +void LLPanelProfileView::togglePanel(LLPanel* panel, const LLSD& key) { + // *TODO: unused method? + LLPanelProfile::togglePanel(panel); if(FALSE == panel->getVisible()) { diff --git a/indra/newview/llpanelprofileview.h b/indra/newview/llpanelprofileview.h index 45c2fc116e..5dc617d4a0 100644 --- a/indra/newview/llpanelprofileview.h +++ b/indra/newview/llpanelprofileview.h @@ -64,7 +64,7 @@ public: /*virtual*/ BOOL postBuild(); - /*virtual*/ void togglePanel(LLPanel* panel); + /*virtual*/ void togglePanel(LLPanel* panel, const LLSD& key = LLSD()); BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index 057cdde6f0..67d0e13786 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -262,6 +262,7 @@ BOOL LLTeleportHistoryPanel::postBuild() fl->setCommitOnSelectionChange(true); fl->setDoubleClickCallback(boost::bind(&LLTeleportHistoryPanel::onDoubleClickItem, this)); fl->setCommitCallback(boost::bind(&LLTeleportHistoryPanel::handleItemSelect, this, fl)); + fl->setReturnCallback(boost::bind(&LLTeleportHistoryPanel::onReturnKeyPressed, this)); } } } @@ -636,6 +637,12 @@ void LLTeleportHistoryPanel::handleItemSelect(LLFlatListView* selected) updateVerbs(); } +void LLTeleportHistoryPanel::onReturnKeyPressed() +{ + // Teleport to selected region as default action on return key pressed + onTeleport(); +} + void LLTeleportHistoryPanel::onDoubleClickItem() { // If item got doubleclick, then that item is already selected diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h index b34d9e876c..a31ff34cb6 100644 --- a/indra/newview/llpanelteleporthistory.h +++ b/indra/newview/llpanelteleporthistory.h @@ -80,6 +80,7 @@ public: private: void onDoubleClickItem(); + void onReturnKeyPressed(); void onAccordionTabRightClick(LLView *view, S32 x, S32 y, MASK mask); void onAccordionTabOpen(LLAccordionCtrlTab *tab); void onAccordionTabClose(LLAccordionCtrlTab *tab); diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index 49a2a3723d..3d2c529dda 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -355,7 +355,7 @@ LLPreviewGesture::~LLPreviewGesture() BOOL LLPreviewGesture::postBuild() { - mVisibleSignal.connect(boost::bind(&LLPreviewGesture::onVisibilityChange, this, _2)); + setVisibleCallback(boost::bind(&LLPreviewGesture::onVisibilityChange, this, _2)); LLLineEditor* edit; LLComboBox* combo; diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index 24505f6bd6..24ba288c49 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -46,6 +46,7 @@ #include "lldockablefloater.h" #include "llsyswellwindow.h" #include "llimfloater.h" +#include "llscriptfloater.h" #include <algorithm> @@ -114,7 +115,9 @@ void LLScreenChannelBase::init(S32 channel_left, S32 channel_right) // LLScreenChannel ////////////////////// //-------------------------------------------------------------------------- -LLScreenChannel::LLScreenChannel(LLUUID& id): LLScreenChannelBase(id) +LLScreenChannel::LLScreenChannel(LLUUID& id): +LLScreenChannelBase(id) +,mStartUpToastPanel(NULL) { } @@ -357,8 +360,6 @@ void LLScreenChannel::redrawToasts() if(mToastList.size() == 0 || isHovering()) return; - hideToastsFromScreen(); - switch(mToastAlignment) { case NA_TOP : @@ -382,6 +383,8 @@ void LLScreenChannel::showToastsBottom() S32 toast_margin = 0; std::vector<ToastElem>::reverse_iterator it; + closeOverflowToastPanel(); + for(it = mToastList.rbegin(); it != mToastList.rend(); ++it) { if(it != mToastList.rbegin()) @@ -407,7 +410,20 @@ void LLScreenChannel::showToastsBottom() if(stop_showing_toasts) break; - (*it).toast->setVisible(TRUE); + if( !(*it).toast->getVisible() ) + { + if((*it).toast->isFirstLook()) + { + (*it).toast->setVisible(TRUE); + } + else + { + // HACK + // EXT-2653: it is necessary to prevent overlapping for secondary showed toasts + (*it).toast->setVisible(TRUE); + gFloaterView->sendChildToBack((*it).toast); + } + } } if(it != mToastList.rend() && !mOverflowToastHidden) @@ -416,6 +432,7 @@ void LLScreenChannel::showToastsBottom() for(; it != mToastList.rend(); it++) { (*it).toast->stopTimer(); + (*it).toast->setVisible(FALSE); mHiddenToastsNum++; } createOverflowToast(bottom, gSavedSettings.getS32("NotificationTipToastLifeTime")); @@ -686,7 +703,8 @@ void LLScreenChannel::updateShowToastsState() } // for IM floaters showed in a docked state - prohibit showing of ani toast - if(dynamic_cast<LLIMFloater*>(floater)) + if(dynamic_cast<LLIMFloater*>(floater) + || dynamic_cast<LLScriptFloater*>(floater) ) { setShowToasts(!(floater->getVisible() && floater->isDocked())); if (!getShowToasts()) diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp new file mode 100644 index 0000000000..bdea6ff459 --- /dev/null +++ b/indra/newview/llscriptfloater.cpp @@ -0,0 +1,335 @@ +/** + * @file llscriptfloater.cpp + * @brief LLScriptFloater class definition + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llscriptfloater.h" + +#include "llbottomtray.h" +#include "llchannelmanager.h" +#include "llchiclet.h" +#include "llfloaterreg.h" +#include "llscreenchannel.h" +#include "lltoastnotifypanel.h" +#include "llviewerwindow.h" + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +LLUUID notification_id_to_object_id(const LLUUID& notification_id) +{ + LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id); + if(notification) + { + return notification->getPayload()["object_id"].asUUID(); + } + return LLUUID::null; +} + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +LLScriptFloater::LLScriptFloater(const LLSD& key) +: LLTransientDockableFloater(NULL, true, key) +, mScriptForm(NULL) +, mObjectId(key.asUUID()) +{ +} + +bool LLScriptFloater::toggle(const LLUUID& object_id) +{ + LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", object_id); + + // show existing floater + if(floater) + { + if(floater->getVisible()) + { + floater->setVisible(false); + return false; + } + else + { + floater->setVisible(TRUE); + floater->setFocus(TRUE); + return true; + } + } + // create and show new floater + else + { + show(object_id); + return true; + } +} + +LLScriptFloater* LLScriptFloater::show(const LLUUID& object_id) +{ + LLScriptFloater* floater = LLFloaterReg::showTypedInstance<LLScriptFloater>("script_floater", object_id); + floater->createForm(object_id); + + if (floater->getDockControl() == NULL) + { + LLChiclet* chiclet = LLBottomTray::getInstance()->getChicletPanel()->findChiclet<LLChiclet>(object_id); + if (chiclet == NULL) + { + llerror("Dock chiclet for LLScriptFloater doesn't exist", 0); + } + else + { + LLBottomTray::getInstance()->getChicletPanel()->scrollToChiclet(chiclet); + } + + floater->setDockControl(new LLDockControl(chiclet, floater, floater->getDockTongue(), + LLDockControl::TOP, boost::bind(&LLScriptFloater::getAllowedRect, floater, _1))); + } + + return floater; +} + +void LLScriptFloater::getAllowedRect(LLRect& rect) +{ + rect = gViewerWindow->getWorldViewRectRaw(); +} + +void LLScriptFloater::createForm(const LLUUID& object_id) +{ + // delete old form + if(mScriptForm) + { + removeChild(mScriptForm); + mScriptForm->die(); + } + + LLNotificationPtr notification = LLNotifications::getInstance()->find( + LLScriptFloaterManager::getInstance()->findNotificationId(object_id)); + if(NULL == notification) + { + return; + } + + // create new form + mScriptForm = new LLToastNotifyPanel(notification); + addChild(mScriptForm); + + // position form on floater + mScriptForm->setOrigin(0, 0); + + // make floater size fit form size + LLRect toast_rect = getRect(); + LLRect panel_rect = mScriptForm->getRect(); + toast_rect.setLeftTopAndSize(toast_rect.mLeft, toast_rect.mTop, panel_rect.getWidth(), panel_rect.getHeight() + getHeaderHeight()); + setShape(toast_rect); +} + +void LLScriptFloater::onClose(bool app_quitting) +{ + LLScriptFloaterManager::getInstance()->removeNotificationByObjectId(getObjectId()); +} + +void LLScriptFloater::setDocked(bool docked, bool pop_on_undock /* = true */) +{ + LLTransientDockableFloater::setDocked(docked, pop_on_undock); + + hideToastsIfNeeded(); +} + +void LLScriptFloater::setVisible(BOOL visible) +{ + LLTransientDockableFloater::setVisible(visible); + + hideToastsIfNeeded(); +} + +void LLScriptFloater::hideToastsIfNeeded() +{ + using namespace LLNotificationsUI; + + // find channel + LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(LLChannelManager::getInstance()->findChannelByID( + LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); + // update notification channel state + if(channel) + { + channel->updateShowToastsState(); + } +} + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id) +{ + // get scripted Object's ID + LLUUID object_id = notification_id_to_object_id(notification_id); + if(object_id.isNull()) + { + llwarns << "Invalid notification, no object id" << llendl; + return; + } + + // If an Object spawns more-than-one floater, only the newest one is shown. + // The previous is automatically closed. + script_notification_map_t::iterator it = mNotifications.find(object_id); + if(it != mNotifications.end()) + { + onRemoveNotification(notification_id); + } + + LLNotificationData nd = {notification_id}; + mNotifications.insert(std::make_pair(object_id, nd)); + + LLBottomTray::getInstance()->getChicletPanel()->createChiclet<LLScriptChiclet>(object_id); +} + +void LLScriptFloaterManager::onRemoveNotification(const LLUUID& notification_id) +{ + LLUUID object_id = notification_id_to_object_id(notification_id); + if(object_id.isNull()) + { + llwarns << "Invalid notification, no object id" << llendl; + return; + } + + using namespace LLNotificationsUI; + + // remove related toast + LLUUID channel_id(gSavedSettings.getString("NotificationChannelUUID")); + LLScreenChannel* channel = dynamic_cast<LLScreenChannel*> + (LLChannelManager::getInstance()->findChannelByID(channel_id)); + if(channel) + { + channel->killToastByNotificationID(findNotificationToastId(object_id)); + } + + mNotifications.erase(object_id); + + // remove related chiclet + LLBottomTray::getInstance()->getChicletPanel()->removeChiclet(object_id); + + // close floater + LLScriptFloater* floater = LLFloaterReg::findTypedInstance<LLScriptFloater>("script_floater", object_id); + if(floater) + { + floater->closeFloater(); + } +} + +void LLScriptFloaterManager::removeNotificationByObjectId(const LLUUID& object_id) +{ + // Check we have not removed notification yet + LLNotificationPtr notification = LLNotifications::getInstance()->find( + findNotificationId(object_id)); + if(notification) + { + onRemoveNotification(notification->getID()); + } +} + +void LLScriptFloaterManager::toggleScriptFloater(const LLUUID& object_id) +{ + // hide "new message" icon from chiclet + LLIMChiclet* chiclet = LLBottomTray::getInstance()->getChicletPanel()->findChiclet<LLIMChiclet>(object_id); + if(chiclet) + { + chiclet->setShowNewMessagesIcon(false); + } + + // kill toast + using namespace LLNotificationsUI; + LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(LLChannelManager::getInstance()->findChannelByID( + LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); + if(channel) + { + channel->killToastByNotificationID(findNotificationToastId(object_id)); + } + + // toggle floater + LLScriptFloater::toggle(object_id); +} + +void LLScriptFloaterManager::setNotificationToastId(const LLUUID& object_id, const LLUUID& notification_id) +{ + script_notification_map_t::iterator it = mNotifications.find(object_id); + if(mNotifications.end() != it) + { + it->second.toast_notification_id = notification_id; + } +} + +LLUUID LLScriptFloaterManager::findNotificationId(const LLUUID& object_id) +{ + script_notification_map_t::const_iterator it = mNotifications.find(object_id); + if(mNotifications.end() != it) + { + return it->second.notification_id; + } + return LLUUID::null; +} + +LLUUID LLScriptFloaterManager::findNotificationToastId(const LLUUID& object_id) +{ + script_notification_map_t::const_iterator it = mNotifications.find(object_id); + if(mNotifications.end() != it) + { + return it->second.toast_notification_id; + } + return LLUUID::null; +} + +//static +void LLScriptFloaterManager::onToastButtonClick(const LLSD¬ification, const LLSD&response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + LLUUID object_id = notification["payload"]["object_id"].asUUID(); + + switch(option) + { + case 0: // "Open" + LLScriptFloaterManager::getInstance()->toggleScriptFloater(object_id); + break; + case 1: // "Ignore" + LLScriptFloaterManager::getInstance()->removeNotificationByObjectId(object_id); + break; + case 2: // "Block" + LLMuteList::getInstance()->add(LLMute(object_id, notification["substitutions"]["TITLE"], LLMute::OBJECT)); + LLScriptFloaterManager::getInstance()->removeNotificationByObjectId(object_id); + break; + default: + llwarns << "Unexpected value" << llendl; + break; + } +} + +// EOF diff --git a/indra/newview/llscriptfloater.h b/indra/newview/llscriptfloater.h new file mode 100644 index 0000000000..0e1a7f36b7 --- /dev/null +++ b/indra/newview/llscriptfloater.h @@ -0,0 +1,164 @@ +/** + * @file llscriptfloater.h + * @brief LLScriptFloater class definition + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_SCRIPTFLOATER_H +#define LL_SCRIPTFLOATER_H + +#include "lltransientdockablefloater.h" + +class LLToastNotifyPanel; + +/** + * Handles script notifications ("ScriptDialog" and "ScriptDialogGroup") + * and manages Script Floaters. + */ +class LLScriptFloaterManager : public LLSingleton<LLScriptFloaterManager> +{ +public: + + /** + * Handles new notifications. + * Saves notification and object ids, removes old notification if needed, creates script chiclet + * Note that one object can spawn one script floater. + */ + void onAddNotification(const LLUUID& notification_id); + + /** + * Handles notification removal. + * Removes script notification toast, removes script chiclet, closes script floater + */ + void onRemoveNotification(const LLUUID& notification_id); + + /** + * Wrapper for onRemoveNotification, removes notification by object id. + */ + void removeNotificationByObjectId(const LLUUID& object_id); + + /** + * Toggles script floater. + * Removes "new message" icon from chiclet and removes notification toast. + */ + void toggleScriptFloater(const LLUUID& object_id); + + LLUUID findNotificationId(const LLUUID& object_id); + + LLUUID findNotificationToastId(const LLUUID& object_id); + + /** + * Associate notification toast id with object id. + */ + void setNotificationToastId(const LLUUID& object_id, const LLUUID& notification_id); + + /** + * Callback for notification toast buttons. + */ + static void onToastButtonClick(const LLSD¬ification, const LLSD&response); + +private: + + struct LLNotificationData + { + LLUUID notification_id; + LLUUID toast_notification_id; + }; + + // <object_id, notification_data> + typedef std::map<LLUUID, LLNotificationData> script_notification_map_t; + + script_notification_map_t mNotifications; +}; + +/** + * Floater script forms. + * LLScriptFloater will create script form based on notification data and + * will auto fit the form. + */ +class LLScriptFloater : public LLTransientDockableFloater +{ +public: + + /** + * key - UUID of scripted Object + */ + LLScriptFloater(const LLSD& key); + + virtual ~LLScriptFloater(){}; + + /** + * Toggle existing floater or create and show a new one. + */ + static bool toggle(const LLUUID& object_id); + + /** + * Creates and shows floater + */ + static LLScriptFloater* show(const LLUUID& object_id); + + const LLUUID& getObjectId() { return mObjectId; } + + /** + * Close notification if script floater is closed. + */ + /*virtual*/ void onClose(bool app_quitting); + + /** + * Hide all notification toasts when we show dockable floater + */ + /*virtual*/ void setDocked(bool docked, bool pop_on_undock = true); + + /** + * Hide all notification toasts when we show dockable floater + */ + /*virtual*/ void setVisible(BOOL visible); + +protected: + + /** + * Creates script form, will delete old form if floater is shown for same object. + */ + void createForm(const LLUUID& object_id); + + /*virtual*/ void getAllowedRect(LLRect& rect); + + /** + * Hide all notification toasts. + */ + static void hideToastsIfNeeded(); + + void setObjectId(const LLUUID& id) { mObjectId = id; } + +private: + LLToastNotifyPanel* mScriptForm; + LLUUID mObjectId; +}; + +#endif //LL_SCRIPTFLOATER_H diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp index b5e55df1f5..32a915608e 100644 --- a/indra/newview/llscrollingpanelparam.cpp +++ b/indra/newview/llscrollingpanelparam.cpp @@ -86,9 +86,8 @@ LLScrollingPanelParam::LLScrollingPanelParam( const LLPanel::Params& panel_param childSetEnabled("param slider", mAllowModify); childSetCommitCallback("param slider", LLScrollingPanelParam::onSliderMoved, this); - // *TODO: Translate - std::string min_name = param->getMinDisplayName(); - std::string max_name = param->getMaxDisplayName(); + std::string min_name = LLTrans::getString(param->getMinDisplayName()); + std::string max_name = LLTrans::getString(param->getMaxDisplayName()); childSetValue("min param text", min_name); childSetValue("max param text", max_name); diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 0f8e86cb3c..d5f01418c6 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -32,6 +32,7 @@ #include "llviewerprecompiledheaders.h" #include "llsidepanelappearance.h" +#include "llaccordionctrltab.h" #include "llagent.h" #include "llagentwearables.h" #include "llappearancemgr.h" @@ -142,6 +143,7 @@ void LLSidepanelAppearance::onOpen(const LLSD& key) { fetchInventory(); refreshCurrentOutfitName(); + updateVerbs(); if(key.size() == 0) return; @@ -188,16 +190,22 @@ void LLSidepanelAppearance::onOpenOutfitButtonClicked() return; if (!outfit_link->getIsLinkType()) return; - LLInventoryPanel *inventory_panel = mPanelOutfitsInventory->getActivePanel(); - if (inventory_panel) + + LLAccordionCtrlTab* tab_outfits = mPanelOutfitsInventory->findChild<LLAccordionCtrlTab>("tab_outfits"); + if (tab_outfits) { - LLFolderView *folder = inventory_panel->getRootFolder(); - LLFolderViewItem *outfit_folder = folder->getItemByID(outfit_link->getLinkedUUID()); - if (outfit_folder) + tab_outfits->changeOpenClose(FALSE); + LLInventoryPanel *inventory_panel = tab_outfits->findChild<LLInventoryPanel>("outfitslist_accordionpanel"); + if (inventory_panel) { - outfit_folder->setOpen(!outfit_folder->isOpen()); - folder->setSelectionFromRoot(outfit_folder,TRUE); - folder->scrollToShowSelection(); + LLFolderView *folder = inventory_panel->getRootFolder(); + LLFolderViewItem *outfit_folder = folder->getItemByID(outfit_link->getLinkedUUID()); + if (outfit_folder) + { + outfit_folder->setOpen(!outfit_folder->isOpen()); + folder->setSelectionFromRoot(outfit_folder,TRUE); + folder->scrollToShowSelection(); + } } } } diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 7711f3c733..ee5fa46c9c 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -34,6 +34,7 @@ #include "lltextbox.h" +#include "llagent.h" #include "llbottomtray.h" #include "llsidetray.h" #include "llviewerwindow.h" @@ -435,35 +436,16 @@ void LLSideTray::processTriState () expandSideBar(); else { - //!!!!!!!!!!!!!!!!! - //** HARDCODED!!!!! - //!!!!!!!!!!!!!!!!! - - //there is no common way to determine "default" panel for tab - //so default panels for now will be hardcoded - - //hardcoded for people tab and profile tab - - /*if(mActiveTab == getTab("sidebar_people")) - { - LLSideTrayPanelContainer* container = findChild<LLSideTrayPanelContainer>("panel_container"); - if(container && container->getCurrentPanelIndex()>0) - { - container->onOpen(LLSD().insert("sub_panel_name","panel_people")); - } - else - collapseSideBar(); - } - else if(mActiveTab == getTab("sidebar_me")) - { - LLTabContainer* tab_container = findChild<LLTabContainer>("tabs"); - if(tab_container && tab_container->getCurrentPanelIndex()>0) - tab_container->selectFirstTab(); - else - collapseSideBar(); - } - else*/ - collapseSideBar(); +#if 0 // *TODO: EXT-2092 + + // Tell the active task panel to switch to its default view + // or collapse side tray if already on the default view. + LLSD info; + info["task-panel-action"] = "handle-tri-state"; + mActiveTab->notifyChildren(info); +#else + collapseSideBar(); +#endif } } @@ -700,7 +682,7 @@ void LLSideTray::updateSidetrayVisibility() // set visibility of parent container based on collapsed state if (getParent()) { - getParent()->setVisible(!mCollapsed); + getParent()->setVisible(!mCollapsed && !gAgent.cameraMouselook()); } } diff --git a/indra/newview/llsidetray.h b/indra/newview/llsidetray.h index 54652c1108..7321574681 100644 --- a/indra/newview/llsidetray.h +++ b/indra/newview/llsidetray.h @@ -120,7 +120,7 @@ public: void setVisible(BOOL visible) { - LLPanel::setVisible(visible); + if (getParent()) getParent()->setVisible(visible); } LLPanel* getButtonsPanel() { return mButtonsPanel; } @@ -141,6 +141,7 @@ public: void processTriState (); + void updateSidetrayVisibility(); protected: LLSideTrayTab* getTab (const std::string& name); @@ -153,10 +154,6 @@ protected: void toggleTabButton (LLSideTrayTab* tab); - void updateSidetrayVisibility(); - - - private: // Implementation of LLDestroyClass<LLSideTray> static void destroyClass() @@ -166,7 +163,6 @@ private: LLSideTray::getInstance()->setEnabled(FALSE); } - private: LLPanel* mButtonsPanel; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index d36ff1605e..736be67710 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2153,7 +2153,7 @@ void login_callback(S32 option, void *userdata) LLStartUp::setStartupState( STATE_LOGIN_CLEANUP ); return; } - else if (QUIT_OPTION == option) + else if (QUIT_OPTION == option) // *TODO: THIS CODE SEEMS TO BE UNREACHABLE!!!!! login_callback is never called with option equal to QUIT_OPTION { // Make sure we don't save the password if the user is trying to clear it. std::string first, last, password; diff --git a/indra/newview/llstatusbar.h b/indra/newview/llstatusbar.h index 3ce3549961..bdaacce981 100644 --- a/indra/newview/llstatusbar.h +++ b/indra/newview/llstatusbar.h @@ -34,7 +34,6 @@ #define LL_LLSTATUSBAR_H #include "llpanel.h" -#include <llmenugl.h> // "Constants" loaded from settings.xml at start time extern S32 STATUS_BAR_HEIGHT; diff --git a/indra/newview/llteleporthistory.cpp b/indra/newview/llteleporthistory.cpp index bc886d5743..cc4689062e 100644 --- a/indra/newview/llteleporthistory.cpp +++ b/indra/newview/llteleporthistory.cpp @@ -52,7 +52,7 @@ const std::string& LLTeleportHistoryItem::getTitle() const { - return gSavedSettings.getBOOL("ShowCoordinatesOption") ? mFullTitle : mTitle; + return gSavedSettings.getBOOL("NavBarShowCoordinates") ? mFullTitle : mTitle; } ////////////////////////////////////////////////////////////////////////////// @@ -177,7 +177,7 @@ void LLTeleportHistory::purgeItems() std::string LLTeleportHistory::getCurrentLocationTitle(bool full, const LLVector3& local_pos_override) { std::string location_name; - LLAgentUI::ELocationFormat fmt = full ? LLAgentUI::LOCATION_FORMAT_WITHOUT_SIM : LLAgentUI::LOCATION_FORMAT_NORMAL; + LLAgentUI::ELocationFormat fmt = full ? LLAgentUI::LOCATION_FORMAT_NO_MATURITY : LLAgentUI::LOCATION_FORMAT_NORMAL; if (!LLAgentUI::buildLocationString(location_name, fmt, local_pos_override)) location_name = "Unknown"; return location_name; diff --git a/indra/newview/llteleporthistory.h b/indra/newview/llteleporthistory.h index 9f5563ed0b..a82bec7c4f 100644 --- a/indra/newview/llteleporthistory.h +++ b/indra/newview/llteleporthistory.h @@ -57,7 +57,8 @@ public: {} /** - * @return title formatted according to the current value of the ShowCoordinatesOption setting. + * @return title formatted according to the current value of the + * NavBarShowCoordinates setting. */ const std::string& getTitle() const; diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 25e0ca46e4..a90f3ee181 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -223,7 +223,16 @@ BOOL LLTexLayerSetBuffer::render() } else { - readBackAndUpload(); + if (mTexLayerSet->isVisible()) + { + readBackAndUpload(); + } + else + { + mUploadPending = FALSE; + mNeedsUpload = FALSE; + mTexLayerSet->getAvatar()->setNewBakedTexture(mTexLayerSet->getBakedTexIndex(),IMG_INVISIBLE); + } } } @@ -551,6 +560,7 @@ LLTexLayerSet::LLTexLayerSet(LLVOAvatarSelf* const avatar) : mComposite( NULL ), mAvatar( avatar ), mUpdatesEnabled( FALSE ), + mIsVisible( TRUE ), mInfo( NULL ) { } @@ -665,38 +675,54 @@ BOOL LLTexLayerSet::isLocalTextureDataFinal() const BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height ) { BOOL success = TRUE; + mIsVisible = TRUE; - LLGLSUIDefault gls_ui; - LLGLDepthTest gls_depth(GL_FALSE, GL_FALSE); - gGL.setColorMask(true, true); - - // clear buffer area to ensure we don't pick up UI elements + if (mMaskLayerList.size() > 0) { - gGL.flush(); - LLGLDisable no_alpha(GL_ALPHA_TEST); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4f( 0.f, 0.f, 0.f, 1.f ); - - gl_rect_2d_simple( width, height ); - - gGL.flush(); + for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++) + { + LLTexLayerInterface* layer = *iter; + if (layer->isInvisibleAlphaMask()) + { + mIsVisible = FALSE; + } + } } - // composite color layers - for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) + if (mIsVisible) { - LLTexLayerInterface* layer = *iter; - if (layer->getRenderPass() == LLTexLayer::RP_COLOR) + LLGLSUIDefault gls_ui; + LLGLDepthTest gls_depth(GL_FALSE, GL_FALSE); + gGL.setColorMask(true, true); + + // clear buffer area to ensure we don't pick up UI elements { gGL.flush(); - success &= layer->render(x, y, width, height); + LLGLDisable no_alpha(GL_ALPHA_TEST); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.color4f( 0.f, 0.f, 0.f, 1.f ); + + gl_rect_2d_simple( width, height ); + gGL.flush(); } - } - renderAlphaMaskTextures(x, y, width, height, false); - - stop_glerror(); + // composite color layers + for( layer_list_t::iterator iter = mLayerList.begin(); iter != mLayerList.end(); iter++ ) + { + LLTexLayerInterface* layer = *iter; + if (layer->getRenderPass() == LLTexLayer::RP_COLOR) + { + gGL.flush(); + success &= layer->render(x, y, width, height); + gGL.flush(); + } + } + + renderAlphaMaskTextures(x, y, width, height, false); + + stop_glerror(); + } return success; } @@ -1709,6 +1735,19 @@ void LLTexLayer::addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 } } +/*virtual*/ BOOL LLTexLayer::isInvisibleAlphaMask() +{ + if (mLocalTextureObject) + { + if (mLocalTextureObject->getID() == IMG_INVISIBLE) + { + return TRUE; + } + } + + return FALSE; +} + // private helper function LLUUID LLTexLayer::getUUID() { @@ -1898,6 +1937,23 @@ LLTexLayer* LLTexLayerTemplate::getLayer(U32 i) } } +/*virtual*/ BOOL LLTexLayerTemplate::isInvisibleAlphaMask() +{ + U32 num_wearables = updateWearableCache(); + for (U32 i = 0; i < num_wearables; i++) + { + LLTexLayer *layer = getLayer(i); + if (layer) + { + if (layer->isInvisibleAlphaMask()) + { + return TRUE; + } + } + } + + return FALSE; +} //----------------------------------------------------------------------------- diff --git a/indra/newview/lltexlayer.h b/indra/newview/lltexlayer.h index cd8f27a96b..5be58f64a9 100644 --- a/indra/newview/lltexlayer.h +++ b/indra/newview/lltexlayer.h @@ -99,6 +99,7 @@ public: virtual void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height) = 0; BOOL hasAlphaParams() const { return !mParamAlphaList.empty(); } BOOL isVisibilityMask() const; + virtual BOOL isInvisibleAlphaMask() = 0; LLTexLayerSet* getLayerSet() {return mTexLayerSet;} @@ -141,6 +142,8 @@ public: /*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height); /*virtual*/ void setHasMorph(BOOL newval); /*virtual*/ void deleteCaches(); + /*virtual*/ BOOL isInvisibleAlphaMask(); + private: U32 updateWearableCache(); LLTexLayer* getLayer(U32 i); @@ -173,6 +176,7 @@ public: /*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height); BOOL renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color); void addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height); + /*virtual*/ BOOL isInvisibleAlphaMask(); void setLTO(LLLocalTextureObject *lto) { mLocalTextureObject = lto; } LLLocalTextureObject* getLTO() { return mLocalTextureObject; } @@ -272,6 +276,7 @@ public: BOOL hasComposite() const { return (mComposite.notNull()); } LLVOAvatarDefines::EBakedTextureIndex getBakedTexIndex() { return mBakedTexIndex; } void setBakedTexIndex( LLVOAvatarDefines::EBakedTextureIndex index) { mBakedTexIndex = index; } + BOOL isVisible() const { return mIsVisible; } public: static BOOL sHasCaches; @@ -284,6 +289,7 @@ private: LLPointer<LLTexLayerSetBuffer> mComposite; LLVOAvatarSelf* const mAvatar; // Backlink only; don't make this an LLPointer. BOOL mUpdatesEnabled; + BOOL mIsVisible; LLVOAvatarDefines::EBakedTextureIndex mBakedTexIndex; diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 6f3dabe5a7..9bb2a4ad0a 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -931,6 +931,14 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mState == DECODE_IMAGE) { + if (mDesiredDiscard < 0) + { + // We aborted, don't decode + mState = DONE; + setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); + return true; + } + if (mFormattedImage->getDataSize() <= 0) { llerrs << "Decode entered with invalid mFormattedImage. ID = " << mID << llendl; diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp index ed2cedbd10..f9cbdc20d6 100644 --- a/indra/newview/lltoast.cpp +++ b/indra/newview/lltoast.cpp @@ -227,7 +227,7 @@ void LLToast::setVisible(BOOL show) } LLModalDialog::setFrontmost(FALSE); } - LLPanel::setVisible(show); + LLFloater::setVisible(show); if(mPanel) { if(!mPanel->isDead()) diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index ded83debad..26b3bdb82e 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -247,7 +247,7 @@ bool LLToolMgr::inEdit() bool LLToolMgr::canEdit() { - return LLViewerParcelMgr::getInstance()->agentCanBuild(); + return LLViewerParcelMgr::getInstance()->allowAgentBuild(); } void LLToolMgr::toggleBuildMode() diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 7772f613f0..642df92379 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -109,6 +109,7 @@ #include "llfloaterwhitelistentry.h" #include "llfloaterwindlight.h" #include "llfloaterworldmap.h" +#include "llimfloatercontainer.h" #include "llinspectavatar.h" #include "llinspectgroup.h" #include "llinspectobject.h" @@ -124,6 +125,7 @@ #include "llpreviewsound.h" #include "llpreviewtexture.h" #include "llsyswellwindow.h" +#include "llscriptfloater.h" // *NOTE: Please add files in alphabetical order to keep merges easy. @@ -171,6 +173,8 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("hud", "floater_hud.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterHUD>); LLFloaterReg::add("impanel", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIMFloater>); + LLFloaterReg::add("im_container", "floater_im_container.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIMFloaterContainer>); + LLFloaterReg::add("script_floater", "floater_script.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLScriptFloater>); LLFloaterReg::add("incoming_call", "floater_incoming_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIncomingCallDialog>); LLFloaterReg::add("inventory", "floater_inventory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterInventory>); LLFloaterReg::add("inspect", "floater_inspect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterInspect>); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 87d256b60a..c6ec25c1cb 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -56,11 +56,43 @@ #include "lltrans.h" #include "llappearancemgr.h" #include "llfloatercustomize.h" +#include "llcommandhandler.h" +#include "llviewermessage.h" ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- +class LLInventoryHandler : public LLCommandHandler +{ +public: + // requires trusted browser to trigger + LLInventoryHandler() : LLCommandHandler("inventory", UNTRUSTED_THROTTLE) { } + + bool handle(const LLSD& params, const LLSD& query_map, + LLMediaCtrl* web) + { + if (params.size() < 2) return false; + LLUUID inventory_id; + if (!inventory_id.set(params[0], FALSE)) + { + return false; + } + + const std::string verb = params[1].asString(); + if (verb == "select") + { + std::vector<LLUUID> items_to_open; + items_to_open.push_back(inventory_id); + open_inventory_offer(items_to_open, ""); + return true; + } + + return false; + } +}; +LLInventoryHandler gInventoryHandler; + ///---------------------------------------------------------------------------- /// Class LLViewerInventoryItem ///---------------------------------------------------------------------------- diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 8c41133a3a..9dfdf3d5b1 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -169,6 +169,12 @@ public: completeAny(status, "text/html"); } else + if(status == 404) + { + // Treat 404s like an html page. + completeAny(status, "text/html"); + } + else { llwarns << "responder failed with status " << status << ", reason " << reason << llendl; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index c67af994a4..8bcf2c6281 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2736,7 +2736,7 @@ bool enable_object_edit() bool enable = false; if (gAgent.inPrelude()) { - enable = LLViewerParcelMgr::getInstance()->agentCanBuild() + enable = LLViewerParcelMgr::getInstance()->allowAgentBuild() || LLSelectMgr::getInstance()->getSelection()->isAttachment(); } else if (LLSelectMgr::getInstance()->selectGetModify()) @@ -5678,6 +5678,16 @@ class LLFloaterVisible : public view_listener_t } }; +class LLShowSidetrayPanel : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + std::string panel_name = userdata.asString(); + LLSideTray::getInstance()->showPanel(panel_name, LLSD()); + return true; + } +}; + bool callback_show_url(const LLSD& notification, const LLSD& response) { S32 option = LLNotification::getSelectedOption(notification, response); @@ -6096,7 +6106,7 @@ class LLAttachmentEnableDrop : public view_listener_t { bool handleEvent(const LLSD& userdata) { - BOOL can_build = gAgent.isGodlike() || (LLViewerParcelMgr::getInstance()->agentCanBuild()); + BOOL can_build = gAgent.isGodlike() || (LLViewerParcelMgr::getInstance()->allowAgentBuild()); //Add an inventory observer to only allow dropping the newly attached item //once it exists in your inventory. Look at Jira 2422. @@ -8039,6 +8049,7 @@ void initialize_menus() visible.add("Object.VisibleEdit", boost::bind(&enable_object_edit)); view_listener_t::addMenu(new LLFloaterVisible(), "FloaterVisible"); + view_listener_t::addMenu(new LLShowSidetrayPanel(), "ShowSidetrayPanel"); view_listener_t::addMenu(new LLSomethingSelected(), "SomethingSelected"); view_listener_t::addMenu(new LLSomethingSelectedNoHUD(), "SomethingSelectedNoHUD"); view_listener_t::addMenu(new LLEditableSelected(), "EditableSelected"); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 8db6d5917a..adad06dc6f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -101,6 +101,7 @@ #include "llpanelgrouplandmoney.h" #include "llpanelplaces.h" #include "llrecentpeople.h" +#include "llscriptfloater.h" #include "llselectmgr.h" #include "llsidetray.h" #include "llstartup.h" @@ -169,7 +170,6 @@ static const F32 LLREQUEST_PERMISSION_THROTTLE_INTERVAL = 10.0f; // seconds extern BOOL gDebugClicks; // function prototypes -void open_offer(const std::vector<LLUUID>& items, const std::string& from_name); bool check_offer_throttle(const std::string& from_name, bool check_only); //inventory offer throttle globals @@ -726,7 +726,7 @@ public: LLOpenAgentOffer(const std::string& from_name) : mFromName(from_name) {} /*virtual*/ void done() { - open_offer(mComplete, mFromName); + open_inventory_offer(mComplete, mFromName); gInventory.removeObserver(this); delete this; } @@ -744,7 +744,7 @@ class LLOpenTaskOffer : public LLInventoryAddedObserver protected: /*virtual*/ void done() { - open_offer(mAdded, ""); + open_inventory_offer(mAdded, ""); mAdded.clear(); } }; @@ -875,7 +875,7 @@ bool check_offer_throttle(const std::string& from_name, bool check_only) } } -void open_offer(const std::vector<LLUUID>& items, const std::string& from_name) +void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& from_name) { std::vector<LLUUID>::const_iterator it = items.begin(); std::vector<LLUUID>::const_iterator end = items.end(); @@ -1065,12 +1065,60 @@ LLSD LLOfferInfo::asLLSD() return sd; } +void LLOfferInfo::send_auto_receive_response(void) +{ + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ImprovedInstantMessage); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_MessageBlock); + msg->addBOOLFast(_PREHASH_FromGroup, FALSE); + msg->addUUIDFast(_PREHASH_ToAgentID, mFromID); + msg->addU8Fast(_PREHASH_Offline, IM_ONLINE); + msg->addUUIDFast(_PREHASH_ID, mTransactionID); + msg->addU32Fast(_PREHASH_Timestamp, NO_TIMESTAMP); // no timestamp necessary + std::string name; + LLAgentUI::buildFullname(name); + msg->addStringFast(_PREHASH_FromAgentName, name); + msg->addStringFast(_PREHASH_Message, ""); + msg->addU32Fast(_PREHASH_ParentEstateID, 0); + msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null); + msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent()); + + // Auto Receive Message. The math for the dialog works, because the accept + // for inventory_offered, task_inventory_offer or + // group_notice_inventory is 1 greater than the offer integer value. + // Generates IM_INVENTORY_ACCEPTED, IM_TASK_INVENTORY_ACCEPTED, + // or IM_GROUP_NOTICE_INVENTORY_ACCEPTED + msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 1)); + msg->addBinaryDataFast(_PREHASH_BinaryBucket, &(mFolderID.mData), + sizeof(mFolderID.mData)); + // send the message + msg->sendReliable(mHost); + + if(IM_INVENTORY_OFFERED == mIM) + { + // add buddy to recent people list + LLRecentPeople::instance().add(mFromID); + } +} + bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& response) - { +{ LLChat chat; std::string log_message; S32 button = LLNotification::getSelectedOption(notification, response); - + + LLInventoryObserver* opener = NULL; + LLViewerInventoryCategory* catp = NULL; + catp = (LLViewerInventoryCategory*)gInventory.getCategory(mObjectID); + LLViewerInventoryItem* itemp = NULL; + if(!catp) + { + itemp = (LLViewerInventoryItem*)gInventory.getItem(mObjectID); + } + // For muting, we need to add the mute, then decline the offer. // This must be done here because: // * callback may be called immediately, @@ -1081,6 +1129,136 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& gCacheName->get(mFromID, mFromGroup, &inventory_offer_mute_callback); } + std::string from_string; // Used in the pop-up. + std::string chatHistory_string; // Used in chat history. + + // TODO: when task inventory offers can also be handled the new way, migrate the code that sets these strings here: + from_string = chatHistory_string = mFromName; + + bool busy=FALSE; + + switch(button) + { + case IOR_SHOW: + // we will want to open this item when it comes back. + LL_DEBUGS("Messaging") << "Initializing an opener for tid: " << mTransactionID + << LL_ENDL; + switch (mIM) + { + case IM_INVENTORY_OFFERED: + { + // This is an offer from an agent. In this case, the back + // end has already copied the items into your inventory, + // so we can fetch it out of our inventory. + LLInventoryFetchObserver::item_ref_t items; + items.push_back(mObjectID); + LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(from_string); + open_agent_offer->fetchItems(items); + if(catp || (itemp && itemp->isComplete())) + { + open_agent_offer->done(); + } + else + { + opener = open_agent_offer; + } + } + break; + case IM_TASK_INVENTORY_OFFERED: + case IM_GROUP_NOTICE: + case IM_GROUP_NOTICE_REQUESTED: + // This is an offer from a task or group. + // We don't use a new instance of an opener + // We instead use the singular observer gOpenTaskOffer + // Since it already exists, we don't need to actually do anything + break; + default: + LL_WARNS("Messaging") << "inventory_offer_callback: unknown offer type" << LL_ENDL; + break; + } // end switch (mIM) + + // Show falls through to accept. + + case IOR_ACCEPT: + //don't spam them if they are getting flooded + if (check_offer_throttle(mFromName, true)) + { + log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString("."); + chat.mText = log_message; + LLFloaterChat::addChatHistory(chat); + } + break; + + case IOR_BUSY: + //Busy falls through to decline. Says to make busy message. + busy=TRUE; + case IOR_MUTE: + // MUTE falls through to decline + case IOR_DECLINE: + { + log_message = LLTrans::getString("InvOfferYouDecline") + " " + mDesc + " " + LLTrans::getString("InvOfferFrom") + " " + mFromName +"."; + chat.mText = log_message; + if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269 + { + chat.mMuted = TRUE; + } + LLFloaterChat::addChatHistory(chat); + + LLInventoryFetchComboObserver::folder_ref_t folders; + LLInventoryFetchComboObserver::item_ref_t items; + items.push_back(mObjectID); + LLDiscardAgentOffer* discard_agent_offer; + discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID); + discard_agent_offer->fetch(folders, items); + if(catp || (itemp && itemp->isComplete())) + { + discard_agent_offer->done(); + } + else + { + opener = discard_agent_offer; + } + + + if (busy && (!mFromGroup && !mFromObject)) + { + busy_message(gMessageSystem, mFromID); + } + break; + } + default: + // close button probably + // The item has already been fetched and is in your inventory, we simply won't highlight it + // OR delete it if the notification gets killed, since we don't want that to be a vector for + // losing inventory offers. + break; + } + + if(opener) + { + gInventory.addObserver(opener); + } + + delete this; + return false; +} + +bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const LLSD& response) +{ + LLChat chat; + std::string log_message; + S32 button = LLNotification::getSelectedOption(notification, response); + + // For muting, we need to add the mute, then decline the offer. + // This must be done here because: + // * callback may be called immediately, + // * adding the mute sends a message, + // * we can't build two messages at once. + if (2 == button) + { + gCacheName->get(mFromID, mFromGroup, &inventory_offer_mute_callback); + } + LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ImprovedInstantMessage); msg->nextBlockFast(_PREHASH_AgentData); @@ -1107,7 +1285,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& { itemp = (LLViewerInventoryItem*)gInventory.getItem(mObjectID); } - + std::string from_string; // Used in the pop-up. std::string chatHistory_string; // Used in chat history. if (mFromObject == TRUE) @@ -1118,16 +1296,16 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& if (gCacheName->getGroupName(mFromID, group_name)) { from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'" - + mFromName + LLTrans::getString("'") +" " + LLTrans::getString("InvOfferOwnedByGroup") - + " "+ "'" + group_name + "'"; + + mFromName + LLTrans::getString("'") +" " + LLTrans::getString("InvOfferOwnedByGroup") + + " "+ "'" + group_name + "'"; chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByGroup") - + " " + group_name + "'"; + + " " + group_name + "'"; } else { from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'" - + mFromName +"'"+ " " + LLTrans::getString("InvOfferOwnedByUnknownGroup"); + + mFromName +"'"+ " " + LLTrans::getString("InvOfferOwnedByUnknownGroup"); chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownGroup"); } } @@ -1137,13 +1315,13 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& if (gCacheName->getName(mFromID, first_name, last_name)) { from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+ LLTrans::getString("'") + mFromName - + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedBy") + first_name + " " + last_name; + + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedBy") + first_name + " " + last_name; chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedBy") + " " + first_name + " " + last_name; } else { from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+LLTrans::getString("'") - + mFromName + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedByUnknownUser"); + + mFromName + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedByUnknownUser"); chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownUser"); } } @@ -1157,137 +1335,90 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& switch(button) { - case IOR_ACCEPT: - // ACCEPT. The math for the dialog works, because the accept - // for inventory_offered, task_inventory_offer or - // group_notice_inventory is 1 greater than the offer integer value. - // Generates IM_INVENTORY_ACCEPTED, IM_TASK_INVENTORY_ACCEPTED, - // or IM_GROUP_NOTICE_INVENTORY_ACCEPTED - msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 1)); - msg->addBinaryDataFast(_PREHASH_BinaryBucket, &(mFolderID.mData), - sizeof(mFolderID.mData)); - // send the message - msg->sendReliable(mHost); - - //don't spam them if they are getting flooded - if (check_offer_throttle(mFromName, true)) - { - log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString("."); - chat.mText = log_message; - LLFloaterChat::addChatHistory(chat); - } - - // we will want to open this item when it comes back. - LL_DEBUGS("Messaging") << "Initializing an opener for tid: " << mTransactionID - << LL_ENDL; - switch (mIM) - { - case IM_INVENTORY_OFFERED: - { - // This is an offer from an agent. In this case, the back - // end has already copied the items into your inventory, - // so we can fetch it out of our inventory. - LLInventoryFetchObserver::item_ref_t items; - items.push_back(mObjectID); - LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(from_string); - open_agent_offer->fetchItems(items); - if(catp || (itemp && itemp->isComplete())) + case IOR_ACCEPT: + // ACCEPT. The math for the dialog works, because the accept + // for inventory_offered, task_inventory_offer or + // group_notice_inventory is 1 greater than the offer integer value. + // Generates IM_INVENTORY_ACCEPTED, IM_TASK_INVENTORY_ACCEPTED, + // or IM_GROUP_NOTICE_INVENTORY_ACCEPTED + msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 1)); + msg->addBinaryDataFast(_PREHASH_BinaryBucket, &(mFolderID.mData), + sizeof(mFolderID.mData)); + // send the message + msg->sendReliable(mHost); + + //don't spam them if they are getting flooded + if (check_offer_throttle(mFromName, true)) { - open_agent_offer->done(); + log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString("."); + chat.mText = log_message; + LLFloaterChat::addChatHistory(chat); } - else + + // we will want to open this item when it comes back. + LL_DEBUGS("Messaging") << "Initializing an opener for tid: " << mTransactionID + << LL_ENDL; + switch (mIM) + { + case IM_TASK_INVENTORY_OFFERED: + case IM_GROUP_NOTICE: + case IM_GROUP_NOTICE_REQUESTED: { - opener = open_agent_offer; + // This is an offer from a task or group. + // We don't use a new instance of an opener + // We instead use the singular observer gOpenTaskOffer + // Since it already exists, we don't need to actually do anything } - } + break; + default: + LL_WARNS("Messaging") << "inventory_offer_callback: unknown offer type" << LL_ENDL; + break; + } // end switch (mIM) break; - case IM_TASK_INVENTORY_OFFERED: - case IM_GROUP_NOTICE: - case IM_GROUP_NOTICE_REQUESTED: - { - // This is an offer from a task or group. - // We don't use a new instance of an opener - // We instead use the singular observer gOpenTaskOffer - // Since it already exists, we don't need to actually do anything - } - break; + + case IOR_BUSY: + //Busy falls through to decline. Says to make busy message. + busy=TRUE; + case IOR_MUTE: + // MUTE falls through to decline + case IOR_DECLINE: + // DECLINE. The math for the dialog works, because the decline + // for inventory_offered, task_inventory_offer or + // group_notice_inventory is 2 greater than the offer integer value. + // Generates IM_INVENTORY_DECLINED, IM_TASK_INVENTORY_DECLINED, + // or IM_GROUP_NOTICE_INVENTORY_DECLINED default: - LL_WARNS("Messaging") << "inventory_offer_callback: unknown offer type" << LL_ENDL; - break; - } // end switch (mIM) - break; - - case IOR_BUSY: - //Busy falls through to decline. Says to make busy message. - busy=TRUE; - case IOR_MUTE: - // MUTE falls through to decline - case IOR_DECLINE: - // DECLINE. The math for the dialog works, because the decline - // for inventory_offered, task_inventory_offer or - // group_notice_inventory is 2 greater than the offer integer value. - // Generates IM_INVENTORY_DECLINED, IM_TASK_INVENTORY_DECLINED, - // or IM_GROUP_NOTICE_INVENTORY_DECLINED - default: - // close button probably (or any of the fall-throughs from above) - msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 2)); - msg->addBinaryDataFast(_PREHASH_BinaryBucket, EMPTY_BINARY_BUCKET, EMPTY_BINARY_BUCKET_SIZE); - // send the message - msg->sendReliable(mHost); - - log_message = LLTrans::getString("InvOfferYouDecline") + " " + mDesc + " " + LLTrans::getString("InvOfferFrom") + " " + mFromName +"."; - chat.mText = log_message; - if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269 - { - chat.mMuted = TRUE; - } - LLFloaterChat::addChatHistory(chat); - - // If it's from an agent, we have to fetch the item to throw - // it away. If it's from a task or group, just denying the - // request will suffice to discard the item. - if(IM_INVENTORY_OFFERED == mIM) - { - LLInventoryFetchComboObserver::folder_ref_t folders; - LLInventoryFetchComboObserver::item_ref_t items; - items.push_back(mObjectID); - LLDiscardAgentOffer* discard_agent_offer; - discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID); - discard_agent_offer->fetch(folders, items); - if(catp || (itemp && itemp->isComplete())) + // close button probably (or any of the fall-throughs from above) + msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 2)); + msg->addBinaryDataFast(_PREHASH_BinaryBucket, EMPTY_BINARY_BUCKET, EMPTY_BINARY_BUCKET_SIZE); + // send the message + msg->sendReliable(mHost); + + log_message = LLTrans::getString("InvOfferYouDecline") + " " + mDesc + " " + LLTrans::getString("InvOfferFrom") + " " + mFromName +"."; + chat.mText = log_message; + if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269 { - discard_agent_offer->done(); + chat.mMuted = TRUE; } - else + LLFloaterChat::addChatHistory(chat); + + if (busy && (!mFromGroup && !mFromObject)) { - opener = discard_agent_offer; + busy_message(msg,mFromID); } - - } - if (busy && (!mFromGroup && !mFromObject)) - { - busy_message(msg,mFromID); - } - break; - } - - if(IM_INVENTORY_OFFERED == mIM) - { - // add buddy to recent people list - LLRecentPeople::instance().add(mFromID); + break; } - + if(opener) { gInventory.addObserver(opener); } - + delete this; return false; } - -void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) +void inventory_offer_handler(LLOfferInfo* info) { //Until throttling is implmented, busy mode should reject inventory instead of silently //accepting it. SEE SL-39554 @@ -1374,21 +1505,45 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) args["OBJECTFROMNAME"] = info->mFromName; args["NAME"] = info->mFromName; args["NAME_SLURL"] = LLSLURL::buildCommand("agent", info->mFromID, "about"); - std::string verb = "highlight?name=" + msg; + std::string verb = "select?name=" + msg; args["ITEM_SLURL"] = LLSLURL::buildCommand("inventory", info->mObjectID, verb.c_str()); LLNotification::Params p("ObjectGiveItem"); - p.substitutions(args).payload(payload).functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, info, _1, _2)); - if (from_task) + // Object -> Agent Inventory Offer + if (info->mFromObject) { + // Inventory Slurls don't currently work for non agent transfers, so only display the object name. + args["ITEM_SLURL"] = msg; + // Note: sets inventory_task_offer_callback as the callback + p.substitutions(args).payload(payload).functor.function(boost::bind(&LLOfferInfo::inventory_task_offer_callback, info, _1, _2)); p.name = name_found ? "ObjectGiveItem" : "ObjectGiveItemUnknownUser"; } - else + else // Agent -> Agent Inventory Offer { + // Note: sets inventory_offer_callback as the callback + p.substitutions(args).payload(payload).functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, info, _1, _2)); p.name = "UserGiveItem"; + + // Prefetch the item into your local inventory. + LLInventoryFetchObserver::item_ref_t items; + items.push_back(info->mObjectID); + LLInventoryFetchObserver* fetch_item = new LLInventoryFetchObserver(); + fetch_item->fetchItems(items); + if(fetch_item->isEverythingComplete()) + { + fetch_item->done(); + } + else + { + gInventory.addObserver(fetch_item); + } + + // In viewer 2 we're now auto receiving inventory offers and messaging as such (not sending reject messages). + info->send_auto_receive_response(); } - + + // Pop up inv offer notification and let the user accept (keep), or reject (and silently delete) the inventory. LLNotifications::instance().add(p); } @@ -1884,7 +2039,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } else { - inventory_offer_handler(info, dialog == IM_TASK_INVENTORY_OFFERED); + inventory_offer_handler(info); } } break; @@ -5380,6 +5535,17 @@ void process_script_dialog(LLMessageSystem* msg, void**) notification = LLNotifications::instance().add( LLNotification::Params("ScriptDialogGroup").substitutions(args).payload(payload).form_elements(form.asLLSD())); } + + // "ScriptDialog" and "ScriptDialogGroup" are handles by LLScriptFloaterManager. + // We want to inform user that there is a script floater, lets add "ScriptToast" + LLNotification::Params p("ScriptToast"); + p.substitutions(args).payload(payload).functor.function(boost::bind( + LLScriptFloaterManager::onToastButtonClick, _1, _2)); + + notification = LLNotifications::instance().add(p); + + LLScriptFloaterManager::getInstance()->setNotificationToastId( + object_id, notification->getID()); } //--------------------------------------------------------------------------- diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index e24da2013d..1a98828010 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -59,7 +59,8 @@ enum InventoryOfferResponse IOR_ACCEPT, IOR_DECLINE, IOR_MUTE, - IOR_BUSY + IOR_BUSY, + IOR_SHOW }; BOOL can_afford_transaction(S32 cost); @@ -197,6 +198,7 @@ void invalid_message_callback(LLMessageSystem*, void*, EMessageException); void process_initiate_download(LLMessageSystem* msg, void**); void start_new_inventory_observer(); +void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& from_name); struct LLOfferInfo { @@ -218,7 +220,9 @@ struct LLOfferInfo LLHost mHost; LLSD asLLSD(); + void send_auto_receive_response(void); bool inventory_offer_callback(const LLSD& notification, const LLSD& response); + bool inventory_task_offer_callback(const LLSD& notification, const LLSD& response); }; diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index aa0987aa7d..fcaf49c884 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -650,7 +650,7 @@ LLParcel *LLViewerParcelMgr::getAgentParcel() const } // Return whether the agent can build on the land they are on -bool LLViewerParcelMgr::agentCanBuild() const +bool LLViewerParcelMgr::allowAgentBuild() const { if (mAgentParcel) { @@ -664,19 +664,47 @@ bool LLViewerParcelMgr::agentCanBuild() const } } -BOOL LLViewerParcelMgr::agentCanTakeDamage() const +bool LLViewerParcelMgr::allowAgentVoice() const { - return mAgentParcel->getAllowDamage(); + LLViewerRegion* region = gAgent.getRegion(); + return region && region->isVoiceEnabled() + && mAgentParcel && mAgentParcel->getParcelFlagAllowVoice(); } -BOOL LLViewerParcelMgr::agentCanFly() const +bool LLViewerParcelMgr::allowAgentFly() const { - return TRUE; + LLViewerRegion* region = gAgent.getRegion(); + return region && !region->getBlockFly() + && mAgentParcel && mAgentParcel->getAllowFly(); } -F32 LLViewerParcelMgr::agentDrawDistance() const +// Can the agent be pushed around by LLPushObject? +bool LLViewerParcelMgr::allowAgentPush() const { - return 512.f; + LLViewerRegion* region = gAgent.getRegion(); + return region && !region->getRestrictPushObject() + && mAgentParcel && !mAgentParcel->getRestrictPushObject(); +} + +bool LLViewerParcelMgr::allowAgentScripts() const +{ + LLViewerRegion* region = gAgent.getRegion(); + // *NOTE: This code does not take into account group-owned parcels + // and the flag to allow group-owned scripted objects to run. + // This mirrors the traditional menu bar parcel icon code, but is not + // technically correct. + return region + && !(region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS) + && !(region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS) + && mAgentParcel + && mAgentParcel->getAllowOtherScripts(); +} + +bool LLViewerParcelMgr::allowAgentDamage() const +{ + LLViewerRegion* region = gAgent.getRegion(); + return region && region->getAllowDamage() + && mAgentParcel && mAgentParcel->getAllowDamage(); } BOOL LLViewerParcelMgr::isOwnedAt(const LLVector3d& pos_global) const diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h index 1c8fe23dba..379190789b 100644 --- a/indra/newview/llviewerparcelmgr.h +++ b/indra/newview/llviewerparcelmgr.h @@ -56,9 +56,6 @@ class LLViewerRegion; // | EAST_MASK // | WEST_MASK); -const F32 PARCEL_POST_HEIGHT = 0.666f; -//const F32 PARCEL_POST_HEIGHT = 20.f; - // Specify the type of land transfer taking place //enum ELandTransferType //{ @@ -171,10 +168,29 @@ public: LLParcel* getCollisionParcel() const; - BOOL agentCanTakeDamage() const; - BOOL agentCanFly() const; - F32 agentDrawDistance() const; - bool agentCanBuild() const; + // Can this agent build on the parcel he is on? + // Used for parcel property icons in nav bar. + bool allowAgentBuild() const; + + // Can this agent speak on the parcel he is on? + // Used for parcel property icons in nav bar. + bool allowAgentVoice() const; + + // Can this agent start flying on this parcel? + // Used for parcel property icons in nav bar. + bool allowAgentFly() const; + + // Can this agent be pushed by llPushObject() on this parcel? + // Used for parcel property icons in nav bar. + bool allowAgentPush() const; + + // Can scripts written by non-parcel-owners run on the agent's current + // parcel? Used for parcel property icons in nav bar. + bool allowAgentScripts() const; + + // Can the agent be damaged here? + // Used for parcel property icons in nav bar. + bool allowAgentDamage() const; F32 getHoverParcelWidth() const { return F32(mHoverEastNorth.mdV[VX] - mHoverWestSouth.mdV[VX]); } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index dd84140d5b..28722b614a 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -841,7 +841,7 @@ BOOL LLViewerWindow::handleDragNDrop( LLWindow *window, LLCoordGL pos, MASK mas llinfos << "### Object: picked at " << pos.mX << ", " << pos.mY << " - face = " << object_face << " - URL = " << url << llendl; LLVOVolume *obj = dynamic_cast<LLVOVolume*>(static_cast<LLViewerObject*>(pick_info.getObject())); - gPipeline.setHighlightObject(NULL); + if (obj && obj->permModify()) { LLTextureEntry *te = obj->getTE(object_face); @@ -866,19 +866,25 @@ BOOL LLViewerWindow::handleDragNDrop( LLWindow *window, LLCoordGL pos, MASK mas // just navigate to the URL obj->getMediaImpl(object_face)->navigateTo(url); } + LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject); + mDragHoveredObject = NULL; } else { mDragHoveredObject = obj; - // Make the object glow - gPipeline.setHighlightObject(mDragHoveredObject->mDrawable); + // Highlight the dragged object + LLSelectMgr::getInstance()->highlightObjectOnly(mDragHoveredObject); } result = TRUE; } } - else { + + if (!result && !mDragHoveredObject.isNull()) + { + LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject); mDragHoveredObject = NULL; } } + return result; } @@ -1411,6 +1417,7 @@ LLViewerWindow::LLViewerWindow( mDebugText = new LLDebugText(this); + mWorldViewRectScaled = calcScaledRect(mWorldViewRectRaw, mDisplayScale); } void LLViewerWindow::initGLDefaults() @@ -1637,7 +1644,8 @@ void LLViewerWindow::initWorldUI() LLPanel* side_tray_container = getRootView()->getChild<LLPanel>("side_tray_container"); LLSideTray* sidetrayp = LLSideTray::getInstance(); sidetrayp->setShape(side_tray_container->getLocalRect()); - sidetrayp->setFollowsAll(); + // don't follow right edge to avoid spurious resizes, since we are using a fixed width layout + sidetrayp->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP|FOLLOWS_BOTTOM); side_tray_container->addChild(sidetrayp); side_tray_container->setVisible(FALSE); @@ -2931,19 +2939,17 @@ void LLViewerWindow::updateWorldViewRect(bool use_full_window) if (mWorldViewRectRaw != new_world_rect) { - // sending a signal with a new WorldView rect - mOnWorldViewRectUpdated(mWorldViewRectRaw, new_world_rect); - + LLRect old_world_rect = mWorldViewRectRaw; mWorldViewRectRaw = new_world_rect; gResizeScreenTexture = TRUE; LLViewerCamera::getInstance()->setViewHeightInPixels( mWorldViewRectRaw.getHeight() ); LLViewerCamera::getInstance()->setAspect( getWorldViewAspectRatio() ); - mWorldViewRectScaled = mWorldViewRectRaw; - mWorldViewRectScaled.mLeft = llround((F32)mWorldViewRectScaled.mLeft / mDisplayScale.mV[VX]); - mWorldViewRectScaled.mRight = llround((F32)mWorldViewRectScaled.mRight / mDisplayScale.mV[VX]); - mWorldViewRectScaled.mBottom = llround((F32)mWorldViewRectScaled.mBottom / mDisplayScale.mV[VY]); - mWorldViewRectScaled.mTop = llround((F32)mWorldViewRectScaled.mTop / mDisplayScale.mV[VY]); + mWorldViewRectScaled = calcScaledRect(mWorldViewRectRaw, mDisplayScale); + + // sending a signal with a new WorldView rect + old_world_rect = calcScaledRect(old_world_rect, mDisplayScale); + mOnWorldViewRectUpdated(old_world_rect, mWorldViewRectScaled); } } @@ -4816,7 +4822,6 @@ F32 LLViewerWindow::getWorldViewAspectRatio() const } else { - llinfos << "World aspect ratio: " << world_aspect << llendl; return world_aspect; } } @@ -4858,6 +4863,18 @@ void LLViewerWindow::calcDisplayScale() } } +//static +LLRect LLViewerWindow::calcScaledRect(const LLRect & rect, const LLVector2& display_scale) +{ + LLRect res = rect; + res.mLeft = llround((F32)res.mLeft / display_scale.mV[VX]); + res.mRight = llround((F32)res.mRight / display_scale.mV[VX]); + res.mBottom = llround((F32)res.mBottom / display_scale.mV[VY]); + res.mTop = llround((F32)res.mTop / display_scale.mV[VY]); + + return res; +} + S32 LLViewerWindow::getChatConsoleBottomPad() { S32 offset = 0; diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 4296495067..11d19cf24d 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -392,6 +392,7 @@ public: F32 getWorldViewAspectRatio() const; const LLVector2& getDisplayScale() const { return mDisplayScale; } void calcDisplayScale(); + static LLRect calcScaledRect(const LLRect & rect, const LLVector2& display_scale); private: bool shouldShowToolTipFor(LLMouseHandler *mh); @@ -476,6 +477,7 @@ protected: static std::string sMovieBaseName; private: + // Object temporarily hovered over while dragging LLPointer<LLViewerObject> mDragHoveredObject; }; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 75e35e5221..9882dcd6af 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3868,7 +3868,7 @@ U32 LLVOAvatar::renderRigid() return 0; } - if (isTextureVisible(TEX_EYES_BAKED) || mIsDummy) + if (isTextureVisible(TEX_EYES_BAKED) || mIsDummy) { num_indices += mMeshLOD[MESH_ID_EYEBALL_LEFT]->render(mAdjustedPixelArea, TRUE, mIsDummy); num_indices += mMeshLOD[MESH_ID_EYEBALL_RIGHT]->render(mAdjustedPixelArea, TRUE, mIsDummy); @@ -7636,15 +7636,19 @@ void LLVOAvatar::idleUpdateRenderCost() return; } - U32 shame = 0; + U32 cost = 0; + std::set<LLUUID> textures; for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); ETextureIndex tex_index = baked_dict->mTextureIndex; - if (isTextureVisible(tex_index)) + if ((tex_index != TEX_SKIRT_BAKED) || (isWearingWearableType(WT_SKIRT))) { - shame +=20; + if (isTextureVisible(tex_index)) + { + cost +=20; + } } } @@ -7663,20 +7667,22 @@ void LLVOAvatar::idleUpdateRenderCost() const LLDrawable* drawable = attached_object->mDrawable; if (drawable) { - shame += 10; + cost += 10; const LLVOVolume* volume = drawable->getVOVolume(); if (volume) { - shame += volume->getRenderCost(); + cost += volume->getRenderCost(textures); } } } } } - setDebugText(llformat("%d", shame)); - F32 green = 1.f-llclamp(((F32) shame-1024.f)/1024.f, 0.f, 1.f); - F32 red = llmin((F32) shame/1024.f, 1.f); + cost += textures.size() * 5; + + setDebugText(llformat("%d", cost)); + F32 green = 1.f-llclamp(((F32) cost-1024.f)/1024.f, 0.f, 1.f); + F32 red = llmin((F32) cost/1024.f, 1.f); mText->setColor(LLColor4(red,green,0,1)); } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index d9c5e932a2..f3e787ae7e 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -318,11 +318,6 @@ BOOL LLVOAvatarSelf::buildMenus() } } - - if (!attachment_found) - { - gAttachPieMenu->addSeparator(); - } } if (gDetachBodyPartPieMenus[i]) @@ -362,11 +357,6 @@ BOOL LLVOAvatarSelf::buildMenus() break; } } - - if (!attachment_found) - { - gDetachPieMenu->addSeparator(); - } } } @@ -1849,6 +1839,13 @@ ETextureIndex LLVOAvatarSelf::getBakedTE( const LLTexLayerSet* layerset ) const } +void LLVOAvatarSelf::setNewBakedTexture(LLVOAvatarDefines::EBakedTextureIndex i, const LLUUID &uuid) +{ + ETextureIndex index = LLVOAvatarDictionary::bakedToLocalTextureIndex(i); + setNewBakedTexture(index, uuid); +} + + //----------------------------------------------------------------------------- // setNewBakedTexture() // A new baked texture has been successfully uploaded and we can start using it now. diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index a1cad82eff..e376e5e9ef 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -209,6 +209,7 @@ private: //-------------------------------------------------------------------- public: LLVOAvatarDefines::ETextureIndex getBakedTE(const LLTexLayerSet* layerset ) const; + void setNewBakedTexture(LLVOAvatarDefines::EBakedTextureIndex i, const LLUUID &uuid); void setNewBakedTexture(LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid); void setCachedBakedTexture(LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid); void forceBakeAllTextures(bool slam_for_debug = false); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 428af5380c..48bd387022 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2566,7 +2566,11 @@ const LLMatrix4 LLVOVolume::getRenderMatrix() const return mDrawable->getWorldMatrix(); } -U32 LLVOVolume::getRenderCost() const +// Returns a base cost and adds textures to passed in set. +// total cost is returned value + 5 * size of the resulting set. +// Cannot include cost of textures, as they may be re-used in linked +// children, and cost should only be increased for unique textures -Nyx +U32 LLVOVolume::getRenderCost(std::set<LLUUID> &textures) const { U32 shame = 0; @@ -2599,7 +2603,7 @@ U32 LLVOVolume::getRenderCost() const { const LLSculptParams *sculpt_params = (LLSculptParams *) getParameterEntry(LLNetworkData::PARAMS_SCULPT); LLUUID sculpt_id = sculpt_params->getSculptTexture(); - shame += 5; + textures.insert(sculpt_id); } for (S32 i = 0; i < drawablep->getNumFaces(); ++i) @@ -2608,7 +2612,7 @@ U32 LLVOVolume::getRenderCost() const const LLTextureEntry* te = face->getTextureEntry(); const LLViewerTexture* img = face->getTexture(); - shame += 5; + textures.insert(img->getID()); if (face->getPoolType() == LLDrawPool::POOL_ALPHA) { @@ -2658,7 +2662,7 @@ U32 LLVOVolume::getRenderCost() const const LLVOVolume* child_volumep = child_drawablep->getVOVolume(); if (child_volumep) { - shame += child_volumep->getRenderCost(); + shame += child_volumep->getRenderCost(textures); } } } diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 70d203daf2..06e214b41e 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -121,7 +121,7 @@ public: const LLMatrix4& getRelativeXform() const { return mRelativeXform; } const LLMatrix3& getRelativeXformInvTrans() const { return mRelativeXformInvTrans; } /*virtual*/ const LLMatrix4 getRenderMatrix() const; - U32 getRenderCost() const; + U32 getRenderCost(std::set<LLUUID> &textures) const; /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face = -1, // which face to check, -1 = ALL_SIDES diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp index ced0b64896..d92da4ef44 100644 --- a/indra/newview/llwearable.cpp +++ b/indra/newview/llwearable.cpp @@ -421,18 +421,6 @@ BOOL LLWearable::importFile( LLFILE* file ) // copy all saved param values to working params revertValues(); - // Hack pt 2. If the wearable we just loaded has definition version 24, - // then force a re-save of this wearable after slamming the version number to 22. - // This number was incorrectly incremented for internal builds before release, and - // this fix will ensure that the affected wearables are re-saved with the right version number. - // the versions themselves are compatible. This code can be removed before release. - if( mDefinitionVersion == 24 ) - { - mDefinitionVersion = 22; - U32 index = gAgentWearables.getWearableIndex(this); - gAgentWearables.saveWearable(mType,index,TRUE); - } - return TRUE; } diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h index 0863adb7f5..43ffa12420 100644 --- a/indra/newview/llwearable.h +++ b/indra/newview/llwearable.h @@ -82,6 +82,8 @@ public: const std::string& getTypeName() const; LLAssetType::EType getAssetType() const; LLLocalTextureObject* getLocalTextureObject(S32 index) const; + S32 getDefinitionVersion() const { return mDefinitionVersion; } + void setDefinitionVersion( S32 new_version ) { mDefinitionVersion = new_version; } public: typedef std::vector<LLVisualParam*> visual_param_vec_t; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 507c726e02..f908a015df 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -344,7 +344,9 @@ LLPipeline::LLPipeline() : mWLSkyPool(NULL), mLightMask(0), mLightMovingMask(0), - mLightingDetail(0) + mLightingDetail(0), + mScreenWidth(0), + mScreenHeight(0) { mNoiseMap = 0; mTrueNoiseMap = 0; @@ -512,22 +514,22 @@ void LLPipeline::resizeScreenTexture() LLFastTimer ft(FTM_RESIZE_SCREEN_TEXTURE); if (gPipeline.canUseVertexShaders() && assertInitialized()) { - GLuint resX = gViewerWindow->getWindowWidthRaw(); - GLuint resY = gViewerWindow->getWindowHeightRaw(); - GLuint view_width = gViewerWindow->getWorldViewWidthRaw(); - GLuint view_height = gViewerWindow->getWorldViewHeightRaw(); + GLuint resX = gViewerWindow->getWorldViewWidthRaw(); + GLuint resY = gViewerWindow->getWorldViewHeightRaw(); - allocateScreenBuffer(resX, resY, view_width, view_height); - - llinfos << "RESIZED SCREEN TEXTURE: " << resX << "x" << resY << llendl; + allocateScreenBuffer(resX,resY); } } -void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U32 viewport_height) +void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) { + // remember these dimensions + mScreenWidth = resX; + mScreenHeight = resY; + U32 samples = gSavedSettings.getU32("RenderFSAASamples"); - U32 res_mod = gSavedSettings.getU32("RenderResolutionDivisor"); + if (res_mod > 1 && res_mod < resX && res_mod < resY) { resX /= res_mod; @@ -544,24 +546,21 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U3 //allocate deferred rendering color buffers mDeferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE); mDeferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); - mDeferredScreen.setViewport(viewport_width, viewport_height); - mDeferredDepth.setViewport(viewport_width, viewport_height); addDeferredAttachments(mDeferredScreen); + + // always set viewport to desired size, since allocate resets the viewport + mScreen.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); mEdgeMap.allocate(resX, resY, GL_ALPHA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE); - mScreen.setViewport(viewport_width, viewport_height); - mEdgeMap.setViewport(viewport_width, viewport_height); for (U32 i = 0; i < 3; i++) { mDeferredLight[i].allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); - mDeferredLight[i].setViewport(viewport_width, viewport_height); } for (U32 i = 0; i < 2; i++) { mGIMapPost[i].allocate(resX,resY, GL_RGB, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE); - mGIMapPost[i].setViewport(viewport_width, viewport_height); } F32 scale = gSavedSettings.getF32("RenderShadowResolutionScale"); @@ -569,7 +568,6 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U3 for (U32 i = 0; i < 4; i++) { mShadow[i].allocate(U32(resX*scale),U32(resY*scale), 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE); - mShadow[i].setViewport(viewport_width, viewport_height); } @@ -579,7 +577,6 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U3 for (U32 i = 4; i < 6; i++) { mShadow[i].allocate(width, height, 0, TRUE, FALSE); - mShadow[i].setViewport(viewport_width, viewport_height); } @@ -587,27 +584,24 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U3 width = nhpo2(resX)/2; height = nhpo2(resY)/2; mLuminanceMap.allocate(width,height, GL_RGBA, FALSE, FALSE); - mLuminanceMap.setViewport(viewport_width, viewport_height); } else { mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE); - mScreen.setViewport(viewport_width, viewport_height); } if (gGLManager.mHasFramebufferMultisample && samples > 1) { mSampleBuffer.allocate(resX,resY,GL_RGBA,TRUE,TRUE,LLTexUnit::TT_RECT_TEXTURE,FALSE,samples); - mSampleBuffer.setViewport(viewport_width, viewport_height); - mScreen.setSampleBuffer(&mSampleBuffer); - if (LLPipeline::sRenderDeferred) { addDeferredAttachments(mSampleBuffer); mDeferredScreen.setSampleBuffer(&mSampleBuffer); } + mScreen.setSampleBuffer(&mSampleBuffer); + stop_glerror(); } @@ -711,10 +705,8 @@ void LLPipeline::createGLBuffers() stop_glerror(); - GLuint resX = gViewerWindow->getWindowWidthRaw(); - GLuint resY = gViewerWindow->getWindowHeightRaw(); - GLuint viewport_width = gViewerWindow->getWorldViewWidthRaw(); - GLuint viewport_height = gViewerWindow->getWorldViewHeightRaw(); + GLuint resX = gViewerWindow->getWorldViewWidthRaw(); + GLuint resY = gViewerWindow->getWorldViewHeightRaw(); if (LLPipeline::sRenderGlow) { //screen space glow buffers @@ -726,7 +718,10 @@ void LLPipeline::createGLBuffers() mGlow[i].allocate(512,glow_res,GL_RGBA,FALSE,FALSE); } - allocateScreenBuffer(resX,resY, viewport_width, viewport_height); + allocateScreenBuffer(resX,resY); + mScreenWidth = 0; + mScreenHeight = 0; + } if (sRenderDeferred) diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 9193e19bb1..67004a5f2d 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -111,7 +111,7 @@ public: void resizeScreenTexture(); void releaseGLBuffers(); void createGLBuffers(); - void allocateScreenBuffer(U32 resX, U32 resY, U32 viewport_width, U32 viewport_height); + void allocateScreenBuffer(U32 resX, U32 resY); void resetVertexBuffers(LLDrawable* drawable); void setUseVBO(BOOL use_vbo); @@ -467,6 +467,9 @@ public: static F32 sMinRenderSize; //screen texture + U32 mScreenWidth; + U32 mScreenHeight; + LLRenderTarget mScreen; LLRenderTarget mUIScreen; LLRenderTarget mDeferredScreen; diff --git a/indra/newview/skins/default/textures/bottomtray/Notices_Unread.png b/indra/newview/skins/default/textures/bottomtray/Notices_Unread.png Binary files differindex 98f1f04b9a..aa3898ca99 100644 --- a/indra/newview/skins/default/textures/bottomtray/Notices_Unread.png +++ b/indra/newview/skins/default/textures/bottomtray/Notices_Unread.png diff --git a/indra/newview/skins/default/textures/bottomtray/Unread_IM.png b/indra/newview/skins/default/textures/bottomtray/Unread_IM.png Binary files differindex a355917fca..598342ea80 100644 --- a/indra/newview/skins/default/textures/bottomtray/Unread_IM.png +++ b/indra/newview/skins/default/textures/bottomtray/Unread_IM.png diff --git a/indra/newview/skins/default/textures/icons/Stop_Off.png b/indra/newview/skins/default/textures/icons/Stop_Off.png Binary files differnew file mode 100644 index 0000000000..3ee215d36f --- /dev/null +++ b/indra/newview/skins/default/textures/icons/Stop_Off.png diff --git a/indra/newview/skins/default/textures/icons/UnZoom_Off.png b/indra/newview/skins/default/textures/icons/UnZoom_Off.png Binary files differnew file mode 100644 index 0000000000..c794113755 --- /dev/null +++ b/indra/newview/skins/default/textures/icons/UnZoom_Off.png diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index f4a239be62..3576b6ed77 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -50,8 +50,12 @@ with the same filename but different name <texture name="Arrow_Right_Off" file_name="navbar/Arrow_Right_Off.png" preload="true" /> <texture name="Arrow_Right_Press" file_name="navbar/Arrow_Right_Press.png" preload="true" /> - <texture name="Arrow_Up" file_name="widgets/Arrow_Up.png" preload="true" /> - <texture name="Arrow_Down" file_name="widgets/Arrow_Down.png" preload="true" /> + <texture name="Arrow_Left" file_name="widgets/Arrow_Left.png" preload="true" /> + <texture name="Arrow_Right" file_name="widgets/Arrow_Right.png" preload="true" /> + + <texture name="Arrow_Small_Up" file_name="widgets/Arrow_Small_Up.png" preload="true" /> + <texture name="Arrow_Small_Left" file_name="widgets/Arrow_Small_Left.png" preload="true" /> + <texture name="Arrow_Small_Right" file_name="widgets/Arrow_Small_Right.png" preload="true" /> <texture name="AudioMute_Off" file_name="icons/AudioMute_Off.png" preload="false" /> <texture name="AudioMute_Over" file_name="icons/AudioMute_Over.png" preload="false" /> @@ -120,6 +124,7 @@ with the same filename but different name <texture name="ComboButton_Press" file_name="widgets/ComboButton_Press.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> <texture name="ComboButton_Selected" file_name="widgets/ComboButton_Selected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> <texture name="ComboButton_UpSelected" file_name="widgets/ComboButton_UpSelected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> + <texture name="ComboButton_Up_On_Selected" file_name="widgets/ComboButton_Up_On_Selected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> <texture name="ComboButton_Off" file_name="widgets/ComboButton_Off.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> <texture name="ComboButton_UpOff" file_name="widgets/ComboButton_UpOff.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" /> <texture name="Container" file_name="containers/Container.png" preload="false" /> @@ -161,7 +166,7 @@ with the same filename but different name <texture name="Generic_Group" file_name="icons/Generic_Group.png" preload="false" /> <texture name="Generic_Group_Large" file_name="icons/Generic_Group_Large.png" preload="false" /> <texture name="Generic_Object_Medium" file_name="icons/Generic_Object_Medium.png" preload="false" /> - <texture name="Generic_Object_Small" file_name="icons/ Generic_Object_Small.png" preload="false" /> + <texture name="Generic_Object_Small" file_name="icons/Generic_Object_Small.png" preload="false" /> <texture name="Generic_Object_Large" file_name="icons/Generic_Object_Large.png" preload="false" /> <texture name="Generic_Person" file_name="icons/Generic_Person.png" preload="false" /> <texture name="Generic_Person_Large" file_name="icons/Generic_Person_Large.png" preload="false" /> @@ -439,6 +444,7 @@ with the same filename but different name <texture name="Search" file_name="navbar/Search.png" preload="false" /> <texture name="SegmentedBtn_Left_Off" file_name="widgets/SegmentedBtn_Left_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Left_Over" file_name="widgets/SegmentedBtn_Left_Over.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> <texture name="SegmentedBtn_Left_Press" file_name="widgets/SegmentedBtn_Left_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> <texture name="SegmentedBtn_Left_Disabled" file_name="widgets/SegmentedBtn_Left_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> <texture name="SegmentedBtn_Left_Selected" file_name="widgets/SegmentedBtn_Left_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> @@ -453,6 +459,7 @@ with the same filename but different name <texture name="SegmentedBtn_Middle_Selected_Disabled" file_name="widgets/SegmentedBtn_Middle_Selected_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> <texture name="SegmentedBtn_Right_Off" file_name="widgets/SegmentedBtn_Right_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> + <texture name="SegmentedBtn_Right_Over" file_name="widgets/SegmentedBtn_Right_Over.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> <texture name="SegmentedBtn_Right_Press" file_name="widgets/SegmentedBtn_Right_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> <texture name="SegmentedBtn_Right_Disabled" file_name="widgets/SegmentedBtn_Right_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> <texture name="SegmentedBtn_Right_Selected" file_name="widgets/SegmentedBtn_Right_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" /> @@ -483,6 +490,9 @@ with the same filename but different name <texture name="Stepper_Up_Off" file_name="widgets/Stepper_Up_Off.png" preload="true" /> <texture name="Stepper_Up_Press" file_name="widgets/Stepper_Up_Press.png" preload="true" /> + <texture name="Stop_Off" file_name="icons/Stop_Off.png" preload="false" /> + <texture name="Stop_Over" file_name="icons/Stop_Over.png" preload="false" /> + <texture name="Stop_Press" file_name="icons/Stop_Press.png" preload="false" /> <texture name="StopReload_Off" file_name="icons/StopReload_Off.png" preload="false" /> <texture name="StopReload_Over" file_name="icons/StopReload_Over.png" preload="false" /> <texture name="StopReload_Press" file_name="icons/StopReload_Press.png" preload="false" /> @@ -600,6 +610,15 @@ with the same filename but different name <texture name="Zoom_Off" file_name="icons/Zoom_Off.png" preload="false" /> <texture name="Zoom_Over" file_name="icons/Zoom_Over.png" preload="false" /> <texture name="Zoom_Press" file_name="icons/Zoom_Press.png" preload="false" /> + <texture name="UnZoom_Off" file_name="icons/UnZoom_Off.png" preload="false" /> + <texture name="UnZoom_Over" file_name="icons/UnZoom_Over.png" preload="false" /> + <texture name="UnZoom_Press" file_name="icons/UnZoom_Press.png" preload="false" /> + <texture name="PowerOn_Off" file_name="icons/PowerOn_Off.png" preload="false" /> + <texture name="PowerOn_Over" file_name="icons/PowerOn_Over.png" preload="false" /> + <texture name="PowerOn_Press" file_name="icons/PowerOn_Press.png" preload="false" /> + <texture name="PowerOff_Off" file_name="icons/PowerOff_Off.png" preload="false" /> + <texture name="PowerOff_Over" file_name="icons/PowerOff_Over.png" preload="false" /> + <texture name="PowerOff_Press" file_name="icons/PowerOff_Press.png" preload="false" /> <!--WARNING OLD ART *do not use*--> diff --git a/indra/newview/skins/default/textures/widgets/Arrow_Small_Left.png b/indra/newview/skins/default/textures/widgets/Arrow_Small_Left.png Binary files differnew file mode 100644 index 0000000000..2d624c3779 --- /dev/null +++ b/indra/newview/skins/default/textures/widgets/Arrow_Small_Left.png diff --git a/indra/newview/skins/default/textures/widgets/Arrow_Small_Right.png b/indra/newview/skins/default/textures/widgets/Arrow_Small_Right.png Binary files differnew file mode 100644 index 0000000000..91c03c426e --- /dev/null +++ b/indra/newview/skins/default/textures/widgets/Arrow_Small_Right.png diff --git a/indra/newview/skins/default/textures/widgets/Arrow_Small_Up.png b/indra/newview/skins/default/textures/widgets/Arrow_Small_Up.png Binary files differnew file mode 100644 index 0000000000..38aac0e5ca --- /dev/null +++ b/indra/newview/skins/default/textures/widgets/Arrow_Small_Up.png diff --git a/indra/newview/skins/default/textures/widgets/ComboButton_Up_On_Selected.png b/indra/newview/skins/default/textures/widgets/ComboButton_Up_On_Selected.png Binary files differnew file mode 100644 index 0000000000..fd1d11dd0b --- /dev/null +++ b/indra/newview/skins/default/textures/widgets/ComboButton_Up_On_Selected.png diff --git a/indra/newview/skins/default/xui/de/panel_me.xml b/indra/newview/skins/default/xui/de/panel_me.xml new file mode 100644 index 0000000000..a685a430f0 --- /dev/null +++ b/indra/newview/skins/default/xui/de/panel_me.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<panel label="Ich" name="panel_me"> + <tab_container name="tabs"> + <panel label="Mein Profil" name="panel_profile"/> + <panel label="Auswahl" name="panel_picks"/> + </tab_container> +</panel> diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml index 615d1bf18d..4f1024f56d 100644 --- a/indra/newview/skins/default/xui/en/floater_about_land.xml +++ b/indra/newview/skins/default/xui/en/floater_about_land.xml @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater can_tear_off="false" height="420" @@ -215,7 +215,6 @@ Go to World menu > About Land or select another parcel to show its details. </text> <button follows="left|top" - font="SansSerifSmall" height="16" label="Profile..." label_selected="Profile..." @@ -247,7 +246,6 @@ Go to World menu > About Land or select another parcel to show its details. width="250" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Set..." label_selected="Set..." @@ -269,7 +267,6 @@ Go to World menu > About Land or select another parcel to show its details. <button enabled="false" follows="left|top" - font="SansSerifSmall" height="16" label="Deed..." label_selected="Deed..." @@ -928,7 +925,6 @@ Go to World menu > About Land or select another parcel to show its details. bottom="100" enabled="false" follows="left|top" - font="SansSerifSmall" height="16" label="Show" label_selected="Show" @@ -940,7 +936,6 @@ Go to World menu > About Land or select another parcel to show its details. bottom="100" enabled="false" follows="left|top" - font="SansSerifSmall" height="16" label="Return..." label_selected="Return..." @@ -977,7 +972,6 @@ Go to World menu > About Land or select another parcel to show its details. bottom="120" enabled="false" follows="left|top" - font="SansSerifSmall" height="16" label="Show" label_selected="Show" @@ -989,7 +983,6 @@ Go to World menu > About Land or select another parcel to show its details. bottom="120" enabled="false" follows="left|top" - font="SansSerifSmall" height="16" label="Return..." label_selected="Return..." @@ -1026,7 +1019,6 @@ Go to World menu > About Land or select another parcel to show its details. bottom="140" enabled="false" follows="left|top" - font="SansSerifSmall" height="16" label="Show" label_selected="Show" @@ -1038,7 +1030,6 @@ Go to World menu > About Land or select another parcel to show its details. bottom="140" enabled="false" follows="left|top" - font="SansSerifSmall" height="16" label="Return..." label_selected="Return..." @@ -1108,7 +1099,6 @@ Go to World menu > About Land or select another parcel to show its details. </text> <button follows="left|top" - font="SansSerifSmall" height="16" label="Refresh List" label_selected="Refresh List" @@ -1120,7 +1110,6 @@ Go to World menu > About Land or select another parcel to show its details. <button enabled="false" follows="left|top" - font="SansSerifSmall" height="16" label="Return objects..." label_selected="Return objects..." @@ -1531,7 +1520,6 @@ Only large parcels can be listed in search. </text> <button follows="left|top" - font="SansSerifSmall" height="16" label="Set" label_selected="Set" @@ -1543,7 +1531,6 @@ Only large parcels can be listed in search. width="50" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Clear" label_selected="Clear" @@ -1654,7 +1641,6 @@ Only large parcels can be listed in search. text_readonly_color="0.576471 0.662745 0.835294 1" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Set..." label_selected="Set..." @@ -1685,7 +1671,6 @@ Only large parcels can be listed in search. width="300" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Reset..." label_selected="Reset..." @@ -2119,7 +2104,6 @@ Texture: width="80" /> <button follows="bottom" - font="SansSerifSmall" height="16" label="Remove" label_selected="Remove" @@ -2155,7 +2139,6 @@ Texture: width="195" /> <button follows="bottom" - font="SansSerifSmall" height="16" label="Add..." label_selected="Add..." @@ -2167,7 +2150,6 @@ Texture: <button enabled="false" follows="bottom" - font="SansSerifSmall" height="16" label="Remove" label_selected="Remove" diff --git a/indra/newview/skins/default/xui/en/floater_animation_preview.xml b/indra/newview/skins/default/xui/en/floater_animation_preview.xml index ebce758d3d..41b1f99d41 100644 --- a/indra/newview/skins/default/xui/en/floater_animation_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_animation_preview.xml @@ -163,7 +163,7 @@ Maximum animation length is [MAX_LENGTH] seconds. follows="top|left|right" height="23" layout="topleft" - left="85" + left="100" name="name_form" right="-10" /> <text @@ -182,7 +182,7 @@ Maximum animation length is [MAX_LENGTH] seconds. follows="top|left|right" height="23" layout="topleft" - left="85" + left="100" name="description_form" right="-10" /> <spinner @@ -192,7 +192,7 @@ Maximum animation length is [MAX_LENGTH] seconds. increment="1" initial_value="0" label="Priority" - label_width="90" + label_width="88" layout="topleft" left="10" max_val="4" @@ -214,14 +214,14 @@ Maximum animation length is [MAX_LENGTH] seconds. increment="1" initial_value="0" label="In(%)" - label_width="35" + label_width="49" layout="topleft" top_pad="5" left="30" max_val="100" name="loop_in_point" tool_tip="Sets point in animation that looping returns to" - width="110" /> + width="115" /> <spinner bottom_delta="0" follows="left|top" @@ -234,8 +234,8 @@ Maximum animation length is [MAX_LENGTH] seconds. max_val="100" name="loop_out_point" tool_tip="Sets point in animation that ends a loop" - label_width="45" - width="120" /> + label_width="49" + width="115" /> <text type="string" length="1" @@ -243,6 +243,7 @@ Maximum animation length is [MAX_LENGTH] seconds. follows="top|left" height="23" width="110" + word_wrap="true" layout="topleft" left="10" name="hand_label"> @@ -315,6 +316,7 @@ Maximum animation length is [MAX_LENGTH] seconds. follows="top|left" height="23" width="110" + word_wrap="true" layout="topleft" left="10" name="emote_label"> @@ -395,6 +397,7 @@ Maximum animation length is [MAX_LENGTH] seconds. follows="top|left" height="23" width="110" + word_wrap="true" layout="topleft" left="10" name="preview_label"> @@ -482,6 +485,8 @@ Maximum animation length is [MAX_LENGTH] seconds. <text type="string" length="1" + height="72" + word_wrap="true" top_pad="5" text_color="EmphasisColor" follows="top|left" diff --git a/indra/newview/skins/default/xui/en/floater_build_options.xml b/indra/newview/skins/default/xui/en/floater_build_options.xml index f0e678af00..56230e912c 100644 --- a/indra/newview/skins/default/xui/en/floater_build_options.xml +++ b/indra/newview/skins/default/xui/en/floater_build_options.xml @@ -15,14 +15,14 @@ height="23" initial_value="1" label="Grid Units (meters)" - label_width="130" + label_width="160" layout="topleft" left="10" max_val="5" min_val="0.01" name="GridResolution" top="25" - width="200" /> + width="230" /> <spinner control_name="GridDrawSize" decimal_digits="1" @@ -31,14 +31,14 @@ increment="0.5" initial_value="5" label="Grid Extents (meters)" - label_width="130" + label_width="160" layout="topleft" left_delta="0" max_val="50" min_val="1" name="GridDrawSize" top_pad="0" - width="200" /> + width="230" /> <check_box control_name="GridSubUnit" height="16" diff --git a/indra/newview/skins/default/xui/en/floater_customize.xml b/indra/newview/skins/default/xui/en/floater_customize.xml index 9d2a811d9f..275ab5bb8b 100644 --- a/indra/newview/skins/default/xui/en/floater_customize.xml +++ b/indra/newview/skins/default/xui/en/floater_customize.xml @@ -64,7 +64,6 @@ width="82" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Body" label_selected="Body" @@ -75,7 +74,6 @@ width="82" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Head" label_selected="Head" @@ -86,7 +84,6 @@ width="82" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Eyes" label_selected="Eyes" @@ -97,7 +94,6 @@ width="82" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Ears" label_selected="Ears" @@ -108,7 +104,6 @@ width="82" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Nose" label_selected="Nose" @@ -119,7 +114,6 @@ width="82" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Mouth" label_selected="Mouth" @@ -130,7 +124,6 @@ width="82" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Chin" label_selected="Chin" @@ -141,7 +134,6 @@ width="82" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Torso" label_selected="Torso" @@ -152,7 +144,6 @@ width="82" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Legs" label_selected="Legs" @@ -351,7 +342,6 @@ scratch and wear it. width="16" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Skin Color" label_selected="Skin Color" @@ -362,7 +352,6 @@ scratch and wear it. width="82" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Face Detail" label_selected="Face Detail" @@ -373,7 +362,6 @@ scratch and wear it. width="82" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Makeup" label_selected="Makeup" @@ -384,7 +372,6 @@ scratch and wear it. width="82" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Body Detail" label_selected="Body Detail" @@ -606,7 +593,6 @@ scratch and wear it. width="16" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Color" label_selected="Color" @@ -617,7 +603,6 @@ scratch and wear it. width="82" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Style" label_selected="Style" @@ -628,7 +613,6 @@ scratch and wear it. width="82" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Eyebrows" label_selected="Eyebrows" @@ -639,7 +623,6 @@ scratch and wear it. width="82" /> <button follows="left|top" - font="SansSerifSmall" height="16" label="Facial" label_selected="Facial" diff --git a/indra/newview/skins/default/xui/en/floater_env_settings.xml b/indra/newview/skins/default/xui/en/floater_env_settings.xml index 5233cb023d..5e78037ee1 100644 --- a/indra/newview/skins/default/xui/en/floater_env_settings.xml +++ b/indra/newview/skins/default/xui/en/floater_env_settings.xml @@ -136,7 +136,6 @@ width="210" /> <button follows="left|top" - font="SansSerifSmall" height="20" label="Use Estate Time" layout="topleft" @@ -146,7 +145,6 @@ width="137" /> <button follows="left|top" - font="SansSerifSmall" height="20" label="Advanced Sky" layout="topleft" @@ -156,7 +154,6 @@ width="137" /> <button follows="left|top" - font="SansSerifSmall" height="20" label="Advanced Water" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/floater_god_tools.xml b/indra/newview/skins/default/xui/en/floater_god_tools.xml index 79eed52fbf..b01c0edc8b 100644 --- a/indra/newview/skins/default/xui/en/floater_god_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_god_tools.xml @@ -191,7 +191,6 @@ </check_box> <button follows="top|right" - font="SansSerifSmall" height="22" label="Bake Terrain" label_selected="Bake Terrain" @@ -206,7 +205,6 @@ </button> <button follows="top|right" - font="SansSerifSmall" height="22" label="Revert Terrain" label_selected="Revert Terrain" @@ -220,7 +218,6 @@ </button> <button follows="top|right" - font="SansSerifSmall" height="22" label="Swap Terrain" label_selected="Swap Terrain" @@ -419,7 +416,6 @@ <button follows="top|right" - font="SansSerifSmall" height="22" label="Refresh" label_selected="Refresh" @@ -434,7 +430,6 @@ </button> <button follows="top|right" - font="SansSerifSmall" height="22" label="Apply" label_selected="Apply" @@ -449,7 +444,6 @@ </button> <button follows="top|right" - font="SansSerifSmall" height="22" label="Select Region" label_selected="Select Region" @@ -464,7 +458,6 @@ </button> <button follows="top|right" - font="SansSerifSmall" height="22" label="Autosave now" label_selected="Autosave now" @@ -556,7 +549,6 @@ </check_box> <button follows="top|right" - font="SansSerifSmall" height="22" label="Apply" label_selected="Apply" @@ -571,7 +563,6 @@ </button> <button follows="top|right" - font="SansSerifSmall" height="22" label="Set Target" label_selected="Set Target" @@ -598,7 +589,6 @@ </text> <button follows="top|right" - font="SansSerifSmall" height="22" label="Delete Target's Scripted Objects On Others Land" label_selected="Delete Target's Scripted Objects On Others Land" @@ -613,7 +603,6 @@ </button> <button follows="top|right" - font="SansSerifSmall" height="22" label="Delete Target's Scripted Objects On *Any* Land" label_selected="Delete Target's Scripted Objects On *Any* Land" @@ -628,7 +617,6 @@ </button> <button follows="top|right" - font="SansSerifSmall" height="22" label="Delete *ALL* Of Target's Objects" label_selected="Delete *ALL* Of Target's Objects" @@ -643,7 +631,6 @@ </button> <button follows="top|right" - font="SansSerifSmall" height="20" label="Get Top Colliders" label_selected="Get Top Colliders" @@ -658,7 +645,6 @@ </button> <button follows="top|right" - font="SansSerifSmall" height="20" label="Get Top Scripts" label_selected="Get Top Scripts" @@ -673,7 +659,6 @@ </button> <button follows="top|right" - font="SansSerifSmall" height="20" label="Scripts digest" label_selected="Scripts digest" diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml new file mode 100644 index 0000000000..cf6a4e45bd --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_im_container.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<multi_floater
+background_visible="true"
+bg_color="yellow"
+ can_resize="true"
+ height="390"
+ layout="topleft"
+ name="floater_im_box"
+ help_topic="floater_im_box"
+ save_rect="true"
+ save_visibility="true"
+ single_instance="true"
+ title="Instant Messages"
+ width="392">
+ <tab_container
+ follows="left|right|top|bottom"
+ height="390"
+ layout="topleft"
+ left="1"
+ name="im_box_tab_container"
+ tab_position="bottom"
+ tab_width="80"
+ top="0"
+ width="390" />
+ <icon
+ color="DefaultShadowLight"
+ enabled="false"
+ follows="left|right|bottom"
+ height="17"
+ image_name="tabarea.tga"
+ layout="bottomleft"
+ left="1"
+ name="im_box_tab_container_icon"
+ bottom="10"
+ width="390" />
+</multi_floater>
diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 01713cc003..645c2973d8 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -9,7 +9,7 @@ name="panel_im" top="0" can_close="true" - can_dock="true" + can_dock="false" can_minimize="false" visible="true" width="300" @@ -18,7 +18,7 @@ min_height="350"> <layout_stack follows="all" - height="350" + height="320" width="300" layout="topleft" orientation="horizontal" @@ -35,7 +35,8 @@ <layout_panel left="0" top="0" - width="180" + height="200" + width="185" user_resize="false"> <button height="20" @@ -55,10 +56,9 @@ width="25" name="slide_right_btn" /> <chat_history - length="1" font="SansSerifSmall" - follows="left|right|top" - height="280" + follows="left|right|top|bottom" + height="150" name="chat_history" parse_highlights="true" allow_html="true" @@ -66,12 +66,13 @@ width="180"> </chat_history> <line_editor - follows="left|right|top" + bottom="0" + follows="left|right|bottom" font="SansSerifSmall" height="20" label="To" + layout="bottomleft" name="chat_editor" - top_pad="1" width="180"> </line_editor> </layout_panel> diff --git a/indra/newview/skins/default/xui/en/floater_image_preview.xml b/indra/newview/skins/default/xui/en/floater_image_preview.xml index 2562daf4b3..6f8f272128 100644 --- a/indra/newview/skins/default/xui/en/floater_image_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_image_preview.xml @@ -47,9 +47,11 @@ <text type="string" length="1" - bottom_delta="20" + bottom_delta="30" follows="top|left" - height="15" + height="25" + width="105" + word_wrap="true" layout="topleft" name="preview_label"> Preview image as: @@ -96,7 +98,9 @@ <text type="string" length="1" - bottom="190" + bottom="225" + height="45" + word_wrap="true" follows="top|left" layout="topleft" left="10" @@ -114,7 +118,7 @@ Try saving image as 24 bit Targa (.tga). layout="topleft" left_delta="2" name="lossless_check" - top_pad="197" + top_pad="162" width="280" /> <button follows="bottom|right" diff --git a/indra/newview/skins/default/xui/en/floater_inventory_item_properties.xml b/indra/newview/skins/default/xui/en/floater_inventory_item_properties.xml index 4ca6002c13..366098013b 100644 --- a/indra/newview/skins/default/xui/en/floater_inventory_item_properties.xml +++ b/indra/newview/skins/default/xui/en/floater_inventory_item_properties.xml @@ -106,12 +106,11 @@ left_delta="78" name="LabelCreatorName" top_delta="0" - width="200"> + width="170"> Nicole Linden </text> <button follows="top|right" - font="SansSerifSmall" height="16" label="Profile..." layout="topleft" @@ -140,12 +139,11 @@ left_delta="78" name="LabelOwnerName" top_delta="0" - width="200"> + width="170"> Thrax Linden </text> <button follows="top|right" - font="SansSerifSmall" height="16" label="Profile..." layout="topleft" @@ -257,12 +255,13 @@ type="string" length="1" follows="left|top" - height="10" + height="25" layout="topleft" left="10" name="NextOwnerLabel" top_pad="5" - width="78"> + width="78" + word_wrap="true"> Next owner: </text> <check_box @@ -303,7 +302,7 @@ layout="topleft" follows="left|top" name="combobox sale copy" - width="90"> + width="110"> <combo_box.item label="Copy" name="Copy" @@ -319,14 +318,26 @@ increment="1" control_name="Edit Cost" name="Edit Cost" - label="Price: L$" - label_width="60" + label="Price:" + label_width="100" left="10" - width="180" + width="192" min_val="1" height="19" max_val="999999999" top_pad="5"/> + <text + type="string" + length="1" + height="15" + follows="left|top" + layout="topleft" + left_delta="82" + name="CurrencySymbol" + top_delta="1" + width="18"> + L$ + </text> <!--line_editor border_style="line" diff --git a/indra/newview/skins/default/xui/en/floater_moveview.xml b/indra/newview/skins/default/xui/en/floater_moveview.xml index 5a8ffcebea..cff0c29dfc 100644 --- a/indra/newview/skins/default/xui/en/floater_moveview.xml +++ b/indra/newview/skins/default/xui/en/floater_moveview.xml @@ -151,8 +151,7 @@ top="2" width="31" /> <button - follows="left|bottom" - font="SansSerifSmall" + follows="left|bottom" height="23" image_overlay="Move_Run_Off" image_selected="PushButton_Selected_Press" diff --git a/indra/newview/skins/default/xui/en/floater_openobject.xml b/indra/newview/skins/default/xui/en/floater_openobject.xml index 3fd118df1c..41a440aaa0 100644 --- a/indra/newview/skins/default/xui/en/floater_openobject.xml +++ b/indra/newview/skins/default/xui/en/floater_openobject.xml @@ -38,7 +38,6 @@ width="284" /> <button follows="bottom|left" - font="SansSerifSmall" height="23" label="Copy To Inventory" label_selected="Copy To Inventory" @@ -53,7 +52,6 @@ </button> <button follows="bottom|left" - font="SansSerifSmall" height="23" label="Copy And Wear" label_selected="Copy And Wear" diff --git a/indra/newview/skins/default/xui/en/floater_preview_animation.xml b/indra/newview/skins/default/xui/en/floater_preview_animation.xml index 3b84358484..bbfb362337 100644 --- a/indra/newview/skins/default/xui/en/floater_preview_animation.xml +++ b/indra/newview/skins/default/xui/en/floater_preview_animation.xml @@ -38,7 +38,6 @@ width="170" /> <button height="20" - font="SansSerifSmall" label="Play in World" label_selected="Stop" layout="topleft" @@ -49,7 +48,6 @@ width="125" /> <button height="20" - font="SansSerifSmall" label="Play Locally" label_selected="Stop" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/floater_preview_sound.xml b/indra/newview/skins/default/xui/en/floater_preview_sound.xml index 95347f0dff..68a78d5017 100644 --- a/indra/newview/skins/default/xui/en/floater_preview_sound.xml +++ b/indra/newview/skins/default/xui/en/floater_preview_sound.xml @@ -50,7 +50,6 @@ <button follows="left|top" height="22" - font="SansSerifSmall" label="Play Locally" label_selected="Play Locally" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/floater_script.xml b/indra/newview/skins/default/xui/en/floater_script.xml new file mode 100644 index 0000000000..f44ba6d873 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_script.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<floater + legacy_header_height="18" + background_visible="true" + follows="left|top|right|bottom" + height="369" + layout="topleft" + left="0" + name="script_floater" + help_topic="script_floater" + top="0" + can_dock="true" + can_minimize="true" + visible="true" + width="520" + can_resize="true" + min_width="350" + min_height="369"> +</floater> diff --git a/indra/newview/skins/default/xui/en/floater_sell_land.xml b/indra/newview/skins/default/xui/en/floater_sell_land.xml index 2cf800fb15..e6a78563f3 100644 --- a/indra/newview/skins/default/xui/en/floater_sell_land.xml +++ b/indra/newview/skins/default/xui/en/floater_sell_land.xml @@ -205,7 +205,6 @@ width="130" /> <button height="20" - font="SansSerifSmall" label="Select" layout="topleft" left_pad="5" @@ -267,7 +266,6 @@ </radio_group> <button height="20" - font="SansSerifSmall" label="Show Objects" layout="topleft" name="show_objects" @@ -290,7 +288,6 @@ <button follows="bottom|left" height="20" - font="SansSerifSmall" label="Set Land For Sale" layout="topleft" left_delta="0" @@ -300,7 +297,6 @@ <button follows="bottom|right" height="20" - font="SansSerifSmall" label="Cancel" layout="topleft" left_pad="30" diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml index 95a40e27f7..8860ac1e50 100644 --- a/indra/newview/skins/default/xui/en/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml @@ -120,7 +120,6 @@ width="85" /> <button follows="left|top" - font="SansSerifSmall" height="20" label="More >>" layout="topleft" @@ -131,7 +130,6 @@ width="80" /> <button follows="left|top" - font="SansSerifSmall" height="20" label="<< Less" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/floater_telehub.xml b/indra/newview/skins/default/xui/en/floater_telehub.xml index cc0ab8c57e..374f014908 100644 --- a/indra/newview/skins/default/xui/en/floater_telehub.xml +++ b/indra/newview/skins/default/xui/en/floater_telehub.xml @@ -57,7 +57,6 @@ </text> <button follows="top|left" - font="SansSerifSmall" height="20" label="Connect Telehub" layout="topleft" @@ -67,7 +66,6 @@ width="110" /> <button follows="top|left" - font="SansSerifSmall" height="20" label="Disconnect" layout="topleft" @@ -97,7 +95,6 @@ width="230" /> <button follows="top|left" - font="SansSerifSmall" height="20" label="Add Spawn" layout="topleft" @@ -107,7 +104,6 @@ width="110" /> <button follows="top|left" - font="SansSerifSmall" height="20" label="Remove Spawn" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/floater_test_button.xml b/indra/newview/skins/default/xui/en/floater_test_button.xml index 2bd0d1a0fa..8c6ad5c0f7 100644 --- a/indra/newview/skins/default/xui/en/floater_test_button.xml +++ b/indra/newview/skins/default/xui/en/floater_test_button.xml @@ -23,7 +23,6 @@ name="bottom_delta_button" /> <button bottom_delta="30" - font="SansSerifSmall" height="23" label="SansSerifSmall" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/floater_test_slider.xml b/indra/newview/skins/default/xui/en/floater_test_slider.xml index 86ff82e01f..85d8bb2bb1 100644 --- a/indra/newview/skins/default/xui/en/floater_test_slider.xml +++ b/indra/newview/skins/default/xui/en/floater_test_slider.xml @@ -2,7 +2,7 @@ <floater legacy_header_height="18" can_resize="true" - height="400" + height="500" layout="topleft" name="floater_test_slider" help_topic="floater_test_slider" @@ -84,4 +84,17 @@ name="red_slider" text_color="red" text_width="40" /> + <slider + width ="140" + bottom="490" + decimal_digits="1" + height="100" + left="20" + label="Red Slider Vertical" + label_width="100" + layout="topleft" + name="red_slider_vertical" + text_color="red" + orientation="vertical" + text_width="20" /> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml index 4679ae467d..113da9ea4d 100644 --- a/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml +++ b/indra/newview/skins/default/xui/en/floater_texture_ctrl.xml @@ -49,7 +49,6 @@ <button enabled="false" follows="left|bottom" - font="SansSerifSmall" height="20" label="Default" label_selected="Default" @@ -61,7 +60,6 @@ <button enabled="false" follows="left|bottom" - font="SansSerifSmall" height="20" label="None" label_selected="None" @@ -72,7 +70,6 @@ width="80" /> <button follows="left|bottom" - font="SansSerifSmall" height="20" label="Blank" label_selected="Blank" diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 8b6f0f03fe..636e9d465a 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -701,7 +701,6 @@ </slider_bar> <button follows="left|top" - font="SansSerifSmall" height="19" label="Apply" label_selected="Apply" @@ -927,7 +926,6 @@ width="150" /> <button follows="top|left" - font="SansSerifSmall" height="20" label="Deed" label_selected="Deed" @@ -2606,7 +2604,6 @@ even though the user gets a free copy. width="170" /> <button follows="left|top" - font="SansSerifSmall" height="19" label="Apply" label_selected="Apply" @@ -2742,7 +2739,6 @@ even though the user gets a free copy. decouple_texture_size="true" /> <button follows="left|top" - font="SansSerifSmall" height="19" label="Align" label_selected="Align Media" diff --git a/indra/newview/skins/default/xui/en/floater_url_entry.xml b/indra/newview/skins/default/xui/en/floater_url_entry.xml index 1ab42cb140..29fb29fabf 100644 --- a/indra/newview/skins/default/xui/en/floater_url_entry.xml +++ b/indra/newview/skins/default/xui/en/floater_url_entry.xml @@ -32,7 +32,6 @@ <button follows="top|left" height="20" - font="SansSerifSmall" label="OK" layout="topleft" left="10" @@ -42,7 +41,6 @@ <button follows="top|left" height="20" - font="SansSerifSmall" label="Cancel" layout="topleft" left_pad="5" @@ -52,7 +50,6 @@ <button follows="top|right" height="20" - font="SansSerifSmall" label="Clear" layout="topleft" left_pad="65" diff --git a/indra/newview/skins/default/xui/en/floater_whitelist_entry.xml b/indra/newview/skins/default/xui/en/floater_whitelist_entry.xml index ef68d03a45..4ece0fa3ba 100644 --- a/indra/newview/skins/default/xui/en/floater_whitelist_entry.xml +++ b/indra/newview/skins/default/xui/en/floater_whitelist_entry.xml @@ -17,9 +17,9 @@ tool_tip="Enter a URL or URL pattern to White List" width="350" /> - <button follows="top|left" height="20" font="SansSerifSmall" label="OK" + <button follows="top|left" height="20" label="OK" layout="topleft" left="10" name="ok_btn" bottom_delta="28" width="64" /> - <button follows="top|left" height="20" font="SansSerifSmall" label="Cancel" + <button follows="top|left" height="20" label="Cancel" layout="topleft" left_pad="5" name="cancel_btn" bottom_delta="0" width="64" /> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml index c60cc163c8..e3db0972ec 100644 --- a/indra/newview/skins/default/xui/en/floater_world_map.xml +++ b/indra/newview/skins/default/xui/en/floater_world_map.xml @@ -116,7 +116,6 @@ </text> <button follows="top|right" - font="SansSerifSmall" height="16" label="Go Home" label_selected="Go Home" diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml index 14a4949df7..3bf7f50a2c 100644 --- a/indra/newview/skins/default/xui/en/main_view.xml +++ b/indra/newview/skins/default/xui/en/main_view.xml @@ -15,19 +15,19 @@ orientation="vertical" top="0"> <layout_panel auto_resize="false" - min_height="19" + height="84" mouse_opaque="false" - name="status_bar_container" - height="19" + name="nav_and_status_bar_region" width="1024" - visible="false"/> - <layout_panel auto_resize="false" - height="65" - mouse_opaque="false" - name="nav_bar_container" - width="1024" - visible="false"/> - <panel auto_resize="true" + visible="false"> + <panel follows="left|right|bottom" + left="0" + name="nav_bar_container" + right="1024" + top="19" + height="65"/> + </layout_panel> + <layout_panel auto_resize="true" follows="all" height="500" layout="topleft" @@ -124,8 +124,16 @@ height="500" name="DebugView" width="1024"/> - </panel> + </layout_panel> </layout_stack> + <panel mouse_opaque="false" + follows="left|right|top" + name="status_bar_container" + height="19" + left="0" + top="0" + width="1024" + visible="false"/> <notify_box_view top="0" follows="all" height="768" diff --git a/indra/newview/skins/default/xui/en/menu_navbar.xml b/indra/newview/skins/default/xui/en/menu_navbar.xml index 89469fb013..e17eeb46f6 100644 --- a/indra/newview/skins/default/xui/en/menu_navbar.xml +++ b/indra/newview/skins/default/xui/en/menu_navbar.xml @@ -10,7 +10,6 @@ width="128"> <menu_item_check label="Show Coordinates" - layout="topleft" name="Show Coordinates"> <menu_item_check.on_click function="Navbar.Action" @@ -19,22 +18,28 @@ function="Navbar.EnableMenuItem" parameter="show_coordinates" /> </menu_item_check> + <menu_item_check + label="Show Parcel Properties" + name="Show Parcel Properties"> + <menu_item_check.on_click + function="Navbar.Action" + parameter="show_properties" /> + <menu_item_check.on_check + control="NavBarShowParcelProperties" /> + </menu_item_check> <!-- Label of 'Landmark' item is changing in runtime, see AddLandmarkNavBarMenu/EditLandmarkNavBarMenu in strings.xml --> <menu_item_call label="Landmark" - layout="topleft" name="Landmark"> <menu_item_call.on_click function="Navbar.Action" parameter="landmark" /> </menu_item_call> <menu_item_separator - layout="topleft" name="Separator" /> <menu_item_call label="Cut" - layout="topleft" name="Cut"> <menu_item_call.on_click function="Navbar.Action" @@ -45,7 +50,6 @@ </menu_item_call> <menu_item_call label="Copy" - layout="topleft" name="Copy"> <menu_item_call.on_click function="Navbar.Action" @@ -56,7 +60,6 @@ </menu_item_call> <menu_item_call label="Paste" - layout="topleft" name="Paste"> <menu_item_call.on_click function="Navbar.Action" @@ -67,7 +70,6 @@ </menu_item_call> <menu_item_call label="Delete" - layout="topleft" name="Delete"> <menu_item_call.on_click function="Navbar.Action" @@ -78,7 +80,6 @@ </menu_item_call> <menu_item_call label="Select All" - layout="topleft" name="Select All"> <menu_item_call.on_click function="Navbar.Action" diff --git a/indra/newview/skins/default/xui/en/menu_profile_overflow.xml b/indra/newview/skins/default/xui/en/menu_profile_overflow.xml index 7b52fecef7..d0128d1c9a 100644 --- a/indra/newview/skins/default/xui/en/menu_profile_overflow.xml +++ b/indra/newview/skins/default/xui/en/menu_profile_overflow.xml @@ -12,4 +12,11 @@ <menu_item_call.on_click function="Profile.Pay" /> </menu_item_call> + <menu_item_call + label="Share" + layout="topleft" + name="share"> + <menu_item_call.on_click + function="Profile.Share" /> + </menu_item_call> </toggleable_menu> diff --git a/indra/newview/skins/default/xui/en/menu_url_inventory.xml b/indra/newview/skins/default/xui/en/menu_url_inventory.xml new file mode 100644 index 0000000000..cf9d1d5881 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_url_inventory.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<context_menu + layout="topleft" + name="Url Popup"> + <menu_item_call + label="Show Inventory Item" + layout="topleft" + name="show_item"> + <menu_item_call.on_click + function="Url.Execute" /> + </menu_item_call> + <menu_item_separator + layout="topleft" /> + <menu_item_call + label="Copy Name to clipboard" + layout="topleft" + name="url_copy_label"> + <menu_item_call.on_click + function="Url.CopyLabel" /> + </menu_item_call> + <menu_item_call + label="Copy SLurl to clipboard" + layout="topleft" + name="url_copy"> + <menu_item_call.on_click + function="Url.CopyUrl" /> + </menu_item_call> +</context_menu> diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 8ab5fb1659..9722849690 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -59,7 +59,7 @@ label="My Inventory" layout="topleft" name="Inventory" - shortcut="control|I"> + shortcut="control|shift|I"> <menu_item_check.on_check function="Floater.Visible" parameter="inventory" /> @@ -68,6 +68,15 @@ parameter="inventory" /> </menu_item_check> <menu_item_call + label="Show Sidetray Inventory" + name="ShowSidetrayInventory" + shortcut="control|I" + visible="false"> + <menu_item_call.on_click + function="ShowSidetrayPanel" + parameter="sidepanel_inventory" /> + </menu_item_call> + <menu_item_call label="My Gestures" layout="topleft" name="Gestures" @@ -1709,6 +1718,8 @@ layout="topleft" name="Fly" shortcut="Home"> + <menu_item_check.on_check + function="Agent.getFlying" /> <menu_item_check.on_click function="Agent.toggleFlying" /> <menu_item_check.on_enable diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 90e32cdd9c..1d385b5a9f 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -3939,6 +3939,18 @@ Would you like to leave Busy Mode before completing this transaction? <notification icon="alertmodal.tga" + name="ConfirmDeleteProtectedCategory" + type="alertmodal"> +The folder '[FOLDERNAME]' is a system folder. Deleting system folders can cause instability. Are you sure you want to delete it? + <usetemplate + ignoretext="Confirm before I delete a system folder" + name="okcancelignore" + notext="Cancel" + yestext="OK"/> + </notification> + + <notification + icon="alertmodal.tga" name="ConfirmEmptyTrash" type="alertmodal"> Are you sure you want to permanently delete the contents of your Trash? @@ -4494,7 +4506,7 @@ You don't have permission to copy this. icon="notifytip.tga" name="InventoryAccepted" type="notifytip"> -[NAME] accepted your inventory offer. +[NAME] received your inventory offer. </notification> <notification @@ -4966,17 +4978,17 @@ No valid parcel could be found. icon="notify.tga" name="ObjectGiveItem" type="offer"> -An object named [OBJECTFROMNAME] owned by [NAME_SLURL] has offered you [OBJECTTYPE]: +An object named [OBJECTFROMNAME] owned by [NAME_SLURL] has given you [OBJECTTYPE]: [ITEM_SLURL] <form name="form"> <button index="0" name="Keep" - text="OK"/> + text="Keep"/> <button index="1" name="Discard" - text="Cancel"/> + text="Discard"/> <button index="2" name="Mute" @@ -4988,17 +5000,17 @@ An object named [OBJECTFROMNAME] owned by [NAME_SLURL] has offered you [OBJECTTY icon="notify.tga" name="ObjectGiveItemUnknownUser" type="offer"> -An object named [OBJECTFROMNAME] owned by (an unknown Resident) has offered you [OBJECTTYPE]: +An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you [OBJECTTYPE]: [ITEM_SLURL] <form name="form"> <button index="0" name="Keep" - text="OK"/> + text="Keep"/> <button index="1" name="Discard" - text="Cancel"/> + text="Discard"/> <button index="2" name="Mute" @@ -5010,17 +5022,21 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has offered you icon="notify.tga" name="UserGiveItem" type="offer"> -[NAME_SLURL] has offered you [OBJECTTYPE]: +[NAME_SLURL] has given you [OBJECTTYPE]: [ITEM_SLURL] <form name="form"> <button index="0" name="Keep" - text="Accept"/> + text="Keep"/> + <button + index="4" + name="Show" + text="Show"/> <button index="1" name="Discard" - text="No, thanks"/> + text="Discard"/> </form> </notification> @@ -5307,6 +5323,27 @@ Grant this request? <notification icon="notify.tga" + name="ScriptToast" + type="notify"> + [FIRST] [LAST]'s '[TITLE]' is requesting user input. + <form name="form"> + <button + index="0" + name="Open" + text="Open Dialog"/> + <button + index="1" + name="Ignore" + text="Ignore"/> + <button + index="2" + name="Block" + text="Block"/> + </form> + </notification> + + <notification + icon="notify.tga" name="FirstBalanceIncrease" type="notify"> You just received L$[AMOUNT]. diff --git a/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml b/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml index a283cff5b3..368ab17689 100644 --- a/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml +++ b/indra/newview/skins/default/xui/en/panel_adhoc_control_panel.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <panel border="false" + follows="all" height="215" name="panel_im_control_panel" width="180"> @@ -23,7 +24,7 @@ bg_alpha_color="DkGray2" border="false" bottom="1" - follows="left|bottom" + follows="left|right|bottom" height="70" left="0" left_pad="0" @@ -32,6 +33,7 @@ width="180"> <button bottom="10" + follows="all" height="20" label="Call" left_delta="40" @@ -39,6 +41,7 @@ width="100" /> <button bottom="40" + follows="all" height="20" label="Leave Call" name="end_call_btn" @@ -46,6 +49,7 @@ width="100" /> <button enabled="false" + follows="all" bottom="10" height="20" label="Voice Controls" diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml index 6480469f43..da8006d545 100644 --- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml @@ -46,7 +46,7 @@ left="0" min_height="23" width="310" - top="0" + top="4" min_width="192" name="chat_bar" user_resize="false" @@ -58,7 +58,7 @@ height="28" layout="topleft" min_height="28" - width="104" + width="100" top_delta="0" min_width="54" name="speak_panel" @@ -71,7 +71,7 @@ layout="topleft" left="0" name="talk" - top="3" + top="4" width="100" /> </layout_panel> <icon @@ -104,11 +104,10 @@ layout="topleft" name="Gesture" left="0" - top="3" + top="4" width="82" tool_tip="Shows/hides gestures"> <gesture_combo_box.drop_down_button - font="SansSerifSmall" pad_right="10" use_ellipses="true" /> </gesture_combo_box> @@ -137,6 +136,9 @@ width="80" min_width="49"> <button + image_selected="PushButton_Selected_Press" + image_pressed="PushButton_Press" + image_pressed_selected="PushButton_Selected_Press" follows="left|right" height="23" use_ellipses="true" @@ -145,7 +147,7 @@ layout="topleft" name="movement_btn" tool_tip="Shows/hides movement controls" - top="3" + top="4" width="80"> <button.init_callback function="Button.SetDockableFloaterToggle" @@ -176,6 +178,9 @@ user_resize="false" width="80"> <button + image_selected="PushButton_Selected_Press" + image_pressed="PushButton_Press" + image_pressed_selected="PushButton_Selected_Press" follows="left|right" height="23" use_ellipses="true" @@ -184,7 +189,7 @@ layout="topleft" left="0" tool_tip="Shows/hides camera controls" - top="3" + top="4" name="camera_btn" width="80"> <button.init_callback @@ -221,7 +226,7 @@ layout="topleft" name="snapshots" width="36" - top="3" + top="4" image_overlay="Snapshot_Off" tool_tip="Take snapshot"> <button.commit_callback @@ -245,37 +250,47 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly. <chiclet_panel mouse_opaque="false" follows="left|right" - height="28" + height="23" layout="topleft" left="0" min_width="180" name="chiclet_list" - top="0" - chiclet_padding="3" + top="4" + chiclet_padding="4" scrolling_offset="40" width="189"> <button auto_resize="true" follows="right" height="23" - image_selected="BottomTray_Scroll_Left" - image_unselected="BottomTray_Scroll_Left" + image_selected="SegmentedBtn_Left_Off" + image_unselected="SegmentedBtn_Left_Off" + image_hover_selected="SegmentedBtn_Left_Over" + image_hover_unselected="SegmentedBtn_Left_Over" + image_pressed="SegmentedBtn_Left_Press" + image_pressed_selected="SegmentedBtn_Left_Press" + image_overlay="Arrow_Small_Left" layout="topleft" name="chicklet_left_scroll_button" tab_stop="false" - top="3" + top="0" visible="false" width="20" /> <button auto_resize="true" follows="right" height="23" - image_selected="BottomTray_Scroll_Right" - image_unselected="BottomTray_Scroll_Right" + image_selected="SegmentedBtn_Right_Off" + image_unselected="SegmentedBtn_Right_Off" + image_hover_selected="SegmentedBtn_Right_Over" + image_hover_unselected="SegmentedBtn_Right_Over" + image_pressed="SegmentedBtn_Right_Press" + image_pressed_selected="SegmentedBtn_Right_Press" + image_overlay="Arrow_Small_Right" layout="topleft" name="chicklet_right_scroll_button" tab_stop="false" - top="3" + top="0" visible="false" width="20" /> </chiclet_panel> @@ -311,6 +326,9 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly. top="4" width="54"> <button + image_selected="PushButton_Selected_Press" + image_pressed="PushButton_Press" + image_pressed_selected="PushButton_Selected_Press" auto_resize="true" halign="right" height="23" diff --git a/indra/newview/skins/default/xui/en/panel_chat_header.xml b/indra/newview/skins/default/xui/en/panel_chat_header.xml index 7a3eae35a9..c1090a1686 100644 --- a/indra/newview/skins/default/xui/en/panel_chat_header.xml +++ b/indra/newview/skins/default/xui/en/panel_chat_header.xml @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <panel - background_visible="true" + background_visible="true" bevel_style="in" bg_alpha_color="black" follows="top|left|right" height="24" label="im_header" - layout="topleft" + layout="topleft" name="im_header" width="300"> - <avatar_icon + <avatar_icon follows="left" height="18" image_name="Generic_Person" @@ -19,18 +19,20 @@ name="avatar_icon" top="3" width="18" /> - <text + <text_editor + v_pad = "0" + read_only = "true" follows="left|right" - font.style="BOLD" - height="12" - layout="topleft" - left_pad="5" - right="-50" + font.style="BOLD" + height="12" + layout="topleft" + left_pad="5" + right="-60" name="user_name" text_color="white" - top="8" - use_ellipses="true" - value="Erica Vader" /> + top="8" + use_ellipses="true" + value="Ericag Vader" /> <text font="SansSerifSmall" follows="right" @@ -39,7 +41,7 @@ layout="topleft" left_pad="5" name="time_box" - right="-10" + right="-5" top="8" value="23:30" width="50" /> diff --git a/indra/newview/skins/default/xui/en/panel_classified_info.xml b/indra/newview/skins/default/xui/en/panel_classified_info.xml index bdca8531dc..df889e87c3 100644 --- a/indra/newview/skins/default/xui/en/panel_classified_info.xml +++ b/indra/newview/skins/default/xui/en/panel_classified_info.xml @@ -151,7 +151,6 @@ name="buttons"> <button follows="bottom|left" - font="SansSerifSmall" height="19" label="Teleport" layout="topleft" @@ -161,7 +160,6 @@ width="90" /> <button follows="bottom|left" - font="SansSerifSmall" height="19" label="Map" layout="topleft" @@ -171,7 +169,6 @@ width="90" /> <button follows="bottom|left" - font="SansSerifSmall" height="19" label="Edit" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/panel_edit_profile.xml b/indra/newview/skins/default/xui/en/panel_edit_profile.xml index 2378ae518b..a833ad97d9 100644 --- a/indra/newview/skins/default/xui/en/panel_edit_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_edit_profile.xml @@ -15,6 +15,10 @@ [ACCTTYPE] [PAYMENTINFO] [AGEVERIFICATION] </string> + <string + name="RegisterDateFormat"> + [REG_DATE] ([AGE]) + </string> <string name="AcctTypeResident" value="Resident" /> diff --git a/indra/newview/skins/default/xui/en/panel_group_control_panel.xml b/indra/newview/skins/default/xui/en/panel_group_control_panel.xml index 2fee2033f6..41b210557e 100644 --- a/indra/newview/skins/default/xui/en/panel_group_control_panel.xml +++ b/indra/newview/skins/default/xui/en/panel_group_control_panel.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <panel border="false" + follows="left|top|right|bottom" height="238" name="panel_im_control_panel" width="180"> @@ -22,6 +23,7 @@ <button bottom_pad="0" + follows="left|right|bottom" height="20" label="Group Info" left_delta="28" @@ -32,7 +34,7 @@ background_visible="true" bg_alpha_color="0.2 0.2 0.2 1" border="false" - follows="left|bottom" + follows="left|right|bottom" height="70" left="0" left_pad="0" @@ -42,6 +44,7 @@ <button bottom="10" + follows="all" height="20" label="Call Group" left_delta="28" @@ -50,6 +53,7 @@ <button bottom="40" + follows="all" height="20" label="Leave Call" name="end_call_btn" @@ -59,6 +63,7 @@ <button enabled="false" bottom="10" + follows="all" height="20" label="Open Voice Controls" name="voice_ctrls_btn" diff --git a/indra/newview/skins/default/xui/en/panel_group_invite.xml b/indra/newview/skins/default/xui/en/panel_group_invite.xml index 1996977acb..37578eae70 100644 --- a/indra/newview/skins/default/xui/en/panel_group_invite.xml +++ b/indra/newview/skins/default/xui/en/panel_group_invite.xml @@ -33,7 +33,6 @@ invite to your group. Click 'Open Resident Chooser' to start. </text> <button - font="SansSerifSmall" height="20" label="Open Resident Chooser" layout="topleft" @@ -53,7 +52,6 @@ Resident Chooser' to start. top_pad="4" width="200" /> <button - font="SansSerifSmall" height="20" label="Remove Selected from List" layout="topleft" @@ -82,7 +80,6 @@ Resident Chooser' to start. top_delta="16" width="196" /> <button - font="SansSerifSmall" height="20" label="Send Invitations" layout="topleft" @@ -91,7 +88,6 @@ Resident Chooser' to start. top="356" width="130" /> <button - font="SansSerifSmall" height="20" label="Cancel" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml index 73d843e6dd..0a5812882d 100644 --- a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml +++ b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml @@ -38,12 +38,12 @@ label="Teleport" name="teleport_btn" width="100" /> - <!-- <button + <button follows="left|top" height="20" label="Share" name="share_btn" - width="100" />--> + width="100" /> <!--Removing pay button to save space - will update spec - verified by Erica/Steve --> <!-- <button follows="left|top" diff --git a/indra/newview/skins/default/xui/en/panel_me.xml b/indra/newview/skins/default/xui/en/panel_me.xml new file mode 100644 index 0000000000..a99777848b --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_me.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<panel + background_visible="true" + border="false" + follows="all" + height="570" + label="My Profile" + layout="topleft" + left="0" + name="panel_me" + top="0" + width="333"> + <!--<text + type="string" + follows="top|left|right" + font="SansSerifHugeBold" + height="20" + layout="topleft" + left="15" + name="user_name" + text_color="white" + top="0" + mouse_opaque="true" + width="280"> + (Loading...) + </text> --> + <tab_container + follows="all" + height="575" + halign="center" + layout="topleft" + left="10" + name="tabs" + tab_min_width="95" + tab_height="30" + tab_position="top" + top_pad="10" + width="313"> + <panel + class="panel_my_profile" + filename="panel_my_profile.xml" + label="PROFILE" + help_topic="panel_my_profile_tab" + name="panel_profile" /> + <panel + class="panel_picks" + filename="panel_picks.xml" + label="PICKS" + help_topic="panel_my_picks_tab" + name="panel_picks" /> + </tab_container> +</panel> diff --git a/indra/newview/skins/default/xui/en/panel_media_settings_general.xml b/indra/newview/skins/default/xui/en/panel_media_settings_general.xml index 686f4ac1d5..e00f654750 100644 --- a/indra/newview/skins/default/xui/en/panel_media_settings_general.xml +++ b/indra/newview/skins/default/xui/en/panel_media_settings_general.xml @@ -93,27 +93,19 @@ </text> <combo_box allow_text_entry="false" - bottom_delta="-20" - enabled="true" + bottom_delta="-20" follows="left|top" height="18" left="10" - max_chars="20" - mouse_opaque="true" + max_chars="20" name="controls" width="120"> <combo_item - type="string" - length="1" - enabled="true" name="Standard" value="Standard"> Standard </combo_item> <combo_item - type="string" - length="1" - enabled="true" name="Mini" value="Mini"> Mini diff --git a/indra/newview/skins/default/xui/en/panel_my_profile.xml b/indra/newview/skins/default/xui/en/panel_my_profile.xml new file mode 100644 index 0000000000..fe3e010cf9 --- /dev/null +++ b/indra/newview/skins/default/xui/en/panel_my_profile.xml @@ -0,0 +1,429 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<panel + follows="all" + height="535" + label="Profile" + layout="topleft" + left="0" + name="panel_profile" + top="0" + width="313"> + <string + name="CaptionTextAcctInfo"> + [ACCTTYPE] +[PAYMENTINFO] [AGEVERIFICATION] + </string> + <string + name="payment_update_link_url"> + http://www.secondlife.com/account/billing.php?lang=en + </string> + <string + name="partner_edit_link_url"> + http://www.secondlife.com/account/partners.php?lang=en + </string> + <string + name="my_account_link_url" + value="http://secondlife.com/account" /> + <string + name="no_partner_text" + value="None" /> + <string + name="RegisterDateFormat"> + [REG_DATE] ([AGE]) + </string> + <scroll_container + color="DkGray2" + follows="all" + height="485" + layout="topleft" + name="profile_scroll" + reserve_scroll_corner="true" + opaque="true" + top="0" + width="313"> + <panel + name="scroll_content_panel" + follows="left|top|right" + height="485" + layout="topleft" + top="0" + left="0" + width="313"> + <panel + follows="left|top" + height="117" + layout="topleft" + left="10" + name="second_life_image_panel" + top="0" + width="280"> + <texture_picker + allow_no_texture="true" + default_image_name="None" + enabled="false" + follows="top|left" + height="117" + layout="topleft" + left="0" + name="2nd_life_pic" + top="10" + width="102" /> + <icon + height="102" + image_name="Blank" + layout="topleft" + name="2nd_life_edit_icon" + label="" + left="0" + tool_tip="Click the Edit Profile button below to change image" + top="10" + width="102" /> + <text + follows="left|top|right" + font.style="BOLD" + height="15" + layout="topleft" + left_pad="10" + name="title_sl_descr_text" + text_color="white" + top_delta="0" + value="[SECOND_LIFE]:" + width="165" /> + <expandable_text + follows="left|top|right" + height="95" + layout="topleft" + left="107" + textbox.max_length="512" + name="sl_description_edit" + top_pad="-3" + width="173" + expanded_bg_visible="true" + expanded_bg_color="DkGray"> + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum. adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum. adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum. + </expandable_text> + </panel> + <panel + follows="left|top" + height="117" + layout="topleft" + top_pad="10" + left="10" + name="first_life_image_panel" + width="280"> + <texture_picker + allow_no_texture="true" + default_image_name="None" + enabled="false" + follows="top|left" + height="117" + layout="topleft" + left="0" + name="real_world_pic" + width="102" /> + <icon + height="102" + image_name="Blank" + layout="topleft" + name="real_world_edit_icon" + label="" + left="0" + tool_tip="Click the Edit Profile button below to change image" + top="4" + width="102" /> + <text + follows="left|top|right" + font.style="BOLD" + height="15" + layout="topleft" + left_pad="10" + name="title_rw_descr_text" + text_color="white" + top_delta="0" + value="Real World:" + width="165" /> + <expandable_text + follows="left|top|right" + height="95" + layout="topleft" + left="107" + textbox.max_length="512" + name="fl_description_edit" + top_pad="-3" + width="173" + expanded_bg_visible="true" + expanded_bg_color="DkGray"> + Lorem ipsum dolor sit amet, consectetur adlkjpiscing elit moose moose. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet. adipiscing elit. Aenean rigviverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet sorbet ipsum. adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum. + </expandable_text> + </panel> + + + <!-- <panel + name="lifes_images_panel" + follows="left|top|right" + height="244" + layout="topleft" + top="0" + left="0" + width="285"> + <panel + follows="left|top" + height="117" + layout="topleft" + left="10" + name="second_life_image_panel" + top="0" + width="285"> + <text + follows="left|top|right" + font.style="BOLD" + height="15" + layout="topleft" + left="0" + name="second_life_photo_title_text" + text_color="white" + value="[SECOND_LIFE]:" + width="170" /> + <texture_picker + allow_no_texture="true" + default_image_name="None" + enabled="false" + follows="top|left" + height="117" + layout="topleft" + left="0" + name="2nd_life_pic" + top_pad="0" + width="102" /> + </panel> + <icon + height="18" + image_name="AddItem_Off" + layout="topleft" + name="2nd_life_edit_icon" + label="" + left="87" + tool_tip="Click to select an image" + top="25" + width="18" /> + </panel> --> + + + + + <text + type="string" + follows="left|top" + font="SansSerifSmall" + font.style="BOLD" + height="15" + layout="topleft" + left="10" + name="me_homepage_text" + text_color="white" + top_pad="0" + width="280"> + Homepage: + </text> + <text + follows="left|top" + height="15" + layout="topleft" + left="10" + name="homepage_edit" + top_pad="0" + value="http://librarianavengers.org" + width="280" + word_wrap="false" + use_ellipses="true" + /> + <text + follows="left|top" + font.style="BOLD" + height="10" + layout="topleft" + left="10" + name="title_member_text" + text_color="white" + top_pad="10" + value="Member Since:" + width="280" /> + <text + follows="left|top" + height="15" + layout="topleft" + left="10" + name="register_date" + value="05/31/1976" + width="280" + word_wrap="true" /> + <text + follows="left|top" + font.style="BOLD" + height="15" + layout="topleft" + left="10" + name="title_acc_status_text" + text_color="white" + top_pad="10" + value="Account Status:" + width="280" /> + <!-- <text + type="string" + follows="left|top" + font="SansSerifSmall" + height="15" + layout="topleft" + left_pad="10" + name="my_account_link" + top_delta="0" + value="Go to Dashboard" + width="100"/> --> + <text + follows="left|top" + height="20" + layout="topleft" + left="10" + name="acc_status_text" + top_pad="0" + value="Resident. No payment info on file." + width="280" + word_wrap="true" /> + <text + follows="left|top" + font.style="BOLD" + height="15" + layout="topleft" + left="10" + name="title_partner_text" + text_color="white" + top_pad="5" + value="Partner:" + width="280" /> + <panel + follows="left|top" + height="15" + layout="topleft" + left="10" + name="partner_data_panel" + top_pad="0" + width="280"> + <text + follows="left|top" + height="10" + layout="topleft" + left="0" + name="partner_text" + top="0" + value="[FIRST] [LAST]" + width="280" + word_wrap="true" /> + </panel> + <text + follows="left|top" + font.style="BOLD" + height="15" + layout="topleft" + left="10" + name="title_groups_text" + text_color="white" + top_pad="8" + value="Groups:" + width="280" /> + <expandable_text + follows="left|top|bottom" + height="60" + layout="topleft" + left="10" + name="sl_groups" + top_pad="0" + width="280" + expanded_bg_visible="true" + expanded_bg_color="DkGray"> + Lorem ipsum dolor sit amet, consectetur adlkjpiscing elit moose moose. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet. adipiscing elit. Aenean rigviverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet sorbet ipsum. adipiscing elit. Aenean viverra orci et justo sagittis aliquet. Nullam malesuada mauris sit amet ipsum. + </expandable_text> + </panel> + </scroll_container> + <panel + follows="bottom|left" + layout="topleft" + left="0" + name="profile_buttons_panel" + top_pad="2" + bottom="10" + height="19" + width="303"> + <button + follows="bottom|left" + height="19" + label="Add Friend" + layout="topleft" + left="0" + mouse_opaque="false" + name="add_friend" + top="5" + width="75" /> + <button + follows="bottom|left" + height="19" + label="IM" + layout="topleft" + name="im" + top="5" + left_pad="5" + width="45" /> + <button + follows="bottom|left" + height="19" + label="Call" + layout="topleft" + name="call" + left_pad="5" + top="5" + width="45" /> + <button + enabled="false" + follows="bottom|left" + height="19" + label="Map" + layout="topleft" + name="show_on_map_btn" + top="5" + left_pad="5" + width="45" /> + <button + follows="bottom|left" + height="19" + label="Teleport" + layout="topleft" + name="teleport" + left_pad="5" + top="5" + width="80" /> + </panel> + <panel + follows="bottom|left" + layout="topleft" + left="0" + top_pad="-17" + name="profile_me_buttons_panel" + visible="false" + height="19" + width="303"> + <button + follows="bottom|right" + height="19" + left="10" + label="Edit Profile" + name="edit_profile_btn" + width="130" /> + <button + follows="bottom|right" + height="19" + label="Edit Appearance" + left_pad="10" + name="edit_appearance_btn" + right="-10" + width="130" /> + </panel> +</panel> diff --git a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml index a90337d31a..bf33b752d9 100644 --- a/indra/newview/skins/default/xui/en/panel_navigation_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_navigation_bar.xml @@ -41,7 +41,6 @@ width="600"> <button follows="left|top" - font="SansSerifSmall" height="23" image_disabled="PushButton_Disabled" image_disabled_selected="PushButton_Disabled" @@ -58,7 +57,6 @@ <button follows="left|top" - font="SansSerifSmall" height="23" image_disabled="PushButton_Disabled" image_disabled_selected="PushButton_Disabled" @@ -74,7 +72,6 @@ width="31" /> <button follows="left|top" - font="SansSerifSmall" height="23" image_disabled="PushButton_Disabled" image_disabled_selected="PushButton_Disabled" diff --git a/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml b/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml index ecf35523cd..de612fbbc3 100644 --- a/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml @@ -26,7 +26,7 @@ max_length="512" name="chat_box" tool_tip="Press Enter to say, Ctrl+Enter to shout" - top="0" + top="1" width="279" /> <output_monitor auto_update="true" @@ -37,19 +37,21 @@ left_pad="-24" mouse_opaque="true" name="chat_zone_indicator" - top="4" + top="1" visible="true" width="20" /> <button follows="right" is_toggle="true" width="20" - top="0" + top="1" layout="topleft" - left_pad="4 " + left_pad="4" image_disabled="ComboButton_UpOff" image_unselected="ComboButton_UpOff" - image_selected="ComboButton_UpSelected" + image_selected="ComboButton_Up_On_Selected" + image_pressed="ComboButton_UpSelected" + image_pressed_selected="ComboButton_Up_On_Selected" height="23" name="show_nearby_chat" tool_tip="Shows/hides nearby chat log"> diff --git a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml index f511ec0d6f..d805209bf5 100644 --- a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml @@ -6,6 +6,18 @@ width="310" border="true" follows="left|top|right|bottom"> + <accordion + follows="left|top|right|bottom" + height="315" + layout="topleft" + left="0" + name="outfits_accordion" + top="2" + width="310"> + <accordion_tab + layout="topleft" + name="tab_outfits" + title="Outfits bar"> <inventory_panel allow_multi_select="true" border="true" @@ -14,9 +26,28 @@ height="326" left="0" mouse_opaque="true" - name="outfits_list" + name="outfitslist_accordionpanel" width="310" start_folder="My Outfits"/> + </accordion_tab> + <accordion_tab + layout="topleft" + name="tab_cof" + title="Current Outfit bar"> + <inventory_panel + allow_multi_select="true" + border="true" + bottom="0" + follows="left|top|right|bottom" + height="326" + left="0" + mouse_opaque="true" + name="cof_accordionpanel" + width="310" + start_folder="Current Outfit"/> + </accordion_tab> + </accordion> + <button bottom="0" halign="center" height="16" diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index a370b450e9..87861e7901 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -344,7 +344,6 @@ background_visible="true" width="313"> <button follows="bottom|left" - font="SansSerifSmall" top="4" left="0" height="19" @@ -355,7 +354,6 @@ background_visible="true" width="70" /> <button follows="bottom|left" - font="SansSerifSmall" top="4" left_pad="2" height="19" @@ -366,7 +364,6 @@ background_visible="true" width="45" /> <button follows="bottom|left" - font="SansSerifSmall" top="4" left_pad="2" height="19" @@ -377,7 +374,6 @@ background_visible="true" width="50" /> <button follows="left|top" - font="SansSerifSmall" top="4" left_pad="2" height="19" @@ -387,7 +383,6 @@ background_visible="true" width="60" /> <button follows="bottom|left" - font="SansSerifSmall" top="4" left_pad="2" height="19" @@ -398,7 +393,6 @@ background_visible="true" width="75" /> <button follows="bottom|left" - font="SansSerifSmall" top="4" left="0" height="19" @@ -409,7 +403,6 @@ background_visible="true" width="110" /> <button follows="bottom|left" - font="SansSerifSmall" top="4" left_pad="2" height="19" diff --git a/indra/newview/skins/default/xui/en/panel_pick_info.xml b/indra/newview/skins/default/xui/en/panel_pick_info.xml index cf18aa2d39..0cf2a7afc3 100644 --- a/indra/newview/skins/default/xui/en/panel_pick_info.xml +++ b/indra/newview/skins/default/xui/en/panel_pick_info.xml @@ -103,7 +103,6 @@ name="buttons"> <button follows="bottom|left" - font="SansSerifSmall" height="19" label="Teleport" layout="topleft" @@ -113,7 +112,6 @@ width="90" /> <button follows="bottom|left" - font="SansSerifSmall" height="19" label="Map" layout="topleft" @@ -123,7 +121,6 @@ width="90" /> <button follows="bottom|left" - font="SansSerifSmall" height="19" label="Edit" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/panel_picks.xml b/indra/newview/skins/default/xui/en/panel_picks.xml index 5cefe3e4ab..ca84c9147b 100644 --- a/indra/newview/skins/default/xui/en/panel_picks.xml +++ b/indra/newview/skins/default/xui/en/panel_picks.xml @@ -24,7 +24,7 @@ top="10" visible="false" width="313"> - There are no any picks/classifieds here + There are no picks/classifieds here </text> <accordion follows="all" @@ -131,7 +131,6 @@ <button enabled="false" follows="bottom|left" - font="SansSerifSmall" height="25" label="Info" layout="topleft" @@ -143,7 +142,6 @@ <button enabled="false" follows="bottom|left" - font="SansSerifSmall" height="25" label="Teleport" layout="topleft" @@ -155,7 +153,6 @@ <button enabled="false" follows="bottom|left" - font="SansSerifSmall" height="25" label="Map" layout="topleft" @@ -167,7 +164,6 @@ <button enabled="false" follows="bottom|right" - font="SansSerifSmall" height="25" label="▼" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/panel_places.xml b/indra/newview/skins/default/xui/en/panel_places.xml index 5efacb68be..88df529ec1 100644 --- a/indra/newview/skins/default/xui/en/panel_places.xml +++ b/indra/newview/skins/default/xui/en/panel_places.xml @@ -72,7 +72,6 @@ background_visible="true" width="313"> <button follows="bottom|left" - font="SansSerifSmall" height="19" label="Teleport" layout="topleft" @@ -82,7 +81,6 @@ background_visible="true" width="100" /> <button follows="bottom|left" - font="SansSerifSmall" height="19" label="Map" layout="topleft" @@ -92,7 +90,6 @@ background_visible="true" width="70" /> <button follows="bottom|left" - font="SansSerifSmall" height="19" label="Edit" layout="topleft" @@ -102,7 +99,6 @@ background_visible="true" width="70" /> <button follows="bottom|right" - font="SansSerifSmall" height="19" image_disabled="ForwardArrow_Off" image_selected="ForwardArrow_Press" @@ -114,7 +110,6 @@ background_visible="true" width="18" /> <button follows="bottom|right" - font="SansSerifSmall" height="19" label="Close" layout="topleft" @@ -124,7 +119,6 @@ background_visible="true" width="60" /> <button follows="bottom|right" - font="SansSerifSmall" height="19" label="Cancel" layout="topleft" @@ -134,7 +128,6 @@ background_visible="true" width="60" /> <button follows="bottom|right" - font="SansSerifSmall" height="19" label="Save" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml index 5a4b0a3892..fac0d5c60f 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -309,4 +309,13 @@ name="send_im_to_email" top_pad="5" width="400" /> + <check_box + enabled="false" + height="16" + label="Enable plain text chat history" + layout="topleft" + left_delta="0" + name="plain_text_chat_history" + top_pad="5" + width="400" /> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml index 88049fe7d1..af4c01185a 100644 --- a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml +++ b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml @@ -3,7 +3,7 @@ follows="left|right|top|bottom" name="MediaControls" background_visible="false" - height="160" + height="192" layout="topleft" mouse_opaque="false" width="800"> @@ -17,44 +17,6 @@ mouse_opaque="false" top="20" /> <layout_stack - follows="left|right|bottom" - height="32" - layout="topleft" - animate="false" - left="0" - orientation="horizontal" - top="96"> - <!-- outer layout_panels center the inner one --> - <layout_panel - width="0" - layout="topleft" - user_resize="false" /> - <panel - name="media_progress_indicator" - height="22" - layout="topleft" - visible="false" - left="0" - top="0" - auto_resize="false" - user_resize="false" - min_width="100" - width="200"> - <progress_bar - name="media_progress_bar" - color_bar="1 1 1 0.96" - follows="left|right|top" - height="16" - layout="topleft" - left="0" - tool_tip="Media is Loading"/> - </panel> - <layout_panel - width="0" - layout="topleft" - user_resize="false" /> - </layout_stack> - <layout_stack name="media_controls" follows="left|right" animate="false" @@ -152,9 +114,8 @@ top="2" min_width="22" width="22"> - <!-- The stop button here is temporary artwork --> <button - image_overlay="media_btn_stoploading.png" + image_overlay="Stop_Off" image_disabled="PushButton_Disabled" image_disabled_selected="PushButton_Disabled" image_selected="PushButton_Selected" @@ -417,8 +378,8 @@ function="MediaCtrl.CommitURL" /> height="22" min_width="22" width="22"> - <!-- Note: this isn't quite right either...the mute button is not the --> - <!-- same as the others because it can't have the "image_overlay" be --> + <!-- Note: this is not quite right either...the mute button is not the --> + <!-- same as the others because it cannot have the "image_overlay" be --> <!-- two different images. --> <button image_disabled="PushButton_Disabled" @@ -439,7 +400,7 @@ function="MediaCtrl.CommitURL" /> function="MediaCtrl.ToggleMute" /> </button> </layout_panel> - <!-- We don't have a design yet for "volume", so this is a temporary --> + <!-- We do not have a design yet for "volume", so this is a temporary --> <!-- solution. See DEV-42827. --> <layout_panel name="volume_up" @@ -609,9 +570,8 @@ function="MediaCtrl.CommitURL" /> layout="topleft" min_width="21" width="21" > - <!-- There is no "Zoom out" icon, so we use this temporarily --> <button - image_overlay="ForwardArrow_Off" + image_overlay="UnZoom_Off" image_disabled="PushButton_Disabled" image_disabled_selected="PushButton_Disabled" image_selected="PushButton_Selected" @@ -657,4 +617,41 @@ function="MediaCtrl.CommitURL" /> layout="topleft" user_resize="false" /> </layout_stack> + <layout_stack + follows="left|right|bottom" + height="32" + layout="topleft" + animate="false" + left="0" + orientation="horizontal" + top="150"> + <!-- outer layout_panels center the inner one --> + <layout_panel + width="0" + layout="topleft" + user_resize="false" /> + <panel + name="media_progress_indicator" + height="22" + layout="topleft" + left="0" + top="0" + auto_resize="false" + user_resize="false" + min_width="100" + width="200"> + <progress_bar + name="media_progress_bar" + color_bar="1 1 1 0.96" + follows="left|right|top" + height="8" + layout="topleft" + left="0" + tool_tip="Media is Loading"/> + </panel> + <layout_panel + width="0" + layout="topleft" + user_resize="false" /> + </layout_stack> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_profile.xml b/indra/newview/skins/default/xui/en/panel_profile.xml index bf1d46451b..947bb67152 100644 --- a/indra/newview/skins/default/xui/en/panel_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_profile.xml @@ -27,7 +27,10 @@ <string name="no_partner_text" value="None" /> - <string name="RegisterDateFormat">[REG_DATE] ([AGE])</string> + <string + name="RegisterDateFormat"> + [REG_DATE] ([AGE]) + </string> <scroll_container color="DkGray2" follows="all" @@ -324,7 +327,6 @@ width="64" /> <button follows="bottom|right" - font="SansSerifSmall" height="19" label="▼" layout="topleft" @@ -344,7 +346,6 @@ width="303"> <button follows="bottom|right" - font="SansSerifSmall" height="19" left="10" label="Edit Profile" diff --git a/indra/newview/skins/default/xui/en/panel_profile_view.xml b/indra/newview/skins/default/xui/en/panel_profile_view.xml index b015346a79..8e683bffc1 100644 --- a/indra/newview/skins/default/xui/en/panel_profile_view.xml +++ b/indra/newview/skins/default/xui/en/panel_profile_view.xml @@ -25,10 +25,11 @@ tab_stop="false" top="2" width="23" /> - <text + <text_editor + read_only = "true" follows="top|left|right" font="SansSerifHugeBold" - height="26" + height="29" layout="topleft" left_pad="10" name="user_name" @@ -52,7 +53,7 @@ halign="center" layout="topleft" left="10" - min_width="333" + min_width="333" name="tabs" tab_min_width="80" tab_height="30" diff --git a/indra/newview/skins/default/xui/en/panel_region_covenant.xml b/indra/newview/skins/default/xui/en/panel_region_covenant.xml index 49fc930cd8..75d7d85505 100644 --- a/indra/newview/skins/default/xui/en/panel_region_covenant.xml +++ b/indra/newview/skins/default/xui/en/panel_region_covenant.xml @@ -119,7 +119,6 @@ </text_editor> <button follows="left|top" - font="SansSerifSmall" height="18" label="Reset" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/panel_region_debug.xml b/indra/newview/skins/default/xui/en/panel_region_debug.xml index a1bca4229d..e07585d285 100644 --- a/indra/newview/skins/default/xui/en/panel_region_debug.xml +++ b/indra/newview/skins/default/xui/en/panel_region_debug.xml @@ -61,7 +61,6 @@ <button enabled="false" follows="left|top" - font="SansSerifSmall" height="20" label="Apply" layout="topleft" @@ -109,7 +108,6 @@ <button follows="left|top" height="20" - font="SansSerifSmall" label="Choose" layout="topleft" left_pad="5" @@ -156,7 +154,6 @@ <button follows="left|top" height="20" - font="SansSerifSmall" label="Return" layout="topleft" left="20" @@ -165,7 +162,6 @@ width="80" /> <button follows="left|top" - font="SansSerifSmall" height="20" label="Get Top Colliders..." layout="topleft" @@ -176,7 +172,6 @@ width="150" /> <button follows="left|top" - font="SansSerifSmall" height="20" label="Get Top Scripts..." layout="topleft" @@ -187,7 +182,6 @@ width="150" /> <button follows="left|top" - font="SansSerifSmall" height="20" label="Restart Region" layout="topleft" @@ -198,7 +192,6 @@ width="130" /> <button follows="left|top" - font="SansSerifSmall" height="20" label="Delay Restart" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/panel_side_tray.xml b/indra/newview/skins/default/xui/en/panel_side_tray.xml index d02354a647..95242a9639 100644 --- a/indra/newview/skins/default/xui/en/panel_side_tray.xml +++ b/indra/newview/skins/default/xui/en/panel_side_tray.xml @@ -102,9 +102,9 @@ background_visible="true" > <panel - class="panel_me_profile_view" - name="panel_me_profile" - filename="panel_me_profile.xml" + class="panel_me" + name="panel_me" + filename="panel_me.xml" label="Me" /> </sidetray_tab> diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml index b1afe76500..65bc48265d 100644 --- a/indra/newview/skins/default/xui/en/panel_status_bar.xml +++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml @@ -43,7 +43,6 @@ auto_resize="true" halign="right" follows="right|bottom" - font="SansSerifSmall" image_selected="BuyArrow_Over" image_unselected="BuyArrow_Off" image_pressed="BuyArrow_Press" diff --git a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml index b9a89a2ebc..4dae8e48a0 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml @@ -71,7 +71,6 @@ width="313" /> <button follows="bottom|left" - font="SansSerifSmall" height="25" label="Wear" layout="topleft" @@ -81,7 +80,6 @@ width="80" /> <button follows="bottom|left" - font="SansSerifSmall" height="25" label="New Outfit" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml index b8b3d993bd..33a6a52f5c 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml @@ -41,7 +41,6 @@ <button enabled="true" follows="bottom|left" - font="SansSerifSmall" height="25" label="Info" layout="topleft" @@ -50,20 +49,8 @@ top="0" width="60" /> <button - enabled="true" - follows="bottom|left" - font="SansSerifSmall" - height="25" - label="Share" - layout="topleft" - left_pad="5" - name="share_btn" - top="0" - width="60" /> - <button enabled="false" follows="bottom|left" - font="SansSerifSmall" height="25" label="Wear" layout="topleft" @@ -74,7 +61,6 @@ <button enabled="false" follows="bottom|left" - font="SansSerifSmall" height="25" label="Play" layout="topleft" @@ -85,7 +71,6 @@ <button enabled="false" follows="bottom|left" - font="SansSerifSmall" height="25" label="Teleport" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml index 6ae2477304..db8a844eb0 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml @@ -126,12 +126,11 @@ left_delta="78" name="LabelCreatorName" top_delta="0" - width="200"> + width="140"> Nicole Linden </text> <button follows="top|right" - font="SansSerifSmall" height="16" label="Profile..." layout="topleft" @@ -160,12 +159,11 @@ left_delta="78" name="LabelOwnerName" top_delta="0" - width="200"> + width="140"> Thrax Linden </text> <button follows="top|right" - font="SansSerifSmall" height="16" label="Profile..." layout="topleft" @@ -194,7 +192,7 @@ left_delta="78" name="LabelAcquiredDate" top_delta="0" - width="252"> + width="222"> Wed May 24 12:50:46 2006 </text> <text @@ -277,12 +275,13 @@ type="string" length="1" follows="left|top" - height="10" + height="25" layout="topleft" left="10" name="NextOwnerLabel" top_pad="5" - width="78"> + width="78" + word_wrap="true"> Next owner: </text> <check_box @@ -323,7 +322,7 @@ layout="topleft" follows="left|top" name="combobox sale copy" - width="90"> + width="110"> <combo_box.item label="Copy" name="Copy" @@ -339,14 +338,26 @@ increment="1" control_name="Edit Cost" name="Edit Cost" - label="Price: L$" - label_width="60" + label="Price:" + label_width="100" left="10" - width="180" + width="192" min_val="1" height="19" max_val="999999999" top_pad="5"/> + <text + type="string" + length="1" + height="15" + follows="left|top" + layout="topleft" + left_delta="82" + name="CurrencySymbol" + top_delta="1" + width="18"> + L$ + </text> <!--line_editor border_style="line" border_thickness="1" @@ -479,7 +490,6 @@ width="313"> <button follows="bottom|left" - font="SansSerifSmall" height="25" label="Edit" layout="topleft" @@ -489,7 +499,6 @@ width="50" /> <button follows="bottom|right" - font="SansSerifSmall" height="25" label="Cancel" layout="topleft" @@ -499,7 +508,6 @@ width="70" /> <button follows="bottom|right" - font="SansSerifSmall" height="25" label="Save" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml index 7647be7830..348f0dfc09 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml @@ -203,7 +203,6 @@ width="150" /> <button follows="top|left" - font="SansSerifSmall" height="20" label="Deed" label_selected="Deed" @@ -485,7 +484,6 @@ width="313"> <button follows="bottom|left" - font="SansSerifSmall" height="25" label="Edit" layout="topleft" @@ -495,7 +493,6 @@ width="50" /> <button follows="bottom|left" - font="SansSerifSmall" height="25" label="Open" layout="topleft" @@ -505,7 +502,6 @@ width="60" /> <button follows="bottom|left" - font="SansSerifSmall" height="25" label="Pay" layout="topleft" @@ -515,7 +511,6 @@ width="50" /> <button follows="bottom|left" - font="SansSerifSmall" height="25" label="Buy" layout="topleft" @@ -525,7 +520,6 @@ width="60" /> <button follows="bottom|right" - font="SansSerifSmall" height="25" label="Cancel" layout="topleft" @@ -535,7 +529,6 @@ width="70" /> <button follows="bottom|right" - font="SansSerifSmall" height="25" label="Save" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/widgets/button.xml b/indra/newview/skins/default/xui/en/widgets/button.xml index 6b11e72247..7c54e618ef 100644 --- a/indra/newview/skins/default/xui/en/widgets/button.xml +++ b/indra/newview/skins/default/xui/en/widgets/button.xml @@ -15,7 +15,6 @@ image_color="ButtonImageColor" image_color_disabled="ButtonImageColor" flash_color="ButtonFlashBgColor" - font="SansSerifSmall" hover_glow_amount="0.15" halign="center" scale_image="true"> diff --git a/indra/newview/skins/default/xui/en/widgets/chiclet_script.xml b/indra/newview/skins/default/xui/en/widgets/chiclet_script.xml new file mode 100644 index 0000000000..5011bf6a61 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/chiclet_script.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<chiclet_script
+ name="script_chiclet">
+ <icon
+ name="chiclet_icon"
+ follows="all"
+ mouse_opaque="false"
+ image_name="Generic_Object_Small" />
+</expandable_text>
\ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/widgets/gesture_combo_box.xml b/indra/newview/skins/default/xui/en/widgets/gesture_combo_box.xml index 6171be034f..4229f34c09 100644 --- a/indra/newview/skins/default/xui/en/widgets/gesture_combo_box.xml +++ b/indra/newview/skins/default/xui/en/widgets/gesture_combo_box.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> -<gesture_combo_box font="SansSerifSmall" +<gesture_combo_box label="Gestures" list_position="below" max_chars="20" @@ -7,7 +7,6 @@ <gesture_combo_box.combo_button name="Combobox Button" label="" hover_glow_amount="0.15" - font="SansSerifSmall" scale_image="true" image_unselected="ComboButton_Off" image_selected="ComboButton_Selected" @@ -17,15 +16,15 @@ label="" halign="center" hover_glow_amount="0.15" - font="SansSerif" scale_image="true" + image_selected="PushButton_Selected_Press" + image_pressed="PushButton_Press" + image_pressed_selected="PushButton_Selected_Press" image_unselected="PushButton_Off" - image_selected="PushButton_Selected" image_disabled="PushButton_Disabled" image_disabled_selected="PushButton_Selected_Disabled" /> <gesture_combo_box.combo_list bg_writeable_color="MenuDefaultBgColor" - scroll_bar_bg_visible="true" /> + scroll_bar_bg_visible="false" /> <gesture_combo_box.combo_editor name="Combo Text Entry" - select_on_focus="true" - font="SansSerifSmall" /> + select_on_focus="true" /> </gesture_combo_box> diff --git a/indra/newview/skins/default/xui/en/widgets/location_input.xml b/indra/newview/skins/default/xui/en/widgets/location_input.xml index d88bcfab1d..17b1479ec4 100644 --- a/indra/newview/skins/default/xui/en/widgets/location_input.xml +++ b/indra/newview/skins/default/xui/en/widgets/location_input.xml @@ -11,7 +11,7 @@ add_landmark_image_disabled="Favorite_Star_Off" add_landmark_image_hover="Favorite_Star_Over" add_landmark_image_selected="Favorite_Star_Press" - add_landmark_hpad="2" + icon_hpad="2" allow_text_entry="true" list_position="below" show_text_as_tentative="false" @@ -38,6 +38,60 @@ scale_image="false" top="19" left="-3" /> + <voice_icon + name="voice_icon" + width="22" + height="18" + top="21" + image_name="parcel_lght_VoiceNo" + /> + <fly_icon + name="fly_icon" + width="22" + height="18" + top="21" + image_name="parcel_lght_FlyNo" + /> + <push_icon + name="push_icon" + width="22" + height="18" + top="21" + image_name="parcel_lght_PushNo" + /> + <build_icon + name="build_icon" + width="22" + height="18" + top="21" + image_name="parcel_lght_BuildNo" + /> + <scripts_icon + name="scripts_icon" + width="22" + height="18" + top="21" + image_name="parcel_lght_ScriptsNo" + /> + <!-- NOTE: Placeholder icon, there is no dark grayscale version --> + <damage_icon + name="damage_icon" + width="22" + height="18" + top="21" + image_name="parcel_lght_Damage" + /> + <!-- Default text color is invisible on top of nav bar background --> + <damage_text + name="damage_text" + width="50" + height="18" + top="16" + halign="right" + font="SansSerifSmall" + text_color="TextFgColor" + /> + <combo_button name="Location History" label="" pad_right="0"/> diff --git a/indra/newview/skins/default/xui/en/widgets/menu_item.xml b/indra/newview/skins/default/xui/en/widgets/menu_item.xml index c98e9cb6b8..2bbaa6233f 100644 --- a/indra/newview/skins/default/xui/en/widgets/menu_item.xml +++ b/indra/newview/skins/default/xui/en/widgets/menu_item.xml @@ -1,6 +1,4 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <!-- Use this for the top-level menu styling --> -<menu_item - font="SansSerifSmall" - > +<menu_item> </menu_item> diff --git a/indra/newview/skins/default/xui/en/widgets/tab_container.xml b/indra/newview/skins/default/xui/en/widgets/tab_container.xml index f1401140de..477c6fb8b8 100644 --- a/indra/newview/skins/default/xui/en/widgets/tab_container.xml +++ b/indra/newview/skins/default/xui/en/widgets/tab_container.xml @@ -2,7 +2,7 @@ <tab_container tab_min_width="60" tab_max_width="150" font_halign="center" - font="SansSerif" + font="SansSerifSmall" tab_height="21"> <first_tab tab_top_image_unselected="TabTop_Left_Off" tab_top_image_selected="TabTop_Left_Selected" diff --git a/indra/newview/skins/default/xui/en/widgets/talk_button.xml b/indra/newview/skins/default/xui/en/widgets/talk_button.xml index 64c2e65a6e..7781bdd066 100644 --- a/indra/newview/skins/default/xui/en/widgets/talk_button.xml +++ b/indra/newview/skins/default/xui/en/widgets/talk_button.xml @@ -7,10 +7,13 @@ --> <speak_button follows="left|right" + image_selected="SegmentedBtn_Left_Selected_Press" + image_unselected="SegmentedBtn_Left_Off" + image_pressed="SegmentedBtn_Left_Selected_Press" + image_pressed_selected="SegmentedBtn_Left_Selected_Press" name="left" label="Speak" label_selected="Speak" - font="SansSerifSmall" tab_stop="false" /> <show_button @@ -23,8 +26,11 @@ bottom="0" tab_stop="false" is_toggle="true" - image_selected="ComboButton_UpSelected" - image_unselected="ComboButton_UpOff" + image_selected="SegmentedBtn_Right_Selected_Press" + image_unselected="SegmentedBtn_Right_Off" + image_pressed="SegmentedBtn_Right_Press" + image_pressed_selected="SegmentedBtn_Right_Selected_Press" + image_overlay="Arrow_Small_Up" /> <monitor follows="right" diff --git a/indra/newview/skins/default/xui/fr/panel_me.xml b/indra/newview/skins/default/xui/fr/panel_me.xml new file mode 100644 index 0000000000..5bedee4616 --- /dev/null +++ b/indra/newview/skins/default/xui/fr/panel_me.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<panel label="Moi" name="panel_me"> + <tab_container name="tabs"> + <panel label="Mon Profil" name="panel_profile"/> + <panel label="Préférences" name="panel_picks"/> + </tab_container> +</panel> diff --git a/indra/newview/skins/default/xui/ja/panel_me.xml b/indra/newview/skins/default/xui/ja/panel_me.xml new file mode 100644 index 0000000000..84151f43cf --- /dev/null +++ b/indra/newview/skins/default/xui/ja/panel_me.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<panel label="ミー" name="panel_me"> + <tab_container name="tabs"> + <panel label="プロフィール" name="panel_profile"/> + <panel label="ピック" name="panel_picks"/> + </tab_container> +</panel> diff --git a/indra/newview/tests/llmediadataclient_test.cpp b/indra/newview/tests/llmediadataclient_test.cpp index 217889c390..6ff2c9446e 100644 --- a/indra/newview/tests/llmediadataclient_test.cpp +++ b/indra/newview/tests/llmediadataclient_test.cpp @@ -191,6 +191,12 @@ public: virtual bool isDead() const { return mDead; } + void setDistanceFromAvatar(F64 val) + { mRep["distance"] = val; } + + void setTotalMediaInterest(F64 val) + { mRep["interest"] = val; } + int getNumBounceBacks() const { return mNumBounceBacks; } @@ -593,6 +599,91 @@ namespace tut ensure("queue empty", mdc->isEmpty()); } - + ensure("refcount of o1", o1->getNumRefs(), 1); + ensure("refcount of o2", o2->getNumRefs(), 1); + ensure("refcount of o3", o3->getNumRefs(), 1); + ensure("refcount of o4", o4->getNumRefs(), 1); + } + + ////////////////////////////////////////////////////////////////////////////////////////// + + template<> template<> + void mediadataclient_object_t::test<9>() + { + // + // Test queue re-ordering + // + LOG_TEST(9); + + LLMediaDataClientObject::ptr_t o1 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_1,"10.0","1.0")); + LLMediaDataClientObject::ptr_t o2 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_2,"20.0","1.0")); + LLMediaDataClientObject::ptr_t o3 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_3,"30.0","1.0")); + LLMediaDataClientObject::ptr_t o4 = new LLMediaDataClientObjectTest(_DATA(VALID_OBJECT_ID_4,"40.0","1.0")); + { + LLPointer<LLObjectMediaDataClient> mdc = new LLObjectMediaDataClient(NO_PERIOD,NO_PERIOD); + + // queue up all 4 objects. They should now be in the queue in + // order 1 through 4, with 4 being at the front of the queue + mdc->fetchMedia(o1); + mdc->fetchMedia(o2); + mdc->fetchMedia(o3); + mdc->fetchMedia(o4); + + int test_num = 0; + + ensure(STR(test_num) + ". is in queue 1", mdc->isInQueue(o1)); + ensure(STR(test_num) + ". is in queue 2", mdc->isInQueue(o2)); + ensure(STR(test_num) + ". is in queue 3", mdc->isInQueue(o3)); + ensure(STR(test_num) + ". is in queue 4", mdc->isInQueue(o4)); + ensure(STR(test_num) + ". post records", gPostRecords->size(), 0); + + ::pump_timers(); + ++test_num; + + // The first tick should remove the first one + ensure(STR(test_num) + ". is not in queue 1", !mdc->isInQueue(o1)); + ensure(STR(test_num) + ". is in queue 2", mdc->isInQueue(o2)); + ensure(STR(test_num) + ". is in queue 3", mdc->isInQueue(o3)); + ensure(STR(test_num) + ". is in queue 4", mdc->isInQueue(o4)); + ensure(STR(test_num) + ". post records", gPostRecords->size(), 1); + + // Now, pretend that object 4 moved relative to the avatar such + // that it is now closest + static_cast<LLMediaDataClientObjectTest*>( + static_cast<LLMediaDataClientObject*>(o4))->setDistanceFromAvatar(5.0); + + ::pump_timers(); + ++test_num; + + // The second tick should still pick off item 2, but then re-sort + // have picked off object 4 + ensure(STR(test_num) + ". is in queue 2", mdc->isInQueue(o2)); + ensure(STR(test_num) + ". is in queue 3", mdc->isInQueue(o3)); + ensure(STR(test_num) + ". is not in queue 4", !mdc->isInQueue(o4)); + ensure(STR(test_num) + ". post records", gPostRecords->size(), 2); + + ::pump_timers(); + ++test_num; + + // The third tick should pick off object 2 + ensure(STR(test_num) + ". is not in queue 2", !mdc->isInQueue(o2)); + ensure(STR(test_num) + ". is in queue 3", mdc->isInQueue(o3)); + ensure(STR(test_num) + ". post records", gPostRecords->size(), 3); + + // The fourth tick should pick off object 3 + ::pump_timers(); + ++test_num; + + ensure(STR(test_num) + ". is not in queue 3", !mdc->isInQueue(o3)); + ensure(STR(test_num) + ". post records", gPostRecords->size(), 4); + + ensure("queue empty", mdc->isEmpty()); + } + ensure("refcount of o1", o1->getNumRefs(), 1); + ensure("refcount of o2", o2->getNumRefs(), 1); + ensure("refcount of o3", o3->getNumRefs(), 1); + ensure("refcount of o4", o4->getNumRefs(), 1); + } + } diff --git a/install.xml b/install.xml index 1df8fd09f4..cc4db90f48 100644 --- a/install.xml +++ b/install.xml @@ -948,9 +948,9 @@ anguage Infrstructure (CLI) international standard</string> <key>darwin</key> <map> <key>md5sum</key> - <string>b40a13847ee773c9ee06f641fe0dd1c2</string> + <string>7f818f13faf7c02838fe66f7d27e1913</string> <key>url</key> - <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-darwin-20091023.tar.bz2</uri> + <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-darwin-20091124.tar.bz2</uri> </map> <key>linux</key> <map> @@ -962,9 +962,9 @@ anguage Infrstructure (CLI) international standard</string> <key>windows</key> <map> <key>md5sum</key> - <string>6f2f911545e5906edc87f4f3cda423a1</string> + <string>92cff05661b5547caae7cc6c66d09870</string> <key>url</key> - <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-windows-20091023.tar.bz2</uri> + <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-windows-20091123.tar.bz2</uri> </map> </map> </map> |