From 93138ec2cbd5a9707a7ade1acc6ef35fbc50b422 Mon Sep 17 00:00:00 2001 From: "Andrew A. de Laix" Date: Mon, 24 Jan 2011 16:00:52 -0800 Subject: hack to work around gcc 4.2 compiler warning; really we should not store static strings in char * pointers (they should all be changed to const char *). --- indra/llui/tests/llurlentry_stub.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp index 96ebe83826..966bea329c 100644 --- a/indra/llui/tests/llurlentry_stub.cpp +++ b/indra/llui/tests/llurlentry_stub.cpp @@ -193,8 +193,8 @@ LLFontGL* LLFontGL::getFontDefault() return NULL; } -char* _PREHASH_AgentData = "AgentData"; -char* _PREHASH_AgentID = "AgentID"; +char* _PREHASH_AgentData = (char *)"AgentData"; +char* _PREHASH_AgentID = (char *)"AgentID"; LLHost LLHost::invalid(INVALID_PORT,INVALID_HOST_IP_ADDRESS); -- cgit v1.2.3 From 409c59b70d2d4f2958ccd3ee8db5f7e6e08fe14e Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 1 Feb 2011 17:35:42 -0500 Subject: Fix string-init compile error (g++ 4.4) in llurlentry_stub.cpp. Newer C++ compilers produce a (fatal) warning when you try to initialize a (non-const) char* variable with a string literal: you're supposed to capture such data in a const char*. But as this module is resolving external references declared in ancient message-system headers, we don't have the option to fix the original declaration. Instead use char* _PREHASH_Foo = const_cast("string literal"); // sigh --- indra/llui/tests/llurlentry_stub.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp index 96ebe83826..c11ad11de9 100644 --- a/indra/llui/tests/llurlentry_stub.cpp +++ b/indra/llui/tests/llurlentry_stub.cpp @@ -193,8 +193,8 @@ LLFontGL* LLFontGL::getFontDefault() return NULL; } -char* _PREHASH_AgentData = "AgentData"; -char* _PREHASH_AgentID = "AgentID"; +char* _PREHASH_AgentData = const_cast("AgentData"); +char* _PREHASH_AgentID = const_cast("AgentID"); LLHost LLHost::invalid(INVALID_PORT,INVALID_HOST_IP_ADDRESS); -- cgit v1.2.3 From c994d7937e502fe4a0b9bc46d876a77a34f0c3d5 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 8 Feb 2011 19:44:21 -0500 Subject: SWAT-481: add event wrapper for LLFloaterReg::instanceVisible() --- indra/llui/llfloaterreglistener.cpp | 13 +++++++++++++ indra/llui/llfloaterreglistener.h | 1 + 2 files changed, 14 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llfloaterreglistener.cpp b/indra/llui/llfloaterreglistener.cpp index 821d4543ae..ec2ac6834e 100644 --- a/indra/llui/llfloaterreglistener.cpp +++ b/indra/llui/llfloaterreglistener.cpp @@ -60,6 +60,11 @@ LLFloaterRegListener::LLFloaterRegListener(): "Ask to toggle the state of the floater specified in [\"name\"]", &LLFloaterRegListener::toggleInstance, requiredName); + add("instanceVisible", + "Return on [\"reply\"] an event whose [\"visible\"] indicates the visibility " + "of the floater specified in [\"name\"]", + &LLFloaterRegListener::instanceVisible, + requiredName); LLSD requiredNameButton; requiredNameButton["name"] = LLSD(); requiredNameButton["button"] = LLSD(); @@ -104,6 +109,14 @@ void LLFloaterRegListener::toggleInstance(const LLSD& event) const LLFloaterReg::toggleInstance(event["name"], event["key"]); } +void LLFloaterRegListener::instanceVisible(const LLSD& event) const +{ + LLReqID reqID(event); + LLSD reply(reqID.makeResponse()); + reply["visible"] = LLFloaterReg::instanceVisible(event["name"], event["key"]); + LLEventPumps::instance().obtain(event["reply"]).post(reply); +} + void LLFloaterRegListener::clickButton(const LLSD& event) const { // If the caller requests a reply, build the reply. diff --git a/indra/llui/llfloaterreglistener.h b/indra/llui/llfloaterreglistener.h index 586656667c..24311a2dfa 100644 --- a/indra/llui/llfloaterreglistener.h +++ b/indra/llui/llfloaterreglistener.h @@ -47,6 +47,7 @@ private: void showInstance(const LLSD& event) const; void hideInstance(const LLSD& event) const; void toggleInstance(const LLSD& event) const; + void instanceVisible(const LLSD& event) const; void clickButton(const LLSD& event) const; }; -- cgit v1.2.3 From 4ef02bc1b6cf5e044d2cf57725eac1a4ccd7580d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 18 Feb 2011 10:56:26 -0500 Subject: Introduce and use new sendReply() function for LLEventAPI methods. Each LLEventAPI method that generates a reply needs to extract the name of the reply LLEventPump from the request, typically from a ["reply"] key, copy the ["reqid"] value from request to reply, locate the reply LLEventPump and send the enriched reply object. Encapsulate in sendReply() function before we proliferate doing all that by hand too many more times. --- indra/llui/llfloaterreglistener.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloaterreglistener.cpp b/indra/llui/llfloaterreglistener.cpp index ec2ac6834e..7525b8cab3 100644 --- a/indra/llui/llfloaterreglistener.cpp +++ b/indra/llui/llfloaterreglistener.cpp @@ -76,9 +76,7 @@ LLFloaterRegListener::LLFloaterRegListener(): void LLFloaterRegListener::getBuildMap(const LLSD& event) const { - // Honor the "reqid" convention by echoing event["reqid"] in our reply packet. - LLReqID reqID(event); - LLSD reply(reqID.makeResponse()); + LLSD reply; // Build an LLSD map that mirrors sBuildMap. Since we have no good way to // represent a C++ callable in LLSD, the only part of BuildData we can // store is the filename. For each LLSD map entry, it would be more @@ -91,7 +89,7 @@ void LLFloaterRegListener::getBuildMap(const LLSD& event) const reply[mi->first] = mi->second.mFile; } // Send the reply to the LLEventPump named in event["reply"]. - LLEventPumps::instance().obtain(event["reply"]).post(reply); + sendReply(reply, event); } void LLFloaterRegListener::showInstance(const LLSD& event) const @@ -111,10 +109,8 @@ void LLFloaterRegListener::toggleInstance(const LLSD& event) const void LLFloaterRegListener::instanceVisible(const LLSD& event) const { - LLReqID reqID(event); - LLSD reply(reqID.makeResponse()); - reply["visible"] = LLFloaterReg::instanceVisible(event["name"], event["key"]); - LLEventPumps::instance().obtain(event["reply"]).post(reply); + sendReply(LLSDMap("visible", LLFloaterReg::instanceVisible(event["name"], event["key"])), + event); } void LLFloaterRegListener::clickButton(const LLSD& event) const -- cgit v1.2.3 From 1362a3e117dadbc5b1de18487314d4af57ce850f Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 22 Feb 2011 20:13:07 -0500 Subject: Move Josh's resolvePath() function to LLUI. Use boost::split_iterator to split LLView pathname on slashes. --- indra/llui/llui.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ indra/llui/llui.h | 27 +++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index c300fe55d9..87669574c2 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -61,6 +61,8 @@ // for XUIParse #include "llquaternion.h" #include +#include +#include // // Globals @@ -2020,6 +2022,53 @@ void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y) view->translateIntoRectWithExclusion( virtual_window_rect, mouse_rect, FALSE ); } +LLView* LLUI::resolvePath(LLView* context, const std::string& path) +{ + // Nothing about resolvePath() should require non-const LLView*. If caller + // wants non-const, call the const flavor and then cast away const-ness. + return const_cast(resolvePath(const_cast(context), path)); +} + +const LLView* LLUI::resolvePath(const LLView* context, const std::string& path) +{ + // Create an iterator over slash-separated parts of 'path'. Dereferencing + // this iterator returns an iterator_range over the substring. Unlike + // LLStringUtil::getTokens(), this split_iterator doesn't combine adjacent + // delimiters: leading/trailing slash produces an empty substring, double + // slash produces an empty substring. That's what we need. + boost::split_iterator ti(path, boost::first_finder("/")), tend; + + if (ti == tend) + { + // 'path' is completely empty, no navigation + return context; + } + + // leading / means "start at root" + if (ti->empty()) + { + context = getRootView(); + ++ti; + } + + bool recurse = false; + for (; ti != tend && context; ++ti) + { + if (ti->empty()) + { + recurse = true; + } + else + { + std::string part(ti->begin(), ti->end()); + context = context->findChildView(part, recurse); + recurse = false; + } + } + + return context; +} + // LLLocalClipRect and LLScreenClipRect moved to lllocalcliprect.h/cpp diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 62d10df8b2..50cb9e6632 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -185,6 +185,33 @@ public: //helper functions (should probably move free standing rendering helper functions here) static LLView* getRootView() { return sRootView; } static void setRootView(LLView* view) { sRootView = view; } + /** + * Walk the LLView tree to resolve a path + * Paths can be discovered using Develop > XUI > Show XUI Paths + * + * A leading "/" indicates the root of the tree is the starting + * position of the search, (otherwise the context node is used) + * + * Adjacent "//" mean that the next level of the search is done + * recursively ("descendant" rather than "child"). + * + * Return values: If no match is found, NULL is returned, + * otherwise the matching LLView* is returned. + * + * Examples: + * + * "/" -> return the root view + * "/foo" -> find "foo" as a direct child of the root + * "foo" -> find "foo" as a direct child of the context node + * "//foo" -> find the first "foo" child anywhere in the tree + * "/foo/bar" -> find "foo" as direct child of the root, and + * "bar" as a direct child of "foo" + * "//foo//bar/baz" -> find the first "foo" anywhere in the + * tree, the first "bar" anywhere under it, and "baz" + * as a direct child of that + */ + static const LLView* resolvePath(const LLView* context, const std::string& path); + static LLView* resolvePath(LLView* context, const std::string& path); static std::string locateSkin(const std::string& filename); static void setMousePositionScreen(S32 x, S32 y); static void getMousePositionScreen(S32 *x, S32 *y); -- cgit v1.2.3 From c077250ff16aeaf0ec4c036154a427c677e85eb3 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 4 Mar 2011 19:26:07 +0200 Subject: STORM-1016 FIXED Crash after pressing ctrl-shift-w while there is an undocked sidepanel. Reason: The shortcut closes all floaters, including those wrapping undocked sidepanels. The sidepanels get destroyed as well, while they are still referenced by the side tray. Fix: Dock (i.e. move to side tray) the sidepanel before its floater gets destroyed. --- indra/llui/llfloater.cpp | 7 ++++++- indra/llui/llfloater.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index c425782715..556278b139 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2865,7 +2865,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p) // close callback if (p.close_callback.isProvided()) { - mCloseSignal.connect(initCommitCallback(p.close_callback)); + setCloseCallback(initCommitCallback(p.close_callback)); } } @@ -2875,6 +2875,11 @@ boost::signals2::connection LLFloater::setMinimizeCallback( const commit_signal_ return mMinimizeSignal->connect(cb); } +boost::signals2::connection LLFloater::setCloseCallback( const commit_signal_t::slot_type& cb ) +{ + return mCloseSignal.connect(cb); +} + LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build"); bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index bb96272d02..79570720cc 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -144,6 +144,7 @@ public: bool buildFromFile(const std::string &filename, LLXMLNodePtr output_node = NULL); boost::signals2::connection setMinimizeCallback( const commit_signal_t::slot_type& cb ); + boost::signals2::connection setCloseCallback( const commit_signal_t::slot_type& cb ); void initFromParams(const LLFloater::Params& p); bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = NULL); -- cgit v1.2.3 From 2453ccbd3ee10a4f845e98fb51aac6c1e4bca5a5 Mon Sep 17 00:00:00 2001 From: Paul ProductEngine Date: Fri, 11 Mar 2011 20:33:06 +0200 Subject: STORM-659 FIXED Viewer hangs when navigate in the Back/Fwd Teleport history by keyboard Reason: If user didn't set number of max scrollable items (msi) then msi = U32_MAX Solution: If user didn't set number of msi then number of scrollable items = number of items in menu. --- indra/llui/llmenugl.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 32d7be377a..f0374de98f 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -1936,9 +1936,15 @@ bool LLMenuGL::scrollItems(EScrollingDirection direction) { item_list_t::reverse_iterator first_visible_item_iter = mItems.rend(); + // Need to scroll through number of actual existing items in menu. + // Otherwise viewer will hang for a time needed to scroll U32_MAX + // times in std::advance(). STORM-659. + size_t nitems = mItems.size(); + U32 scrollable_items = nitems < mMaxScrollableItems ? nitems : mMaxScrollableItems; + // Advance by mMaxScrollableItems back from the end of the list // to make the last item visible. - std::advance(first_visible_item_iter, mMaxScrollableItems); + std::advance(first_visible_item_iter, scrollable_items); mFirstVisibleItem = *first_visible_item_iter; break; } -- cgit v1.2.3 From a024493c04aea26b523d52971ab9cc1c9df5d08b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 15 Mar 2011 13:36:23 -0700 Subject: eol fixes --- indra/llui/lldockcontrol.cpp | 722 +++++++++++++++++++++---------------------- 1 file changed, 361 insertions(+), 361 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp index 3f81c2b28f..b1c27126d9 100644 --- a/indra/llui/lldockcontrol.cpp +++ b/indra/llui/lldockcontrol.cpp @@ -1,361 +1,361 @@ -/** - * @file lldockcontrol.cpp - * @brief Creates a panel of a specific kind for a toast - * - * $LicenseInfo:firstyear=2000&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "linden_common.h" - -#include "lldockcontrol.h" -#include "lldockablefloater.h" - -LLDockControl::LLDockControl(LLView* dockWidget, LLFloater* dockableFloater, - const LLUIImagePtr& dockTongue, DocAt dockAt, get_allowed_rect_callback_t get_allowed_rect_callback) : - mDockWidget(dockWidget), - mDockableFloater(dockableFloater), - mDockTongue(dockTongue), - mDockTongueX(0), - mDockTongueY(0) -{ - mDockAt = dockAt; - - if (dockableFloater->isDocked()) - { - on(); - } - else - { - off(); - } - - if (!(get_allowed_rect_callback)) - { - mGetAllowedRectCallback = boost::bind(&LLDockControl::getAllowedRect, this, _1); - } - else - { - mGetAllowedRectCallback = get_allowed_rect_callback; - } - - if (dockWidget != NULL) - { - repositionDockable(); - } - - if (mDockWidget != NULL) - { - mDockWidgetVisible = isDockVisible(); - } - else - { - mDockWidgetVisible = false; - } -} - -LLDockControl::~LLDockControl() -{ -} - -void LLDockControl::setDock(LLView* dockWidget) -{ - mDockWidget = dockWidget; - if (mDockWidget != NULL) - { - repositionDockable(); - mDockWidgetVisible = isDockVisible(); - } - else - { - mDockWidgetVisible = false; - } -} - -void LLDockControl::getAllowedRect(LLRect& rect) -{ - rect = mDockableFloater->getRootView()->getRect(); -} - -void LLDockControl::repositionDockable() -{ - LLRect dockRect = mDockWidget->calcScreenRect(); - LLRect rootRect; - mGetAllowedRectCallback(rootRect); - - // recalculate dockable position if dock position changed, dock visibility changed, - // root view rect changed or recalculation is forced - if (mPrevDockRect != dockRect || mDockWidgetVisible != isDockVisible() - || mRootRect != rootRect || mRecalculateDocablePosition) - { - // undock dockable and off() if dock not visible - if (!isDockVisible()) - { - mDockableFloater->setDocked(false); - // force off() since dockable may not have dockControll at this time - off(); - LLDockableFloater* dockable_floater = - dynamic_cast (mDockableFloater); - if(dockable_floater != NULL) - { - dockable_floater->onDockHidden(); - } - } - else - { - if(mEnabled) - { - moveDockable(); - } - LLDockableFloater* dockable_floater = - dynamic_cast (mDockableFloater); - if(dockable_floater != NULL) - { - dockable_floater->onDockShown(); - } - } - - mPrevDockRect = dockRect; - mRootRect = rootRect; - mRecalculateDocablePosition = false; - mDockWidgetVisible = isDockVisible(); - } -} - -bool LLDockControl::isDockVisible() -{ - bool res = true; - - if (mDockWidget != NULL) - { - //we should check all hierarchy - res = mDockWidget->isInVisibleChain(); - if (res) - { - LLRect dockRect = mDockWidget->calcScreenRect(); - - switch (mDockAt) - { - case LEFT: // to keep compiler happy - break; - case BOTTOM: - case TOP: - { - // check is dock inside parent rect - // assume that parent for all dockable flaoters - // is the root view - LLRect dockParentRect = - mDockWidget->getRootView()->calcScreenRect(); - if (dockRect.mRight <= dockParentRect.mLeft - || dockRect.mLeft >= dockParentRect.mRight) - { - res = false; - } - break; - } - default: - break; - } - } - } - - return res; -} - -void LLDockControl::moveDockable() -{ - // calculate new dockable position - LLRect dockRect = mDockWidget->calcScreenRect(); - LLRect rootRect; - mGetAllowedRectCallback(rootRect); - - bool use_tongue = false; - LLDockableFloater* dockable_floater = - dynamic_cast (mDockableFloater); - if (dockable_floater != NULL) - { - use_tongue = dockable_floater->getUseTongue(); - } - - LLRect dockableRect = mDockableFloater->calcScreenRect(); - S32 x = 0; - S32 y = 0; - LLRect dockParentRect; - switch (mDockAt) - { - case LEFT: - x = dockRect.mLeft; - y = dockRect.mTop + mDockTongue->getHeight() + dockableRect.getHeight(); - // check is dockable inside root view rect - if (x < rootRect.mLeft) - { - x = rootRect.mLeft; - } - if (x + dockableRect.getWidth() > rootRect.mRight) - { - x = rootRect.mRight - dockableRect.getWidth(); - } - - mDockTongueX = x + dockableRect.getWidth()/2 - mDockTongue->getWidth() / 2; - - mDockTongueY = dockRect.mTop; - break; - - case TOP: - x = dockRect.getCenterX() - dockableRect.getWidth() / 2; - y = dockRect.mTop + dockableRect.getHeight(); - // unique docking used with dock tongue, so add tongue height to the Y coordinate - if (use_tongue) - { - y += mDockTongue->getHeight(); - - if ( y > rootRect.mTop) - { - y = rootRect.mTop; - } - } - - // check is dockable inside root view rect - if (x < rootRect.mLeft) - { - x = rootRect.mLeft; - } - if (x + dockableRect.getWidth() > rootRect.mRight) - { - x = rootRect.mRight - dockableRect.getWidth(); - } - - - // calculate dock tongue position - dockParentRect = mDockWidget->getParent()->calcScreenRect(); - if (dockRect.getCenterX() < dockParentRect.mLeft) - { - mDockTongueX = dockParentRect.mLeft - mDockTongue->getWidth() / 2; - } - else if (dockRect.getCenterX() > dockParentRect.mRight) - { - mDockTongueX = dockParentRect.mRight - mDockTongue->getWidth() / 2;; - } - else - { - mDockTongueX = dockRect.getCenterX() - mDockTongue->getWidth() / 2; - } - mDockTongueY = dockRect.mTop; - - break; - case BOTTOM: - x = dockRect.getCenterX() - dockableRect.getWidth() / 2; - y = dockRect.mBottom; - // unique docking used with dock tongue, so add tongue height to the Y coordinate - if (use_tongue) - { - y -= mDockTongue->getHeight(); - } - - // check is dockable inside root view rect - if (x < rootRect.mLeft) - { - x = rootRect.mLeft; - } - if (x + dockableRect.getWidth() > rootRect.mRight) - { - x = rootRect.mRight - dockableRect.getWidth(); - } - - // calculate dock tongue position - dockParentRect = mDockWidget->getParent()->calcScreenRect(); - if (dockRect.getCenterX() < dockParentRect.mLeft) - { - mDockTongueX = dockParentRect.mLeft - mDockTongue->getWidth() / 2; - } - else if (dockRect.getCenterX() > dockParentRect.mRight) - { - mDockTongueX = dockParentRect.mRight - mDockTongue->getWidth() / 2;; - } - else - { - mDockTongueX = dockRect.getCenterX() - mDockTongue->getWidth() / 2; - } - mDockTongueY = dockRect.mBottom - mDockTongue->getHeight(); - - break; - } - - S32 max_available_height = rootRect.getHeight() - (rootRect.mBottom - mDockTongueY) - mDockTongue->getHeight(); - - // A floater should be shrunk so it doesn't cover a part of its docking tongue and - // there is a space between a dockable floater and a control to which it is docked. - if (use_tongue && dockableRect.getHeight() >= max_available_height) - { - dockableRect.setLeftTopAndSize(x, y, dockableRect.getWidth(), max_available_height); - mDockableFloater->reshape(dockableRect.getWidth(), dockableRect.getHeight()); - } - else - { - // move dockable - dockableRect.setLeftTopAndSize(x, y, dockableRect.getWidth(), - dockableRect.getHeight()); - } - LLRect localDocableParentRect; - mDockableFloater->getParent()->screenRectToLocal(dockableRect, - &localDocableParentRect); - mDockableFloater->setRect(localDocableParentRect); - - mDockableFloater->screenPointToLocal(mDockTongueX, mDockTongueY, - &mDockTongueX, &mDockTongueY); - -} - -void LLDockControl::on() -{ - if (isDockVisible()) - { - mEnabled = true; - mRecalculateDocablePosition = true; - } -} - -void LLDockControl::off() -{ - mEnabled = false; -} - -void LLDockControl::forceRecalculatePosition() -{ - mRecalculateDocablePosition = true; -} - -void LLDockControl::drawToungue() -{ - bool use_tongue = false; - LLDockableFloater* dockable_floater = - dynamic_cast (mDockableFloater); - if (dockable_floater != NULL) - { - use_tongue = dockable_floater->getUseTongue(); - } - - if (mEnabled && use_tongue) - { - mDockTongue->draw(mDockTongueX, mDockTongueY); - } -} - +/** + * @file lldockcontrol.cpp + * @brief Creates a panel of a specific kind for a toast + * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "lldockcontrol.h" +#include "lldockablefloater.h" + +LLDockControl::LLDockControl(LLView* dockWidget, LLFloater* dockableFloater, + const LLUIImagePtr& dockTongue, DocAt dockAt, get_allowed_rect_callback_t get_allowed_rect_callback) : + mDockWidget(dockWidget), + mDockableFloater(dockableFloater), + mDockTongue(dockTongue), + mDockTongueX(0), + mDockTongueY(0) +{ + mDockAt = dockAt; + + if (dockableFloater->isDocked()) + { + on(); + } + else + { + off(); + } + + if (!(get_allowed_rect_callback)) + { + mGetAllowedRectCallback = boost::bind(&LLDockControl::getAllowedRect, this, _1); + } + else + { + mGetAllowedRectCallback = get_allowed_rect_callback; + } + + if (dockWidget != NULL) + { + repositionDockable(); + } + + if (mDockWidget != NULL) + { + mDockWidgetVisible = isDockVisible(); + } + else + { + mDockWidgetVisible = false; + } +} + +LLDockControl::~LLDockControl() +{ +} + +void LLDockControl::setDock(LLView* dockWidget) +{ + mDockWidget = dockWidget; + if (mDockWidget != NULL) + { + repositionDockable(); + mDockWidgetVisible = isDockVisible(); + } + else + { + mDockWidgetVisible = false; + } +} + +void LLDockControl::getAllowedRect(LLRect& rect) +{ + rect = mDockableFloater->getRootView()->getRect(); +} + +void LLDockControl::repositionDockable() +{ + LLRect dockRect = mDockWidget->calcScreenRect(); + LLRect rootRect; + mGetAllowedRectCallback(rootRect); + + // recalculate dockable position if dock position changed, dock visibility changed, + // root view rect changed or recalculation is forced + if (mPrevDockRect != dockRect || mDockWidgetVisible != isDockVisible() + || mRootRect != rootRect || mRecalculateDocablePosition) + { + // undock dockable and off() if dock not visible + if (!isDockVisible()) + { + mDockableFloater->setDocked(false); + // force off() since dockable may not have dockControll at this time + off(); + LLDockableFloater* dockable_floater = + dynamic_cast (mDockableFloater); + if(dockable_floater != NULL) + { + dockable_floater->onDockHidden(); + } + } + else + { + if(mEnabled) + { + moveDockable(); + } + LLDockableFloater* dockable_floater = + dynamic_cast (mDockableFloater); + if(dockable_floater != NULL) + { + dockable_floater->onDockShown(); + } + } + + mPrevDockRect = dockRect; + mRootRect = rootRect; + mRecalculateDocablePosition = false; + mDockWidgetVisible = isDockVisible(); + } +} + +bool LLDockControl::isDockVisible() +{ + bool res = true; + + if (mDockWidget != NULL) + { + //we should check all hierarchy + res = mDockWidget->isInVisibleChain(); + if (res) + { + LLRect dockRect = mDockWidget->calcScreenRect(); + + switch (mDockAt) + { + case LEFT: // to keep compiler happy + break; + case BOTTOM: + case TOP: + { + // check is dock inside parent rect + // assume that parent for all dockable flaoters + // is the root view + LLRect dockParentRect = + mDockWidget->getRootView()->calcScreenRect(); + if (dockRect.mRight <= dockParentRect.mLeft + || dockRect.mLeft >= dockParentRect.mRight) + { + res = false; + } + break; + } + default: + break; + } + } + } + + return res; +} + +void LLDockControl::moveDockable() +{ + // calculate new dockable position + LLRect dockRect = mDockWidget->calcScreenRect(); + LLRect rootRect; + mGetAllowedRectCallback(rootRect); + + bool use_tongue = false; + LLDockableFloater* dockable_floater = + dynamic_cast (mDockableFloater); + if (dockable_floater != NULL) + { + use_tongue = dockable_floater->getUseTongue(); + } + + LLRect dockableRect = mDockableFloater->calcScreenRect(); + S32 x = 0; + S32 y = 0; + LLRect dockParentRect; + switch (mDockAt) + { + case LEFT: + x = dockRect.mLeft; + y = dockRect.mTop + mDockTongue->getHeight() + dockableRect.getHeight(); + // check is dockable inside root view rect + if (x < rootRect.mLeft) + { + x = rootRect.mLeft; + } + if (x + dockableRect.getWidth() > rootRect.mRight) + { + x = rootRect.mRight - dockableRect.getWidth(); + } + + mDockTongueX = x + dockableRect.getWidth()/2 - mDockTongue->getWidth() / 2; + + mDockTongueY = dockRect.mTop; + break; + + case TOP: + x = dockRect.getCenterX() - dockableRect.getWidth() / 2; + y = dockRect.mTop + dockableRect.getHeight(); + // unique docking used with dock tongue, so add tongue height to the Y coordinate + if (use_tongue) + { + y += mDockTongue->getHeight(); + + if ( y > rootRect.mTop) + { + y = rootRect.mTop; + } + } + + // check is dockable inside root view rect + if (x < rootRect.mLeft) + { + x = rootRect.mLeft; + } + if (x + dockableRect.getWidth() > rootRect.mRight) + { + x = rootRect.mRight - dockableRect.getWidth(); + } + + + // calculate dock tongue position + dockParentRect = mDockWidget->getParent()->calcScreenRect(); + if (dockRect.getCenterX() < dockParentRect.mLeft) + { + mDockTongueX = dockParentRect.mLeft - mDockTongue->getWidth() / 2; + } + else if (dockRect.getCenterX() > dockParentRect.mRight) + { + mDockTongueX = dockParentRect.mRight - mDockTongue->getWidth() / 2;; + } + else + { + mDockTongueX = dockRect.getCenterX() - mDockTongue->getWidth() / 2; + } + mDockTongueY = dockRect.mTop; + + break; + case BOTTOM: + x = dockRect.getCenterX() - dockableRect.getWidth() / 2; + y = dockRect.mBottom; + // unique docking used with dock tongue, so add tongue height to the Y coordinate + if (use_tongue) + { + y -= mDockTongue->getHeight(); + } + + // check is dockable inside root view rect + if (x < rootRect.mLeft) + { + x = rootRect.mLeft; + } + if (x + dockableRect.getWidth() > rootRect.mRight) + { + x = rootRect.mRight - dockableRect.getWidth(); + } + + // calculate dock tongue position + dockParentRect = mDockWidget->getParent()->calcScreenRect(); + if (dockRect.getCenterX() < dockParentRect.mLeft) + { + mDockTongueX = dockParentRect.mLeft - mDockTongue->getWidth() / 2; + } + else if (dockRect.getCenterX() > dockParentRect.mRight) + { + mDockTongueX = dockParentRect.mRight - mDockTongue->getWidth() / 2;; + } + else + { + mDockTongueX = dockRect.getCenterX() - mDockTongue->getWidth() / 2; + } + mDockTongueY = dockRect.mBottom - mDockTongue->getHeight(); + + break; + } + + S32 max_available_height = rootRect.getHeight() - (rootRect.mBottom - mDockTongueY) - mDockTongue->getHeight(); + + // A floater should be shrunk so it doesn't cover a part of its docking tongue and + // there is a space between a dockable floater and a control to which it is docked. + if (use_tongue && dockableRect.getHeight() >= max_available_height) + { + dockableRect.setLeftTopAndSize(x, y, dockableRect.getWidth(), max_available_height); + mDockableFloater->reshape(dockableRect.getWidth(), dockableRect.getHeight()); + } + else + { + // move dockable + dockableRect.setLeftTopAndSize(x, y, dockableRect.getWidth(), + dockableRect.getHeight()); + } + LLRect localDocableParentRect; + mDockableFloater->getParent()->screenRectToLocal(dockableRect, + &localDocableParentRect); + mDockableFloater->setRect(localDocableParentRect); + + mDockableFloater->screenPointToLocal(mDockTongueX, mDockTongueY, + &mDockTongueX, &mDockTongueY); + +} + +void LLDockControl::on() +{ + if (isDockVisible()) + { + mEnabled = true; + mRecalculateDocablePosition = true; + } +} + +void LLDockControl::off() +{ + mEnabled = false; +} + +void LLDockControl::forceRecalculatePosition() +{ + mRecalculateDocablePosition = true; +} + +void LLDockControl::drawToungue() +{ + bool use_tongue = false; + LLDockableFloater* dockable_floater = + dynamic_cast (mDockableFloater); + if (dockable_floater != NULL) + { + use_tongue = dockable_floater->getUseTongue(); + } + + if (mEnabled && use_tongue) + { + mDockTongue->draw(mDockTongueX, mDockTongueY); + } +} + -- cgit v1.2.3 From a5572505d843778b7f5395e25f9b9d15178bb423 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 24 Mar 2011 19:37:00 -0700 Subject: SOCIAL-509 FIX There is no way to copy a user name from web profile with the mouse --- indra/llui/llmenugl.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 32d7be377a..e60fae6ff5 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3099,9 +3099,6 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y) CURSOR_HEIGHT + MOUSE_CURSOR_PADDING * 2); menu->translateIntoRectWithExclusion( menu_region_rect, mouse_rect, FALSE ); menu->getParent()->sendChildToFront(menu); - - - } ///============================================================================ -- cgit v1.2.3 From 567035a2f758fc99ab09b8c9e802dfc881fc301b Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 25 Mar 2011 17:58:20 -0400 Subject: STORM-1094 Chat preferences > font size should increase size of input text in IM window --- indra/llui/lllineeditor.cpp | 5 +++++ indra/llui/lllineeditor.h | 1 + 2 files changed, 6 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 7e348656a9..900742ed6c 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -2290,3 +2290,8 @@ void LLLineEditor::setContextMenu(LLContextMenu* new_context_menu) else mContextMenuHandle.markDead(); } + +void LLLineEditor::setFont(const LLFontGL* font) +{ + mGLFont = font; +} \ No newline at end of file diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 723423a5b9..7b5fa218f2 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -201,6 +201,7 @@ public: const LLColor4& getTentativeFgColor() const { return mTentativeFgColor.get(); } const LLFontGL* getFont() const { return mGLFont; } + void setFont(const LLFontGL* font); void setIgnoreArrowKeys(BOOL b) { mIgnoreArrowKeys = b; } void setIgnoreTab(BOOL b) { mIgnoreTab = b; } -- cgit v1.2.3 From f443f3e84725d01d47b96a3385ee9ccc494ede89 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 25 Mar 2011 19:13:32 -0700 Subject: SOCIAL-717 FIX Artwork for click to move hint updated resize logic for hint popups to accomodate image size --- indra/llui/lliconctrl.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui') diff --git a/indra/llui/lliconctrl.h b/indra/llui/lliconctrl.h index e9bdab2d47..669e126266 100644 --- a/indra/llui/lliconctrl.h +++ b/indra/llui/lliconctrl.h @@ -69,6 +69,7 @@ public: void setColor(const LLColor4& color) { mColor = color; } void setImage(LLPointer image) { mImagep = image; } + const LLPointer getImage() { return mImagep; } private: void setIconImageDrawSize() ; -- cgit v1.2.3 From 8ceff5afd679d4432bc22532dc1d98f563c0b8e4 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 1 Apr 2011 13:31:08 -0400 Subject: correct merge error in prehash change --- indra/llui/tests/llurlentry_stub.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp index 966bea329c..ac2412c928 100644 --- a/indra/llui/tests/llurlentry_stub.cpp +++ b/indra/llui/tests/llurlentry_stub.cpp @@ -193,8 +193,8 @@ LLFontGL* LLFontGL::getFontDefault() return NULL; } -char* _PREHASH_AgentData = (char *)"AgentData"; -char* _PREHASH_AgentID = (char *)"AgentID"; +char const* const _PREHASH_AgentData = (char *)"AgentData"; +char const* const _PREHASH_AgentID = (char *)"AgentID"; LLHost LLHost::invalid(INVALID_PORT,INVALID_HOST_IP_ADDRESS); -- cgit v1.2.3 From a1a5a793a70f62c977e97b7433840fcb70f47c03 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 6 Apr 2011 08:13:44 -0400 Subject: fix line endings (one missing, two files of DOS) --- indra/llui/lllineeditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 900742ed6c..d99ee5a545 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -2294,4 +2294,4 @@ void LLLineEditor::setContextMenu(LLContextMenu* new_context_menu) void LLLineEditor::setFont(const LLFontGL* font) { mGLFont = font; -} \ No newline at end of file +} -- cgit v1.2.3