diff options
-rw-r--r-- | indra/llui/llfloater.cpp | 42 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 8 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 22 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_preferences_advanced.xml | 40 |
4 files changed, 104 insertions, 8 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index b758070419..34d8e9c500 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -61,6 +61,9 @@ // 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] = { @@ -200,6 +203,21 @@ void LLFloater::initClass() { sButtonToolTips[i] = LLTrans::getString( sButtonToolTipsIndex[i] ); } + + LLControlVariable* ctrl = LLUI::sSettingGroups["config"]->getControl("ActiveFloaterTransparency").get(); + if (ctrl) + { + ctrl->getSignal()->connect(boost::bind(&LLFloater::updateActiveFloaterTransparency)); + sActiveFloaterTransparency = LLUI::sSettingGroups["config"]->getF32("ActiveFloaterTransparency"); + } + + ctrl = LLUI::sSettingGroups["config"]->getControl("InactiveFloaterTransparency").get(); + if (ctrl) + { + ctrl->getSignal()->connect(boost::bind(&LLFloater::updateInactiveFloaterTransparency)); + sInactiveFloaterTransparency = LLUI::sSettingGroups["config"]->getF32("InactiveFloaterTransparency"); + } + } // defaults for floater param block pulled from widgets/floater.xml @@ -347,6 +365,18 @@ void LLFloater::layoutDragHandle() updateTitleButtons(); } +// static +void LLFloater::updateActiveFloaterTransparency() +{ + sActiveFloaterTransparency = LLUI::sSettingGroups["config"]->getF32("ActiveFloaterTransparency"); +} + +// static +void LLFloater::updateInactiveFloaterTransparency() +{ + sInactiveFloaterTransparency = LLUI::sSettingGroups["config"]->getF32("InactiveFloaterTransparency"); +} + void LLFloater::addResizeCtrls() { // Resize bars (sides) @@ -1622,7 +1652,8 @@ void LLFloater::onClickCloseBtn() // virtual void LLFloater::draw() { - F32 alpha = getDrawContext().mAlpha; + mCurrentTransparency = hasFocus() ? sActiveFloaterTransparency : sInactiveFloaterTransparency; + // draw background if( isBackgroundVisible() ) { @@ -1653,12 +1684,12 @@ void LLFloater::draw() if (image) { // We're using images for this floater's backgrounds - image->draw(getLocalRect(), overlay_color % alpha); + image->draw(getLocalRect(), overlay_color % mCurrentTransparency); } else { // We're not using images, use old-school flat colors - gl_rect_2d( left, top, right, bottom, color % alpha ); + gl_rect_2d( left, top, right, bottom, color % mCurrentTransparency ); // draw highlight on title bar to indicate focus. RDW if(hasFocus() @@ -1670,7 +1701,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 % alpha, 0, TRUE); + titlebar_focus_color % mCurrentTransparency, 0, TRUE); } } } @@ -1720,7 +1751,6 @@ void LLFloater::draw() void LLFloater::drawShadow(LLPanel* panel) { - F32 alpha = panel->getDrawContext().mAlpha; S32 left = LLPANEL_BORDER_WIDTH; S32 top = panel->getRect().getHeight() - LLPANEL_BORDER_WIDTH; S32 right = panel->getRect().getWidth() - LLPANEL_BORDER_WIDTH; @@ -1737,7 +1767,7 @@ void LLFloater::drawShadow(LLPanel* panel) shadow_color.mV[VALPHA] *= 0.5f; } gl_drop_shadow(left, top, right, bottom, - shadow_color % alpha, + shadow_color % mCurrentTransparency, llround(shadow_offset)); } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 32d03f9f83..fa806bb632 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -341,6 +341,9 @@ private: void addDragHandle(); void layoutDragHandle(); // repair layout + static void updateActiveFloaterTransparency(); + static void updateInactiveFloaterTransparency(); + public: // Called when floater is opened, passes mKey // Public so external views or floaters can watch for this floater opening @@ -408,6 +411,11 @@ private: bool mDocked; bool mTornOff; + F32 mCurrentTransparency; + + static F32 sActiveFloaterTransparency; + static F32 sInactiveFloaterTransparency; + static LLMultiFloater* sHostp; static BOOL sQuitting; static std::string sButtonNames[BUTTON_COUNT]; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 097fdfbb99..ebd93b5987 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -35,6 +35,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>ActiveFloaterTransparency</key> + <map> + <key>Comment</key> + <string>Transparency of active floaters (floaters that have focus)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.95</real> + </map> <key>AdvanceSnapshot</key> <map> <key>Comment</key> @@ -3986,6 +3997,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>InactiveFloaterTransparency</key> + <map> + <key>Comment</key> + <string>Transparency of inactive floaters (floaters that have no focus)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>0.5</real> + </map> <key>InBandwidth</key> <map> <key>Comment</key> diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml index 9d496575c9..006d7895b2 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml @@ -17,6 +17,42 @@ name="middle_mouse"> Middle Mouse </panel.string> + <slider + can_edit_text="false" + control_name="ActiveFloaterTransparency" + decimal_digits="2" + follows="left|top" + height="16" + increment="0.01" + initial_value="0.8" + layout="topleft" + label_width="120" + label="Active floater opacity:" + left="240" + max_val="1.00" + min_val="0.00" + name="active" + show_text="true" + top="75" + width="290" /> + <slider + can_edit_text="false" + control_name="InactiveFloaterTransparency" + decimal_digits="2" + follows="left|top" + height="16" + increment="0.01" + initial_value="0.5" + layout="topleft" + label_width="120" + label="Inctive floater opacity:" + left="240" + max_val="1.00" + min_val="0.00" + name="active" + show_text="true" + top_pad="15" + width="290" /> <icon follows="left|top" height="18" @@ -70,7 +106,7 @@ height="10" left="80" name="heading2" - width="270" + width="240" top_pad="5"> Automatic position for: </text> @@ -207,7 +243,7 @@ Automatic position for: left="80" name="UI Size:" top_pad="25" - width="300"> + width="160"> UI size </text> <slider |