From e018ecf4696aa17c7696c2b8f8bed2ac2d149eae Mon Sep 17 00:00:00 2001
From: James Cook <james@lindenlab.com>
Date: Tue, 27 Oct 2009 15:01:09 -0700
Subject: EXT-1352 First pass background images for floaters and panels,
 including pretty header. Reviewed with Leyla.

---
 indra/llui/llpanel.cpp | 40 ++++++++++++++++++++++++++++------------
 1 file changed, 28 insertions(+), 12 deletions(-)

(limited to 'indra/llui/llpanel.cpp')

diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 095200ddc3..b53f7801cf 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -71,10 +71,12 @@ const LLPanel::Params& LLPanel::getDefaultParams()
 LLPanel::Params::Params()
 :	has_border("border", false),
 	border(""),
-	bg_opaque_color("bg_opaque_color"),
-	bg_alpha_color("bg_alpha_color"),
 	background_visible("background_visible", false),
 	background_opaque("background_opaque", false),
+	bg_opaque_color("bg_opaque_color"),
+	bg_alpha_color("bg_alpha_color"),
+	bg_opaque_image("bg_opaque_image"),
+	bg_alpha_image("bg_alpha_image"),
 	min_width("min_width", 100),
 	min_height("min_height", 100),
 	strings("string"),
@@ -92,10 +94,12 @@ LLPanel::Params::Params()
 
 LLPanel::LLPanel(const LLPanel::Params& p)
 :	LLUICtrl(p),
-	mBgColorAlpha(p.bg_alpha_color()),
-	mBgColorOpaque(p.bg_opaque_color()),
 	mBgVisible(p.background_visible),
 	mBgOpaque(p.background_opaque),
+	mBgOpaqueColor(p.bg_opaque_color()),
+	mBgAlphaColor(p.bg_alpha_color()),
+	mBgOpaqueImage(p.bg_opaque_image()),
+	mBgAlphaImage(p.bg_alpha_image()),
 	mDefaultBtn(NULL),
 	mBorder(NULL),
 	mLabel(p.label),
@@ -178,19 +182,31 @@ void LLPanel::draw()
 	// draw background
 	if( mBgVisible )
 	{
-		//RN: I don't see the point of this
-		S32 left = 0;//LLPANEL_BORDER_WIDTH;
-		S32 top = getRect().getHeight();// - LLPANEL_BORDER_WIDTH;
-		S32 right = getRect().getWidth();// - LLPANEL_BORDER_WIDTH;
-		S32 bottom = 0;//LLPANEL_BORDER_WIDTH;
-
+		LLRect local_rect = getLocalRect();
 		if (mBgOpaque )
 		{
-			gl_rect_2d( left, top, right, bottom, mBgColorOpaque.get() % alpha);
+			// opaque, in-front look
+			if (mBgOpaqueImage.notNull())
+			{
+				mBgOpaqueImage->draw( local_rect, UI_VERTEX_COLOR % alpha );
+			}
+			else
+			{
+				// fallback to flat colors when there are no images
+				gl_rect_2d( local_rect, mBgOpaqueColor.get() % alpha);
+			}
 		}
 		else
 		{
-			gl_rect_2d( left, top, right, bottom, mBgColorAlpha.get() % alpha);
+			// transparent, in-back look
+			if (mBgAlphaImage.notNull())
+			{
+				mBgAlphaImage->draw( local_rect, UI_VERTEX_COLOR % alpha );
+			}
+			else
+			{
+				gl_rect_2d( local_rect, mBgAlphaColor.get() % alpha );
+			}
 		}
 	}
 
-- 
cgit v1.2.3


From f80a3e268ad96de935c886adc2009ff5b2c880fc Mon Sep 17 00:00:00 2001
From: James Cook <james@lindenlab.com>
Date: Tue, 27 Oct 2009 16:26:49 -0700
Subject: Revert change: Floater constructor CANNOT call LLPanel(p) with
 params, must set bg images in initFromParams, because we have too many
 LLPanels to retrofit them all to call LLPanel() with params.  Discussed with
 Richard.

---
 indra/llui/llpanel.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'indra/llui/llpanel.cpp')

diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index b53f7801cf..0d340699c5 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -107,6 +107,8 @@ LLPanel::LLPanel(const LLPanel::Params& p)
 	mCommitCallbackRegistrar(false),
 	mEnableCallbackRegistrar(false),
 	mXMLFilename(p.filename)
+	// *NOTE: Be sure to also change LLPanel::initFromParams().  We have too
+	// many classes derived from LLPanel to retrofit them all to pass in params.
 {
 	setIsChrome(FALSE);
 
@@ -459,7 +461,8 @@ void LLPanel::initFromParams(const LLPanel::Params& p)
 	setBackgroundOpaque(p.background_opaque);
 	setBackgroundColor(p.bg_opaque_color().get());
 	setTransparentColor(p.bg_alpha_color().get());
-	
+	mBgOpaqueImage = p.bg_opaque_image();
+	mBgAlphaImage = p.bg_alpha_image();
 }
 
 static LLFastTimer::DeclareTimer FTM_PANEL_SETUP("Panel Setup");
-- 
cgit v1.2.3