summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/CMakeLists.txt4
-rw-r--r--indra/newview/llpanellandmarks.cpp30
-rw-r--r--indra/newview/llpanellandmarks.h24
-rw-r--r--indra/newview/llplacesinventorypanel.cpp191
-rw-r--r--indra/newview/llplacesinventorypanel.h96
-rw-r--r--indra/newview/skins/default/xui/en/panel_landmarks.xml8
6 files changed, 320 insertions, 33 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 7d8e9268e5..a26aae3590 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -258,7 +258,6 @@ set(viewer_SOURCE_FILES
llinventorymodel.cpp
llinventoryobserver.cpp
llinventorypanel.cpp
- llinventorysubtreepanel.cpp
lljoystickbutton.cpp
lllandmarkactions.cpp
lllandmarklist.cpp
@@ -354,6 +353,7 @@ set(viewer_SOURCE_FILES
llparticipantlist.cpp
llpatchvertexarray.cpp
llplacesinventorybridge.cpp
+ llplacesinventorypanel.cpp
llpolymesh.cpp
llpolymorph.cpp
llpreview.cpp
@@ -766,7 +766,6 @@ set(viewer_HEADER_FILES
llinventorymodel.h
llinventoryobserver.h
llinventorypanel.h
- llinventorysubtreepanel.h
lljoystickbutton.h
lllandmarkactions.h
lllandmarklist.h
@@ -858,6 +857,7 @@ set(viewer_HEADER_FILES
llparticipantlist.h
llpatchvertexarray.h
llplacesinventorybridge.h
+ llplacesinventorypanel.h
llpolymesh.h
llpolymorph.h
llpreview.h
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 716a914306..d75744ead9 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -49,9 +49,9 @@
#include "llfloaterworldmap.h"
#include "llfolderviewitem.h"
#include "llinventorypanel.h"
-#include "llinventorysubtreepanel.h"
#include "lllandmarkactions.h"
#include "llplacesinventorybridge.h"
+#include "llplacesinventorypanel.h"
#include "llsidetray.h"
#include "llviewermenu.h"
#include "llviewerregion.h"
@@ -66,8 +66,8 @@ static const std::string TRASH_BUTTON_NAME = "trash_btn";
// helper functions
-static void filter_list(LLInventorySubTreePanel* inventory_list, const std::string& string);
-static bool category_has_descendents(LLInventorySubTreePanel* inventory_list);
+static void filter_list(LLPlacesInventoryPanel* inventory_list, const std::string& string);
+static bool category_has_descendents(LLPlacesInventoryPanel* inventory_list);
/**
* Bridge to support knowing when the inventory has changed to update Landmarks tab
@@ -150,7 +150,7 @@ void LLLandmarksPanel::onSearchEdit(const std::string& string)
tab->changeOpenClose(false);
}
- LLInventorySubTreePanel* inventory_list = dynamic_cast<LLInventorySubTreePanel*>(tab->getAccordionView());
+ LLPlacesInventoryPanel* inventory_list = dynamic_cast<LLPlacesInventoryPanel*>(tab->getAccordionView());
if (NULL == inventory_list) continue;
if (inventory_list->getFilter())
@@ -218,7 +218,7 @@ void LLLandmarksPanel::updateVerbs()
updateListCommands();
}
-void LLLandmarksPanel::onSelectionChange(LLInventorySubTreePanel* inventory_list, const std::deque<LLFolderViewItem*> &items, BOOL user_action)
+void LLLandmarksPanel::onSelectionChange(LLPlacesInventoryPanel* inventory_list, const std::deque<LLFolderViewItem*> &items, BOOL user_action)
{
if (user_action && (items.size() > 0))
{
@@ -362,7 +362,7 @@ void LLLandmarksPanel::setErrorStatus(U32 status, const std::string& reason)
void LLLandmarksPanel::initFavoritesInventoryPanel()
{
- mFavoritesInventoryPanel = getChild<LLInventorySubTreePanel>("favorites_list");
+ mFavoritesInventoryPanel = getChild<LLPlacesInventoryPanel>("favorites_list");
initLandmarksPanel(mFavoritesInventoryPanel);
mFavoritesInventoryPanel->getFilter()->setEmptyLookupMessage("FavoritesNoMatchingItems");
@@ -372,7 +372,7 @@ void LLLandmarksPanel::initFavoritesInventoryPanel()
void LLLandmarksPanel::initLandmarksInventoryPanel()
{
- mLandmarksInventoryPanel = getChild<LLInventorySubTreePanel>("landmarks_list");
+ mLandmarksInventoryPanel = getChild<LLPlacesInventoryPanel>("landmarks_list");
initLandmarksPanel(mLandmarksInventoryPanel);
@@ -391,7 +391,7 @@ void LLLandmarksPanel::initLandmarksInventoryPanel()
void LLLandmarksPanel::initMyInventoryPanel()
{
- mMyInventoryPanel= getChild<LLInventorySubTreePanel>("my_inventory_list");
+ mMyInventoryPanel= getChild<LLPlacesInventoryPanel>("my_inventory_list");
initLandmarksPanel(mMyInventoryPanel);
@@ -400,14 +400,14 @@ void LLLandmarksPanel::initMyInventoryPanel()
void LLLandmarksPanel::initLibraryInventoryPanel()
{
- mLibraryInventoryPanel = getChild<LLInventorySubTreePanel>("library_list");
+ mLibraryInventoryPanel = getChild<LLPlacesInventoryPanel>("library_list");
initLandmarksPanel(mLibraryInventoryPanel);
initAccordion("tab_library", mLibraryInventoryPanel);
}
-void LLLandmarksPanel::initLandmarksPanel(LLInventorySubTreePanel* inventory_list)
+void LLLandmarksPanel::initLandmarksPanel(LLPlacesInventoryPanel* inventory_list)
{
// In case of a dummy widget further we have no Folder View widget and no Filter,
// so further initialization leads to crash.
@@ -431,7 +431,7 @@ void LLLandmarksPanel::initLandmarksPanel(LLInventorySubTreePanel* inventory_lis
inventory_list->saveFolderState();
}
-void LLLandmarksPanel::initAccordion(const std::string& accordion_tab_name, LLInventorySubTreePanel* inventory_list)
+void LLLandmarksPanel::initAccordion(const std::string& accordion_tab_name, LLPlacesInventoryPanel* inventory_list)
{
LLAccordionCtrlTab* accordion_tab = getChild<LLAccordionCtrlTab>(accordion_tab_name);
@@ -441,7 +441,7 @@ void LLLandmarksPanel::initAccordion(const std::string& accordion_tab_name, LLIn
accordion_tab->setDisplayChildren(false);
}
-void LLLandmarksPanel::onAccordionExpandedCollapsed(const LLSD& param, LLInventorySubTreePanel* inventory_list)
+void LLLandmarksPanel::onAccordionExpandedCollapsed(const LLSD& param, LLPlacesInventoryPanel* inventory_list)
{
bool expanded = param.asBoolean();
@@ -467,7 +467,7 @@ void LLLandmarksPanel::onAccordionExpandedCollapsed(const LLSD& param, LLInvento
}
}
-void LLLandmarksPanel::deselectOtherThan(const LLInventorySubTreePanel* inventory_list)
+void LLLandmarksPanel::deselectOtherThan(const LLPlacesInventoryPanel* inventory_list)
{
if (inventory_list != mFavoritesInventoryPanel)
{
@@ -987,7 +987,7 @@ void LLLandmarksPanel::doCreatePick(LLLandmark* landmark)
//////////////////////////////////////////////////////////////////////////
// HELPER FUNCTIONS
//////////////////////////////////////////////////////////////////////////
-static void filter_list(LLInventorySubTreePanel* inventory_list, const std::string& string)
+static void filter_list(LLPlacesInventoryPanel* inventory_list, const std::string& string)
{
// When search is cleared, restore the old folder state.
if (!inventory_list->getRootFolder()->getFilterSubString().empty() && string == "")
@@ -1017,7 +1017,7 @@ static void filter_list(LLInventorySubTreePanel* inventory_list, const std::stri
inventory_list->setFilterSubString(string);
}
-static bool category_has_descendents(LLInventorySubTreePanel* inventory_list)
+static bool category_has_descendents(LLPlacesInventoryPanel* inventory_list)
{
LLViewerInventoryCategory* category = gInventory.getCategory(inventory_list->getStartFolderID());
if (category)
diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h
index 9b02f73afa..569739237d 100644
--- a/indra/newview/llpanellandmarks.h
+++ b/indra/newview/llpanellandmarks.h
@@ -46,7 +46,7 @@ class LLAccordionCtrlTab;
class LLFolderViewItem;
class LLMenuGL;
class LLInventoryPanel;
-class LLInventorySubTreePanel;
+class LLPlacesInventoryPanel;
class LLLandmarksPanel : public LLPanelPlacesTab, LLRemoteParcelInfoObserver
{
@@ -60,9 +60,9 @@ public:
/*virtual*/ void onTeleport();
/*virtual*/ void updateVerbs();
- void onSelectionChange(LLInventorySubTreePanel* inventory_list, const std::deque<LLFolderViewItem*> &items, BOOL user_action);
+ void onSelectionChange(LLPlacesInventoryPanel* inventory_list, const std::deque<LLFolderViewItem*> &items, BOOL user_action);
void onSelectorButtonClicked();
- void setCurrentSelectedList(LLInventorySubTreePanel* inventory_list)
+ void setCurrentSelectedList(LLPlacesInventoryPanel* inventory_list)
{
mCurrentSelectedList = inventory_list;
}
@@ -93,10 +93,10 @@ private:
void initLandmarksInventoryPanel();
void initMyInventoryPanel();
void initLibraryInventoryPanel();
- void initLandmarksPanel(LLInventorySubTreePanel* inventory_list);
- void initAccordion(const std::string& accordion_tab_name, LLInventorySubTreePanel* inventory_list);
- void onAccordionExpandedCollapsed(const LLSD& param, LLInventorySubTreePanel* inventory_list);
- void deselectOtherThan(const LLInventorySubTreePanel* inventory_list);
+ void initLandmarksPanel(LLPlacesInventoryPanel* inventory_list);
+ void initAccordion(const std::string& accordion_tab_name, LLPlacesInventoryPanel* inventory_list);
+ void onAccordionExpandedCollapsed(const LLSD& param, LLPlacesInventoryPanel* inventory_list);
+ void deselectOtherThan(const LLPlacesInventoryPanel* inventory_list);
// List Commands Handlers
void initListCommandsHandlers();
@@ -137,14 +137,14 @@ private:
void doCreatePick(LLLandmark* landmark);
private:
- LLInventorySubTreePanel* mFavoritesInventoryPanel;
- LLInventorySubTreePanel* mLandmarksInventoryPanel;
- LLInventorySubTreePanel* mMyInventoryPanel;
- LLInventorySubTreePanel* mLibraryInventoryPanel;
+ LLPlacesInventoryPanel* mFavoritesInventoryPanel;
+ LLPlacesInventoryPanel* mLandmarksInventoryPanel;
+ LLPlacesInventoryPanel* mMyInventoryPanel;
+ LLPlacesInventoryPanel* mLibraryInventoryPanel;
LLMenuGL* mGearLandmarkMenu;
LLMenuGL* mGearFolderMenu;
LLMenuGL* mMenuAdd;
- LLInventorySubTreePanel* mCurrentSelectedList;
+ LLPlacesInventoryPanel* mCurrentSelectedList;
LLInventoryObserver* mInventoryObserver;
LLPanel* mListCommands;
diff --git a/indra/newview/llplacesinventorypanel.cpp b/indra/newview/llplacesinventorypanel.cpp
new file mode 100644
index 0000000000..4de953a59d
--- /dev/null
+++ b/indra/newview/llplacesinventorypanel.cpp
@@ -0,0 +1,191 @@
+/**
+ * @file llplacesinventorypanel.cpp
+ * @brief LLPlacesInventoryPanel class definition
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 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 "llscrollcontainer.h"
+
+#include "llplacesinventorypanel.h"
+
+#include "llfoldervieweventlistener.h"
+#include "llinventorybridge.h"
+#include "llinventoryfunctions.h"
+#include "llpanellandmarks.h"
+#include "llplacesinventorybridge.h"
+
+static LLDefaultChildRegistry::Register<LLPlacesInventoryPanel> r("places_inventory_panel");
+
+static const LLPlacesInventoryBridgeBuilder PLACES_INVENTORY_BUILDER;
+
+LLPlacesInventoryPanel::LLPlacesInventoryPanel(const Params& p) :
+ LLInventoryPanel(p),
+ mSavedFolderState(NULL)
+
+{
+ mInvFVBridgeBuilder = &PLACES_INVENTORY_BUILDER;
+ mSavedFolderState = new LLSaveFolderState();
+ mSavedFolderState->setApply(FALSE);
+}
+
+
+LLPlacesInventoryPanel::~LLPlacesInventoryPanel()
+{
+ delete mSavedFolderState;
+}
+
+BOOL LLPlacesInventoryPanel::postBuild()
+{
+ LLInventoryPanel::postBuild();
+
+ // clear Contents();
+ {
+ mFolders->destroyView();
+ mFolders->getParent()->removeChild(mFolders);
+ mFolders->die();
+
+ if( mScroller )
+ {
+ removeChild( mScroller );
+ mScroller->die();
+ mScroller = NULL;
+ }
+ mFolders = NULL;
+ }
+
+
+ mCommitCallbackRegistrar.pushScope(); // registered as a widget; need to push callback scope ourselves
+
+ // create root folder
+ {
+ LLRect folder_rect(0,
+ 0,
+ getRect().getWidth(),
+ 0);
+ LLPlacesFolderView::Params p;
+ p.name = getName();
+ p.rect = folder_rect;
+ p.parent_panel = this;
+ mFolders = (LLFolderView*)LLUICtrlFactory::create<LLPlacesFolderView>(p);
+ mFolders->setAllowMultiSelect(mAllowMultiSelect);
+ }
+
+ mCommitCallbackRegistrar.popScope();
+
+ mFolders->setCallbackRegistrar(&mCommitCallbackRegistrar);
+
+ // scroller
+ {
+ LLRect scroller_view_rect = getRect();
+ scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom);
+ LLScrollContainer::Params p;
+ p.name("Inventory Scroller");
+ p.rect(scroller_view_rect);
+ p.follows.flags(FOLLOWS_ALL);
+ p.reserve_scroll_corner(true);
+ p.tab_stop(true);
+ mScroller = LLUICtrlFactory::create<LLScrollContainer>(p);
+ }
+ addChild(mScroller);
+ mScroller->addChild(mFolders);
+
+ mFolders->setScrollContainer(mScroller);
+
+
+ // cut subitems
+ mFolders->setUseEllipses(true);
+
+ return TRUE;
+}
+
+// save current folder open state
+void LLPlacesInventoryPanel::saveFolderState()
+{
+ mSavedFolderState->setApply(FALSE);
+ getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+}
+
+// re-open folders which state was saved
+void LLPlacesInventoryPanel::restoreFolderState()
+{
+ mSavedFolderState->setApply(TRUE);
+ getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+ LLOpenFoldersWithSelection opener;
+ getRootFolder()->applyFunctorRecursively(opener);
+ getRootFolder()->scrollToShowSelection();
+}
+
+/************************************************************************/
+/* PROTECTED METHODS */
+/************************************************************************/
+
+
+
+/************************************************************************/
+/* LLPlacesFolderView implementation */
+/************************************************************************/
+
+//////////////////////////////////////////////////////////////////////////
+// PUBLIC METHODS
+//////////////////////////////////////////////////////////////////////////
+
+BOOL LLPlacesFolderView::handleRightMouseDown(S32 x, S32 y, MASK mask)
+{
+ // let children to change selection first
+ childrenHandleRightMouseDown(x, y, mask);
+ mParentLandmarksPanel->setCurrentSelectedList((LLPlacesInventoryPanel*)getParentPanel());
+
+ // then determine its type and set necessary menu handle
+ if (getCurSelectedItem())
+ {
+ LLInventoryType::EType inventory_type = getCurSelectedItem()->getListener()->getInventoryType();
+ inventory_type_menu_handle_t::iterator it_handle = mMenuHandlesByInventoryType.find(inventory_type);
+
+ if (it_handle != mMenuHandlesByInventoryType.end())
+ {
+ mPopupMenuHandle = (*it_handle).second;
+ }
+ else
+ {
+ llwarns << "Requested menu handle for non-setup inventory type: " << inventory_type << llendl;
+ }
+
+ }
+
+ return LLFolderView::handleRightMouseDown(x, y, mask);
+}
+
+void LLPlacesFolderView::setupMenuHandle(LLInventoryType::EType asset_type, LLHandle<LLView> menu_handle)
+{
+ mMenuHandlesByInventoryType[asset_type] = menu_handle;
+}
+
+// EOF
diff --git a/indra/newview/llplacesinventorypanel.h b/indra/newview/llplacesinventorypanel.h
new file mode 100644
index 0000000000..7b34045d32
--- /dev/null
+++ b/indra/newview/llplacesinventorypanel.h
@@ -0,0 +1,96 @@
+/**
+ * @file llplacesinventorypanel.h
+ * @brief LLPlacesInventoryPanel class declaration
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ *
+ * Copyright (c) 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_LLINVENTORYSUBTREEPANEL_H
+#define LL_LLINVENTORYSUBTREEPANEL_H
+
+#include "llfloaterinventory.h"
+#include "llinventorypanel.h"
+#include "llfolderview.h"
+
+class LLLandmarksPanel;
+
+class LLPlacesInventoryPanel : public LLInventoryPanel
+{
+public:
+ struct Params
+ : public LLInitParam::Block<Params, LLInventoryPanel::Params>
+ {
+ Params()
+ {}
+ };
+
+ LLPlacesInventoryPanel(const Params& p);
+ ~LLPlacesInventoryPanel();
+
+ /*virtual*/ BOOL postBuild();
+
+ void saveFolderState();
+ void restoreFolderState();
+
+private:
+ LLSaveFolderState* mSavedFolderState;
+};
+
+
+class LLPlacesFolderView : public LLFolderView
+{
+public:
+ LLPlacesFolderView(const LLFolderView::Params& p) : LLFolderView(p) {};
+ /**
+ * Handles right mouse down
+ *
+ * Contains workaround for EXT-2786: sets current selected list for landmark
+ * panel using @c mParentLandmarksPanel which is set in @c LLLandmarksPanel::initLandmarksPanel
+ */
+ /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
+
+ void setupMenuHandle(LLInventoryType::EType asset_type, LLHandle<LLView> menu_handle);
+
+ void setParentLandmarksPanel(LLLandmarksPanel* panel)
+ {
+ mParentLandmarksPanel = panel;
+ }
+
+ S32 getSelectedCount() { return (S32)mSelectedItems.size(); }
+
+private:
+ /**
+ * holds pointer to landmark panel. This pointer is used in @c LLPlacesFolderView::handleRightMouseDown
+ */
+ LLLandmarksPanel* mParentLandmarksPanel;
+ typedef std::map<LLInventoryType::EType, LLHandle<LLView> > inventory_type_menu_handle_t;
+ inventory_type_menu_handle_t mMenuHandlesByInventoryType;
+
+};
+
+#endif //LL_LLINVENTORYSUBTREEPANEL_H
diff --git a/indra/newview/skins/default/xui/en/panel_landmarks.xml b/indra/newview/skins/default/xui/en/panel_landmarks.xml
index 1f211c0fed..c899dcb750 100644
--- a/indra/newview/skins/default/xui/en/panel_landmarks.xml
+++ b/indra/newview/skins/default/xui/en/panel_landmarks.xml
@@ -23,7 +23,7 @@
layout="topleft"
name="tab_favorites"
title="Favorites bar">
- <inventory_subtree_panel
+ <places_inventory_panel
allow_multi_select="true"
border="true"
bottom="0"
@@ -39,7 +39,7 @@
layout="topleft"
name="tab_landmarks"
title="Landmarks">
- <inventory_subtree_panel
+ <places_inventory_panel
allow_multi_select="true"
border="true"
bottom="0"
@@ -55,7 +55,7 @@
layout="topleft"
name="tab_inventory"
title="My Inventory">
- <inventory_subtree_panel
+ <places_inventory_panel
allow_multi_select="true"
border="true"
bottom="0"
@@ -71,7 +71,7 @@
layout="topleft"
name="tab_library"
title="Library">
- <inventory_subtree_panel
+ <places_inventory_panel
allow_multi_select="true"
border="true"
bottom="0"