From cf460b13bee894684d0ca1bcb5bbc9eb38df719c Mon Sep 17 00:00:00 2001 From: "Graham Linden graham@lindenlab.com" Date: Mon, 12 Mar 2018 16:24:16 +0100 Subject: De-duplicate sRGB conversion funcs from many shaders and unify on using the version that works on OSX. Add more logging to shader loading about fallbacks and loading succcess. Add frag shaders for sharing sRGB and normal encode/decode via GL shader linkage. --- indra/llui/llui.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llui.h b/indra/llui/llui.h index d7151dbee9..111f6472cd 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -33,7 +33,6 @@ #include "llcontrol.h" #include "llcoord.h" #include "llcontrol.h" -#include "llglslshader.h" #include "llinitparam.h" #include "llregistry.h" #include "llrender2dutils.h" @@ -49,7 +48,6 @@ // for initparam specialization #include "llfontgl.h" - class LLUUID; class LLWindow; class LLView; -- cgit v1.2.3 From 7a0a580eddf4fb7608d1bd84b7eccd2653075184 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 17 May 2018 15:50:27 +0300 Subject: MAINT-8344 Prevent multislider from locking in infinit cycle --- indra/llui/llmultislider.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 0aa3e17075..aab77c2bd8 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -334,10 +334,15 @@ void LLMultiSlider::deleteSlider(const std::string& name) void LLMultiSlider::clear() { - while(mThumbRects.size() > 0) { + while(mThumbRects.size() > 0 && mValue.size() > 0) { deleteCurSlider(); } + if (mThumbRects.size() > 0 || mValue.size() > 0) + { + LL_WARNS() << "Failed to fully clear Multi slider" << LL_ENDL; + } + LLF32UICtrl::clear(); } -- cgit v1.2.3 From e4973e0f92b524e7f9c2d10745f4c5e3a8557284 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 18 May 2018 21:09:42 +0300 Subject: MAINT-8344 Day Cycle Editor (part 3) --- indra/llui/llmultislider.cpp | 42 ++++++++++++++++++++++++++-------------- indra/llui/llmultislider.h | 1 + indra/llui/llmultisliderctrl.cpp | 5 +++++ indra/llui/llmultisliderctrl.h | 1 + 4 files changed, 34 insertions(+), 15 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index aab77c2bd8..93045a6578 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -196,7 +196,11 @@ void LLMultiSlider::setValue(const LLSD& value) F32 LLMultiSlider::getSliderValue(const std::string& name) const { - return (F32)mValue[name].asReal(); + if (mValue.has(name)) + { + return (F32)mValue[name].asReal(); + } + return 0; } void LLMultiSlider::setCurSlider(const std::string& name) @@ -206,6 +210,11 @@ void LLMultiSlider::setCurSlider(const std::string& name) } } +void LLMultiSlider::resetCurSlider() +{ + mCurSlider = LLStringUtil::null; +} + const std::string& LLMultiSlider::addSlider() { return addSlider(mInitialValue); @@ -421,20 +430,23 @@ BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask) } } - // Find the offset of the actual mouse location from the center of the thumb. - if (mThumbRects[mCurSlider].pointInRect(x,y)) + if (!mCurSlider.empty()) { - mMouseOffset = (mThumbRects[mCurSlider].mLeft + mThumbWidth/2) - x; - } - else - { - mMouseOffset = 0; - } + // Find the offset of the actual mouse location from the center of the thumb. + if (mThumbRects[mCurSlider].pointInRect(x,y)) + { + mMouseOffset = (mThumbRects[mCurSlider].mLeft + mThumbWidth/2) - x; + } + else + { + mMouseOffset = 0; + } - // Start dragging the thumb - // No handler needed for focus lost since this class has no state that depends on it. - gFocusMgr.setMouseCapture( this ); - mDragStartThumbRect = mThumbRects[mCurSlider]; + // Start dragging the thumb + // No handler needed for focus lost since this class has no state that depends on it. + gFocusMgr.setMouseCapture( this ); + mDragStartThumbRect = mThumbRects[mCurSlider]; + } } make_ui_sound("UISndClick"); @@ -551,7 +563,7 @@ void LLMultiSlider::draw() thumb_imagep->drawSolid(mDragStartThumbRect, mThumbCenterColor.get() % 0.3f); // draw the highlight - if (hasFocus()) + if (hasFocus() && !mCurSlider.empty()) { thumb_imagep->drawBorder(mThumbRects[mCurSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth()); } @@ -583,7 +595,7 @@ void LLMultiSlider::draw() else { // draw highlight - if (hasFocus()) + if (hasFocus() && !mCurSlider.empty()) { thumb_imagep->drawBorder(mThumbRects[mCurSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth()); } diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 2b422e89c9..927063a5fd 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -76,6 +76,7 @@ public: const std::string& getCurSlider() const { return mCurSlider; } F32 getCurSliderValue() const { return getSliderValue(mCurSlider); } void setCurSlider(const std::string& name); + void resetCurSlider(); void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mCurSlider, val, from_event); } /*virtual*/ void setValue(const LLSD& value); diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index c460a08afc..a982d431b3 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -213,6 +213,11 @@ void LLMultiSliderCtrl::setCurSlider(const std::string& name) mCurValue = mMultiSlider->getCurSliderValue(); } +void LLMultiSliderCtrl::resetCurSlider() +{ + mMultiSlider->resetCurSlider(); +} + BOOL LLMultiSliderCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text ) { BOOL res = FALSE; diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index b6a3542376..84378ff7b2 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -84,6 +84,7 @@ public: const std::string& getCurSlider() const { return mMultiSlider->getCurSlider(); } F32 getCurSliderValue() const { return mCurValue; } void setCurSlider(const std::string& name); + void resetCurSlider(); void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mMultiSlider->getCurSlider(), val, from_event); } virtual void setMinValue(const LLSD& min_value) { setMinValue((F32)min_value.asReal()); } -- cgit v1.2.3 From 2ddad24c4d5e64711cdbffd98e290d3da8e9714a Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 30 May 2018 17:08:28 -0700 Subject: Timeline behavior in day cycle edit. --- indra/llui/llmultislider.cpp | 30 ++++++++++++++++++++++-------- indra/llui/llmultislider.h | 1 + indra/llui/llmultisliderctrl.h | 4 +++- 3 files changed, 26 insertions(+), 9 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 93045a6578..5cfe79267f 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -210,6 +210,19 @@ void LLMultiSlider::setCurSlider(const std::string& name) } } +F32 LLMultiSlider::getSliderValueFromX(S32 xpos) const +{ + S32 left_edge = mThumbWidth / 2; + S32 right_edge = getRect().getWidth() - (mThumbWidth / 2); + + xpos += mMouseOffset; + xpos = llclamp(xpos, left_edge, right_edge); + + F32 t = F32(xpos - left_edge) / (right_edge - left_edge); + + return((t * (mMaxValue - mMinValue)) + mMinValue); +} + void LLMultiSlider::resetCurSlider() { mCurSlider = LLStringUtil::null; @@ -359,14 +372,15 @@ BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask) { if( gFocusMgr.getMouseCapture() == this ) { - S32 left_edge = mThumbWidth/2; - S32 right_edge = getRect().getWidth() - (mThumbWidth/2); - - x += mMouseOffset; - x = llclamp( x, left_edge, right_edge ); - - F32 t = F32(x - left_edge) / (right_edge - left_edge); - setCurSliderValue(t * (mMaxValue - mMinValue) + mMinValue ); +// S32 left_edge = mThumbWidth/2; +// S32 right_edge = getRect().getWidth() - (mThumbWidth/2); +// +// x += mMouseOffset; +// x = llclamp( x, left_edge, right_edge ); +// +// F32 t = F32(x - left_edge) / (right_edge - left_edge); +// setCurSliderValue(t * (mMaxValue - mMinValue) + mMinValue ); + setCurSliderValue(getSliderValueFromX(x)); onCommit(); getWindow()->setCursor(UI_CURSOR_ARROW); diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 927063a5fd..0177597da2 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -72,6 +72,7 @@ public: virtual ~LLMultiSlider(); void setSliderValue(const std::string& name, F32 value, BOOL from_event = FALSE); F32 getSliderValue(const std::string& name) const; + F32 getSliderValueFromX(S32 xpos) const; const std::string& getCurSlider() const { return mCurSlider; } F32 getCurSliderValue() const { return getSliderValue(mCurSlider); } diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index 84378ff7b2..5c4777ebd0 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -74,7 +74,7 @@ protected: public: virtual ~LLMultiSliderCtrl(); - F32 getSliderValue(const std::string& name) const; + F32 getSliderValue(const std::string& name) const { return mMultiSlider->getSliderValue(name); } void setSliderValue(const std::string& name, F32 v, BOOL from_event = FALSE); virtual void setValue(const LLSD& value ); @@ -99,6 +99,8 @@ public: void setMaxValue(F32 max_value) {mMultiSlider->setMaxValue(max_value);} void setIncrement(F32 increment) {mMultiSlider->setIncrement(increment);} + F32 getSliderValueFromX(S32 x) const { return mMultiSlider->getSliderValueFromX(x); } + /// for adding and deleting sliders const std::string& addSlider(); const std::string& addSlider(F32 val); -- cgit v1.2.3 From 442bbfed348b0c60f4d8a8da87aa15d3185bde7c Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 20 Jun 2018 12:37:17 -0700 Subject: Adding settings DAD type --- indra/llui/llui.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llui.h b/indra/llui/llui.h index 111f6472cd..59fc1ddcef 100644 --- a/indra/llui/llui.h +++ b/indra/llui/llui.h @@ -75,7 +75,8 @@ enum EDragAndDropType DAD_MESH = 15, DAD_WIDGET = 16, DAD_PERSON = 17, - DAD_COUNT = 18, // number of types in this enum + DAD_SETTINGS = 18, + DAD_COUNT = 19, // number of types in this enum }; // Reasons for drags to be denied. -- cgit v1.2.3 From 8b3957b310afa23e543c3eb33aca9131dba52b31 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Thu, 7 Jun 2018 20:22:20 +0300 Subject: MAINT-8331 EEP UI control: XYVector --- indra/llui/CMakeLists.txt | 2 + indra/llui/llxyvector.cpp | 306 ++++++++++++++++++++++++++++++++++++++++++++++ indra/llui/llxyvector.h | 118 ++++++++++++++++++ 3 files changed, 426 insertions(+) create mode 100644 indra/llui/llxyvector.cpp create mode 100644 indra/llui/llxyvector.h (limited to 'indra/llui') diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 8054eb3619..04cd8b3f21 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -135,6 +135,7 @@ set(llui_SOURCE_FILES llviewereventrecorder.cpp llwindowshade.cpp llxuiparser.cpp + llxyvector.cpp ) set(llui_HEADER_FILES @@ -251,6 +252,7 @@ set(llui_HEADER_FILES llviewquery.h llwindowshade.h llxuiparser.h + llxyvector.h ) set_source_files_properties(${llui_HEADER_FILES} diff --git a/indra/llui/llxyvector.cpp b/indra/llui/llxyvector.cpp new file mode 100644 index 0000000000..48f38b8a92 --- /dev/null +++ b/indra/llui/llxyvector.cpp @@ -0,0 +1,306 @@ +/** +* @file llxyvector.cpp +* @author Andrey Lihatskiy +* @brief Implementation for LLXYVector +* +* $LicenseInfo:firstyear=2001&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2018, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +// A control that allows to set two related vector magnitudes by manipulating a single vector on a plane. + +#include "linden_common.h" + +#include "llxyvector.h" + +#include "llstring.h" +#include "llrect.h" + +#include "lluictrlfactory.h" +#include "llrender.h" + +// Globals +static LLDefaultChildRegistry::Register register_xy_vector("xy_vector"); + + +const F32 CENTER_CIRCLE_RADIUS = 2; +const S32 ARROW_ANGLE = 30; +const S32 ARROW_LENGTH_LONG = 10; +const S32 ARROW_LENGTH_SHORT = 6; + +LLXYVector::Params::Params() + : x_entry("x_entry"), + y_entry("y_entry"), + touch_area("touch_area"), + border("border"), + edit_bar_height("edit_bar_height", 18), + padding("padding", 4), + min_val_x("min_val_x", -1.0f), + max_val_x("max_val_x", 1.0f), + increment_x("increment_x", 0.05f), + min_val_y("min_val_y", -1.0f), + max_val_y("max_val_y", 1.0f), + increment_y("increment_y", 0.05f), + label_width("label_width", 16), + arrow_color("arrow_color", LLColor4::white), + ghost_color("ghost_color"), + area_color("area_color", LLColor4::grey4), + grid_color("grid_color", LLColor4::grey % 0.25f) +{ +} + +LLXYVector::LLXYVector(const LLXYVector::Params& p) + : LLUICtrl(p), + mArrowColor(p.arrow_color()), + mAreaColor(p.area_color), + mGridColor(p.grid_color), + mMinValueX(p.min_val_x), + mMaxValueX(p.max_val_x), + mIncrementX(p.increment_x), + mMinValueY(p.min_val_y), + mMaxValueY(p.max_val_y), + mIncrementY(p.increment_y) +{ + mGhostColor = p.ghost_color.isProvided() ? p.ghost_color() % 0.3f : p.arrow_color() % 0.3f; + + LLRect border_rect = getLocalRect(); + LLViewBorder::Params params = p.border; + params.rect(border_rect); + mBorder = LLUICtrlFactory::create(params); + addChild(mBorder); + + LLTextBox::Params x_label_params; + x_label_params.initial_value(p.x_entry.label()); + x_label_params.rect = LLRect(p.padding, + border_rect.mTop - p.padding, + p.label_width, + border_rect.getHeight() - p.edit_bar_height); + mXLabel = LLUICtrlFactory::create(x_label_params); + addChild(mXLabel); + LLLineEditor::Params x_params = p.x_entry; + x_params.rect = LLRect(p.padding + p.label_width, + border_rect.mTop - p.padding, + border_rect.getCenterX(), + border_rect.getHeight() - p.edit_bar_height); + x_params.commit_callback.function(boost::bind(&LLXYVector::onEditChange, this)); + mXEntry = LLUICtrlFactory::create(x_params); + mXEntry->setPrevalidateInput(LLTextValidate::validateFloat); + addChild(mXEntry); + + LLTextBox::Params y_label_params; + y_label_params.initial_value(p.y_entry.label()); + y_label_params.rect = LLRect(border_rect.getCenterX() + p.padding, + border_rect.mTop - p.padding, + border_rect.getCenterX() + p.label_width, + border_rect.getHeight() - p.edit_bar_height); + mYLabel = LLUICtrlFactory::create(y_label_params); + addChild(mYLabel); + LLLineEditor::Params y_params = p.y_entry; + y_params.rect = LLRect(border_rect.getCenterX() + p.padding + p.label_width, + border_rect.getHeight() - p.padding, + border_rect.getWidth() - p.padding, + border_rect.getHeight() - p.edit_bar_height); + y_params.commit_callback.function(boost::bind(&LLXYVector::onEditChange, this)); + mYEntry = LLUICtrlFactory::create(y_params); + mYEntry->setPrevalidateInput(LLTextValidate::validateFloat); + addChild(mYEntry); + + LLPanel::Params touch_area = p.touch_area; + touch_area.rect = LLRect(p.padding, + border_rect.mTop - p.edit_bar_height - p.padding, + border_rect.getWidth() - p.padding, + p.padding); + mTouchArea = LLUICtrlFactory::create(touch_area); + addChild(mTouchArea); +} + +LLXYVector::~LLXYVector() +{ +} + +BOOL LLXYVector::postBuild() +{ + return TRUE; +} + +void drawArrow(S32 tailX, S32 tailY, S32 tipX, S32 tipY, LLColor4 color) +{ + gl_line_2d(tailX, tailY, tipX, tipY, color); + + S32 dx = tipX - tailX; + S32 dy = tipY - tailY; + + S32 arrowLength = (abs(dx) < ARROW_LENGTH_LONG && abs(dy) < ARROW_LENGTH_LONG) ? ARROW_LENGTH_SHORT : ARROW_LENGTH_LONG; + + F32 theta = std::atan2(dy, dx); + + F32 rad = ARROW_ANGLE * std::atan(1) * 4 / 180; + F32 x = tipX - arrowLength * cos(theta + rad); + F32 y = tipY - arrowLength * sin(theta + rad); + F32 rad2 = -1 * ARROW_ANGLE * std::atan(1) * 4 / 180; + F32 x2 = tipX - arrowLength * cos(theta + rad2); + F32 y2 = tipY - arrowLength * sin(theta + rad2); + gl_triangle_2d(tipX, tipY, x, y, x2, y2, color, true); +} + +void LLXYVector::draw() +{ + S32 centerX = mTouchArea->getRect().getCenterX(); + S32 centerY = mTouchArea->getRect().getCenterY(); + + S32 pointX = centerX + (mValueX * mTouchArea->getRect().getWidth() / (2 * mMaxValueX)); + S32 pointY = centerY + (mValueY * mTouchArea->getRect().getHeight() / (2 * mMaxValueY)); + + // fill + gl_rect_2d(mTouchArea->getRect(), mAreaColor, true); + + // draw grid + gl_line_2d(centerX, mTouchArea->getRect().mTop, centerX, mTouchArea->getRect().mBottom, mGridColor); + gl_line_2d(mTouchArea->getRect().mLeft, centerY, mTouchArea->getRect().mRight, centerY, mGridColor); + + // draw ghost + if (hasMouseCapture()) + { + drawArrow(centerX, centerY, mGhostX, mGhostY, mGhostColor); + } + else + { + mGhostX = pointX; + mGhostY = pointY; + } + + if (abs(mValueX) >= mIncrementX || abs(mValueY) >= mIncrementY) + { + // draw the vector arrow + drawArrow(centerX, centerY, pointX, pointY, mArrowColor); + } + else + { + // skip the arrow, set color for center circle + gGL.color4fv(mArrowColor.get().mV); + } + + // draw center circle + gl_circle_2d(centerX, centerY, CENTER_CIRCLE_RADIUS, 12, true); + + LLView::draw(); +} + +void LLXYVector::onEditChange() +{ + if (getEnabled()) + { + setValueAndCommit(mXEntry->getValue().asReal(), mYEntry->getValue().asReal()); + } +} + +void LLXYVector::setValue(const LLSD& value) +{ + if (value.isArray()) + { + setValue(value[0].asReal(), value[1].asReal()); + } +} + +void LLXYVector::setValue(F32 x, F32 y) +{ + x = llclamp(x, mMinValueX, mMaxValueX); + y = llclamp(y, mMinValueY, mMaxValueY); + + // Round the values to nearest increments + x -= mMinValueX; + x += mIncrementX / 2.0001f; + x -= fmod(x, mIncrementX); + x += mMinValueX; + + y -= mMinValueY; + y += mIncrementY / 2.0001f; + y -= fmod(y, mIncrementY); + y += mMinValueY; + + mValueX = x; + mValueY = y; + + update(); +} + +void LLXYVector::setValueAndCommit(F32 x, F32 y) +{ + if (mValueX != x || mValueY != y) + { + setValue(x, y); + onCommit(); + } +} + +LLSD LLXYVector::getValue() const +{ + LLSD value; + value.append(mValueX); + value.append(mValueY); + return value; +} + +void LLXYVector::update() +{ + mXEntry->setValue(mValueX); + mYEntry->setValue(mValueY); +} + +BOOL LLXYVector::handleHover(S32 x, S32 y, MASK mask) +{ + if (hasMouseCapture()) + { + F32 valueX = F32(x - mTouchArea->getRect().getCenterX()) / mTouchArea->getRect().getWidth(); + F32 valueY = F32(y - mTouchArea->getRect().getCenterY()) / mTouchArea->getRect().getHeight(); + + valueX *= 2 * mMaxValueX; + valueY *= 2 * mMaxValueY; + + setValueAndCommit(valueX, valueY); + } + + return TRUE; +} + +BOOL LLXYVector::handleMouseUp(S32 x, S32 y, MASK mask) +{ + if (hasMouseCapture()) + { + gFocusMgr.setMouseCapture(NULL); + make_ui_sound("UISndClickRelease"); + } + + return TRUE; +} + +BOOL LLXYVector::handleMouseDown(S32 x, S32 y, MASK mask) +{ + + if (mTouchArea->getRect().pointInRect(x, y)) + { + gFocusMgr.setMouseCapture(this); + make_ui_sound("UISndClick"); + } + + return TRUE; +} + diff --git a/indra/llui/llxyvector.h b/indra/llui/llxyvector.h new file mode 100644 index 0000000000..4d67db3251 --- /dev/null +++ b/indra/llui/llxyvector.h @@ -0,0 +1,118 @@ +/** +* @file llxyvector.h +* @author Andrey Lihatskiy +* @brief Header file for LLXYVector +* +* $LicenseInfo:firstyear=2001&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2018, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +// A control that allows to set two related vector magnitudes by manipulating a single vector on a plane. + +#ifndef LL_LLXYVECTOR_H +#define LL_LLXYVECTOR_H + +#include "lluictrl.h" +#include "llpanel.h" +#include "lltextbox.h" +#include "lllineeditor.h" + +class LLXYVector + : public LLUICtrl +{ +public: + struct Params + : public LLInitParam::Block + { + Optional x_entry; + Optional y_entry; + Optional touch_area; + Optional border; + Optional edit_bar_height; + Optional padding; + Optional label_width; + Optional min_val_x; + Optional max_val_x; + Optional increment_x; + Optional min_val_y; + Optional max_val_y; + Optional increment_y; + Optional arrow_color; + Optional ghost_color; + Optional area_color; + Optional grid_color; + + Params(); + }; + + + virtual ~LLXYVector(); + /*virtual*/ BOOL postBuild(); + + virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + + virtual void draw(); + + virtual void setValue(const LLSD& value); + void setValue(F32 x, F32 y); + virtual LLSD getValue() const; + +protected: + friend class LLUICtrlFactory; + LLXYVector(const Params&); + void onEditChange(); + +protected: + LLTextBox* mXLabel; + LLTextBox* mYLabel; + LLLineEditor* mXEntry; + LLLineEditor* mYEntry; + LLPanel* mTouchArea; + LLViewBorder* mBorder; + +private: + void update(); + void setValueAndCommit(F32 x, F32 y); + + F32 mValueX; + F32 mValueY; + + F32 mMinValueX; + F32 mMaxValueX; + F32 mIncrementX; + F32 mMinValueY; + F32 mMaxValueY; + F32 mIncrementY; + + U32 mGhostX; + U32 mGhostY; + + LLUIColor mArrowColor; + LLUIColor mGhostColor; + LLUIColor mAreaColor; + LLUIColor mGridColor; + +}; + +#endif + -- cgit v1.2.3 From e61d7ac0098d89cc6b124dda2e040120c01d2bee Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 10 Jul 2018 17:09:47 +0300 Subject: MAINT-8833 EEP UI should be either responsive or indicate that it is disabled. --- indra/llui/llslider.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp index ebbb951ee6..6925c0a130 100644 --- a/indra/llui/llslider.cpp +++ b/indra/llui/llslider.cpp @@ -331,8 +331,9 @@ void LLSlider::draw() highlight_rect.set(track_rect.mLeft, track_rect.mTop, track_rect.mRight, track_rect.mBottom); } - trackImage->draw(track_rect, LLColor4::white % alpha); - trackHighlightImage->draw(highlight_rect, LLColor4::white % alpha); + LLColor4 color = isInEnabledChain() ? LLColor4::white % alpha : LLColor4::white % (0.6f * alpha); + trackImage->draw(track_rect, color); + trackHighlightImage->draw(highlight_rect, color); // Thumb if (hasFocus()) -- cgit v1.2.3 From 1abea33b7012b6b00502620dab92cc39eacb1d50 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Wed, 18 Jul 2018 14:13:29 +0300 Subject: MAINT-8334 EEP UI control: Virtual Trackball --- indra/llui/CMakeLists.txt | 2 + indra/llui/llvirtualtrackball.cpp | 411 ++++++++++++++++++++++++++++++++++++++ indra/llui/llvirtualtrackball.h | 149 ++++++++++++++ 3 files changed, 562 insertions(+) create mode 100644 indra/llui/llvirtualtrackball.cpp create mode 100644 indra/llui/llvirtualtrackball.h (limited to 'indra/llui') diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 04cd8b3f21..54e4d296ab 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -133,6 +133,7 @@ set(llui_SOURCE_FILES llview.cpp llviewquery.cpp llviewereventrecorder.cpp + llvirtualtrackball.cpp llwindowshade.cpp llxuiparser.cpp llxyvector.cpp @@ -250,6 +251,7 @@ set(llui_HEADER_FILES llview.h llviewereventrecorder.h llviewquery.h + llvirtualtrackball.h llwindowshade.h llxuiparser.h llxyvector.h diff --git a/indra/llui/llvirtualtrackball.cpp b/indra/llui/llvirtualtrackball.cpp new file mode 100644 index 0000000000..0ddbe8b9c2 --- /dev/null +++ b/indra/llui/llvirtualtrackball.cpp @@ -0,0 +1,411 @@ +/** +* @file LLVirtualTrackball.cpp +* @author Andrey Lihatskiy +* @brief Implementation for LLVirtualTrackball +* +* $LicenseInfo:firstyear=2001&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2018, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +// A control for positioning the sun and the moon in the celestial sphere. + +#include "linden_common.h" +#include "llvirtualtrackball.h" +#include "llstring.h" +#include "llrect.h" +#include "lluictrlfactory.h" +#include "llrender.h" + +// Globals +static LLDefaultChildRegistry::Register register_virtual_trackball("sun_moon_trackball"); + +const LLVector3 VectorZero(1.0f, 0.0f, 0.0f); + +LLVirtualTrackball::Params::Params() + : border("border"), + image_moon_back("image_moon_back"), + image_moon_front("image_moon_front"), + image_sphere("image_sphere"), + image_sun_back("image_sun_back"), + image_sun_front("image_sun_front"), + btn_rotate_top("button_rotate_top"), + btn_rotate_bottom("button_rotate_bottom"), + btn_rotate_left("button_rotate_left"), + btn_rotate_right("button_rotate_right"), + thumb_mode("thumb_mode"), + lbl_N("labelN"), + lbl_S("labelS"), + lbl_W("labelW"), + lbl_E("labelE"), + increment_angle_mouse("increment_angle_mouse", 0.5f), + increment_angle_btn("increment_angle_btn", 3.0f) +{ +} + +LLVirtualTrackball::LLVirtualTrackball(const LLVirtualTrackball::Params& p) + : LLUICtrl(p), + mImgMoonBack(p.image_moon_back), + mImgMoonFront(p.image_moon_front), + mImgSunBack(p.image_sun_back), + mImgSunFront(p.image_sun_front), + mImgSphere(p.image_sphere), + mThumbMode(p.thumb_mode() == "moon" ? ThumbMode::MOON : ThumbMode::SUN), + mIncrementMouse(DEG_TO_RAD * p.increment_angle_mouse()), + mIncrementBtn(DEG_TO_RAD * p.increment_angle_btn()) +{ + LLRect border_rect = getLocalRect(); + S32 centerX = border_rect.getCenterX(); + S32 centerY = border_rect.getCenterY(); + U32 btn_size = 32; // width & height + U32 axis_offset_lt = 16; // offset from the axis for left/top sides + U32 axis_offset_rb = btn_size - axis_offset_lt; // and for right/bottom + + LLViewBorder::Params border = p.border; + border.rect(border_rect); + mBorder = LLUICtrlFactory::create(border); + addChild(mBorder); + + + LLButton::Params btn_rt = p.btn_rotate_top; + btn_rt.rect(LLRect(centerX - axis_offset_lt, border_rect.mTop, centerX + axis_offset_rb, border_rect.mTop - btn_size)); + btn_rt.click_callback.function(boost::bind(&LLVirtualTrackball::onRotateTopClick, this)); + btn_rt.mouse_held_callback.function(boost::bind(&LLVirtualTrackball::onRotateTopClick, this)); + mBtnRotateTop = LLUICtrlFactory::create(btn_rt); + addChild(mBtnRotateTop); + + LLTextBox::Params lbl_N = p.lbl_N; + LLRect rect_N = btn_rt.rect; + //rect_N.translate(btn_rt.rect().getWidth(), 0); + lbl_N.rect = rect_N; + lbl_N.initial_value(lbl_N.label()); + mLabelN = LLUICtrlFactory::create(lbl_N); + addChild(mLabelN); + + + LLButton::Params btn_rr = p.btn_rotate_right; + btn_rr.rect(LLRect(border_rect.mRight - btn_size, centerY + axis_offset_lt, border_rect.mRight, centerY - axis_offset_rb)); + btn_rr.click_callback.function(boost::bind(&LLVirtualTrackball::onRotateRightClick, this)); + btn_rr.mouse_held_callback.function(boost::bind(&LLVirtualTrackball::onRotateRightClick, this)); + mBtnRotateRight = LLUICtrlFactory::create(btn_rr); + addChild(mBtnRotateRight); + + LLTextBox::Params lbl_E = p.lbl_E; + LLRect rect_E = btn_rr.rect; + //rect_E.translate(0, -1 * btn_rr.rect().getHeight()); + lbl_E.rect = rect_E; + lbl_E.initial_value(lbl_E.label()); + mLabelE = LLUICtrlFactory::create(lbl_E); + addChild(mLabelE); + + + LLButton::Params btn_rb = p.btn_rotate_bottom; + btn_rb.rect(LLRect(centerX - axis_offset_lt, border_rect.mBottom + btn_size, centerX + axis_offset_rb, border_rect.mBottom)); + btn_rb.click_callback.function(boost::bind(&LLVirtualTrackball::onRotateBottomClick, this)); + btn_rb.mouse_held_callback.function(boost::bind(&LLVirtualTrackball::onRotateBottomClick, this)); + mBtnRotateBottom = LLUICtrlFactory::create(btn_rb); + addChild(mBtnRotateBottom); + + LLTextBox::Params lbl_S = p.lbl_S; + LLRect rect_S = btn_rb.rect; + //rect_S.translate(btn_rb.rect().getWidth(), 0); + lbl_S.rect = rect_S; + lbl_S.initial_value(lbl_S.label()); + mLabelS = LLUICtrlFactory::create(lbl_S); + addChild(mLabelS); + + + LLButton::Params btn_rl = p.btn_rotate_left; + btn_rl.rect(LLRect(border_rect.mLeft, centerY + axis_offset_lt, border_rect.mLeft + btn_size, centerY - axis_offset_rb)); + btn_rl.click_callback.function(boost::bind(&LLVirtualTrackball::onRotateLeftClick, this)); + btn_rl.mouse_held_callback.function(boost::bind(&LLVirtualTrackball::onRotateLeftClick, this)); + mBtnRotateLeft = LLUICtrlFactory::create(btn_rl); + addChild(mBtnRotateLeft); + + LLTextBox::Params lbl_W = p.lbl_W; + LLRect rect_W = btn_rl.rect; + //rect_W.translate(0, -1* btn_rl.rect().getHeight()); + lbl_W.rect = rect_W; + lbl_W.initial_value(lbl_W.label()); + mLabelW = LLUICtrlFactory::create(lbl_W); + addChild(mLabelW); + + + LLPanel::Params touch_area; + touch_area.rect = LLRect(centerX - mImgSphere->getWidth() / 2, + centerY + mImgSphere->getHeight() / 2, + centerX + mImgSphere->getWidth() / 2, + centerY - mImgSphere->getHeight() / 2); + mTouchArea = LLUICtrlFactory::create(touch_area); + addChild(mTouchArea); +} + +LLVirtualTrackball::~LLVirtualTrackball() +{ +} + +BOOL LLVirtualTrackball::postBuild() +{ + return TRUE; +} + + +void LLVirtualTrackball::drawThumb(S32 x, S32 y, ThumbMode mode, bool upperHemi) +{ + LLUIImage* thumb; + if (mode == ThumbMode::SUN) + { + if (upperHemi) + { + thumb = mImgSunFront; + } + else + { + thumb = mImgSunBack; + } + } + else + { + if (upperHemi) + { + thumb = mImgMoonFront; + } + else + { + thumb = mImgMoonBack; + } + } + thumb->draw(LLRect(x - thumb->getWidth() / 2, + y + thumb->getHeight() / 2, + x + thumb->getWidth() / 2, + y - thumb->getHeight() / 2)); +} + +bool LLVirtualTrackball::pointInTouchCircle(S32 x, S32 y) const +{ + S32 centerX = mTouchArea->getRect().getCenterX(); + S32 centerY = mTouchArea->getRect().getCenterY(); + + bool in_circle = pow(x - centerX, 2) + pow(y - centerY, 2) <= pow(mTouchArea->getRect().getWidth() / 2, 2); + return in_circle; +} + +void LLVirtualTrackball::draw() +{ + LLVector3 draw_point = VectorZero * mValue; + + S32 halfwidth = mTouchArea->getRect().getWidth() / 2; + S32 halfheight = mTouchArea->getRect().getHeight() / 2; + draw_point.mV[VX] = (draw_point.mV[VX] + 1.0) * halfwidth + mTouchArea->getRect().mLeft; + draw_point.mV[VY] = (draw_point.mV[VY] + 1.0) * halfheight + mTouchArea->getRect().mBottom; + bool upper_hemisphere = (draw_point.mV[VZ] >= 0.f); + + mImgSphere->draw(mTouchArea->getRect(), upper_hemisphere ? UI_VERTEX_COLOR : UI_VERTEX_COLOR % 0.5f); + drawThumb(draw_point.mV[VX], draw_point.mV[VY], mThumbMode, upper_hemisphere); + + + if (LLView::sDebugRects) + { + gGL.color4fv(LLColor4::red.mV); + gl_circle_2d(mTouchArea->getRect().getCenterX(), mTouchArea->getRect().getCenterY(), mImgSphere->getWidth() / 2, 60, false); + gl_circle_2d(draw_point.mV[VX], draw_point.mV[VY], mImgSunFront->getWidth() / 2, 12, false); + } + + LLView::draw(); +} + +void LLVirtualTrackball::onRotateTopClick() +{ + if (getEnabled()) + { + LLQuaternion delta; + delta.setAngleAxis(mIncrementBtn, 1, 0, 0); + mValue *= delta; + setValueAndCommit(mValue); + + make_ui_sound("UISndClick"); + } +} + +void LLVirtualTrackball::onRotateBottomClick() +{ + if (getEnabled()) + { + LLQuaternion delta; + delta.setAngleAxis(mIncrementBtn, -1, 0, 0); + mValue *= delta; + setValueAndCommit(mValue); + + make_ui_sound("UISndClick"); + } +} + +void LLVirtualTrackball::onRotateLeftClick() +{ + if (getEnabled()) + { + LLQuaternion delta; + delta.setAngleAxis(mIncrementBtn, 0, 1, 0); + mValue *= delta; + setValueAndCommit(mValue); + + make_ui_sound("UISndClick"); + } +} + +void LLVirtualTrackball::onRotateRightClick() +{ + if (getEnabled()) + { + LLQuaternion delta; + delta.setAngleAxis(mIncrementBtn, 0, -1, 0); + mValue *= delta; + setValueAndCommit(mValue); + + make_ui_sound("UISndClick"); + } +} + +void LLVirtualTrackball::setValue(const LLSD& value) +{ + if (value.isArray() && value.size() == 4) + { + mValue.setValue(value); + } +} + +void LLVirtualTrackball::setRotation(const LLQuaternion &value) +{ + mValue = value; +} + +void LLVirtualTrackball::setValue(F32 x, F32 y, F32 z, F32 w) +{ + mValue.set(x, y, z, w); +} + +void LLVirtualTrackball::setValueAndCommit(const LLQuaternion &value) +{ + mValue = value; + onCommit(); +} + +LLSD LLVirtualTrackball::getValue() const +{ + return mValue.getValue(); +} + +LLQuaternion LLVirtualTrackball::getRotation() const +{ + return mValue; +} + +BOOL LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask) +{ + if (hasMouseCapture()) + { + LLQuaternion delta; + + F32 rotX = x - mPrevX; + F32 rotY = y - mPrevY; + + if (abs(rotX) > 1) + { + F32 direction = (rotX < 0) ? -1 : 1; + delta.setAngleAxis(mIncrementMouse * abs(rotX), 0, direction, 0); // changing X - rotate around Y axis + mValue *= delta; + } + + if (abs(rotY) > 1) + { + F32 direction = (rotY < 0) ? 1 : -1; // reverse for Y (value increases from bottom to top) + delta.setAngleAxis(mIncrementMouse * abs(rotY), direction, 0, 0); // changing Y - rotate around X axis + mValue *= delta; + } + + onCommit(); + + mPrevX = x; + mPrevY = y; + } + return TRUE; +} + +BOOL LLVirtualTrackball::handleMouseUp(S32 x, S32 y, MASK mask) +{ + if (hasMouseCapture()) + { + mPrevX = 0; + mPrevY = 0; + gFocusMgr.setMouseCapture(NULL); + make_ui_sound("UISndClickRelease"); + } + return TRUE; +} + +BOOL LLVirtualTrackball::handleMouseDown(S32 x, S32 y, MASK mask) +{ + if (pointInTouchCircle(x, y)) + { + mPrevX = x; + mPrevY = y; + gFocusMgr.setMouseCapture(this); + make_ui_sound("UISndClick"); + } + return TRUE; +} + +BOOL LLVirtualTrackball::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + if (pointInTouchCircle(x, y)) + { + + //make_ui_sound("UISndClick"); + } + return TRUE; +} + +BOOL LLVirtualTrackball::handleKeyHere(KEY key, MASK mask) +{ + BOOL handled = FALSE; + switch (key) + { + case KEY_DOWN: + onRotateTopClick(); + handled = TRUE; + break; + case KEY_LEFT: + onRotateRightClick(); + handled = TRUE; + break; + case KEY_UP: + onRotateBottomClick(); + handled = TRUE; + break; + case KEY_RIGHT: + onRotateLeftClick(); + handled = TRUE; + break; + default: + break; + } + return handled; +} + diff --git a/indra/llui/llvirtualtrackball.h b/indra/llui/llvirtualtrackball.h new file mode 100644 index 0000000000..c1b66550bb --- /dev/null +++ b/indra/llui/llvirtualtrackball.h @@ -0,0 +1,149 @@ +/** +* @file virtualtrackball.h +* @author Andrey Lihatskiy +* @brief Header file for LLVirtualTrackball +* +* $LicenseInfo:firstyear=2001&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2018, Linden Research, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA +* $/LicenseInfo$ +*/ + +// A control for positioning the sun and the moon in the celestial sphere. + +#ifndef LL_LLVIRTUALTRACKBALL_H +#define LL_LLVIRTUALTRACKBALL_H + +#include "lluictrl.h" +#include "llpanel.h" +#include "lltextbox.h" +#include "llbutton.h" + +class LLVirtualTrackball + : public LLUICtrl +{ +public: + enum ThumbMode + { + SUN, + MOON + }; + + struct Params + : public LLInitParam::Block + { + Optional border; + Optional image_moon_back, + image_moon_front, + image_sphere, + image_sun_back, + image_sun_front; + + Optional thumb_mode; + Optional increment_angle_mouse, + increment_angle_btn; + + Optional lbl_N, + lbl_S, + lbl_W, + lbl_E; + + Optional btn_rotate_top, + btn_rotate_bottom, + btn_rotate_left, + btn_rotate_right; + + Params(); + }; + + + virtual ~LLVirtualTrackball(); + /*virtual*/ BOOL postBuild(); + + virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleKeyHere(KEY key, MASK mask); + + virtual void draw(); + + virtual void setValue(const LLSD& value); + void setValue(F32 x, F32 y, F32 z, F32 w); + virtual LLSD getValue() const; + + void setRotation(const LLQuaternion &value); + LLQuaternion getRotation() const; + +protected: + friend class LLUICtrlFactory; + LLVirtualTrackball(const Params&); + void onEditChange(); + +protected: + LLTextBox* mNLabel; + LLTextBox* mELabel; + LLTextBox* mSLabel; + LLTextBox* mWLabel; + + LLButton* mBtnRotateTop; + LLButton* mBtnRotateBottom; + LLButton* mBtnRotateLeft; + LLButton* mBtnRotateRight; + + LLTextBox* mLabelN; + LLTextBox* mLabelS; + LLTextBox* mLabelW; + LLTextBox* mLabelE; + + LLPanel* mTouchArea; + LLViewBorder* mBorder; + +private: + void setValueAndCommit(const LLQuaternion &value); + void drawThumb(S32 x, S32 y, ThumbMode mode, bool upperHemi = true); + bool pointInTouchCircle(S32 x, S32 y) const; + + void onRotateTopClick(); + void onRotateBottomClick(); + void onRotateLeftClick(); + void onRotateRightClick(); + + S32 mPrevX; + S32 mPrevY; + + LLUIImage* mImgMoonBack; + LLUIImage* mImgMoonFront; + LLUIImage* mImgSunBack; + LLUIImage* mImgSunFront; + LLUIImage* mImgBtnRotTop; + LLUIImage* mImgBtnRotLeft; + LLUIImage* mImgBtnRotRight; + LLUIImage* mImgBtnRotBottom; + LLUIImage* mImgSphere; + + LLQuaternion mValue; + ThumbMode mThumbMode; + + F32 mIncrementMouse; + F32 mIncrementBtn; +}; + +#endif + -- cgit v1.2.3 From 31aa86b7039b025b23b5b02455e65be103e2ea0b Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 19 Jul 2018 21:11:23 +0100 Subject: Compile fixes for latest Xcode on OSX. --- indra/llui/llscrolllistctrl.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 212e27477b..ed65b1e45f 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -2784,7 +2784,6 @@ void LLScrollListCtrl::onClickColumn(void *userdata) } // if this column is the primary sort key, reverse the direction - sort_column_t cur_sort_column; if (!parent->mSortColumns.empty() && parent->mSortColumns.back().first == column_index) { ascending = !parent->mSortColumns.back().second; -- cgit v1.2.3 From c822d8af16428cf245ae57305a4f39d3fccd672b Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 20 Jul 2018 19:10:22 +0300 Subject: MAINT-8344 implement slider support for an overlap threshold and reenable shift-copy --- indra/llui/llmultislider.cpp | 23 ++++++++++++++++++----- indra/llui/llmultislider.h | 3 +++ indra/llui/llmultisliderctrl.cpp | 5 +++++ indra/llui/llmultisliderctrl.h | 2 ++ 4 files changed, 28 insertions(+), 5 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 5cfe79267f..cd9c77585a 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -41,8 +41,6 @@ static LLDefaultChildRegistry::Register r("multi_slider_bar"); -const F32 FLOAT_THRESHOLD = 0.00001f; - S32 LLMultiSlider::mNameCounter = 0; LLMultiSlider::SliderParams::SliderParams() @@ -54,6 +52,7 @@ LLMultiSlider::SliderParams::SliderParams() LLMultiSlider::Params::Params() : max_sliders("max_sliders", 1), allow_overlap("allow_overlap", false), + overlap_threshold("overlap_threshold", 0), draw_track("draw_track", true), use_triangle("use_triangle", false), track_color("track_color"), @@ -98,6 +97,15 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p) setMouseUpCallback(initCommitCallback(p.mouse_up_callback)); } + if (p.overlap_threshold.isProvided()) + { + mOverlapThreshold = p.overlap_threshold; + } + else + { + mOverlapThreshold = 0; + } + for (LLInitParam::ParamIterator::const_iterator it = p.sliders.begin(); it != p.sliders.end(); ++it) @@ -143,11 +151,14 @@ void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from // look at the current spot // and see if anything is there LLSD::map_iterator mIt = mValue.beginMap(); + F32 threshold = mOverlapThreshold + (mIncrement / 4); // increment is our distance between points, use to eliminate round error for(;mIt != mValue.endMap(); mIt++) { F32 testVal = (F32)mIt->second.asReal() - newValue; - if(testVal > -FLOAT_THRESHOLD && testVal < FLOAT_THRESHOLD && - mIt->first != name) { + if (testVal > -threshold + && testVal < threshold + && mIt->first != name) + { hit = true; break; } @@ -300,11 +311,13 @@ bool LLMultiSlider::findUnusedValue(F32& initVal) // look at the current spot // and see if anything is there + F32 threshold = mOverlapThreshold + (mIncrement / 4); LLSD::map_iterator mIt = mValue.beginMap(); for(;mIt != mValue.endMap(); mIt++) { F32 testVal = (F32)mIt->second.asReal() - initVal; - if(testVal > -FLOAT_THRESHOLD && testVal < FLOAT_THRESHOLD) { + if(testVal > -threshold && testVal < threshold) + { hit = true; break; } diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 0177597da2..9281b68406 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -50,6 +50,8 @@ public: draw_track, use_triangle; + Optional overlap_threshold; + Optional track_color, thumb_disabled_color, thumb_outline_color, @@ -107,6 +109,7 @@ protected: S32 mMaxNumSliders; BOOL mAllowOverlap; + F32 mOverlapThreshold; BOOL mDrawTrack; BOOL mUseTriangle; /// hacked in toggle to use a triangle diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index a982d431b3..d2afca19b7 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -53,6 +53,7 @@ LLMultiSliderCtrl::Params::Params() can_edit_text("can_edit_text", false), max_sliders("max_sliders", 1), allow_overlap("allow_overlap", false), + overlap_threshold("overlap_threshold", 0), draw_track("draw_track", true), use_triangle("use_triangle", false), decimal_digits("decimal_digits", 3), @@ -167,6 +168,10 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLMultiSliderCtrl::Params& p) params.increment(p.increment); params.max_sliders(p.max_sliders); params.allow_overlap(p.allow_overlap); + if (p.overlap_threshold.isProvided()) + { + params.overlap_threshold = p.overlap_threshold; + } params.draw_track(p.draw_track); params.use_triangle(p.use_triangle); params.control_name(p.control_name); diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index 5c4777ebd0..507115f5e1 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -57,6 +57,8 @@ public: draw_track, use_triangle; + Optional overlap_threshold; + Optional text_color, text_disabled_color; -- cgit v1.2.3 From 6a54e0948d651963399da82cfc5672125b9442e7 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Wed, 8 Aug 2018 03:28:37 +0300 Subject: MAINT-8900 LLVirtualTrackball improvement: added click-to-set mode --- indra/llui/llvirtualtrackball.cpp | 73 +++++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 18 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llvirtualtrackball.cpp b/indra/llui/llvirtualtrackball.cpp index 0ddbe8b9c2..a24c5a420d 100644 --- a/indra/llui/llvirtualtrackball.cpp +++ b/indra/llui/llvirtualtrackball.cpp @@ -321,29 +321,66 @@ BOOL LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { - LLQuaternion delta; - - F32 rotX = x - mPrevX; - F32 rotY = y - mPrevY; - - if (abs(rotX) > 1) - { - F32 direction = (rotX < 0) ? -1 : 1; - delta.setAngleAxis(mIncrementMouse * abs(rotX), 0, direction, 0); // changing X - rotate around Y axis - mValue *= delta; + if (mask == MASK_CONTROL) + { // trackball (move to roll) mode + LLQuaternion delta; + + F32 rotX = x - mPrevX; + F32 rotY = y - mPrevY; + + if (abs(rotX) > 1) + { + F32 direction = (rotX < 0) ? -1 : 1; + delta.setAngleAxis(mIncrementMouse * abs(rotX), 0, direction, 0); // changing X - rotate around Y axis + mValue *= delta; + } + + if (abs(rotY) > 1) + { + F32 direction = (rotY < 0) ? 1 : -1; // reverse for Y (value increases from bottom to top) + delta.setAngleAxis(mIncrementMouse * abs(rotY), direction, 0, 0); // changing Y - rotate around X axis + mValue *= delta; + } } - - if (abs(rotY) > 1) - { - F32 direction = (rotY < 0) ? 1 : -1; // reverse for Y (value increases from bottom to top) - delta.setAngleAxis(mIncrementMouse * abs(rotY), direction, 0, 0); // changing Y - rotate around X axis - mValue *= delta; + else + { // set on click mode + if (!pointInTouchCircle(x, y)) + { + return TRUE; // don't drag outside the circle + } + + F32 radius = mTouchArea->getRect().getWidth() / 2; + F32 xx = x - mTouchArea->getRect().getCenterX(); + F32 yy = y - mTouchArea->getRect().getCenterY(); + F32 dist = sqrt(pow(xx, 2) + pow(yy, 2)); + + F32 azimuth = llclamp(acosf(xx / dist), 0.0f, F_PI); + F32 altitude = llclamp(acosf(dist / radius), 0.0f, F_PI_BY_TWO); + + if (yy < 0) + { + azimuth = F_TWO_PI - azimuth; + } + + LLVector3 draw_point = VectorZero * mValue; + if (draw_point.mV[VZ] >= 0.f) + { + if (is_approx_zero(altitude)) // don't change the hemisphere + { + altitude = F_APPROXIMATELY_ZERO; + } + altitude *= -1; + } + + mValue.setAngleAxis(altitude, 0, 1, 0); + LLQuaternion az_quat; + az_quat.setAngleAxis(azimuth, 0, 0, 1); + mValue *= az_quat; } - - onCommit(); mPrevX = x; mPrevY = y; + onCommit(); } return TRUE; } -- cgit v1.2.3 From 51abc168c03f80d63c85d4bb48624f440b585390 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 3 Aug 2018 21:01:43 +0300 Subject: MAINT-8902 fix encroaching 'legacy' issues --- indra/llui/llmultislider.cpp | 27 +++++++++++++++++++++++++-- indra/llui/llmultislider.h | 2 ++ indra/llui/llmultisliderctrl.cpp | 2 ++ indra/llui/llmultisliderctrl.h | 1 + 4 files changed, 30 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index cd9c77585a..725f1e8f65 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -41,6 +41,8 @@ static LLDefaultChildRegistry::Register r("multi_slider_bar"); +const F32 FLOAT_THRESHOLD = 0.00001f; + S32 LLMultiSlider::mNameCounter = 0; LLMultiSlider::SliderParams::SliderParams() @@ -52,6 +54,7 @@ LLMultiSlider::SliderParams::SliderParams() LLMultiSlider::Params::Params() : max_sliders("max_sliders", 1), allow_overlap("allow_overlap", false), + loop_overlap("loop_overlap", false), overlap_threshold("overlap_threshold", 0), draw_track("draw_track", true), use_triangle("use_triangle", false), @@ -73,6 +76,7 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p) mDragStartThumbRect( 0, getRect().getHeight(), p.thumb_width, 0 ), mMaxNumSliders(p.max_sliders), mAllowOverlap(p.allow_overlap), + mLoopOverlap(p.loop_overlap), mDrawTrack(p.draw_track), mUseTriangle(p.use_triangle), mTrackColor(p.track_color()), @@ -151,7 +155,14 @@ void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from // look at the current spot // and see if anything is there LLSD::map_iterator mIt = mValue.beginMap(); - F32 threshold = mOverlapThreshold + (mIncrement / 4); // increment is our distance between points, use to eliminate round error + + // increment is our distance between points, use to eliminate round error + F32 threshold = mOverlapThreshold + (mIncrement / 4); + // If loop overlap is enabled, check if we overlap with points 'after' max value (project to lower) + F32 loop_up_check = (mLoopOverlap && (value + threshold) > mMaxValue) ? (value + threshold - mMaxValue + mMinValue) : 0.0f; + // If loop overlap is enabled, check if we overlap with points 'before' min value (project to upper) + F32 loop_down_check = (mLoopOverlap && (value - threshold) < mMinValue) ? (value - threshold - mMinValue + mMaxValue) : 0.0f; + for(;mIt != mValue.endMap(); mIt++) { F32 testVal = (F32)mIt->second.asReal() - newValue; @@ -162,6 +173,18 @@ void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from hit = true; break; } + if (loop_up_check != 0 + && testVal < loop_up_check) + { + hit = true; + break; + } + if (loop_down_check != 0 + && testVal > loop_down_check) + { + hit = true; + break; + } } // if none found, stop @@ -311,7 +334,7 @@ bool LLMultiSlider::findUnusedValue(F32& initVal) // look at the current spot // and see if anything is there - F32 threshold = mOverlapThreshold + (mIncrement / 4); + F32 threshold = mAllowOverlap ? FLOAT_THRESHOLD : mOverlapThreshold + (mIncrement / 4); LLSD::map_iterator mIt = mValue.beginMap(); for(;mIt != mValue.endMap(); mIt++) { diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 9281b68406..eff0c7d2d7 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -47,6 +47,7 @@ public: Optional max_sliders; Optional allow_overlap, + loop_overlap, draw_track, use_triangle; @@ -109,6 +110,7 @@ protected: S32 mMaxNumSliders; BOOL mAllowOverlap; + BOOL mLoopOverlap; F32 mOverlapThreshold; BOOL mDrawTrack; BOOL mUseTriangle; /// hacked in toggle to use a triangle diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index d2afca19b7..4c2936eb69 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -53,6 +53,7 @@ LLMultiSliderCtrl::Params::Params() can_edit_text("can_edit_text", false), max_sliders("max_sliders", 1), allow_overlap("allow_overlap", false), + loop_overlap("loop_overlap", false), overlap_threshold("overlap_threshold", 0), draw_track("draw_track", true), use_triangle("use_triangle", false), @@ -168,6 +169,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLMultiSliderCtrl::Params& p) params.increment(p.increment); params.max_sliders(p.max_sliders); params.allow_overlap(p.allow_overlap); + params.loop_overlap(p.loop_overlap); if (p.overlap_threshold.isProvided()) { params.overlap_threshold = p.overlap_threshold; diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index 507115f5e1..0ce21c0612 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -54,6 +54,7 @@ public: Optional decimal_digits; Optional max_sliders; Optional allow_overlap, + loop_overlap, draw_track, use_triangle; -- cgit v1.2.3 From 3dfd3be98e19c239949eb7d59ef3fb84274322d1 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Thu, 9 Aug 2018 13:09:22 +0300 Subject: MAINT-8900 LLVirtualTrackball improvements: buttons behavior and mode select --- indra/llui/llvirtualtrackball.cpp | 9 +++++---- indra/llui/llvirtualtrackball.h | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llvirtualtrackball.cpp b/indra/llui/llvirtualtrackball.cpp index a24c5a420d..e73bba57bb 100644 --- a/indra/llui/llvirtualtrackball.cpp +++ b/indra/llui/llvirtualtrackball.cpp @@ -321,7 +321,7 @@ BOOL LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { - if (mask == MASK_CONTROL) + if (mDragMode == DRAG_SCROLL) { // trackball (move to roll) mode LLQuaternion delta; @@ -394,7 +394,7 @@ BOOL LLVirtualTrackball::handleMouseUp(S32 x, S32 y, MASK mask) gFocusMgr.setMouseCapture(NULL); make_ui_sound("UISndClickRelease"); } - return TRUE; + return LLView::handleMouseUp(x, y, mask); } BOOL LLVirtualTrackball::handleMouseDown(S32 x, S32 y, MASK mask) @@ -404,9 +404,10 @@ BOOL LLVirtualTrackball::handleMouseDown(S32 x, S32 y, MASK mask) mPrevX = x; mPrevY = y; gFocusMgr.setMouseCapture(this); + mDragMode = (mask == MASK_CONTROL) ? DRAG_SCROLL : DRAG_SET; make_ui_sound("UISndClick"); } - return TRUE; + return LLView::handleMouseDown(x, y, mask); } BOOL LLVirtualTrackball::handleRightMouseDown(S32 x, S32 y, MASK mask) @@ -416,7 +417,7 @@ BOOL LLVirtualTrackball::handleRightMouseDown(S32 x, S32 y, MASK mask) //make_ui_sound("UISndClick"); } - return TRUE; + return LLView::handleRightMouseDown(x, y, mask); } BOOL LLVirtualTrackball::handleKeyHere(KEY key, MASK mask) diff --git a/indra/llui/llvirtualtrackball.h b/indra/llui/llvirtualtrackball.h index c1b66550bb..48ddb7f4d9 100644 --- a/indra/llui/llvirtualtrackball.h +++ b/indra/llui/llvirtualtrackball.h @@ -44,6 +44,11 @@ public: SUN, MOON }; + enum DragMode + { + DRAG_SET, + DRAG_SCROLL + }; struct Params : public LLInitParam::Block @@ -140,6 +145,7 @@ private: LLQuaternion mValue; ThumbMode mThumbMode; + DragMode mDragMode; F32 mIncrementMouse; F32 mIncrementBtn; -- cgit v1.2.3 From d965af2b0cbf62e2e1601f504e0d548da40aa742 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Fri, 24 Aug 2018 02:40:12 +0300 Subject: MAINT-9032 Virtual Track Ball improvements --- indra/llui/llvirtualtrackball.cpp | 31 +++++++++++++++++++++++++++++++ indra/llui/llvirtualtrackball.h | 5 +++++ 2 files changed, 36 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llvirtualtrackball.cpp b/indra/llui/llvirtualtrackball.cpp index e73bba57bb..723643dd25 100644 --- a/indra/llui/llvirtualtrackball.cpp +++ b/indra/llui/llvirtualtrackball.cpp @@ -88,6 +88,7 @@ LLVirtualTrackball::LLVirtualTrackball(const LLVirtualTrackball::Params& p) btn_rt.rect(LLRect(centerX - axis_offset_lt, border_rect.mTop, centerX + axis_offset_rb, border_rect.mTop - btn_size)); btn_rt.click_callback.function(boost::bind(&LLVirtualTrackball::onRotateTopClick, this)); btn_rt.mouse_held_callback.function(boost::bind(&LLVirtualTrackball::onRotateTopClick, this)); + btn_rt.mouseenter_callback.function(boost::bind(&LLVirtualTrackball::onRotateTopMouseEnter, this)); mBtnRotateTop = LLUICtrlFactory::create(btn_rt); addChild(mBtnRotateTop); @@ -104,6 +105,7 @@ LLVirtualTrackball::LLVirtualTrackball(const LLVirtualTrackball::Params& p) btn_rr.rect(LLRect(border_rect.mRight - btn_size, centerY + axis_offset_lt, border_rect.mRight, centerY - axis_offset_rb)); btn_rr.click_callback.function(boost::bind(&LLVirtualTrackball::onRotateRightClick, this)); btn_rr.mouse_held_callback.function(boost::bind(&LLVirtualTrackball::onRotateRightClick, this)); + btn_rr.mouseenter_callback.function(boost::bind(&LLVirtualTrackball::onRotateRightMouseEnter, this)); mBtnRotateRight = LLUICtrlFactory::create(btn_rr); addChild(mBtnRotateRight); @@ -120,6 +122,7 @@ LLVirtualTrackball::LLVirtualTrackball(const LLVirtualTrackball::Params& p) btn_rb.rect(LLRect(centerX - axis_offset_lt, border_rect.mBottom + btn_size, centerX + axis_offset_rb, border_rect.mBottom)); btn_rb.click_callback.function(boost::bind(&LLVirtualTrackball::onRotateBottomClick, this)); btn_rb.mouse_held_callback.function(boost::bind(&LLVirtualTrackball::onRotateBottomClick, this)); + btn_rb.mouseenter_callback.function(boost::bind(&LLVirtualTrackball::onRotateBottomMouseEnter, this)); mBtnRotateBottom = LLUICtrlFactory::create(btn_rb); addChild(mBtnRotateBottom); @@ -136,6 +139,7 @@ LLVirtualTrackball::LLVirtualTrackball(const LLVirtualTrackball::Params& p) btn_rl.rect(LLRect(border_rect.mLeft, centerY + axis_offset_lt, border_rect.mLeft + btn_size, centerY - axis_offset_rb)); btn_rl.click_callback.function(boost::bind(&LLVirtualTrackball::onRotateLeftClick, this)); btn_rl.mouse_held_callback.function(boost::bind(&LLVirtualTrackball::onRotateLeftClick, this)); + btn_rl.mouseenter_callback.function(boost::bind(&LLVirtualTrackball::onRotateLeftMouseEnter, this)); mBtnRotateLeft = LLUICtrlFactory::create(btn_rl); addChild(mBtnRotateLeft); @@ -228,6 +232,13 @@ void LLVirtualTrackball::draw() gl_circle_2d(draw_point.mV[VX], draw_point.mV[VY], mImgSunFront->getWidth() / 2, 12, false); } + // hide the direction labels when disabled + BOOL enabled = isInEnabledChain(); + mLabelN->setVisible(enabled); + mLabelE->setVisible(enabled); + mLabelS->setVisible(enabled); + mLabelW->setVisible(enabled); + LLView::draw(); } @@ -283,6 +294,26 @@ void LLVirtualTrackball::onRotateRightClick() } } +void LLVirtualTrackball::onRotateTopMouseEnter() +{ + mBtnRotateTop->setHighlight(true); +} + +void LLVirtualTrackball::onRotateBottomMouseEnter() +{ + mBtnRotateBottom->setHighlight(true); +} + +void LLVirtualTrackball::onRotateLeftMouseEnter() +{ + mBtnRotateLeft->setHighlight(true); +} + +void LLVirtualTrackball::onRotateRightMouseEnter() +{ + mBtnRotateRight->setHighlight(true); +} + void LLVirtualTrackball::setValue(const LLSD& value) { if (value.isArray() && value.size() == 4) diff --git a/indra/llui/llvirtualtrackball.h b/indra/llui/llvirtualtrackball.h index 48ddb7f4d9..2d4b1ece17 100644 --- a/indra/llui/llvirtualtrackball.h +++ b/indra/llui/llvirtualtrackball.h @@ -130,6 +130,11 @@ private: void onRotateLeftClick(); void onRotateRightClick(); + void onRotateTopMouseEnter(); + void onRotateBottomMouseEnter(); + void onRotateLeftMouseEnter(); + void onRotateRightMouseEnter(); + S32 mPrevX; S32 mPrevY; -- cgit v1.2.3 From e539236a75a163b1c6748617bd1e4d2b84aaa3d6 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 6 Sep 2018 21:29:28 +0300 Subject: MAINT-9099 Implementation of vertical orientation support for multislider --- indra/llui/llmultislider.cpp | 95 ++++++++++++++++++++++++++++++++-------- indra/llui/llmultislider.h | 8 +++- indra/llui/llmultisliderctrl.cpp | 2 + indra/llui/llmultisliderctrl.h | 4 +- 4 files changed, 88 insertions(+), 21 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 725f1e8f65..6d6b6c4e90 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -55,6 +55,7 @@ LLMultiSlider::Params::Params() : max_sliders("max_sliders", 1), allow_overlap("allow_overlap", false), loop_overlap("loop_overlap", false), + orientation("orientation"), overlap_threshold("overlap_threshold", 0), draw_track("draw_track", true), use_triangle("use_triangle", false), @@ -86,6 +87,7 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p) mDisabledThumbColor(p.thumb_disabled_color()), mTriangleColor(p.triangle_color()), mThumbWidth(p.thumb_width), + mOrientation((p.orientation() == "vertical") ? VERTICAL : HORIZONTAL), mMouseDownSignal(NULL), mMouseUpSignal(NULL) { @@ -204,13 +206,26 @@ void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from } F32 t = (newValue - mMinValue) / (mMaxValue - mMinValue); + if (mOrientation == HORIZONTAL) + { + S32 left_edge = mThumbWidth/2; + S32 right_edge = getRect().getWidth() - (mThumbWidth/2); + + S32 x = left_edge + S32( t * (right_edge - left_edge) ); + + mThumbRects[name].mLeft = x - (mThumbWidth / 2); + mThumbRects[name].mRight = x + (mThumbWidth / 2); + } + else + { + S32 bottom_edge = mThumbWidth/2; + S32 top_edge = getRect().getHeight() - (mThumbWidth/2); - S32 left_edge = mThumbWidth/2; - S32 right_edge = getRect().getWidth() - (mThumbWidth/2); + S32 x = bottom_edge + S32( t * (top_edge - bottom_edge) ); - S32 x = left_edge + S32( t * (right_edge - left_edge) ); - mThumbRects[name].mLeft = x - (mThumbWidth/2); - mThumbRects[name].mRight = x + (mThumbWidth/2); + mThumbRects[name].mTop = x + (mThumbWidth / 2); + mThumbRects[name].mBottom = x - (mThumbWidth / 2); + } } void LLMultiSlider::setValue(const LLSD& value) @@ -244,15 +259,29 @@ void LLMultiSlider::setCurSlider(const std::string& name) } } -F32 LLMultiSlider::getSliderValueFromX(S32 xpos) const +F32 LLMultiSlider::getSliderValueFromPos(S32 xpos, S32 ypos) const { - S32 left_edge = mThumbWidth / 2; - S32 right_edge = getRect().getWidth() - (mThumbWidth / 2); + F32 t = 0; + if (mOrientation == HORIZONTAL) + { + S32 left_edge = mThumbWidth / 2; + S32 right_edge = getRect().getWidth() - (mThumbWidth / 2); - xpos += mMouseOffset; - xpos = llclamp(xpos, left_edge, right_edge); + xpos += mMouseOffset; + xpos = llclamp(xpos, left_edge, right_edge); - F32 t = F32(xpos - left_edge) / (right_edge - left_edge); + t = F32(xpos - left_edge) / (right_edge - left_edge); + } + else + { + S32 bottom_edge = mThumbWidth / 2; + S32 top_edge = getRect().getHeight() - (mThumbWidth / 2); + + ypos += mMouseOffset; + ypos = llclamp(ypos, bottom_edge, top_edge); + + t = F32(ypos - bottom_edge) / (top_edge - bottom_edge); + } return((t * (mMaxValue - mMinValue)) + mMinValue); } @@ -286,7 +315,14 @@ const std::string& LLMultiSlider::addSlider(F32 val) } // add a new thumb rect - mThumbRects[newName.str()] = LLRect( 0, getRect().getHeight(), mThumbWidth, 0 ); + if (mOrientation == HORIZONTAL) + { + mThumbRects[newName.str()] = LLRect(0, getRect().getHeight(), mThumbWidth, 0); + } + else + { + mThumbRects[newName.str()] = LLRect(0, mThumbWidth, getRect().getWidth(), 0); + } // add the value and set the current slider to this one mValue.insert(newName.str(), initVal); @@ -312,7 +348,14 @@ void LLMultiSlider::addSlider(F32 val, const std::string& name) } // add a new thumb rect - mThumbRects[name] = LLRect( 0, getRect().getHeight(), mThumbWidth, 0 ); + if (mOrientation == HORIZONTAL) + { + mThumbRects[name] = LLRect(0, getRect().getHeight(), mThumbWidth, 0); + } + else + { + mThumbRects[name] = LLRect(0, mThumbWidth, getRect().getWidth(), 0); + } // add the value and set the current slider to this one mValue.insert(name, initVal); @@ -416,7 +459,7 @@ BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask) // // F32 t = F32(x - left_edge) / (right_edge - left_edge); // setCurSliderValue(t * (mMaxValue - mMinValue) + mMinValue ); - setCurSliderValue(getSliderValueFromX(x)); + setCurSliderValue(getSliderValueFromPos(x, y)); onCommit(); getWindow()->setCursor(UI_CURSOR_ARROW); @@ -485,7 +528,14 @@ BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask) // Find the offset of the actual mouse location from the center of the thumb. if (mThumbRects[mCurSlider].pointInRect(x,y)) { - mMouseOffset = (mThumbRects[mCurSlider].mLeft + mThumbWidth/2) - x; + if (mOrientation == HORIZONTAL) + { + mMouseOffset = (mThumbRects[mCurSlider].mLeft + mThumbWidth / 2) - x; + } + else + { + mMouseOffset = (mThumbRects[mCurSlider].mBottom + mThumbWidth / 2) - y; + } } else { @@ -550,9 +600,18 @@ void LLMultiSlider::draw() // Track LLUIImagePtr thumb_imagep = LLUI::getUIImage("Rounded_Square"); - static LLUICachedControl multi_track_height ("UIMultiTrackHeight", 0); - S32 height_offset = (getRect().getHeight() - multi_track_height) / 2; - LLRect track_rect(0, getRect().getHeight() - height_offset, getRect().getWidth(), height_offset ); + static LLUICachedControl multi_track_height_width ("UIMultiTrackHeight", 0); + S32 height_offset = 0; + S32 width_offset = 0; + if (mOrientation == HORIZONTAL) + { + height_offset = (getRect().getHeight() - multi_track_height_width) / 2; + } + else + { + width_offset = (getRect().getWidth() - multi_track_height_width) / 2; + } + LLRect track_rect(width_offset, getRect().getHeight() - height_offset, getRect().getWidth() - width_offset, height_offset); if(mDrawTrack) diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index eff0c7d2d7..3884b0a2a0 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -60,6 +60,8 @@ public: thumb_center_selected_color, triangle_color; + Optional orientation; + Optional mouse_down_callback, mouse_up_callback; Optional thumb_width; @@ -75,7 +77,7 @@ public: virtual ~LLMultiSlider(); void setSliderValue(const std::string& name, F32 value, BOOL from_event = FALSE); F32 getSliderValue(const std::string& name) const; - F32 getSliderValueFromX(S32 xpos) const; + F32 getSliderValueFromPos(S32 xpos, S32 ypos) const; const std::string& getCurSlider() const { return mCurSlider; } F32 getCurSliderValue() const { return getSliderValue(mCurSlider); } @@ -127,7 +129,9 @@ protected: LLUIColor mThumbCenterSelectedColor; LLUIColor mDisabledThumbColor; LLUIColor mTriangleColor; - + + const EOrientation mOrientation; + commit_signal_t* mMouseDownSignal; commit_signal_t* mMouseUpSignal; }; diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index 4c2936eb69..73792206a6 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -54,6 +54,7 @@ LLMultiSliderCtrl::Params::Params() max_sliders("max_sliders", 1), allow_overlap("allow_overlap", false), loop_overlap("loop_overlap", false), + orientation("orientation"), overlap_threshold("overlap_threshold", 0), draw_track("draw_track", true), use_triangle("use_triangle", false), @@ -170,6 +171,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLMultiSliderCtrl::Params& p) params.max_sliders(p.max_sliders); params.allow_overlap(p.allow_overlap); params.loop_overlap(p.loop_overlap); + params.orientation(p.orientation()); if (p.overlap_threshold.isProvided()) { params.overlap_threshold = p.overlap_threshold; diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index 0ce21c0612..a1593c28e0 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -58,6 +58,8 @@ public: draw_track, use_triangle; + Optional orientation; + Optional overlap_threshold; Optional text_color, @@ -102,7 +104,7 @@ public: void setMaxValue(F32 max_value) {mMultiSlider->setMaxValue(max_value);} void setIncrement(F32 increment) {mMultiSlider->setIncrement(increment);} - F32 getSliderValueFromX(S32 x) const { return mMultiSlider->getSliderValueFromX(x); } + F32 getSliderValueFromPos(S32 x, S32 y) const { return mMultiSlider->getSliderValueFromPos(x, y); } /// for adding and deleting sliders const std::string& addSlider(); -- cgit v1.2.3 From 43c8f5959f8afaf2f67fbbf49e78965802859b55 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 10 Sep 2018 16:44:56 +0300 Subject: MAINT-9099 Adjustable region altitudes. --- indra/llui/llmultislider.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'indra/llui') 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)); -- cgit v1.2.3 From c5936bbba031272b1deb78ce8ea52663d033695b Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 12 Sep 2018 21:02:58 +0300 Subject: SL-1961 Icon support for multislider and icons on altitudes slider --- indra/llui/llmultislider.cpp | 91 ++++++++++++++++++++++++---------------- indra/llui/llmultislider.h | 6 ++- indra/llui/llmultisliderctrl.cpp | 12 +++++- indra/llui/llmultisliderctrl.h | 9 ++-- 4 files changed, 76 insertions(+), 42 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index b5e3032626..caf9f06074 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -61,9 +61,11 @@ LLMultiSlider::Params::Params() use_triangle("use_triangle", false), track_color("track_color"), thumb_disabled_color("thumb_disabled_color"), + thumb_highlight_color("thumb_highlight_color"), thumb_outline_color("thumb_outline_color"), thumb_center_color("thumb_center_color"), thumb_center_selected_color("thumb_center_selected_color"), + thumb_image("thumb_image"), triangle_color("triangle_color"), mouse_down_callback("mouse_down_callback"), mouse_up_callback("mouse_up_callback"), @@ -133,6 +135,12 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p) addSlider(it->value); } } + + if (p.thumb_image.isProvided()) + { + mThumbImagep = LLUI::getUIImage(p.thumb_image()); + } + mThumbHighlightColor = p.thumb_highlight_color.isProvided() ? p.thumb_highlight_color() : gFocusMgr.getFocusColor(); } LLMultiSlider::~LLMultiSlider() @@ -644,7 +652,7 @@ void LLMultiSlider::draw() mTriangleColor.get() % opacity, TRUE); } } - else if (!thumb_imagep) + else if (!thumb_imagep && !mThumbImagep) { // draw all the thumbs curSldrIt = mThumbRects.end(); @@ -674,15 +682,33 @@ void LLMultiSlider::draw() gl_rect_2d(mDragStartThumbRect, mThumbCenterColor.get() % opacity, FALSE); } } - else if( gFocusMgr.getMouseCapture() == this ) + else { - // draw drag start - thumb_imagep->drawSolid(mDragStartThumbRect, mThumbCenterColor.get() % 0.3f); + LLMouseHandler* capture = gFocusMgr.getMouseCapture(); + if (capture == this) + { + // draw drag start (ghost) + if (mThumbImagep) + { + mThumbImagep->draw(mDragStartThumbRect, mThumbCenterColor.get() % 0.3f); + } + else + { + thumb_imagep->drawSolid(mDragStartThumbRect, mThumbCenterColor.get() % 0.3f); + } + } // draw the highlight if (hasFocus() && !mCurSlider.empty()) { - thumb_imagep->drawBorder(mThumbRects[mCurSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth()); + if (mThumbImagep) + { + mThumbImagep->drawBorder(mThumbRects[mCurSlider], mThumbHighlightColor, gFocusMgr.getFocusFlashWidth()); + } + else + { + thumb_imagep->drawBorder(mThumbRects[mCurSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth()); + } } // draw the thumbs @@ -699,44 +725,35 @@ void LLMultiSlider::draw() } // the draw command - thumb_imagep->drawSolid(mIt->second, curThumbColor); + if (mThumbImagep) + { + mThumbImagep->draw(mIt->second); + } + else if (capture == this) + { + thumb_imagep->drawSolid(mIt->second, curThumbColor); + } + else + { + thumb_imagep->drawSolid(mIt->second, curThumbColor % opacity); + } } // draw cur slider last if(curSldrIt != mThumbRects.end()) { - thumb_imagep->drawSolid(curSldrIt->second, mThumbCenterSelectedColor.get()); - } - - } - else - { - // draw highlight - if (hasFocus() && !mCurSlider.empty()) - { - thumb_imagep->drawBorder(mThumbRects[mCurSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth()); - } - - // draw thumbs - curSldrIt = mThumbRects.end(); - for(mIt = mThumbRects.begin(); mIt != mThumbRects.end(); mIt++) - { - - // choose the color - curThumbColor = mThumbCenterColor.get(); - if(mIt->first == mCurSlider) + if (mThumbImagep) { - curSldrIt = mIt; - continue; - //curThumbColor = mThumbCenterSelectedColor; - } - - thumb_imagep->drawSolid(mIt->second, curThumbColor % opacity); - } - - if(curSldrIt != mThumbRects.end()) - { - thumb_imagep->drawSolid(curSldrIt->second, mThumbCenterSelectedColor.get() % opacity); + mThumbImagep->draw(curSldrIt->second); + } + else if (capture == this) + { + thumb_imagep->drawSolid(curSldrIt->second, mThumbCenterSelectedColor.get()); + } + else + { + thumb_imagep->drawSolid(curSldrIt->second, mThumbCenterSelectedColor.get() % opacity); + } } } diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 3884b0a2a0..a068b461e0 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -55,12 +55,14 @@ public: Optional track_color, thumb_disabled_color, + thumb_highlight_color, thumb_outline_color, thumb_center_color, thumb_center_selected_color, triangle_color; - Optional orientation; + Optional orientation, + thumb_image; Optional mouse_down_callback, mouse_up_callback; @@ -125,10 +127,12 @@ protected: mThumbRects; LLUIColor mTrackColor; LLUIColor mThumbOutlineColor; + LLUIColor mThumbHighlightColor; LLUIColor mThumbCenterColor; LLUIColor mThumbCenterSelectedColor; LLUIColor mDisabledThumbColor; LLUIColor mTriangleColor; + LLUIImagePtr mThumbImagep; //blimps on the slider, for now no 'disabled' support const EOrientation mOrientation; diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index 73792206a6..972567ef9b 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -55,6 +55,9 @@ LLMultiSliderCtrl::Params::Params() allow_overlap("allow_overlap", false), loop_overlap("loop_overlap", false), orientation("orientation"), + thumb_image("thumb_image"), + thumb_width("thumb_width"), + thumb_highlight_color("thumb_highlight_color"), overlap_threshold("overlap_threshold", 0), draw_track("draw_track", true), use_triangle("use_triangle", false), @@ -171,11 +174,18 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const LLMultiSliderCtrl::Params& p) params.max_sliders(p.max_sliders); params.allow_overlap(p.allow_overlap); params.loop_overlap(p.loop_overlap); - params.orientation(p.orientation()); if (p.overlap_threshold.isProvided()) { params.overlap_threshold = p.overlap_threshold; } + params.orientation(p.orientation); + params.thumb_image(p.thumb_image); + params.thumb_highlight_color(p.thumb_highlight_color); + if (p.thumb_width.isProvided()) + { + // otherwise should be provided by template + params.thumb_width(p.thumb_width); + } params.draw_track(p.draw_track); params.use_triangle(p.use_triangle); params.control_name(p.control_name); diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index a1593c28e0..74eaf69987 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -51,19 +51,22 @@ public: text_width; Optional show_text, can_edit_text; - Optional decimal_digits; + Optional decimal_digits, + thumb_width; Optional max_sliders; Optional allow_overlap, loop_overlap, draw_track, use_triangle; - Optional orientation; + Optional orientation, + thumb_image; Optional overlap_threshold; Optional text_color, - text_disabled_color; + text_disabled_color, + thumb_highlight_color; Optional mouse_down_callback, mouse_up_callback; -- cgit v1.2.3 From ceb336c5f340c260ac5c1923723dbc8204b98157 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 13 Sep 2018 16:32:41 +0300 Subject: SL-1168 EEP Shouldn't be possible to create more than 20 keframes --- indra/llui/llmultislider.h | 4 ++++ indra/llui/llmultisliderctrl.h | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 3884b0a2a0..9a997de16a 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -105,6 +105,10 @@ public: /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); /*virtual*/ void draw(); + S32 getMaxNumSliders() { return mMaxNumSliders; } + S32 getCurNumSliders() { return mValue.size(); } + bool canAddSliders() { return mValue.size() < mMaxNumSliders; } + protected: LLSD mValue; std::string mCurSlider; diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index a1593c28e0..ad2dc94779 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -115,6 +115,10 @@ public: F32 getMinValue() const { return mMultiSlider->getMinValue(); } F32 getMaxValue() const { return mMultiSlider->getMaxValue(); } + S32 getMaxNumSliders() { return mMultiSlider->getMaxNumSliders(); } + S32 getCurNumSliders() { return mMultiSlider->getCurNumSliders(); } + bool canAddSliders() { return mMultiSlider->canAddSliders(); } + void setLabel(const std::string& label) { if (mLabelBox) mLabelBox->setText(label); } void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; } -- cgit v1.2.3 From 53de3916a16e316543cd12491556999a4c84f545 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Thu, 13 Sep 2018 10:48:55 -0700 Subject: Explicit cast for LLUIColor --- indra/llui/llmultislider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index caf9f06074..ef907e620e 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -140,7 +140,7 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p) { mThumbImagep = LLUI::getUIImage(p.thumb_image()); } - mThumbHighlightColor = p.thumb_highlight_color.isProvided() ? p.thumb_highlight_color() : gFocusMgr.getFocusColor(); + mThumbHighlightColor = p.thumb_highlight_color.isProvided() ? p.thumb_highlight_color() : static_cast(gFocusMgr.getFocusColor()); } LLMultiSlider::~LLMultiSlider() -- cgit v1.2.3 From 8290206887972bcd3d3acac0a02d9df37a82e637 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 14 Sep 2018 17:52:08 +0300 Subject: SL-9653 Multy slider edge overlap cases --- indra/llui/llmultislider.cpp | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index ef907e620e..c35b7c5496 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -177,13 +177,15 @@ void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from // increment is our distance between points, use to eliminate round error F32 threshold = mOverlapThreshold + (mIncrement / 4); // If loop overlap is enabled, check if we overlap with points 'after' max value (project to lower) - F32 loop_up_check = (mLoopOverlap && (value + threshold) > mMaxValue) ? (value + threshold - mMaxValue + mMinValue) : 0.0f; + F32 loop_up_check = (mLoopOverlap && (value + threshold) > mMaxValue) ? (value + threshold - mMaxValue + mMinValue) : mMinValue - 1.0f; // If loop overlap is enabled, check if we overlap with points 'before' min value (project to upper) - F32 loop_down_check = (mLoopOverlap && (value - threshold) < mMinValue) ? (value - threshold - mMinValue + mMaxValue) : 0.0f; + F32 loop_down_check = (mLoopOverlap && (value - threshold) < mMinValue) ? (value - threshold - mMinValue + mMaxValue) : mMaxValue + 1.0f; - for(;mIt != mValue.endMap(); mIt++) { - - F32 testVal = (F32)mIt->second.asReal() - newValue; + for(;mIt != mValue.endMap(); mIt++) + { + F32 locationVal = (F32)mIt->second.asReal(); + // Check nearby values + F32 testVal = locationVal - newValue; if (testVal > -threshold && testVal < threshold && mIt->first != name) @@ -191,17 +193,19 @@ void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from hit = true; break; } - if (loop_up_check != 0 - && testVal < loop_up_check) - { - hit = true; - break; - } - if (loop_down_check != 0 - && testVal > loop_down_check) + if (mLoopOverlap) { - hit = true; - break; + // Check edge overlap values + if (locationVal < loop_up_check) + { + hit = true; + break; + } + if (locationVal > loop_down_check) + { + hit = true; + break; + } } } -- cgit v1.2.3 From 92dc9ceb834dd31aa6fe1c67b9ea896a62cd7c7c Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 24 Sep 2018 16:36:01 +0300 Subject: SL-9676 EEP Pick:SELECT SETTINGS limit folder operations options --- indra/llui/llfolderview.cpp | 25 ++++++++++++++++++++++--- indra/llui/llfolderview.h | 8 ++++++-- 2 files changed, 28 insertions(+), 5 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 895753aeae..9d0f4b6db1 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -149,6 +149,7 @@ LLFolderView::Params::Params() use_label_suffix("use_label_suffix"), allow_multiselect("allow_multiselect", true), show_empty_message("show_empty_message", true), + suppress_folder_menu("suppress_folder_menu", false), use_ellipses("use_ellipses", false), options_menu("options_menu", "") { @@ -167,6 +168,7 @@ LLFolderView::LLFolderView(const Params& p) mRenameItem( NULL ), mNeedsScroll( FALSE ), mUseLabelSuffix(p.use_label_suffix), + mSuppressFolderMenu(p.suppress_folder_menu), mPinningSelectedItem(FALSE), mNeedsAutoSelect( FALSE ), mAutoSelectOverride(FALSE), @@ -1432,10 +1434,13 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) BOOL handled = childrenHandleRightMouseDown(x, y, mask) != NULL; S32 count = mSelectedItems.size(); + LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get(); - if ( handled + bool hide_folder_menu = mSuppressFolderMenu && isFolderSelected(); + if ((handled && ( count > 0 && (hasVisibleChildren()) ) // show menu only if selected items are visible - && menu ) + && menu ) && + !hide_folder_menu) { if (mCallbackRegistrar) { @@ -1449,7 +1454,7 @@ BOOL LLFolderView::handleRightMouseDown( S32 x, S32 y, MASK mask ) if (mCallbackRegistrar) { mCallbackRegistrar->popScope(); - } + } } else { @@ -1862,6 +1867,20 @@ void LLFolderView::updateMenu() } } +bool LLFolderView::isFolderSelected() +{ + selected_items_t::iterator item_iter; + for (item_iter = mSelectedItems.begin(); item_iter != mSelectedItems.end(); ++item_iter) + { + LLFolderViewFolder* folder = dynamic_cast(*item_iter); + if (folder != NULL) + { + return true; + } + } + return false; +} + bool LLFolderView::selectFirstItem() { for (folders_t::iterator iter = mFolders.begin(); diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index 2926e160d0..69824992c1 100644 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -92,7 +92,8 @@ public: allow_multiselect, show_empty_message, use_ellipses, - show_item_link_overlays; + show_item_link_overlays, + suppress_folder_menu; Mandatory view_model; Optional grouped_item_model; Mandatory options_menu; @@ -259,6 +260,8 @@ protected: void closeRenamer( void ); + bool isFolderSelected(); + bool selectFirstItem(); bool selectLastItem(); @@ -282,7 +285,8 @@ protected: mDragAndDropThisFrame, mShowItemLinkOverlays, mShowSelectionContext, - mShowSingleSelection; + mShowSingleSelection, + mSuppressFolderMenu; // Renaming variables and methods LLFolderViewItem* mRenameItem; // The item currently being renamed -- cgit v1.2.3 From 6fff70222b60674f0e3cc531e402afb9e7c184e3 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 5 Oct 2018 18:05:36 +0300 Subject: SL-9818 [EEP] Single click on Cloud Scroll number input field doesn't select it --- indra/llui/llxyvector.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llxyvector.cpp b/indra/llui/llxyvector.cpp index 48f38b8a92..9d5823e368 100644 --- a/indra/llui/llxyvector.cpp +++ b/indra/llui/llxyvector.cpp @@ -289,7 +289,14 @@ BOOL LLXYVector::handleMouseUp(S32 x, S32 y, MASK mask) make_ui_sound("UISndClickRelease"); } - return TRUE; + if (mTouchArea->getRect().pointInRect(x, y)) + { + return TRUE; + } + else + { + return LLUICtrl::handleMouseUp(x, y, mask); + } } BOOL LLXYVector::handleMouseDown(S32 x, S32 y, MASK mask) @@ -299,8 +306,12 @@ BOOL LLXYVector::handleMouseDown(S32 x, S32 y, MASK mask) { gFocusMgr.setMouseCapture(this); make_ui_sound("UISndClick"); - } - return TRUE; + return TRUE; + } + else + { + return LLUICtrl::handleMouseDown(x, y, mask); + } } -- cgit v1.2.3 From b030d7036f87d30babb4a8df8d256113f46182e9 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 5 Oct 2018 19:31:35 +0300 Subject: SL-1961 EEP correct disabling of altitude multislider and cleanup --- indra/llui/llmultislider.cpp | 18 ++++++++++++++++-- indra/llui/llslider.cpp | 2 -- indra/llui/llslider.h | 4 +--- 3 files changed, 17 insertions(+), 7 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index c35b7c5496..ece6edd285 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -731,7 +731,14 @@ void LLMultiSlider::draw() // the draw command if (mThumbImagep) { - mThumbImagep->draw(mIt->second); + if (getEnabled()) + { + mThumbImagep->draw(mIt->second); + } + else + { + mThumbImagep->draw(mIt->second, LLColor4::grey % 0.8f); + } } else if (capture == this) { @@ -748,7 +755,14 @@ void LLMultiSlider::draw() { if (mThumbImagep) { - mThumbImagep->draw(curSldrIt->second); + if (getEnabled()) + { + mThumbImagep->draw(curSldrIt->second); + } + else + { + mThumbImagep->draw(curSldrIt->second, LLColor4::grey % 0.8f); + } } else if (capture == this) { diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp index 6925c0a130..62df5a2c38 100644 --- a/indra/llui/llslider.cpp +++ b/indra/llui/llslider.cpp @@ -42,7 +42,6 @@ static LLDefaultChildRegistry::Register r1("slider_bar"); LLSlider::Params::Params() : orientation ("orientation", std::string ("horizontal")), - track_color("track_color"), thumb_outline_color("thumb_outline_color"), thumb_center_color("thumb_center_color"), thumb_image("thumb_image"), @@ -60,7 +59,6 @@ LLSlider::LLSlider(const LLSlider::Params& p) : LLF32UICtrl(p), mMouseOffset( 0 ), mOrientation ((p.orientation() == "horizontal") ? HORIZONTAL : VERTICAL), - mTrackColor(p.track_color()), mThumbOutlineColor(p.thumb_outline_color()), mThumbCenterColor(p.thumb_center_color()), mThumbImage(p.thumb_image), diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h index 3b492d8182..484a5373b3 100644 --- a/indra/llui/llslider.h +++ b/indra/llui/llslider.h @@ -38,8 +38,7 @@ public: { Optional orientation; - Optional track_color, - thumb_outline_color, + Optional thumb_outline_color, thumb_center_color; Optional thumb_image, @@ -99,7 +98,6 @@ private: const EOrientation mOrientation; LLRect mThumbRect; - LLUIColor mTrackColor; LLUIColor mThumbOutlineColor; LLUIColor mThumbCenterColor; -- cgit v1.2.3 From 49f4b68b31a8299fc1b796102bea6da6de8b6115 Mon Sep 17 00:00:00 2001 From: AndreyL ProductEngine Date: Tue, 23 Oct 2018 10:15:04 +0300 Subject: SL-9941 EEP XY_Vector improvement - logarithmic scale mode --- indra/llui/llxyvector.cpp | 72 +++++++++++++++++++++++++++++------------------ indra/llui/llxyvector.h | 4 +++ 2 files changed, 49 insertions(+), 27 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llxyvector.cpp b/indra/llui/llxyvector.cpp index 9d5823e368..08dedc157b 100644 --- a/indra/llui/llxyvector.cpp +++ b/indra/llui/llxyvector.cpp @@ -37,6 +37,8 @@ #include "lluictrlfactory.h" #include "llrender.h" +#include "llmath.h" + // Globals static LLDefaultChildRegistry::Register register_xy_vector("xy_vector"); @@ -63,7 +65,8 @@ LLXYVector::Params::Params() arrow_color("arrow_color", LLColor4::white), ghost_color("ghost_color"), area_color("area_color", LLColor4::grey4), - grid_color("grid_color", LLColor4::grey % 0.25f) + grid_color("grid_color", LLColor4::grey % 0.25f), + logarithmic("logarithmic", FALSE) { } @@ -77,7 +80,8 @@ LLXYVector::LLXYVector(const LLXYVector::Params& p) mIncrementX(p.increment_x), mMinValueY(p.min_val_y), mMaxValueY(p.max_val_y), - mIncrementY(p.increment_y) + mIncrementY(p.increment_y), + mLogarithmic(p.logarithmic) { mGhostColor = p.ghost_color.isProvided() ? p.ghost_color() % 0.3f : p.arrow_color() % 0.3f; @@ -138,6 +142,9 @@ LLXYVector::~LLXYVector() BOOL LLXYVector::postBuild() { + mLogScaleX = (2 * log(mMaxValueX)) / mTouchArea->getRect().getWidth(); + mLogScaleY = (2 * log(mMaxValueY)) / mTouchArea->getRect().getHeight(); + return TRUE; } @@ -165,9 +172,24 @@ void LLXYVector::draw() { S32 centerX = mTouchArea->getRect().getCenterX(); S32 centerY = mTouchArea->getRect().getCenterY(); + S32 pointX; + S32 pointY; + + if (mLogarithmic) + { + pointX = (log(llabs(mValueX) + 1)) / mLogScaleX; + pointX *= (mValueX < 0) ? -1 : 1; + pointX += centerX; - S32 pointX = centerX + (mValueX * mTouchArea->getRect().getWidth() / (2 * mMaxValueX)); - S32 pointY = centerY + (mValueY * mTouchArea->getRect().getHeight() / (2 * mMaxValueY)); + pointY = (log(llabs(mValueY) + 1)) / mLogScaleY; + pointY *= (mValueY < 0) ? -1 : 1; + pointY += centerY; + } + else // linear + { + pointX = centerX + (mValueX * mTouchArea->getRect().getWidth() / (2 * mMaxValueX)); + pointY = centerY + (mValueY * mTouchArea->getRect().getHeight() / (2 * mMaxValueY)); + } // fill gl_rect_2d(mTouchArea->getRect(), mAreaColor, true); @@ -222,22 +244,8 @@ void LLXYVector::setValue(const LLSD& value) void LLXYVector::setValue(F32 x, F32 y) { - x = llclamp(x, mMinValueX, mMaxValueX); - y = llclamp(y, mMinValueY, mMaxValueY); - - // Round the values to nearest increments - x -= mMinValueX; - x += mIncrementX / 2.0001f; - x -= fmod(x, mIncrementX); - x += mMinValueX; - - y -= mMinValueY; - y += mIncrementY / 2.0001f; - y -= fmod(y, mIncrementY); - y += mMinValueY; - - mValueX = x; - mValueY = y; + mValueX = ll_round(llclamp(x, mMinValueX, mMaxValueX), mIncrementX); + mValueY = ll_round(llclamp(y, mMinValueY, mMaxValueY), mIncrementY); update(); } @@ -269,13 +277,23 @@ BOOL LLXYVector::handleHover(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { - F32 valueX = F32(x - mTouchArea->getRect().getCenterX()) / mTouchArea->getRect().getWidth(); - F32 valueY = F32(y - mTouchArea->getRect().getCenterY()) / mTouchArea->getRect().getHeight(); - - valueX *= 2 * mMaxValueX; - valueY *= 2 * mMaxValueY; - - setValueAndCommit(valueX, valueY); + if (mLogarithmic) + { + F32 valueX = llfastpow(F_E, mLogScaleX*(llabs(x - mTouchArea->getRect().getCenterX()))) - 1; + valueX *= (x < mTouchArea->getRect().getCenterX()) ? -1 : 1; + + F32 valueY = llfastpow(F_E, mLogScaleY*(llabs(y - mTouchArea->getRect().getCenterY()))) - 1; + valueY *= (y < mTouchArea->getRect().getCenterY()) ? -1 : 1; + + setValueAndCommit(valueX, valueY); + } + else //linear + { + F32 valueX = 2 * mMaxValueX * F32(x - mTouchArea->getRect().getCenterX()) / mTouchArea->getRect().getWidth(); + F32 valueY = 2 * mMaxValueY * F32(y - mTouchArea->getRect().getCenterY()) / mTouchArea->getRect().getHeight(); + + setValueAndCommit(valueX, valueY); + } } return TRUE; diff --git a/indra/llui/llxyvector.h b/indra/llui/llxyvector.h index 4d67db3251..bb3822dd26 100644 --- a/indra/llui/llxyvector.h +++ b/indra/llui/llxyvector.h @@ -59,6 +59,7 @@ public: Optional ghost_color; Optional area_color; Optional grid_color; + Optional logarithmic; Params(); }; @@ -112,6 +113,9 @@ private: LLUIColor mAreaColor; LLUIColor mGridColor; + BOOL mLogarithmic; + F32 mLogScaleX; + F32 mLogScaleY; }; #endif -- cgit v1.2.3 From 58ffb2e4b11d7aaf1fb66531f4925bd359f551cb Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Thu, 29 Nov 2018 17:55:23 +0200 Subject: SL-10141 FIXED [EEP] Neighboring sky levels may be closer than 100 meters to each other in edit mode --- indra/llui/llmultislider.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index ece6edd285..9a7b6f9f6b 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -113,9 +113,9 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p) setMouseUpCallback(initCommitCallback(p.mouse_up_callback)); } - if (p.overlap_threshold.isProvided()) + if (p.overlap_threshold.isProvided() && p.overlap_threshold > mIncrement) { - mOverlapThreshold = p.overlap_threshold; + mOverlapThreshold = p.overlap_threshold - mIncrement; } else { -- cgit v1.2.3 From 6762c4515a9b0f98164d6efd191abec5ca4dd211 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 7 Dec 2018 17:10:05 +0200 Subject: SL-1894 When crossing regions altitude slider could misbehave --- indra/llui/llmultislider.cpp | 8 +++++--- indra/llui/llmultislider.h | 3 ++- indra/llui/llmultisliderctrl.cpp | 11 +++++++++++ indra/llui/llmultisliderctrl.h | 2 ++ 4 files changed, 20 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 9a7b6f9f6b..ed93b3d44c 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -354,17 +354,17 @@ const std::string& LLMultiSlider::addSlider(F32 val) return mCurSlider; } -void LLMultiSlider::addSlider(F32 val, const std::string& name) +bool LLMultiSlider::addSlider(F32 val, const std::string& name) { F32 initVal = val; if(mValue.size() >= mMaxNumSliders) { - return; + return false; } bool foundOne = findUnusedValue(initVal); if(!foundOne) { - return; + return false; } // add a new thumb rect @@ -383,6 +383,8 @@ void LLMultiSlider::addSlider(F32 val, const std::string& name) // move the slider setSliderValue(mCurSlider, initVal, TRUE); + + return true; } bool LLMultiSlider::findUnusedValue(F32& initVal) diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 52c6d1ddef..50cf62e9c5 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -96,7 +96,7 @@ public: bool findUnusedValue(F32& initVal); const std::string& addSlider(); const std::string& addSlider(F32 val); - void addSlider(F32 val, const std::string& name); + bool addSlider(F32 val, const std::string& name); void deleteSlider(const std::string& name); void deleteCurSlider() { deleteSlider(mCurSlider); } void clear(); @@ -109,6 +109,7 @@ public: S32 getMaxNumSliders() { return mMaxNumSliders; } S32 getCurNumSliders() { return mValue.size(); } + F32 getOverlapThreshold() { return mOverlapThreshold; } bool canAddSliders() { return mValue.size() < mMaxNumSliders; } protected: diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index 972567ef9b..20e2b569f1 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -293,6 +293,17 @@ const std::string& LLMultiSliderCtrl::addSlider(F32 val) return name; } +bool LLMultiSliderCtrl::addSlider(F32 val, const std::string& name) +{ + bool res = mMultiSlider->addSlider(val, name); + if (res) + { + mCurValue = mMultiSlider->getCurSliderValue(); + updateText(); + } + return res; +} + void LLMultiSliderCtrl::deleteSlider(const std::string& name) { mMultiSlider->deleteSlider(name); diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index c370ebf505..75715d6043 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -112,6 +112,7 @@ public: /// for adding and deleting sliders const std::string& addSlider(); const std::string& addSlider(F32 val); + bool addSlider(F32 val, const std::string& name); void deleteSlider(const std::string& name); void deleteCurSlider() { deleteSlider(mMultiSlider->getCurSlider()); } @@ -120,6 +121,7 @@ public: S32 getMaxNumSliders() { return mMultiSlider->getMaxNumSliders(); } S32 getCurNumSliders() { return mMultiSlider->getCurNumSliders(); } + F32 getOverlapThreshold() { return mMultiSlider->getOverlapThreshold(); } bool canAddSliders() { return mMultiSlider->canAddSliders(); } void setLabel(const std::string& label) { if (mLabelBox) mLabelBox->setText(label); } -- cgit v1.2.3 From 8227a0b270f6e7cc521adeb7b97ad2d5fb646973 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 21 Dec 2018 15:30:57 -0800 Subject: SL-10279: Rework the environment pannel. Still in progress. --- indra/llui/llmultislider.cpp | 9 +++++++++ indra/llui/llmultislider.h | 1 + indra/llui/llmultisliderctrl.h | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index ed93b3d44c..f30ce28b9d 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -306,6 +306,15 @@ F32 LLMultiSlider::getSliderValueFromPos(S32 xpos, S32 ypos) const return((t * (mMaxValue - mMinValue)) + mMinValue); } + +LLRect LLMultiSlider::getSliderThumbRect(const std::string& name) const +{ + auto it = mThumbRects.find(name); + if (it != mThumbRects.end()) + return (*it).second; + return LLRect(); +} + void LLMultiSlider::resetCurSlider() { mCurSlider = LLStringUtil::null; diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 50cf62e9c5..b4331e11c0 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -80,6 +80,7 @@ public: void setSliderValue(const std::string& name, F32 value, BOOL from_event = FALSE); F32 getSliderValue(const std::string& name) const; F32 getSliderValueFromPos(S32 xpos, S32 ypos) const; + LLRect getSliderThumbRect(const std::string& name) const; const std::string& getCurSlider() const { return mCurSlider; } F32 getCurSliderValue() const { return getSliderValue(mCurSlider); } diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index 75715d6043..20d204a6dc 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -107,7 +107,8 @@ public: void setMaxValue(F32 max_value) {mMultiSlider->setMaxValue(max_value);} void setIncrement(F32 increment) {mMultiSlider->setIncrement(increment);} - F32 getSliderValueFromPos(S32 x, S32 y) const { return mMultiSlider->getSliderValueFromPos(x, y); } + F32 getSliderValueFromPos(S32 x, S32 y) const { return mMultiSlider->getSliderValueFromPos(x, y); } + LLRect getSliderThumbRect(const std::string &name) const { return mMultiSlider->getSliderThumbRect(name); } /// for adding and deleting sliders const std::string& addSlider(); -- cgit v1.2.3 From d607d81dba25dfe7dd1ecdf123af656ca939924f Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Wed, 2 Jan 2019 17:10:15 -0800 Subject: SL-10279: Temp fix for stale estate info when editing parcel environment. --- indra/llui/llmultislider.cpp | 15 +++++++++++++++ indra/llui/llmultislider.h | 5 +++++ indra/llui/llmultisliderctrl.h | 3 +++ 3 files changed, 23 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index f30ce28b9d..61e8bdd38c 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -315,6 +315,21 @@ LLRect LLMultiSlider::getSliderThumbRect(const std::string& name) const return LLRect(); } +void LLMultiSlider::setSliderThumbImage(const std::string &name) +{ + if (!name.empty()) + { + mThumbImagep = LLUI::getUIImage(name); + } + else + clearSliderThumbImage(); +} + +void LLMultiSlider::clearSliderThumbImage() +{ + mThumbImagep = NULL; +} + void LLMultiSlider::resetCurSlider() { mCurSlider = LLStringUtil::null; diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index b4331e11c0..b0fca2597d 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -82,6 +82,10 @@ public: F32 getSliderValueFromPos(S32 xpos, S32 ypos) const; LLRect getSliderThumbRect(const std::string& name) const; + void setSliderThumbImage(const std::string &name); + void clearSliderThumbImage(); + + const std::string& getCurSlider() const { return mCurSlider; } F32 getCurSliderValue() const { return getSliderValue(mCurSlider); } void setCurSlider(const std::string& name); @@ -113,6 +117,7 @@ public: F32 getOverlapThreshold() { return mOverlapThreshold; } bool canAddSliders() { return mValue.size() < mMaxNumSliders; } + protected: LLSD mValue; std::string mCurSlider; diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index 20d204a6dc..e16737b3c7 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -110,6 +110,9 @@ public: F32 getSliderValueFromPos(S32 x, S32 y) const { return mMultiSlider->getSliderValueFromPos(x, y); } LLRect getSliderThumbRect(const std::string &name) const { return mMultiSlider->getSliderThumbRect(name); } + void setSliderThumbImage(const std::string &name) { mMultiSlider->setSliderThumbImage(name); } + void clearSliderThumbImage() { mMultiSlider->clearSliderThumbImage(); } + /// for adding and deleting sliders const std::string& addSlider(); const std::string& addSlider(F32 val); -- cgit v1.2.3 From 64e45b5b6ef8ded7bbea1b376e5bf2cbb0d6f5a4 Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 4 Jan 2019 17:10:28 -0800 Subject: SL-10041, SL-9758: Environment tab is disabled(shows can't do this) when EM does not allow parcel override. "Commit" button now reads "Apply to Parcel" or "Apply to Region" as needed. --- indra/llui/llmenugl.cpp | 22 ++++++++++++++++++++++ indra/llui/llmenugl.h | 3 +++ 2 files changed, 25 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 0d42f726fa..ddcce61123 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -2713,6 +2713,15 @@ void LLMenuGL::setItemVisible( const std::string& name, BOOL visible ) } } + +void LLMenuGL::setItemLabel(const std::string &name, const std::string &label) +{ + LLMenuItemGL *item = getItem(name); + + if (item) + item->setLabel(label); +} + void LLMenuGL::setItemLastSelected(LLMenuItemGL* item) { if (getVisible()) @@ -2757,6 +2766,19 @@ LLMenuItemGL* LLMenuGL::getItem(S32 number) return NULL; } +LLMenuItemGL* LLMenuGL::getItem(std::string name) +{ + item_list_t::iterator item_iter; + for (item_iter = mItems.begin(); item_iter != mItems.end(); ++item_iter) + { + if ((*item_iter)->getName() == name) + { + return (*item_iter); + } + } + return NULL; +} + LLMenuItemGL* LLMenuGL::getHighlightedItem() { item_list_t::iterator item_iter; diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 69f7d21513..6ca581fa86 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -463,6 +463,8 @@ public: void setEnabledSubMenus(BOOL enable); void setItemVisible( const std::string& name, BOOL visible); + + void setItemLabel(const std::string &name, const std::string &label); // sets the left,bottom corner of menu, useful for popups void setLeftAndBottom(S32 left, S32 bottom); @@ -493,6 +495,7 @@ public: void setItemLastSelected(LLMenuItemGL* item); // must be in menu U32 getItemCount(); // number of menu items LLMenuItemGL* getItem(S32 number); // 0 = first item + LLMenuItemGL* getItem(std::string name); LLMenuItemGL* getHighlightedItem(); LLMenuItemGL* highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disabled = TRUE); -- cgit v1.2.3 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 ++++ 2 files changed, 41 insertions(+) (limited to 'indra/llui') 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; -- cgit v1.2.3 From ac865de287b2e740acd9f6a8724301146df73ccf Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 25 Jan 2019 22:02:16 +0200 Subject: SL-1945 Day Cycle Editor Copy Track --- indra/llui/llfloater.cpp | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ indra/llui/llfloater.h | 13 +++++++++ 2 files changed, 82 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index a245dd8f78..d6c2c7bc55 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -37,6 +37,7 @@ #include "lluictrlfactory.h" #include "llbutton.h" #include "llcheckboxctrl.h" +#include "llcriticaldamp.h" // LLSmoothInterpolation #include "lldir.h" #include "lldraghandle.h" #include "llfloaterreg.h" @@ -64,6 +65,10 @@ // use this to control "jumping" behavior when Ctrl-Tabbing const S32 TABBED_FLOATER_OFFSET = 0; +const F32 LLFloater::CONTEXT_CONE_IN_ALPHA = 0.0f; +const F32 LLFloater::CONTEXT_CONE_OUT_ALPHA = 1.f; +const F32 LLFloater::CONTEXT_CONE_FADE_TIME = 0.08f; + namespace LLInitParam { void TypeValues::declareValues() @@ -2116,6 +2121,70 @@ void LLFloater::updateTitleButtons() } } +void LLFloater::drawConeToOwner(F32 &context_cone_opacity, + F32 max_cone_opacity, + LLView *owner_view, + F32 fade_time, + F32 contex_cone_in_alpha, + F32 contex_cone_out_alpha) +{ + if (owner_view + && owner_view->isInVisibleChain() + && hasFocus() + && context_cone_opacity > 0.001f + && gFocusMgr.childHasKeyboardFocus(this)) + { + // draw cone of context pointing back to owner (e.x. texture swatch) + LLRect owner_rect; + owner_view->localRectToOtherView(owner_view->getLocalRect(), &owner_rect, this); + LLRect local_rect = getLocalRect(); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + LLGLEnable(GL_CULL_FACE); + gGL.begin(LLRender::QUADS); + { + gGL.color4f(0.f, 0.f, 0.f, contex_cone_in_alpha * context_cone_opacity); + gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); + gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); + gGL.color4f(0.f, 0.f, 0.f, contex_cone_out_alpha * context_cone_opacity); + gGL.vertex2i(local_rect.mRight, local_rect.mTop); + gGL.vertex2i(local_rect.mLeft, local_rect.mTop); + + gGL.color4f(0.f, 0.f, 0.f, contex_cone_out_alpha * context_cone_opacity); + gGL.vertex2i(local_rect.mLeft, local_rect.mTop); + gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); + gGL.color4f(0.f, 0.f, 0.f, contex_cone_in_alpha * context_cone_opacity); + gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); + gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); + + gGL.color4f(0.f, 0.f, 0.f, contex_cone_out_alpha * context_cone_opacity); + gGL.vertex2i(local_rect.mRight, local_rect.mBottom); + gGL.vertex2i(local_rect.mRight, local_rect.mTop); + gGL.color4f(0.f, 0.f, 0.f, contex_cone_in_alpha * context_cone_opacity); + gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); + gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); + + + gGL.color4f(0.f, 0.f, 0.f, contex_cone_out_alpha * context_cone_opacity); + gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); + gGL.vertex2i(local_rect.mRight, local_rect.mBottom); + gGL.color4f(0.f, 0.f, 0.f, contex_cone_in_alpha * context_cone_opacity); + gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); + gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); + } + gGL.end(); + } + + if (gFocusMgr.childHasMouseCapture(getDragHandle())) + { + context_cone_opacity = lerp(context_cone_opacity, max_cone_opacity, LLSmoothInterpolation::getInterpolant(fade_time)); + } + else + { + context_cone_opacity = lerp(context_cone_opacity, 0.f, LLSmoothInterpolation::getInterpolant(fade_time)); + } +} + void LLFloater::buildButtons(const Params& floater_params) { static LLUICachedControl floater_close_box_size ("UIFloaterCloseBoxSize", 0); diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 165f67499b..f8c04e8a2f 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -395,6 +395,15 @@ protected: virtual void updateTitleButtons(); + // Draws a cone from this floater to parent floater or view (owner) + // Modifies context_cone_opacity (interpolates according to fade time and returns new value) + void drawConeToOwner(F32 &context_cone_opacity, + F32 max_cone_opacity, + LLView *owner_view, + F32 context_fade_time = CONTEXT_CONE_FADE_TIME, + F32 contex_cone_in_alpha = CONTEXT_CONE_IN_ALPHA, + F32 contex_cone_out_alpha = CONTEXT_CONE_OUT_ALPHA); + private: void setForeground(BOOL b); // called only by floaterview void cleanupHandles(); // remove handles to dead floaters @@ -424,6 +433,10 @@ private: void updateTransparency(LLView* view, ETypeTransparency transparency_type); public: + static const F32 CONTEXT_CONE_IN_ALPHA; + static const F32 CONTEXT_CONE_OUT_ALPHA; + static const F32 CONTEXT_CONE_FADE_TIME; + // Called when floater is opened, passes mKey // Public so external views or floaters can watch for this floater opening commit_signal_t mOpenSignal; -- cgit v1.2.3 From 347ae7a38bb2535bac4d3c497e216e3178c6e966 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Tue, 29 Jan 2019 16:49:16 +0200 Subject: SL-10430 FIXED Slider control rendering broken --- indra/llui/llsliderctrl.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index c3c3ce04f9..3b89a8ca63 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -300,6 +300,10 @@ void LLSliderCtrl::updateSliderRect() right -= editor_width + sliderctrl_spacing; } + if (mTextBox) + { + right -= mTextBox->getRect().getWidth() + sliderctrl_spacing; + } if (mLabelBox) { left += mLabelBox->getRect().getWidth() + sliderctrl_spacing; -- cgit v1.2.3 From 531ad5b3ec1b6785bf6cde04c1d7203233b552a2 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 31 Jan 2019 18:45:01 +0200 Subject: SL-1531 EEP Visual feedback on the timeline --- indra/llui/llmultislider.cpp | 102 +++++++++++++++++++++++++++++++++++-------- indra/llui/llmultislider.h | 2 + 2 files changed, 85 insertions(+), 19 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 61e8bdd38c..b8f0a01b86 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -497,14 +497,6 @@ BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask) { if( gFocusMgr.getMouseCapture() == this ) { -// S32 left_edge = mThumbWidth/2; -// S32 right_edge = getRect().getWidth() - (mThumbWidth/2); -// -// x += mMouseOffset; -// x = llclamp( x, left_edge, right_edge ); -// -// F32 t = F32(x - left_edge) / (right_edge - left_edge); -// setCurSliderValue(t * (mMaxValue - mMinValue) + mMinValue ); setCurSliderValue(getSliderValueFromPos(x, y)); onCommit(); @@ -513,6 +505,27 @@ BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask) } else { + if (getEnabled()) + { + if (mHoverSlider.empty() || !getSliderThumbRect(mHoverSlider).pointInRect(x, y)) + { + mHoverSlider.clear(); + std::map::iterator mIt = mThumbRects.begin(); + for (; mIt != mThumbRects.end(); mIt++) + { + if (mIt->second.pointInRect(x, y)) + { + mHoverSlider = mIt->first; + break; + } + } + } + } + else + { + mHoverSlider.clear(); + } + getWindow()->setCursor(UI_CURSOR_ARROW); LL_DEBUGS("UserInput") << "hover handled by " << getName() << " (inactive)" << LL_ENDL; } @@ -625,6 +638,13 @@ BOOL LLMultiSlider::handleKeyHere(KEY key, MASK mask) return handled; } +/*virtual*/ +void LLMultiSlider::onMouseLeave(S32 x, S32 y, MASK mask) +{ + mHoverSlider.clear(); + LLF32UICtrl::onMouseLeave(x, y, mask); +} + void LLMultiSlider::draw() { static LLUICachedControl extra_triangle_height ("UIExtraTriangleHeight", 0); @@ -633,6 +653,7 @@ void LLMultiSlider::draw() std::map::iterator mIt; std::map::iterator curSldrIt; + std::map::iterator hoverSldrIt; // Draw background and thumb. @@ -686,6 +707,7 @@ void LLMultiSlider::draw() { // draw all the thumbs curSldrIt = mThumbRects.end(); + hoverSldrIt = mThumbRects.end(); for(mIt = mThumbRects.begin(); mIt != mThumbRects.end(); mIt++) { // choose the color @@ -694,15 +716,21 @@ void LLMultiSlider::draw() curSldrIt = mIt; continue; - //curThumbColor = mThumbCenterSelectedColor; + } + if (mIt->first == mHoverSlider && getEnabled() && gFocusMgr.getMouseCapture() != this) + { + // draw last, after current one + hoverSldrIt = mIt; + continue; } // the draw command gl_rect_2d(mIt->second, curThumbColor, TRUE); } - // now draw the current slider - if(curSldrIt != mThumbRects.end()) { + // now draw the current and hover sliders + if(curSldrIt != mThumbRects.end()) + { gl_rect_2d(curSldrIt->second, mThumbCenterSelectedColor.get(), TRUE); } @@ -711,6 +739,10 @@ void LLMultiSlider::draw() { gl_rect_2d(mDragStartThumbRect, mThumbCenterColor.get() % opacity, FALSE); } + else if (hoverSldrIt != mThumbRects.end()) + { + gl_rect_2d(hoverSldrIt->second, mThumbCenterSelectedColor.get(), TRUE); + } } else { @@ -729,20 +761,35 @@ void LLMultiSlider::draw() } // draw the highlight - if (hasFocus() && !mCurSlider.empty()) + if (hasFocus()) { - if (mThumbImagep) + if (!mCurSlider.empty()) { - mThumbImagep->drawBorder(mThumbRects[mCurSlider], mThumbHighlightColor, gFocusMgr.getFocusFlashWidth()); - } - else - { - thumb_imagep->drawBorder(mThumbRects[mCurSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth()); + if (mThumbImagep) + { + mThumbImagep->drawBorder(mThumbRects[mCurSlider], mThumbHighlightColor, gFocusMgr.getFocusFlashWidth()); + } + else + { + thumb_imagep->drawBorder(mThumbRects[mCurSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth()); + } } } + if (!mHoverSlider.empty()) + { + if (mThumbImagep) + { + mThumbImagep->drawBorder(mThumbRects[mHoverSlider], mThumbHighlightColor, gFocusMgr.getFocusFlashWidth()); + } + else + { + thumb_imagep->drawBorder(mThumbRects[mHoverSlider], gFocusMgr.getFocusColor(), gFocusMgr.getFocusFlashWidth()); + } + } // draw the thumbs curSldrIt = mThumbRects.end(); + hoverSldrIt = mThumbRects.end(); for(mIt = mThumbRects.begin(); mIt != mThumbRects.end(); mIt++) { // choose the color @@ -753,6 +800,12 @@ void LLMultiSlider::draw() curSldrIt = mIt; continue; } + if (mIt->first == mHoverSlider && getEnabled() && gFocusMgr.getMouseCapture() != this) + { + // don't draw now, draw last, after current one + hoverSldrIt = mIt; + continue; + } // the draw command if (mThumbImagep) @@ -776,7 +829,7 @@ void LLMultiSlider::draw() } } - // draw cur slider last + // draw cur and hover slider last if(curSldrIt != mThumbRects.end()) { if (mThumbImagep) @@ -799,6 +852,17 @@ void LLMultiSlider::draw() thumb_imagep->drawSolid(curSldrIt->second, mThumbCenterSelectedColor.get() % opacity); } } + if(hoverSldrIt != mThumbRects.end()) + { + if (mThumbImagep) + { + mThumbImagep->draw(hoverSldrIt->second); + } + else + { + thumb_imagep->drawSolid(hoverSldrIt->second, mThumbCenterSelectedColor.get()); + } + } } LLF32UICtrl::draw(); diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index b0fca2597d..b85eec1e61 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -110,6 +110,7 @@ public: /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask) override; /*virtual*/ void draw(); S32 getMaxNumSliders() { return mMaxNumSliders; } @@ -121,6 +122,7 @@ public: protected: LLSD mValue; std::string mCurSlider; + std::string mHoverSlider; static S32 mNameCounter; S32 mMaxNumSliders; -- cgit v1.2.3 From 7469fdba800e9a5d282ddc16f034aca71a2e8764 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 31 Jan 2019 20:25:56 +0200 Subject: SL-1531 Mac build fix --- indra/llui/llmultislider.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index b85eec1e61..20c3437ec4 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -92,8 +92,8 @@ public: void resetCurSlider(); void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mCurSlider, val, from_event); } - /*virtual*/ void setValue(const LLSD& value); - /*virtual*/ LLSD getValue() const { return mValue; } + /*virtual*/ void setValue(const LLSD& value) override; + /*virtual*/ LLSD getValue() const override { return mValue; } boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ); @@ -104,14 +104,14 @@ public: bool addSlider(F32 val, const std::string& name); void deleteSlider(const std::string& name); void deleteCurSlider() { deleteSlider(mCurSlider); } - void clear(); + /*virtual*/ void clear() override; - /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); - /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); + /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) override; + /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask) override; + /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) override; + /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask) override; /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask) override; - /*virtual*/ void draw(); + /*virtual*/ void draw() override; S32 getMaxNumSliders() { return mMaxNumSliders; } S32 getCurNumSliders() { return mValue.size(); } -- cgit v1.2.3 From b7a1b499fd03bd6bfaef37dbdaa9db734dc293b5 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 1 Feb 2019 15:03:02 +0200 Subject: SL-1531 Hover highlight should be consistent with mouse selection --- indra/llui/llmultislider.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index b8f0a01b86..fbe0d3f065 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -507,17 +507,14 @@ BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask) { if (getEnabled()) { - if (mHoverSlider.empty() || !getSliderThumbRect(mHoverSlider).pointInRect(x, y)) + mHoverSlider.clear(); + std::map::iterator mIt = mThumbRects.begin(); + for (; mIt != mThumbRects.end(); mIt++) { - mHoverSlider.clear(); - std::map::iterator mIt = mThumbRects.begin(); - for (; mIt != mThumbRects.end(); mIt++) + if (mIt->second.pointInRect(x, y)) { - if (mIt->second.pointInRect(x, y)) - { - mHoverSlider = mIt->first; - break; - } + mHoverSlider = mIt->first; + break; } } } -- cgit v1.2.3 From c8d8414b3b2e83fbaffd6e48f55ca14a3cb27ca4 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Fri, 8 Feb 2019 19:06:20 +0200 Subject: SL-10509 EEP Settings Picker gets closed by drag&drop --- indra/llui/llfolderview.cpp | 2 ++ indra/llui/llfolderview.h | 3 +++ indra/llui/llfolderviewitem.cpp | 1 + 3 files changed, 6 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index 9d0f4b6db1..e38c5c1ef3 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -148,6 +148,7 @@ LLFolderView::Params::Params() : title("title"), use_label_suffix("use_label_suffix"), allow_multiselect("allow_multiselect", true), + allow_drag("allow_drag", true), show_empty_message("show_empty_message", true), suppress_folder_menu("suppress_folder_menu", false), use_ellipses("use_ellipses", false), @@ -163,6 +164,7 @@ LLFolderView::LLFolderView(const Params& p) mScrollContainer( NULL ), mPopupMenuHandle(), mAllowMultiSelect(p.allow_multiselect), + mAllowDrag(p.allow_drag), mShowEmptyMessage(p.show_empty_message), mShowFolderHierarchy(FALSE), mRenameItem( NULL ), diff --git a/indra/llui/llfolderview.h b/indra/llui/llfolderview.h index 69824992c1..6bb5e6c02e 100644 --- a/indra/llui/llfolderview.h +++ b/indra/llui/llfolderview.h @@ -90,6 +90,7 @@ public: Optional title; Optional use_label_suffix, allow_multiselect, + allow_drag, show_empty_message, use_ellipses, show_item_link_overlays, @@ -124,6 +125,7 @@ public: void setReshapeCallback(const signal_t::slot_type& cb) { mReshapeSignal.connect(cb); } bool getAllowMultiSelect() { return mAllowMultiSelect; } + bool getAllowDrag() { return mAllowDrag; } // Close all folders in the view void closeAllFolders(); @@ -274,6 +276,7 @@ protected: selected_items_t mSelectedItems; bool mKeyboardSelection, mAllowMultiSelect, + mAllowDrag, mShowEmptyMessage, mShowFolderHierarchy, mNeedsScroll, diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 0510e472c5..341399e980 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -557,6 +557,7 @@ BOOL LLFolderViewItem::handleHover( S32 x, S32 y, MASK mask ) LLFolderView* root = getRoot(); if( (x - mDragStartX) * (x - mDragStartX) + (y - mDragStartY) * (y - mDragStartY) > drag_and_drop_threshold() * drag_and_drop_threshold() + && root->getAllowDrag() && root->getCurSelectedItem() && root->startDrag()) { -- cgit v1.2.3 From 3a78da70ad14eab11218cc056c2a3703af1b9738 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 29 Mar 2019 17:39:19 +0200 Subject: SL-10833 FIXED [EEP] Text in the Sky Altitudes boxes is low contrast and difficult to read. --- indra/llui/lllineeditor.cpp | 57 ++++++++++++++++++++++++++------------------- indra/llui/lllineeditor.h | 7 +++++- 2 files changed, 39 insertions(+), 25 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index cfab6b7fc8..ee8c445afb 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -96,6 +96,8 @@ LLLineEditor::Params::Params() ignore_tab("ignore_tab", true), is_password("is_password", false), cursor_color("cursor_color"), + use_bg_color("use_bg_color", false), + bg_color("bg_color"), text_color("text_color"), text_readonly_color("text_readonly_color"), text_tentative_color("text_tentative_color"), @@ -150,10 +152,12 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p) mBgImageDisabled( p.background_image_disabled ), mBgImageFocused( p.background_image_focused ), mShowImageFocused( p.bg_image_always_focused ), + mUseBgColor(p.use_bg_color), mHaveHistory(FALSE), mReplaceNewlinesWithSpaces( TRUE ), mLabel(p.label), mCursorColor(p.cursor_color()), + mBgColor(p.bg_color()), mFgColor(p.text_color()), mReadOnlyFgColor(p.text_readonly_color()), mTentativeFgColor(p.text_tentative_color()), @@ -1681,37 +1685,42 @@ void LLLineEditor::doDelete() void LLLineEditor::drawBackground() { - bool has_focus = hasFocus(); - LLUIImage* image; - if ( mReadOnly ) - { - image = mBgImageDisabled; - } - else if ( has_focus || mShowImageFocused) + F32 alpha = getCurrentTransparency(); + if (mUseBgColor) { - image = mBgImageFocused; + gl_rect_2d(getLocalRect(), mBgColor % alpha, TRUE); } else { - image = mBgImage; - } - - if (!image) return; - - F32 alpha = getCurrentTransparency(); + bool has_focus = hasFocus(); + LLUIImage* image; + if (mReadOnly) + { + image = mBgImageDisabled; + } + else if (has_focus || mShowImageFocused) + { + image = mBgImageFocused; + } + else + { + image = mBgImage; + } - // optionally draw programmatic border - if (has_focus) - { - LLColor4 tmp_color = gFocusMgr.getFocusColor(); + if (!image) return; + // optionally draw programmatic border + if (has_focus) + { + LLColor4 tmp_color = gFocusMgr.getFocusColor(); + tmp_color.setAlpha(alpha); + image->drawBorder(0, 0, getRect().getWidth(), getRect().getHeight(), + tmp_color, + gFocusMgr.getFocusFlashWidth()); + } + LLColor4 tmp_color = UI_VERTEX_COLOR; tmp_color.setAlpha(alpha); - image->drawBorder(0, 0, getRect().getWidth(), getRect().getHeight(), - tmp_color, - gFocusMgr.getFocusFlashWidth()); + image->draw(getLocalRect(), tmp_color); } - LLColor4 tmp_color = UI_VERTEX_COLOR; - tmp_color.setAlpha(alpha); - image->draw(getLocalRect(), tmp_color); } void LLLineEditor::draw() diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index 287837a15c..a711ccefab 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -91,10 +91,12 @@ public: commit_on_focus_lost, ignore_tab, bg_image_always_focused, - is_password; + is_password, + use_bg_color; // colors Optional cursor_color, + bg_color, text_color, text_readonly_color, text_tentative_color, @@ -365,6 +367,7 @@ protected: LLTimer mTripleClickTimer; LLUIColor mCursorColor; + LLUIColor mBgColor; LLUIColor mFgColor; LLUIColor mReadOnlyFgColor; LLUIColor mTentativeFgColor; @@ -385,6 +388,8 @@ protected: BOOL mShowImageFocused; + bool mUseBgColor; + LLWString mPreeditWString; LLWString mPreeditOverwrittenWString; std::vector mPreeditPositions; -- cgit v1.2.3 From 07f380d61a8f939e672dd1b07cc871dc799bdbc2 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 3 Apr 2019 08:47:44 -0700 Subject: Fix random Xcode 10.2 failures from unused vars and references to local objects. Modified llwindowmacosx to pass some things by value instead. --- indra/llui/lllayoutstack.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 69246a2f57..ce8dbb1f66 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -510,7 +510,6 @@ LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const { if (!panelp) return NULL; - e_panel_list_t::const_iterator panel_it; BOOST_FOREACH(LLLayoutPanel* p, mPanels) { if (p == panelp) -- cgit v1.2.3 From f67fe8fce7d84bc8687d409311518565d97a5fc5 Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Thu, 2 May 2019 13:45:40 +0300 Subject: SL-10833 Restore missing code after a merge --- indra/llui/lllineeditor.cpp | 71 ++++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 33 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index f1914ee9c5..de6bb23783 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1690,39 +1690,44 @@ void LLLineEditor::doDelete() } -void LLLineEditor::drawBackground() -{ - bool has_focus = hasFocus(); - LLUIImage* image; - if ( mReadOnly ) - { - image = mBgImageDisabled; - } - else if ( has_focus || mShowImageFocused) - { - image = mBgImageFocused; - } - else - { - image = mBgImage; - } - - if (!image) return; - - F32 alpha = getCurrentTransparency(); - - // optionally draw programmatic border - if (has_focus) - { - LLColor4 tmp_color = gFocusMgr.getFocusColor(); - tmp_color.setAlpha(alpha); - image->drawBorder(0, 0, getRect().getWidth(), getRect().getHeight(), - tmp_color, - gFocusMgr.getFocusFlashWidth()); - } - LLColor4 tmp_color = UI_VERTEX_COLOR; - tmp_color.setAlpha(alpha); - image->draw(getLocalRect(), tmp_color); +void LLLineEditor::drawBackground() +{ + F32 alpha = getCurrentTransparency(); + if (mUseBgColor) + { + gl_rect_2d(getLocalRect(), mBgColor % alpha, TRUE); + } + else + { + bool has_focus = hasFocus(); + LLUIImage* image; + if (mReadOnly) + { + image = mBgImageDisabled; + } + else if (has_focus || mShowImageFocused) + { + image = mBgImageFocused; + } + else + { + image = mBgImage; + } + + if (!image) return; + // optionally draw programmatic border + if (has_focus) + { + LLColor4 tmp_color = gFocusMgr.getFocusColor(); + tmp_color.setAlpha(alpha); + image->drawBorder(0, 0, getRect().getWidth(), getRect().getHeight(), + tmp_color, + gFocusMgr.getFocusFlashWidth()); + } + LLColor4 tmp_color = UI_VERTEX_COLOR; + tmp_color.setAlpha(alpha); + image->draw(getLocalRect(), tmp_color); + } } void LLLineEditor::draw() -- cgit v1.2.3 From 24acb7d5c3b6c3af4d7d814b8ccb0b9652eb38d3 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 3 May 2019 14:58:51 -0700 Subject: Fix some line-endings to be newline only. --- indra/llui/lllineeditor.cpp | 76 ++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index de6bb23783..b9133c5a35 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -1690,44 +1690,44 @@ void LLLineEditor::doDelete() } -void LLLineEditor::drawBackground() -{ - F32 alpha = getCurrentTransparency(); - if (mUseBgColor) - { - gl_rect_2d(getLocalRect(), mBgColor % alpha, TRUE); - } - else - { - bool has_focus = hasFocus(); - LLUIImage* image; - if (mReadOnly) - { - image = mBgImageDisabled; - } - else if (has_focus || mShowImageFocused) - { - image = mBgImageFocused; - } - else - { - image = mBgImage; - } - - if (!image) return; - // optionally draw programmatic border - if (has_focus) - { - LLColor4 tmp_color = gFocusMgr.getFocusColor(); - tmp_color.setAlpha(alpha); - image->drawBorder(0, 0, getRect().getWidth(), getRect().getHeight(), - tmp_color, - gFocusMgr.getFocusFlashWidth()); - } - LLColor4 tmp_color = UI_VERTEX_COLOR; - tmp_color.setAlpha(alpha); - image->draw(getLocalRect(), tmp_color); - } +void LLLineEditor::drawBackground() +{ + F32 alpha = getCurrentTransparency(); + if (mUseBgColor) + { + gl_rect_2d(getLocalRect(), mBgColor % alpha, TRUE); + } + else + { + bool has_focus = hasFocus(); + LLUIImage* image; + if (mReadOnly) + { + image = mBgImageDisabled; + } + else if (has_focus || mShowImageFocused) + { + image = mBgImageFocused; + } + else + { + image = mBgImage; + } + + if (!image) return; + // optionally draw programmatic border + if (has_focus) + { + LLColor4 tmp_color = gFocusMgr.getFocusColor(); + tmp_color.setAlpha(alpha); + image->drawBorder(0, 0, getRect().getWidth(), getRect().getHeight(), + tmp_color, + gFocusMgr.getFocusFlashWidth()); + } + LLColor4 tmp_color = UI_VERTEX_COLOR; + tmp_color.setAlpha(alpha); + image->draw(getLocalRect(), tmp_color); + } } void LLLineEditor::draw() -- cgit v1.2.3 From 605c9c19661702755171669e2af846abe77d2a51 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Wed, 8 May 2019 11:42:31 -0700 Subject: Fix merge fail. --- indra/llui/llmenugl.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index aa87329020..1f11f26192 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -175,7 +175,12 @@ protected: // This function appends the character string representation of // the current accelerator key and mask to the provided string. void appendAcceleratorString( std::string& st ) const; - + + virtual std::string _getSearchText() const + { + return mLabel.getString(); + } + protected: KEY mAcceleratorKey; MASK mAcceleratorMask; -- cgit v1.2.3 From c1a586d7e459858d31ad1549a79294832dd8e62e Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Fri, 14 Jun 2019 17:53:43 +0300 Subject: SL-11425 FIXED [EEP] Wave vectors cross all over the Water tab if key frame is not selected. --- indra/llui/llxyvector.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llxyvector.cpp b/indra/llui/llxyvector.cpp index 08dedc157b..d7ba243e1d 100644 --- a/indra/llui/llxyvector.cpp +++ b/indra/llui/llxyvector.cpp @@ -81,7 +81,9 @@ LLXYVector::LLXYVector(const LLXYVector::Params& p) mMinValueY(p.min_val_y), mMaxValueY(p.max_val_y), mIncrementY(p.increment_y), - mLogarithmic(p.logarithmic) + mLogarithmic(p.logarithmic), + mValueX(0), + mValueY(0) { mGhostColor = p.ghost_color.isProvided() ? p.ghost_color() % 0.3f : p.arrow_color() % 0.3f; -- cgit v1.2.3 From db2c32285b95d3517ebcd1dbf84faa2872ab6428 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 25 Feb 2020 18:59:43 +0200 Subject: SL-12591 Fixed slider value comparison --- indra/llui/llmultislider.cpp | 18 +++++++++++------- indra/llui/llmultislider.h | 4 ++++ indra/llui/llmultisliderctrl.h | 1 + 3 files changed, 16 insertions(+), 7 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index fbe0d3f065..acfe4a0cba 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -149,6 +149,16 @@ LLMultiSlider::~LLMultiSlider() delete mMouseUpSignal; } +F32 LLMultiSlider::getNearestIncrement(F32 value) const +{ + value = llclamp(value, mMinValue, mMaxValue); + + // Round to nearest increment (bias towards rounding down) + value -= mMinValue; + value += mIncrement / 2.0001f; + value -= fmod(value, mIncrement); + return mMinValue + value; +} void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from_event) { @@ -157,13 +167,7 @@ void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from return; } - value = llclamp( value, mMinValue, mMaxValue ); - - // Round to nearest increment (bias towards rounding down) - value -= mMinValue; - value += mIncrement/2.0001f; - value -= fmod(value, mIncrement); - F32 newValue = mMinValue + value; + F32 newValue = getNearestIncrement(value); // now, make sure no overlap // if we want that diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index 20c3437ec4..99a78d6e09 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -77,6 +77,10 @@ protected: friend class LLUICtrlFactory; public: virtual ~LLMultiSlider(); + + // Multi-slider rounds values to nearest increments (bias towards rounding down) + F32 getNearestIncrement(F32 value) const; + void setSliderValue(const std::string& name, F32 value, BOOL from_event = FALSE); F32 getSliderValue(const std::string& name) const; F32 getSliderValueFromPos(S32 xpos, S32 ypos) const; diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index e16737b3c7..adb28676ec 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -107,6 +107,7 @@ public: void setMaxValue(F32 max_value) {mMultiSlider->setMaxValue(max_value);} void setIncrement(F32 increment) {mMultiSlider->setIncrement(increment);} + F32 getNearestIncrement(F32 value) const { return mMultiSlider->getNearestIncrement(value); } F32 getSliderValueFromPos(S32 x, S32 y) const { return mMultiSlider->getSliderValueFromPos(x, y); } LLRect getSliderThumbRect(const std::string &name) const { return mMultiSlider->getSliderThumbRect(name); } -- cgit v1.2.3