diff options
author | Loren Shih <seraph@lindenlab.com> | 2009-12-01 21:12:34 -0500 |
---|---|---|
committer | Loren Shih <seraph@lindenlab.com> | 2009-12-01 21:12:34 -0500 |
commit | 8fdd2e0b28121ead88da55c2be760a5f62b6d112 (patch) | |
tree | 326812c75067e8555096d79b207bde8ec397907d | |
parent | f62ea011ea5e99de16bd3bb761ea9203815ce0e6 (diff) |
EXT-3028 : "Find Original" does nothing if floater inventory isn't open
Changed logic for getActiveInventory so that it considers InventorySP.
Removed getActiveInventory and replaced with getActiveInventoryPanel since that follows its current usage.
This currently contains a bug because the InventorySP always thinks it's open.
--HG--
branch : avatar-pipeline
-rw-r--r-- | indra/newview/llagentwearables.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llassetuploadresponders.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llfloaterinventory.cpp | 22 | ||||
-rw-r--r-- | indra/newview/llfloaterinventory.h | 5 | ||||
-rw-r--r-- | indra/newview/llfloateropenobject.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llinventorymodel.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 23 | ||||
-rw-r--r-- | indra/newview/llsidepanelinventory.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llsidepanelinventory.h | 3 | ||||
-rw-r--r-- | indra/newview/lltoolbar.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 72 |
13 files changed, 97 insertions, 107 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index b52b58f9e2..15983ee78a 100644 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -37,7 +37,6 @@ #include "llcallbacklist.h" #include "llfloatercustomize.h" -#include "llfloaterinventory.h" #include "llinventorybridge.h" #include "llinventoryobserver.h" #include "llinventorypanel.h" @@ -1361,10 +1360,10 @@ void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index) // Open the inventory and select the first item we added. if (first_item_id.notNull()) { - LLFloaterInventory* view = LLFloaterInventory::getActiveInventory(); - if (view) + LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); + if (active_panel) { - view->getPanel()->setSelection(first_item_id, TAKE_FOCUS_NO); + active_panel->setSelection(first_item_id, TAKE_FOCUS_NO); } } } diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index d5f9f7ca5d..1d03cc8823 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -42,7 +42,6 @@ #include "llnotify.h" #include "llinventoryobserver.h" #include "llinventorypanel.h" -#include "llfloaterinventory.h" #include "llpermissionsflags.h" #include "llpreviewnotecard.h" #include "llpreviewscript.h" @@ -287,19 +286,18 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content) // Show the preview panel for textures and sounds to let // user know that the image (or snapshot) arrived intact. - LLFloaterInventory* view = LLFloaterInventory::getActiveInventory(); - if(view) + LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); + if (active_panel) { - LLFocusableElement* focus = gFocusMgr.getKeyboardFocus(); - - view->getPanel()->setSelection(content["new_inventory_item"].asUUID(), TAKE_FOCUS_NO); + active_panel->setSelection(content["new_inventory_item"].asUUID(), TAKE_FOCUS_NO); if((LLAssetType::AT_TEXTURE == asset_type || LLAssetType::AT_SOUND == asset_type) && LLFilePicker::instance().getFileCount() <= FILE_COUNT_DISPLAY_THRESHOLD) { - view->getPanel()->openSelected(); + active_panel->openSelected(); } //LLFloaterInventory::dumpSelectionInformation((void*)view); // restore keyboard focus + LLFocusableElement* focus = gFocusMgr.getKeyboardFocus(); gFocusMgr.setKeyboardFocus(focus); } } diff --git a/indra/newview/llfloaterinventory.cpp b/indra/newview/llfloaterinventory.cpp index 4a2e1913cd..76c0a7637c 100644 --- a/indra/newview/llfloaterinventory.cpp +++ b/indra/newview/llfloaterinventory.cpp @@ -120,28 +120,6 @@ LLFloaterInventory* LLFloaterInventory::showAgentInventory() } // static -LLFloaterInventory* LLFloaterInventory::getActiveInventory() -{ - LLFloaterInventory* res = NULL; - LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory"); - S32 z_min = S32_MAX; - for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter) - { - LLFloaterInventory* iv = dynamic_cast<LLFloaterInventory*>(*iter); - if (iv) - { - S32 z_order = gFloaterView->getZOrder(iv); - if (z_order < z_min) - { - res = iv; - z_min = z_order; - } - } - } - return res; -} - -// static void LLFloaterInventory::cleanup() { LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory"); diff --git a/indra/newview/llfloaterinventory.h b/indra/newview/llfloaterinventory.h index c0de89bff2..b661c391a7 100644 --- a/indra/newview/llfloaterinventory.h +++ b/indra/newview/llfloaterinventory.h @@ -55,11 +55,6 @@ public: BOOL postBuild(); - // Return the active inventory view if there is one. Active is - // defined as the inventory that is the closest to the front, and - // is visible. - static LLFloaterInventory* getActiveInventory(); - // This method makes sure that an inventory view exists, is // visible, and has focus. The view chosen is returned. static LLFloaterInventory* showAgentInventory(); diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp index 6caa0d60f9..56a86c2cb7 100644 --- a/indra/newview/llfloateropenobject.cpp +++ b/indra/newview/llfloateropenobject.cpp @@ -195,10 +195,10 @@ void LLFloaterOpenObject::callbackMoveInventory(S32 result, void* data) if (result == 0) { LLFloaterInventory::showAgentInventory(); - LLFloaterInventory* view = LLFloaterInventory::getActiveInventory(); - if (view) + LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); + if (active_panel) { - view->getPanel()->setSelection(cat->mCatID, TAKE_FOCUS_NO); + active_panel->setSelection(cat->mCatID, TAKE_FOCUS_NO); } } diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index ebb33ef454..9e5a831555 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -38,7 +38,6 @@ #include "llappearancemgr.h" #include "llavataractions.h" #include "llfloatercustomize.h" -#include "llfloaterinventory.h" #include "llfloateropenobject.h" #include "llfloaterreg.h" #include "llfloaterworldmap.h" @@ -1052,7 +1051,7 @@ void LLItemBridge::gotoItem(LLFolderView *folder) LLInventoryObject *obj = getInventoryObject(); if (obj && obj->getIsLinkType()) { - LLInventoryPanel* active_panel = LLFloaterInventory::getActiveInventory()->getPanel(); + LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); if (active_panel) { active_panel->setSelection(obj->getLinkedUUID(), TAKE_FOCUS_NO); @@ -2928,9 +2927,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item, // everything in the active window so that we don't follow // the selection to its new location (which is very // annoying). - if (LLFloaterInventory::getActiveInventory()) + LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); + if (active_panel) { - LLInventoryPanel* active_panel = LLFloaterInventory::getActiveInventory()->getPanel(); LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get()); if (active_panel && (panel != active_panel)) { diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 9f96ebc366..ea6dfb8e7a 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -36,10 +36,10 @@ #include "llagent.h" #include "llagentwearables.h" #include "llinventorypanel.h" -#include "llfloaterinventory.h" #include "llinventorybridge.h" #include "llinventoryfunctions.h" #include "llinventoryobserver.h" +#include "llinventorypanel.h" #include "llnotificationsutil.h" #include "llwindow.h" #include "llviewercontrol.h" @@ -3048,10 +3048,10 @@ void LLInventoryModel::processUpdateInventoryFolder(LLMessageSystem* msg, gInventory.notifyObservers(); // *HACK: Do the 'show' logic for a new item in the inventory. - LLFloaterInventory* view = LLFloaterInventory::getActiveInventory(); - if(view) + LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); + if (active_panel) { - view->getPanel()->setSelection(lastfolder->getUUID(), TAKE_FOCUS_NO); + active_panel->setSelection(lastfolder->getUUID(), TAKE_FOCUS_NO); } } diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index f633225dbf..0d75561f27 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -31,21 +31,22 @@ */ #include "llviewerprecompiledheaders.h" +#include "llinventorypanel.h" #include <utility> // for std::pair<> -#include "llinventorypanel.h" - #include "llagent.h" #include "llagentwearables.h" #include "llappearancemgr.h" #include "llfloaterinventory.h" #include "llfloaterreg.h" +#include "llimfloater.h" #include "llimview.h" #include "llinventorybridge.h" +#include "llsidepanelinventory.h" +#include "llsidetray.h" #include "llscrollcontainer.h" #include "llviewerfoldertype.h" -#include "llimfloater.h" #include "llvoavatarself.h" static LLDefaultChildRegistry::Register<LLInventoryPanel> r("inventory_panel"); @@ -841,12 +842,26 @@ void LLInventoryPanel::dumpSelectionInformation(void* user_data) LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel() { LLInventoryPanel* res = NULL; + + // If the inventorySP is opened and its main inventory view is active, use that. + LLSidepanelInventory *sidepanel_inventory = + dynamic_cast<LLSidepanelInventory*>(LLSideTray::getInstance()->getPanel("sidepanel_inventory")); + if (sidepanel_inventory) + { + res = sidepanel_inventory->getActivePanel(); + if (res) + { + return res; + } + } + + // Iterate through the inventory floaters and return whichever is on top. LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("inventory"); S32 z_min = S32_MAX; for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin(); iter != inst_list.end(); ++iter) { LLFloaterInventory* iv = dynamic_cast<LLFloaterInventory*>(*iter); - if (iv) + if (iv && iv->getVisible()) { S32 z_order = gFloaterView->getZOrder(iv); if (z_order < z_min) diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 824def3d92..9ab459080e 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -277,3 +277,16 @@ LLInventoryItem *LLSidepanelInventory::getSelectedItem() LLInventoryItem *item = gInventory.getItem(item_id); return item; } + +LLInventoryPanel *LLSidepanelInventory::getActivePanel() +{ + if (!getVisible()) + { + return NULL; + } + if (mInventoryPanel->getVisible()) + { + return mPanelMainInventory->getActivePanel(); + } + return NULL; +} diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h index 6aa9cc745f..c2ce3badb8 100644 --- a/indra/newview/llsidepanelinventory.h +++ b/indra/newview/llsidepanelinventory.h @@ -36,6 +36,7 @@ class LLFolderViewItem; class LLInventoryItem; +class LLInventoryPanel; class LLPanelMainInventory; class LLSidepanelItemInfo; class LLSidepanelTaskInfo; @@ -49,6 +50,8 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); + LLInventoryPanel* getActivePanel(); // Returns an active inventory panel, if any. + protected: // Tracks highlighted (selected) item in inventory panel. LLInventoryItem *getSelectedItem(); diff --git a/indra/newview/lltoolbar.cpp b/indra/newview/lltoolbar.cpp index 268a18d2a2..bf6d715c31 100644 --- a/indra/newview/lltoolbar.cpp +++ b/indra/newview/lltoolbar.cpp @@ -56,6 +56,7 @@ #include "llfloaterchatterbox.h" #include "llfloaterfriends.h" #include "llfloatersnapshot.h" +#include "llinventorypanel.h" #include "lltoolmgr.h" #include "llui.h" #include "llviewermenu.h" @@ -157,12 +158,11 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, LLButton* inventory_btn = getChild<LLButton>("inventory_btn"); if (!inventory_btn) return FALSE; - LLFloaterInventory* active_inventory = LLFloaterInventory::getActiveInventory(); - LLRect button_screen_rect; inventory_btn->localRectToScreen(inventory_btn->getRect(),&button_screen_rect); - - if(active_inventory && active_inventory->getVisible()) + + const LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); + if(active_panel) { mInventoryAutoOpen = FALSE; } @@ -170,8 +170,8 @@ BOOL LLToolBar::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, { if (mInventoryAutoOpen) { - if (!(active_inventory && active_inventory->getVisible()) && - mInventoryAutoOpenTimer.getElapsedTimeF32() > sInventoryAutoOpenTime) + if (!active_panel && + mInventoryAutoOpenTimer.getElapsedTimeF32() > sInventoryAutoOpenTime) { LLFloaterInventory::showAgentInventory(); } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 4307002980..0cedf3acd3 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -31,14 +31,16 @@ */ #include "llviewerprecompiledheaders.h" - #include "llviewermenu.h" +// TODO: Remove unnecessary headers. + // system library includes #include <iostream> #include <fstream> #include <sstream> + // linden library includes #include "llaudioengine.h" #include "llfloaterreg.h" @@ -141,7 +143,6 @@ #include "llimagetga.h" #include "llinventorybridge.h" #include "llinventorymodel.h" -#include "llfloaterinventory.h" #include "llkeyboard.h" #include "llpanellogin.h" #include "llpanelblockedlist.h" @@ -6962,16 +6963,15 @@ void handle_grab_texture(void* data) gInventory.updateItem(item); gInventory.notifyObservers(); - LLFloaterInventory* view = LLFloaterInventory::getActiveInventory(); - // Show the preview panel for textures to let // user know that the image is now in inventory. - if(view) + LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); + if(active_panel) { LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus(); - view->getPanel()->setSelection(item_id, TAKE_FOCUS_NO); - view->getPanel()->openSelected(); + active_panel->setSelection(item_id, TAKE_FOCUS_NO); + active_panel->openSelected(); //LLFloaterInventory::dumpSelectionInformation((void*)view); // restore keyboard focus gFocusMgr.setKeyboardFocus(focus_ctrl); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 9fc818e1ff..549be65c2d 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -31,9 +31,10 @@ */ #include "llviewerprecompiledheaders.h" - #include "llviewermessage.h" +// TODO: Remove unnecessary headers. + #include <deque> #include "llaudioengine.h" @@ -91,7 +92,6 @@ #include "llinventorymodel.h" #include "llinventoryobserver.h" #include "llinventorypanel.h" -#include "llfloaterinventory.h" #include "llmenugl.h" #include "llmoveview.h" #include "llmutelist.h" @@ -933,56 +933,46 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f //highlight item, if it's not in the trash or lost+found // Don't auto-open the inventory floater - LLFloaterInventory* view = NULL; if(gSavedSettings.getBOOL("ShowInInventory") && asset_type != LLAssetType::AT_CALLINGCARD && item->getInventoryType() != LLInventoryType::IT_ATTACHMENT && !from_name.empty()) { - view = LLFloaterInventory::showAgentInventory(); //TODO:this should be moved to the end of method after all the checks, //but first decide what to do with active inventory if any (EK) LLSD key; key["select"] = item->getUUID(); LLSideTray::getInstance()->showPanel("sidepanel_inventory", key); } - else - { - view = LLFloaterInventory::getActiveInventory(); - } - if(!view) + LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); + if(active_panel) { - return; - } - - //Trash Check - const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) - { - return; - } - const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); - //BOOL inventory_has_focus = gFocusMgr.childHasKeyboardFocus(view); - BOOL user_is_away = gAwayTimer.getStarted(); + //Trash Check + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id)) + { + return; + } + const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND); + //BOOL inventory_has_focus = gFocusMgr.childHasKeyboardFocus(view); + BOOL user_is_away = gAwayTimer.getStarted(); - // don't select lost and found items if the user is active - if (gInventory.isObjectDescendentOf(item->getUUID(), lost_and_found_id) - && !user_is_away) - { - return; - } + // don't select lost and found items if the user is active + if (gInventory.isObjectDescendentOf(item->getUUID(), lost_and_found_id) + && !user_is_away) + { + return; + } - //Not sure about this check. Could make it easy to miss incoming items. - //don't dick with highlight while the user is working - //if(inventory_has_focus && !user_is_away) - // break; - LL_DEBUGS("Messaging") << "Highlighting" << item->getUUID() << LL_ENDL; - //highlight item + //Not sure about this check. Could make it easy to miss incoming items. + //don't dick with highlight while the user is working + //if(inventory_has_focus && !user_is_away) + // break; + LL_DEBUGS("Messaging") << "Highlighting" << item->getUUID() << LL_ENDL; + //highlight item - if (view->getPanel()) - { LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus(); - view->getPanel()->setSelection(item->getUUID(), TAKE_FOCUS_NO); + active_panel->setSelection(item->getUUID(), TAKE_FOCUS_NO); gFocusMgr.setKeyboardFocus(focus_ctrl); } } @@ -4991,7 +4981,7 @@ void container_inventory_arrived(LLViewerObject* object, gAgent.changeCameraToDefault(); } - LLFloaterInventory* view = LLFloaterInventory::getActiveInventory(); + LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); if (inventory->size() > 2) { @@ -5029,9 +5019,9 @@ void container_inventory_arrived(LLViewerObject* object, } } gInventory.notifyObservers(); - if(view) + if(active_panel) { - view->getPanel()->setSelection(cat_id, TAKE_FOCUS_NO); + active_panel->setSelection(cat_id, TAKE_FOCUS_NO); } } else if (inventory->size() == 2) @@ -5065,9 +5055,9 @@ void container_inventory_arrived(LLViewerObject* object, new_item->updateServer(TRUE); gInventory.updateItem(new_item); gInventory.notifyObservers(); - if(view) + if(active_panel) { - view->getPanel()->setSelection(item_id, TAKE_FOCUS_NO); + active_panel->setSelection(item_id, TAKE_FOCUS_NO); } } |