summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2010-06-09 14:20:31 +0300
committerVadim Savchuk <vsavchuk@productengine.com>2010-06-09 14:20:31 +0300
commit27479d35237de5989ea44b9f3d1ee3513733b501 (patch)
treec333b873b0714f28115a7f41daf192dc4ea7c55f
parente24bfa78666788bc1e5179ff5d4ac3bf7d0a5491 (diff)
parentd34ce302591616637a9a025c8016bfbe2a9ff174 (diff)
merge
--HG-- branch : product-engine
-rw-r--r--indra/llui/llaccordionctrl.cpp4
-rw-r--r--indra/llui/llaccordionctrltab.h1
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llnearbychathandler.cpp2
-rw-r--r--indra/newview/llpaneleditwearable.cpp78
-rw-r--r--indra/newview/llpaneleditwearable.h21
-rw-r--r--indra/newview/skins/default/xui/en/panel_edit_shape.xml29
7 files changed, 129 insertions, 17 deletions
diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp
index 6bf1347514..cd23d5cd33 100644
--- a/indra/llui/llaccordionctrl.cpp
+++ b/indra/llui/llaccordionctrl.cpp
@@ -352,7 +352,7 @@ void LLAccordionCtrl::addCollapsibleCtrl(LLView* view)
mAccordionTabs.push_back(accordion_tab);
accordion_tab->setDropDownStateChangedCallback( boost::bind(&LLAccordionCtrl::onCollapseCtrlCloseOpen, this, mAccordionTabs.size() - 1) );
-
+ arrange();
}
void LLAccordionCtrl::removeCollapsibleCtrl(LLView* view)
@@ -541,6 +541,8 @@ void LLAccordionCtrl::arrange()
S32 panel_height = getRect().getHeight() - 2*BORDER_MARGIN;
+ if (accordion_tab->getFitParent())
+ panel_height = accordion_tab->getRect().getHeight();
ctrlSetLeftTopAndSize(accordion_tab,panel_rect.mLeft,panel_top,panel_width,panel_height);
show_hide_scrollbar(getRect().getWidth(),getRect().getHeight());
diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h
index 82e0234bfc..480b26e130 100644
--- a/indra/llui/llaccordionctrltab.h
+++ b/indra/llui/llaccordionctrltab.h
@@ -190,6 +190,7 @@ public:
void showAndFocusHeader();
void setFitPanel( bool fit ) { mFitPanel = true; }
+ bool getFitParent() const { return mFitPanel; }
protected:
void adjustContainerPanel (const LLRect& child_rect);
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index b0211dd85b..d4aebe6cb1 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -11428,5 +11428,16 @@
<key>Value</key>
<integer>180</integer>
</map>
+ <key>HeightUnits</key>
+ <map>
+ <key>Comment</key>
+ <string>Determines which metric units are used: 1(TRUE) for meter and 0(FALSE) for foot.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>1</integer>
+ </map>
</map>
</llsd>
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index 9824517ed1..d36fc6bca7 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -287,7 +287,7 @@ void LLNearbyChatScreenChannel::showToastsBottom()
toast_rect.setLeftTopAndSize(getRect().mLeft , bottom + toast_rect.getHeight(), toast_rect.getWidth() ,toast_rect.getHeight());
toast->setRect(toast_rect);
- bottom += toast_rect.getHeight() + margin;
+ bottom += toast_rect.getHeight() - toast->getTopPad() + margin;
}
// use reverse order to provide correct z-order and avoid toast blinking
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index a1a9300ec2..1aedfec86f 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -61,6 +61,9 @@
#include "llagentcamera.h"
#include "llmorphview.h"
+#include "llcommandhandler.h"
+#include "lltextutil.h"
+
// register panel with appropriate XML
static LLRegisterPanelClassWrapper<LLPanelEditWearable> t_edit_wearable("panel_edit_wearable");
@@ -608,6 +611,36 @@ LLPanelEditWearable::~LLPanelEditWearable()
}
+bool LLPanelEditWearable::changeHeightUnits(const LLSD& new_value)
+{
+ updateMetricLayout( new_value.asBoolean() );
+ updateTypeSpecificControls(LLWearableType::WT_SHAPE);
+ return true;
+}
+
+void LLPanelEditWearable::updateMetricLayout(BOOL new_value)
+{
+ LLUIString current_metric, replacment_metric;
+ current_metric = new_value ? mMeters : mFeet;
+ replacment_metric = new_value ? mFeet : mMeters;
+ mHeigthValue.setArg( "[METRIC1]", current_metric.getString() );
+ mReplacementMetricUrl.setArg( "[URL_METRIC2]", std::string("[secondlife:///app/metricsystem ") + replacment_metric.getString() + std::string("]"));
+}
+
+void LLPanelEditWearable::updateAvatarHeightLabel()
+{
+ mTxtAvatarHeight->setText(LLStringUtil::null);
+ LLStyle::Params param;
+ param.color = mAvatarHeigthLabelColor;
+ mTxtAvatarHeight->appendText(mHeigth, false, param);
+ param.color = mAvatarHeigthValueLabelColor;
+ mTxtAvatarHeight->appendText(mHeigthValue, false, param);
+ param.color = mAvatarHeigthLabelColor; // using mAvatarHeigthLabelColor for '/' separator
+ mTxtAvatarHeight->appendText(" / ", false, param);
+ mTxtAvatarHeight->appendText(this->mReplacementMetricUrl, false, param);
+}
+
+
// virtual
BOOL LLPanelEditWearable::postBuild()
{
@@ -700,6 +733,20 @@ BOOL LLPanelEditWearable::postBuild()
for_each_picker_ctrl_entry <LLTextureCtrl> (getPanel(type), type, boost::bind(init_texture_ctrl, this, _1, _2));
}
+ // init all strings
+ mMeters = mPanelShape->getString("meters");
+ mFeet = mPanelShape->getString("feet");
+ mHeigth = mPanelShape->getString("height") + " ";
+ mHeigthValue = "[HEIGHT] [METRIC1]";
+ mReplacementMetricUrl = "[URL_METRIC2]";
+
+ std::string color = mPanelShape->getString("heigth_label_color");
+ mAvatarHeigthLabelColor = LLUIColorTable::instance().getColor(color, LLColor4::green);
+ color = mPanelShape->getString("heigth_value_label_color");
+ mAvatarHeigthValueLabelColor = LLUIColorTable::instance().getColor(color, LLColor4::green);
+ gSavedSettings.getControl("HeightUnits")->getSignal()->connect(boost::bind(&LLPanelEditWearable::changeHeightUnits, this, _2));
+ updateMetricLayout(gSavedSettings.getBOOL("HeightUnits"));
+
return TRUE;
}
@@ -1107,12 +1154,22 @@ void LLPanelEditWearable::toggleTypeSpecificControls(LLWearableType::EType type)
void LLPanelEditWearable::updateTypeSpecificControls(LLWearableType::EType type)
{
+ const F32 ONE_METER = 1.0;
+ const F32 ONE_FOOT = 0.3048 * ONE_METER; // in meters
// Update controls specific to shape editing panel.
if (type == LLWearableType::WT_SHAPE)
{
// Update avatar height
- std::string avatar_height_str = llformat("%.2f", gAgentAvatarp->mBodySize.mV[VZ]);
- mTxtAvatarHeight->setTextArg("[HEIGHT]", avatar_height_str);
+ F32 new_size = gAgentAvatarp->mBodySize.mV[VZ];
+ if (gSavedSettings.getBOOL("HeightUnits") == FALSE)
+ {
+ // convert meters to feet
+ new_size = new_size / ONE_FOOT;
+ }
+
+ std::string avatar_height_str = llformat("%.2f", new_size);
+ mHeigthValue.setArg("[HEIGHT]", avatar_height_str);
+ updateAvatarHeightLabel();
}
if (LLWearableType::WT_ALPHA == type)
@@ -1381,4 +1438,21 @@ void LLPanelEditWearable::initPreviousAlphaTextureEntry(LLVOAvatarDefines::EText
}
}
+// handle secondlife:///app/metricsystem
+class LLMetricSystemHandler : public LLCommandHandler
+{
+public:
+ LLMetricSystemHandler() : LLCommandHandler("metricsystem", UNTRUSTED_THROTTLE) { }
+
+ bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
+ {
+ // change height units TRUE for meters and FALSE for feet
+ BOOL new_value = (gSavedSettings.getBOOL("HeightUnits") == FALSE) ? TRUE : FALSE;
+ gSavedSettings.setBOOL("HeightUnits", new_value);
+ return true;
+ }
+};
+
+LLMetricSystemHandler gMetricSystemHandler;
+
// EOF
diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h
index 54f729fa7a..c63671fcc9 100644
--- a/indra/newview/llpaneleditwearable.h
+++ b/indra/newview/llpaneleditwearable.h
@@ -104,6 +104,15 @@ private:
void initPreviousAlphaTextures();
void initPreviousAlphaTextureEntry(LLVOAvatarDefines::ETextureIndex te);
+ // callback for HeightUnits parameter.
+ bool changeHeightUnits(const LLSD& new_value);
+
+ // updates current metric and replacemet metric label text
+ void updateMetricLayout(BOOL new_value);
+
+ // updates avatar height label
+ void updateAvatarHeightLabel();
+
// the pointer to the wearable we're editing. NULL means we're not editing a wearable.
LLWearable *mWearablePtr;
LLViewerInventoryItem* mWearableItem;
@@ -117,6 +126,18 @@ private:
LLTextBox *mTxtAvatarHeight;
+ // localized and parametrized strings that used to build avatar_height_label
+ std::string mMeters;
+ std::string mFeet;
+ std::string mHeigth;
+ LLUIString mHeigthValue;
+ LLUIString mReplacementMetricUrl;
+
+ // color for mHeigth string
+ LLUIColor mAvatarHeigthLabelColor;
+ // color for mHeigthValue string
+ LLUIColor mAvatarHeigthValueLabelColor;
+
// This text editor reference will change each time we edit a new wearable -
// it will be grabbed from the currently visible panel
LLTextEditor *mTextEditor;
diff --git a/indra/newview/skins/default/xui/en/panel_edit_shape.xml b/indra/newview/skins/default/xui/en/panel_edit_shape.xml
index cf15fb0455..d295f5fe4a 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_shape.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_shape.xml
@@ -8,19 +8,22 @@
name="edit_shape_panel"
top_pad="10"
width="333" >
- <text
- follows="top|left|right"
- font="SansSerifSmallBold"
- halign="right"
- height="12"
- layout="topleft"
- left="0"
- name="avatar_height"
- text_color="EmphasisColor"
- top="0"
- width="310">
- [HEIGHT] Meters tall
- </text>
+ <string name="meters">Meters</string>
+ <string name="feet">Feet</string>
+ <string name="height">Height:</string>
+ <string name="heigth_label_color" translate="false">White_50</string>
+ <string name="heigth_value_label_color" translate="false">White</string>
+ <text
+ follows="top|left|right"
+ font="SansSerifSmallBold"
+ halign="right"
+ height="12"
+ layout="topleft"
+ left="0"
+ name="avatar_height"
+ top="0"
+ width="310">
+ </text>
<panel
border="false"
bg_alpha_color="DkGray2"