summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorypanel.cpp
diff options
context:
space:
mode:
authorniel@nirvana-win7hp.planescape.home <niel@nirvana-win7hp.planescape.home>2011-10-26 01:42:26 +0100
committerniel@nirvana-win7hp.planescape.home <niel@nirvana-win7hp.planescape.home>2011-10-26 01:42:26 +0100
commit4fd9a53115bf85ffe17974323d5fa609e0df960c (patch)
tree7968008d0fa7c0347d637e1fb19add9d436b926d /indra/newview/llinventorypanel.cpp
parent42c166e451d362609d83fb17261f9e8f344e974d (diff)
parentb7a349f231977d5917b29faacca143a85d925576 (diff)
Merge STORM-959
Diffstat (limited to 'indra/newview/llinventorypanel.cpp')
-rw-r--r--indra/newview/llinventorypanel.cpp58
1 files changed, 21 insertions, 37 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 615d3aefde..18c3f76826 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -35,6 +35,7 @@
#include "llavataractions.h"
#include "llfloaterinventory.h"
#include "llfloaterreg.h"
+#include "llfloatersidepanelcontainer.h"
#include "llfolderview.h"
#include "llimfloater.h"
#include "llimview.h"
@@ -42,7 +43,6 @@
#include "llinventoryfunctions.h"
#include "llinventorymodelbackgroundfetch.h"
#include "llsidepanelinventory.h"
-#include "llsidetray.h"
#include "llviewerattachmenu.h"
#include "llviewerfoldertype.h"
#include "llvoavatarself.h"
@@ -1077,10 +1077,9 @@ void LLInventoryPanel::dumpSelectionInformation(void* user_data)
BOOL is_inventorysp_active()
{
- if (!LLSideTray::getInstance()->isPanelActive("sidepanel_inventory")) return FALSE;
- LLSidepanelInventory *inventorySP = dynamic_cast<LLSidepanelInventory *>(LLSideTray::getInstance()->getPanel("sidepanel_inventory"));
- if (!inventorySP) return FALSE;
- return inventorySP->isMainInventoryPanelActive();
+ LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+ if (!sidepanel_inventory || !sidepanel_inventory->isInVisibleChain()) return FALSE;
+ return sidepanel_inventory->isMainInventoryPanelActive();
}
// static
@@ -1090,34 +1089,24 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open)
LLInventoryPanel* res = NULL;
LLFloater* active_inv_floaterp = NULL;
- // A. If the inventory side panel is open, use that preferably.
- if (is_inventorysp_active())
+ LLFloater* floater_inventory = LLFloaterReg::getInstance("inventory");
+ if (!floater_inventory)
{
- LLSidepanelInventory *inventorySP = dynamic_cast<LLSidepanelInventory *>(LLSideTray::getInstance()->getPanel("sidepanel_inventory"));
- if (inventorySP)
- {
- return inventorySP->getActivePanel();
- }
+ llwarns << "Could not find My Inventory floater" << llendl;
+ return FALSE;
}
- // or if it is in floater undocked from sidetray get it and remember z order of floater to later compare it
- // with other inventory floaters order.
- else if (!LLSideTray::getInstance()->isTabAttached("sidebar_inventory"))
+
+ LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory");
+
+ // A. If the inventory side panel floater is open, use that preferably.
+ if (is_inventorysp_active())
{
- LLSidepanelInventory *inventorySP =
- dynamic_cast<LLSidepanelInventory *>(LLSideTray::getInstance()->getPanel("sidepanel_inventory"));
- LLFloater* inv_floater = LLFloaterReg::findInstance("side_bar_tab", LLSD("sidebar_inventory"));
- if (inventorySP && inv_floater)
- {
- res = inventorySP->getActivePanel();
- z_min = gFloaterView->getZOrder(inv_floater);
- active_inv_floaterp = inv_floater;
- }
- else
- {
- llwarns << "Inventory tab is detached from sidetray, but either panel or floater were not found!" << llendl;
- }
+ // Get the floater's z order to compare it to other inventory floaters' order later.
+ res = sidepanel_inventory->getActivePanel();
+ z_min = gFloaterView->getZOrder(floater_inventory);
+ active_inv_floaterp = floater_inventory;
}
-
+
// B. Iterate through the inventory floaters and return whichever is on top.
LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory");
for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter)
@@ -1147,14 +1136,9 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open)
// C. If no panels are open and we don't want to force open a panel, then just abort out.
if (!auto_open) return NULL;
- // D. Open the inventory side panel and use that.
- LLSD key;
- LLSidepanelInventory *sidepanel_inventory =
- dynamic_cast<LLSidepanelInventory *>(LLSideTray::getInstance()->showPanel("sidepanel_inventory", key));
- if (sidepanel_inventory)
- {
- return sidepanel_inventory->getActivePanel();
- }
+ // D. Open the inventory side panel floater and use that.
+ floater_inventory->openFloater();
+ return sidepanel_inventory->getActivePanel();
return NULL;
}