diff options
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rw-r--r-- | indra/newview/llviewermenu.cpp | 64 |
1 files changed, 47 insertions, 17 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 8a5598e955..fbbd2e2d4f 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2555,7 +2555,7 @@ void handle_object_inspect() key["task"] = "task"; LLSideTray::getInstance()->showPanel("sidepanel_inventory", key); } - + /* // Old floater properties LLFloaterReg::showInstance("inspect", LLSD()); @@ -3554,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) ); } @@ -4842,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; } }; @@ -5332,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()) { @@ -5352,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 ); - } + } } } @@ -5594,8 +5606,6 @@ void handle_buy_currency() LLFloaterBuyCurrency::buyCurrency(); } - - class LLFloaterVisible : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -5625,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); @@ -6378,7 +6408,6 @@ class LLToolsSelectedScriptAction : public view_listener_t else { llwarns << "Failed to generate LLFloaterScriptQueue with action: " << action << llendl; - delete queue; } return true; } @@ -8022,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"); |