From a44fb94af2974fce07575f30f5dcaff9729d9ba9 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 11 Aug 2011 17:41:54 -0400 Subject: CHOP-763: Reduce redundancy in LLView::childrenHandle*() methods. There were 13 different methods that were more or less clones of each other. Consolidate those down to 5 variations on the basic method body, where each variation has good (commented!) reason to differ. Use helper methods to further simplify the remaining distinct method bodies. Use BOOST_FOREACH() to improve readability of iterating over mChildList. --- indra/llui/llview.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'indra/llui/llview.h') diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 594a5eec6b..daea46d330 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -516,6 +516,9 @@ protected: void drawDebugRect(); void drawChild(LLView* childp, S32 x_offset = 0, S32 y_offset = 0, BOOL force_draw = FALSE); void drawChildren(); + bool visibleAndContains(S32 local_x, S32 local_Y); + bool visibleEnabledAndContains(S32 local_x, S32 local_y); + void logMouseEvent(); LLView* childrenHandleKey(KEY key, MASK mask); LLView* childrenHandleUnicodeChar(llwchar uni_char); @@ -541,6 +544,20 @@ protected: private: + template + LLView* childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra); + + template + LLView* childrenHandleCharEvent(const std::string& desc, const METHOD& method, + CHARTYPE c, MASK mask); + + // adapter to blur distinction between handleKey() and handleUnicodeChar() + // for childrenHandleCharEvent() + BOOL handleUnicodeCharWithDummyMask(llwchar uni_char, MASK /* dummy */, BOOL from_parent) + { + return handleUnicodeChar(uni_char, from_parent); + } + LLView* mParentView; child_list_t mChildList; -- cgit v1.2.3 From f7a6ed85e40f53e5e28868bf34ac4dbc9bb204fb Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 25 Aug 2011 14:40:53 -0400 Subject: CHOP-763: Add LLView::TemporaryDrilldownFunc to support UI injection. Instead of unconditionally calling LLView::pointInView(), LLView::visibleAndContains() now consults a class-static boost::function called sDrilldown -- which is initialized to LLView::pointInView(). Introduce LLView::TemporaryDrilldownFunc, instantiated with a callable whose signature is compatible with LLView::pointInView(). This replaces sDrilldown, but only for the life of the TemporaryDrilldownFunc object. Introduce llview::TargetEvent, an object intended to serve as a TemporaryDrilldownFunc callable. Construct it with a desired target LLView* and pass it to TemporaryDrilldownFunc. When called with each candidate child LLView*, instead of selecting the one containing the particular (x, y) point, it selects the one that will lead to the ultimate desired target LLView*. Add optional 'recur' param to LLView::childFromPoint(); default is current one-level behavior. But when you pass recur=true, it should return the frontmost visible leaf LLView containing the passed (x, y) point. --- indra/llui/llview.h | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'indra/llui/llview.h') diff --git a/indra/llui/llview.h b/indra/llui/llview.h index daea46d330..67634938fb 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -50,6 +50,7 @@ #include "llfocusmgr.h" #include +#include class LLSD; @@ -437,7 +438,7 @@ public: /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const; /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const; - virtual LLView* childFromPoint(S32 x, S32 y); + virtual LLView* childFromPoint(S32 x, S32 y, bool recur=false); // view-specific handlers virtual void onMouseEnter(S32 x, S32 y, MASK mask); @@ -599,7 +600,35 @@ private: LLView& getDefaultWidgetContainer() const; + // This allows special mouse-event targeting logic for testing. + typedef boost::function DrilldownFunc; + static DrilldownFunc sDrilldown; + public: + // This is the only public accessor to alter sDrilldown. This is not + // an accident. The intended usage pattern is like: + // { + // LLView::TemporaryDrilldownFunc scoped_func(myfunctor); + // // ... test with myfunctor ... + // } // exiting block restores original LLView::sDrilldown + class TemporaryDrilldownFunc + { + public: + TemporaryDrilldownFunc(const DrilldownFunc& func): + mOldDrilldown(sDrilldown) + { + sDrilldown = func; + } + + ~TemporaryDrilldownFunc() + { + sDrilldown = mOldDrilldown; + } + + private: + DrilldownFunc mOldDrilldown; + }; + // Depth in view hierarchy during rendering static S32 sDepth; -- cgit v1.2.3 From 6e8ba7e1179c0ac8c3a085e010992ea91fb15114 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 30 Aug 2011 09:53:43 -0400 Subject: CHOP-763: Introduce LLView::getPathname(). --- indra/llui/llview.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui/llview.h') diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 67634938fb..11f25bcd7f 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -444,6 +444,7 @@ public: virtual void onMouseEnter(S32 x, S32 y, MASK mask); virtual void onMouseLeave(S32 x, S32 y, MASK mask); + std::string getPathname() const; template T* findChild(const std::string& name, BOOL recurse = TRUE) const { -- cgit v1.2.3 From 71aec7439c1a8027880ac06d99f923ab8fa7111b Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 30 Aug 2011 15:22:44 -0400 Subject: CHOP-763: Introduce static LLView::getPathname(LLView*). Use it for LLWindowListener to safely report an LLView* which might be NULL. --- indra/llui/llview.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llui/llview.h') diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 11f25bcd7f..97151c4fb4 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -445,6 +445,8 @@ public: virtual void onMouseLeave(S32 x, S32 y, MASK mask); std::string getPathname() const; + // static method handles NULL pointer too + static std::string getPathname(const LLView*); template T* findChild(const std::string& name, BOOL recurse = TRUE) const { -- cgit v1.2.3 From 654cd3f89786e5c19cf26472ccf5a402a22ea661 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Sun, 4 Sep 2011 07:08:23 -0400 Subject: CHOP-763: Make LLView::TemporaryDrilldownFunc boost::noncopyable. Code review with Alain turned up the fact that TemporaryDrilldownFunc, simple to the point of naivety, doesn't address the case of its being copied. Making it boost::noncopyable should turn any such usage into a compile error. --- indra/llui/llview.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui/llview.h') diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 97151c4fb4..fcae75c447 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -51,6 +51,7 @@ #include #include +#include class LLSD; @@ -614,7 +615,7 @@ public: // LLView::TemporaryDrilldownFunc scoped_func(myfunctor); // // ... test with myfunctor ... // } // exiting block restores original LLView::sDrilldown - class TemporaryDrilldownFunc + class TemporaryDrilldownFunc: public boost::noncopyable { public: TemporaryDrilldownFunc(const DrilldownFunc& func): -- cgit v1.2.3 From 2d19a2002501d44ce18080b6f26ceaf2dbf796e9 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Thu, 8 Sep 2011 09:46:04 -0500 Subject: add getInfo to LLView to get state information about ui elements. --- indra/llui/llview.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/llui/llview.h') 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 -- cgit v1.2.3 From c5d930b280c71dfd6ba2f63960c91895083ecc19 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 23 Sep 2011 20:06:35 -0700 Subject: made LLView a possible parent for all default widgets --- indra/llui/llview.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'indra/llui/llview.h') diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 594a5eec6b..43986a3a84 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -95,9 +95,6 @@ private: static std::vector sDrawContextStack; }; -class LLViewWidgetRegistry : public LLChildRegistry -{}; - class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElement { public: @@ -150,7 +147,8 @@ public: Params(); }; - typedef LLViewWidgetRegistry child_registry_t; + // most widgets are valid children of LLView + typedef LLDefaultChildRegistry child_registry_t; void initFromParams(const LLView::Params&); -- cgit v1.2.3 From 7fd0e8c69e6dced4a770da4fac10c154eac5899f Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 26 Sep 2011 18:51:43 -0700 Subject: fixed toolbar context menu deprecated pointless LLView::deleteViewByHandle --- indra/llui/llview.h | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llui/llview.h') diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 594a5eec6b..7a1b2e4ba0 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -482,7 +482,6 @@ public: // return query for iterating over focus roots in tab order static const LLCtrlQuery & getFocusRootsQuery(); - static void deleteViewByHandle(LLHandle handle); static LLWindow* getWindow(void) { return LLUI::sWindow; } // Set up params after XML load before calling new(), -- cgit v1.2.3 From 6a49f2947f05963c577a1644c16a8affc779da63 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 28 Sep 2011 16:25:32 -0700 Subject: EXP-1234 WIP experimental drag and drop --- indra/llui/llview.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'indra/llui/llview.h') diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 9039366e7e..f4e31b109a 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -465,6 +465,20 @@ public: return dynamic_cast(widgetp); } + template T* getParentByType() const + { + LLView* parent = getParent(); + while(parent) + { + if (dynamic_cast(parent)) + { + return static_cast(parent); + } + parent = parent->getParent(); + } + return NULL; + } + ////////////////////////////////////////////// // statics ////////////////////////////////////////////// -- cgit v1.2.3 From 09e179b2381a4db03309839babae664feb9b0886 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 30 Sep 2011 16:57:08 -0700 Subject: param block cleanup added Flag as value type moved Batch to BatchBlock renamed Choice to ChoiceBlock made merging of parameters for ValueParams consistent (fillFrom and overwriteFrom are inverses of each other now) made iteration over Multiple type params easier initial schema param blocks --- indra/llui/llview.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui/llview.h') diff --git a/indra/llui/llview.h b/indra/llui/llview.h index f4e31b109a..a1c46f3bf3 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -98,7 +98,7 @@ private: class LLView : public LLMouseHandler, public LLMortician, public LLFocusableElement { public: - struct Follows : public LLInitParam::Choice + struct Follows : public LLInitParam::ChoiceBlock { Alternative string; Alternative flags; -- cgit v1.2.3 From 9206226a377c88d34036ebd8a3ac6d9d55bc4146 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Wed, 12 Oct 2011 18:16:59 -0700 Subject: tooltips now only show labels for toolbar buttons when label is hidden or truncated tooltips are no longer instantaneous once a tooltip is visible --- indra/llui/llview.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui/llview.h') diff --git a/indra/llui/llview.h b/indra/llui/llview.h index a1c46f3bf3..5e3387dc98 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -238,7 +238,7 @@ public: ECursorType getHoverCursor() { return mHoverCursor; } - const std::string& getToolTip() const { return mToolTipMsg.getString(); } + virtual const std::string getToolTip() const { return mToolTipMsg.getString(); } void sendChildToFront(LLView* child); void sendChildToBack(LLView* child); -- cgit v1.2.3 From bb3f1e3d7ac300d300e91dfff887098816af27e5 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 18 Oct 2011 18:51:17 -0700 Subject: EXP-1406 FIX Scrolling using mousewheel not working to scroll in inventory and people panels --- indra/llui/llview.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui/llview.h') diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 6d1dda90af..08828e55e6 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -565,7 +565,7 @@ protected: private: template - LLView* childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra); + LLView* childrenHandleMouseEvent(const METHOD& method, S32 x, S32 y, XDATA extra, bool allow_mouse_block = true); template LLView* childrenHandleCharEvent(const std::string& desc, const METHOD& method, -- cgit v1.2.3