From cf9814bc05f17e233e5d03e63fc2e519512b3e58 Mon Sep 17 00:00:00 2001
From: Martin Reddy <lynx@lindenlab.com>
Date: Thu, 1 Oct 2009 17:52:20 +0000
Subject: EXT-332: Updated the visual style of the Buy L$ floater based on
 Erica's design. Now any errors during the L$ purchase process will give you a
 nice prompt to visit the SL website.

Replaced all user-visible references to the illegal term "currency"
with the term "L$".

Also fixed an outstanding bug with this floater: if you clicked the
Buy button but then cancelled the confirmation dialog, then the Buy
button would remain disabled. Now the Buy button is only disabled
during periods when you actually cannot buy.

Added initial support for local currencies, with the use of a new
[LOCALAMOUNT] field in the XUI files. When the XML-RPC server can
actually return local currency details, we can hook this up by just
changing llcurrencyuimanager.cpp.

Discussed XML-RPC interaction with Morpheus. Thanks to Erica for
the images and first cut at the XUI.
---
 indra/newview/llcurrencyuimanager.cpp              |   6 +-
 indra/newview/llfloaterbuycurrency.cpp             |  42 +--
 indra/newview/skins/default/textures/textures.xml  |   3 +
 .../textures/widgets/Linden_Dollar_Alert.png       | Bin 0 -> 66186 bytes
 .../textures/widgets/Linden_Dollar_Background.png  | Bin 0 -> 9506 bytes
 .../skins/default/xui/en/floater_buy_currency.xml  | 333 ++++++++++-----------
 .../newview/skins/default/xui/en/notifications.xml |   2 +-
 .../skins/default/xui/en/panel_status_bar.xml      |   2 +-
 8 files changed, 186 insertions(+), 202 deletions(-)
 create mode 100644 indra/newview/skins/default/textures/widgets/Linden_Dollar_Alert.png
 create mode 100644 indra/newview/skins/default/textures/widgets/Linden_Dollar_Background.png

diff --git a/indra/newview/llcurrencyuimanager.cpp b/indra/newview/llcurrencyuimanager.cpp
index 9957694727..979a1a9a60 100644
--- a/indra/newview/llcurrencyuimanager.cpp
+++ b/indra/newview/llcurrencyuimanager.cpp
@@ -125,7 +125,7 @@ LLCurrencyUIManager::Impl::Impl(LLPanel& dialog)
 	mUserCurrencyBuy(2000), // note, this is a default, real value set in llfloaterbuycurrency.cpp
 	mUserEnteredCurrencyBuy(false),
 	mSiteCurrencyEstimated(false),
-	  mSiteCurrencyEstimatedCost(0),
+	mSiteCurrencyEstimatedCost(0),
 	mBought(false),
 	mTransactionType(TransactionNone), mTransaction(0),
 	mCurrencyChanged(false)
@@ -394,7 +394,7 @@ void LLCurrencyUIManager::Impl::updateUI()
 		}
 	}
 
-	mPanel.childSetTextArg("currency_est", "[USD]", llformat("%#.2f", mSiteCurrencyEstimatedCost / 100.0));
+	mPanel.childSetTextArg("currency_est", "[LOCALAMOUNT]", "US$ " + llformat("%#.2f", mSiteCurrencyEstimatedCost / 100.0));
 	mPanel.childSetVisible("currency_est", mSiteCurrencyEstimated && mUserCurrencyBuy > 0);
 
 	if (mPanel.childIsEnabled("buy_btn")
@@ -478,7 +478,7 @@ void LLCurrencyUIManager::buy(const std::string& buy_msg)
 
 	LLUIString msg = buy_msg;
 	msg.setArg("[LINDENS]", llformat("%d", impl.mUserCurrencyBuy));
-	msg.setArg("[USD]", llformat("%#.2f", impl.mSiteCurrencyEstimatedCost / 100.0));
+	msg.setArg("[LOCALAMOUNT]", "US$ " + llformat("%#.2f", impl.mSiteCurrencyEstimatedCost / 100.0));
 	LLConfirmationManager::confirm(impl.mSiteConfirm,
 								   msg,
 								   impl,
diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp
index 0107cb6fe2..5c4b8552a6 100644
--- a/indra/newview/llfloaterbuycurrency.cpp
+++ b/indra/newview/llfloaterbuycurrency.cpp
@@ -159,6 +159,9 @@ void LLFloaterBuyCurrencyUI::draw()
 		updateUI();
 	}
 
+	// disable the Buy button when we are not able to buy
+	childSetEnabled("buy_btn", mManager.canBuy());
+
 	LLFloater::draw();
 }
 
