From 34b678c991b2cdd6c4fc3a3ebda2d305eee2e0f5 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 29 Dec 2011 19:44:52 +0100 Subject: [PATCH] Backed out the changes to LLScrollListCell and changed accessing individual cells by name into the LL way --- indra/llui/llscrolllistcell.cpp | 3 +-- indra/llui/llscrolllistcell.h | 6 ------ indra/llui/llscrolllistitem.cpp | 16 ---------------- indra/llui/llscrolllistitem.h | 3 --- indra/newview/llpanelpeople.cpp | 14 +++++++------- 5 files changed, 8 insertions(+), 34 deletions(-) diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 59c75c61b4..9d25c7180d 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -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 diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h index cd661e4da3..d625ebddcc 100644 --- a/indra/llui/llscrolllistcell.h +++ b/indra/llui/llscrolllistcell.h @@ -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 diff --git a/indra/llui/llscrolllistitem.cpp b/indra/llui/llscrolllistitem.cpp index fb0ffc740a..d95752e31c 100644 --- a/indra/llui/llscrolllistitem.cpp +++ b/indra/llui/llscrolllistitem.cpp @@ -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::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; diff --git a/indra/llui/llscrolllistitem.h b/indra/llui/llscrolllistitem.h index 86d9155189..611df729b4 100644 --- a/indra/llui/llscrolllistitem.h +++ b/indra/llui/llscrolllistitem.h @@ -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); diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index ee32e47884..8de20f85a3 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -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)); } }