summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llmultislider.cpp102
-rw-r--r--indra/llui/llmultislider.h18
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp16
-rw-r--r--indra/newview/llfloatereditextdaycycle.h2
-rw-r--r--indra/newview/llfloaterfixedenvironment.cpp20
-rw-r--r--indra/newview/llfloaterfixedenvironment.h1
-rw-r--r--indra/newview/llpanelenvironment.cpp21
7 files changed, 136 insertions, 44 deletions
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<std::string, LLRect>::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<S32> extra_triangle_height ("UIExtraTriangleHeight", 0);
@@ -633,6 +653,7 @@ void LLMultiSlider::draw()
std::map<std::string, LLRect>::iterator mIt;
std::map<std::string, LLRect>::iterator curSldrIt;
+ std::map<std::string, LLRect>::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..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,13 +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*/ void draw();
+ /*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() override;
S32 getMaxNumSliders() { return mMaxNumSliders; }
S32 getCurNumSliders() { return mValue.size(); }
@@ -121,6 +122,7 @@ public:
protected:
LLSD mValue;
std::string mCurSlider;
+ std::string mHoverSlider;
static S32 mNameCounter;
S32 mMaxNumSliders;
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index aa16747fe3..c16eb11293 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -181,7 +181,7 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) :
mIsDirty(false),
mCanCopy(false),
mCanMod(false),
- mMakeNoTrans(false),
+ mCanTrans(false),
mCloneTrack(nullptr),
mLoadTrack(nullptr),
mClearTrack(nullptr)
@@ -325,7 +325,7 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key)
{
mCanCopy = true;
mCanMod = true;
- mMakeNoTrans = false;
+ mCanTrans = true;
setEditDefaultDayCycle();
}
@@ -1394,7 +1394,7 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId)
mInventoryId.setNull();
mCanCopy = true;
mCanMod = true;
- mMakeNoTrans = false;
+ mCanTrans = true;
return;
}
@@ -1427,6 +1427,7 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId)
mCanCopy = mInventoryItem->getPermissions().allowCopyBy(gAgent.getID());
mCanMod = mInventoryItem->getPermissions().allowModifyBy(gAgent.getID());
+ mCanTrans = mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID());
mExpectingAssetId = mInventoryItem->getAssetUUID();
LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(),
@@ -1462,6 +1463,11 @@ void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::pt
else
settings->setFlag(LLSettingsBase::FLAG_NOMOD);
+ if (mCanTrans)
+ settings->clearFlag(LLSettingsBase::FLAG_NOTRANS);
+ else
+ settings->setFlag(LLSettingsBase::FLAG_NOTRANS);
+
if (mInventoryItem)
settings->setName(mInventoryItem->getName());
@@ -2020,7 +2026,7 @@ void LLFloaterEditExtDayCycle::onAssetLoadedForInsertion(LLUUID item_id, LLUUID
bool no_transfer = false;
if (mInventoryItem)
{
- no_transfer = mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID());
+ no_transfer = !mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID());
}
else
{
@@ -2038,7 +2044,7 @@ void LLFloaterEditExtDayCycle::onAssetLoadedForInsertion(LLUUID item_id, LLUUID
S32 opt = LLNotificationsUtil::getSelectedOption(notif, resp);
if (opt == 0)
{
- mMakeNoTrans = true;
+ mCanTrans = false;
mEditDay->setFlag(LLSettingsBase::FLAG_NOTRANS);
cb();
}
diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h
index f50c9f7e5f..311bbd52dc 100644
--- a/indra/newview/llfloatereditextdaycycle.h
+++ b/indra/newview/llfloatereditextdaycycle.h
@@ -238,7 +238,7 @@ private:
bool mIsDirty;
bool mCanCopy;
bool mCanMod;
- bool mMakeNoTrans;
+ bool mCanTrans;
edit_commit_signal_t mCommitSignal;
diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp
index 5eac6b317b..dfd60acb50 100644
--- a/indra/newview/llfloaterfixedenvironment.cpp
+++ b/indra/newview/llfloaterfixedenvironment.cpp
@@ -117,7 +117,8 @@ LLFloaterFixedEnvironment::LLFloaterFixedEnvironment(const LLSD &key) :
mInventoryItem(nullptr),
mIsDirty(false),
mCanCopy(false),
- mCanMod(false)
+ mCanMod(false),
+ mCanTrans(false)
{
}
@@ -257,6 +258,7 @@ void LLFloaterFixedEnvironment::loadInventoryItem(const LLUUID &inventoryId)
mInventoryId.setNull();
mCanMod = true;
mCanCopy = true;
+ mCanTrans = true;
return;
}
@@ -288,6 +290,7 @@ void LLFloaterFixedEnvironment::loadInventoryItem(const LLUUID &inventoryId)
mCanCopy = mInventoryItem->getPermissions().allowCopyBy(gAgent.getID());
mCanMod = mInventoryItem->getPermissions().allowModifyBy(gAgent.getID());
+ mCanTrans = mInventoryItem->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID());
LLSettingsVOBase::getSettingsAsset(mInventoryItem->getAssetUUID(),
[this](LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, LLExtStat) { onAssetLoaded(asset_id, settings, status); });
@@ -348,6 +351,21 @@ void LLFloaterFixedEnvironment::onAssetLoaded(LLUUID asset_id, LLSettingsBase::p
if (mInventoryItem)
mSettings->setName(mInventoryItem->getName());
+ if (mCanCopy)
+ settings->clearFlag(LLSettingsBase::FLAG_NOCOPY);
+ else
+ settings->setFlag(LLSettingsBase::FLAG_NOCOPY);
+
+ if (mCanMod)
+ settings->clearFlag(LLSettingsBase::FLAG_NOMOD);
+ else
+ settings->setFlag(LLSettingsBase::FLAG_NOMOD);
+
+ if (mCanTrans)
+ settings->clearFlag(LLSettingsBase::FLAG_NOTRANS);
+ else
+ settings->setFlag(LLSettingsBase::FLAG_NOTRANS);
+
updateEditEnvironment();
syncronizeTabs();
refresh();
diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h
index 12fa64e733..f694e59281 100644
--- a/indra/newview/llfloaterfixedenvironment.h
+++ b/indra/newview/llfloaterfixedenvironment.h
@@ -102,6 +102,7 @@ protected:
LLHandle<LLFloater> mInventoryFloater;
bool mCanCopy;
bool mCanMod;
+ bool mCanTrans;
void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id);
void onInventoryCreated(LLUUID asset_id, LLUUID inventory_id, LLSD results);
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index 8f279c07ba..d20cc096de 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -263,6 +263,7 @@ void LLPanelEnvironmentInfo::refresh()
updateEditFloater(mCurrentEnvironment, canEdit());
LLEnvironment::altitude_list_t altitudes = LLEnvironment::instance().getRegionAltitudes();
+
if (altitudes.size() > 0)
{
LLMultiSliderCtrl *sld = getChild<LLMultiSliderCtrl>(SLD_ALTITUDES);
@@ -294,16 +295,16 @@ void LLPanelEnvironmentInfo::refresh()
res = sld->addSlider(altitude, alt_sliders[idx]);
if (res) break;
}
- if (!res)
- {
- // Something is very very wrong
- LL_WARNS_ONCE("ENVPANEL") << "Failed to set up altitudes for parcel id " << getParcelId() << LL_ENDL;
- }
- else
- {
- // slider has some auto correction that might have kicked in
- altitude = sld->getSliderValue(alt_sliders[idx]);
- }
+ }
+ if (res)
+ {
+ // slider has some auto correction that might have kicked in
+ altitude = sld->getSliderValue(alt_sliders[idx]);
+ }
+ else
+ {
+ // Something is very very wrong
+ LL_WARNS_ONCE("ENVPANEL") << "Failed to set up altitudes for parcel id " << getParcelId() << LL_ENDL;
}
updateAltLabel(alt_prefixes[idx], idx + 2, altitude);
mAltitudes[alt_sliders[idx]] = AltitudeData(idx + 2, idx, altitude);