@@ -194,29 +197,19 @@ void LLFloaterBuyCurrencyUI::updateUI()
 	// error section
 	if (hasError)
 	{
-		mChildren.setBadge(std::string("step_error"), LLViewChildren::BADGE_ERROR);
-		
-		LLTextBox* message = getChild<LLTextBox>("error_message");
-		if (message)
-		{
-			message->setVisible(true);
-			message->setWrappedText(mManager.errorMessage());
-		}
-
-		childSetVisible("error_web", !mManager.errorURI().empty());
-		if (!mManager.errorURI().empty())
-		{
-			childHide("getting_data");
-		}
+		childHide("normal_background");
+		childShow("error_background");
+		childShow("cannot_buy_message");
+		childShow("error_web");
 	}
 	else
 	{
-		childHide("step_error");
-		childHide("error_message");
+		childShow("normal_background");
+		childHide("error_background");
+		childHide("cannot_buy_message");
 		childHide("error_web");
 	}
-	
-	
+
 	//  currency
 	childSetVisible("contacting", false);
 	childSetVisible("buy_action", false);
@@ -224,8 +217,6 @@ void LLFloaterBuyCurrencyUI::updateUI()
 	
 	if (!hasError)
 	{
-		mChildren.setBadge(std::string("step_1"), LLViewChildren::BADGE_NOTE);
-
 		if (mManager.buying())
 		{
 			childSetVisible("contacting", true);
@@ -286,9 +277,8 @@ void LLFloaterBuyCurrencyUI::updateUI()
 		childHide("purchase_warning_notenough");
 	}
 	
-	childSetEnabled("buy_btn", mManager.canBuy());
-
-	if (!mManager.canBuy() && !childIsVisible("error_web"))
+	childHide("getting_data");
+	if (!mManager.canBuy() && !hasError)
 	{
 		childShow("getting_data");
 	}
@@ -298,10 +288,6 @@ void LLFloaterBuyCurrencyUI::onClickBuy()
 {
 	mManager.buy(getString("buy_currency"));
 	updateUI();
-	// JC: updateUI() doesn't get called again until progress is made
-	// with transaction processing, so the "Purchase" button would be
-	// left enabled for some time.  Pre-emptively disable.
-	childSetEnabled("buy_btn", false);
 }
 
 void LLFloaterBuyCurrencyUI::onClickCancel()
@@ -311,7 +297,7 @@ void LLFloaterBuyCurrencyUI::onClickCancel()
 
 void LLFloaterBuyCurrencyUI::onClickErrorWeb()
 {
-	LLWeb::loadURLExternal(mManager.errorURI());
+	LLWeb::loadURLExternal(getString("account_website"));
 	closeFloater();
 }
 
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index 66ea444c15..8a6e9486a2 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -173,6 +173,9 @@
   <texture name="Inv_Underpants" file_name="icons/Inv_Underpants.png" preload="false" />
   <texture name="Inv_Undershirt" file_name="icons/Inv_Undershirt.png" preload="false" />
 
+  <texture name="Linden_Dollar_Alert" file_name="widgets/Linden_Dollar_Alert.png"/>
+  <texture name="Linden_Dollar_Background" file_name="widgets/Linden_Dollar_Background.png"/>
+
   <texture name="ListItem_Select" file_name="widgets/ListItem_Select.png" preload="true" />
   <texture name="ListItem_Over" file_name="widgets/ListItem_Over.png" preload="true" />
 
diff --git a/indra/newview/skins/default/textures/widgets/Linden_Dollar_Alert.png b/indra/newview/skins/default/textures/widgets/Linden_Dollar_Alert.png
new file mode 100644
index 0000000000..a1f21e8194
Binary files /dev/null and b/indra/newview/skins/default/textures/widgets/Linden_Dollar_Alert.png differ
diff --git a/indra/newview/skins/default/textures/widgets/Linden_Dollar_Background.png b/indra/newview/skins/default/textures/widgets/Linden_Dollar_Background.png
new file mode 100644
index 0000000000..a1d602f6f0
Binary files /dev/null and b/indra/newview/skins/default/textures/widgets/Linden_Dollar_Background.png differ
diff --git a/indra/newview/skins/default/xui/en/floater_buy_currency.xml b/indra/newview/skins/default/xui/en/floater_buy_currency.xml
index 52c7944ba9..563a222ff9 100644
--- a/indra/newview/skins/default/xui/en/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/en/floater_buy_currency.xml
@@ -1,296 +1,291 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <floater
  can_minimize="false"
- height="270"
+ height="275"
  layout="topleft"
  name="buy currency"
- help_topic="buy_currency"
+ help_topic="buy_linden_dollars"
  single_instance="true"
- title="Buy Currency"
+ title="Buy L$"
  width="350">
     <floater.string
      name="buy_currency">
-        Buy L$ [LINDENS] for approx. US$ [USD]
+        Buy L$ [LINDENS] for approx. [LOCALAMOUNT]
     </floater.string>
-    <text
+    <floater.string
+     name="account_website">
+        http://secondlife.com/account/billing.php
+    </floater.string>
+    <icon
+     height="215"
+     image_name="Linden_Dollar_Background"
+     layout="topleft"
+     left="0"
+     name="normal_background"
+     top="17"
+     width="350" />
+   <text
      type="string"
      length="1"
-     bottom_delta="48"
      follows="top|left"
      font="SansSerifHuge"
-     height="24"
      layout="topleft"
-     left="16"
-     name="info_buying"
-     right="-20">
-        Buying Currency:
+     left="20"
+     height="30"
+     top="30"
+     width="300"
+     name="info_need_more">
+        You need more L$:
     </text>
     <text
      type="string"
      length="1"
-     bottom_delta="0"
      follows="top|left"
-     font="SansSerifHuge"
-     height="24"
+     height="16"
      layout="topleft"
-     left="16"
-     name="info_cannot_buy"
-     right="-20">
-        Cannot buy now:
+     left="20"
+     width="300"
+     name="contacting">
+        Contacting LindeX...
     </text>
     <text
      type="string"
      length="1"
-     bottom_delta="0"
      follows="top|left"
      font="SansSerifHuge"
-     height="24"
      layout="topleft"
-     left="16"
-     name="info_need_more"
-     right="-20">
-        You need more currency:
+     left="20"
+     height="30"
+     top="30"
+     width="200"
+     name="info_buying">
+        Buy L$
     </text>
-    <icon
-     follows="top|left"
-     height="64"
-     image_name="badge_note.j2c"
-     layout="topleft"
-     left="0"
-     name="step_error"
-     top="48"
-     width="64" />
     <text
      type="string"
      length="1"
-     bottom_delta="96"
-     follows="top|left"
-     height="140"
-     layout="topleft"
-     left="72"
-     name="error_message"
-     right="-20">
-        Something ain&apos;t right.
-    </text>
-    <button
-     follows="bottom|left"
-     height="20"
-     label="Go to website"
-     layout="topleft"
-     left_delta="0"
-     name="error_web"
-     top_delta="124"
-     width="120" />
-    <icon
-     follows="top|left"
-     height="64"
-     image_name="badge_note.j2c"
-     layout="topleft"
-     left="0"
-     name="step_1"
-     top="48"
-     width="64" />
-    <text
-     type="string"
-     length="1"
-     bottom_delta="-38"
      follows="top|left"
+     font="SansSerifMedium"
      height="16"
      layout="topleft"
-     left="72"
-     name="contacting"
-     right="-20">
-        Contacting LindeX...
+     left="20"
+     name="balance_label"
+     top_pad="10"
+     width="210">
+        I have
     </text>
     <text
      type="string"
      length="1"
-     bottom_delta="0"
+     font="SansSerifMedium"
      follows="top|left"
+     halign="right"
      height="16"
      layout="topleft"
-     left="72"
-     name="buy_action_unknown"
-     right="-20">
-        Buy L$ on the LindeX currency exchange
+     left="200"
+     name="balance_amount"
+     top_delta="0"
+     width="100">
+        L$ [AMT]
     </text>
     <text
      type="string"
      length="1"
-     bottom_delta="0"
      follows="top|left"
+     font="SansSerifMedium"
      height="16"
+     top_pad="15"
      layout="topleft"
-     left="72"
-     name="buy_action"
-     right="-20">
-        [NAME] L$ [PRICE]
+     left="20"
+     name="currency_action"
+     width="210">
+        I want to buy
     </text>
     <text
+     font="SansSerifMedium"
      type="string"
      length="1"
-     follows="top|left"
+     follows="left|top"
      height="16"
      layout="topleft"
-     left_delta="0"
-     name="currency_action"
-     top_pad="4"
-     width="40">
-        Buy L$
+     top_delta="0"
+     left="222"
+     name="currency_label"
+     width="15">
+      L$
     </text>
     <line_editor
      type="string"
-     length="1"
-     follows="top|right"
-     height="16"
-     layout="topleft"
-     left_pad="5"
+     halign="right"
+     font="SansSerifMedium"
+     select_on_focus="true"
+     follows="top|left"
+     top_delta="-7"
+     height="22"
+     label="L$"
+     left_pad="3"
      name="currency_amt"
-     top_delta="0"
-     width="80">
+     width="60">
         1234
     </line_editor>
     <text
      type="string"
-     length="1"
-     follows="top|right"
-     height="16"
-     layout="topleft"
-     left_pad="5"
-     name="currency_est"
-     top_delta="0"
-     width="180">
-        for approx. US$ [USD,number,2]
-    </text>
-    <text
-     type="string"
-     length="1"
-     follows="top|right"
-     height="16"
-     layout="topleft"
-     left_delta="5"
-     name="getting_data"
-     top_delta="0"
-     width="180">
-        Getting data...
-    </text>
-    <text
-     type="string"
+     font="SansSerifMedium"
      length="1"
      follows="top|left"
      height="16"
      layout="topleft"
-     left="80"
-     name="balance_label"
-     top="110"
-     width="240">
-        You currently have
+     left="20"
+     top_pad="10"
+     name="buying_label"
+     width="210">
+        For the price
     </text>
     <text
      type="string"
      length="1"
+     font="SansSerifMedium"
+     text_color="EmphasisColor"
      follows="top|left"
      halign="right"
      height="16"
-     layout="topleft"
-     left_delta="0"
-     name="balance_amount"
      top_delta="0"
-     width="240">
-        L$ [AMT]
+     layout="topleft"
+     left="170"
+     name="currency_est"
+     width="130">
+     [LOCALAMOUNT]
     </text>
     <text
      type="string"
+     font="SansSerifSmall"
+     text_color="EmphasisColor"
      length="1"
      follows="top|left"
      height="16"
      layout="topleft"
-     left_delta="0"
-     name="buying_label"
-     top_pad="4"
-     width="240">
-        You are buying
+     left="40"
+     width="100"
+     halign="right"
+     name="getting_data">
+        Estimating...
     </text>
     <text
      type="string"
+     font="SansSerifSmall"
+     top_delta="0"
      length="1"
      follows="top|left"
      halign="right"
      height="16"
+     left_pad="10"
+     width="150"
      layout="topleft"
-     left_delta="0"
-     name="buying_amount"
-     top_delta="0"
-     width="240">
-        L$ [AMT]
+     name="buy_action">
+        [NAME] L$ [PRICE]
     </text>
     <text
      type="string"
+     font="SansSerifMedium"
      length="1"
      follows="top|left"
      height="16"
      layout="topleft"
-     left_delta="0"
+     left="20"
      name="total_label"
-     top_pad="4"
-     width="240">
-        Your balance will be
+     width="210">
+        My new balance will be
     </text>
     <text
      type="string"
      length="1"
+     font="SansSerifMedium"
      follows="top|left"
-     halign="right"
+     top_delta="0"
      height="16"
      layout="topleft"
-     left_delta="0"
+     left="200"
+     halign="right"
      name="total_amount"
-     top_delta="0"
-     width="240">
+     width="100">
         L$ [AMT]
     </text>
     <text
      type="string"
      length="1"
-     bottom_delta="48"
      follows="top|left"
-     height="32"
      layout="topleft"
-     left="72"
-     name="purchase_warning_repurchase"
-     right="-20">
-        Confirming this purchase only buys the currency.
-You&apos;ll need to try the operation again.
+     left="20"
+     width="300"
+     name="purchase_warning_repurchase">
+        Confirming this purchase only buys the L$.
+        You&apos;ll need to try again.
     </text>
     <text
      type="string"
      length="1"
-     bottom_delta="0"
      follows="top|left"
-     height="32"
      layout="topleft"
-     left="72"
-     name="purchase_warning_notenough"
-     right="-20">
-        You aren&apos;t buying enough currency
-Increase the amount to buy.
+     left="20"
+     name="purchase_warning_notenough">
+        You aren&apos;t buying enough L$.
+        Increase the amount to buy.
     </text>
+
+    <button
+     follows="bottom|left"
+     height="20"
+     label="Buy Now"
+     layout="topleft"
+     left="151"
+     name="buy_btn"
+     top="248"
+     width="90"/>
     <button
      follows="bottom|right"
      height="20"
      label="Cancel"
      layout="topleft"
-     left="237"
+     left_pad="10"
      name="cancel_btn"
-     top="234"
-     width="90" />
-    <button
-     follows="bottom|left"
-     height="20"
-     label="Purchase"
+     width="90"/>
+    <icon
+     height="215"
+     image_name="Linden_Dollar_Alert"
      layout="topleft"
-     left_delta="-96"
-     name="buy_btn"
-     top_delta="0"
-     width="90" />
+     left="0"
+     name="error_background"
+     top="15"
+     width="350"/>
+    <text
+     type="string"
+     font="SansSerifHuge"
+     left="170"
+     width="170"
+     height="80"
+     top="30"
+     name="info_cannot_buy">
+        Take your
+Second Life to
+the next level...
+    </text>
+     <button
+      follows="bottom|left"
+      height="20"
+      label="Continue to the Web"
+      layout="topleft"
+      left="170"
+      name="error_web"
+      top="120"
+      width="160"/>
+     <text
+      type="string"
+      width="350"
+      height="20"
+      top_pad="92"
+      left_pad="-300"
+      follows="bottom|right"
+      name="cannot_buy_message">
+        Continue to the web and enter payment information
+     </text>
 </floater>
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 6298a068f0..c1262f5efe 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -1245,7 +1245,7 @@ Please move all objects to be acquired onto the same region.
    type="alertmodal">
 [EXTRA]
 
-Go to [_URL] for information on purchasing currency?
+Go to [_URL] for information on purchasing L$?
     <url option="0" name="url">
 
 			http://secondlife.com/app/currency/
diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml
index c178554287..f6ffd2e4ee 100644
--- a/indra/newview/skins/default/xui/en/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml
@@ -52,7 +52,7 @@
      left="-210"
      name="buycurrency"
      picture_style="true"
-     tool_tip="My Balance / Buy currency"
+     tool_tip="My Balance / Buy L$"
      top="0"
      width="117" />
     <text
-- 
cgit v1.2.3