diff options
-rw-r--r-- | indra/llcommon/lleventapi.h | 5 | ||||
-rw-r--r-- | indra/llui/lluictrl.cpp | 6 | ||||
-rw-r--r-- | indra/llui/lluictrl.h | 4 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 22 | ||||
-rw-r--r-- | indra/llui/llview.h | 6 | ||||
-rw-r--r-- | indra/newview/llwindowlistener.cpp | 29 |
6 files changed, 46 insertions, 26 deletions
diff --git a/indra/llcommon/lleventapi.h b/indra/llcommon/lleventapi.h index 64d038ade4..1a37d780b6 100644 --- a/indra/llcommon/lleventapi.h +++ b/indra/llcommon/lleventapi.h @@ -149,6 +149,11 @@ public: * @endcode */ LLSD& operator[](const LLSD::String& key) { return mResp[key]; } + + /** + * set the response to the given data + */ + void setResponse(LLSD const & response){ mResp = response; } LLSD mResp, mReq; LLSD::String mKey; diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index d58df5801b..9b9e2ddb55 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -1045,3 +1045,9 @@ boost::signals2::connection LLUICtrl::setDoubleClickCallback( const mouse_signal if (!mDoubleClickSignal) mDoubleClickSignal = new mouse_signal_t(); return mDoubleClickSignal->connect(cb); } + +void LLUICtrl::addInfo(LLSD & info) +{ + LLView::addInfo(info); + info["value"] = getValue(); +} diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 09bed9b958..8a8b589e9c 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -301,7 +301,9 @@ protected: static F32 sActiveControlTransparency; static F32 sInactiveControlTransparency; - + + virtual void addInfo(LLSD & info); + private: BOOL mIsChrome; diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index a630a03c92..e2b9527cc5 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -47,6 +47,7 @@ #include "v3color.h" #include "lluictrlfactory.h" #include "lltooltip.h" +#include "llsdutil.h" // for ui edit hack #include "llbutton.h" @@ -2606,3 +2607,24 @@ const LLViewDrawContext& LLViewDrawContext::getCurrentContext() return *sDrawContextStack.back(); } + +LLSD LLView::getInfo(void) +{ + LLSD info; + addInfo(info); + return info; +} + +void LLView::addInfo(LLSD & info) +{ + info["path"] = getPathname(); + info["class"] = typeid(*this).name(); + info["visible"] = getVisible(); + info["visible_chain"] = isInVisibleChain(); + info["enabled"] = getEnabled(); + info["enabled_chain"] = isInEnabledChain(); + info["available"] = isAvailable(); + LLRect rect(calcScreenRect()); + info["rect"] = LLSDMap("left", rect.mLeft)("top", rect.mTop) + ("right", rect.mRight)("bottom", rect.mBottom); +} diff --git a/indra/llui/llview.h b/indra/llui/llview.h index fcae75c447..fe15307a5d 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -516,6 +516,9 @@ public: virtual S32 notify(const LLSD& info) { return 0;}; static const LLViewDrawContext& getDrawContext(); + + // Returns useful information about this ui widget. + LLSD getInfo(void); protected: void drawDebugRect(); @@ -546,7 +549,8 @@ protected: LLView* childrenHandleToolTip(S32 x, S32 y, MASK mask); ECursorType mHoverCursor; - + + virtual void addInfo(LLSD & info); private: template <typename METHOD, typename XDATA> diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp index d497964f6c..ac8e981c4e 100644 --- a/indra/newview/llwindowlistener.cpp +++ b/indra/newview/llwindowlistener.cpp @@ -135,18 +135,6 @@ protected: namespace { -void insertViewInformation(LLEventAPI::Response & response, LLView * target) -{ - // Get info about this LLView* for when we send response. - response["path"] = target->getPathname(); - response["class"] = typeid(*target).name(); - response["visible"] = target->getVisible(); - response["visible_chain"] = target->isInVisibleChain(); - response["enabled"] = target->getEnabled(); - response["enabled_chain"] = target->isInEnabledChain(); - response["available"] = target->isAvailable(); -} - // helper for getMask() MASK lookupMask_(const std::string& maskname) { @@ -219,10 +207,7 @@ void LLWindowListener::getInfo(LLSD const & evt) LLUI::resolvePath(gViewerWindow->getRootView(), path); if (target_view != 0) { - insertViewInformation(response, target_view); - LLRect rect(target_view->calcScreenRect()); - response["rect"] = LLSDMap("left", rect.mLeft)("top", rect.mTop) - ("right", rect.mRight)("bottom", rect.mBottom); + response.setResponse(target_view->getInfo()); } else { @@ -253,7 +238,7 @@ void LLWindowListener::keyDown(LLSD const & evt) } else if(target_view->isAvailable()) { - insertViewInformation(response, target_view); + response.setResponse(target_view->getInfo()); gFocusMgr.setKeyboardFocus(target_view); KEY key = getKEY(evt); @@ -290,7 +275,7 @@ void LLWindowListener::keyUp(LLSD const & evt) } else if (target_view->isAvailable()) { - insertViewInformation(response, target_view); + response.setResponse(target_view->getInfo()); gFocusMgr.setKeyboardFocus(target_view); mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt)); @@ -370,12 +355,7 @@ static void mouseEvent(const MouseFunc& func, const LLSD& request) "specified invalid \"path\": '" << path << "'")); } - insertViewInformation(response, target); - - // Don't show caller the LLView's own relative rectangle; that only - // tells its dimensions. Provide actual location on screen. - LLRect rect(target->calcScreenRect()); - response["rect"] = LLSDMap("left", rect.mLeft)("top", rect.mTop)("right", rect.mRight)("bottom", rect.mBottom); + response.setResponse(target->getInfo()); // The intent of this test is to prevent trying to drill down to a // widget in a hidden floater, or on a tab that's not current, etc. @@ -397,6 +377,7 @@ static void mouseEvent(const MouseFunc& func, const LLSD& request) if (! has_pos) { + LLRect rect(target->calcScreenRect()); pos.set(rect.getCenterX(), rect.getCenterY()); // nonstandard warning tactic: probably usual case; we want event // sender to know synthesized (x, y), but maybe don't need to log? |