Backed out the changes to LLScrollListCell and changed accessing individual cells by name into the LL way

Ansariel 2011-12-29 19:44:52 +01:00
parent e8f5003ecc
commit 34b678c991
5 changed files with 8 additions and 34 deletions

View File

@ -66,8 +66,7 @@ LLScrollListCell* LLScrollListCell::create(const LLScrollListCell::Params& cell_
LLScrollListCell::LLScrollListCell(const LLScrollListCell::Params& p)
: mWidth(p.width),
mToolTip(p.tool_tip),
mColumn(p.column) // Ansariel: Also store the column name the cell belongs to if that info is already provided
mToolTip(p.tool_tip)
{}
// virtual

View File

@ -110,15 +110,9 @@ public:
virtual BOOL handleClick() { return FALSE; }
virtual void setEnabled(BOOL enable) { }
// Ansariel: Return column name the cell belongs to
virtual std::string getName() const { return mColumn; }
private:
S32 mWidth;
std::string mToolTip;
// Ansariel: Column name the cell belongs to
std::string mColumn;
};
class LLScrollListSpacer : public LLScrollListCell

View File

@ -101,22 +101,6 @@ LLScrollListCell* LLScrollListItem::getColumn(const S32 i) const
return NULL;
}
// Ansariel: Return LLScrollListCell by name
LLScrollListCell* LLScrollListItem::getColumn(const std::string& name) const
{
std::vector<LLScrollListCell *>::const_iterator it = mColumns.begin();
for (; it < mColumns.end(); it++)
{
if ((*it)->getName() == name)
{
return (*it);
}
}
return NULL;
}
std::string LLScrollListItem::getContentsCSV() const
{
std::string ret;

View File

@ -105,9 +105,6 @@ public:
LLScrollListCell *getColumn(const S32 i) const;
// Ansariel: Return LLScrollListCell by name
LLScrollListCell *getColumn(const std::string& name) const;
std::string getContentsCSV() const;
virtual void draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding);

View File

@ -907,7 +907,7 @@ void LLPanelPeople::updateNearbyList()
S32 lastScroll = mRadarList->getScrollPos();
if (lastRadarSelectedItem)
{
selected_id = lastRadarSelectedItem->getColumn("uuid")->getValue().asUUID();
selected_id = lastRadarSelectedItem->getColumn(mRadarList->getColumn("uuid")->mIndex)->getValue().asUUID();
}
mRadarList->clearRows();
mRadarEnterAlerts.clear();
@ -1186,7 +1186,7 @@ void LLPanelPeople::updateNearbyList()
LLScrollListItem* radarRow = mRadarList->addElement(row);
//AO: Set any range colors / styles
LLScrollListText* radarRangeCell = (LLScrollListText*)radarRow->getColumn(5); // Ansariel: Use index-based access here because of speed
LLScrollListText* radarRangeCell = (LLScrollListText*)radarRow->getColumn(mRadarList->getColumn("range")->mIndex);
if (avRange > -1)
{
if (avRange <= CHAT_NORMAL_RADIUS)
@ -1218,7 +1218,7 @@ void LLPanelPeople::updateNearbyList()
}
//AO: Set friends colors / styles
LLScrollListText* radarNameCell = (LLScrollListText*)radarRow->getColumn(0); // Ansariel: Use index-based access here because of speed
LLScrollListText* radarNameCell = (LLScrollListText*)radarRow->getColumn(mRadarList->getColumn("name")->mIndex);
const LLRelationship* relation = LLAvatarTracker::instance().getBuddyInfo(avId);
if (relation)
{
@ -1582,7 +1582,7 @@ LLUUID LLPanelPeople::getCurrentItemID() const
{
LLScrollListItem* item = mRadarList->getFirstSelected();
if (item)
return item->getColumn("uuid")->getValue().asUUID();
return item->getColumn(mRadarList->getColumn("uuid")->mIndex)->getValue().asUUID();
else
return LLUUID::null;
//return mNearbyList->getSelectedUUID();
@ -1614,7 +1614,7 @@ void LLPanelPeople::getCurrentItemIDs(uuid_vec_t& selected_uuids) const
//mNearbyList->getSelectedUUIDs(selected_uuids);
LLScrollListItem* item = mRadarList->getFirstSelected();
if (item)
selected_uuids.push_back(item->getColumn("name")->getValue().asUUID());
selected_uuids.push_back(item->getColumn(mRadarList->getColumn("name")->mIndex)->getValue().asUUID());
}
else if (cur_tab == RECENT_TAB_NAME)
mRecentList->getSelectedUUIDs(selected_uuids);
@ -1786,7 +1786,7 @@ void LLPanelPeople::onNearbyListDoubleClicked(LLUICtrl* ctrl)
void LLPanelPeople::onRadarListDoubleClicked()
{
LLScrollListItem* item = mRadarList->getFirstSelected();
LLUUID clicked_id = item->getColumn("uuid")->getValue().asUUID();
LLUUID clicked_id = item->getColumn(mRadarList->getColumn("uuid")->mIndex)->getValue().asUUID();
if (gObjectList.findObject(clicked_id))
{
@ -1795,7 +1795,7 @@ void LLPanelPeople::onRadarListDoubleClicked()
else
{
LLStringUtil::format_map_t args;
args["AVATARNAME"] = item->getColumn("name")->getValue().asString();
args["AVATARNAME"] = item->getColumn(mRadarList->getColumn("name")->mIndex)->getValue().asString();
reportToNearbyChat(getString("camera_no_focus", args));
}
}