summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavriliuk <alexandrgproductengine@lindenlab.com>2024-08-28 23:51:29 +0200
committerGuru <alexandrgproductengine@lindenlab.com>2024-08-29 15:40:34 +0200
commite26261c7f936d697a96b964723498f3e989017d8 (patch)
tree86c574c4b316b6896c71117039c4b800c8697d1e
parente92a06d68114c933599da12d75221504ebac77e0 (diff)
#2360 Incorrect Day Cycle name in Edit Day Cycle floater after clicking the "Customize" button
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp49
-rw-r--r--indra/newview/llfloatereditextdaycycle.h6
-rw-r--r--indra/newview/llpanelenvironment.cpp16
-rw-r--r--indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml2
4 files changed, 32 insertions, 41 deletions
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index 60343a4e2a..d6e7cd97f3 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -184,7 +184,6 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key) :
mLoadTrack(nullptr),
mClearTrack(nullptr)
{
-
mCommitCallbackRegistrar.add(EVNT_DAYTRACK, [this](LLUICtrl *ctrl, const LLSD &data) { onTrackSelectionCallback(data); });
mCommitCallbackRegistrar.add(EVNT_PLAY, [this](LLUICtrl *ctrl, const LLSD &data) { onPlayActionCallback(data); });
@@ -205,8 +204,8 @@ LLFloaterEditExtDayCycle::~LLFloaterEditExtDayCycle()
// virtual
bool LLFloaterEditExtDayCycle::postBuild()
{
- getChild<LLLineEditor>(TXT_DAY_NAME)->setKeystrokeCallback(boost::bind(&LLFloaterEditExtDayCycle::onCommitName, this, _1, _2), NULL);
-
+ mNameEditor = getChild<LLLineEditor>(TXT_DAY_NAME, true);
+ mCancelButton = getChild<LLButton>(BTN_CANCEL, true);
mAddFrameButton = getChild<LLButton>(BTN_ADDFRAME, true);
mDeleteFrameButton = getChild<LLButton>(BTN_DELFRAME, true);
mTimeSlider = getChild<LLMultiSliderCtrl>(SLDR_TIME);
@@ -221,24 +220,24 @@ bool LLFloaterEditExtDayCycle::postBuild()
mClearTrack = getChild<LLButton>(BTN_CLEARTRACK, true);
mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BTN_SAVE, BTN_FLYOUT, XML_FLYOUTMENU_FILE, false);
- mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); });
+ mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD&) { onButtonApply(ctrl); });
- getChild<LLButton>(BTN_CANCEL, true)->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onClickCloseBtn(); });
- mTimeSlider->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onTimeSliderCallback(); });
- mAddFrameButton->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onAddFrame(); });
- mDeleteFrameButton->setCommitCallback([this](LLUICtrl *ctrl, const LLSD &data) { onRemoveFrame(); });
- mImportButton->setCommitCallback([this](LLUICtrl *, const LLSD &){ onButtonImport(); });
- mLoadFrame->setCommitCallback([this](LLUICtrl *, const LLSD &){ onButtonLoadFrame(); });
+ mNameEditor->setKeystrokeCallback([this](LLLineEditor*, void*) { onNameKeystroke(); }, NULL);
+ mCancelButton->setCommitCallback([this](LLUICtrl*, const LLSD&) { onClickCloseBtn(); });
+ mTimeSlider->setCommitCallback([this](LLUICtrl*, const LLSD&) { onTimeSliderCallback(); });
+ mAddFrameButton->setCommitCallback([this](LLUICtrl*, const LLSD&) { onAddFrame(); });
+ mDeleteFrameButton->setCommitCallback([this](LLUICtrl*, const LLSD&) { onRemoveFrame(); });
+ mImportButton->setCommitCallback([this](LLUICtrl*, const LLSD&) { onButtonImport(); });
+ mLoadFrame->setCommitCallback([this](LLUICtrl*, const LLSD&) { onButtonLoadFrame(); });
- mCloneTrack->setCommitCallback([this](LLUICtrl *, const LLSD&){ onCloneTrack(); });
- mLoadTrack->setCommitCallback([this](LLUICtrl *, const LLSD&){ onLoadTrack();});
- mClearTrack->setCommitCallback([this](LLUICtrl *, const LLSD&){ onClearTrack(); });
+ mCloneTrack->setCommitCallback([this](LLUICtrl*, const LLSD&) { onCloneTrack(); });
+ mLoadTrack->setCommitCallback([this](LLUICtrl*, const LLSD&) { onLoadTrack();});
+ mClearTrack->setCommitCallback([this](LLUICtrl*, const LLSD&) { onClearTrack(); });
-
- mFramesSlider->setCommitCallback([this](LLUICtrl *, const LLSD &data) { onFrameSliderCallback(data); });
- mFramesSlider->setDoubleClickCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask){ onFrameSliderDoubleClick(x, y, mask); });
- mFramesSlider->setMouseDownCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask){ onFrameSliderMouseDown(x, y, mask); });
- mFramesSlider->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask){ onFrameSliderMouseUp(x, y, mask); });
+ mFramesSlider->setCommitCallback([this](LLUICtrl*, const LLSD &data) { onFrameSliderCallback(data); });
+ mFramesSlider->setDoubleClickCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onFrameSliderDoubleClick(x, y, mask); });
+ mFramesSlider->setMouseDownCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onFrameSliderMouseDown(x, y, mask); });
+ mFramesSlider->setMouseUpCallback([this](LLUICtrl*, S32 x, S32 y, MASK mask) { onFrameSliderMouseUp(x, y, mask); });
mTimeSlider->addSlider(0);
@@ -431,12 +430,10 @@ void LLFloaterEditExtDayCycle::refresh()
{
if (mEditDay)
{
- LLLineEditor* name_field = getChild<LLLineEditor>(TXT_DAY_NAME);
- name_field->setText(mEditDay->getName());
- name_field->setEnabled(mCanMod);
+ mNameEditor->setText(mEditDay->getName());
+ mNameEditor->setEnabled(mCanMod && mCanSave && mInventoryId.notNull());
}
-
bool is_inventory_avail = canUseInventory();
bool show_commit = ((mEditContext == CONTEXT_PARCEL) || (mEditContext == CONTEXT_REGION));
@@ -461,7 +458,7 @@ void LLFloaterEditExtDayCycle::refresh()
mFlyoutControl->setMenuItemVisible(ACTION_APPLY_REGION, show_apply);
mFlyoutControl->setMenuItemEnabled(ACTION_COMMIT, show_commit && !mCommitSignal.empty());
- mFlyoutControl->setMenuItemEnabled(ACTION_SAVE, is_inventory_avail && mCanMod && !mInventoryId.isNull() && mCanSave);
+ mFlyoutControl->setMenuItemEnabled(ACTION_SAVE, is_inventory_avail && mCanMod && mCanSave && mInventoryId.notNull());
mFlyoutControl->setMenuItemEnabled(ACTION_SAVEAS, is_inventory_avail && mCanCopy && mCanSave);
mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_LOCAL, true);
mFlyoutControl->setMenuItemEnabled(ACTION_APPLY_PARCEL, canApplyParcel() && show_apply);
@@ -569,7 +566,7 @@ bool LLFloaterEditExtDayCycle::handleKeyUp(KEY key, MASK mask, bool called_from_
return LLFloater::handleKeyUp(key, mask, called_from_parent);
}
-void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data)
+void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl)
{
std::string ctrl_action = ctrl->getName();
@@ -832,7 +829,7 @@ void LLFloaterEditExtDayCycle::onClearTrack()
refresh();
}
-void LLFloaterEditExtDayCycle::onCommitName(class LLLineEditor* caller, void* user_data)
+void LLFloaterEditExtDayCycle::onNameKeystroke()
{
if (!mEditDay)
{
@@ -840,7 +837,7 @@ void LLFloaterEditExtDayCycle::onCommitName(class LLLineEditor* caller, void* us
return;
}
- mEditDay->setName(caller->getText());
+ mEditDay->setName(mNameEditor->getText());
}
void LLFloaterEditExtDayCycle::onTrackSelectionCallback(const LLSD& user_data)
diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h
index 655915b6e8..926a24f8a4 100644
--- a/indra/newview/llfloatereditextdaycycle.h
+++ b/indra/newview/llfloatereditextdaycycle.h
@@ -110,7 +110,7 @@ private:
F32 getCurrentFrame() const;
// flyout response/click
- void onButtonApply(LLUICtrl *ctrl, const LLSD &data);
+ void onButtonApply(LLUICtrl *ctrl);
//virtual void onClickCloseBtn(bool app_quitting = false) override;
//void onButtonImport();
void onButtonLoadFrame();
@@ -119,7 +119,7 @@ private:
void onCloneTrack();
void onLoadTrack();
void onClearTrack();
- void onCommitName(class LLLineEditor* caller, void* user_data);
+ void onNameKeystroke();
void onTrackSelectionCallback(const LLSD& user_data);
void onPlayActionCallback(const LLSD& user_data);
// time slider clicked
@@ -196,6 +196,8 @@ private:
std::string mLastFrameSlider;
bool mShiftCopyEnabled;
+ LLLineEditor* mNameEditor;
+ LLButton* mCancelButton;
LLButton* mAddFrameButton;
LLButton* mDeleteFrameButton;
LLButton* mImportButton;
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index 2a4323d3e6..c1d8ce50ff 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -58,14 +58,6 @@ namespace
const std::string FLOATER_DAY_CYCLE_EDIT("env_edit_extdaycycle");
const std::string STRING_REGION_ENV("str_region_env");
const std::string STRING_EMPTY_NAME("str_empty");
-
- inline bool ends_with(std::string const & value, std::string const & ending)
- {
- if (ending.size() > value.size())
- return false;
- return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
- }
-
}
//=========================================================================
@@ -876,16 +868,16 @@ void LLPanelEnvironmentInfo::onBtnEdit()
(LLFloaterEditExtDayCycle::KEY_CANMOD, LLSD::Boolean(true)));
dayeditor->openFloater(params);
+
if (mCurrentEnvironment && mCurrentEnvironment->mDayCycle)
{
dayeditor->setEditDayCycle(mCurrentEnvironment->mDayCycle);
- if (!ends_with(mCurrentEnvironment->mDayCycle->getName(), "(customized)"))
- {
- dayeditor->setEditName(mCurrentEnvironment->mDayCycle->getName() + "(customized)");
- }
+ dayeditor->setEditName(mCurrentEnvironment->mDayCycleName);
}
else
+ {
dayeditor->setEditDefaultDayCycle();
+ }
}
void LLPanelEnvironmentInfo::onBtnSelect()
diff --git a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml
index 1500c96b8d..787b2f8be4 100644
--- a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml
+++ b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml
@@ -50,7 +50,7 @@
layout="topleft"
name="label"
left="15"
- top="5"
+ top="8"
width="105">
Day Cycle Name:
</text>