diff options
author | Rider Linden <rider@lindenlab.com> | 2018-05-22 13:08:35 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-05-22 13:08:35 -0700 |
commit | 656967b326c59a3966261cd75e256e3a7a27cc0a (patch) | |
tree | 1c2c4c8f2adae7f17930843913a286fc1fd784b4 | |
parent | 044b80e4e1a7b55f46e6f3b52c9cae6d9c6df3eb (diff) | |
parent | b6ba9dd565b59e516571445e56f9dafe3bdf4061 (diff) |
Merge PR
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 255 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.h | 59 | ||||
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.h | 2 | ||||
-rw-r--r-- | indra/newview/llflyoutcombobtn.cpp | 24 | ||||
-rw-r--r-- | indra/newview/llflyoutcombobtn.h | 15 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml | 35 |
7 files changed, 216 insertions, 176 deletions
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index 1c9b42d03f..d87ea83fe7 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -44,13 +44,11 @@ #include "llinventorymodel.h" // newview #include "llagent.h" -//#include "llflyoutcombobtnctrl.h" //Todo: get rid of this and LLSaveOutfitComboBtn, make a proper UI element/button/pannel instead +#include "llflyoutcombobtn.h" //Todo: make a proper UI element/button/panel instead #include "llregioninfomodel.h" #include "llviewerregion.h" #include "llpaneleditwater.h" #include "llpaneleditsky.h" -//#include "llsettingsvo.h" -//#include "llinventorymodel.h" #include "llenvironment.h" #include "lltrans.h" @@ -64,13 +62,14 @@ static const std::string track_tabs[] = { }; // For flyout -/*const std::string ACTION_SAVE("save_settings"); +const std::string XML_FLYOUTMENU_FILE("menu_save_settings.xml"); +// From menu_save_settings.xml, consider moving into flyout since it should be supported by flyout either way +const std::string ACTION_SAVE("save_settings"); const std::string ACTION_SAVEAS("save_as_new_settings"); const std::string ACTION_APPLY_LOCAL("apply_local"); const std::string ACTION_APPLY_PARCEL("apply_parcel"); const std::string ACTION_APPLY_REGION("apply_region"); -const std::string XML_FLYOUTMENU_FILE("menu_save_settings.xml");*/ //========================================================================= // **RIDER** @@ -83,14 +82,12 @@ const std::string LLFloaterEditExtDayCycle::KEY_DAY_LENGTH("day_length"); LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key): LLFloater(key), - mSaveButton(NULL), + mFlyoutControl(NULL), mCancelButton(NULL), - mUploadButton(NULL), mDayLength(0), mCurrentTrack(4), mTimeSlider(NULL), mFramesSlider(NULL), - //mFlyoutControl(NULL), mCurrentTimeLabel(NULL), // **RIDER** mInventoryId(), @@ -109,28 +106,17 @@ LLFloaterEditExtDayCycle::LLFloaterEditExtDayCycle(const LLSD &key): LLFloaterEditExtDayCycle::~LLFloaterEditExtDayCycle() { - // Todo: consider remaking mFlyoutControl into class that initializes intself with floater, - // completes at postbuild, e t c... - // (make it into actual button?, In such case XML_FLYOUTMENU_FILE will be specified in xml) - //delete mFlyoutControl; + // Todo: consider remaking mFlyoutControl into full view class that initializes intself with floater, + // complete with postbuild, e t c... + delete mFlyoutControl; } -// void LLFloaterEditExtDayCycle::openFloater(LLSettingsDay::ptr_t settings, S64Seconds daylength, S64Seconds dayoffset) -// { -// mEditDay = settings->buildClone(); -// mDayLength = daylength; -// mDayOffset = dayoffset; -// LLFloater::openFloater(); -// } - // virtual BOOL LLFloaterEditExtDayCycle::postBuild() { getChild<LLLineEditor>("day_cycle_name")->setKeystrokeCallback(boost::bind(&LLFloaterEditExtDayCycle::onCommitName, this, _1, _2), NULL); - mSaveButton = getChild<LLButton>("save_btn", true); mCancelButton = getChild<LLButton>("cancel_btn", true); - mUploadButton = getChild<LLButton>("upload_btn", true); mAddFrameButton = getChild<LLButton>("add_frame", true); mDeleteFrameButton = getChild<LLButton>("delete_frame", true); mTimeSlider = getChild<LLMultiSliderCtrl>("WLTimeSlider"); @@ -139,12 +125,10 @@ BOOL LLFloaterEditExtDayCycle::postBuild() mWaterTabLayoutContainer = getChild<LLView>("frame_settings_water", true); mCurrentTimeLabel = getChild<LLTextBox>("current_time", true); - //mFlyoutControl = new LLFlyoutComboBtnCtrl(this, "save_btn", "btn_flyout", XML_FLYOUTMENU_FILE); - //mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); }); + mFlyoutControl = new LLFlyoutComboBtnCtrl(this, "save_btn", "btn_flyout", XML_FLYOUTMENU_FILE); + mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); }); - mUploadButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onBtnSave, this)); mCancelButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onBtnCancel, this)); - mUploadButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onBtnUpload, this)); mTimeSlider->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onTimeSliderMoved, this)); mFramesSlider->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onFrameSliderCallback, this)); mAddFrameButton->setCommitCallback(boost::bind(&LLFloaterEditExtDayCycle::onAddTrack, this)); @@ -203,7 +187,6 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) S32Hours hrs; S32Minutes minutes; S64Seconds total; - //LLDate date; LLUIString formatted_label = getString("time_label"); for (int i = 0; i < max_elm; i++) { @@ -211,19 +194,12 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) hrs = total; minutes = total - hrs; - //date = LLDate(((mDayLength / (max_elm - 1)) * i) + mDayOffset); - //formatted_label.setArg("[TIME]", date.toHTTPDateString(std::string("%H:%M"))); - //formatted_label.setArg("[TIME]", llformat("%.1f", hrs.value())); - formatted_label.setArg("[HH]", llformat("%d", hrs.value())); formatted_label.setArg("[MM]", llformat("%d", abs(minutes.value()))); getChild<LLTextBox>("p" + llformat("%d", i), true)->setTextArg("[DSC]", formatted_label.getString()); } hrs = mDayLength; minutes = mDayLength - hrs; - //formatted_label.setArg("[TIME]", llformat("%.1f", hrs.value())); - //date = LLDate(mDayOffset); - //formatted_label.setArg("[TIME]", date.toHTTPDateString(std::string("%H:%M"))); formatted_label.setArg("[HH]", llformat("%d", hrs.value())); formatted_label.setArg("[MM]", llformat("%d", abs(minutes.value()))); mCurrentTimeLabel->setTextArg("[DSC]", formatted_label.getString()); @@ -240,12 +216,12 @@ void LLFloaterEditExtDayCycle::onOpen(const LLSD& key) void LLFloaterEditExtDayCycle::onClose(bool app_quitting) { - if (!app_quitting) // there's no point to change environment if we're quitting - { - /* TODO: don't restore this environment. We may have gotten here from land or region. */ - LLEnvironment::instance().clearEnvironment(LLEnvironment::ENV_EDIT); - LLEnvironment::instance().updateEnvironment(); - } + // there's no point to change environment if we're quitting + // or if we already restored environment + if (!app_quitting && LLEnvironment::instance().getSelectedEnvironment() == LLEnvironment::ENV_EDIT) + { + LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); + } } void LLFloaterEditExtDayCycle::onVisibilityChange(BOOL new_visibility) @@ -257,60 +233,64 @@ void LLFloaterEditExtDayCycle::onVisibilityChange(BOOL new_visibility) } else { - /* TODO: don't restore this environment. We may have gotten here from land or region. */ LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL); } } -/*void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data) +void LLFloaterEditExtDayCycle::onButtonApply(LLUICtrl *ctrl, const LLSD &data) { std::string ctrl_action = ctrl->getName(); if (ctrl_action == ACTION_SAVE) { - mSavedDay = mEditDay; - //doApplyUpdateInventory(); +// if (mSavedDay.get() != mOriginalDay.get()) +// { +// restoreSavedEnv(); +// } +// else +// { +// S64Seconds day_length = mDayLength.value() > 0 ? mDayLength : LLSettingsDay::DEFAULT_DAYLENGTH; +// S64Seconds day_offset = mDayLength.value() > 0 ? mDayOffset : LLSettingsDay::DEFAULT_DAYOFFSET; +// LLEnvironment::instance().setEnvironment((LLEnvironment::EnvSelection_t)mSavedEnvironment, mEditDay, day_length, day_offset); +// LLEnvironment::instance().setSelectedEnvironment((LLEnvironment::EnvSelection_t)mSavedEnvironment); +// LLEnvironment::instance().updateEnvironment(); +// } +// mOriginalDay = mEditDay; // to kill the pointer +// +// if (!mCommitSignal.empty()) +// mCommitSignal(mEditDay); } else if (ctrl_action == ACTION_SAVEAS) { - //doApplyCreateNewInventory(); - LLSettingsVOBase::createInventoryItem(mEditDay, NULL); - } - else if ((ctrl_action == ACTION_APPLY_LOCAL) || - (ctrl_action == ACTION_APPLY_PARCEL) || - (ctrl_action == ACTION_APPLY_REGION)) - { - //doApplyEnvironment(ctrl_action); - // Shouldn't be supported? + LLSettingsVOBase::createInventoryItem(mEditDay); } else { - LL_WARNS("ENVIRONMENT") << "Unknown settings action '" << ctrl_action << "'" << LL_ENDL; - } + LLEnvironment::EnvSelection_t env(LLEnvironment::ENV_DEFAULT); + bool updateSimulator(ctrl_action != ACTION_APPLY_LOCAL); - if (!mCommitSignal.empty()) - mCommitSignal(mEditDay); - closeFloater(); - }*/ - -void LLFloaterEditExtDayCycle::onBtnSave() -{ - //no longer needed? - if (!mCommitSignal.empty()) - mCommitSignal(mEditDay); + if (ctrl_action == ACTION_APPLY_LOCAL) + env = LLEnvironment::ENV_LOCAL; + else if (ctrl_action == ACTION_APPLY_PARCEL) + env = LLEnvironment::ENV_PARCEL; + else if (ctrl_action == ACTION_APPLY_REGION) + env = LLEnvironment::ENV_REGION; + else + { + LL_WARNS("ENVIRONMENT") << "Unknown apply '" << ctrl_action << "'" << LL_ENDL; + } - closeFloater(); + LLEnvironment::instance().setEnvironment(env, mEditDay); + if (updateSimulator) + { + LL_WARNS("ENVIRONMENT") << "Attempting to apply " << env << LL_ENDL; + } + } } void LLFloaterEditExtDayCycle::onBtnCancel() { - closeFloater(); -} - -void LLFloaterEditExtDayCycle::onBtnUpload() -{ - LLSettingsVOBase::createInventoryItem(mEditDay); - //closeFloater(); + closeFloater(); // will restore env } void LLFloaterEditExtDayCycle::onAddTrack() @@ -414,14 +394,44 @@ void LLFloaterEditExtDayCycle::onFrameSliderCallback() } F32 new_frame = mFramesSlider->getCurSliderValue(); - // todo: add safety checks, user shouldn't be capable of moving one frame over another or move missing frame + // todo: add safety 2.5% checks keymap_t::iterator iter = mSliderKeyMap.find(cur_sldr); if (iter != mSliderKeyMap.end() && mEditDay->getSettingsAtKeyframe(new_frame, mCurrentTrack).get() == NULL) { - LL_DEBUGS() << "Moving frame from " << iter->second.first << " to " << new_frame << LL_ENDL; - if (mEditDay->moveTrackKeyframe(mCurrentTrack, iter->second.first, new_frame)) + if (gKeyboard->currentMask(TRUE) == MASK_SHIFT) { - iter->second.first = new_frame; + LL_DEBUGS() << "Copying frame from " << iter->second.mFrame << " to " << new_frame << LL_ENDL; + LLSettingsBase::ptr_t new_settings; + + // mEditDay still remembers old position, add copy at new position + if (mCurrentTrack == LLSettingsDay::TRACK_WATER) + { + LLSettingsWaterPtr_t water_ptr = std::dynamic_pointer_cast<LLSettingsWater>(iter->second.pSettings)->buildClone(); + mEditDay->setWaterAtKeyframe(water_ptr, new_frame); + new_settings = water_ptr; + } + else + { + LLSettingsSkyPtr_t sky_ptr = std::dynamic_pointer_cast<LLSettingsSky>(iter->second.pSettings)->buildClone(); + mEditDay->setSkyAtKeyframe(sky_ptr, new_frame, mCurrentTrack); + new_settings = sky_ptr; + } + + // mSliderKeyMap still remembers old position, for simplicity, just move it to be identical to slider + F32 old_frame = iter->second.mFrame; + iter->second.mFrame = new_frame; + // slider already moved old frame, create new one in old place + addSliderFrame(old_frame, new_settings, false /*because we are going to reselect new one*/); + // reselect new frame + mFramesSlider->setCurSlider(iter->first); + } + else + { + LL_DEBUGS() << "Moving frame from " << iter->second.mFrame << " to " << new_frame << LL_ENDL; + if (mEditDay->moveTrackKeyframe(mCurrentTrack, iter->second.mFrame, new_frame)) + { + iter->second.mFrame = new_frame; + } } } @@ -450,7 +460,7 @@ void LLFloaterEditExtDayCycle::onTimeSliderMoved() F32 frame = mTimeSlider->getCurSliderValue(); while (iter != end_iter) { - if (iter->second.first == frame) + if (iter->second.mFrame == frame) { mFramesSlider->setCurSlider(iter->first); break; @@ -458,14 +468,14 @@ void LLFloaterEditExtDayCycle::onTimeSliderMoved() iter++; } - // Todo: safety checks + // block or update tabs according to new selection updateTabs(); - //Todo: update something related to time/play/blending? + + // blending: } void LLFloaterEditExtDayCycle::selectTrack(U32 track_index) { - // todo: safety checks mCurrentTrack = track_index; LLButton* button = getChild<LLButton>(track_tabs[track_index], true); if (button->getToggleState()) @@ -488,7 +498,7 @@ void LLFloaterEditExtDayCycle::selectTrack(U32 track_index) void LLFloaterEditExtDayCycle::clearTabs() { - // todo: instead init with defaults? + // Note: If this doesn't look good, init panels with default settings. It might be better looking if (mCurrentTrack == LLSettingsDay::TRACK_WATER) { const LLSettingsWaterPtr_t p_water = LLSettingsWaterPtr_t(NULL); @@ -505,12 +515,12 @@ void LLFloaterEditExtDayCycle::clearTabs() void LLFloaterEditExtDayCycle::updateTabs() { -// // TODO: either prevent user from editing existing settings or clone them to not affect saved frames // std::string sldr = mFramesSlider->getCurSlider(); // if (sldr.empty()) // { -// // keep old settings for duplicating if there are any -// // TODO: disable tabs to prevent editing without nulling settings +// // keep old settings for duplicating if there are any +// setWaterTabsEnabled(FALSE); +// setSkyTabsEnabled(FALSE); // } // else if (mCurrentTrack == LLSettingsDay::TRACK_WATER) // { @@ -562,6 +572,42 @@ void LLFloaterEditExtDayCycle::updateSkyTabs(const LLSettingsSkyPtr_t &p_sky) } } +void LLFloaterEditExtDayCycle::setWaterTabsEnabled(BOOL enable) +{ + LLView* tab_container = mWaterTabLayoutContainer->getChild<LLView>("water_tabs"); //can't extract panels directly, since it is in 'tuple' + LLPanelSettingsWaterMainTab* panel = dynamic_cast<LLPanelSettingsWaterMainTab*>(tab_container->getChildView("water_panel")); + if (panel) + { + panel->setEnabled(enable); + panel->setAllChildrenEnabled(enable); + } +} + +void LLFloaterEditExtDayCycle::setSkyTabsEnabled(BOOL enable) +{ + LLView* tab_container = mSkyTabLayoutContainer->getChild<LLView>("sky_tabs"); //can't extract panels directly, since they are in 'tuple' + + LLPanelSettingsSky* panel; + panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("atmosphere_panel")); + if (panel) + { + panel->setEnabled(enable); + panel->setAllChildrenEnabled(enable); + } + panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("clouds_panel")); + if (panel) + { + panel->setEnabled(enable); + panel->setAllChildrenEnabled(enable); + } + panel = dynamic_cast<LLPanelSettingsSky*>(tab_container->getChildView("moon_panel")); + if (panel) + { + panel->setEnabled(enable); + panel->setAllChildrenEnabled(enable); + } +} + void LLFloaterEditExtDayCycle::updateButtons() { F32 frame = mTimeSlider->getCurSliderValue(); @@ -575,29 +621,24 @@ void LLFloaterEditExtDayCycle::updateSlider() mFramesSlider->clear(); mSliderKeyMap.clear(); - std::string new_slider; - F32 frame = 0; LLSettingsDay::CycleTrack_t track = mEditDay->getCycleTrack(mCurrentTrack); for (auto &track_frame : track) { - // multi slider distinguishes elements by key/name in string format - // store names to map to be able to recall dependencies - frame = track_frame.first; - new_slider = mFramesSlider->addSlider(frame); - mSliderKeyMap[new_slider] = framedata_t(frame, track_frame.second); + addSliderFrame(track_frame.first, track_frame.second, false); } - mLastFrameSlider = new_slider; - if (mSliderKeyMap.size() > 0) { - mTimeSlider->setCurSliderValue(frame); + // update positions + mLastFrameSlider = mFramesSlider->getCurSlider(); + mTimeSlider->setCurSliderValue(mFramesSlider->getCurSliderValue()); updateTabs(); } else { // disable panels clearTabs(); + mLastFrameSlider.clear(); } } @@ -609,11 +650,6 @@ void LLFloaterEditExtDayCycle::updateTimeAndLabel() { LLUIString formatted_label = getString("time_label"); - //F32Hours hrs = (mDayLength * time) + mDayOffset; - //LLDate date((mDayLength * time) + mDayOffset); - //formatted_label.setArg("[TIME]", llformat("%.1f", hrs.value())); - //formatted_label.setArg("[TIME]", date.toHTTPDateString(std::string("%H:%M"))); - S64Seconds total = (mDayLength * time); S32Hours hrs = total; S32Minutes minutes = total - hrs; @@ -630,16 +666,19 @@ void LLFloaterEditExtDayCycle::updateTimeAndLabel() // Update blender here: } -void LLFloaterEditExtDayCycle::addSliderFrame(const F32 frame, LLSettingsBase::ptr_t setting) +void LLFloaterEditExtDayCycle::addSliderFrame(const F32 frame, LLSettingsBase::ptr_t &setting, bool update_ui) { // multi slider distinguishes elements by key/name in string format // store names to map to be able to recall dependencies std::string new_slider = mFramesSlider->addSlider(frame); - mSliderKeyMap[new_slider] = framedata_t(frame, setting); - mLastFrameSlider = new_slider; + mSliderKeyMap[new_slider] = FrameData(frame, setting); - mTimeSlider->setCurSliderValue(frame); - updateTabs(); + if (update_ui) + { + mLastFrameSlider = new_slider; + mTimeSlider->setCurSliderValue(frame); + updateTabs(); + } } void LLFloaterEditExtDayCycle::removeCurrentSliderFrame() @@ -653,9 +692,9 @@ void LLFloaterEditExtDayCycle::removeCurrentSliderFrame() keymap_t::iterator iter = mSliderKeyMap.find(sldr); if (iter != mSliderKeyMap.end()) { - LL_DEBUGS() << "Removing frame from " << iter->second.first << LL_ENDL; + LL_DEBUGS() << "Removing frame from " << iter->second.mFrame << LL_ENDL; mSliderKeyMap.erase(iter); - mEditDay->removeTrackKeyframe(mCurrentTrack, iter->second.first); + mEditDay->removeTrackKeyframe(mCurrentTrack, iter->second.mFrame); } mLastFrameSlider = mFramesSlider->getCurSlider(); @@ -699,6 +738,7 @@ void LLFloaterEditExtDayCycle::loadInventoryItem(const LLUUID &inventoryId) void LLFloaterEditExtDayCycle::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status) { mEditDay = std::dynamic_pointer_cast<LLSettingsDay>(settings); + mOriginalDay = mEditDay->buildClone(); updateEditEnvironment(); syncronizeTabs(); refresh(); @@ -713,6 +753,7 @@ void LLFloaterEditExtDayCycle::loadLiveEnvironment(LLEnvironment::EnvSelection_t if (day) { + mOriginalDay = day; mEditDay = day->buildClone(); break; } diff --git a/indra/newview/llfloatereditextdaycycle.h b/indra/newview/llfloatereditextdaycycle.h index 80e5850558..287d2fe2dc 100644 --- a/indra/newview/llfloatereditextdaycycle.h +++ b/indra/newview/llfloatereditextdaycycle.h @@ -35,11 +35,11 @@ class LLCheckBoxCtrl; class LLComboBox; +class LLFlyoutComboBtnCtrl; class LLLineEditor; class LLMultiSliderCtrl; class LLTextBox; class LLTimeCtrl; -//class LLFlyoutComboBtnCtrl; class LLInventoryItem; @@ -62,53 +62,44 @@ public: typedef boost::signals2::signal<void(LLSettingsDay::ptr_t)> edit_commit_signal_t; typedef boost::signals2::connection connection_t; - LLFloaterEditExtDayCycle(const LLSD &key); + LLFloaterEditExtDayCycle(const LLSD &key); ~LLFloaterEditExtDayCycle(); //void openFloater(LLSettingsDay::ptr_t settings, S64Seconds daylength = S64Seconds(0), S64Seconds dayoffset = S64Seconds(0)); BOOL postBuild(); void onOpen(const LLSD& key); - void onClose(bool app_quitting); + void onClose(bool app_quitting); void onVisibilityChange(BOOL new_visibility); -// /*virtual*/ void draw(); connection_t setEditCommitSignal(edit_commit_signal_t::slot_type cb); private: -// /// sync the time slider with day cycle structure -// void syncTimeSlider(); -// -// // makes sure key slider has what's in day cycle -// void loadTrack(); -// -// /// makes sure day cycle data structure has what's in menu -// void applyTrack(); -// -// /// refresh the sky presets combobox - -// void onButtonApply(LLUICtrl *ctrl, const LLSD &data); - void onBtnSave(); + // flyout response/click + void onButtonApply(LLUICtrl *ctrl, const LLSD &data); void onBtnCancel(); - void onBtnUpload(); void onAddTrack(); void onRemoveTrack(); void onCommitName(class LLLineEditor* caller, void* user_data); void onTrackSelectionCallback(const LLSD& user_data); - void onTimeSliderMoved(); /// time slider moved - void onFrameSliderCallback(); /// a frame moved or frame selection changed + // time slider moved + void onTimeSliderMoved(); + // a frame moved or frame selection changed + void onFrameSliderCallback(); void selectTrack(U32 track_index); void clearTabs(); void updateTabs(); void updateWaterTabs(const LLSettingsWaterPtr_t &p_water); void updateSkyTabs(const LLSettingsSkyPtr_t &p_sky); + void setWaterTabsEnabled(BOOL enable); + void setSkyTabsEnabled(BOOL enable); void updateButtons(); void updateSlider(); //track to slider void updateTimeAndLabel(); - void addSliderFrame(const F32 frame, LLSettingsBase::ptr_t setting); + void addSliderFrame(const F32 frame, LLSettingsBase::ptr_t &setting, bool update_ui = true); void removeCurrentSliderFrame(); // **RIDER** @@ -120,15 +111,18 @@ private: void syncronizeTabs(); void reblendSettings(); // **RIDER** + + // data for restoring previous displayed environment - LLSettingsDay::ptr_t mEditDay; + S32 mSavedEnvironment; + + LLSettingsDay::ptr_t mEditDay; // edited copy + LLSettingsDay::ptr_t mOriginalDay; // the one we are editing S64Seconds mDayLength; U32 mCurrentTrack; std::string mLastFrameSlider; - LLButton* mSaveButton; LLButton* mCancelButton; - LLButton* mUploadButton; LLButton* mAddFrameButton; LLButton* mDeleteFrameButton; @@ -148,14 +142,21 @@ private: LLSettingsWater::ptr_t mScratchWater; // **RIDER** -// LLFlyoutComboBtnCtrl * mFlyoutControl; // not a View! + LLFlyoutComboBtnCtrl * mFlyoutControl; edit_commit_signal_t mCommitSignal; - // map of sliders to parameters - typedef std::pair<F32, LLSettingsBase::ptr_t> framedata_t; - typedef std::map<std::string, framedata_t> keymap_t; - keymap_t mSliderKeyMap; //slider keys[old_frames], shadows mFramesSlider + // For map of sliders to parameters + class FrameData + { + public: + FrameData() : mFrame(0) {}; + FrameData(F32 frame, LLSettingsBase::ptr_t settings) : mFrame(frame), pSettings(settings) {}; + F32 mFrame; + LLSettingsBase::ptr_t pSettings; + }; + typedef std::map<std::string, FrameData> keymap_t; + keymap_t mSliderKeyMap; //slider's keys vs old_frames&settings, shadows mFramesSlider }; #endif // LL_LLFloaterEditExtDayCycle_H diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 8365311179..d5fc34a04b 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -103,7 +103,7 @@ BOOL LLFloaterFixedEnvironment::postBuild() getChild<LLButton>(BUTTON_NAME_IMPORT)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onButtonImport(); }); getChild<LLButton>(BUTTON_NAME_CANCEL)->setClickedCallback([this](LLUICtrl *, const LLSD &) { onButtonCancel(); }); - mFlyoutControl = new LLFlyoutComboBtn(this, BUTTON_NAME_COMMIT, BUTTON_NAME_FLYOUT, XML_FLYOUTMENU_FILE); + mFlyoutControl = new LLFlyoutComboBtnCtrl(this, BUTTON_NAME_COMMIT, BUTTON_NAME_FLYOUT, XML_FLYOUTMENU_FILE); mFlyoutControl->setAction([this](LLUICtrl *ctrl, const LLSD &data) { onButtonApply(ctrl, data); }); return TRUE; diff --git a/indra/newview/llfloaterfixedenvironment.h b/indra/newview/llfloaterfixedenvironment.h index 6f1030e6ed..ef47941555 100644 --- a/indra/newview/llfloaterfixedenvironment.h +++ b/indra/newview/llfloaterfixedenvironment.h @@ -80,7 +80,7 @@ protected: bool canApplyRegion() const; bool canApplyParcel() const; - LLFlyoutComboBtn * mFlyoutControl; + LLFlyoutComboBtnCtrl * mFlyoutControl; LLUUID mInventoryId; LLInventoryItem * mInventoryItem; diff --git a/indra/newview/llflyoutcombobtn.cpp b/indra/newview/llflyoutcombobtn.cpp index efe76b5653..a736fcafa3 100644 --- a/indra/newview/llflyoutcombobtn.cpp +++ b/indra/newview/llflyoutcombobtn.cpp @@ -1,5 +1,5 @@ /** - * @file llsaveoutfitcombobtn.cpp + * @file llflyoutcombobtn.cpp * @brief Represents outfit save/save as combo button. * * $LicenseInfo:firstyear=2010&license=viewerlgpl$ @@ -29,7 +29,7 @@ #include "llflyoutcombobtn.h" #include "llviewermenu.h" -LLFlyoutComboBtn::LLFlyoutComboBtn(LLPanel* parent, const std::string &action_button, const std::string &flyout_button, const std::string &menu_file) : +LLFlyoutComboBtnCtrl::LLFlyoutComboBtnCtrl(LLPanel* parent, const std::string &action_button, const std::string &flyout_button, const std::string &menu_file) : mParent(parent), mActionButton(action_button), mFlyoutButton(flyout_button) @@ -48,30 +48,30 @@ LLFlyoutComboBtn::LLFlyoutComboBtn(LLPanel* parent, const std::string &action_bu setSelectedItem(0); } -void LLFlyoutComboBtn::setAction(LLUICtrl::commit_callback_t cb) +void LLFlyoutComboBtnCtrl::setAction(LLUICtrl::commit_callback_t cb) { mActionSignal.connect(cb); } -U32 LLFlyoutComboBtn::getItemCount() +U32 LLFlyoutComboBtnCtrl::getItemCount() { return mFlyoutMenu->getItemCount(); } -void LLFlyoutComboBtn::setSelectedItem(S32 itemno) +void LLFlyoutComboBtnCtrl::setSelectedItem(S32 itemno) { LLMenuItemGL *pitem = mFlyoutMenu->getItem(itemno); setSelectedItem(pitem); } -void LLFlyoutComboBtn::setSelectedItem(const std::string &item) +void LLFlyoutComboBtnCtrl::setSelectedItem(const std::string &item) { LLMenuItemGL *pitem = mFlyoutMenu->getChild<LLMenuItemGL>(item, false); setSelectedItem(pitem); } -void LLFlyoutComboBtn::setSelectedItem(LLMenuItemGL *pitem) +void LLFlyoutComboBtnCtrl::setSelectedItem(LLMenuItemGL *pitem) { if (!pitem) { @@ -86,7 +86,7 @@ void LLFlyoutComboBtn::setSelectedItem(LLMenuItemGL *pitem) action_button->setLabel(pitem->getLabel()); } -void LLFlyoutComboBtn::setMenuItemEnabled(const std::string& item, bool enabled) +void LLFlyoutComboBtnCtrl::setMenuItemEnabled(const std::string& item, bool enabled) { mFlyoutMenu->setItemEnabled(item, enabled); if (item == mSelectedName) @@ -95,12 +95,12 @@ void LLFlyoutComboBtn::setMenuItemEnabled(const std::string& item, bool enabled) } } -void LLFlyoutComboBtn::setShownBtnEnabled(bool enabled) +void LLFlyoutComboBtnCtrl::setShownBtnEnabled(bool enabled) { mParent->getChildView(mActionButton)->setEnabled(enabled); } -void LLFlyoutComboBtn::onFlyoutButton(LLUICtrl *ctrl, const LLSD &data) +void LLFlyoutComboBtnCtrl::onFlyoutButton(LLUICtrl *ctrl, const LLSD &data) { S32 x, y; LLUI::getMousePositionLocal(mParent, &x, &y); @@ -109,7 +109,7 @@ void LLFlyoutComboBtn::onFlyoutButton(LLUICtrl *ctrl, const LLSD &data) LLMenuGL::showPopup(mParent, mFlyoutMenu, x, y); } -void LLFlyoutComboBtn::onFlyoutItemSelected(LLUICtrl *ctrl, const LLSD &data) +void LLFlyoutComboBtnCtrl::onFlyoutItemSelected(LLUICtrl *ctrl, const LLSD &data) { LLMenuItemGL *pmenuitem = static_cast<LLMenuItemGL*>(ctrl); setSelectedItem(pmenuitem); @@ -117,7 +117,7 @@ void LLFlyoutComboBtn::onFlyoutItemSelected(LLUICtrl *ctrl, const LLSD &data) onFlyoutAction(pmenuitem, data); } -void LLFlyoutComboBtn::onFlyoutAction(LLUICtrl *ctrl, const LLSD &data) +void LLFlyoutComboBtnCtrl::onFlyoutAction(LLUICtrl *ctrl, const LLSD &data) { LLMenuItemGL *pmenuitem = mFlyoutMenu->getChild<LLMenuItemGL>(mSelectedName); diff --git a/indra/newview/llflyoutcombobtn.h b/indra/newview/llflyoutcombobtn.h index ebf7564422..517752d8db 100644 --- a/indra/newview/llflyoutcombobtn.h +++ b/indra/newview/llflyoutcombobtn.h @@ -24,8 +24,8 @@ * $/LicenseInfo$ */ -#ifndef LL_LLSAVECOMBOBTN_H -#define LL_LLSAVECOMBOBTN_H +#ifndef LL_LLFLYOUTCOMBOBTN_H +#define LL_LLFLYOUTCOMBOBTN_H /*TODO: Make this button generic */ @@ -33,14 +33,11 @@ class LLButton; #include "lltoggleablemenu.h" -/** - * Represents outfit Save/Save As combo button. - */ -class LLFlyoutComboBtn +class LLFlyoutComboBtnCtrl { - LOG_CLASS(LLFlyoutComboBtn); + LOG_CLASS(LLFlyoutComboBtnCtrl); public: - LLFlyoutComboBtn(LLPanel* parent, const std::string &action_button, const std::string &flyout_button, const std::string &menu_file); + LLFlyoutComboBtnCtrl(LLPanel* parent, const std::string &action_button, const std::string &flyout_button, const std::string &menu_file); void setMenuItemEnabled(const std::string &item, bool enabled); void setShownBtnEnabled(bool enabled); @@ -68,4 +65,4 @@ private: LLUICtrl::commit_signal_t mActionSignal; }; -#endif // LL_LLSAVEOUTFITCOMBOBTN_H +#endif // LL_LLFLYOUTCOMBOBTN_H 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 3a3779e753..ba4e15e7db 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 @@ -470,6 +470,22 @@ top_pad="0" name="save_btn" width="100" /> + + <button + follows="top|left" + height="23" + name="btn_flyout" + label="" + layout="topleft" + left_pad="-20" + top="0" + image_selected="SegmentedBtn_Right_Selected_Press" + image_unselected="SegmentedBtn_Right_Off" + image_pressed="SegmentedBtn_Right_Press" + image_pressed_selected="SegmentedBtn_Right_Selected_Press" + image_overlay="Arrow_Small_Up" + width="20"/> + <button follows="top|left" height="23" @@ -479,29 +495,14 @@ name="cancel_btn" width="100" /> - <button + <!--<button follows="top|left" height="23" label="Upload" layout="topleft" left_pad="10" name="upload_btn" - width="100" /> - - <!--<button - follows="top|left" - height="23" - name="btn_flyout" - label="" - layout="topleft" - left_pad="-20" - top="0" - image_selected="SegmentedBtn_Right_Selected_Press" - image_unselected="SegmentedBtn_Right_Off" - image_pressed="SegmentedBtn_Right_Press" - image_pressed_selected="SegmentedBtn_Right_Selected_Press" - image_overlay="Arrow_Small_Up" - width="20"/>--> + width="100" />--> </layout_panel> </layout_stack> |