summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rw-r--r--indra/newview/llviewermenu.cpp198
1 files changed, 132 insertions, 66 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index db462dee44..24a788aaed 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -48,12 +48,11 @@
#include "llconsole.h"
#include "lldebugview.h"
#include "llfilepicker.h"
-#include "llfirstuse.h"
+//#include "llfirstuse.h"
#include "llfloaterbuy.h"
#include "llfloaterbuycontents.h"
#include "llfloaterbuycurrency.h"
#include "llfloatercustomize.h"
-#include "llfloaterchatterbox.h"
#include "llfloatergodtools.h"
#include "llfloaterinventory.h"
#include "llfloaterland.h"
@@ -82,7 +81,6 @@
#include "llsidetray.h"
#include "llstatusbar.h"
#include "lltextureview.h"
-#include "lltoolbar.h"
#include "lltoolcomp.h"
#include "lltoolmgr.h"
#include "lltoolpie.h"
@@ -605,6 +603,10 @@ class LLAdvancedToggleHUDInfo : public view_listener_t
{
gDisplayFOV = !(gDisplayFOV);
}
+ else if ("badge" == info_type)
+ {
+ gDisplayBadge = !(gDisplayBadge);
+ }
return true;
}
};
@@ -627,6 +629,10 @@ class LLAdvancedCheckHUDInfo : public view_listener_t
{
new_value = gDisplayFOV;
}
+ else if ("badge" == info_type)
+ {
+ new_value = gDisplayBadge;
+ }
return new_value;
}
};
@@ -2490,7 +2496,7 @@ class LLObjectBuild : public view_listener_t
LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() );
// Could be first use
- LLFirstUse::useBuild();
+ //LLFirstUse::useBuild();
return true;
}
};
@@ -2535,7 +2541,7 @@ void handle_object_edit()
LLViewerJoystick::getInstance()->setNeedsReset(true);
// Could be first use
- LLFirstUse::useBuild();
+ //LLFirstUse::useBuild();
return;
}
@@ -2549,7 +2555,7 @@ void handle_object_inspect()
key["task"] = "task";
LLSideTray::getInstance()->showPanel("sidepanel_inventory", key);
}
-
+
/*
// Old floater properties
LLFloaterReg::showInstance("inspect", LLSD());
@@ -2586,7 +2592,7 @@ class LLLandBuild : public view_listener_t
LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() );
// Could be first use
- LLFirstUse::useBuild();
+ //LLFirstUse::useBuild();
return true;
}
};
@@ -2823,7 +2829,7 @@ bool handle_go_to()
}
// Could be first use
- LLFirstUse::useGoTo();
+ //LLFirstUse::useGoTo();
return true;
}
@@ -3364,13 +3370,13 @@ void handle_show_side_tray()
root->addChild(side_tray);
}
-class LLShowPanelPeopleTab : public view_listener_t
+// Toggle one of "People" panel tabs in side tray.
+class LLTogglePanelPeopleTab : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
std::string panel_name = userdata.asString();
- // Open tab of the "People" panel in side tray.
LLSD param;
param["people_panel_tab_name"] = panel_name;
@@ -3380,15 +3386,15 @@ class LLShowPanelPeopleTab : public view_listener_t
if (panel_name == "friends_panel")
{
- return togglePanel(friends_panel, param);
+ return togglePeoplePanel(friends_panel, panel_name, param);
}
else if (panel_name == "groups_panel")
{
- return togglePanel(groups_panel, param);
+ return togglePeoplePanel(groups_panel, panel_name, param);
}
else if (panel_name == "nearby_panel")
{
- return togglePanel(nearby_panel, param);
+ return togglePeoplePanel(nearby_panel, panel_name, param);
}
else
{
@@ -3396,23 +3402,16 @@ class LLShowPanelPeopleTab : public view_listener_t
}
}
- static bool togglePanel(LLPanel* &panel, const LLSD& param)
+ static bool togglePeoplePanel(LLPanel* &panel, const std::string& panel_name, const LLSD& param)
{
if(!panel)
{
- panel = LLSideTray::getInstance()->findChild<LLPanel>(param["people_panel_tab_name"].asString());
+ panel = LLSideTray::getInstance()->getPanel(panel_name);
if(!panel)
return false;
}
- if (panel->isInVisibleChain())
- {
- LLSideTray::getInstance()->collapseSideBar();
- }
- else
- {
- LLSideTray::getInstance()->showPanel("panel_people", param);
- }
+ LLSideTray::getInstance()->togglePanel(panel, "panel_people", param);
return true;
}
@@ -3555,9 +3554,15 @@ bool LLHaveCallingcard::operator()(LLInventoryCategory* cat,
BOOL is_agent_mappable(const LLUUID& agent_id)
{
- return (LLAvatarActions::isFriend(agent_id) &&
- LLAvatarTracker::instance().getBuddyInfo(agent_id)->isOnline() &&
- LLAvatarTracker::instance().getBuddyInfo(agent_id)->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)
+ const LLRelationship* buddy_info = NULL;
+ bool is_friend = LLAvatarActions::isFriend(agent_id);
+
+ if (is_friend)
+ buddy_info = LLAvatarTracker::instance().getBuddyInfo(agent_id);
+
+ return (buddy_info &&
+ buddy_info->isOnline() &&
+ buddy_info->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)
);
}
@@ -3667,7 +3672,7 @@ void near_sit_down_point(BOOL success, void *)
gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND);
// Might be first sit
- LLFirstUse::useSit();
+ //LLFirstUse::useSit();
}
}
@@ -4843,9 +4848,10 @@ class LLToolsEnableUnlink : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
+ LLViewerObject* first_editable_object = LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject();
bool new_value = LLSelectMgr::getInstance()->selectGetAllRootsValid() &&
- LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() &&
- !LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject()->isAttachment();
+ first_editable_object &&
+ !first_editable_object->isAttachment();
return new_value;
}
};
@@ -5185,7 +5191,7 @@ void toggle_debug_menus(void*)
gSavedSettings.setBOOL("UseDebugMenus", visible);
if(visible)
{
- LLFirstUse::useDebugMenus();
+ //LLFirstUse::useDebugMenus();
}
show_debug_menus();
}
@@ -5333,7 +5339,7 @@ class LLWorldCreateLandmark : public view_listener_t
void handle_look_at_selection(const LLSD& param)
{
- const F32 PADDING_FACTOR = 2.f;
+ const F32 PADDING_FACTOR = 1.75f;
BOOL zoom = (param.asString() == "zoom");
if (!LLSelectMgr::getInstance()->getSelection()->isEmpty())
{
@@ -5353,14 +5359,19 @@ void handle_look_at_selection(const LLSD& param)
}
if (zoom)
{
+ // Make sure we are not increasing the distance between the camera and object
+ LLVector3d orig_distance = gAgent.getCameraPositionGlobal() - LLSelectMgr::getInstance()->getSelectionCenterGlobal();
+ distance = llmin(distance, (F32) orig_distance.length());
+
gAgent.setCameraPosAndFocusGlobal(LLSelectMgr::getInstance()->getSelectionCenterGlobal() + LLVector3d(obj_to_cam * distance),
- LLSelectMgr::getInstance()->getSelectionCenterGlobal(),
- object_id );
+ LLSelectMgr::getInstance()->getSelectionCenterGlobal(),
+ object_id );
+
}
else
{
gAgent.setFocusGlobal( LLSelectMgr::getInstance()->getSelectionCenterGlobal(), object_id );
- }
+ }
}
}
@@ -5595,8 +5606,6 @@ void handle_buy_currency()
LLFloaterBuyCurrency::buyCurrency();
}
-
-
class LLFloaterVisible : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@@ -5626,19 +5635,39 @@ class LLShowSidetrayPanel : public view_listener_t
bool handleEvent(const LLSD& userdata)
{
std::string panel_name = userdata.asString();
- // Open up either the sidepanel or new floater.
- if (LLSideTray::getInstance()->isPanelActive(panel_name))
+ // Toggle the panel
+ if (!LLSideTray::getInstance()->isPanelActive(panel_name))
{
- LLFloaterInventory::showAgentInventory();
+ // LLFloaterInventory::showAgentInventory();
+ LLSideTray::getInstance()->showPanel(panel_name, LLSD());
}
else
{
- LLSideTray::getInstance()->showPanel(panel_name, LLSD());
+ LLSideTray::getInstance()->collapseSideBar();
}
return true;
}
};
+class LLSidetrayPanelVisible : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ std::string panel_name = userdata.asString();
+ // Toggle the panel
+ if (LLSideTray::getInstance()->isPanelActive(panel_name))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+
+ }
+};
+
+
bool callback_show_url(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
@@ -6106,7 +6135,8 @@ class LLAttachmentEnableDrop : public view_listener_t
LLViewerJointAttachment* attachment = NULL;
LLInventoryItem* item = NULL;
- if (object)
+ // Do not enable drop if all faces of object are not enabled
+ if (object && LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES ))
{
S32 attachmentID = ATTACHMENT_ID_FROM_STATE(object->getState());
attachment = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
@@ -6148,8 +6178,14 @@ class LLAttachmentEnableDrop : public view_listener_t
BOOL enable_detach(const LLSD&)
{
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (!object) return FALSE;
- if (!object->isAttachment()) return FALSE;
+
+ // Only enable detach if all faces of object are selected
+ if (!object ||
+ !object->isAttachment() ||
+ !LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES ))
+ {
+ return FALSE;
+ }
// Find the avatar who owns this attachment
LLViewerObject* avatar = object;
@@ -6372,7 +6408,6 @@ class LLToolsSelectedScriptAction : public view_listener_t
else
{
llwarns << "Failed to generate LLFloaterScriptQueue with action: " << action << llendl;
- delete queue;
}
return true;
}
@@ -6380,8 +6415,55 @@ class LLToolsSelectedScriptAction : public view_listener_t
void handle_selected_texture_info(void*)
{
- //useless without LLFloaterChat
- //as since we don't use LLFloaterChat...
+ for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin();
+ iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+
+ std::string msg;
+ msg.assign("Texture info for: ");
+ msg.append(node->mName);
+
+ LLSD args;
+ args["MESSAGE"] = msg;
+ LLNotificationsUtil::add("SystemMessage", args);
+
+ U8 te_count = node->getObject()->getNumTEs();
+ // map from texture ID to list of faces using it
+ typedef std::map< LLUUID, std::vector<U8> > map_t;
+ map_t faces_per_texture;
+ for (U8 i = 0; i < te_count; i++)
+ {
+ if (!node->isTESelected(i)) continue;
+
+ LLViewerTexture* img = node->getObject()->getTEImage(i);
+ LLUUID image_id = img->getID();
+ faces_per_texture[image_id].push_back(i);
+ }
+ // Per-texture, dump which faces are using it.
+ map_t::iterator it;
+ for (it = faces_per_texture.begin(); it != faces_per_texture.end(); ++it)
+ {
+ LLUUID image_id = it->first;
+ U8 te = it->second[0];
+ LLViewerTexture* img = node->getObject()->getTEImage(te);
+ S32 height = img->getHeight();
+ S32 width = img->getWidth();
+ S32 components = img->getComponents();
+ msg = llformat("%dx%d %s on face ",
+ width,
+ height,
+ (components == 4 ? "alpha" : "opaque"));
+ for (U8 i = 0; i < it->second.size(); ++i)
+ {
+ msg.append( llformat("%d ", (S32)(it->second[i])));
+ }
+
+ LLSD args;
+ args["MESSAGE"] = msg;
+ LLNotificationsUtil::add("SystemMessage", args);
+ }
+ }
}
void handle_test_male(void*)
@@ -7134,25 +7216,7 @@ void handle_buy_currency_test(void*)
LLStringUtil::format_map_t replace;
replace["[AGENT_ID]"] = gAgent.getID().asString();
replace["[SESSION_ID]"] = gAgent.getSecureSessionID().asString();
-
- // *TODO: Replace with call to LLUI::getLanguage() after windows-setup
- // branch merges in. JC
- std::string language = "en";
- language = gSavedSettings.getString("Language");
- if (language.empty() || language == "default")
- {
- language = gSavedSettings.getString("InstallLanguage");
- }
- if (language.empty() || language == "default")
- {
- language = gSavedSettings.getString("SystemLanguage");
- }
- if (language.empty() || language == "default")
- {
- language = "en";
- }
-
- replace["[LANGUAGE]"] = language;
+ replace["[LANGUAGE]"] = LLUI::getLanguage();
LLStringUtil::format(url, replace);
llinfos << "buy currency url " << url << llendl;
@@ -7896,7 +7960,7 @@ void initialize_menus()
view_listener_t::addMenu(new LLSelfEnableRemoveAllAttachments(), "Self.EnableRemoveAllAttachments");
// we don't use boost::bind directly to delay side tray construction
- view_listener_t::addMenu( new LLShowPanelPeopleTab(), "SideTray.PanelPeopleTab");
+ view_listener_t::addMenu( new LLTogglePanelPeopleTab(), "SideTray.PanelPeopleTab");
// Avatar pie menu
view_listener_t::addMenu(new LLObjectMute(), "Avatar.Mute");
@@ -7910,6 +7974,7 @@ void initialize_menus()
commit.add("Avatar.Eject", boost::bind(&handle_avatar_eject, LLSD()));
view_listener_t::addMenu(new LLAvatarSendIM(), "Avatar.SendIM");
view_listener_t::addMenu(new LLAvatarCall(), "Avatar.Call");
+ enable.add("Avatar.EnableCall", boost::bind(&LLAvatarActions::canCall));
view_listener_t::addMenu(new LLAvatarReportAbuse(), "Avatar.ReportAbuse");
view_listener_t::addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend");
@@ -7986,6 +8051,7 @@ void initialize_menus()
view_listener_t::addMenu(new LLFloaterVisible(), "FloaterVisible");
view_listener_t::addMenu(new LLShowSidetrayPanel(), "ShowSidetrayPanel");
+ view_listener_t::addMenu(new LLSidetrayPanelVisible(), "SidetrayPanelVisible");
view_listener_t::addMenu(new LLSomethingSelected(), "SomethingSelected");
view_listener_t::addMenu(new LLSomethingSelectedNoHUD(), "SomethingSelectedNoHUD");
view_listener_t::addMenu(new LLEditableSelected(), "EditableSelected");