Refactored radarlist control:

* Renamed from LLRadarListCtrl to FSRadarListCtrl since it's a Firestorm specific file
* Fixed license text accordingly
* Removed unnecessary includes
* Commented out debug spam
* Reduced calls to getAllSelected() and getColumn()
Ansariel 2013-03-19 14:05:38 +01:00
parent 832e9faa3b
commit 8d1115566c
4 changed files with 33 additions and 44 deletions

View File

@ -1,10 +1,10 @@
/**
* @file llradarlistctrl.cpp
* @file fsradarlistctrl.cpp
* @brief A radar-specific implementation of scrolllist
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Phoenix Firestorm Viewer Source Code
* Copyright (c) 2011 Arrehn Oberlander
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -20,62 +20,50 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
* http://www.firestormviewer.org
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "fsradarlistctrl.h"
#include "lllistcontextmenu.h"
#include "llscrolllistitem.h"
#include "rlvhandler.h"
static LLDefaultChildRegistry::Register<FSRadarListCtrl> r("radar_list");
#include <boost/tokenizer.hpp>
#include "llavatarnamecache.h"
#include "llcachename.h"
#include "llfloaterreg.h"
#include "llinventory.h"
#include "llscrolllistitem.h"
#include "llscrolllistcell.h"
#include "llscrolllistcolumn.h"
#include "llsdparam.h"
#include "lltooltip.h"
#include "lltrans.h"
static LLDefaultChildRegistry::Register<LLRadarListCtrl> r("radar_list");
LLRadarListCtrl::Params::Params()
FSRadarListCtrl::Params::Params()
{
name = "radar_list";
}
LLRadarListCtrl::LLRadarListCtrl(const LLRadarListCtrl::Params& p)
FSRadarListCtrl::FSRadarListCtrl(const FSRadarListCtrl::Params& p)
: LLScrollListCtrl(p),
mContextMenu(NULL)
{
}
BOOL LLRadarListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
BOOL FSRadarListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
llinfos << "handleRightMouseDown" << llendl;
//llinfos << "handleRightMouseDown" << llendl;
BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask);
// if ( mContextMenu )
// [RLVa:KB-FS] - Checked: 2011-06-11 (RLVa-1.3.1) | Added: RLVa-1.3.1
if ( (mContextMenu) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) )
// [/RLVa:KB-FS]
{
if(getAllSelected().size() > 1)
S32 uuid_column_index = getColumn("uuid")->mIndex;
std::vector<LLScrollListItem*> selected_items = getAllSelected();
if (selected_items.size() > 1)
{
//llinfos << "Right-click select by value: (multi-select)" << llendl;
uuid_vec_t selected_uuids;
for(size_t i=0;i<getAllSelected().size();i++)
for (size_t i = 0; i < selected_items.size(); i++)
{
llinfos << "Right-click select by value: " << getAllSelected().at(i)->getColumn(getColumn("uuid")->mIndex)->getValue().asUUID() << llendl;
selected_uuids.push_back(getAllSelected().at(i)->getColumn(getColumn("uuid")->mIndex)->getValue().asUUID());
//llinfos << "Right-click select by value: " << selected_items.at(i)->getColumn(uuid_column_index)->getValue().asUUID() << llendl;
selected_uuids.push_back(selected_items.at(i)->getColumn(uuid_column_index)->getValue().asUUID());
}
mContextMenu->show(this, selected_uuids, x, y);
}
@ -84,7 +72,7 @@ BOOL LLRadarListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
LLScrollListItem* hit_item = hitItem(x, y);
if (hit_item)
{
llinfos << "Right-click select by value: " << hit_item->getValue() << llendl;
//llinfos << "Right-click select by value: " << hit_item->getValue() << llendl;
selectByID(hit_item->getValue());
LLUUID av = hit_item->getValue();
uuid_vec_t selected_uuids;

View File

@ -1,10 +1,10 @@
/**
* @file fs_radarlistctr.h
* @file fsradarlistctrl.h
* @brief A radar-specific scrolllist implementation, so we can subclass custom methods.
*
* $LicenseInfo:firstyear=2003&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Phoenix Firestorm Viewer Source Code
* Copyright (c) 2011 Arrehn Oberlander
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -20,19 +20,20 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
* http://www.firestormviewer.org
* $/LicenseInfo$
*/
#ifndef FS_RADARLISTCTRL_H
#define FS_RADARLISTCTRL_H
#include <set>
#include "llscrolllistctrl.h"
#include "lllistcontextmenu.h"
class LLRadarListCtrl
: public LLScrollListCtrl, public LLInstanceTracker<LLRadarListCtrl>
class LLListContextMenu;
class FSRadarListCtrl
: public LLScrollListCtrl, public LLInstanceTracker<FSRadarListCtrl>
{
public:
@ -84,7 +85,7 @@ public:
protected:
LLRadarListCtrl(const Params&);
FSRadarListCtrl(const Params&);
friend class LLUICtrlFactory;
private:

View File

@ -607,7 +607,7 @@ BOOL LLPanelPeople::postBuild()
nearby_tab->getChildView("NearMeRange")->setVisible(gSavedSettings.getBOOL("LimitRadarByRange"));
// AO: radarlist takes over for nearbylist for presentation.
mRadarList = nearby_tab->getChild<LLRadarListCtrl>("radar_list");
mRadarList = nearby_tab->getChild<FSRadarListCtrl>("radar_list");
mRadarList->sortByColumn("range",TRUE); // sort by range
mRadarList->setFilterColumn(0);
mRadarFrameCount = 0;

View File

@ -184,7 +184,7 @@ private:
LLAvatarList* mNearbyList;
LLAvatarList* mRecentList;
LLGroupList* mGroupList;
LLRadarListCtrl* mRadarList;
FSRadarListCtrl* mRadarList;
LLNetMap* mMiniMap;
LLHandle<LLView> mGroupPlusMenuHandle;