Merge
commit
770baa2852
|
|
@ -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 left_edge = mThumbWidth/2;
|
||||
S32 right_edge = getRect().getWidth() - (mThumbWidth/2);
|
||||
S32 x = left_edge + S32( t * (right_edge - left_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].mLeft = x - (mThumbWidth / 2);
|
||||
mThumbRects[name].mRight = x + (mThumbWidth / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
S32 bottom_edge = mThumbWidth/2;
|
||||
S32 top_edge = getRect().getHeight() - (mThumbWidth/2);
|
||||
|
||||
S32 x = bottom_edge + S32( t * (top_edge - bottom_edge) );
|
||||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue