summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim ProductEngine <vsavchuk@productengine.com>2010-12-01 15:46:57 +0200
committerVadim ProductEngine <vsavchuk@productengine.com>2010-12-01 15:46:57 +0200
commit3c4cf5a309612d2a999453b282cad0aab7764083 (patch)
treebfca12ff66e120fad7b687165648565c3f066f2b
parentd3dbdf6f51ae9cada4a5a450387c0688ccbe07a1 (diff)
STORM-677 ADDITIONAL_FIX Force textures inside texture picker to be 100% opaque while the control is in a focused floater.
Besides, made LLFloater handle opacity more like other controls do.
-rw-r--r--indra/llui/llfloater.cpp33
-rw-r--r--indra/llui/llfloater.h5
-rw-r--r--indra/newview/llnearbychat.cpp13
-rw-r--r--indra/newview/llnearbychat.h1
-rw-r--r--indra/newview/llsidetray.cpp2
-rw-r--r--indra/newview/lltexturectrl.cpp6
6 files changed, 38 insertions, 22 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index da5dad6b82..7727e154da 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1189,7 +1189,7 @@ void LLFloater::setFocus( BOOL b )
last_focus->setFocus(TRUE);
}
}
- updateChildrenTransparency(this, b ? TT_ACTIVE : TT_INACTIVE);
+ updateTransparency(this, b ? TT_ACTIVE : TT_INACTIVE);
}
// virtual
@@ -1649,7 +1649,7 @@ void LLFloater::onClickCloseBtn()
// virtual
void LLFloater::draw()
{
- mCurrentTransparency = hasFocus() ? sActiveControlTransparency : sInactiveControlTransparency;
+ const F32 alpha = getCurrentTransparency();
// draw background
if( isBackgroundVisible() )
@@ -1681,12 +1681,12 @@ void LLFloater::draw()
if (image)
{
// We're using images for this floater's backgrounds
- image->draw(getLocalRect(), overlay_color % mCurrentTransparency);
+ image->draw(getLocalRect(), overlay_color % alpha);
}
else
{
// We're not using images, use old-school flat colors
- gl_rect_2d( left, top, right, bottom, color % mCurrentTransparency );
+ gl_rect_2d( left, top, right, bottom, color % alpha );
// draw highlight on title bar to indicate focus. RDW
if(hasFocus()
@@ -1698,7 +1698,7 @@ void LLFloater::draw()
const LLFontGL* font = LLFontGL::getFontSansSerif();
LLRect r = getRect();
gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - (S32)font->getLineHeight() - 1,
- titlebar_focus_color % mCurrentTransparency, 0, TRUE);
+ titlebar_focus_color % alpha, 0, TRUE);
}
}
}
@@ -1764,29 +1764,30 @@ void LLFloater::drawShadow(LLPanel* panel)
shadow_color.mV[VALPHA] *= 0.5f;
}
gl_drop_shadow(left, top, right, bottom,
- shadow_color % mCurrentTransparency,
+ shadow_color % getCurrentTransparency(),
llround(shadow_offset));
}
-void LLFloater::updateChildrenTransparency(LLView* ctrl, ETypeTransparency transparency_type)
+void LLFloater::updateTransparency(LLView* view, ETypeTransparency transparency_type)
{
- child_list_t children = *ctrl->getChildList();
+ child_list_t children = *view->getChildList();
child_list_t::iterator it = children.begin();
+ LLUICtrl* ctrl = dynamic_cast<LLUICtrl*>(view);
+ if (ctrl)
+ {
+ ctrl->setTransparencyType(transparency_type);
+ }
+
for(; it != children.end(); ++it)
{
- LLUICtrl* ui_ctrl = dynamic_cast<LLUICtrl*>(*it);
- if (ui_ctrl)
- {
- ui_ctrl->setTransparencyType(transparency_type);
- }
- updateChildrenTransparency(*it, transparency_type);
+ updateTransparency(*it, transparency_type);
}
}
-void LLFloater::updateChildrenTransparency(ETypeTransparency transparency_type)
+void LLFloater::updateTransparency(ETypeTransparency transparency_type)
{
- updateChildrenTransparency(this, transparency_type);
+ updateTransparency(this, transparency_type);
}
void LLFloater::setCanMinimize(BOOL can_minimize)
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 2ec233f454..bb96272d02 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -285,7 +285,7 @@ public:
static void setFloaterHost(LLMultiFloater* hostp) {sHostp = hostp; }
static LLMultiFloater* getFloaterHost() {return sHostp; }
- void updateChildrenTransparency(ETypeTransparency transparency_type);
+ void updateTransparency(ETypeTransparency transparency_type);
protected:
@@ -345,7 +345,7 @@ private:
static void updateActiveFloaterTransparency();
static void updateInactiveFloaterTransparency();
- void updateChildrenTransparency(LLView* ctrl, ETypeTransparency transparency_type);
+ void updateTransparency(LLView* view, ETypeTransparency transparency_type);
public:
// Called when floater is opened, passes mKey
@@ -363,7 +363,6 @@ protected:
std::string mVisibilityControl;
std::string mDocStateControl;
LLSD mKey; // Key used for retrieving instances; set (for now) by LLFLoaterReg
- F32 mCurrentTransparency;
LLDragHandle* mDragHandle;
LLResizeBar* mResizeBar[4];
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index 180695e40b..572eeb8fc7 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -365,3 +365,16 @@ BOOL LLNearbyChat::handleMouseDown(S32 x, S32 y, MASK mask)
mChatHistory->setFocus(TRUE);
return LLDockableFloater::handleMouseDown(x, y, mask);
}
+
+void LLNearbyChat::draw()
+{
+ // *HACK: Update transparency type depending on whether our children have focus.
+ // This is needed because this floater is chrome and thus cannot accept focus, so
+ // the transparency type setting code from LLFloater::setFocus() isn't reached.
+ if (getTransparencyType() != TT_DEFAULT)
+ {
+ setTransparencyType(hasFocus() ? TT_ACTIVE : TT_INACTIVE);
+ }
+
+ LLDockableFloater::draw();
+}
diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h
index 1e62910385..2ea79797f8 100644
--- a/indra/newview/llnearbychat.h
+++ b/indra/newview/llnearbychat.h
@@ -48,6 +48,7 @@ public:
bool onNearbyChatCheckContextMenuItem(const LLSD& userdata);
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual void draw();
// focus overrides
/*virtual*/ void onFocusLost();
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp
index 526f3d1e77..3f8aeaf400 100644
--- a/indra/newview/llsidetray.cpp
+++ b/indra/newview/llsidetray.cpp
@@ -277,7 +277,7 @@ void LLSideTrayTab::dock(LLFloater* floater_tab)
if (!side_tray) return;
// Before docking the tab, reset its (and its children's) transparency to default (STORM-688).
- floater_tab->updateChildrenTransparency(TT_DEFAULT);
+ floater_tab->updateTransparency(TT_DEFAULT);
if (!side_tray->addTab(this))
{
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 759f68b321..56e9739350 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -564,7 +564,8 @@ void LLFloaterTexturePicker::draw()
LLRect interior = border;
interior.stretch( -1 );
- const F32 alpha = mCurrentTransparency; // mCurrentTransparency gets updated in LLFloater::draw()
+ // If the floater is focused, don't apply its alpha to the texture (STORM-677).
+ const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
if( mTexturep )
{
if( mTexturep->getComponents() == 4 )
@@ -1264,7 +1265,8 @@ void LLTextureCtrl::draw()
LLRect interior = border;
interior.stretch( -1 );
- const F32 alpha = getCurrentTransparency();
+ // If we're in a focused floater, don't apply the floater's alpha to the texture (STORM-677).
+ const F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
if( mTexturep )
{
if( mTexturep->getComponents() == 4 )