diff options
author | Graham Linden <graham@lindenlab.com> | 2018-09-07 17:27:24 +0100 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-09-07 17:27:24 +0100 |
commit | 770baa28526cf4d860cdea6d97fa9f089a5941c7 (patch) | |
tree | f8c0b372fbee3957d8a6fbb760a923591e79e531 | |
parent | 4bd2b8b98ba1c562dfd65975a87ef5ee3db35633 (diff) | |
parent | df96fc652b452dbc9bd2daa7398ada1feb235fff (diff) |
Merge
-rw-r--r-- | indra/llui/llmultislider.cpp | 95 | ||||
-rw-r--r-- | indra/llui/llmultislider.h | 8 | ||||
-rw-r--r-- | indra/llui/llmultisliderctrl.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llmultisliderctrl.h | 4 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llfloatermyenvironment.cpp | 75 | ||||
-rw-r--r-- | indra/newview/llfloatermyenvironment.h | 2 | ||||
-rw-r--r-- | indra/newview/llsidepaneliteminfo.cpp | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_fixedenvironment.xml | 2 |
9 files changed, 150 insertions, 47 deletions
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<S32> 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<S32> 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<std::string> orientation; + Optional<CommitCallbackParam> mouse_down_callback, mouse_up_callback; Optional<S32> 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<std::string> orientation; + Optional<F32> overlap_threshold; Optional<LLUIColor> 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(); diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 7d20a27813..01d4dd631d 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -590,7 +590,7 @@ void LLFloaterEditExtDayCycle::onFrameSliderCallback(const LLSD &data) S32 x(0), y(0); LLUI::getMousePositionLocal(mFramesSlider, &x, &y); - sliderpos = mFramesSlider->getSliderValueFromX(x); + sliderpos = mFramesSlider->getSliderValueFromPos(x, y); } else { @@ -657,7 +657,7 @@ void LLFloaterEditExtDayCycle::onFrameSliderDoubleClick(S32 x, S32 y, MASK mask) void LLFloaterEditExtDayCycle::onFrameSliderMouseDown(S32 x, S32 y, MASK mask) { stopPlay(); - F32 sliderpos = mFramesSlider->getSliderValueFromX(x); + F32 sliderpos = mFramesSlider->getSliderValueFromPos(x, y); std::string slidername = mFramesSlider->getCurSlider(); @@ -681,7 +681,7 @@ void LLFloaterEditExtDayCycle::onFrameSliderMouseDown(S32 x, S32 y, MASK mask) void LLFloaterEditExtDayCycle::onFrameSliderMouseUp(S32 x, S32 y, MASK mask) { - F32 sliderpos = mFramesSlider->getSliderValueFromX(x); + F32 sliderpos = mFramesSlider->getSliderValueFromPos(x, y); mTimeSlider->setCurSliderValue(sliderpos); selectFrame(sliderpos, LLSettingsDay::DEFAULT_FRAME_SLOP_FACTOR); diff --git a/indra/newview/llfloatermyenvironment.cpp b/indra/newview/llfloatermyenvironment.cpp index 35f43d57e2..6dcff7c264 100644 --- a/indra/newview/llfloatermyenvironment.cpp +++ b/indra/newview/llfloatermyenvironment.cpp @@ -157,9 +157,9 @@ LLFloaterMyEnvironment::LLFloaterMyEnvironment(const LLSD& key) : mSelectedAsset() { mCommitCallbackRegistrar.add(ACTION_DOCREATE, [this](LLUICtrl *, const LLSD &userdata) { onDoCreate(userdata); }); - mCommitCallbackRegistrar.add(ACTION_DOEDIT, [](LLUICtrl *, const LLSD &userdata) { }); + mCommitCallbackRegistrar.add(ACTION_DOEDIT, [this](LLUICtrl *, const LLSD &userdata) { mInventoryList->openSelected(); }); mCommitCallbackRegistrar.add(ACTION_DOAPPLY, [this](LLUICtrl *, const LLSD &userdata) { onDoApply(userdata.asString()); }); - mCommitCallbackRegistrar.add(ACTION_COPYPASTE, [](LLUICtrl *, const LLSD &userdata) { }); + mCommitCallbackRegistrar.add(ACTION_COPYPASTE, [this](LLUICtrl *, const LLSD &userdata) { mInventoryList->doToSelected(userdata.asString()); }); mEnableCallbackRegistrar.add(ENABLE_ACTION, [this](LLUICtrl *, const LLSD &userdata) { return canAction(userdata.asString()); }); mEnableCallbackRegistrar.add(ENABLE_CANAPPLY, [this](LLUICtrl *, const LLSD &userdata) { return canApply(userdata.asString()); }); @@ -343,27 +343,49 @@ void LLFloaterMyEnvironment::onDoApply(const std::string &context) } } - bool LLFloaterMyEnvironment::canAction(const std::string &context) { -// uuid_vec_t selected; -// getSelectedIds(selected); -// -// if (selected.empty()) -// return false; -// -// if (context == PARAMETER_EDIT) -// { -// } -// else if (context == PARAMETER_COPY) -// { -// } -// else if (context == PARAMETER_PASTE) -// { -// } -// else if (context == PARAMETER_COPYUUID) -// { -// } + uuid_vec_t selected; + getSelectedIds(selected); + + if (selected.empty()) + return false; + + if (context == PARAMETER_EDIT) + { + return (selected.size() == 1) && isSettingSelected(selected.front()); + } + else if (context == PARAMETER_COPY) + { + for (std::vector<LLUUID>::iterator it = selected.begin(); it != selected.end(); it++) + { + if(!isSettingSelected(*it)) + { + return false; + } + } + return true; + } + else if (context == PARAMETER_PASTE) + { + if (!LLClipboard::instance().hasContents()) + return false; + + std::vector<LLUUID> ids; + LLClipboard::instance().pasteFromClipboard(ids); + for (std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++) + { + if (!isSettingSelected(*it)) + { + return false; + } + } + return (selected.size() == 1); + } + else if (context == PARAMETER_COPYUUID) + { + return (selected.size() == 1) && isSettingSelected(selected.front()); + } return false; } @@ -449,6 +471,17 @@ LLUUID LLFloaterMyEnvironment::findItemByAssetId(LLUUID asset_id, bool copyable_ return LLUUID::null; } +bool LLFloaterMyEnvironment::isSettingSelected(LLUUID item_id) +{ + LLInventoryItem* itemp = gInventory.getItem(item_id); + + if (itemp && itemp->getInventoryType() == LLInventoryType::IT_SETTINGS) + { + return true; + } + return false; +} + void LLFloaterMyEnvironment::getSelectedIds(uuid_vec_t& ids) const { LLInventoryPanel::selected_items_t items = mInventoryList->getSelectedItems(); diff --git a/indra/newview/llfloatermyenvironment.h b/indra/newview/llfloatermyenvironment.h index 9d9659576d..10d64eaa93 100644 --- a/indra/newview/llfloatermyenvironment.h +++ b/indra/newview/llfloatermyenvironment.h @@ -76,6 +76,8 @@ private: void getSelectedIds(uuid_vec_t& ids) const; void refreshButtonStates(); + bool isSettingSelected(LLUUID item_id); + static LLUUID findItemByAssetId(LLUUID asset_id, bool copyable_only, bool ignore_library); #if 0 diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp index a486a29aa2..3ec8e1e911 100644 --- a/indra/newview/llsidepaneliteminfo.cpp +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -301,6 +301,7 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) BOOL is_complete = item->isFinished(); const BOOL cannot_restrict_permissions = LLInventoryType::cannotRestrictPermissions(item->getInventoryType()); const BOOL is_calling_card = (item->getInventoryType() == LLInventoryType::IT_CALLINGCARD); + const BOOL is_settings = (item->getInventoryType() == LLInventoryType::IT_SETTINGS); const LLPermissions& perm = item->getPermissions(); const BOOL can_agent_manipulate = gAgent.allowOperation(PERM_OWNER, perm, GP_OBJECT_MANIPULATE); @@ -637,7 +638,7 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item) getChildView("NextOwnerLabel")->setEnabled(TRUE); getChildView("CheckNextOwnerModify")->setEnabled((base_mask & PERM_MODIFY) && !cannot_restrict_permissions); - getChildView("CheckNextOwnerCopy")->setEnabled((base_mask & PERM_COPY) && !cannot_restrict_permissions); + getChildView("CheckNextOwnerCopy")->setEnabled((base_mask & PERM_COPY) && !cannot_restrict_permissions && !is_settings); getChildView("CheckNextOwnerTransfer")->setEnabled((next_owner_mask & PERM_COPY) && !cannot_restrict_permissions); combo_sale_type->setEnabled(is_complete && is_for_sale); diff --git a/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml b/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml index 36462dcd02..73f2683e84 100644 --- a/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml +++ b/indra/newview/skins/default/xui/en/floater_fixedenvironment.xml @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater - can_minimize="false" can_tear_off="false" can_resize="false" can_drag_on_left="false" @@ -13,6 +12,7 @@ save_rect="true" title="Fixed Environment" save_visibility="false" + help_topic="fixed_environment" single_instance="true" width="750"> <layout_stack name="floater_stack" |