Radar Improvements: Radar always active, Minor Refactoring, Ansariel's colorful range indicator
parent
6c70d222fa
commit
9c24c207d7
|
|
@ -242,6 +242,9 @@ LLAvatarList::LLAvatarList(const Params& p)
|
|||
, mShowPaymentStatus(false)
|
||||
, mItemHeight(0)
|
||||
// [/RLVa:KB]
|
||||
// [Ansariel: Colorful radar]
|
||||
, mUseRangeColors(false)
|
||||
// [Ansariel: Colorful radar]
|
||||
{
|
||||
setCommitOnSelectionChange(true);
|
||||
|
||||
|
|
@ -294,6 +297,20 @@ void LLAvatarList::showMiniProfileIcons(bool visible)
|
|||
}
|
||||
}
|
||||
|
||||
// [Ansariel: Colorful radar]
|
||||
void LLAvatarList::setUseRangeColors(bool UseRangeColors)
|
||||
{
|
||||
mUseRangeColors = UseRangeColors;
|
||||
|
||||
std::vector<LLPanel*> items;
|
||||
getItems(items);
|
||||
for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
|
||||
{
|
||||
static_cast<LLAvatarListItem*>(*it)->setUseRangeColors(mUseRangeColors);
|
||||
}
|
||||
}
|
||||
// [Ansariel: Colorful radar]
|
||||
|
||||
// virtual
|
||||
void LLAvatarList::draw()
|
||||
{
|
||||
|
|
@ -404,6 +421,7 @@ void LLAvatarList::addAvalineItem(const LLUUID& item_id, const LLUUID& session_i
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
void LLAvatarList::refresh()
|
||||
{
|
||||
llinfos << "AO: refreshing" << llendl;
|
||||
bool have_names = TRUE;
|
||||
bool add_limit_exceeded = false;
|
||||
bool modified = false;
|
||||
|
|
@ -609,6 +627,13 @@ void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is
|
|||
item->showStatusFlags(mShowStatusFlags);
|
||||
item->showPaymentStatus(mShowPaymentStatus);
|
||||
item->showAvatarAge(mShowAge);
|
||||
|
||||
// [Ansariel: Colorful radar]
|
||||
item->setUseRangeColors(mUseRangeColors);
|
||||
LLUIColorTable* colorTable = &LLUIColorTable::instance();
|
||||
item->setShoutRangeColor(colorTable->getColor("AvatarListItemShoutRange", LLColor4::yellow));
|
||||
item->setBeyondShoutRangeColor(colorTable->getColor("AvatarListItemBeyondShoutRange", LLColor4::red));
|
||||
// [/Ansariel: Colorful radar]
|
||||
|
||||
item->setDoubleClickCallback(boost::bind(&LLAvatarList::onItemDoubleClicked, this, _1, _2, _3, _4));
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,10 @@ public:
|
|||
bool getIconsVisible() const { return mShowIcons; }
|
||||
const std::string getIconParamName() const{return mIconParamName;}
|
||||
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
|
||||
|
||||
// [Ansariel: Colorful radar]
|
||||
void setUseRangeColors(bool UseRangeColors);
|
||||
// [/Ansariel: Colorful radar]
|
||||
|
||||
// Return true if filter has at least one match.
|
||||
bool filterHasMatches();
|
||||
|
|
@ -147,6 +151,10 @@ private:
|
|||
bool mIgnoreGlobalIcons;
|
||||
S32 mItemHeight;
|
||||
|
||||
// [Ansariel: Colorful radar]
|
||||
bool mUseRangeColors;
|
||||
// [/Ansariel: Colorful radar]
|
||||
|
||||
// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.2a) | Added: RLVa-1.2.0d
|
||||
bool mRlvCheckShowNames;
|
||||
// [/RLVa:KB]
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#include "llavatarpropertiesprocessor.h"
|
||||
#include "lldateutil.h"
|
||||
#include "llavatarconstants.h"
|
||||
#include "indra_constants.h"
|
||||
|
||||
bool LLAvatarListItem::sStaticInitialized = false;
|
||||
S32 LLAvatarListItem::sLeftPadding = 0;
|
||||
|
|
@ -95,7 +96,11 @@ LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/)
|
|||
mShowAvatarAge(false),
|
||||
mShowPaymentStatus(false),
|
||||
mPaymentStatus(NULL),
|
||||
mAvatarAge(0)
|
||||
mAvatarAge(0),
|
||||
// [Ansariel: Colorful radar]
|
||||
mUseRangeColors(false),
|
||||
// [Ansariel: Colorful radar]
|
||||
mDistance(99999.9) // arbitary large number to insure new avatars are considered outside close range until we know for sure.
|
||||
{
|
||||
if (not_from_ui_factory)
|
||||
{
|
||||
|
|
@ -133,7 +138,7 @@ BOOL LLAvatarListItem::postBuild()
|
|||
|
||||
// radar
|
||||
mNearbyRange = getChild<LLTextBox>("radar_range");
|
||||
mNearbyRange->setValue("100.0");
|
||||
mNearbyRange->setValue("N/A");
|
||||
mNearbyRange->setVisible(false);
|
||||
mFirstSeenDisplay = getChild<LLTextBox>("first_seen");
|
||||
mFirstSeenDisplay->setValue("");
|
||||
|
|
@ -387,13 +392,31 @@ void LLAvatarListItem::updateFirstSeen()
|
|||
|
||||
void LLAvatarListItem::setRange(F32 distance)
|
||||
{
|
||||
mNearbyRange->setValue(llformat("%3.2f", distance));
|
||||
mDistance = distance;
|
||||
|
||||
// [Ansariel: Colorful radar]
|
||||
// Get default style params
|
||||
LLStyle::Params rangeHighlight = LLStyle::Params();
|
||||
|
||||
if (mUseRangeColors && mDistance > CHAT_NORMAL_RADIUS)
|
||||
{
|
||||
if (mDistance < CHAT_SHOUT_RADIUS)
|
||||
{
|
||||
rangeHighlight.color = mShoutRangeColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
rangeHighlight.color = mBeyondShoutRangeColor;
|
||||
}
|
||||
}
|
||||
|
||||
mNearbyRange->setText(llformat("%3.2f", mDistance), rangeHighlight);
|
||||
// [Ansariel: Colorful radar]
|
||||
}
|
||||
|
||||
F32 LLAvatarListItem::getRange()
|
||||
{
|
||||
std::string tmp = mNearbyRange->getText();
|
||||
return F32(::atof(tmp.c_str()));
|
||||
return mDistance;
|
||||
}
|
||||
|
||||
void LLAvatarListItem::setPosition(LLVector3d pos)
|
||||
|
|
@ -451,6 +474,22 @@ void LLAvatarListItem::showUsername(bool show)
|
|||
updateAvatarName();
|
||||
}
|
||||
|
||||
// [Ansariel: Colorful radar]
|
||||
void LLAvatarListItem::setShoutRangeColor(const LLUIColor& shoutRangeColor)
|
||||
{
|
||||
mShoutRangeColor = shoutRangeColor;
|
||||
}
|
||||
|
||||
void LLAvatarListItem::setBeyondShoutRangeColor(const LLUIColor& beyondShoutRangeColor)
|
||||
{
|
||||
mBeyondShoutRangeColor = beyondShoutRangeColor;
|
||||
}
|
||||
|
||||
void LLAvatarListItem::setUseRangeColors(bool UseRangeColors)
|
||||
{
|
||||
mUseRangeColors = UseRangeColors;
|
||||
}
|
||||
// [Ansariel: Colorful radar]
|
||||
|
||||
void LLAvatarListItem::onInfoBtnClick()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -133,7 +133,11 @@ public:
|
|||
void onProfileBtnClick();
|
||||
|
||||
//Radar state-specific
|
||||
|
||||
// [Ansariel: Colorful radar]
|
||||
void setUseRangeColors(bool UseRangeColors);
|
||||
void setShoutRangeColor(const LLUIColor& shoutRangeColor);
|
||||
void setBeyondShoutRangeColor(const LLUIColor& beyondShoutRangeColor);
|
||||
// [/Ansariel: Colorful radar]
|
||||
|
||||
/*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
|
||||
|
||||
|
|
@ -159,6 +163,12 @@ protected:
|
|||
bool mShowDisplayName;
|
||||
bool mShowUsername;
|
||||
bool mShowFirstSeen;
|
||||
|
||||
// [Ansariel: Colorful radar]
|
||||
bool mUseRangeColors;
|
||||
LLUIColor mShoutRangeColor;
|
||||
LLUIColor mBeyondShoutRangeColor;
|
||||
// [/Ansariel: Colorful radar]
|
||||
|
||||
private:
|
||||
|
||||
|
|
@ -237,9 +247,10 @@ private:
|
|||
|
||||
LLUUID mAvatarId;
|
||||
time_t mFirstSeen;
|
||||
S32 mAvStatus;
|
||||
S32 mAvStatus;
|
||||
LLVector3d mAvPosition;
|
||||
S32 mAvatarAge;
|
||||
S32 mAvatarAge;
|
||||
F32 mDistance;
|
||||
|
||||
std::string mHighlihtSubstring; // substring to highlight
|
||||
EOnlineStatus mOnlineStatus;
|
||||
|
|
|
|||
|
|
@ -483,9 +483,7 @@ LLPanelPeople::LLPanelPeople()
|
|||
mNearbyGearButton(NULL),
|
||||
mFriendsGearButton(NULL),
|
||||
mGroupsGearButton(NULL),
|
||||
mRecentGearButton(NULL),
|
||||
mChatRadius(20.0),
|
||||
mDrawRadius(0.0)
|
||||
mRecentGearButton(NULL)
|
||||
|
||||
{
|
||||
mFriendListUpdater = new LLFriendListUpdater(boost::bind(&LLPanelPeople::updateFriendList, this));
|
||||
|
|
@ -533,7 +531,6 @@ void LLPanelPeople::onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LL
|
|||
|
||||
BOOL LLPanelPeople::postBuild()
|
||||
{
|
||||
mDrawRadius = gSavedSettings.getF32("RenderFarClip");
|
||||
mFilterEditor = getChild<LLFilterEditor>("filter_input");
|
||||
mFilterEditor->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
|
||||
|
||||
|
|
@ -553,7 +550,7 @@ BOOL LLPanelPeople::postBuild()
|
|||
mAllFriendList->showPermissions(true);
|
||||
|
||||
LLPanel* nearby_tab = getChild<LLPanel>(NEARBY_TAB_NAME);
|
||||
nearby_tab->setVisibleCallback(boost::bind(&Updater::setActive, mNearbyListUpdater, _2));
|
||||
|
||||
mNearbyList = nearby_tab->getChild<LLAvatarList>("avatar_list");
|
||||
mNearbyList->setNoItemsCommentText(getString("no_one_near"));
|
||||
mNearbyList->setNoItemsMsg(getString("no_one_near"));
|
||||
|
|
@ -568,11 +565,16 @@ BOOL LLPanelPeople::postBuild()
|
|||
mNearbyList->showMiniProfileIcons(false);
|
||||
mNearbyList->showPermissions(false);
|
||||
mNearbyList->setItemHeight(20); // AO: Radar item spacing should be more compressed to use less screen space
|
||||
|
||||
// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.2a) | Added: RLVa-1.2.0d
|
||||
// [Ansariel: Colorful radar]
|
||||
mNearbyList->setUseRangeColors(true);
|
||||
// [/Ansariel: Colorful radar]
|
||||
// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.2a) | Added: RLVa-1.2.0d
|
||||
mNearbyList->setRlvCheckShowNames(true);
|
||||
// [/RLVa:KB]
|
||||
// [/RLVa:KB]
|
||||
|
||||
//nearby_tab->setVisibleCallback(boost::bind(&Updater::setActive, mNearbyListUpdater, _2));
|
||||
mNearbyListUpdater->setActive(true); // AO: always keep radar active, for chat and channel integration
|
||||
|
||||
mRecentList = getChild<LLPanel>(RECENT_TAB_NAME)->getChild<LLAvatarList>("avatar_list");
|
||||
mRecentList->setNoItemsCommentText(getString("no_recent_people"));
|
||||
mRecentList->setNoItemsMsg(getString("no_recent_people"));
|
||||
|
|
@ -800,15 +802,18 @@ void LLPanelPeople::updateFriendList()
|
|||
void LLPanelPeople::updateNearbyList()
|
||||
{
|
||||
if (!mNearbyList)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<LLPanel*> items;
|
||||
F32 drawRadius = gSavedSettings.getF32("RenderFarClip");
|
||||
mNearbyList->getItems(items);
|
||||
|
||||
// Fetch new list of surrounding Avs
|
||||
std::vector<LLVector3d> positions;
|
||||
LLWorld::getInstance()->getAvatars(&mNearbyList->getIDs(), &positions, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange"));
|
||||
mNearbyList->setDirty();
|
||||
mNearbyList->setDirty(true,true); // AO: These optional arguements force updating even when we're not a visible window.
|
||||
DISTANCE_COMPARATOR.updateAvatarsPositions(positions, mNearbyList->getIDs());
|
||||
|
||||
//Compare new list with last radar cache, updating fields and processing changes
|
||||
|
|
@ -818,6 +823,7 @@ void LLPanelPeople::updateNearbyList()
|
|||
{
|
||||
LLAvatarListItem* av = static_cast<LLAvatarListItem*>(*itItem);
|
||||
LLUUID avId = av->getAvatarId();
|
||||
F32 r = av->getRange();
|
||||
|
||||
if (lastRadarSweep.count(avId) > 0)
|
||||
{
|
||||
|
|
@ -826,22 +832,22 @@ void LLPanelPeople::updateNearbyList()
|
|||
|
||||
if (gSavedSettings.getBOOL("RadarReportChatRange"))
|
||||
{
|
||||
if ((av->getRange() <= mChatRadius) && (lastRadarSweep[avId].lastDistance > mChatRadius))
|
||||
if ((r <= CHAT_NORMAL_RADIUS) && (lastRadarSweep[avId].lastDistance > CHAT_NORMAL_RADIUS))
|
||||
{
|
||||
reportToNearbyChat(av->getAvatarName() + " entered chat range.");
|
||||
}
|
||||
else if ((av->getRange() > mChatRadius) && (lastRadarSweep[avId].lastDistance <= mChatRadius))
|
||||
else if ((r > CHAT_NORMAL_RADIUS) && (lastRadarSweep[avId].lastDistance <= CHAT_NORMAL_RADIUS))
|
||||
{
|
||||
reportToNearbyChat(av->getAvatarName() + " left chat range.");
|
||||
}
|
||||
}
|
||||
if (gSavedSettings.getBOOL("RadarReportDrawRange"))
|
||||
{
|
||||
if ((av->getRange() <= mDrawRadius) && (lastRadarSweep[avId].lastDistance > mDrawRadius))
|
||||
if ((r <= drawRadius) && (lastRadarSweep[avId].lastDistance > drawRadius))
|
||||
{
|
||||
reportToNearbyChat(av->getAvatarName() + " entered draw distance.");
|
||||
}
|
||||
else if ((av->getRange() > mDrawRadius) && (lastRadarSweep[avId].lastDistance <= mDrawRadius))
|
||||
else if ((r > drawRadius) && (lastRadarSweep[avId].lastDistance <= drawRadius))
|
||||
{
|
||||
reportToNearbyChat(av->getAvatarName() + " left draw distance.");
|
||||
}
|
||||
|
|
@ -851,23 +857,19 @@ void LLPanelPeople::updateNearbyList()
|
|||
// TODO Alert if we entered the sim
|
||||
// TODO Alert if we changed status
|
||||
}
|
||||
|
||||
// Handle new entries
|
||||
else
|
||||
{
|
||||
av->setFirstSeen(time(NULL));
|
||||
|
||||
if (gSavedSettings.getBOOL("RadarReportChatRange"))
|
||||
if (gSavedSettings.getBOOL("RadarReportChatRange") && (r <= CHAT_NORMAL_RADIUS))
|
||||
{
|
||||
if (av->getRange() <= mChatRadius)
|
||||
{
|
||||
reportToNearbyChat(av->getAvatarName() + " entered chat range.");
|
||||
}
|
||||
reportToNearbyChat(av->getAvatarName()+llformat(" entered chat range (%3.2f m)\n",r));
|
||||
}
|
||||
if (gSavedSettings.getBOOL("RadarReportDrawRange"))
|
||||
if (gSavedSettings.getBOOL("RadarReportDrawRange") && (r <= drawRadius))
|
||||
{
|
||||
if (av->getRange() <= mDrawRadius)
|
||||
{
|
||||
reportToNearbyChat(av->getAvatarName() + " entered draw distance.");
|
||||
}
|
||||
reportToNearbyChat(av->getAvatarName()+llformat(" entered draw distance (%3.2f m)\n",r));
|
||||
}
|
||||
|
||||
// TODO Alert if we entered the sim
|
||||
|
|
@ -878,19 +880,13 @@ void LLPanelPeople::updateNearbyList()
|
|||
{
|
||||
radarFields rf = i->second;
|
||||
|
||||
if (gSavedSettings.getBOOL("RadarReportChatRange"))
|
||||
if (gSavedSettings.getBOOL("RadarReportChatRange") && (rf.lastDistance <= CHAT_NORMAL_RADIUS))
|
||||
{
|
||||
if (rf.lastDistance <= mChatRadius)
|
||||
{
|
||||
reportToNearbyChat(rf.avName + " left chat range.");
|
||||
}
|
||||
reportToNearbyChat(rf.avName + " left chat range.");
|
||||
}
|
||||
if (gSavedSettings.getBOOL("RadarReportDrawRange"))
|
||||
if (gSavedSettings.getBOOL("RadarReportDrawRange") && (rf.lastDistance <= drawRadius))
|
||||
{
|
||||
if (rf.lastDistance <= mDrawRadius)
|
||||
{
|
||||
reportToNearbyChat(rf.avName + " left draw distance.");
|
||||
}
|
||||
reportToNearbyChat(rf.avName + " left draw distance.");
|
||||
}
|
||||
// TODO Alert if we left the sim
|
||||
}
|
||||
|
|
@ -1409,7 +1405,6 @@ void LLPanelPeople::teleportToAvatar(LLUUID targetAv)
|
|||
// Teleports user to last scanned location of nearby avatar
|
||||
// Note: currently teleportViaLocation is disrupted by enforced landing points set on a parcel.
|
||||
{
|
||||
llinfos << "AO: Trying to teleport to avatar: " << targetAv << llendl;
|
||||
std::vector<LLPanel*> items;
|
||||
mNearbyList->getItems(items);
|
||||
for (std::vector<LLPanel*>::const_iterator itItem = items.begin(); itItem != items.end(); ++itItem)
|
||||
|
|
@ -1417,7 +1412,6 @@ void LLPanelPeople::teleportToAvatar(LLUUID targetAv)
|
|||
LLAvatarListItem* av = static_cast<LLAvatarListItem*>(*itItem);
|
||||
if (av->getAvatarId() == targetAv)
|
||||
{
|
||||
llinfos << "avatar found, teleporting." << llendl;
|
||||
gAgent.teleportViaLocation(av->getPosition());
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,9 +178,6 @@ private:
|
|||
std::string mFilterSubString;
|
||||
std::string mFilterSubStringOrig;
|
||||
|
||||
F32 mChatRadius;
|
||||
F32 mDrawRadius;
|
||||
|
||||
struct radarFields
|
||||
{
|
||||
std::string avName;
|
||||
|
|
|
|||
|
|
@ -342,6 +342,12 @@
|
|||
<color
|
||||
name="AvatarListItemIconVoiceLeftColor"
|
||||
reference="AvatarListItemIconOfflineColor" />
|
||||
<color
|
||||
name="AvatarListItemShoutRange"
|
||||
reference="Yellow" />
|
||||
<color
|
||||
name="AvatarListItemBeyondShoutRange"
|
||||
reference="Red" />
|
||||
<color
|
||||
name="BackgroundChatColor"
|
||||
reference="DkGray" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue