diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-01-10 22:11:11 +0200 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-01-10 22:11:11 +0200 |
commit | 00d8caa359a216620db46d49696bc79a95fe8dc2 (patch) | |
tree | 96d4e35810df1b3033feb08957616df25383753d /indra/newview | |
parent | c0f67e8d6a20933d35539888b229e3ac77fa22ec (diff) |
SL-10279 Finalize drag and drop support
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llenvironment.cpp | 17 | ||||
-rw-r--r-- | indra/newview/llenvironment.h | 5 | ||||
-rw-r--r-- | indra/newview/llfloatereditextdaycycle.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llfloaterfixedenvironment.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llfloatermyenvironment.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.cpp | 54 | ||||
-rw-r--r-- | indra/newview/llpanelenvironment.h | 14 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_region_environment.xml | 2 |
9 files changed, 75 insertions, 31 deletions
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index d925dd9d49..5acd508d5d 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -1200,7 +1200,7 @@ void LLEnvironment::updateRegion(const LLSettingsDay::ptr_t &pday, S32 day_lengt updateParcel(INVALID_PARCEL_ID, pday, day_length, day_offset, altitudes, cb); } -void LLEnvironment::updateRegion(const LLUUID &asset_id, std::string display_name, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) +void LLEnvironment::updateRegion(const LLUUID &asset_id, std::string display_name, S32 track_num, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) { if (!isExtendedEnvironmentEnabled()) { @@ -1209,7 +1209,7 @@ void LLEnvironment::updateRegion(const LLUUID &asset_id, std::string display_nam return; } - updateParcel(INVALID_PARCEL_ID, asset_id, display_name, day_length, day_offset, altitudes, cb); + updateParcel(INVALID_PARCEL_ID, asset_id, display_name, track_num, day_length, day_offset, altitudes, cb); } void LLEnvironment::updateRegion(const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) @@ -1261,12 +1261,12 @@ void LLEnvironment::requestParcel(S32 parcel_id, environment_apply_fn cb) [this, parcel_id, cb]() { coroRequestEnvironment(parcel_id, cb); }); } -void LLEnvironment::updateParcel(S32 parcel_id, const LLUUID &asset_id, std::string display_name, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) +void LLEnvironment::updateParcel(S32 parcel_id, const LLUUID &asset_id, std::string display_name, S32 track_num, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) { UpdateInfo::ptr_t updates(std::make_shared<UpdateInfo>(asset_id, display_name, day_length, day_offset, altitudes)); std::string coroname = LLCoros::instance().launch("LLEnvironment::coroUpdateEnvironment", - [this, parcel_id, updates, cb]() { coroUpdateEnvironment(parcel_id, NO_TRACK, updates, cb); }); + [this, parcel_id, track_num, updates, cb]() { coroUpdateEnvironment(parcel_id, track_num, updates, cb); }); } void LLEnvironment::onUpdateParcelAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr_t settings, S32 status, S32 parcel_id, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes) @@ -1309,13 +1309,18 @@ void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsWater::ptr_t &pw updateParcel(parcel_id, pday, day_length, day_offset, altitudes, cb); } -void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) +void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday, S32 track_num, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) { UpdateInfo::ptr_t updates(std::make_shared<UpdateInfo>(pday, day_length, day_offset, altitudes)); std::string coroname = LLCoros::instance().launch("LLEnvironment::coroUpdateEnvironment", - [this, parcel_id, updates, cb]() { coroUpdateEnvironment(parcel_id, NO_TRACK, updates, cb); }); + [this, parcel_id, track_num, updates, cb]() { coroUpdateEnvironment(parcel_id, track_num, updates, cb); }); +} + +void LLEnvironment::updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, LLEnvironment::altitudes_vect_t altitudes, environment_apply_fn cb) +{ + updateParcel(parcel_id, pday, NO_TRACK, day_length, day_offset, altitudes, cb); } diff --git a/indra/newview/llenvironment.h b/indra/newview/llenvironment.h index d9b667cd79..c925ea6e7c 100644 --- a/indra/newview/llenvironment.h +++ b/indra/newview/llenvironment.h @@ -201,13 +201,14 @@ public: connection_t setEnvironmentChanged(env_changed_fn cb) { return mSignalEnvChanged.connect(cb); } void requestRegion(environment_apply_fn cb = environment_apply_fn()); - void updateRegion(const LLUUID &asset_id, std::string display_name, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); + void updateRegion(const LLUUID &asset_id, std::string display_name, S32 track_num, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void updateRegion(const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void updateRegion(const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void updateRegion(const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void resetRegion(environment_apply_fn cb = environment_apply_fn()); void requestParcel(S32 parcel_id, environment_apply_fn cb = environment_apply_fn()); - void updateParcel(S32 parcel_id, const LLUUID &asset_id, std::string display_name, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); + void updateParcel(S32 parcel_id, const LLUUID &asset_id, std::string display_name, S32 track_num, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); + void updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday, S32 track_num, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void updateParcel(S32 parcel_id, const LLSettingsDay::ptr_t &pday, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void updateParcel(S32 parcel_id, const LLSettingsSky::ptr_t &psky, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); void updateParcel(S32 parcel_id, const LLSettingsWater::ptr_t &pwater, S32 day_length, S32 day_offset, altitudes_vect_t altitudes = altitudes_vect_t(), environment_apply_fn cb = environment_apply_fn()); diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp index b27efb56fd..048090aea6 100644 --- a/indra/newview/llfloatereditextdaycycle.cpp +++ b/indra/newview/llfloatereditextdaycycle.cpp @@ -1476,7 +1476,7 @@ void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where, cons if (mInventoryItem && !isDirty()) { - LLEnvironment::instance().updateParcel(parcel->getLocalID(), mInventoryItem->getAssetUUID(), mInventoryItem->getName(), -1, -1); + LLEnvironment::instance().updateParcel(parcel->getLocalID(), mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1); } else { @@ -1487,7 +1487,7 @@ void LLFloaterEditExtDayCycle::doApplyEnvironment(const std::string &where, cons { if (mInventoryItem && !isDirty()) { - LLEnvironment::instance().updateRegion(mInventoryItem->getAssetUUID(), mInventoryItem->getName(), -1, -1); + LLEnvironment::instance().updateRegion(mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1); } else { diff --git a/indra/newview/llfloaterfixedenvironment.cpp b/indra/newview/llfloaterfixedenvironment.cpp index 712c7cf31a..4e6bc6eae0 100644 --- a/indra/newview/llfloaterfixedenvironment.cpp +++ b/indra/newview/llfloaterfixedenvironment.cpp @@ -549,7 +549,7 @@ void LLFloaterFixedEnvironment::doApplyEnvironment(const std::string &where) if (mInventoryItem && !isDirty()) { - LLEnvironment::instance().updateParcel(parcel->getLocalID(), mInventoryItem->getAssetUUID(), mInventoryItem->getName(), -1, -1); + LLEnvironment::instance().updateParcel(parcel->getLocalID(), mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1); } else if (mSettings->getSettingsType() == "sky") { @@ -564,7 +564,7 @@ void LLFloaterFixedEnvironment::doApplyEnvironment(const std::string &where) { if (mInventoryItem && !isDirty()) { - LLEnvironment::instance().updateRegion(mInventoryItem->getAssetUUID(), mInventoryItem->getName(), -1, -1); + LLEnvironment::instance().updateRegion(mInventoryItem->getAssetUUID(), mInventoryItem->getName(), LLEnvironment::NO_TRACK, -1, -1); } else if (mSettings->getSettingsType() == "sky") { diff --git a/indra/newview/llfloatermyenvironment.cpp b/indra/newview/llfloatermyenvironment.cpp index f93d7ce8ed..1edec248d9 100644 --- a/indra/newview/llfloatermyenvironment.cpp +++ b/indra/newview/llfloatermyenvironment.cpp @@ -324,7 +324,7 @@ void LLFloaterMyEnvironment::onDoApply(const std::string &context) if (context == PARAMETER_REGION) { - LLEnvironment::instance().updateRegion(asset_id, name, -1, -1); + LLEnvironment::instance().updateRegion(asset_id, name, LLEnvironment::NO_TRACK, -1, -1); LLEnvironment::instance().setSharedEnvironment(); } else if (context == PARAMETER_PARCEL) @@ -335,7 +335,7 @@ void LLFloaterMyEnvironment::onDoApply(const std::string &context) LL_WARNS("ENVIRONMENT") << "Unable to determine parcel." << LL_ENDL; return; } - LLEnvironment::instance().updateParcel(parcel->getLocalID(), asset_id, name, -1, -1); + LLEnvironment::instance().updateParcel(parcel->getLocalID(), asset_id, name, LLEnvironment::NO_TRACK, -1, -1); LLEnvironment::instance().setSharedEnvironment(); } else if (context == PARAMETER_LOCAL) diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 44927de75e..142720dd03 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -6959,7 +6959,7 @@ void LLSettingsBridge::performAction(LLInventoryModel* model, std::string action S32 parcel_id = parcel->getLocalID(); LL_WARNS("LAPRAS") << "Applying asset ID " << asset_id << " to parcel " << parcel_id << LL_ENDL; - LLEnvironment::instance().updateParcel(parcel_id, asset_id, name, -1, -1); + LLEnvironment::instance().updateParcel(parcel_id, asset_id, name, LLEnvironment::NO_TRACK, -1, -1); LLEnvironment::instance().setSharedEnvironment(); } else diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp index 6e6879ca0c..f84ceb6853 100644 --- a/indra/newview/llpanelenvironment.cpp +++ b/indra/newview/llpanelenvironment.cpp @@ -109,6 +109,7 @@ const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK( const U32 ALTITUDE_SLIDER_COUNT = 3; const F32 ALTITUDE_DEFAULT_HEIGHT_STEP = 1000; const U32 ALTITUDE_MARKERS_COUNT = 3; +const U32 ALTITUDE_PREFIXERS_COUNT = 5; const std::string slider_marker_base = "mark"; @@ -179,7 +180,16 @@ BOOL LLPanelEnvironmentInfo::postBuild() mChangeMonitor = LLEnvironment::instance().setEnvironmentChanged([this](LLEnvironment::EnvSelection_t env, S32 version) { onEnvironmentChanged(env, version); }); - getChild<LLSettingsDropTarget>(SDT_DROP_TARGET)->setPanel(this); + for (U32 idx = 0; idx < ALTITUDE_SLIDER_COUNT; idx++) + { + LLSettingsDropTarget* drop_target = findChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[idx]); + if (drop_target) + { + drop_target->setPanel(this, alt_sliders[idx]); + } + } + getChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[3])->setPanel(this, alt_prefixes[3]); + getChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[4])->setPanel(this, alt_prefixes[4]); return TRUE; } @@ -260,7 +270,7 @@ void LLPanelEnvironmentInfo::refresh() { sld->addSlider(altitudes[idx + 1], alt_sliders[idx]); updateAltLabel(alt_prefixes[idx], idx + 2, altitudes[idx + 1]); - mAltitudes[alt_sliders[idx]] = AltitudeData(idx+1, idx, altitudes[idx+1]); + mAltitudes[alt_sliders[idx]] = AltitudeData(idx+2, idx, altitudes[idx+1]); } if (sld->getCurNumSliders() != ALTITUDE_SLIDER_COUNT) { @@ -460,7 +470,14 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled) } } - getChild<LLSettingsDropTarget>(SDT_DROP_TARGET)->setDndEnabled(enabled && !is_legacy); + for (U32 idx = 0; idx < ALTITUDE_PREFIXERS_COUNT; idx++) + { + LLSettingsDropTarget* drop_target = findChild<LLSettingsDropTarget>("sdt_" + alt_prefixes[idx]); + if (drop_target) + { + drop_target->setDndEnabled(enabled && !is_legacy); + } + } return true; } @@ -621,7 +638,7 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da while (iter != end) { iter2 = mAltitudes.begin(); - new_index = 1; + new_index = 2; while (iter2 != end) { if (iter->second.mAltitude > iter2->second.mAltitude) @@ -630,9 +647,9 @@ void LLPanelEnvironmentInfo::onAltSliderCallback(LLUICtrl *cntrl, const LLSD &da } iter2++; } - iter->second.mAltitudeIndex = new_index; + iter->second.mTrackIndex = new_index; - updateAltLabel(alt_prefixes[iter->second.mLabelIndex], iter->second.mAltitudeIndex + 1, iter->second.mAltitude); + updateAltLabel(alt_prefixes[iter->second.mLabelIndex], iter->second.mTrackIndex, iter->second.mAltitude); iter++; } @@ -771,7 +788,24 @@ void LLPanelEnvironmentInfo::onIdlePlay(void *data) ((LLPanelEnvironmentInfo *)data)->udpateApparentTimeOfDay(); } -void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id) + +void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id, std::string source) +{ + if (source == alt_prefixes[4]) + { + onPickerCommitted(item_id, 0); + } + else if (source == alt_prefixes[3]) + { + onPickerCommitted(item_id, 1); + } + else + { + onPickerCommitted(item_id, mAltitudes[source].mTrackIndex); + } +} + +void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id, S32 track_num) { LLInventoryItem *itemp = gInventory.getItem(item_id); if (itemp) @@ -779,7 +813,8 @@ void LLPanelEnvironmentInfo::onPickerCommitted(LLUUID item_id) LLHandle<LLPanel> that_h = getHandle(); LLEnvironment::instance().updateParcel(getParcelId(), itemp->getAssetUUID(), - itemp->getName(), + itemp->getName(), + track_num, -1, -1, LLEnvironment::altitudes_vect_t(), [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); }); } @@ -946,7 +981,8 @@ BOOL LLSettingsDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, *accept = ACCEPT_YES_COPY_SINGLE; if (drop) { - mEnvironmentInfoPanel->onPickerCommitted(item_id); + // might be better to use name of the element + mEnvironmentInfoPanel->onPickerCommitted(item_id, mTrack); } } } diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h index b5debe69c2..87ce0772b2 100644 --- a/indra/newview/llpanelenvironment.h +++ b/indra/newview/llpanelenvironment.h @@ -123,7 +123,8 @@ protected: void udpateApparentTimeOfDay(); - void onPickerCommitted(LLUUID item_id); + void onPickerCommitted(LLUUID item_id, std::string source); + void onPickerCommitted(LLUUID item_id, S32 track_num = LLEnvironment::NO_TRACK); void onEditCommitted(LLSettingsDay::ptr_t newday); void onDayLenOffsetMouseUp(); @@ -154,13 +155,13 @@ protected: { public: AltitudeData() : - mAltitudeIndex(0), mLabelIndex(0), mAltitude(0) + mTrackIndex(0), mLabelIndex(0), mAltitude(0) {} - AltitudeData(U32 altitude_index, U32 label_index, F32 altitude) : - mAltitudeIndex(altitude_index), mLabelIndex(label_index), mAltitude(altitude) + AltitudeData(U32 track_index, U32 label_index, F32 altitude) : + mTrackIndex(track_index), mLabelIndex(label_index), mAltitude(altitude) {} - U32 mAltitudeIndex; + U32 mTrackIndex; U32 mLabelIndex; F32 mAltitude; }; @@ -211,11 +212,12 @@ public: void* cargo_data, EAcceptance* accept, std::string& tooltip_msg); - void setPanel(LLPanelEnvironmentInfo* panel) { mEnvironmentInfoPanel = panel; }; + void setPanel(LLPanelEnvironmentInfo* panel, std::string track) { mEnvironmentInfoPanel = panel; mTrack = track; }; void setDndEnabled(bool dnd_enabled) { mDndEnabled = dnd_enabled; }; protected: LLPanelEnvironmentInfo* mEnvironmentInfoPanel; + std::string mTrack; bool mDndEnabled; }; #endif // LL_LLPANELENVIRONMENT_H diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml index ed344f2a14..0c0ca2ac60 100644 --- a/indra/newview/skins/default/xui/en/panel_region_environment.xml +++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml @@ -263,7 +263,7 @@ left_delta="0" follows="top|left" layout="topleft" - name="sdt_alt2" + name="sdt_alt1" tool_tip="Drag a setting from Inventory onto this target box to select it as current sky." width="155" /> </panel> |