summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2018-09-10 16:44:56 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2018-09-10 16:44:56 +0300
commit43c8f5959f8afaf2f67fbbf49e78965802859b55 (patch)
tree261a148cdd8466a268923e7e42a7cbd29926a44a /indra
parent6246c8077e5ee81321cff52250d3b99eab81cd57 (diff)
MAINT-9099 Adjustable region altitudes.
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llmultislider.cpp12
-rw-r--r--indra/newview/llfloaterland.cpp1
-rw-r--r--indra/newview/llfloaterregioninfo.cpp3
-rw-r--r--indra/newview/llpanelenvironment.cpp122
-rw-r--r--indra/newview/llpanelenvironment.h23
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_environment.xml155
6 files changed, 295 insertions, 21 deletions
diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp
index 6d6b6c4e90..b5e3032626 100644
--- a/indra/llui/llmultislider.cpp
+++ b/indra/llui/llmultislider.cpp
@@ -74,7 +74,6 @@ LLMultiSlider::Params::Params()
LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p)
: LLF32UICtrl(p),
mMouseOffset( 0 ),
- mDragStartThumbRect( 0, getRect().getHeight(), p.thumb_width, 0 ),
mMaxNumSliders(p.max_sliders),
mAllowOverlap(p.allow_overlap),
mLoopOverlap(p.loop_overlap),
@@ -93,7 +92,16 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p)
{
mValue.emptyMap();
mCurSlider = LLStringUtil::null;
-
+
+ if (mOrientation == HORIZONTAL)
+ {
+ mDragStartThumbRect = LLRect(0, getRect().getHeight(), p.thumb_width, 0);
+ }
+ else
+ {
+ mDragStartThumbRect = LLRect(0, p.thumb_width, getRect().getWidth(), 0);
+ }
+
if (p.mouse_down_callback.isProvided())
{
setMouseDownCallback(initCommitCallback(p.mouse_down_callback));
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 3e50700377..a2886d5010 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -3261,6 +3261,7 @@ BOOL LLPanelLandEnvironment::postBuild()
getChild<LLUICtrl>(RDO_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEREGION));
getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(FALSE);
+ getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(FALSE);
return TRUE;
}
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 11bbd2c6fa..d13190254f 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -3376,7 +3376,7 @@ void LLPanelRegionExperiences::itemChanged( U32 event_type, const LLUUID& id )
}
//=========================================================================
-const U32 LLPanelRegionEnvironment::DIRTY_FLAG_OVERRIDE(0x01 << 3);
+const U32 LLPanelRegionEnvironment::DIRTY_FLAG_OVERRIDE(0x01 << 4);
LLPanelRegionEnvironment::LLPanelRegionEnvironment():
LLPanelEnvironmentInfo(),
@@ -3395,6 +3395,7 @@ BOOL LLPanelRegionEnvironment::postBuild()
getChild<LLUICtrl>(RDO_USEDEFAULT)->setLabelArg("[USEDEFAULT]", getString(STR_LABEL_USEDEFAULT));
getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setVisible(TRUE);
+ getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(TRUE);
getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setCommitCallback([this](LLUICtrl *, const LLSD &value){ onChkAllowOverride(value.asBoolean()); });
return TRUE;
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index 3edfd4156c..825a38e8b2 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -41,6 +41,7 @@
#include "llfloater.h"
#include "llfloaterreg.h"
#include "llfloatereditextdaycycle.h"
+#include "llmultisliderctrl.h"
#include "llsettingsvo.h"
#include "llappviewer.h"
@@ -62,26 +63,45 @@ const std::string LLPanelEnvironmentInfo::BTN_SELECTINV("btn_select_inventory");
const std::string LLPanelEnvironmentInfo::BTN_EDIT("btn_edit");
const std::string LLPanelEnvironmentInfo::SLD_DAYLENGTH("sld_day_length");
const std::string LLPanelEnvironmentInfo::SLD_DAYOFFSET("sld_day_offset");
+const std::string LLPanelEnvironmentInfo::SLD_ALTITUDES("sld_altitudes");
const std::string LLPanelEnvironmentInfo::CHK_ALLOWOVERRIDE("chk_allow_override");
const std::string LLPanelEnvironmentInfo::BTN_APPLY("btn_apply");
const std::string LLPanelEnvironmentInfo::BTN_CANCEL("btn_cancel");
const std::string LLPanelEnvironmentInfo::LBL_TIMEOFDAY("lbl_apparent_time");
const std::string LLPanelEnvironmentInfo::PNL_SETTINGS("pnl_environment_config");
+const std::string LLPanelEnvironmentInfo::PNL_ENVIRONMENT_ALTITUDES("pnl_environment_altitudes");
const std::string LLPanelEnvironmentInfo::PNL_BUTTONS("pnl_environment_buttons");
const std::string LLPanelEnvironmentInfo::PNL_DISABLED("pnl_environment_disabled");
const std::string LLPanelEnvironmentInfo::STR_LABEL_USEDEFAULT("str_label_use_default");
const std::string LLPanelEnvironmentInfo::STR_LABEL_USEREGION("str_label_use_region");
const std::string LLPanelEnvironmentInfo::STR_LABEL_UNKNOWNINV("str_unknow_inventory");
+const std::string LLPanelEnvironmentInfo::STR_ALTITUDE_DESCRIPTION("str_altitude_desription");
const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE(0x01 << 0);
const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH(0x01 << 1);
const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET(0x01 << 2);
+const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_ALTITUDES(0x01 << 3);
const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK(
LLPanelEnvironmentInfo::DIRTY_FLAG_DAYCYCLE |
LLPanelEnvironmentInfo::DIRTY_FLAG_DAYLENGTH |
- LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET );
+ LLPanelEnvironmentInfo::DIRTY_FLAG_DAYOFFSET |
+ LLPanelEnvironmentInfo::DIRTY_FLAG_ALTITUDES);
+
+const U32 ALTITUDE_SLIDER_COUNT = 3;
+const std::string alt_sliders[] = {
+ "sld1",
+ "sld2",
+ "sld3",
+};
+
+const std::string alt_labels[] = {
+ "alt1",
+ "alt2",
+ "alt3",
+ "ground",
+};
//=========================================================================
LLPanelEnvironmentInfo::LLPanelEnvironmentInfo():
@@ -104,6 +124,8 @@ BOOL LLPanelEnvironmentInfo::postBuild()
getChild<LLUICtrl>(SLD_DAYLENGTH)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged(value.asReal()); });
getChild<LLUICtrl>(SLD_DAYOFFSET)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayOffsetChanged(value.asReal()); });
+ getChild<LLMultiSliderCtrl>(SLD_ALTITUDES)->setCommitCallback([this](LLUICtrl *cntrl, const LLSD &value) { onAltSliderCallback(cntrl, value); });
+
return TRUE;
}
@@ -183,6 +205,18 @@ void LLPanelEnvironmentInfo::refresh()
udpateApparentTimeOfDay();
+ LLEnvironment::altitude_list_t altitudes = LLEnvironment::instance().getRegionAltitudes();
+ if (altitudes.size() > 0)
+ {
+ for (S32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; ++idx)
+ {
+ LLMultiSliderCtrl *sld = getChild<LLMultiSliderCtrl>(SLD_ALTITUDES);
+ sld->setSliderValue(alt_sliders[idx], altitudes[idx+1], FALSE);
+ updateAltLabel(alt_labels[idx], idx + 2, altitudes[idx+1]);
+ mAltitudes[alt_sliders[idx]] = AltitudeData(idx+1, idx, altitudes[idx+1]);
+ }
+ }
+
}
void LLPanelEnvironmentInfo::refreshFromSource()
@@ -333,6 +367,37 @@ void LLPanelEnvironmentInfo::clearDirtyFlag(U32 flag)
getChildView(BTN_CANCEL)->setEnabled((mDirtyFlag != 0) && can_edit);
}
+void LLPanelEnvironmentInfo::updateAltLabel(const std::string &alt_name, U32 sky_index, F32 alt_value)
+{
+ LLMultiSliderCtrl *sld = getChild<LLMultiSliderCtrl>(SLD_ALTITUDES);
+ LLRect sld_rect = sld->getRect();
+ U32 sld_range = sld_rect.getHeight();
+ U32 sld_bottom = sld_rect.mBottom;
+ U32 sld_offset = 8 + 1; // Default slider-thumb width plus stretch. Placeholder until images are implemented.
+ U32 pos = (sld_range - sld_offset) * ((alt_value - 100) / (4000 - 100));
+
+ // get related text box
+ LLTextBox* text = getChild<LLTextBox>(alt_name);
+ if (text)
+ {
+ // move related text box
+ LLRect rect = text->getRect();
+ U32 height = rect.getHeight();
+ rect.mBottom = sld_bottom + sld_offset + pos - (height / 2);
+ rect.mTop = rect.mBottom + height;
+ text->setRect(rect);
+
+ // update text
+ std::ostringstream convert;
+ convert << alt_value;
+ text->setTextArg("[ALTITUDE]", convert.str());
+ convert.str("");
+ convert.clear();
+ convert << sky_index;
+ text->setTextArg("[INDEX]", convert.str());
+ }
+}
+
void LLPanelEnvironmentInfo::onSwitchDefaultSelection()
{
bool can_edit = canEdit();
@@ -366,6 +431,59 @@ void LLPanelEnvironmentInfo::onSldDayOffsetChanged(F32 value)
udpateApparentTimeOfDay();
}
+void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &data)
+{
+ LLMultiSliderCtrl *sld = (LLMultiSliderCtrl *)cntrl;
+ std::string sld_name = sld->getCurSlider();
+ F32 sld_value = sld->getCurSliderValue();
+ U32 alt_index = 1;
+
+ mAltitudes[sld_name].mAltitude = sld_value;
+
+ // find index of sky layer/altitude
+ altitudes_data_t::iterator iter = mAltitudes.begin();
+ altitudes_data_t::iterator end = mAltitudes.end();
+ while (iter!=end)
+ {
+ if (sld_value > iter->second.mAltitude)
+ {
+ alt_index++;
+ }
+ iter++;
+ }
+
+ if (mAltitudes[sld_name].mAltitudeIndex != alt_index)
+ {
+ // update all labels since we could have jumped multiple
+ // (or sort by altitude, too little elements, so I didn't bother with efficiency)
+ altitudes_data_t::iterator iter = mAltitudes.begin();
+ altitudes_data_t::iterator iter2;
+ U32 new_index;
+ while (iter != end)
+ {
+ iter2 = mAltitudes.begin();
+ new_index = 1;
+ while (iter2 != end)
+ {
+ if (iter->second.mAltitude > iter2->second.mAltitude)
+ {
+ new_index++;
+ }
+ iter2++;
+ }
+ iter->second.mAltitudeIndex = new_index;
+ updateAltLabel(alt_labels[iter->second.mLabelIndex], iter->second.mAltitudeIndex + 1, iter->second.mAltitude);
+ iter++;
+ }
+ }
+ else
+ {
+ updateAltLabel(alt_labels[mAltitudes[sld_name].mLabelIndex], alt_index + 1, sld_value);
+ }
+
+ setDirtyFlag(DIRTY_FLAG_ALTITUDES);
+}
+
void LLPanelEnvironmentInfo::onBtnApply()
{
doApply();
@@ -431,6 +549,8 @@ void LLPanelEnvironmentInfo::doApply()
[this](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) {onEnvironmentReceived(parcel_id, envifo); });
}
+ // Todo: save altitudes once LLEnvironment::setRegionAltitudes() gets implemented
+
setControlsEnabled(false);
}
}
diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h
index a8a1f018cf..7469da9c05 100644
--- a/indra/newview/llpanelenvironment.h
+++ b/indra/newview/llpanelenvironment.h
@@ -71,11 +71,13 @@ protected:
static const std::string BTN_EDIT;
static const std::string SLD_DAYLENGTH;
static const std::string SLD_DAYOFFSET;
+ static const std::string SLD_ALTITUDES;
static const std::string CHK_ALLOWOVERRIDE;
static const std::string BTN_APPLY;
static const std::string BTN_CANCEL;
static const std::string LBL_TIMEOFDAY;
static const std::string PNL_SETTINGS;
+ static const std::string PNL_ENVIRONMENT_ALTITUDES;
static const std::string PNL_BUTTONS;
static const std::string PNL_DISABLED;
@@ -83,10 +85,12 @@ protected:
static const std::string STR_LABEL_USEDEFAULT;
static const std::string STR_LABEL_USEREGION;
static const std::string STR_LABEL_UNKNOWNINV;
+ static const std::string STR_ALTITUDE_DESCRIPTION;
static const U32 DIRTY_FLAG_DAYCYCLE;
static const U32 DIRTY_FLAG_DAYLENGTH;
static const U32 DIRTY_FLAG_DAYOFFSET;
+ static const U32 DIRTY_FLAG_ALTITUDES;
static const U32 DIRTY_FLAG_MASK;
@@ -97,10 +101,12 @@ protected:
bool getIsDirty() const { return (mDirtyFlag != 0); }
bool getIsDirtyFlag(U32 flag) const { return ((mDirtyFlag & flag) != 0); }
U32 getDirtyFlag() const { return mDirtyFlag; }
+ void updateAltLabel(const std::string &alt_name, U32 sky_index, F32 alt_value);
void onSwitchDefaultSelection();
void onSldDayLengthChanged(F32 value);
void onSldDayOffsetChanged(F32 value);
+ void onAltSliderCallback(LLUICtrl *cntrl, const LLSD &data);
void onBtnApply();
void onBtnReset();
void onBtnEdit();
@@ -126,6 +132,23 @@ protected:
LLEnvironment::EnvironmentInfo::ptr_t mCurrentEnvironment;
S32 mCurrentParcelId;
+ class AltitudeData
+ {
+ public:
+ AltitudeData() :
+ mAltitudeIndex(0), mLabelIndex(0), mAltitude(0)
+ {}
+ AltitudeData(U32 altitude_index, U32 label_index, F32 altitude) :
+ mAltitudeIndex(altitude_index), mLabelIndex(label_index), mAltitude(altitude)
+ {}
+
+ U32 mAltitudeIndex;
+ U32 mLabelIndex;
+ F32 mAltitude;
+ };
+ typedef std::map<std::string, AltitudeData> altitudes_data_t;
+ altitudes_data_t mAltitudes;
+
private:
diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml
index 557e093f51..8229dcb91d 100644
--- a/indra/newview/skins/default/xui/en/panel_region_environment.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml
@@ -3,20 +3,22 @@
<panel
border="true"
follows="top|left"
- height="300"
+ height="375"
label="Environment"
layout="topleft"
help_topic="panel_region_environment_tab"
name="panel_env_info"
- width="420">
+ width="530">
<string name="str_label_use_default">Use Default Settings</string>
<string name="str_label_use_region">Use Region Settings</string>
<string name="str_unknow_inventory">Unknown</string>
+ <string name="str_altitude_desription">Sky [INDEX]([ALTITUDE]m)</string>
<layout_stack
- width="420"
- height="450"
- follows="left|right|top|bottom"
+ width="530"
+ height="367"
+ follows="all"
+ layout="topleft"
orientation="vertical">
<layout_panel
auto_resize="true"
@@ -34,15 +36,19 @@ settings are disabled.
</text>
</layout_panel>
<layout_panel
- auto_resize="true"
+ auto_resize="false"
user_resize="false"
+ height="155"
+ min_height="0"
name="pnl_environment_config"
visible="true">
<layout_stack
left="5"
- top="5"
+ top="0"
right="-5"
- follows="left|right|top|bottom"
+ bottom="-1"
+ layout="topleft"
+ follows="all"
orientation="horizontal">
<layout_panel
background_visible="true"
@@ -51,11 +57,13 @@ settings are disabled.
auto_resize="true"
user_resize="false"
width="260"
- min_width="260">
+ min_width="260"
+ name="pnl_environment_current">
<text follows="top|left"
font="SansSerif"
halign="left"
- text_color="white">Current Environment</text>
+ text_color="white"
+ top="2">Current Environment</text>
<radio_group
height="90"
layout="topleft"
@@ -117,12 +125,16 @@ settings are disabled.
bevel_style="in"
auto_resize="true"
user_resize="false"
- background_visible="true">
+ width="260"
+ min_width="260"
+ background_visible="true"
+ name="pnl_environment_length">
<text
font="SansSerif"
follows="top|left|right"
halign="left"
- text_color="white">Day Settings</text>
+ text_color="white"
+ top="2">Day Settings</text>
<text
type="string"
length="1"
@@ -180,7 +192,7 @@ settings are disabled.
height="12"
layout="topleft"
left_delta="0"
- top_pad="20"
+ top_pad="10"
width="200">
Apparent Time of Day:
</text>
@@ -200,25 +212,134 @@ settings are disabled.
</layout_panel>
</layout_stack>
</layout_panel>
- <layout_panel
+ <layout_panel
+ auto_resize="false"
+ user_resize="false"
+ height="155"
+ min_height="0"
+ name="pnl_environment_altitudes"
+ visible="true">
+ <panel
+ left="5"
+ top="0"
+ bottom="-1"
+ width="260"
+ follows="left|top|bottom"
+ background_visible="true"
+ border="true"
+ bevel_style="in"
+ name="cnt_panel">
+ <text follows="top|left"
+ font="SansSerif"
+ halign="left"
+ text_color="white"
+ top="2">Sky Altitudes</text>
+ <multi_slider
+ decimal_digits="0"
+ follows="bottom"
+ height="120"
+ width="10"
+ orientation="vertical"
+ increment="10"
+ initial_value="100"
+ max_val="4000"
+ layout="topleft"
+ left="15"
+ top="20"
+ max_sliders="20"
+ name="sld_altitudes"
+ show_text="false">
+ <slider name="sld1" value="200"/>
+ <slider name="sld2" value="400"/>
+ <slider name="sld3" value="600"/>
+ </multi_slider>
+ <icon
+ follows="left|top"
+ height="10"
+ width="10"
+ image_name="Rounded_Square"
+ layout="topleft"
+ name="camera_icon"
+ mouse_opaque="false"
+ visible="true"
+ left_delta="0"
+ top_pad="-3"/>
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ height="12"
+ layout="topleft"
+ left_pad="3"
+ top_delta="0"
+ width="200"
+ name="ground">
+ Ground
+ </text>
+ <text
+ type="string"
+ length="1"
+ follows="left"
+ height="12"
+ layout="topleft"
+ left="25"
+ top="30"
+ width="200"
+ name="alt1">
+ Sky [INDEX]([ALTITUDE]m)
+ </text>
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ height="12"
+ layout="topleft"
+ left="25"
+ top="40"
+ width="200"
+ name="alt2">
+ Sky [INDEX]([ALTITUDE]m)
+ </text>
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ height="12"
+ layout="topleft"
+ left="25"
+ top="50"
+ width="200"
+ name="alt3">
+ Sky [INDEX]([ALTITUDE]m)
+ </text>
+ </panel>
+ </layout_panel>
+ <layout_panel
auto_resize="true"
user_resize="false"
- height="21"
+ height="0"
min_height="0"
+ name="pnl_auto_adjust"
+ visible="true"/>
+ <layout_panel
+ auto_resize="false"
+ user_resize="false"
+ height="59"
+ min_height="59"
name="pnl_environment_buttons">
<check_box
height="20"
label="Parcel Owners May Override Environment"
layout="topleft"
left="10"
- top="10"
+ top="0"
name="chk_allow_override"
width="200" />
<button
follows="top|left"
height="23"
label="Apply"
- top_pad="10"
+ top_pad="5"
name="btn_apply"
width="100" />
<button