Clean up LLFLoaterMap and remove unnecessary duplicate code
parent
6d34a304e6
commit
b3ca9b43ac
|
|
@ -45,18 +45,6 @@
|
|||
#include "llfloaterworldmap.h"
|
||||
#include "llagent.h"
|
||||
|
||||
// Firestorm includes
|
||||
#include "rlvhandler.h"
|
||||
#include "llavataractions.h"
|
||||
#include "llavatarnamecache.h"
|
||||
#include "llfloatersidepanelcontainer.h"
|
||||
#include "lltrans.h"
|
||||
#include "llviewerobject.h"
|
||||
#include "llviewerparceloverlay.h"
|
||||
#include "llviewerparcelmgr.h"
|
||||
#include "llviewermenu.h"
|
||||
#include "llworld.h" // <FS:CR> Aurora Sim
|
||||
|
||||
//
|
||||
// Constants
|
||||
//
|
||||
|
|
@ -82,7 +70,6 @@ LLFloaterMap::LLFloaterMap(const LLSD& key)
|
|||
mTextBoxNorthEast(NULL),
|
||||
mTextBoxNorthWest(NULL),
|
||||
mTextBoxSouthWest(NULL),
|
||||
mPopupMenu(NULL), // <FS:CR>
|
||||
mMap(NULL)
|
||||
{
|
||||
}
|
||||
|
|
@ -115,39 +102,7 @@ BOOL LLFloaterMap::postBuild()
|
|||
mTextBoxSouthWest = getChild<LLTextBox> ("floater_map_southwest");
|
||||
mTextBoxNorthWest = getChild<LLTextBox> ("floater_map_northwest");
|
||||
|
||||
// <Firestorm Minimap changes>
|
||||
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
|
||||
|
||||
registrar.add("Minimap.Zoom", boost::bind(&LLFloaterMap::handleZoom, this, _2));
|
||||
registrar.add("Minimap.Tracker", boost::bind(&LLFloaterMap::handleStopTracking, this, _2));
|
||||
|
||||
registrar.add("Minimap.Mark", boost::bind(&LLFloaterMap::handleMark, this, _2));
|
||||
registrar.add("Minimap.ClearMarks", boost::bind(&LLFloaterMap::handleClearMarks, this));
|
||||
|
||||
registrar.add("Minimap.Cam", boost::bind(&LLFloaterMap::handleCam, this));
|
||||
registrar.add("Minimap.StartTracking", boost::bind(&LLFloaterMap::handleStartTracking, this));
|
||||
|
||||
// [SL:KB] - Patch: World-MiniMap | Checked: 2012-07-08 (Catznip-3.3.0)
|
||||
registrar.add("Minimap.ShowProfile", boost::bind(&LLFloaterMap::handleShowProfile, this, _2));
|
||||
registrar.add("Minimap.TextureType", boost::bind(&LLFloaterMap::handleTextureType, this, _2));
|
||||
registrar.add("Minimap.ToggleOverlay", boost::bind(&LLFloaterMap::handleOverlayToggle, this, _2));
|
||||
|
||||
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
|
||||
enable_registrar.add("Minimap.CheckTextureType", boost::bind(&LLFloaterMap::checkTextureType, this, _2));
|
||||
// [/SL:KB]
|
||||
|
||||
// [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0)
|
||||
LLViewerParcelMgr::instance().setCollisionUpdateCallback(boost::bind(&LLFloaterMap::refreshParcelOverlay, this));
|
||||
LLViewerParcelOverlay::setUpdateCallback(boost::bind(&LLFloaterMap::refreshParcelOverlay, this));
|
||||
// [/SL:KB]
|
||||
|
||||
mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
|
||||
if (mPopupMenu && !LLTracker::isTracking(0))
|
||||
{
|
||||
mPopupMenu->setItemEnabled ("Stop Tracking", false);
|
||||
}
|
||||
// </Firestorm minimap changes>
|
||||
|
||||
// <FS:Ansariel> Remove titlebar
|
||||
stretchMiniMap(getRect().getWidth() - MAP_PADDING_LEFT - MAP_PADDING_RIGHT,
|
||||
getRect().getHeight() - MAP_PADDING_TOP - MAP_PADDING_BOTTOM);
|
||||
|
||||
|
|
@ -156,8 +111,10 @@ BOOL LLFloaterMap::postBuild()
|
|||
// Get the drag handle all the way in back
|
||||
sendChildToBack(getDragHandle());
|
||||
|
||||
// <FS:Ansariel> Remove titlebar
|
||||
setIsChrome(TRUE);
|
||||
getDragHandle()->setTitleVisible(TRUE);
|
||||
// </FS:Ansariel>
|
||||
|
||||
// keep onscreen
|
||||
gFloaterView->adjustToFitScreen(this, FALSE);
|
||||
|
|
@ -198,63 +155,6 @@ BOOL LLFloaterMap::handleDoubleClick(S32 x, S32 y, MASK mask)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL LLFloaterMap::handleRightMouseDown(S32 x, S32 y, MASK mask)
|
||||
{
|
||||
if (mPopupMenu)
|
||||
{
|
||||
// [SL:KB] - Patch: World-MiniMap | Checked: 2012-07-08 (Catznip-3.3.0)
|
||||
mMap->mClosestAgentRightClick = mMap->getClosestAgentToCursor();
|
||||
mMap->mPosGlobalRightClick = mMap->viewPosToGlobal(x, y);
|
||||
|
||||
mPopupMenu->setItemVisible("View Profile", mMap->mClosestAgentsToCursor.size() == 1);
|
||||
|
||||
LLMenuItemBranchGL* pProfilesMenu = mPopupMenu->getChild<LLMenuItemBranchGL>("View Profiles");
|
||||
if (pProfilesMenu)
|
||||
{
|
||||
pProfilesMenu->setVisible(mMap->mClosestAgentsToCursor.size() > 1);
|
||||
|
||||
pProfilesMenu->getBranch()->empty();
|
||||
for (uuid_vec_t::const_iterator itAgent = mMap->mClosestAgentsToCursor.begin(); itAgent != mMap->mClosestAgentsToCursor.end(); ++itAgent)
|
||||
{
|
||||
LLMenuItemCallGL::Params p;
|
||||
p.name = llformat("Profile Item %d", itAgent - mMap->mClosestAgentsToCursor.begin());
|
||||
|
||||
LLAvatarName avName; const LLUUID& idAgent = *itAgent;
|
||||
if (LLAvatarNameCache::get(idAgent, &avName))
|
||||
{
|
||||
p.label = avName.getCompleteName();
|
||||
}
|
||||
else
|
||||
{
|
||||
p.label = LLTrans::getString("LoadingData");
|
||||
LLAvatarNameCache::get(idAgent, boost::bind(&LLFloaterMap::setAvatarProfileLabel, this, _2, p.name.getValue()));
|
||||
}
|
||||
p.on_click.function = boost::bind(&LLAvatarActions::showProfile, _2);
|
||||
p.on_click.parameter = idAgent;
|
||||
|
||||
LLMenuItemCallGL* pMenuItem = LLUICtrlFactory::create<LLMenuItemCallGL>(p);
|
||||
if (pMenuItem)
|
||||
pProfilesMenu->getBranch()->addChild(pMenuItem);
|
||||
}
|
||||
}
|
||||
mPopupMenu->setItemVisible("Cam", mMap->isZoomable());
|
||||
mPopupMenu->setItemVisible("MarkAvatar", mMap->getClosestAgentToCursor().notNull());
|
||||
mPopupMenu->setItemVisible("Start Tracking", mMap->getClosestAgentToCursor().notNull());
|
||||
mPopupMenu->setItemVisible("Profile Separator", (mMap->mClosestAgentsToCursor.size() >= 1
|
||||
|| mMap->getClosestAgentToCursor().notNull()));
|
||||
// [/SL:KB]
|
||||
mPopupMenu->buildDrawLabels();
|
||||
mPopupMenu->updateParent(LLMenuGL::sMenuContainer);
|
||||
// [SL:KB] - Patch: World-MiniMap | Checked: 2012-07-08 (Catznip-3.3.0)
|
||||
mPopupMenu->setItemVisible("Stop Tracking", LLTracker::isTracking(0));
|
||||
mPopupMenu->setItemVisible("Stop Tracking Separator", LLTracker::isTracking(0));
|
||||
// [/SL:KB]
|
||||
// mPopupMenu->setItemEnabled("Stop Tracking", LLTracker::isTracking(0));
|
||||
LLMenuGL::showPopup(this, mPopupMenu, x, y);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LLFloaterMap::setDirectionPos( LLTextBox* text_box, F32 rotation )
|
||||
{
|
||||
// Rotation is in radians.
|
||||
|
|
@ -324,19 +224,73 @@ void LLFloaterMap::draw()
|
|||
setMouseOpaque(TRUE);
|
||||
getDragHandle()->setMouseOpaque(TRUE);
|
||||
}
|
||||
|
||||
if (LLTracker::isTracking(0))
|
||||
{
|
||||
mPopupMenu->setItemEnabled("Stop Tracking", true);
|
||||
}
|
||||
|
||||
// <FS:CR> Aurora Sim
|
||||
//LLFloater::draw();
|
||||
if(LLWorld::getInstance()->getAllowMinimap())
|
||||
LLFloater::draw();
|
||||
}
|
||||
|
||||
void LLFloaterMap::reshape(S32 width, S32 height, BOOL called_from_parent)
|
||||
{
|
||||
LLFloater::reshape(width, height, called_from_parent);
|
||||
|
||||
// <FS:Ansariel> Remove titlebar
|
||||
stretchMiniMap(width - MAP_PADDING_LEFT - MAP_PADDING_RIGHT, height - MAP_PADDING_TOP - MAP_PADDING_BOTTOM);
|
||||
|
||||
updateMinorDirections();
|
||||
}
|
||||
|
||||
// <FS:Ansariel> Unused as of 06-02-2014; Handled in LLNetMap
|
||||
//void LLFloaterMap::handleZoom(const LLSD& userdata)
|
||||
//{
|
||||
// std::string level = userdata.asString();
|
||||
//
|
||||
// F32 scale = 0.0f;
|
||||
// if (level == std::string("default"))
|
||||
// {
|
||||
// LLControlVariable *pvar = gSavedSettings.getControl("MiniMapScale");
|
||||
// if(pvar)
|
||||
// {
|
||||
// pvar->resetToDefault();
|
||||
// scale = gSavedSettings.getF32("MiniMapScale");
|
||||
// }
|
||||
// }
|
||||
// else if (level == std::string("close"))
|
||||
// scale = LLNetMap::MAP_SCALE_MAX;
|
||||
// else if (level == std::string("medium"))
|
||||
// scale = LLNetMap::MAP_SCALE_MID;
|
||||
// else if (level == std::string("far"))
|
||||
// scale = LLNetMap::MAP_SCALE_MIN;
|
||||
// if (scale != 0.0f)
|
||||
// {
|
||||
// mMap->setScale(scale);
|
||||
// }
|
||||
//}
|
||||
// </FS:Ansariel>
|
||||
|
||||
LLFloaterMap* LLFloaterMap::getInstance()
|
||||
{
|
||||
return LLFloaterReg::getTypedInstance<LLFloaterMap>("mini_map");
|
||||
}
|
||||
|
||||
// <FS:Ansariel> FIRE-1825: Minimap floater background transparency
|
||||
// virtual
|
||||
F32 LLFloaterMap::getCurrentTransparency()
|
||||
{
|
||||
static LLCachedControl<F32> fsMiniMapOpacity(gSavedSettings, "FSMiniMapOpacity");
|
||||
return fsMiniMapOpacity();
|
||||
}
|
||||
|
||||
// <FS:Ansariel> Remove titlebar
|
||||
void LLFloaterMap::setMinimized(BOOL b)
|
||||
{
|
||||
LLFloater::setMinimized(b);
|
||||
if (b)
|
||||
{
|
||||
LLFloater::draw();
|
||||
setTitle(getString("mini_map_caption"));
|
||||
}
|
||||
else
|
||||
{
|
||||
setTitle("");
|
||||
}
|
||||
// <FS:CR> Aurora Sim
|
||||
}
|
||||
|
||||
void LLFloaterMap::stretchMiniMap(S32 width,S32 height)
|
||||
|
|
@ -351,168 +305,4 @@ void LLFloaterMap::stretchMiniMap(S32 width,S32 height)
|
|||
mMap->setRect(map_rect);
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterMap::reshape(S32 width, S32 height, BOOL called_from_parent)
|
||||
{
|
||||
LLFloater::reshape(width, height, called_from_parent);
|
||||
|
||||
stretchMiniMap(width - MAP_PADDING_LEFT - MAP_PADDING_RIGHT,
|
||||
height - MAP_PADDING_TOP - MAP_PADDING_BOTTOM);
|
||||
|
||||
updateMinorDirections();
|
||||
}
|
||||
|
||||
void LLFloaterMap::handleZoom(const LLSD& userdata)
|
||||
{
|
||||
std::string level = userdata.asString();
|
||||
|
||||
F32 scale = 0.0f;
|
||||
|
||||
if (level == std::string("default"))
|
||||
{
|
||||
LLControlVariable *pvar = gSavedSettings.getControl("MiniMapScale");
|
||||
if(pvar)
|
||||
{
|
||||
pvar->resetToDefault();
|
||||
scale = gSavedSettings.getF32("MiniMapScale");
|
||||
}
|
||||
}
|
||||
else if (level == std::string("close"))
|
||||
scale = LLNetMap::MAP_SCALE_MAX;
|
||||
else if (level == std::string("medium"))
|
||||
scale = LLNetMap::MAP_SCALE_MID;
|
||||
else if (level == std::string("far"))
|
||||
scale = LLNetMap::MAP_SCALE_MIN;
|
||||
if (scale != 0.0f)
|
||||
{
|
||||
mMap->setScale(scale);
|
||||
}
|
||||
}
|
||||
|
||||
LLFloaterMap* LLFloaterMap::getInstance()
|
||||
{
|
||||
return LLFloaterReg::getTypedInstance<LLFloaterMap>("mini_map");
|
||||
}
|
||||
|
||||
void LLFloaterMap::setMinimized(BOOL b)
|
||||
{
|
||||
LLFloater::setMinimized(b);
|
||||
if(b)
|
||||
{
|
||||
setTitle(getString("mini_map_caption"));
|
||||
}
|
||||
else
|
||||
{
|
||||
setTitle("");
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterMap::handleMark(const LLSD& userdata)
|
||||
{
|
||||
mMap->setAvatarMark(userdata);
|
||||
}
|
||||
|
||||
void LLFloaterMap::handleClearMarks()
|
||||
{
|
||||
mMap->clearAvatarMarks();
|
||||
}
|
||||
|
||||
void LLFloaterMap::handleCam()
|
||||
{
|
||||
mMap->camAvatar();
|
||||
}
|
||||
|
||||
void LLFloaterMap::handleStopTracking (const LLSD& userdata)
|
||||
{
|
||||
if (mPopupMenu)
|
||||
{
|
||||
mPopupMenu->setItemEnabled ("Stop Tracking", false);
|
||||
LLTracker::stopTracking ((void*)(ptrdiff_t)LLTracker::isTracking(NULL));
|
||||
}
|
||||
}
|
||||
|
||||
// <FS:Ansariel> Avatar tracking feature
|
||||
void LLFloaterMap::handleStartTracking()
|
||||
{
|
||||
mMap->startTracking();
|
||||
}
|
||||
// </FS:Ansariel> Avatar tracking feature
|
||||
|
||||
// <FS:CR> FIXME: Cut and paste duplicate code from llnetmap.cpp
|
||||
void LLFloaterMap::setAvatarProfileLabel(const LLAvatarName& avName, const std::string& item_name)
|
||||
{
|
||||
LLMenuItemGL* pItem = mPopupMenu->findChild<LLMenuItemGL>(item_name, TRUE /*recurse*/);
|
||||
if (pItem)
|
||||
{
|
||||
pItem->setLabel(avName.getCompleteName());
|
||||
pItem->getMenu()->arrange();
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterMap::handleOverlayToggle(const LLSD& sdParam)
|
||||
{
|
||||
// Toggle the setting
|
||||
const std::string strControl = sdParam.asString();
|
||||
BOOL fCurValue = gSavedSettings.getBOOL(strControl);
|
||||
gSavedSettings.setBOOL(strControl, !fCurValue);
|
||||
|
||||
// Force an overlay update
|
||||
refreshParcelOverlay();
|
||||
}
|
||||
|
||||
void LLFloaterMap::handleShowProfile(const LLSD& sdParam) const
|
||||
{
|
||||
const std::string strParam = sdParam.asString();
|
||||
if ("closest" == strParam)
|
||||
{
|
||||
LLAvatarActions::showProfile(mMap->mClosestAgentRightClick);
|
||||
}
|
||||
else if ("place" == strParam)
|
||||
{
|
||||
LLSD sdParams;
|
||||
sdParams["type"] = "remote_place";
|
||||
sdParams["x"] = mMap->mPosGlobalRightClick.mdV[VX];
|
||||
sdParams["y"] = mMap->mPosGlobalRightClick.mdV[VY];
|
||||
sdParams["z"] = mMap->mPosGlobalRightClick.mdV[VZ];
|
||||
|
||||
if (gSavedSettings.getBOOL("FSUseStandalonePlaceDetailsFloater"))
|
||||
{
|
||||
LLFloaterReg::showInstance("fs_placedetails", sdParams);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLFloaterSidePanelContainer::showPanel("places", sdParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool LLFloaterMap::checkTextureType(const LLSD& sdParam) const
|
||||
{
|
||||
const std::string strParam = sdParam.asString();
|
||||
|
||||
bool fWorldMapTextures = gSavedSettings.getBOOL("MiniMapWorldMapTextures");
|
||||
if ("maptile" == strParam)
|
||||
return fWorldMapTextures;
|
||||
else if ("terrain" == strParam)
|
||||
return !fWorldMapTextures;
|
||||
return false;
|
||||
}
|
||||
|
||||
void LLFloaterMap::handleTextureType(const LLSD& sdParam) const
|
||||
{
|
||||
gSavedSettings.setBOOL("MiniMapWorldMapTextures", ("maptile" == sdParam.asString()));
|
||||
}
|
||||
|
||||
void LLFloaterMap::refreshParcelOverlay()
|
||||
{
|
||||
mMap->mUpdateParcelImage = true;
|
||||
}
|
||||
|
||||
// <FS:Ansariel> FIRE-1825: Minimap floater background transparency
|
||||
// virtual
|
||||
F32 LLFloaterMap::getCurrentTransparency()
|
||||
{
|
||||
static LLCachedControl<F32> fsMiniMapOpacity(gSavedSettings, "FSMiniMapOpacity");
|
||||
return fsMiniMapOpacity();
|
||||
}
|
||||
|
||||
// </FS:Ansariel>
|
||||
|
|
|
|||
|
|
@ -28,9 +28,7 @@
|
|||
#define LL_LLFLOATERMAP_H
|
||||
|
||||
#include "llfloater.h"
|
||||
#include "llavatarname.h" // <FS:CR>
|
||||
|
||||
class LLMenuGL;
|
||||
class LLNetMap;
|
||||
class LLTextBox;
|
||||
|
||||
|
|
@ -46,7 +44,6 @@ public:
|
|||
|
||||
/*virtual*/ BOOL postBuild();
|
||||
/*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
|
||||
/*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
|
||||
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
|
||||
/*virtual*/ void draw();
|
||||
|
||||
|
|
@ -54,26 +51,15 @@ public:
|
|||
/*virtual*/ F32 getCurrentTransparency();
|
||||
|
||||
private:
|
||||
void handleZoom(const LLSD& userdata);
|
||||
void handleStopTracking (const LLSD& userdata);
|
||||
// <FS:Ansariel> Unused as of 06-02-2014; Handled in LLNetMap
|
||||
//void handleZoom(const LLSD& userdata);
|
||||
void setDirectionPos( LLTextBox* text_box, F32 rotation );
|
||||
void updateMinorDirections();
|
||||
void handleMark(const LLSD& userdata);
|
||||
void handleClearMarks();
|
||||
void handleCam();
|
||||
void handleStartTracking();
|
||||
void handleShowProfile(const LLSD& sdParam) const;
|
||||
void handleOverlayToggle(const LLSD& sdParam);
|
||||
void refreshParcelOverlay();
|
||||
bool checkTextureType(const LLSD& sdParam) const;
|
||||
void handleTextureType(const LLSD& sdParam) const;
|
||||
void setAvatarProfileLabel(const LLAvatarName& avName, const std::string& item_name); // <FS:CR>
|
||||
|
||||
// <FS:Ansariel> Remove titlebar
|
||||
void setMinimized( BOOL );
|
||||
|
||||
void stretchMiniMap(S32 width,S32 height);
|
||||
|
||||
LLMenuGL* mPopupMenu;
|
||||
// </FS:Ansariel>
|
||||
|
||||
LLTextBox* mTextBoxEast;
|
||||
LLTextBox* mTextBoxNorth;
|
||||
|
|
|
|||
Loading…
Reference in New Issue