From d7aa36abe0b8328dd5ab137c178a4080adf61756 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sun, 10 Feb 2019 14:08:29 +0100 Subject: [PATCH] Add some context cones for contacts floater --- indra/newview/fsfloatercontacts.cpp | 6 ++-- indra/newview/fsfloatercontacts.h | 2 +- .../fsfloatercontactsetconfiguration.cpp | 33 ++++++++++++++++--- .../fsfloatercontactsetconfiguration.h | 12 +++++-- indra/newview/fspanelcontactsets.cpp | 20 ++++++----- indra/newview/fspanelcontactsets.h | 16 ++++----- 6 files changed, 63 insertions(+), 26 deletions(-) diff --git a/indra/newview/fsfloatercontacts.cpp b/indra/newview/fsfloatercontacts.cpp index cf2965b17f..2a108bf57b 100644 --- a/indra/newview/fsfloatercontacts.cpp +++ b/indra/newview/fsfloatercontacts.cpp @@ -125,7 +125,7 @@ BOOL FSFloaterContacts::postBuild() mFriendsTab->childSetAction("map_btn", boost::bind(&FSFloaterContacts::onMapButtonClicked, this)); mFriendsTab->childSetAction("pay_btn", boost::bind(&FSFloaterContacts::onPayButtonClicked, this)); mFriendsTab->childSetAction("remove_btn", boost::bind(&FSFloaterContacts::onDeleteFriendButtonClicked, this)); - mFriendsTab->childSetAction("add_btn", boost::bind(&FSFloaterContacts::onAddFriendWizButtonClicked, this)); + mFriendsTab->childSetAction("add_btn", boost::bind(&FSFloaterContacts::onAddFriendWizButtonClicked, this, _1)); mFriendsTab->setDefaultBtn("im_btn"); mFriendsTab->getChild("friend_count")->setTextArg("COUNT", llformat("%d", mFriendsList->getItemCount())); @@ -372,10 +372,10 @@ void FSFloaterContacts::onAvatarPicked(const uuid_vec_t& ids, const std::vector< } } -void FSFloaterContacts::onAddFriendWizButtonClicked() +void FSFloaterContacts::onAddFriendWizButtonClicked(LLUICtrl* ctrl) { // Show add friend wizard. - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&FSFloaterContacts::onAvatarPicked, _1, _2), FALSE, TRUE); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&FSFloaterContacts::onAvatarPicked, _1, _2), FALSE, TRUE, TRUE, "", ctrl); // Need to disable 'ok' button when friend occurs in selection if (picker) { diff --git a/indra/newview/fsfloatercontacts.h b/indra/newview/fsfloatercontacts.h index 3f1c0fd99e..398de020e9 100644 --- a/indra/newview/fsfloatercontacts.h +++ b/indra/newview/fsfloatercontacts.h @@ -127,7 +127,7 @@ private: void onTeleportButtonClicked(); void onPayButtonClicked(); void onDeleteFriendButtonClicked(); - void onAddFriendWizButtonClicked(); + void onAddFriendWizButtonClicked(LLUICtrl* ctrl); void onContactSetsButtonClicked(); void onMapButtonClicked(); diff --git a/indra/newview/fsfloatercontactsetconfiguration.cpp b/indra/newview/fsfloatercontactsetconfiguration.cpp index b81653b1c9..839f750a75 100644 --- a/indra/newview/fsfloatercontactsetconfiguration.cpp +++ b/indra/newview/fsfloatercontactsetconfiguration.cpp @@ -28,18 +28,28 @@ */ #include "llviewerprecompiledheaders.h" + #include "fsfloatercontactsetconfiguration.h" + #include "lggcontactsets.h" +#include "llbutton.h" #include "llcheckboxctrl.h" #include "llcolorswatch.h" #include "lllineeditor.h" -#include "llbutton.h" #include "llnotificationsutil.h" +#include "llviewercontrol.h" FSFloaterContactSetConfiguration::FSFloaterContactSetConfiguration(const LLSD& target_set) -: LLFloater(target_set) +: LLFloater(target_set), + mContextConeOpacity(0.f), + mContextConeInAlpha(0.f), + mContextConeOutAlpha(0.f), + mContextConeFadeTime(0.f) { mContactSet = target_set.asString(); + mContextConeInAlpha = gSavedSettings.getF32("ContextConeInAlpha"); + mContextConeOutAlpha = gSavedSettings.getF32("ContextConeOutAlpha"); + mContextConeFadeTime = gSavedSettings.getF32("ContextConeFadeTime"); } BOOL FSFloaterContactSetConfiguration::postBuild() @@ -57,13 +67,13 @@ BOOL FSFloaterContactSetConfiguration::postBuild() { mSetSwatch->setCommitCallback(boost::bind(&FSFloaterContactSetConfiguration::onCommitSetColor, this)); } - + mGlobalSwatch = getChild("global_swatch"); if (mGlobalSwatch) { mGlobalSwatch->setCommitCallback(boost::bind(&FSFloaterContactSetConfiguration::onCommitDefaultColor, this)); } - + mNotificationCheckBox = getChild("show_set_notifications"); if (mNotificationCheckBox) { @@ -72,6 +82,13 @@ BOOL FSFloaterContactSetConfiguration::postBuild() return TRUE; } +void FSFloaterContactSetConfiguration::draw() +{ + static LLCachedControl max_opacity(gSavedSettings, "PickerContextOpacity", 0.4f); + drawConeToOwner(mContextConeOpacity, max_opacity, mFrustumOrigin.get(), mContextConeFadeTime, mContextConeInAlpha, mContextConeOutAlpha); + LLFloater::draw(); +} + void FSFloaterContactSetConfiguration::onOpen(const LLSD& target_set) { mSetSwatch->set(LGGContactSets::getInstance()->getSetColor(mContactSet), TRUE); @@ -119,3 +136,11 @@ void FSFloaterContactSetConfiguration::updateTitle() map["NAME"] = mContactSet; setTitle(getString("title", map)); } + +void FSFloaterContactSetConfiguration::setFrustumOrigin(LLView* frustumOrigin) +{ + if (frustumOrigin) + { + mFrustumOrigin = frustumOrigin->getHandle(); + } +} diff --git a/indra/newview/fsfloatercontactsetconfiguration.h b/indra/newview/fsfloatercontactsetconfiguration.h index a3449c5d3f..0e229440ec 100644 --- a/indra/newview/fsfloatercontactsetconfiguration.h +++ b/indra/newview/fsfloatercontactsetconfiguration.h @@ -43,7 +43,9 @@ public: FSFloaterContactSetConfiguration(const LLSD& target_set); BOOL postBuild(); void onOpen(const LLSD& target_set); - + void draw(); + void setFrustumOrigin(LLView* frustumOrigin); + private: ~FSFloaterContactSetConfiguration(){}; void onCommitSetColor(); @@ -55,12 +57,18 @@ private: // Wish there was something better to use for this... std::string mContactSet; - + LLCheckBoxCtrl* mNotificationCheckBox; LLColorSwatchCtrl* mSetSwatch; LLColorSwatchCtrl* mGlobalSwatch; LLLineEditor* mSetName; LLButton* mRenameButton; + + LLHandle mFrustumOrigin; + F32 mContextConeOpacity; + F32 mContextConeInAlpha; + F32 mContextConeOutAlpha; + F32 mContextConeFadeTime; }; #endif //FS_FLOATERCONTACTSETCONFIGURATION_H diff --git a/indra/newview/fspanelcontactsets.cpp b/indra/newview/fspanelcontactsets.cpp index dd28c3164f..c9dada71f8 100644 --- a/indra/newview/fspanelcontactsets.cpp +++ b/indra/newview/fspanelcontactsets.cpp @@ -29,15 +29,16 @@ #include "llviewerprecompiledheaders.h" -#include "llnotificationsutil.h" - #include "fspanelcontactsets.h" + #include "fsfloatercontacts.h" +#include "fsfloatercontactsetconfiguration.h" #include "lggcontactsets.h" #include "llavataractions.h" #include "llcallingcard.h" #include "llfloateravatarpicker.h" #include "llfloaterreg.h" +#include "llnotificationsutil.h" #include "llpanelpeoplemenus.h" #include "llslurl.h" @@ -63,8 +64,8 @@ BOOL FSPanelContactSets::postBuild() { childSetAction("add_set_btn", boost::bind(&FSPanelContactSets::onClickAddSet, this)); childSetAction("remove_set_btn", boost::bind(&FSPanelContactSets::onClickRemoveSet, this)); - childSetAction("config_btn", boost::bind(&FSPanelContactSets::onClickConfigureSet, this)); - childSetAction("add_btn", boost::bind(&FSPanelContactSets::onClickAddAvatar, this)); + childSetAction("config_btn", boost::bind(&FSPanelContactSets::onClickConfigureSet, this, _1)); + childSetAction("add_btn", boost::bind(&FSPanelContactSets::onClickAddAvatar, this, _1)); childSetAction("remove_btn", boost::bind(&FSPanelContactSets::onClickRemoveAvatar, this)); childSetAction("profile_btn", boost::bind(&FSPanelContactSets::onClickOpenProfile, this)); childSetAction("start_im_btn", boost::bind(&FSPanelContactSets::onClickStartIM, this)); @@ -222,11 +223,11 @@ void FSPanelContactSets::refreshSetList() resetControls(); } -void FSPanelContactSets::onClickAddAvatar() +void FSPanelContactSets::onClickAddAvatar(LLUICtrl* ctrl) { LLFloater* root_floater = gFloaterView->getParentFloater(this); LLFloater* avatar_picker = LLFloaterAvatarPicker::show(boost::bind(&FSPanelContactSets::handlePickerCallback, this, _1, mContactSetCombo->getValue().asString()), - TRUE, TRUE, TRUE, root_floater->getName()); + TRUE, TRUE, TRUE, root_floater->getName(), ctrl); if (root_floater && avatar_picker) { root_floater->addDependentFloater(avatar_picker); @@ -277,12 +278,15 @@ void FSPanelContactSets::onClickRemoveSet() LLNotificationsUtil::add("RemoveContactSet", args, payload, &LGGContactSets::handleRemoveContactSetCallback); } -void FSPanelContactSets::onClickConfigureSet() +void FSPanelContactSets::onClickConfigureSet(LLUICtrl* ctrl) { LLFloater* root_floater = gFloaterView->getParentFloater(this); - LLFloater* config_floater = LLFloaterReg::showInstance("fs_contact_set_config", LLSD(mContactSetCombo->getValue().asString())); + FSFloaterContactSetConfiguration* config_floater = LLFloaterReg::showTypedInstance("fs_contact_set_config", LLSD(mContactSetCombo->getValue().asString())); + config_floater->setFrustumOrigin(ctrl); if (root_floater && config_floater) + { root_floater->addDependentFloater(config_floater); + } } void FSPanelContactSets::onClickOpenProfile() diff --git a/indra/newview/fspanelcontactsets.h b/indra/newview/fspanelcontactsets.h index f4d30a4a73..0f30a0fa81 100644 --- a/indra/newview/fspanelcontactsets.h +++ b/indra/newview/fspanelcontactsets.h @@ -43,13 +43,13 @@ public: FSPanelContactSets(); BOOL postBuild(); void refreshSetList(); - + private: ~FSPanelContactSets(); - + void onSelectAvatar(); void generateAvatarList(const std::string& contact_set); - void onClickAddAvatar(); + void onClickAddAvatar(LLUICtrl* ctrl); void handlePickerCallback(const uuid_vec_t& ids, const std::string& set); void onClickRemoveAvatar(); void onClickOpenProfile(); @@ -57,20 +57,20 @@ private: void onClickOfferTeleport(); void onClickAddSet(); void onClickRemoveSet(); - void onClickConfigureSet(); + void onClickConfigureSet(LLUICtrl* ctrl); void onClickRemoveDisplayName(); void onClickSetPseudonym(); void onClickRemovePseudonym(); - + void refreshContactSets(); void removeAvatarFromSet(); void resetControls(); - + void updateSets(LGGContactSets::EContactSetUpdate type); boost::signals2::connection mContactSetChangedConnection; - + uuid_vec_t mAvatarSelections; - + LLComboBox* mContactSetCombo; LLAvatarList* mAvatarList; };