diff options
Diffstat (limited to 'indra/newview/llsettingspicker.cpp')
-rw-r--r-- | indra/newview/llsettingspicker.cpp | 91 |
1 files changed, 18 insertions, 73 deletions
diff --git a/indra/newview/llsettingspicker.cpp b/indra/newview/llsettingspicker.cpp index 7aa9cf0ae8..e2d6d43ae3 100644 --- a/indra/newview/llsettingspicker.cpp +++ b/indra/newview/llsettingspicker.cpp @@ -55,10 +55,6 @@ namespace const std::string BTN_SELECT("btn_select"); const std::string BTN_CANCEL("btn_cancel"); - const F32 CONTEXT_CONE_IN_ALPHA(0.0f); - const F32 CONTEXT_CONE_OUT_ALPHA(1.0f); - const F32 CONTEXT_FADE_TIME(0.08f); - // strings in xml const std::string STR_TITLE_PREFIX = "pick title"; @@ -76,7 +72,7 @@ LLFloaterSettingsPicker::LLFloaterSettingsPicker(LLView * owner, LLUUID initial_ mActive(true), mContextConeOpacity(0.0f), mSettingItemID(initial_item_id), - mTrackWater(true), + mTrackMode(TRACK_NONE), mImmediateFilterPermMask(PERM_NONE) { mOwnerHandle = owner->getHandle(); @@ -136,6 +132,8 @@ BOOL LLFloaterSettingsPicker::postBuild() childSetAction(BTN_CANCEL, [this](LLUICtrl*, const LLSD& param){ onButtonCancel(); }); childSetAction(BTN_SELECT, [this](LLUICtrl*, const LLSD& param){ onButtonSelect(); }); + getChild<LLPanel>(PNL_COMBO)->setVisible(mTrackMode != TRACK_NONE); + // update permission filter once UI is fully initialized mSavedFolderState.setApply(FALSE); @@ -173,13 +171,18 @@ void LLFloaterSettingsPicker::setSettingsFilter(LLSettingsType::type_e type) filter = static_cast<S64>(0x1) << static_cast<S64>(type); } - bool day_cycle = (type != LLSettingsType::ST_WATER) && (type != LLSettingsType::ST_SKY); - getChild<LLPanel>(PNL_COMBO)->setVisible(day_cycle); + mInventoryPanel->setFilterSettingsTypes(filter); +} + +void LLFloaterSettingsPicker::setTrackMode(ETrackMode mode) +{ + mTrackMode = mode; + getChild<LLPanel>(PNL_COMBO)->setVisible(mode != TRACK_NONE); + std::string prefix = getString(STR_TITLE_PREFIX); std::string label; - if (day_cycle) + if (mode != TRACK_NONE) { - label = getString(STR_TITLE_TRACK); } else @@ -187,66 +190,13 @@ void LLFloaterSettingsPicker::setSettingsFilter(LLSettingsType::type_e type) label = getString(STR_TITLE_SETTINGS); } setTitle(prefix + " " + label); - - mInventoryPanel->setFilterSettingsTypes(filter); } void LLFloaterSettingsPicker::draw() { LLView *owner = mOwnerHandle.get(); - if (owner) - { - // draw cone of context pointing back to texture swatch - LLRect owner_rect; - owner->localRectToOtherView(owner->getLocalRect(), &owner_rect, this); - LLRect local_rect = getLocalRect(); - if (gFocusMgr.childHasKeyboardFocus(this) && owner->isInVisibleChain() && mContextConeOpacity > 0.001f) - { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - LLGLEnable(GL_CULL_FACE); - gGL.begin(LLRender::QUADS); - { - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); - gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mTop); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop); - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mTop); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mRight, owner_rect.mTop); - gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); - - - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_OUT_ALPHA * mContextConeOpacity); - gGL.vertex2i(local_rect.mLeft, local_rect.mBottom); - gGL.vertex2i(local_rect.mRight, local_rect.mBottom); - gGL.color4f(0.f, 0.f, 0.f, CONTEXT_CONE_IN_ALPHA * mContextConeOpacity); - gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom); - gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom); - } - gGL.end(); - } - } - - if (gFocusMgr.childHasMouseCapture(getDragHandle())) - { - mContextConeOpacity = lerp(mContextConeOpacity, gSavedSettings.getF32("PickerContextOpacity"), LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); - } - else - { - mContextConeOpacity = lerp(mContextConeOpacity, 0.f, LLSmoothInterpolation::getInterpolant(CONTEXT_FADE_TIME)); - } + static LLCachedControl<F32> max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, owner); LLFloater::draw(); } @@ -289,7 +239,6 @@ void LLFloaterSettingsPicker::onFilterEdit(const std::string& search_string) void LLFloaterSettingsPicker::onSelectionChange(const LLFloaterSettingsPicker::itemlist_t &items, bool user_action) { - bool track_picker_enabled = false; bool is_item = false; LLUUID asset_id; if (items.size()) @@ -315,15 +264,11 @@ void LLFloaterSettingsPicker::onSelectionChange(const LLFloaterSettingsPicker::i { mChangeIDSignal(mSettingItemID); } - - if (bridge_model->getSettingsType() == LLSettingsType::ST_DAYCYCLE - && !mNoCopySettingsSelected) - { - track_picker_enabled = true; - } } } } + bool track_picker_enabled = mTrackMode != TRACK_NONE; + getChild<LLView>(CMB_TRACK_SELECTION)->setEnabled(track_picker_enabled && mSettingAssetID == asset_id); getChild<LLView>(BTN_SELECT)->setEnabled(is_item && (!track_picker_enabled || mSettingAssetID == asset_id)); if (track_picker_enabled && asset_id.notNull() && mSettingAssetID != asset_id) @@ -359,11 +304,11 @@ void LLFloaterSettingsPicker::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr track_selection->removeall(); LLSettingsDay::ptr_t pday = std::dynamic_pointer_cast<LLSettingsDay>(settings); - if (mTrackWater) + if (mTrackMode == TRACK_WATER) { track_selection->add(getString(STR_TRACK_WATER), LLSD::Integer(LLSettingsDay::TRACK_WATER), ADD_TOP, true); } - else + else if (mTrackMode == TRACK_SKY) { // track 1 always present track_selection->add(getString(STR_TRACK_GROUND), LLSD::Integer(LLSettingsDay::TRACK_GROUND_LEVEL), ADD_TOP, true); |