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.cpp455
1 files changed, 197 insertions, 258 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 476e761c28..64967466fb 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -2,25 +2,31 @@
* @file llviewermenu.cpp
* @brief Builds menus out of items.
*
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ *
+ * Copyright (c) 2002-2009, Linden Research, Inc.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
*
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
@@ -47,7 +53,8 @@
//#include "llfirstuse.h"
#include "llfloaterbuy.h"
#include "llfloaterbuycontents.h"
-#include "llbuycurrencyhtml.h"
+#include "llfloaterbuycurrency.h"
+#include "llfloatercustomize.h"
#include "llfloatergodtools.h"
#include "llfloaterinventory.h"
#include "llfloaterland.h"
@@ -101,13 +108,9 @@
#include "lluilistener.h"
#include "llappearancemgr.h"
#include "lltrans.h"
-#include "lleconomy.h"
-#include "boost/unordered_map.hpp"
using namespace LLVOAvatarDefines;
-static boost::unordered_map<std::string, LLStringExplicit> sDefaultItemLabels;
-
BOOL enable_land_build(void*);
BOOL enable_object_build(void*);
@@ -289,8 +292,8 @@ void handle_toggle_pg(void*);
void handle_dump_attachments(void *);
void handle_dump_avatar_local_textures(void*);
void handle_debug_avatar_textures(void*);
-void handle_grab_baked_texture(void*);
-BOOL enable_grab_baked_texture(void*);
+void handle_grab_texture(void*);
+BOOL enable_grab_texture(void*);
void handle_dump_region_object_cache(void*);
BOOL enable_save_into_inventory(void*);
@@ -427,7 +430,7 @@ void init_menus()
gPopupMenuView->setBackgroundColor( color );
// If we are not in production, use a different color to make it apparent.
- if (LLGridManager::getInstance()->isInProductionGrid())
+ if (LLViewerLogin::getInstance()->isInProductionGrid())
{
color = LLUIColorTable::instance().getColor( "MenuBarBgColor" );
}
@@ -443,7 +446,7 @@ void init_menus()
menu_bar_holder->addChild(gMenuBarView);
gViewerWindow->setMenuBackgroundColor(false,
- LLGridManager::getInstance()->isInProductionGrid());
+ LLViewerLogin::getInstance()->isInProductionGrid());
// Assume L$10 for now, the server will tell us the real cost at login
// *TODO:Also fix cost in llfolderview.cpp for Inventory menus
@@ -1457,28 +1460,28 @@ class LLAdvancedGrabBakedTexture : public view_listener_t
std::string texture_type = userdata.asString();
if ("iris" == texture_type)
{
- handle_grab_baked_texture( (void*)BAKED_EYES );
+ handle_grab_texture( (void*)TEX_EYES_BAKED );
}
else if ("head" == texture_type)
{
- handle_grab_baked_texture( (void*)BAKED_HEAD );
+ handle_grab_texture( (void*)TEX_HEAD_BAKED );
}
else if ("upper" == texture_type)
{
- handle_grab_baked_texture( (void*)BAKED_UPPER );
+ handle_grab_texture( (void*)TEX_UPPER_BAKED );
}
else if ("lower" == texture_type)
{
- handle_grab_baked_texture( (void*)BAKED_LOWER );
+ handle_grab_texture( (void*)TEX_SKIRT_BAKED );
}
else if ("skirt" == texture_type)
{
- handle_grab_baked_texture( (void*)BAKED_SKIRT );
+ handle_grab_texture( (void*)TEX_SKIRT_BAKED );
}
else if ("hair" == texture_type)
{
- handle_grab_baked_texture( (void*)BAKED_HAIR );
- }
+ handle_grab_texture( (void*)TEX_HAIR_BAKED );
+}
return true;
}
@@ -1493,27 +1496,23 @@ class LLAdvancedEnableGrabBakedTexture : public view_listener_t
if ("iris" == texture_type)
{
- new_value = enable_grab_baked_texture( (void*)BAKED_EYES );
+ new_value = enable_grab_texture( (void*)TEX_EYES_BAKED );
}
else if ("head" == texture_type)
{
- new_value = enable_grab_baked_texture( (void*)BAKED_HEAD );
+ new_value = enable_grab_texture( (void*)TEX_HEAD_BAKED );
}
else if ("upper" == texture_type)
{
- new_value = enable_grab_baked_texture( (void*)BAKED_UPPER );
+ new_value = enable_grab_texture( (void*)TEX_UPPER_BAKED );
}
else if ("lower" == texture_type)
{
- new_value = enable_grab_baked_texture( (void*)BAKED_LOWER );
+ new_value = enable_grab_texture( (void*)TEX_LOWER_BAKED );
}
else if ("skirt" == texture_type)
{
- new_value = enable_grab_baked_texture( (void*)BAKED_SKIRT );
- }
- else if ("hair" == texture_type)
- {
- new_value = enable_grab_baked_texture( (void*)BAKED_HAIR );
+ new_value = enable_grab_texture( (void*)TEX_SKIRT_BAKED );
}
return new_value;
@@ -2400,55 +2399,35 @@ void handle_object_touch()
msg->sendMessage(object->getRegion()->getHost());
}
-static void init_default_item_label(const std::string& item_name)
+bool enable_object_touch()
{
- boost::unordered_map<std::string, LLStringExplicit>::iterator it = sDefaultItemLabels.find(item_name);
- if (it == sDefaultItemLabels.end())
- {
- // *NOTE: This will not work for items of type LLMenuItemCheckGL because they return boolean value
- // (doesn't seem to matter much ATM).
- LLStringExplicit default_label = gMenuHolder->childGetValue(item_name).asString();
- if (!default_label.empty())
- {
- sDefaultItemLabels.insert(std::pair<std::string, LLStringExplicit>(item_name, default_label));
- }
- }
+ LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+ return obj && obj->flagHandleTouch();
}
-static LLStringExplicit get_default_item_label(const std::string& item_name)
+// One object must have touch sensor
+class LLObjectEnableTouch : public view_listener_t
{
- LLStringExplicit res("");
- boost::unordered_map<std::string, LLStringExplicit>::iterator it = sDefaultItemLabels.find(item_name);
- if (it != sDefaultItemLabels.end())
+ bool handleEvent(const LLSD& userdata)
{
- res = it->second;
- }
-
- return res;
-}
-
-
-bool enable_object_touch(LLUICtrl* ctrl)
-{
- LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
-
- bool new_value = obj && obj->flagHandleTouch();
+ bool new_value = enable_object_touch();
- std::string item_name = ctrl->getName();
- init_default_item_label(item_name);
+ // Update label based on the node touch name if available.
+ std::string touch_text;
+ LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
+ if (node && node->mValid && !node->mTouchName.empty())
+ {
+ touch_text = node->mTouchName;
+ }
+ else
+ {
+ touch_text = userdata.asString();
+ }
+ gMenuHolder->childSetText("Object Touch", touch_text);
+ gMenuHolder->childSetText("Attachment Object Touch", touch_text);
- // Update label based on the node touch name if available.
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- if (node && node->mValid && !node->mTouchName.empty())
- {
- gMenuHolder->childSetText(item_name, node->mTouchName);
- }
- else
- {
- gMenuHolder->childSetText(item_name, get_default_item_label(item_name));
+ return new_value;
}
-
- return new_value;
};
//void label_touch(std::string& label, void*)
@@ -3299,6 +3278,16 @@ void handle_buy_object(LLSaleInfo sale_info)
return;
}
+ S32 price = sale_info.getSalePrice();
+
+ if (price > 0 && price > gStatusBar->getBalance())
+ {
+ LLStringUtil::format_map_t args;
+ args["AMOUNT"] = llformat("%d", price);
+ LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("this_object_costs", args), price);
+ return;
+ }
+
LLFloaterBuy::show(sale_info);
}
@@ -3479,7 +3468,7 @@ void set_god_level(U8 god_level)
if(gViewerWindow)
{
gViewerWindow->setMenuBackgroundColor(god_level > GOD_NOT,
- LLGridManager::getInstance()->isInProductionGrid());
+ LLViewerLogin::getInstance()->isInProductionGrid());
}
LLSD args;
@@ -3519,7 +3508,7 @@ BOOL check_toggle_hacked_godmode(void*)
bool enable_toggle_hacked_godmode(void*)
{
- return !LLGridManager::getInstance()->isInProductionGrid();
+ return !LLViewerLogin::getInstance()->isInProductionGrid();
}
#endif
@@ -3640,15 +3629,7 @@ class LLEditEnableCustomizeAvatar : public view_listener_t
}
};
-class LLEnableEditShape : public view_listener_t
-{
- bool handleEvent(const LLSD& userdata)
- {
- return gAgentWearables.isWearableModifiable(LLWearableType::WT_SHAPE, 0);
- }
-};
-
-bool is_object_sittable()
+bool enable_sit_object()
{
LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
@@ -3742,15 +3723,17 @@ void reset_view_final( BOOL proceed );
void handle_reset_view()
{
- if (gAgentCamera.cameraCustomizeAvatar())
+ if( (CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode()) && gFloaterCustomize )
{
- // switching to outfit selector should automagically save any currently edited wearable
- LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "my_outfits"));
+ // Show dialog box if needed.
+ gFloaterCustomize->askToSaveIfDirty( reset_view_final );
+ }
+ else
+ {
+ gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW);
+ reset_view_final( TRUE );
+ LLFloaterCamera::resetCameraMode();
}
-
- gAgentCamera.switchCameraPreset(CAMERA_PRESET_REAR_VIEW);
- reset_view_final( TRUE );
- LLFloaterCamera::resetCameraMode();
}
class LLViewResetView : public view_listener_t
@@ -3799,6 +3782,15 @@ class LLViewMouselook : public view_listener_t
}
};
+class LLViewFullscreen : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ gViewerWindow->toggleFullscreen(TRUE);
+ return true;
+ }
+};
+
class LLViewDefaultUISize : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
@@ -4387,7 +4379,7 @@ BOOL enable_take()
return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLGridManager::getInstance()->isInProductionGrid()
+ if (!LLViewerLogin::getInstance()->isInProductionGrid()
&& gAgent.isGodlike())
{
return TRUE;
@@ -4424,7 +4416,8 @@ void handle_buy_or_take()
{
LLStringUtil::format_map_t args;
args["AMOUNT"] = llformat("%d", total_price);
- LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString( "BuyingCosts", args ), total_price );
+ LLFloaterBuyCurrency::buyCurrency(
+ LLTrans::getString("BuyingCosts", args), total_price);
}
}
else
@@ -4554,16 +4547,6 @@ void handle_buy()
BOOL valid = LLSelectMgr::getInstance()->selectGetSaleInfo(sale_info);
if (!valid) return;
- S32 price = sale_info.getSalePrice();
-
- if (price > 0 && price > gStatusBar->getBalance())
- {
- LLStringUtil::format_map_t args;
- args["AMOUNT"] = llformat("%d", price);
- LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("this_object_costs", args), price );
- return;
- }
-
if (sale_info.getSaleType() == LLSaleInfo::FS_CONTENTS)
{
handle_buy_contents(sale_info);
@@ -5009,7 +4992,7 @@ bool enable_object_delete()
TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- (!LLGridManager::getInstance()->isInProductionGrid()
+ (!LLViewerLogin::getInstance()->isInProductionGrid()
&& gAgent.isGodlike()) ||
# endif
LLSelectMgr::getInstance()->canDoDelete();
@@ -5534,37 +5517,56 @@ bool enable_pay_object()
return false;
}
-bool enable_object_stand_up()
+bool visible_object_stand_up()
{
- // 'Object Stand Up' menu item is enabled when agent is sitting on selection
+ // 'Object Stand Up' menu item is visible when agent is sitting on selection
return sitting_on_selection();
}
-bool enable_object_sit(LLUICtrl* ctrl)
+bool visible_object_sit()
{
- // 'Object Sit' menu item is enabled when agent is not sitting on selection
- bool sitting_on_sel = sitting_on_selection();
- if (!sitting_on_sel)
+ // 'Object Sit' menu item is visible when agent is not sitting on selection
+ bool is_sit_visible = !sitting_on_selection();
+ if (is_sit_visible)
{
- std::string item_name = ctrl->getName();
-
- // init default labels
- init_default_item_label(item_name);
-
+ LLMenuItemGL* sit_menu_item = gMenuHolder->getChild<LLMenuItemGL>("Object Sit");
+ // Init default 'Object Sit' menu item label
+ static const LLStringExplicit sit_text(sit_menu_item->getLabel());
// Update label
+ std::string label;
LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
if (node && node->mValid && !node->mSitName.empty())
{
- gMenuHolder->childSetText(item_name, node->mSitName);
+ label.assign(node->mSitName);
}
else
{
- gMenuHolder->childSetText(item_name, get_default_item_label(item_name));
+ label = sit_text;
}
+ sit_menu_item->setLabel(label);
}
- return !sitting_on_sel && is_object_sittable();
+ return is_sit_visible;
}
+class LLObjectEnableSitOrStand : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ bool new_value = false;
+ LLViewerObject* dest_object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
+
+ if(dest_object)
+ {
+ if(dest_object->getPCode() == LL_PCODE_VOLUME)
+ {
+ new_value = true;
+ }
+ }
+
+ return new_value;
+ }
+};
+
void dump_select_mgr(void*)
{
LLSelectMgr::getInstance()->dump();
@@ -5593,17 +5595,10 @@ void handle_viewer_disable_message_log(void*)
void handle_customize_avatar()
{
- LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "my_outfits"));
-}
-
-void handle_edit_outfit()
-{
- LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit"));
-}
-
-void handle_edit_shape()
-{
- LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_shape"));
+ if (gAgentWearables.areWearablesLoaded())
+ {
+ gAgentCamera.changeCameraToCustomizeAvatar();
+ }
}
void handle_report_abuse()
@@ -5615,7 +5610,7 @@ void handle_report_abuse()
void handle_buy_currency()
{
- LLBuyCurrencyHTML::openCurrencyFloater();
+ LLFloaterBuyCurrency::buyCurrency();
}
class LLFloaterVisible : public view_listener_t
@@ -6111,12 +6106,10 @@ class LLAttachmentDetach : public view_listener_t
//Adding an observer for a Jira 2422 and needs to be a fetch observer
//for Jira 3119
-class LLWornItemFetchedObserver : public LLInventoryFetchItemsObserver
+class LLWornItemFetchedObserver : public LLInventoryFetchObserver
{
public:
- LLWornItemFetchedObserver(const LLUUID& worn_item_id) :
- LLInventoryFetchItemsObserver(worn_item_id)
- {}
+ LLWornItemFetchedObserver() {}
virtual ~LLWornItemFetchedObserver() {}
protected:
@@ -6170,9 +6163,13 @@ class LLAttachmentEnableDrop : public view_listener_t
// when the item finishes fetching worst case scenario
// if a fetch is already out there (being sent from a slow sim)
// we refetch and there are 2 fetches
- LLWornItemFetchedObserver* worn_item_fetched = new LLWornItemFetchedObserver((*attachment_iter)->getItemID());
- worn_item_fetched->startFetch();
- gInventory.addObserver(worn_item_fetched);
+ LLWornItemFetchedObserver* wornItemFetched = new LLWornItemFetchedObserver();
+ uuid_vec_t items; //add item to the inventory item to be fetched
+
+ items.push_back((*attachment_iter)->getItemID());
+
+ wornItemFetched->fetch(items);
+ gInventory.addObserver(wornItemFetched);
}
}
}
@@ -6641,7 +6638,7 @@ bool enable_object_take_copy()
all_valid = true;
#ifndef HACKED_GODLIKE_VIEWER
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (LLGridManager::getInstance()->isInProductionGrid()
+ if (LLViewerLogin::getInstance()->isInProductionGrid()
|| !gAgent.isGodlike())
# endif
{
@@ -6703,7 +6700,7 @@ BOOL enable_save_into_inventory(void*)
return TRUE;
#else
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- if (!LLGridManager::getInstance()->isInProductionGrid()
+ if (!LLViewerLogin::getInstance()->isInProductionGrid()
&& gAgent.isGodlike())
{
return TRUE;
@@ -6939,20 +6936,27 @@ void handle_debug_avatar_textures(void*)
}
}
-void handle_grab_baked_texture(void* data)
+void handle_grab_texture(void* data)
{
- EBakedTextureIndex baked_tex_index = (EBakedTextureIndex)((intptr_t)data);
+ ETextureIndex tex_index = (ETextureIndex)((intptr_t)data);
if (!isAgentAvatarValid()) return;
- const LLUUID& asset_id = gAgentAvatarp->grabBakedTexture(baked_tex_index);
+ // MULTI-WEARABLE: change to support an index
+ const LLUUID& asset_id = gAgentAvatarp->grabLocalTexture(tex_index, 0);
LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << llendl;
LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE;
LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE;
const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(asset_type));
if(folder_id.notNull())
{
- std::string name;
- name = "Baked " + LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_tex_index)->mNameCapitalized + " Texture";
+ std::string name = "Unknown";
+ const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(tex_index);
+ if (texture_dict->mIsBakedTexture)
+ {
+ EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
+ name = "Baked " + LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mNameCapitalized;
+ }
+ name += " Texture";
LLUUID item_id;
item_id.generate();
@@ -7005,12 +7009,13 @@ void handle_grab_baked_texture(void* data)
}
}
-BOOL enable_grab_baked_texture(void* data)
+BOOL enable_grab_texture(void* data)
{
- EBakedTextureIndex index = (EBakedTextureIndex)((intptr_t)data);
+ ETextureIndex index = (ETextureIndex)((intptr_t)data);
if (isAgentAvatarValid())
{
- return gAgentAvatarp->canGrabBakedTexture(index);
+ // MULTI-WEARABLE:
+ return gAgentAvatarp->canGrabLocalTexture(index,0);
}
return FALSE;
}
@@ -7200,7 +7205,7 @@ void handle_web_browser_test(const LLSD& param)
{
url = "about:blank";
}
- LLWeb::loadURLInternal(url);
+ LLWeb::loadURL(url);
}
void handle_buy_currency_test(void*)
@@ -7469,8 +7474,8 @@ class LLEditEnableTakeOff : public view_listener_t
bool handleEvent(const LLSD& userdata)
{
std::string clothing = userdata.asString();
- LLWearableType::EType type = LLWearableType::typeNameToType(clothing);
- if (type >= LLWearableType::WT_SHAPE && type < LLWearableType::WT_COUNT)
+ EWearableType type = LLWearableDictionary::typeNameToType(clothing);
+ if (type >= WT_SHAPE && type < WT_COUNT)
return LLAgentWearables::selfHasWearable(type);
return false;
}
@@ -7485,14 +7490,11 @@ class LLEditTakeOff : public view_listener_t
LLWearableBridge::removeAllClothesFromAvatar();
else
{
- LLWearableType::EType type = LLWearableType::typeNameToType(clothing);
- if (type >= LLWearableType::WT_SHAPE
- && type < LLWearableType::WT_COUNT
- && (gAgentWearables.getWearableCount(type) > 0))
+ EWearableType type = LLWearableDictionary::typeNameToType(clothing);
+ if (type >= WT_SHAPE && type < WT_COUNT)
{
- // MULTI-WEARABLES: assuming user wanted to remove top shirt.
- U32 wearable_index = gAgentWearables.getWearableCount(type) - 1;
- LLViewerInventoryItem *item = dynamic_cast<LLViewerInventoryItem*>(gAgentWearables.getWearableInventoryItem(type,wearable_index));
+ // MULTI-WEARABLES
+ LLViewerInventoryItem *item = dynamic_cast<LLViewerInventoryItem*>(gAgentWearables.getWearableInventoryItem(type,0));
LLWearableBridge::removeItemFromAvatar(item);
}
@@ -7646,42 +7648,6 @@ class LLWorldToggleCameraControls : public view_listener_t
}
};
-class LLUploadCostCalculator : public view_listener_t
-{
- std::string mCostStr;
-
- bool handleEvent(const LLSD& userdata)
- {
- std::string menu_name = userdata.asString();
- gMenuHolder->childSetLabelArg(menu_name, "[COST]", mCostStr);
-
- return true;
- }
-
- void calculateCost();
-
-public:
- LLUploadCostCalculator()
- {
- calculateCost();
- }
-};
-
-void LLUploadCostCalculator::calculateCost()
-{
- S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
-
- // getPriceUpload() returns -1 if no data available yet.
- if(upload_cost >= 0)
- {
- mCostStr = llformat("%d", upload_cost);
- }
- else
- {
- mCostStr = llformat("%d", gSavedSettings.getU32("DefaultUploadCost"));
- }
-}
-
void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y)
{
static LLMenuGL* show_navbar_context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_hide_navbar.xml",
@@ -7695,55 +7661,6 @@ void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y)
LLMenuGL::showPopup(ctrl, show_navbar_context_menu, x, y);
}
-void show_topinfobar_context_menu(LLView* ctrl, S32 x, S32 y)
-{
- static LLMenuGL* show_topbarinfo_context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_topinfobar.xml",
- gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
-
- LLMenuItemGL* landmark_item = show_topbarinfo_context_menu->getChild<LLMenuItemGL>("Landmark");
- if (!LLLandmarkActions::landmarkAlreadyExists())
- {
- landmark_item->setLabel(LLTrans::getString("AddLandmarkNavBarMenu"));
- }
- else
- {
- landmark_item->setLabel(LLTrans::getString("EditLandmarkNavBarMenu"));
- }
-
- if(gMenuHolder->hasVisibleMenu())
- {
- gMenuHolder->hideMenus();
- }
-
- show_topbarinfo_context_menu->buildDrawLabels();
- show_topbarinfo_context_menu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(ctrl, show_topbarinfo_context_menu, x, y);
-}
-
-void initialize_edit_menu()
-{
- view_listener_t::addMenu(new LLEditUndo(), "Edit.Undo");
- view_listener_t::addMenu(new LLEditRedo(), "Edit.Redo");
- view_listener_t::addMenu(new LLEditCut(), "Edit.Cut");
- view_listener_t::addMenu(new LLEditCopy(), "Edit.Copy");
- view_listener_t::addMenu(new LLEditPaste(), "Edit.Paste");
- view_listener_t::addMenu(new LLEditDelete(), "Edit.Delete");
- view_listener_t::addMenu(new LLEditSelectAll(), "Edit.SelectAll");
- view_listener_t::addMenu(new LLEditDeselect(), "Edit.Deselect");
- view_listener_t::addMenu(new LLEditDuplicate(), "Edit.Duplicate");
- view_listener_t::addMenu(new LLEditTakeOff(), "Edit.TakeOff");
- view_listener_t::addMenu(new LLEditEnableUndo(), "Edit.EnableUndo");
- view_listener_t::addMenu(new LLEditEnableRedo(), "Edit.EnableRedo");
- view_listener_t::addMenu(new LLEditEnableCut(), "Edit.EnableCut");
- view_listener_t::addMenu(new LLEditEnableCopy(), "Edit.EnableCopy");
- view_listener_t::addMenu(new LLEditEnablePaste(), "Edit.EnablePaste");
- view_listener_t::addMenu(new LLEditEnableDelete(), "Edit.EnableDelete");
- view_listener_t::addMenu(new LLEditEnableSelectAll(), "Edit.EnableSelectAll");
- view_listener_t::addMenu(new LLEditEnableDeselect(), "Edit.EnableDeselect");
- view_listener_t::addMenu(new LLEditEnableDuplicate(), "Edit.EnableDuplicate");
-
-}
-
void initialize_menus()
{
// A parameterized event handler used as ctrl-8/9/0 zoom controls below.
@@ -7770,8 +7687,7 @@ void initialize_menus()
// Generic enable and visible
// Don't prepend MenuName.Foo because these can be used in any menu.
enable.add("IsGodCustomerService", boost::bind(&is_god_customer_service));
-
- view_listener_t::addEnable(new LLUploadCostCalculator(), "Upload.CalculateCosts");
+ enable.add("IsGodCustomerService", boost::bind(&is_god_customer_service));
// Agent
commit.add("Agent.toggleFlying", boost::bind(&LLAgent::toggleFlying));
@@ -7780,12 +7696,30 @@ void initialize_menus()
// File menu
init_menu_file();
+ // Edit menu
+ view_listener_t::addMenu(new LLEditUndo(), "Edit.Undo");
+ view_listener_t::addMenu(new LLEditRedo(), "Edit.Redo");
+ view_listener_t::addMenu(new LLEditCut(), "Edit.Cut");
+ view_listener_t::addMenu(new LLEditCopy(), "Edit.Copy");
+ view_listener_t::addMenu(new LLEditPaste(), "Edit.Paste");
+ view_listener_t::addMenu(new LLEditDelete(), "Edit.Delete");
+ view_listener_t::addMenu(new LLEditSelectAll(), "Edit.SelectAll");
+ view_listener_t::addMenu(new LLEditDeselect(), "Edit.Deselect");
+ view_listener_t::addMenu(new LLEditDuplicate(), "Edit.Duplicate");
+ view_listener_t::addMenu(new LLEditTakeOff(), "Edit.TakeOff");
+
+ view_listener_t::addMenu(new LLEditEnableUndo(), "Edit.EnableUndo");
+ view_listener_t::addMenu(new LLEditEnableRedo(), "Edit.EnableRedo");
+ view_listener_t::addMenu(new LLEditEnableCut(), "Edit.EnableCut");
+ view_listener_t::addMenu(new LLEditEnableCopy(), "Edit.EnableCopy");
+ view_listener_t::addMenu(new LLEditEnablePaste(), "Edit.EnablePaste");
+ view_listener_t::addMenu(new LLEditEnableDelete(), "Edit.EnableDelete");
+ view_listener_t::addMenu(new LLEditEnableSelectAll(), "Edit.EnableSelectAll");
+ view_listener_t::addMenu(new LLEditEnableDeselect(), "Edit.EnableDeselect");
+ view_listener_t::addMenu(new LLEditEnableDuplicate(), "Edit.EnableDuplicate");
view_listener_t::addMenu(new LLEditEnableTakeOff(), "Edit.EnableTakeOff");
view_listener_t::addMenu(new LLEditEnableCustomizeAvatar(), "Edit.EnableCustomizeAvatar");
- view_listener_t::addMenu(new LLEnableEditShape(), "Edit.EnableEditShape");
commit.add("CustomizeAvatar", boost::bind(&handle_customize_avatar));
- commit.add("EditOutfit", boost::bind(&handle_edit_outfit));
- commit.add("EditShape", boost::bind(&handle_edit_shape));
// View menu
view_listener_t::addMenu(new LLViewMouselook(), "View.Mouselook");
@@ -7799,6 +7733,7 @@ void initialize_menus()
view_listener_t::addMenu(new LLZoomer(1.2f), "View.ZoomOut");
view_listener_t::addMenu(new LLZoomer(1/1.2f), "View.ZoomIn");
view_listener_t::addMenu(new LLZoomer(DEFAULT_FIELD_OF_VIEW, false), "View.ZoomDefault");
+ view_listener_t::addMenu(new LLViewFullscreen(), "View.Fullscreen");
view_listener_t::addMenu(new LLViewDefaultUISize(), "View.DefaultUISize");
view_listener_t::addMenu(new LLViewEnableMouselook(), "View.EnableMouselook");
@@ -8064,11 +7999,13 @@ void initialize_menus()
view_listener_t::addMenu(new LLAvatarEnableAddFriend(), "Avatar.EnableAddFriend");
enable.add("Avatar.EnableFreezeEject", boost::bind(&enable_freeze_eject, _2));
+ enable.add("Avatar.EnableFreezeEject", boost::bind(&enable_freeze_eject, _2));
// Object pie menu
view_listener_t::addMenu(new LLObjectBuild(), "Object.Build");
commit.add("Object.Touch", boost::bind(&handle_object_touch));
commit.add("Object.SitOrStand", boost::bind(&handle_object_sit_or_stand));
+ enable.add("Object.EnableSit", boost::bind(&enable_sit_object));
commit.add("Object.Delete", boost::bind(&handle_object_delete));
view_listener_t::addMenu(new LLObjectAttachToAvatar(), "Object.AttachToAvatar");
view_listener_t::addMenu(new LLObjectReturn(), "Object.Return");
@@ -8084,12 +8021,14 @@ void initialize_menus()
commit.add("Object.Open", boost::bind(&handle_object_open));
commit.add("Object.Take", boost::bind(&handle_take));
enable.add("Object.EnableOpen", boost::bind(&enable_object_open));
- enable.add("Object.EnableTouch", boost::bind(&enable_object_touch, _1));
+ enable.add("Object.EnableTouch", boost::bind(&enable_object_touch));
+ view_listener_t::addMenu(new LLObjectEnableTouch(), "Object.EnableTouch");
+ view_listener_t::addMenu(new LLObjectEnableSitOrStand(), "Object.EnableSitOrStand");
enable.add("Object.EnableDelete", boost::bind(&enable_object_delete));
enable.add("Object.EnableWear", boost::bind(&object_selected_and_point_valid));
- enable.add("Object.EnableStandUp", boost::bind(&enable_object_stand_up));
- enable.add("Object.EnableSit", boost::bind(&enable_object_sit, _1));
+ enable.add("Object.StandUpVisible", boost::bind(&visible_object_stand_up));
+ enable.add("Object.SitVisible", boost::bind(&visible_object_sit));
view_listener_t::addMenu(new LLObjectEnableReturn(), "Object.EnableReturn");
view_listener_t::addMenu(new LLObjectEnableReportAbuse(), "Object.EnableReportAbuse");