From b7d020e744e69749dc946ce63fdb18d613a18e0a Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Tue, 3 Nov 2009 16:28:52 -0500 Subject: EXT-2168 : Rename ObjectInfo to ItemInfo Renaming for better clarity as to what llsidepaneliteminfo does. Also fixed an error where Edit was not enabling the panel. Also did some superficial cleanup and reorganization of llsidepanel- files. --HG-- branch : avatar-pipeline --- indra/newview/CMakeLists.txt | 4 +- indra/newview/llsidepanelinventory.cpp | 481 +++++------ indra/newview/llsidepanelinventory.h | 166 ++-- indra/newview/llsidepaneliteminfo.cpp | 961 +++++++++++++++++++++ indra/newview/llsidepaneliteminfo.h | 107 +++ .../skins/default/xui/en/sidepanel_inventory.xml | 244 +++--- .../skins/default/xui/en/sidepanel_item_info.xml | 531 ++++++++++++ 7 files changed, 2046 insertions(+), 448 deletions(-) create mode 100644 indra/newview/llsidepaneliteminfo.cpp create mode 100644 indra/newview/llsidepaneliteminfo.h create mode 100644 indra/newview/skins/default/xui/en/sidepanel_item_info.xml (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index e138b431c5..8882f02df4 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -370,7 +370,7 @@ set(viewer_SOURCE_FILES llsearchhistory.cpp llselectmgr.cpp llsidepanelinventory.cpp - llsidepanelobjectinfo.cpp + llsidepaneliteminfo.cpp llsidetray.cpp llsidetraypanelcontainer.cpp llsky.cpp @@ -855,7 +855,7 @@ set(viewer_HEADER_FILES llsearchhistory.h llselectmgr.h llsidepanelinventory.h - llsidepanelobjectinfo.h + llsidepaneliteminfo.h llsidetray.h llsidetraypanelcontainer.h llsky.h diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 3cf17fb7f2..dbe7e9fec6 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -1,244 +1,237 @@ -/** - * @file LLSidepanelInventory.cpp - * @brief Side Bar "Inventory" panel - * - * $LicenseInfo:firstyear=2009&license=viewergpl$ - * - * Copyright (c) 2004-2009, Linden Research, Inc. - * - * 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 - * - * 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 - * - * 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. - * - * 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$ - */ - -#include "llviewerprecompiledheaders.h" -#include "llsidepanelinventory.h" - -#include "llagent.h" -#include "llbutton.h" -#include "llinventorybridge.h" -#include "llinventorypanel.h" -#include "llpanelmaininventory.h" -#include "llsidepanelobjectinfo.h" -#include "lltabcontainer.h" - -static const S32 LANDMARK_FOLDERS_MENU_WIDTH = 250; -static const std::string AGENT_INFO_TYPE = "agent"; -static const std::string CREATE_LANDMARK_INFO_TYPE = "create_landmark"; -static const std::string LANDMARK_INFO_TYPE = "landmark"; -static const std::string REMOTE_PLACE_INFO_TYPE = "remote_place"; -static const std::string TELEPORT_HISTORY_INFO_TYPE = "teleport_history"; - -static LLRegisterPanelClassWrapper t_inventory("sidepanel_inventory"); - -LLSidepanelInventory::LLSidepanelInventory() - : LLPanel(), - mSidepanelObjectInfo(NULL) -{ - - //LLUICtrlFactory::getInstance()->buildPanel(this, "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() -} - -LLSidepanelInventory::~LLSidepanelInventory() -{ -} - -BOOL LLSidepanelInventory::postBuild() -{ - mInfoBtn = getChild("info_btn"); - mInfoBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onInfoButtonClicked, this)); - - mShareBtn = getChild("share_btn"); - mShareBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onShareButtonClicked, this)); - - mShareBtn = getChild("share_btn"); - mShareBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onShareButtonClicked, this)); - - mWearBtn = getChild("wear_btn"); - mWearBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onWearButtonClicked, this)); - - mPlayBtn = getChild("play_btn"); - mPlayBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onPlayButtonClicked, this)); - - mTeleportBtn = getChild("teleport_btn"); - mTeleportBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onTeleportButtonClicked, this)); - - mOverflowBtn = getChild("overflow_btn"); - mOverflowBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onOverflowButtonClicked, this)); - - mTabContainer = getChild("Inventory Tabs"); - mSidepanelObjectInfo = getChild("sidepanel_object_info"); - - mPanelMainInventory = getChild("panel_main_inventory"); - mPanelMainInventory->setSelectCallback(boost::bind(&LLSidepanelInventory::onSelectionChange, this, _1, _2)); - - LLButton* back_btn = mSidepanelObjectInfo->getChild("back_btn"); - back_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onBackButtonClicked, this)); - - return TRUE; -} - -void LLSidepanelInventory::onOpen(const LLSD& key) -{ - if(key.size() == 0) - return; - - mSidepanelObjectInfo->reset(); - - if (key.has("id")) - { - mSidepanelObjectInfo->setItemID(key["id"].asUUID()); - } - - if (key.has("object")) - { - mSidepanelObjectInfo->setObjectID(key["object"].asUUID()); - } - - toggleObjectInfoPanel(TRUE); -} - -void LLSidepanelInventory::onInfoButtonClicked() -{ - LLInventoryItem *item = getSelectedItem(); - if (item) - { - mSidepanelObjectInfo->reset(); - mSidepanelObjectInfo->setItemID(item->getUUID()); - toggleObjectInfoPanel(TRUE); - } -} - -void LLSidepanelInventory::onShareButtonClicked() -{ -} - -void LLSidepanelInventory::performActionOnSelection(const std::string &action) -{ - LLInventoryPanel *panel = mPanelMainInventory->getActivePanel(); - LLFolderViewItem* current_item = panel->getRootFolder()->getCurSelectedItem(); - if (!current_item) - { - return; - } - current_item->getListener()->performAction(panel->getRootFolder(), panel->getModel(), action); -} - -void LLSidepanelInventory::onWearButtonClicked() -{ - performActionOnSelection("wear"); - performActionOnSelection("attach"); -} - -void LLSidepanelInventory::onPlayButtonClicked() -{ - performActionOnSelection("activate"); -} - -void LLSidepanelInventory::onTeleportButtonClicked() -{ - performActionOnSelection("teleport"); -} - -void LLSidepanelInventory::onOverflowButtonClicked() -{ -} - -void LLSidepanelInventory::onBackButtonClicked() -{ - toggleObjectInfoPanel(FALSE); - updateVerbs(); -} - -void LLSidepanelInventory::onSelectionChange(const std::deque &items, BOOL user_action) -{ - updateVerbs(); -} - -void LLSidepanelInventory::toggleObjectInfoPanel(BOOL visible) -{ - mSidepanelObjectInfo->setVisible(visible); - mTabContainer->setVisible(!visible); - - if (visible) - { - mSidepanelObjectInfo->reset(); - mSidepanelObjectInfo->setEditMode(FALSE); - - LLRect rect = getRect(); - LLRect new_rect = LLRect(rect.mLeft, rect.mTop, rect.mRight, mTabContainer->getRect().mBottom); - mSidepanelObjectInfo->reshape(new_rect.getWidth(),new_rect.getHeight()); - } -} - -void LLSidepanelInventory::updateVerbs() -{ - mInfoBtn->setEnabled(FALSE); - mShareBtn->setEnabled(FALSE); - - mWearBtn->setVisible(FALSE); - mWearBtn->setEnabled(FALSE); - mPlayBtn->setVisible(FALSE); - mPlayBtn->setEnabled(FALSE); - mTeleportBtn->setVisible(FALSE); - mTeleportBtn->setEnabled(FALSE); - - const LLInventoryItem *item = getSelectedItem(); - if (!item) - return; - - mInfoBtn->setEnabled(TRUE); - mShareBtn->setEnabled(TRUE); - - switch(item->getInventoryType()) - { - case LLInventoryType::IT_WEARABLE: - case LLInventoryType::IT_OBJECT: - case LLInventoryType::IT_ATTACHMENT: - mWearBtn->setVisible(TRUE); - mWearBtn->setEnabled(TRUE); - break; - case LLInventoryType::IT_SOUND: - case LLInventoryType::IT_GESTURE: - case LLInventoryType::IT_ANIMATION: - mPlayBtn->setVisible(TRUE); - mPlayBtn->setEnabled(TRUE); - break; - case LLInventoryType::IT_LANDMARK: - mTeleportBtn->setVisible(TRUE); - mTeleportBtn->setEnabled(TRUE); - break; - default: - break; - } -} - -LLInventoryItem *LLSidepanelInventory::getSelectedItem() -{ - LLFolderViewItem* current_item = mPanelMainInventory->getActivePanel()->getRootFolder()->getCurSelectedItem(); - if (!current_item) - { - return NULL; - } - const LLUUID &item_id = current_item->getListener()->getUUID(); - LLInventoryItem *item = gInventory.getItem(item_id); - return item; -} +/** + * @file LLSidepanelInventory.cpp + * @brief Side Bar "Inventory" panel + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * 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 + * + * 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 + * + * 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. + * + * 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$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llsidepanelinventory.h" + +#include "llagent.h" +#include "llbutton.h" +#include "llinventorybridge.h" +#include "llinventorypanel.h" +#include "llpanelmaininventory.h" +#include "llsidepaneliteminfo.h" +#include "lltabcontainer.h" + +static LLRegisterPanelClassWrapper t_inventory("sidepanel_inventory"); + +LLSidepanelInventory::LLSidepanelInventory() + : LLPanel(), + mSidepanelItemInfo(NULL) +{ + + //LLUICtrlFactory::getInstance()->buildPanel(this, "panel_inventory.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() +} + +LLSidepanelInventory::~LLSidepanelInventory() +{ +} + +BOOL LLSidepanelInventory::postBuild() +{ + mInfoBtn = getChild("info_btn"); + mInfoBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onInfoButtonClicked, this)); + + mShareBtn = getChild("share_btn"); + mShareBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onShareButtonClicked, this)); + + mShareBtn = getChild("share_btn"); + mShareBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onShareButtonClicked, this)); + + mWearBtn = getChild("wear_btn"); + mWearBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onWearButtonClicked, this)); + + mPlayBtn = getChild("play_btn"); + mPlayBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onPlayButtonClicked, this)); + + mTeleportBtn = getChild("teleport_btn"); + mTeleportBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onTeleportButtonClicked, this)); + + mOverflowBtn = getChild("overflow_btn"); + mOverflowBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onOverflowButtonClicked, this)); + + mTabContainer = getChild("Inventory Tabs"); + mSidepanelItemInfo = getChild("sidepanel_item_info"); + + mPanelMainInventory = getChild("panel_main_inventory"); + mPanelMainInventory->setSelectCallback(boost::bind(&LLSidepanelInventory::onSelectionChange, this, _1, _2)); + + LLButton* back_btn = mSidepanelItemInfo->getChild("back_btn"); + back_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onBackButtonClicked, this)); + + return TRUE; +} + +void LLSidepanelInventory::onOpen(const LLSD& key) +{ + if(key.size() == 0) + return; + + mSidepanelItemInfo->reset(); + + if (key.has("id")) + { + mSidepanelItemInfo->setItemID(key["id"].asUUID()); + } + + if (key.has("object")) + { + mSidepanelItemInfo->setObjectID(key["object"].asUUID()); + } + + toggleItemInfoPanel(TRUE); +} + +void LLSidepanelInventory::onInfoButtonClicked() +{ + LLInventoryItem *item = getSelectedItem(); + if (item) + { + mSidepanelItemInfo->reset(); + mSidepanelItemInfo->setItemID(item->getUUID()); + toggleItemInfoPanel(TRUE); + } +} + +void LLSidepanelInventory::onShareButtonClicked() +{ +} + +void LLSidepanelInventory::performActionOnSelection(const std::string &action) +{ + LLInventoryPanel *panel = mPanelMainInventory->getActivePanel(); + LLFolderViewItem* current_item = panel->getRootFolder()->getCurSelectedItem(); + if (!current_item) + { + return; + } + current_item->getListener()->performAction(panel->getRootFolder(), panel->getModel(), action); +} + +void LLSidepanelInventory::onWearButtonClicked() +{ + performActionOnSelection("wear"); + performActionOnSelection("attach"); +} + +void LLSidepanelInventory::onPlayButtonClicked() +{ + performActionOnSelection("activate"); +} + +void LLSidepanelInventory::onTeleportButtonClicked() +{ + performActionOnSelection("teleport"); +} + +void LLSidepanelInventory::onOverflowButtonClicked() +{ +} + +void LLSidepanelInventory::onBackButtonClicked() +{ + toggleItemInfoPanel(FALSE); + updateVerbs(); +} + +void LLSidepanelInventory::onSelectionChange(const std::deque &items, BOOL user_action) +{ + updateVerbs(); +} + +void LLSidepanelInventory::toggleItemInfoPanel(BOOL visible) +{ + mSidepanelItemInfo->setVisible(visible); + mTabContainer->setVisible(!visible); + + if (visible) + { + mSidepanelItemInfo->dirty(); + mSidepanelItemInfo->setEditMode(FALSE); + + LLRect rect = getRect(); + LLRect new_rect = LLRect(rect.mLeft, rect.mTop, rect.mRight, mTabContainer->getRect().mBottom); + mSidepanelItemInfo->reshape(new_rect.getWidth(),new_rect.getHeight()); + } +} + +void LLSidepanelInventory::updateVerbs() +{ + mInfoBtn->setEnabled(FALSE); + mShareBtn->setEnabled(FALSE); + + mWearBtn->setVisible(FALSE); + mWearBtn->setEnabled(FALSE); + mPlayBtn->setVisible(FALSE); + mPlayBtn->setEnabled(FALSE); + mTeleportBtn->setVisible(FALSE); + mTeleportBtn->setEnabled(FALSE); + + const LLInventoryItem *item = getSelectedItem(); + if (!item) + return; + + mInfoBtn->setEnabled(TRUE); + mShareBtn->setEnabled(TRUE); + + switch(item->getInventoryType()) + { + case LLInventoryType::IT_WEARABLE: + case LLInventoryType::IT_OBJECT: + case LLInventoryType::IT_ATTACHMENT: + mWearBtn->setVisible(TRUE); + mWearBtn->setEnabled(TRUE); + break; + case LLInventoryType::IT_SOUND: + case LLInventoryType::IT_GESTURE: + case LLInventoryType::IT_ANIMATION: + mPlayBtn->setVisible(TRUE); + mPlayBtn->setEnabled(TRUE); + break; + case LLInventoryType::IT_LANDMARK: + mTeleportBtn->setVisible(TRUE); + mTeleportBtn->setEnabled(TRUE); + break; + default: + break; + } +} + +LLInventoryItem *LLSidepanelInventory::getSelectedItem() +{ + LLFolderViewItem* current_item = mPanelMainInventory->getActivePanel()->getRootFolder()->getCurSelectedItem(); + if (!current_item) + { + return NULL; + } + const LLUUID &item_id = current_item->getListener()->getUUID(); + LLInventoryItem *item = gInventory.getItem(item_id); + return item; +} diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h index 62eeecc5e2..fbffb39b8c 100644 --- a/indra/newview/llsidepanelinventory.h +++ b/indra/newview/llsidepanelinventory.h @@ -1,80 +1,86 @@ -/** - * @file LLSidepanelInventory.h - * @brief Side Bar "Inventory" panel - * - * $LicenseInfo:firstyear=2009&license=viewergpl$ - * - * Copyright (c) 2004-2009, Linden Research, Inc. - * - * 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 - * - * 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 - * - * 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. - * - * 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$ - */ - -#ifndef LL_LLSIDEPANELINVENTORY_H -#define LL_LLSIDEPANELINVENTORY_H - -#include "llpanel.h" - -class LLInventoryItem; -class LLSidepanelObjectInfo; -class LLTabContainer; -class LLPanelMainInventory; -class LLFolderViewItem; - -class LLSidepanelInventory : public LLPanel -{ -public: - LLSidepanelInventory(); - virtual ~LLSidepanelInventory(); - - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); - -protected: - LLInventoryItem *getSelectedItem(); - void onSelectionChange(const std::deque &items, BOOL user_action); - void onTabSelected(); - void toggleObjectInfoPanel(BOOL visible); - void updateVerbs(); - void performActionOnSelection(const std::string &action); - - LLTabContainer* mTabContainer; - LLSidepanelObjectInfo* mSidepanelObjectInfo; - LLPanelMainInventory* mPanelMainInventory; - - void onInfoButtonClicked(); - void onShareButtonClicked(); - void onWearButtonClicked(); - void onPlayButtonClicked(); - void onTeleportButtonClicked(); - void onOverflowButtonClicked(); - void onBackButtonClicked(); - - LLButton* mInfoBtn; - LLButton* mShareBtn; - LLButton* mWearBtn; - LLButton* mPlayBtn; - LLButton* mTeleportBtn; - LLButton* mOverflowBtn; -}; - -#endif //LL_LLSIDEPANELINVENTORY_H +/** + * @file LLSidepanelInventory.h + * @brief Side Bar "Inventory" panel + * + * $LicenseInfo:firstyear=2009&license=viewergpl$ + * + * Copyright (c) 2004-2009, Linden Research, Inc. + * + * 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 + * + * 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 + * + * 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. + * + * 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$ + */ + +#ifndef LL_LLSIDEPANELINVENTORY_H +#define LL_LLSIDEPANELINVENTORY_H + +#include "llpanel.h" + +class LLInventoryItem; +class LLSidepanelItemInfo; +class LLTabContainer; +class LLPanelMainInventory; +class LLFolderViewItem; + +class LLSidepanelInventory : public LLPanel +{ +public: + LLSidepanelInventory(); + virtual ~LLSidepanelInventory(); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(const LLSD& key); + +protected: + // Tracks highlighted (selected) item in inventory panel. + LLInventoryItem *getSelectedItem(); + void onSelectionChange(const std::deque &items, BOOL user_action); + // "wear", "teleport", etc. + void performActionOnSelection(const std::string &action); + + void toggleItemInfoPanel(BOOL visible); + void updateVerbs(); + + // + // UI Elements + // +protected: + void onInfoButtonClicked(); + void onShareButtonClicked(); + void onWearButtonClicked(); + void onPlayButtonClicked(); + void onTeleportButtonClicked(); + void onOverflowButtonClicked(); + void onBackButtonClicked(); +private: + LLButton* mInfoBtn; + LLButton* mShareBtn; + LLButton* mWearBtn; + LLButton* mPlayBtn; + LLButton* mTeleportBtn; + LLButton* mOverflowBtn; + + LLTabContainer* mTabContainer; + LLSidepanelItemInfo* mSidepanelItemInfo; + LLPanelMainInventory* mPanelMainInventory; +}; + +#endif //LL_LLSIDEPANELINVENTORY_H diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp new file mode 100644 index 0000000000..0b00c7fbe9 --- /dev/null +++ b/indra/newview/llsidepaneliteminfo.cpp @@ -0,0 +1,961 @@ +/** + * @file llsidepaneliteminfo.cpp + * @brief A floater which shows an inventory item's properties. + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2009, Linden Research, Inc. + * + * 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 + * + * 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 + * + * 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. + * + * 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$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llsidepaneliteminfo.h" + +#include "roles_constants.h" + +#include "llagent.h" +#include "llavataractions.h" +#include "llbutton.h" +#include "llfloaterreg.h" +#include "llgroupactions.h" +#include "llinventorymodel.h" +#include "lllineeditor.h" +#include "llradiogroup.h" +#include "llviewercontrol.h" +#include "llviewerinventory.h" +#include "llviewerobjectlist.h" + + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLItemPropertiesObserver +// +// Helper class to watch for changes to the item. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLItemPropertiesObserver : public LLInventoryObserver +{ +public: + LLItemPropertiesObserver(LLSidepanelItemInfo* floater) + : mFloater(floater) + { + gInventory.addObserver(this); + } + virtual ~LLItemPropertiesObserver() + { + gInventory.removeObserver(this); + } + virtual void changed(U32 mask); +private: + LLSidepanelItemInfo* mFloater; +}; + +void LLItemPropertiesObserver::changed(U32 mask) +{ + // if there's a change we're interested in. + if((mask & (LLInventoryObserver::LABEL | LLInventoryObserver::INTERNAL | LLInventoryObserver::REMOVE)) != 0) + { + mFloater->dirty(); + } +} + + + +///---------------------------------------------------------------------------- +/// Class LLSidepanelItemInfo +///---------------------------------------------------------------------------- + +static LLRegisterPanelClassWrapper t_item_info("sidepanel_item_info"); + +// Default constructor +LLSidepanelItemInfo::LLSidepanelItemInfo() + : LLPanel(), + mItemID(LLUUID::null), + mDirty(TRUE), + mEditMode(FALSE) +{ + mPropertiesObserver = new LLItemPropertiesObserver(this); + + //LLUICtrlFactory::getInstance()->buildFloater(this,"floater_inventory_item_properties.xml"); +} + +// Destroys the object +LLSidepanelItemInfo::~LLSidepanelItemInfo() +{ + delete mPropertiesObserver; + mPropertiesObserver = NULL; +} + +// virtual +BOOL LLSidepanelItemInfo::postBuild() +{ + mEditBtn = getChild("edit_btn"); + mEditBtn->setClickedCallback(boost::bind(&LLSidepanelItemInfo::onEditButtonClicked, this)); + + mSaveBtn = getChild("save_btn"); + mSaveBtn->setClickedCallback(boost::bind(&LLSidepanelItemInfo::onSaveButtonClicked, this)); + + mCancelBtn = getChild("cancel_btn"); + mCancelBtn->setClickedCallback(boost::bind(&LLSidepanelItemInfo::onCancelButtonClicked, this)); + + // build the UI + // item name & description + childSetPrevalidate("LabelItemName",&LLLineEditor::prevalidatePrintableNotPipe); + //getChild("LabelItemName")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitName,this)); + childSetPrevalidate("LabelItemDesc",&LLLineEditor::prevalidatePrintableNotPipe); + //getChild("LabelItemDesc")->setCommitCallback(boost::bind(&LLSidepanelItemInfo:: onCommitDescription, this)); + + // Creator information + getChild("BtnCreator")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onClickCreator,this)); + + // owner information + getChild("BtnOwner")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onClickOwner,this)); + + // acquired date + // owner permissions + // Permissions debug text + // group permissions + // getChild("CheckShareWithGroup")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this)); + + // everyone permissions + // getChild("CheckEveryoneCopy")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this)); + + // next owner permissions + // getChild("CheckNextOwnerModify")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this)); + // getChild("CheckNextOwnerCopy")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this)); + // getChild("CheckNextOwnerTransfer")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitPermissions, this)); + + // Mark for sale or not, and sale info + // getChild("CheckPurchase")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this)); + // getChild("RadioSaleType")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleType, this)); + + // "Price" label for edit + // getChild("Edit Cost")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitSaleInfo, this)); + + // The UI has been built, now fill in all the values + refresh(); + + return TRUE; +} + +void LLSidepanelItemInfo::setVisible(BOOL visible) +{ + if (visible) + { + mDirty = TRUE; + } + LLPanel::setVisible(visible); +} + +void LLSidepanelItemInfo::setObjectID(const LLUUID& object_id) +{ + mObjectID = object_id; +} + +void LLSidepanelItemInfo::setItemID(const LLUUID& item_id) +{ + mItemID = item_id; +} + +void LLSidepanelItemInfo::setEditMode(BOOL edit) +{ + mEditMode = edit; + mDirty = TRUE; +} + +void LLSidepanelItemInfo::reset() +{ + mObjectID = LLUUID::null; + mItemID = LLUUID::null; + mDirty = TRUE; +} + +void LLSidepanelItemInfo::refresh() +{ + LLInventoryItem* item = findItem(); + if(item) + { + refreshFromItem(item); + updateVerbs(); + } + + if (!mEditMode || !item) + { + //RN: it is possible that the container object is in the middle of an inventory refresh + // causing findItem() to fail, so just temporarily disable everything + + mDirty = TRUE; + + const std::string no_item_names[]={ + "LabelItemName", + "LabelItemDesc", + "LabelCreatorName", + "LabelOwnerName", + "CheckOwnerModify", + "CheckOwnerCopy", + "CheckOwnerTransfer", + "CheckShareWithGroup", + "CheckEveryoneCopy", + "CheckNextOwnerModify", + "CheckNextOwnerCopy", + "CheckNextOwnerTransfer", + "CheckPurchase", + "RadioSaleType", + "Edit Cost" + }; + + for(size_t t=0; tisComplete(); + const BOOL cannot_restrict_permissions = LLInventoryType::cannotRestrictPermissions(i->getInventoryType()); + const BOOL is_calling_card = (i->getInventoryType() == LLInventoryType::IT_CALLINGCARD); + const LLPermissions& perm = item->getPermissions(); + const BOOL can_agent_manipulate = gAgent.allowOperation(PERM_OWNER, perm, + GP_OBJECT_MANIPULATE); + const BOOL can_agent_sell = gAgent.allowOperation(PERM_OWNER, perm, + GP_OBJECT_SET_SALE) && + !cannot_restrict_permissions; + const BOOL is_link = i->getIsLinkType(); + + // You need permission to modify the object to modify an inventory + // item in it. + LLViewerObject* object = NULL; + if(!mObjectID.isNull()) object = gObjectList.findObject(mObjectID); + BOOL is_obj_modify = TRUE; + if(object) + { + is_obj_modify = object->permOwnerModify(); + } + + ////////////////////// + // ITEM NAME & DESC // + ////////////////////// + BOOL is_modifiable = gAgent.allowOperation(PERM_MODIFY, perm, + GP_OBJECT_MANIPULATE) + && is_obj_modify && is_complete; + + childSetEnabled("LabelItemNameTitle",TRUE); + childSetEnabled("LabelItemName",is_modifiable && !is_calling_card); // for now, don't allow rename of calling cards + childSetText("LabelItemName",item->getName()); + childSetEnabled("LabelItemDescTitle",TRUE); + childSetEnabled("LabelItemDesc",is_modifiable); + childSetVisible("IconLocked",!is_modifiable); + childSetText("LabelItemDesc",item->getDescription()); + + ////////////////// + // CREATOR NAME // + ////////////////// + if(!gCacheName) return; + if(!gAgent.getRegion()) return; + + if (item->getCreatorUUID().notNull()) + { + std::string name; + gCacheName->getFullName(item->getCreatorUUID(), name); + childSetEnabled("BtnCreator",TRUE); + childSetEnabled("LabelCreatorTitle",TRUE); + childSetEnabled("LabelCreatorName",TRUE); + childSetText("LabelCreatorName",name); + } + else + { + childSetEnabled("BtnCreator",FALSE); + childSetEnabled("LabelCreatorTitle",FALSE); + childSetEnabled("LabelCreatorName",FALSE); + childSetText("LabelCreatorName",getString("unknown")); + } + + //////////////// + // OWNER NAME // + //////////////// + if(perm.isOwned()) + { + std::string name; + if (perm.isGroupOwned()) + { + gCacheName->getGroupName(perm.getGroup(), name); + } + else + { + gCacheName->getFullName(perm.getOwner(), name); + } + childSetEnabled("BtnOwner",TRUE); + childSetEnabled("LabelOwnerTitle",TRUE); + childSetEnabled("LabelOwnerName",TRUE); + childSetText("LabelOwnerName",name); + } + else + { + childSetEnabled("BtnOwner",FALSE); + childSetEnabled("LabelOwnerTitle",FALSE); + childSetEnabled("LabelOwnerName",FALSE); + childSetText("LabelOwnerName",getString("public")); + } + + ////////////////// + // ACQUIRE DATE // + ////////////////// + + time_t time_utc = item->getCreationDate(); + if (0 == time_utc) + { + childSetText("LabelAcquiredDate",getString("unknown")); + } + else + { + std::string timeStr = getString("acquiredDate"); + LLSD substitution; + substitution["datetime"] = (S32) time_utc; + LLStringUtil::format (timeStr, substitution); + childSetText ("LabelAcquiredDate", timeStr); + } + + /////////////////////// + // OWNER PERMISSIONS // + /////////////////////// + if(can_agent_manipulate) + { + childSetText("OwnerLabel",getString("you_can")); + } + else + { + childSetText("OwnerLabel",getString("owner_can")); + } + + U32 base_mask = perm.getMaskBase(); + U32 owner_mask = perm.getMaskOwner(); + U32 group_mask = perm.getMaskGroup(); + U32 everyone_mask = perm.getMaskEveryone(); + U32 next_owner_mask = perm.getMaskNextOwner(); + + childSetEnabled("OwnerLabel",TRUE); + childSetEnabled("CheckOwnerModify",FALSE); + childSetValue("CheckOwnerModify",LLSD((BOOL)(owner_mask & PERM_MODIFY))); + childSetEnabled("CheckOwnerCopy",FALSE); + childSetValue("CheckOwnerCopy",LLSD((BOOL)(owner_mask & PERM_COPY))); + childSetEnabled("CheckOwnerTransfer",FALSE); + childSetValue("CheckOwnerTransfer",LLSD((BOOL)(owner_mask & PERM_TRANSFER))); + + /////////////////////// + // DEBUG PERMISSIONS // + /////////////////////// + + if( gSavedSettings.getBOOL("DebugPermissions") ) + { + BOOL slam_perm = FALSE; + BOOL overwrite_group = FALSE; + BOOL overwrite_everyone = FALSE; + + if (item->getType() == LLAssetType::AT_OBJECT) + { + U32 flags = item->getFlags(); + slam_perm = flags & LLInventoryItem::II_FLAGS_OBJECT_SLAM_PERM; + overwrite_everyone = flags & LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE; + overwrite_group = flags & LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; + } + + std::string perm_string; + + perm_string = "B: "; + perm_string += mask_to_string(base_mask); + childSetText("BaseMaskDebug",perm_string); + childSetVisible("BaseMaskDebug",TRUE); + + perm_string = "O: "; + perm_string += mask_to_string(owner_mask); + childSetText("OwnerMaskDebug",perm_string); + childSetVisible("OwnerMaskDebug",TRUE); + + perm_string = "G"; + perm_string += overwrite_group ? "*: " : ": "; + perm_string += mask_to_string(group_mask); + childSetText("GroupMaskDebug",perm_string); + childSetVisible("GroupMaskDebug",TRUE); + + perm_string = "E"; + perm_string += overwrite_everyone ? "*: " : ": "; + perm_string += mask_to_string(everyone_mask); + childSetText("EveryoneMaskDebug",perm_string); + childSetVisible("EveryoneMaskDebug",TRUE); + + perm_string = "N"; + perm_string += slam_perm ? "*: " : ": "; + perm_string += mask_to_string(next_owner_mask); + childSetText("NextMaskDebug",perm_string); + childSetVisible("NextMaskDebug",TRUE); + } + else + { + childSetVisible("BaseMaskDebug",FALSE); + childSetVisible("OwnerMaskDebug",FALSE); + childSetVisible("GroupMaskDebug",FALSE); + childSetVisible("EveryoneMaskDebug",FALSE); + childSetVisible("NextMaskDebug",FALSE); + } + + ///////////// + // SHARING // + ///////////// + + // Check for ability to change values. + if (is_link || cannot_restrict_permissions) + { + childSetEnabled("CheckShareWithGroup",FALSE); + childSetEnabled("CheckEveryoneCopy",FALSE); + } + else if (is_obj_modify && can_agent_manipulate) + { + childSetEnabled("CheckShareWithGroup",TRUE); + childSetEnabled("CheckEveryoneCopy",(owner_mask & PERM_COPY) && (owner_mask & PERM_TRANSFER)); + } + else + { + childSetEnabled("CheckShareWithGroup",FALSE); + childSetEnabled("CheckEveryoneCopy",FALSE); + } + + // Set values. + BOOL is_group_copy = (group_mask & PERM_COPY) ? TRUE : FALSE; + BOOL is_group_modify = (group_mask & PERM_MODIFY) ? TRUE : FALSE; + BOOL is_group_move = (group_mask & PERM_MOVE) ? TRUE : FALSE; + + if (is_group_copy && is_group_modify && is_group_move) + { + childSetValue("CheckShareWithGroup",LLSD((BOOL)TRUE)); + + LLCheckBoxCtrl* ctl = getChild("CheckShareWithGroup"); + if(ctl) + { + ctl->setTentative(FALSE); + } + } + else if (!is_group_copy && !is_group_modify && !is_group_move) + { + childSetValue("CheckShareWithGroup",LLSD((BOOL)FALSE)); + LLCheckBoxCtrl* ctl = getChild("CheckShareWithGroup"); + if(ctl) + { + ctl->setTentative(FALSE); + } + } + else + { + LLCheckBoxCtrl* ctl = getChild("CheckShareWithGroup"); + if(ctl) + { + ctl->setTentative(TRUE); + ctl->set(TRUE); + } + } + + childSetValue("CheckEveryoneCopy",LLSD((BOOL)(everyone_mask & PERM_COPY))); + + /////////////// + // SALE INFO // + /////////////// + + const LLSaleInfo& sale_info = item->getSaleInfo(); + BOOL is_for_sale = sale_info.isForSale(); + // Check for ability to change values. + if (is_obj_modify && can_agent_sell + && gAgent.allowOperation(PERM_TRANSFER, perm, GP_OBJECT_MANIPULATE)) + { + childSetEnabled("SaleLabel",is_complete); + childSetEnabled("CheckPurchase",is_complete); + + childSetEnabled("NextOwnerLabel",TRUE); + childSetEnabled("CheckNextOwnerModify",(base_mask & PERM_MODIFY) && !cannot_restrict_permissions); + childSetEnabled("CheckNextOwnerCopy",(base_mask & PERM_COPY) && !cannot_restrict_permissions); + childSetEnabled("CheckNextOwnerTransfer",(next_owner_mask & PERM_COPY) && !cannot_restrict_permissions); + + childSetEnabled("RadioSaleType",is_complete && is_for_sale); + childSetEnabled("TextPrice",is_complete && is_for_sale); + childSetEnabled("Edit Cost",is_complete && is_for_sale); + } + else + { + childSetEnabled("SaleLabel",FALSE); + childSetEnabled("CheckPurchase",FALSE); + + childSetEnabled("NextOwnerLabel",FALSE); + childSetEnabled("CheckNextOwnerModify",FALSE); + childSetEnabled("CheckNextOwnerCopy",FALSE); + childSetEnabled("CheckNextOwnerTransfer",FALSE); + + childSetEnabled("RadioSaleType",FALSE); + childSetEnabled("TextPrice",FALSE); + childSetEnabled("Edit Cost",FALSE); + } + + // Set values. + childSetValue("CheckPurchase", is_for_sale); + childSetEnabled("combobox sale copy", is_for_sale); + childSetEnabled("Edit Cost", is_for_sale); + childSetValue("CheckNextOwnerModify",LLSD(BOOL(next_owner_mask & PERM_MODIFY))); + childSetValue("CheckNextOwnerCopy",LLSD(BOOL(next_owner_mask & PERM_COPY))); + childSetValue("CheckNextOwnerTransfer",LLSD(BOOL(next_owner_mask & PERM_TRANSFER))); + + LLRadioGroup* radioSaleType = getChild("RadioSaleType"); + if (is_for_sale) + { + radioSaleType->setSelectedIndex((S32)sale_info.getSaleType() - 1); + S32 numerical_price; + numerical_price = sale_info.getSalePrice(); + childSetText("Edit Cost",llformat("%d",numerical_price)); + } + else + { + radioSaleType->setSelectedIndex(-1); + childSetText("Edit Cost",llformat("%d",0)); + } +} + +void LLSidepanelItemInfo::onClickCreator() +{ + LLInventoryItem* item = findItem(); + if(!item) return; + if(!item->getCreatorUUID().isNull()) + { + LLAvatarActions::showProfile(item->getCreatorUUID()); + } +} + +// static +void LLSidepanelItemInfo::onClickOwner() +{ + LLInventoryItem* item = findItem(); + if(!item) return; + if(item->getPermissions().isGroupOwned()) + { + LLGroupActions::show(item->getPermissions().getGroup()); + } + else + { + LLAvatarActions::showProfile(item->getPermissions().getOwner()); + } +} + +// static +void LLSidepanelItemInfo::onCommitName() +{ + //llinfos << "LLSidepanelItemInfo::onCommitName()" << llendl; + LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); + if(!item) + { + return; + } + LLLineEditor* labelItemName = getChild("LabelItemName"); + + if(labelItemName&& + (item->getName() != labelItemName->getText()) && + (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE)) ) + { + LLPointer new_item = new LLViewerInventoryItem(item); + new_item->rename(labelItemName->getText()); + if(mObjectID.isNull()) + { + new_item->updateServer(FALSE); + gInventory.updateItem(new_item); + gInventory.notifyObservers(); + } + else + { + LLViewerObject* object = gObjectList.findObject(mObjectID); + if(object) + { + object->updateInventory( + new_item, + TASK_INVENTORY_ITEM_KEY, + false); + } + } + } +} + +void LLSidepanelItemInfo::onCommitDescription() +{ + //llinfos << "LLSidepanelItemInfo::onCommitDescription()" << llendl; + LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); + if(!item) return; + + LLLineEditor* labelItemDesc = getChild("LabelItemDesc"); + if(!labelItemDesc) + { + return; + } + if((item->getDescription() != labelItemDesc->getText()) && + (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE))) + { + LLPointer new_item = new LLViewerInventoryItem(item); + + new_item->setDescription(labelItemDesc->getText()); + if(mObjectID.isNull()) + { + new_item->updateServer(FALSE); + gInventory.updateItem(new_item); + gInventory.notifyObservers(); + } + else + { + LLViewerObject* object = gObjectList.findObject(mObjectID); + if(object) + { + object->updateInventory( + new_item, + TASK_INVENTORY_ITEM_KEY, + false); + } + } + } +} + +// static +void LLSidepanelItemInfo::onCommitPermissions() +{ + //llinfos << "LLSidepanelItemInfo::onCommitPermissions()" << llendl; + LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); + if(!item) return; + LLPermissions perm(item->getPermissions()); + + + LLCheckBoxCtrl* CheckShareWithGroup = getChild("CheckShareWithGroup"); + + if(CheckShareWithGroup) + { + perm.setGroupBits(gAgent.getID(), gAgent.getGroupID(), + CheckShareWithGroup->get(), + PERM_MODIFY | PERM_MOVE | PERM_COPY); + } + LLCheckBoxCtrl* CheckEveryoneCopy = getChild("CheckEveryoneCopy"); + if(CheckEveryoneCopy) + { + perm.setEveryoneBits(gAgent.getID(), gAgent.getGroupID(), + CheckEveryoneCopy->get(), PERM_COPY); + } + + LLCheckBoxCtrl* CheckNextOwnerModify = getChild("CheckNextOwnerModify"); + if(CheckNextOwnerModify) + { + perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(), + CheckNextOwnerModify->get(), PERM_MODIFY); + } + LLCheckBoxCtrl* CheckNextOwnerCopy = getChild("CheckNextOwnerCopy"); + if(CheckNextOwnerCopy) + { + perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(), + CheckNextOwnerCopy->get(), PERM_COPY); + } + LLCheckBoxCtrl* CheckNextOwnerTransfer = getChild("CheckNextOwnerTransfer"); + if(CheckNextOwnerTransfer) + { + perm.setNextOwnerBits(gAgent.getID(), gAgent.getGroupID(), + CheckNextOwnerTransfer->get(), PERM_TRANSFER); + } + if(perm != item->getPermissions() + && item->isComplete()) + { + LLPointer new_item = new LLViewerInventoryItem(item); + new_item->setPermissions(perm); + U32 flags = new_item->getFlags(); + // If next owner permissions have changed (and this is an object) + // then set the slam permissions flag so that they are applied on rez. + if((perm.getMaskNextOwner()!=item->getPermissions().getMaskNextOwner()) + && (item->getType() == LLAssetType::AT_OBJECT)) + { + flags |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_PERM; + } + // If everyone permissions have changed (and this is an object) + // then set the overwrite everyone permissions flag so they + // are applied on rez. + if ((perm.getMaskEveryone()!=item->getPermissions().getMaskEveryone()) + && (item->getType() == LLAssetType::AT_OBJECT)) + { + flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE; + } + // If group permissions have changed (and this is an object) + // then set the overwrite group permissions flag so they + // are applied on rez. + if ((perm.getMaskGroup()!=item->getPermissions().getMaskGroup()) + && (item->getType() == LLAssetType::AT_OBJECT)) + { + flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; + } + new_item->setFlags(flags); + if(mObjectID.isNull()) + { + new_item->updateServer(FALSE); + gInventory.updateItem(new_item); + gInventory.notifyObservers(); + } + else + { + LLViewerObject* object = gObjectList.findObject(mObjectID); + if(object) + { + object->updateInventory( + new_item, + TASK_INVENTORY_ITEM_KEY, + false); + } + } + } + else + { + // need to make sure we don't just follow the click + refresh(); + } +} + +// static +void LLSidepanelItemInfo::onCommitSaleInfo() +{ + //llinfos << "LLSidepanelItemInfo::onCommitSaleInfo()" << llendl; + updateSaleInfo(); +} + +// static +void LLSidepanelItemInfo::onCommitSaleType() +{ + //llinfos << "LLSidepanelItemInfo::onCommitSaleType()" << llendl; + updateSaleInfo(); +} + +void LLSidepanelItemInfo::updateSaleInfo() +{ + LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); + if(!item) return; + LLSaleInfo sale_info(item->getSaleInfo()); + if(!gAgent.allowOperation(PERM_TRANSFER, item->getPermissions(), GP_OBJECT_SET_SALE)) + { + childSetValue("CheckPurchase",LLSD((BOOL)FALSE)); + } + + if((BOOL)childGetValue("CheckPurchase")) + { + // turn on sale info + LLSaleInfo::EForSale sale_type = LLSaleInfo::FS_COPY; + + LLRadioGroup* RadioSaleType = getChild("RadioSaleType"); + if(RadioSaleType) + { + switch (RadioSaleType->getSelectedIndex()) + { + case 0: + sale_type = LLSaleInfo::FS_ORIGINAL; + break; + case 1: + sale_type = LLSaleInfo::FS_COPY; + break; + case 2: + sale_type = LLSaleInfo::FS_CONTENTS; + break; + default: + sale_type = LLSaleInfo::FS_COPY; + break; + } + } + + if (sale_type == LLSaleInfo::FS_COPY + && !gAgent.allowOperation(PERM_COPY, item->getPermissions(), + GP_OBJECT_SET_SALE)) + { + sale_type = LLSaleInfo::FS_ORIGINAL; + } + + + + S32 price = -1; + price = getChild("Edit Cost")->getValue().asInteger();; + + // Invalid data - turn off the sale + if (price < 0) + { + sale_type = LLSaleInfo::FS_NOT; + price = 0; + } + + sale_info.setSaleType(sale_type); + sale_info.setSalePrice(price); + } + else + { + sale_info.setSaleType(LLSaleInfo::FS_NOT); + } + if(sale_info != item->getSaleInfo() + && item->isComplete()) + { + LLPointer new_item = new LLViewerInventoryItem(item); + + // Force an update on the sale price at rez + if (item->getType() == LLAssetType::AT_OBJECT) + { + U32 flags = new_item->getFlags(); + flags |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_SALE; + new_item->setFlags(flags); + } + + new_item->setSaleInfo(sale_info); + if(mObjectID.isNull()) + { + // This is in the agent's inventory. + new_item->updateServer(FALSE); + gInventory.updateItem(new_item); + gInventory.notifyObservers(); + } + else + { + // This is in an object's contents. + LLViewerObject* object = gObjectList.findObject(mObjectID); + if(object) + { + object->updateInventory( + new_item, + TASK_INVENTORY_ITEM_KEY, + false); + } + } + } + else + { + // need to make sure we don't just follow the click + refresh(); + } +} + +LLInventoryItem* LLSidepanelItemInfo::findItem() const +{ + LLInventoryItem* item = NULL; + if(mObjectID.isNull()) + { + // it is in agent inventory + item = gInventory.getItem(mItemID); + } + else + { + LLViewerObject* object = gObjectList.findObject(mObjectID); + if(object) + { + item = (LLInventoryItem*)object->getInventoryObject(mItemID); + } + } + return item; +} + +void LLSidepanelItemInfo::updateVerbs() +{ + mEditBtn->setVisible(!mEditMode); + mSaveBtn->setVisible(mEditMode); + mCancelBtn->setVisible(mEditMode); + + const LLViewerInventoryItem* item = (LLViewerInventoryItem*)findItem(); + if (item) + { + const LLPermissions& perm = item->getPermissions(); + BOOL is_modifiable = gAgent.allowOperation(PERM_MODIFY, perm, + GP_OBJECT_MANIPULATE); + mEditBtn->setEnabled(is_modifiable); + } +} + +void LLSidepanelItemInfo::onEditButtonClicked() +{ + setEditMode(TRUE); + refresh(); + updateVerbs(); +} + +void LLSidepanelItemInfo::onSaveButtonClicked() +{ + onCommitName(); + onCommitDescription(); + onCommitPermissions(); + onCommitSaleInfo(); + onCommitSaleType(); + + setEditMode(FALSE); + refresh(); + updateVerbs(); +} + +void LLSidepanelItemInfo::onCancelButtonClicked() +{ + setEditMode(FALSE); + refresh(); + updateVerbs(); +} diff --git a/indra/newview/llsidepaneliteminfo.h b/indra/newview/llsidepaneliteminfo.h new file mode 100644 index 0000000000..21ca63894c --- /dev/null +++ b/indra/newview/llsidepaneliteminfo.h @@ -0,0 +1,107 @@ +/** + * @file llsidepaneliteminfo.h + * @brief A panel which shows an inventory item's properties. + * + * $LicenseInfo:firstyear=2002&license=viewergpl$ + * + * Copyright (c) 2002-2009, Linden Research, Inc. + * + * 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 + * + * 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 + * + * 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. + * + * 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$ + */ + +#ifndef LL_LLSIDEPANELITEMINFO_H +#define LL_LLSIDEPANELITEMINFO_H + +#include +#include "llmultifloater.h" +#include "lliconctrl.h" + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLSidepanelItemInfo +// Object properties for inventory side panel. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +class LLButton; +class LLInventoryItem; +class LLItemPropertiesObserver; + +class LLSidepanelItemInfo : public LLPanel +{ +public: + LLSidepanelItemInfo(); + virtual ~LLSidepanelItemInfo(); + + /*virtual*/ BOOL postBuild(); + /*virtual*/ void setVisible(BOOL visible); + /*virtual*/ void draw(); + + void setObjectID(const LLUUID& object_id); + void setItemID(const LLUUID& item_id); + void setEditMode(BOOL edit); + + void reset(); + void dirty(); + +protected: + LLInventoryItem* findItem() const; + void refresh(); + void refreshFromItem(LLInventoryItem* item); + void updateVerbs(); + +private: + // The item id of the inventory item in question. + LLUUID mItemID; + + // mObjectID will have a value if it is associated with a task in + // the world, and will be == LLUUID::null if it's in the agent + // inventory. + LLUUID mObjectID; + + BOOL mDirty; + BOOL mEditMode; + + LLItemPropertiesObserver* mPropertiesObserver; + + // + // UI Elements + // +protected: + void onEditButtonClicked(); + void onSaveButtonClicked(); + void onCancelButtonClicked(); + void onClickCreator(); + void onClickOwner(); + void onCommitName(); + void onCommitDescription(); + void onCommitPermissions(); + void onCommitSaleInfo(); + void onCommitSaleType(); + void updateSaleInfo(); +private: + LLButton* mEditBtn; + LLButton* mSaveBtn; + LLButton* mCancelBtn; +}; + +#endif // LL_LLSIDEPANELITEMINFO_H diff --git a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml index d0c3cdfafc..0b4a0e1e24 100644 --- a/indra/newview/skins/default/xui/en/sidepanel_inventory.xml +++ b/indra/newview/skins/default/xui/en/sidepanel_inventory.xml @@ -1,122 +1,122 @@ - - - - - - + + + - - - Date: Fri, 6 Nov 2009 16:11:42 -0500 Subject: Changed "Support" tab to "Info". http://jira.secondlife.com/browse/EXT-2177 --- indra/newview/skins/default/xui/en/floater_about.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml index c74b1929b4..2ff99dcf5a 100644 --- a/indra/newview/skins/default/xui/en/floater_about.xml +++ b/indra/newview/skins/default/xui/en/floater_about.xml @@ -69,7 +69,7 @@ Packets Lost: [PACKETS_LOST,number,0]/[PACKETS_IN,number,0] ([PACKETS_PCT,number tab_position="top"> Date: Fri, 6 Nov 2009 16:30:35 -0500 Subject: Changed llwarns on spurious InventoryPanel::buildNewViews debug mesage to lldebugs. --HG-- branch : avatar-pipeline --- indra/newview/llinventorypanel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 36d9455fa2..f13651f7f9 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -457,8 +457,8 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id) if (objectp->getType() <= LLAssetType::AT_NONE || objectp->getType() >= LLAssetType::AT_COUNT) { - llwarns << "LLInventoryPanel::buildNewViews called with invalid objectp->mType : " << - ((S32) objectp->getType()) << llendl; + lldebugs << "LLInventoryPanel::buildNewViews called with invalid objectp->mType : " << + ((S32) objectp->getType()) << " name " << objectp->getName() << " UUID " << objectp->getUUID() << llendl; return; } -- cgit v1.2.3 From 0b3bbf8cfc2b3c2afcb9cc79a8c74677d8645b92 Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 6 Nov 2009 13:51:16 -0800 Subject: EXT-1501 Menu fonts now configurable in XUI, set size to SansSerifSmall --- indra/llui/llmenugl.cpp | 23 ++++++++++++++++++++++ indra/llui/llmenugl.h | 21 +------------------- .../skins/default/xui/en/widgets/menu_item.xml | 6 ++++++ 3 files changed, 30 insertions(+), 20 deletions(-) create mode 100644 indra/newview/skins/default/xui/en/widgets/menu_item.xml (limited to 'indra') diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 956e843987..c6a38c7ca7 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -118,6 +118,7 @@ const F32 PIE_SHRINK_TIME = 0.2f; // time of transition between unbounded and bo const F32 ACTIVATE_HIGHLIGHT_TIME = 0.3f; +static MenuRegistry::Register register_menu_item("menu_item"); static MenuRegistry::Register register_separator("menu_item_separator"); static MenuRegistry::Register register_menu_item_call("menu_item_call"); static MenuRegistry::Register register_menu_item_check("menu_item_check"); @@ -132,6 +133,28 @@ static LLDefaultChildRegistry::Register register_menu_default("menu"); ///============================================================================ /// Class LLMenuItemGL ///============================================================================ + +LLMenuItemGL::Params::Params() +: shortcut("shortcut"), + jump_key("jump_key", KEY_NONE), + use_mac_ctrl("use_mac_ctrl", false), + rect("rect"), + left("left"), + top("top"), + right("right"), + bottom("bottom"), + width("width"), + height("height"), + bottom_delta("bottom_delta"), + left_delta("left_delta"), + enabled_color("enabled_color"), + disabled_color("disabled_color"), + highlight_bg_color("highlight_bg_color"), + highlight_fg_color("highlight_fg_color") +{ + mouse_opaque = true; +} + // Default constructor LLMenuItemGL::LLMenuItemGL(const LLMenuItemGL::Params& p) : LLUICtrl(p), diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index 09d9e407c7..dc8ed3b3fd 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -79,26 +79,7 @@ public: highlight_fg_color; - Params() - : shortcut("shortcut"), - jump_key("jump_key", KEY_NONE), - use_mac_ctrl("use_mac_ctrl", false), - rect("rect"), - left("left"), - top("top"), - right("right"), - bottom("bottom"), - width("width"), - height("height"), - bottom_delta("bottom_delta"), - left_delta("left_delta"), - enabled_color("enabled_color"), - disabled_color("disabled_color"), - highlight_bg_color("highlight_bg_color"), - highlight_fg_color("highlight_fg_color") - { - mouse_opaque = true; - } + Params(); }; protected: diff --git a/indra/newview/skins/default/xui/en/widgets/menu_item.xml b/indra/newview/skins/default/xui/en/widgets/menu_item.xml new file mode 100644 index 0000000000..c98e9cb6b8 --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/menu_item.xml @@ -0,0 +1,6 @@ + + + + -- cgit v1.2.3 From 2aa981ac23bbdf2fd609e04434179be0cfec79ce Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Fri, 6 Nov 2009 17:35:05 -0500 Subject: EXT-2278 : "Save Texture As" for bottom panel EXT-2310 : "Save Texture As" for inventory right-click menu "Save Texture As" now works properly and brings up the texture preview while saving. Also added "Save Texture As" to the right-click inventory context menu. --HG-- branch : avatar-pipeline --- indra/newview/llinventorybridge.cpp | 45 ++++++++++++++++++- indra/newview/llinventorybridge.h | 2 + indra/newview/llpanellandmarks.cpp | 2 +- indra/newview/llpanellandmarks.h | 2 +- indra/newview/llpanelmaininventory.cpp | 51 +++------------------- indra/newview/llpreviewtexture.cpp | 24 ++++++++-- indra/newview/llpreviewtexture.h | 12 ++--- .../skins/default/xui/en/menu_inventory.xml | 10 +++++ 8 files changed, 92 insertions(+), 56 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index f46bbbe188..9c7be2fcf5 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3086,6 +3086,49 @@ void LLTextureBridge::openItem() } } +void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags) +{ + lldebugs << "LLTextureBridge::buildContextMenu()" << llendl; + std::vector items; + std::vector disabled_items; + if(isInTrash()) + { + items.push_back(std::string("Purge Item")); + if (!isItemRemovable()) + { + disabled_items.push_back(std::string("Purge Item")); + } + + items.push_back(std::string("Restore Item")); + } + else + { + items.push_back(std::string("Open")); + items.push_back(std::string("Properties")); + + getClipboardEntries(true, items, disabled_items, flags); + + items.push_back(std::string("Texture Separator")); + items.push_back(std::string("Save As")); + } + hide_context_entries(menu, items, disabled_items); +} + +// virtual +void LLTextureBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) +{ + if ("save_as" == action) + { + LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES); + LLPreviewTexture* preview_texture = LLFloaterReg::findTypedInstance("preview_texture", mUUID); + if (preview_texture) + { + preview_texture->openToSave(); + } + } + else LLItemBridge::performAction(folder, model, action); +} + // +=================================================+ // | LLSoundBridge | // +=================================================+ @@ -3134,7 +3177,7 @@ void LLSoundBridge::openSoundPreview(void* which) void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { - lldebugs << "LLTextureBridge::buildContextMenu()" << llendl; + lldebugs << "LLSoundBridge::buildContextMenu()" << llendl; std::vector items; std::vector disabled_items; diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index 3f3513a665..cce06813b7 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -383,6 +383,8 @@ class LLTextureBridge : public LLItemBridge public: virtual LLUIImagePtr getIcon() const; virtual void openItem(); + virtual void buildContextMenu(LLMenuGL& menu, U32 flags); + virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action); protected: LLTextureBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLInventoryType::EType type) : diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 91e1590dc3..cb5f471837 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -265,7 +265,7 @@ LLLandmark* LLLandmarksPanel::getCurSelectedLandmark() const return NULL; } -LLFolderViewItem* LLLandmarksPanel::getCurSelectedItem () const +LLFolderViewItem* LLLandmarksPanel::getCurSelectedItem() const { return mCurrentSelectedList ? mCurrentSelectedList->getRootFolder()->getCurSelectedItem() : NULL; } diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h index 0e7abb4865..6498f2c778 100644 --- a/indra/newview/llpanellandmarks.h +++ b/indra/newview/llpanellandmarks.h @@ -69,7 +69,7 @@ protected: bool isLandmarkSelected() const; bool isReceivedFolderSelected() const; LLLandmark* getCurSelectedLandmark() const; - LLFolderViewItem* getCurSelectedItem () const; + LLFolderViewItem* getCurSelectedItem() const; void updateSortOrder(LLInventoryPanel* panel, bool byDate); //LLRemoteParcelInfoObserver interface diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index bdfff9b2ab..f4c88b9f82 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -41,6 +41,7 @@ #include "llinventorypanel.h" #include "llfiltereditor.h" #include "llfloaterreg.h" +#include "llpreviewtexture.h" #include "llscrollcontainer.h" #include "llsdserialize.h" #include "llspinctrl.h" @@ -965,18 +966,11 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata) } const LLUUID& item_id = current_item->getListener()->getUUID(); - LLFilePicker& file_picker = LLFilePicker::instance(); - const LLInventoryItem* item = gInventory.getItem(item_id); - if( !file_picker.getSaveFile( LLFilePicker::FFSAVE_TGA, item ? LLDir::getScrubbedFileName(item->getName()) : LLStringUtil::null) ) + LLPreviewTexture* preview_texture = LLFloaterReg::showTypedInstance("preview_texture", LLSD(item_id), TAKE_FOCUS_YES); + if (preview_texture) { - // User canceled or we failed to acquire save file. - return; + preview_texture->openToSave(); } - // remember the user-approved/edited file name. - const LLUUID& asset_id = item->getAssetUUID(); - LLPointer image = LLViewerTextureManager::getFetchedTexture(asset_id, MIPMAP_TRUE, FALSE, LLViewerTexture::LOD_TEXTURE); - image->setLoadedCallback( on_file_loaded_for_save, - 0, TRUE, FALSE, new std::string(file_picker.getFirstFile()) ); } } @@ -1002,6 +996,7 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) } return can_delete; } + return FALSE; } if (command_name == "save_texture") { @@ -1010,8 +1005,9 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata) { return (current_item->getListener()->getInventoryType() == LLInventoryType::IT_TEXTURE); } + return FALSE; } - return FALSE; + return TRUE; } bool LLPanelMainInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept) @@ -1027,36 +1023,3 @@ bool LLPanelMainInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropType } return true; } - -void on_file_loaded_for_save(BOOL success, - LLViewerFetchedTexture *src_vi, - LLImageRaw* src, - LLImageRaw* aux_src, - S32 discard_level, - BOOL final, - void* userdata) -{ - std::string *filename = (std::string*) userdata; - - if (final && success) - { - LLPointer image_tga = new LLImageTGA; - if( !image_tga->encode( src ) ) - { - LLSD args; - args["FILE"] = *filename; - LLNotifications::instance().add("CannotEncodeFile", args); - } - else if( !image_tga->save( *filename ) ) - { - LLSD args; - args["FILE"] = *filename; - LLNotifications::instance().add("CannotWriteFile", args); - } - } - - if(!success ) - { - LLNotifications::instance().add("CannotDownloadFile"); - } -} diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 9c21faa3be..6324b0adf9 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -48,6 +48,7 @@ #include "lltextbox.h" #include "lltextureview.h" #include "llui.h" +#include "llviewerinventory.h" #include "llviewertexture.h" #include "llviewertexturelist.h" #include "lluictrlfactory.h" @@ -63,7 +64,7 @@ const F32 PREVIEW_TEXTURE_MIN_ASPECT = 0.005f; LLPreviewTexture::LLPreviewTexture(const LLSD& key) - : LLPreview( key ), + : LLPreview(key), mLoadingFullImage( FALSE ), mShowKeepDiscard(FALSE), mCopyToInv(FALSE), @@ -71,7 +72,8 @@ LLPreviewTexture::LLPreviewTexture(const LLSD& key) mUpdateDimensions(TRUE), mLastHeight(0), mLastWidth(0), - mAspectRatio(0.f) + mAspectRatio(0.f), + mPreviewToSave(FALSE) { const LLInventoryItem *item = getItem(); if(item) @@ -104,6 +106,10 @@ LLPreviewTexture::LLPreviewTexture(const LLSD& key) mIsCopyable = TRUE; } + if (key.has("save_as")) + { + mPreviewToSave = TRUE; + } //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_texture.xml", FALSE); } @@ -181,6 +187,12 @@ void LLPreviewTexture::draw() if ( mImage.notNull() ) { + // Automatically bring up SaveAs dialog if we opened this to save the texture. + if (mPreviewToSave) + { + mPreviewToSave = FALSE; + saveAs(); + } // Draw the texture glColor3f( 1.f, 1.f, 1.f ); gl_draw_scaled_image(interior.mLeft, @@ -209,7 +221,7 @@ void LLPreviewTexture::draw() if( mLoadingFullImage ) { - LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("Receiving:"), 0, + LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("Receiving"), 0, interior.mLeft + 4, interior.mBottom + 4, LLColor4::white, LLFontGL::LEFT, LLFontGL::BOTTOM, @@ -304,6 +316,11 @@ void LLPreviewTexture::onFocusReceived() LLPreview::onFocusReceived(); } +void LLPreviewTexture::openToSave() +{ + mPreviewToSave = TRUE; +} + // static void LLPreviewTexture::onFileLoadedForSave(BOOL success, LLViewerFetchedTexture *src_vi, @@ -356,6 +373,7 @@ void LLPreviewTexture::onFileLoadedForSave(BOOL success, { LLNotifications::instance().add("CannotDownloadFile"); } + } diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h index 520626b49f..9b3c91d831 100644 --- a/indra/newview/llpreviewtexture.h +++ b/indra/newview/llpreviewtexture.h @@ -67,8 +67,7 @@ public: S32 discard_level, BOOL final, void* userdata ); - - + void openToSave(); protected: void init(); /* virtual */ BOOL postBuild(); @@ -77,14 +76,17 @@ protected: private: void updateDimensions(); - LLUUID mImageID; + LLUUID mImageID; LLPointer mImage; BOOL mLoadingFullImage; std::string mSaveFileName; LLFrameTimer mSavedFileTimer; BOOL mShowKeepDiscard; BOOL mCopyToInv; - + + // Save the image once it's loaded. + BOOL mPreviewToSave; + // This is stored off in a member variable, because the save-as // button and drag and drop functionality need to know. BOOL mIsCopyable; @@ -94,6 +96,4 @@ private: F32 mAspectRatio; BOOL mUpdateDimensions; }; - - #endif // LL_LLPREVIEWTEXTURE_H diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml index 62940b87dc..8b6ab4e4d8 100644 --- a/indra/newview/skins/default/xui/en/menu_inventory.xml +++ b/indra/newview/skins/default/xui/en/menu_inventory.xml @@ -550,6 +550,16 @@ function="Inventory.DoToSelected" parameter="deactivate" /> + + + + Date: Fri, 6 Nov 2009 14:36:16 -0800 Subject: DEV-42272 - viewer crash on startup in LLCurlRequest::process --- indra/llcommon/llqueuedthread.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/llqueuedthread.cpp b/indra/llcommon/llqueuedthread.cpp index 395d298887..e7ad571a90 100644 --- a/indra/llcommon/llqueuedthread.cpp +++ b/indra/llcommon/llqueuedthread.cpp @@ -113,8 +113,11 @@ S32 LLQueuedThread::update(U32 max_time_ms) { if (!mStarted) { - startThread(); - mStarted = TRUE; + if (!mThreaded) + { + startThread(); + mStarted = TRUE; + } } return updateQueue(max_time_ms); } -- cgit v1.2.3 From 3fa1e785a6964d672682b9e5c3fcbdda0fa1f8df Mon Sep 17 00:00:00 2001 From: Leyla Farazha Date: Fri, 6 Nov 2009 15:16:40 -0800 Subject: EXT-1576 "Zoom In" menu option should be disabled when the person is not in range EXT-2306 Default voice input/output pref panel to closed --- indra/newview/llfloatervoicedevicesettings.cpp | 3 +++ indra/newview/llinspectavatar.cpp | 9 +++++++++ .../skins/default/xui/en/menu_inspect_avatar_gear.xml | 2 ++ .../skins/default/xui/en/panel_preferences_sound.xml | 13 ------------- 4 files changed, 14 insertions(+), 13 deletions(-) (limited to 'indra') diff --git a/indra/newview/llfloatervoicedevicesettings.cpp b/indra/newview/llfloatervoicedevicesettings.cpp index bbeb287171..43024a4bd0 100644 --- a/indra/newview/llfloatervoicedevicesettings.cpp +++ b/indra/newview/llfloatervoicedevicesettings.cpp @@ -95,6 +95,9 @@ void LLPanelVoiceDeviceSettings::handleVisibilityChange ( BOOL new_visibility ) else { cleanup(); + // when closing this window, turn of visiblity control so that + // next time preferences is opened we don't suspend voice + gSavedSettings.setBOOL("ShowDeviceSettings", FALSE); } } void LLPanelVoiceDeviceSettings::draw() diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index bfad2b1624..0329e740af 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -47,6 +47,7 @@ #include "llstartup.h" #include "llviewermenu.h" #include "llvoiceclient.h" +#include "llviewerobjectlist.h" // Linden libraries #include "llfloater.h" @@ -113,6 +114,7 @@ private: void onClickFindOnMap(); bool onVisibleFindOnMap(); bool onVisibleFreezeEject(); + bool onVisibleZoomIn(); void onClickMuteVolume(); void onVolumeChange(const LLSD& data); @@ -203,6 +205,8 @@ LLInspectAvatar::LLInspectAvatar(const LLSD& sd) mVisibleCallbackRegistrar.add("InspectAvatar.VisibleFindOnMap", boost::bind(&LLInspectAvatar::onVisibleFindOnMap, this)); mVisibleCallbackRegistrar.add("InspectAvatar.VisibleFreezeEject", boost::bind(&LLInspectAvatar::onVisibleFreezeEject, this)); + mVisibleCallbackRegistrar.add("InspectAvatar.VisibleZoomIn", + boost::bind(&LLInspectAvatar::onVisibleZoomIn, this)); // can't make the properties request until the widgets are constructed // as it might return immediately, so do it in postBuild. @@ -464,6 +468,11 @@ bool LLInspectAvatar::onVisibleFreezeEject() return enable_freeze_eject( LLSD(mAvatarID) ); } +bool LLInspectAvatar::onVisibleZoomIn() +{ + return gObjectList.findObject(mAvatarID); +} + void LLInspectAvatar::onClickIM() { LLAvatarActions::startIM(mAvatarID); diff --git a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml index 6049476a43..db2c9ea0fb 100644 --- a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml @@ -101,6 +101,8 @@ name="zoom_in"> + - -