From d6aace58b342b8c7467e36d32fd6e1ca4b60265d Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Thu, 8 Aug 2013 22:02:24 -0400 Subject: [PATCH] Fix the borders of drop targets to look like they did back in 1.8.0 --- indra/newview/lldroptarget.cpp | 27 ++++++++++++++++--- indra/newview/lldroptarget.h | 5 +++- .../skins/default/xui/en-us/floater_ao.xml | 2 +- .../skins/default/xui/en-us/panel_avatar.xml | 2 +- .../default/xui/en-us/panel_group_notices.xml | 2 +- .../en-us/panel_preferences_ascent_chat.xml | 14 +++++----- .../en-us/panel_preferences_ascent_system.xml | 2 +- 7 files changed, 38 insertions(+), 16 deletions(-) diff --git a/indra/newview/lldroptarget.cpp b/indra/newview/lldroptarget.cpp index c86e1f18c..d35cb4c03 100644 --- a/indra/newview/lldroptarget.cpp +++ b/indra/newview/lldroptarget.cpp @@ -42,6 +42,7 @@ #include "lltextbox.h" #include "lltooldraganddrop.h" #include "lltrans.h" +#include "llviewborder.h" static LLRegisterWidget r("drop_target"); @@ -63,16 +64,23 @@ LLDropTarget::LLDropTarget(const LLDropTarget::Params& p) setControlName(p.control_name, NULL); mText->setOrigin(0, 0); mText->setFollows(FOLLOWS_NONE); + mText->setMouseOpaque(false); mText->setHAlign(LLFontGL::HCENTER); - mText->setBorderVisible(true); - mText->setBorderColor(LLUI::sColorsGroup->getColor("DefaultHighlightLight")); + mText->setVPad(1); + + mBorder = new LLViewBorder("drop_border", p.rect, LLViewBorder::BEVEL_IN); + addChild(mBorder); + + mBorder->setMouseOpaque(false); if (p.fill_parent) fillParent(getParent()); + if (!p.border_visible) mBorder->setBorderWidth(0); } LLDropTarget::~LLDropTarget() { delete mText; + delete mBorder; } // static @@ -89,7 +97,9 @@ void LLDropTarget::initFromXML(LLXMLNodePtr node, LLView* parent) LLView::initFromXML(node, parent); const LLRect& rect = getRect(); - mText->setRect(LLRect(0, rect.getHeight(), rect.getWidth(), 0)); + const LLRect child_rect(0, rect.getHeight(), rect.getWidth(), 0); + mText->setRect(child_rect); + mBorder->setRect(child_rect); if (node->hasAttribute("name")) // Views can't have names, but drop targets can { @@ -111,6 +121,13 @@ void LLDropTarget::initFromXML(LLXMLNodePtr node, LLView* parent) node->getAttribute_bool("fill_parent", fill); if (fill) fillParent(parent); } + + if (node->hasAttribute("border_visible")) + { + bool border_visible; + node->getAttribute_bool("border_visible", border_visible); + if (!border_visible) mBorder->setBorderWidth(0); + } } // virtual @@ -154,7 +171,9 @@ void LLDropTarget::fillParent(const LLView* parent) } // The following block enlarges the target, but maintains the desired size for the text and border - mText->setRect(getRect()); // mText takes over the old rectangle, since the position will now be relative to the parent's rectangle for the text. + const LLRect& rect = getRect(); // Children maintain the old rectangle + mText->setRect(rect); + mBorder->setRect(rect); const LLRect& parent_rect = parent->getRect(); setRect(LLRect(0, parent_rect.getHeight(), parent_rect.getWidth(), 0)); } diff --git a/indra/newview/lldroptarget.h b/indra/newview/lldroptarget.h index e064c1b02..08026bd2a 100644 --- a/indra/newview/lldroptarget.h +++ b/indra/newview/lldroptarget.h @@ -44,11 +44,13 @@ class LLDropTarget : public LLView public: struct Params : public LLInitParam::Block { + Optional border_visible; // Whether or not to display the border Optional control_name; // Control to change on item drop (Per Account only) Optional label; // Label for the LLTextBox, used when label doesn't dynamically change on drop Optional fill_parent; // Whether or not to fill the direct parent, to have a larger drop target. If true, the next sibling must explicitly define its rect without deltas. Params() - : control_name("control_name", "") + : border_visible("border_visible", true) + , control_name("control_name", "") , label("label", "") , fill_parent("fill_parent", false) { @@ -74,6 +76,7 @@ public: protected: LLUUID mEntityID; private: + class LLViewBorder* mBorder; LLControlVariable* mControl; class LLTextBox* mText; }; diff --git a/indra/newview/skins/default/xui/en-us/floater_ao.xml b/indra/newview/skins/default/xui/en-us/floater_ao.xml index f07a992a1..41a73e873 100644 --- a/indra/newview/skins/default/xui/en-us/floater_ao.xml +++ b/indra/newview/skins/default/xui/en-us/floater_ao.xml @@ -10,7 +10,7 @@ width="610" height="380"> - +