From 13c537e9a0f05857f89085b91ac098921c317fb1 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 9 Jan 2019 21:57:12 +0200 Subject: SL-10279 Readjusting altitude slider --- indra/llui/llsliderctrl.cpp | 37 ++ indra/llui/llsliderctrl.h | 4 + indra/newview/llpanelenvironment.cpp | 15 + indra/newview/llpanelenvironment.h | 1 + .../default/xui/en/panel_region_environment.xml | 651 +++++++++++---------- 5 files changed, 403 insertions(+), 305 deletions(-) diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index 0056cb6dc4..c3c3ce04f9 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -283,6 +283,31 @@ void LLSliderCtrl::updateText() } } +void LLSliderCtrl::updateSliderRect() +{ + S32 right = getRect().getWidth(); + S32 top = getRect().getHeight(); + S32 bottom = 0; + S32 left = 0; + static LLUICachedControl sliderctrl_spacing("UISliderctrlSpacing", 0); + if (mEditor) + { + LLRect editor_rect = mEditor->getRect(); + S32 editor_width = editor_rect.getWidth(); + editor_rect.mRight = right; + editor_rect.mLeft = right - editor_width; + mEditor->setRect(editor_rect); + + right -= editor_width + sliderctrl_spacing; + } + if (mLabelBox) + { + left += mLabelBox->getRect().getWidth() + sliderctrl_spacing; + } + + mSlider->setRect(LLRect(left, top,right,bottom)); +} + // static void LLSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata ) { @@ -404,6 +429,18 @@ void LLSliderCtrl::onCommit() LLF32UICtrl::onCommit(); } +void LLSliderCtrl::setRect(const LLRect& rect) +{ + LLF32UICtrl::setRect(rect); + updateSliderRect(); +} + +//virtual +void LLSliderCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) +{ + LLF32UICtrl::reshape(width, height, called_from_parent); + updateSliderRect(); +} void LLSliderCtrl::setPrecision(S32 precision) { diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h index 67cca9ef04..75fcdc4b71 100644 --- a/indra/llui/llsliderctrl.h +++ b/indra/llui/llsliderctrl.h @@ -125,6 +125,9 @@ public: mSlider->setControlName(control_name, context); } + /*virtual*/ void setRect(const LLRect& rect); + /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); + static void onSliderCommit(LLUICtrl* caller, const LLSD& userdata); static void onEditorCommit(LLUICtrl* ctrl, const LLSD& userdata); @@ -133,6 +136,7 @@ public: private: void updateText(); + void updateSliderRect(); void reportInvalidData(); const LLFontGL* mFont; diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index abd1913185..6e6879ca0c 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -73,6 +73,7 @@ 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::ICN_GROUND("icon_ground"); +const std::string LLPanelEnvironmentInfo::ICN_WATER("icon_water"); const std::string LLPanelEnvironmentInfo::CHK_ALLOWOVERRIDE("chk_allow_override"); const std::string LLPanelEnvironmentInfo::LBL_TIMEOFDAY("lbl_apparent_time"); const std::string LLPanelEnvironmentInfo::PNL_SETTINGS("pnl_environment_config"); @@ -107,6 +108,9 @@ const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( const U32 ALTITUDE_SLIDER_COUNT = 3; const F32 ALTITUDE_DEFAULT_HEIGHT_STEP = 1000; +const U32 ALTITUDE_MARKERS_COUNT = 3; + +const std::string slider_marker_base = "mark"; const std::string alt_sliders[] = { "sld1", @@ -441,10 +445,21 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) getChild(SLD_DAYOFFSET)->setEnabled(can_enable && !is_legacy); getChild(SLD_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); getChild(ICN_GROUND)->setColor((can_enable && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f); + getChild(ICN_WATER)->setColor((can_enable && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f); getChild(BTN_RST_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); getChild(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy); getChild(CHK_ALLOWOVERRIDE)->setEnabled(can_enable && isRegion() && !is_legacy); + for (U32 idx = 0; idx < ALTITUDE_MARKERS_COUNT; idx++) + { + LLUICtrl* marker = findChild(slider_marker_base + llformat("%u", idx)); + if (marker) + { + static LLColor4 marker_color(0.75f, 0.75f, 0.75f, 1.f); + marker->setColor((can_enable && isRegion() && !is_legacy) ? marker_color : marker_color % 0.3f); + } + } + getChild(SDT_DROP_TARGET)->setDndEnabled(enabled && !is_legacy); return true; diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index 18ab64dc12..b5debe69c2 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -71,6 +71,7 @@ protected: static const std::string SLD_DAYOFFSET; static const std::string SLD_ALTITUDES; static const std::string ICN_GROUND; + static const std::string ICN_WATER; static const std::string CHK_ALLOWOVERRIDE; static const std::string BTN_APPLY; static const std::string BTN_CANCEL; 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 a39973fe3a..ed344f2a14 100644 --- a/indra/newview/skins/default/xui/en/panel_region_environment.xml +++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml @@ -2,7 +2,7 @@ - Sky Altitudes - - - - - - - - - Ground - - - Unknown - - - - - - - Water - - - Unknown - - - -