STORM-593 FIXED Make transparent texteditor and lineeditor
Reason: If some child of transparent LLFloater has a visible non-transparent background then this part of floater is non-transparent. As a result floater became partially transparent. Solution: When transparent floater changes focus, iterate through its children and set corresponding (corresponding to whether control in active or in inactive floater see STORM-535) transparency value. - Added method LLUICtrl::getCurrentTransparency. This method calculates transparency level of a control. Calculated value should be used as an alpha chennel value in case we want this control to be transparent. For now this method is used by LLFloater to adjust transparency of its children. - Added calculating of transparecny level for: LLLineEditor, LLTextBase, LLinventoryListItem, LLScrollContainer, LLScrollListCtrl, LLAccrodionCtrlTab. - Added method LLFlaoter::updateChildrenTransparency which updates transparency value of its childrenmaster
parent
082443b88f
commit
e997a09343
|
|
@ -203,7 +203,8 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::draw()
|
|||
S32 width = getRect().getWidth();
|
||||
S32 height = getRect().getHeight();
|
||||
|
||||
gl_rect_2d(0,0,width - 1 ,height - 1,mHeaderBGColor.get(),true);
|
||||
F32 alpha = getCurrentTransparency();
|
||||
gl_rect_2d(0,0,width - 1 ,height - 1,mHeaderBGColor.get() % alpha,true);
|
||||
|
||||
LLAccordionCtrlTab* parent = dynamic_cast<LLAccordionCtrlTab*>(getParent());
|
||||
bool collapsible = (parent && parent->getCollapsible());
|
||||
|
|
|
|||
|
|
@ -61,10 +61,6 @@
|
|||
// use this to control "jumping" behavior when Ctrl-Tabbing
|
||||
const S32 TABBED_FLOATER_OFFSET = 0;
|
||||
|
||||
// static
|
||||
F32 LLFloater::sActiveFloaterTransparency = 0.0f;
|
||||
F32 LLFloater::sInactiveFloaterTransparency = 0.0f;
|
||||
|
||||
std::string LLFloater::sButtonNames[BUTTON_COUNT] =
|
||||
{
|
||||
"llfloater_close_btn", //BUTTON_CLOSE
|
||||
|
|
@ -208,14 +204,14 @@ void LLFloater::initClass()
|
|||
if (ctrl)
|
||||
{
|
||||
ctrl->getSignal()->connect(boost::bind(&LLFloater::updateActiveFloaterTransparency));
|
||||
sActiveFloaterTransparency = LLUI::sSettingGroups["config"]->getF32("ActiveFloaterTransparency");
|
||||
updateActiveFloaterTransparency();
|
||||
}
|
||||
|
||||
ctrl = LLUI::sSettingGroups["config"]->getControl("InactiveFloaterTransparency").get();
|
||||
if (ctrl)
|
||||
{
|
||||
ctrl->getSignal()->connect(boost::bind(&LLFloater::updateInactiveFloaterTransparency));
|
||||
sInactiveFloaterTransparency = LLUI::sSettingGroups["config"]->getF32("InactiveFloaterTransparency");
|
||||
updateInactiveFloaterTransparency();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -225,7 +221,7 @@ static LLWidgetNameRegistry::StaticRegistrar sRegisterFloaterParams(&typeid(LLFl
|
|||
|
||||
LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
|
||||
: LLPanel(), // intentionally do not pass params here, see initFromParams
|
||||
mDragHandle(NULL),
|
||||
mDragHandle(NULL),
|
||||
mTitle(p.title),
|
||||
mShortTitle(p.short_title),
|
||||
mSingleInstance(p.single_instance),
|
||||
|
|
@ -368,13 +364,13 @@ void LLFloater::layoutDragHandle()
|
|||
// static
|
||||
void LLFloater::updateActiveFloaterTransparency()
|
||||
{
|
||||
sActiveFloaterTransparency = LLUI::sSettingGroups["config"]->getF32("ActiveFloaterTransparency");
|
||||
sActiveControlTransparency = LLUI::sSettingGroups["config"]->getF32("ActiveFloaterTransparency");
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloater::updateInactiveFloaterTransparency()
|
||||
{
|
||||
sInactiveFloaterTransparency = LLUI::sSettingGroups["config"]->getF32("InactiveFloaterTransparency");
|
||||
sInactiveControlTransparency = LLUI::sSettingGroups["config"]->getF32("InactiveFloaterTransparency");
|
||||
}
|
||||
|
||||
void LLFloater::addResizeCtrls()
|
||||
|
|
@ -1193,6 +1189,7 @@ void LLFloater::setFocus( BOOL b )
|
|||
last_focus->setFocus(TRUE);
|
||||
}
|
||||
}
|
||||
updateChildrenTransparency(this);
|
||||
}
|
||||
|
||||
// virtual
|
||||
|
|
@ -1652,7 +1649,7 @@ void LLFloater::onClickCloseBtn()
|
|||
// virtual
|
||||
void LLFloater::draw()
|
||||
{
|
||||
mCurrentTransparency = hasFocus() ? sActiveFloaterTransparency : sInactiveFloaterTransparency;
|
||||
mCurrentTransparency = hasFocus() ? sActiveControlTransparency : sInactiveControlTransparency;
|
||||
|
||||
// draw background
|
||||
if( isBackgroundVisible() )
|
||||
|
|
@ -1771,6 +1768,24 @@ void LLFloater::drawShadow(LLPanel* panel)
|
|||
llround(shadow_offset));
|
||||
}
|
||||
|
||||
void LLFloater::updateChildrenTransparency(LLView* ctrl)
|
||||
{
|
||||
child_list_t children = *ctrl->getChildList();
|
||||
child_list_t::iterator it = children.begin();
|
||||
|
||||
ETypeTransparency transparency_type = hasFocus() ? TT_ACTIVE : TT_INACTIVE;
|
||||
|
||||
for(; it != children.end(); ++it)
|
||||
{
|
||||
LLUICtrl* ui_ctrl = dynamic_cast<LLUICtrl*>(*it);
|
||||
if (ui_ctrl)
|
||||
{
|
||||
ui_ctrl->setTransparencyType(transparency_type);
|
||||
}
|
||||
updateChildrenTransparency(*it);
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloater::setCanMinimize(BOOL can_minimize)
|
||||
{
|
||||
// if removing minimize/restore button programmatically,
|
||||
|
|
|
|||
|
|
@ -343,6 +343,7 @@ private:
|
|||
|
||||
static void updateActiveFloaterTransparency();
|
||||
static void updateInactiveFloaterTransparency();
|
||||
void updateChildrenTransparency(LLView* ctrl);
|
||||
|
||||
public:
|
||||
// Called when floater is opened, passes mKey
|
||||
|
|
@ -413,9 +414,6 @@ private:
|
|||
|
||||
F32 mCurrentTransparency;
|
||||
|
||||
static F32 sActiveFloaterTransparency;
|
||||
static F32 sInactiveFloaterTransparency;
|
||||
|
||||
static LLMultiFloater* sHostp;
|
||||
static BOOL sQuitting;
|
||||
static std::string sButtonNames[BUTTON_COUNT];
|
||||
|
|
|
|||
|
|
@ -1530,7 +1530,8 @@ void LLLineEditor::drawBackground()
|
|||
image = mBgImage;
|
||||
}
|
||||
|
||||
F32 alpha = getDrawContext().mAlpha;
|
||||
F32 alpha = getCurrentTransparency();
|
||||
|
||||
// optionally draw programmatic border
|
||||
if (has_focus)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -194,6 +194,8 @@ void LLPanel::draw()
|
|||
// draw background
|
||||
if( mBgVisible )
|
||||
{
|
||||
alpha = getCurrentTransparency();
|
||||
|
||||
LLRect local_rect = getLocalRect();
|
||||
if (mBgOpaque )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -422,9 +422,10 @@ void LLScrollContainer::draw()
|
|||
// Draw background
|
||||
if( mIsOpaque )
|
||||
{
|
||||
F32 alpha = getCurrentTransparency();
|
||||
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
gGL.color4fv( mBackgroundColor.get().mV );
|
||||
gl_rect_2d( mInnerRect );
|
||||
gl_rect_2d(mInnerRect, mBackgroundColor.get() % alpha);
|
||||
}
|
||||
|
||||
// Draw mScrolledViews and update scroll bars.
|
||||
|
|
|
|||
|
|
@ -1482,8 +1482,9 @@ void LLScrollListCtrl::draw()
|
|||
// Draw background
|
||||
if (mBackgroundVisible)
|
||||
{
|
||||
F32 alpha = getCurrentTransparency();
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
gl_rect_2d(background, getEnabled() ? mBgWriteableColor.get() : mBgReadOnlyColor.get() );
|
||||
gl_rect_2d(background, getEnabled() ? mBgWriteableColor.get() % alpha : mBgReadOnlyColor.get() % alpha );
|
||||
}
|
||||
|
||||
if (mColumnsDirty)
|
||||
|
|
|
|||
|
|
@ -1005,6 +1005,7 @@ void LLTextBase::draw()
|
|||
|
||||
if (mBGVisible)
|
||||
{
|
||||
F32 alpha = getCurrentTransparency();
|
||||
// clip background rect against extents, if we support scrolling
|
||||
LLRect bg_rect = mVisibleTextRect;
|
||||
if (mScroller)
|
||||
|
|
@ -1016,7 +1017,7 @@ void LLTextBase::draw()
|
|||
: hasFocus()
|
||||
? mFocusBgColor.get()
|
||||
: mWriteableBgColor.get();
|
||||
gl_rect_2d(doc_rect, bg_color, TRUE);
|
||||
gl_rect_2d(doc_rect, bg_color % alpha, TRUE);
|
||||
}
|
||||
|
||||
// draw document view
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@
|
|||
|
||||
static LLDefaultChildRegistry::Register<LLUICtrl> r("ui_ctrl");
|
||||
|
||||
F32 LLUICtrl::sActiveControlTransparency = 1.0f;
|
||||
F32 LLUICtrl::sInactiveControlTransparency = 1.0f;
|
||||
|
||||
// Compiler optimization, generate extern template
|
||||
template class LLUICtrl* LLView::getChild<class LLUICtrl>(
|
||||
const std::string& name, BOOL recurse) const;
|
||||
|
|
@ -110,7 +113,8 @@ LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel)
|
|||
mMouseUpSignal(NULL),
|
||||
mRightMouseDownSignal(NULL),
|
||||
mRightMouseUpSignal(NULL),
|
||||
mDoubleClickSignal(NULL)
|
||||
mDoubleClickSignal(NULL),
|
||||
mTransparencyType(TT_DEFAULT)
|
||||
{
|
||||
mUICtrlHandle.bind(this);
|
||||
}
|
||||
|
|
@ -923,6 +927,33 @@ BOOL LLUICtrl::getTentative() const
|
|||
void LLUICtrl::setColor(const LLColor4& color)
|
||||
{ }
|
||||
|
||||
F32 LLUICtrl::getCurrentTransparency()
|
||||
{
|
||||
F32 alpha;
|
||||
|
||||
switch(mTransparencyType)
|
||||
{
|
||||
case TT_DEFAULT:
|
||||
alpha = getDrawContext().mAlpha;
|
||||
break;
|
||||
|
||||
case TT_ACTIVE:
|
||||
alpha = sActiveControlTransparency;
|
||||
break;
|
||||
|
||||
case TT_INACTIVE:
|
||||
alpha = sInactiveControlTransparency;
|
||||
break;
|
||||
}
|
||||
|
||||
return alpha;
|
||||
}
|
||||
|
||||
void LLUICtrl::setTransparencyType(ETypeTransparency type)
|
||||
{
|
||||
mTransparencyType = type;
|
||||
}
|
||||
|
||||
boost::signals2::connection LLUICtrl::setCommitCallback( const commit_signal_t::slot_type& cb )
|
||||
{
|
||||
if (!mCommitSignal) mCommitSignal = new commit_signal_t();
|
||||
|
|
|
|||
|
|
@ -120,6 +120,12 @@ public:
|
|||
Params();
|
||||
};
|
||||
|
||||
enum ETypeTransparency
|
||||
{
|
||||
TT_DEFAULT,
|
||||
TT_ACTIVE,
|
||||
TT_INACTIVE
|
||||
};
|
||||
/*virtual*/ ~LLUICtrl();
|
||||
|
||||
void initFromParams(const Params& p);
|
||||
|
|
@ -202,6 +208,11 @@ public:
|
|||
|
||||
virtual void setColor(const LLColor4& color);
|
||||
|
||||
F32 getCurrentTransparency();
|
||||
|
||||
void setTransparencyType(ETypeTransparency type);
|
||||
ETypeTransparency getTransparencyType() const {return mTransparencyType;}
|
||||
|
||||
BOOL focusNextItem(BOOL text_entry_only);
|
||||
BOOL focusPrevItem(BOOL text_entry_only);
|
||||
BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE );
|
||||
|
|
@ -283,6 +294,10 @@ protected:
|
|||
boost::signals2::connection mMakeVisibleControlConnection;
|
||||
LLControlVariable* mMakeInvisibleControlVariable;
|
||||
boost::signals2::connection mMakeInvisibleControlConnection;
|
||||
|
||||
static F32 sActiveControlTransparency;
|
||||
static F32 sInactiveControlTransparency;
|
||||
|
||||
private:
|
||||
|
||||
BOOL mTabStop;
|
||||
|
|
@ -290,6 +305,8 @@ private:
|
|||
BOOL mTentative;
|
||||
LLRootHandle<LLUICtrl> mUICtrlHandle;
|
||||
|
||||
ETypeTransparency mTransparencyType;
|
||||
|
||||
class DefaultTabGroupFirstSorter;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,8 @@ void LLPanelInventoryListItemBase::draw()
|
|||
LLRect separator_rect = getLocalRect();
|
||||
separator_rect.mTop = separator_rect.mBottom;
|
||||
separator_rect.mBottom -= mSeparatorImage->getHeight();
|
||||
mSeparatorImage->draw(separator_rect);
|
||||
F32 alpha = getCurrentTransparency();
|
||||
mSeparatorImage->draw(separator_rect, UI_VERTEX_COLOR % alpha);
|
||||
}
|
||||
|
||||
LLPanel::draw();
|
||||
|
|
|
|||
Loading…
Reference in New Issue