summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorypanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventorypanel.cpp')
-rw-r--r--indra/newview/llinventorypanel.cpp57
1 files changed, 21 insertions, 36 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 173e5c6ae6..c4f810fc93 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"
@@ -1071,10 +1072,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>("my_inventory");
+ if (!sidepanel_inventory || !sidepanel_inventory->isInVisibleChain()) return FALSE;
+ return sidepanel_inventory->isMainInventoryPanelActive();
}
// static
@@ -1084,34 +1084,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_my_inventory = LLFloaterReg::getInstance("my_inventory");
+ if (!floater_my_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>("my_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_my_inventory);
+ active_inv_floaterp = floater_my_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)
@@ -1141,14 +1131,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_my_inventory->openFloater();
+ return sidepanel_inventory->getActivePanel();
return NULL;
}