diff options
author | Mike Antipov <mantipov@productengine.com> | 2010-05-05 12:29:53 +0300 |
---|---|---|
committer | Mike Antipov <mantipov@productengine.com> | 2010-05-05 12:29:53 +0300 |
commit | 15413e44427c5cc332bcae65462498b349d15eba (patch) | |
tree | 6810fc91a7d5f04ccf24021eac436c627b4538bc /indra | |
parent | 4bff09dcf42cda492f3cd74a5614fe1aec9b538e (diff) |
Fixed major bug EXT-6797 (attempting to create new folder while viewing recent inventory renames newest item instead.)
Implemented Recent Inventory Panel specific classes to create appropriate context menu for Folders in Recent Items Panel:
* Registered new LLInventoryRecentItemsPanel class
* Added appropriate Folder Bridge and Bridge Builder
Updated main inventory panel to not show "+" button on Recent Items tab
* Placed controls into Layout Stack.
* Change visibility of panel with "+" button while switching between tabs.
* also made bottom panel wider to be consistent with other side panels (see screenshots).
Reviewed by Loren Shih at https://codereview.productengine.com/secondlife/r/334/
--HG--
branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 64 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.h | 57 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 27 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 6 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_main_inventory.xml | 140 |
5 files changed, 239 insertions, 55 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 2d08c0a01a..228ab7ebd6 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -5525,3 +5525,67 @@ LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_ /** Bridge Actions ** ********************************************************************************/ + +/************************************************************************/ +/* Recent Inventory Panel related classes */ +/************************************************************************/ +void LLRecentItemsFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags) +{ + LLFolderBridge::buildContextMenu(menu, flags); + + menuentry_vec_t disabled_items, items = getMenuItems(); + + items.erase(std::find(items.begin(), items.end(), std::string("New Folder"))); + items.erase(std::find(items.begin(), items.end(), std::string("New Script"))); + items.erase(std::find(items.begin(), items.end(), std::string("New Note"))); + items.erase(std::find(items.begin(), items.end(), std::string("New Gesture"))); + items.erase(std::find(items.begin(), items.end(), std::string("New Clothes"))); + items.erase(std::find(items.begin(), items.end(), std::string("New Body Parts"))); + + hide_context_entries(menu, items, disabled_items); +} + +LLInvFVBridge* LLRecentInventoryBridgeBuilder::createBridge( + LLAssetType::EType asset_type, + LLAssetType::EType actual_asset_type, + LLInventoryType::EType inv_type, + LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid, + U32 flags /*= 0x00*/ ) const +{ + LLInvFVBridge* new_listener = NULL; + switch(asset_type) + { + case LLAssetType::AT_CATEGORY: + if (actual_asset_type == LLAssetType::AT_LINK_FOLDER) + { + // *TODO: Create a link folder handler instead if it is necessary + new_listener = LLInventoryFVBridgeBuilder::createBridge( + asset_type, + actual_asset_type, + inv_type, + inventory, + root, + uuid, + flags); + break; + } + new_listener = new LLRecentItemsFolderBridge(inv_type, inventory, root, uuid); + break; + default: + new_listener = LLInventoryFVBridgeBuilder::createBridge( + asset_type, + actual_asset_type, + inv_type, + inventory, + root, + uuid, + flags); + } + return new_listener; + +} + + +// EOF diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index de63bdd76b..c45e376cab 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -349,6 +349,11 @@ protected: void modifyOutfit(BOOL append); void determineFolderType(); + /** + * Returns a copy of current menu items. + */ + menuentry_vec_t getMenuItems() { return mItems; } + public: static LLFolderBridge* sSelf; static void staticFolderOptionsMenu(); @@ -659,6 +664,58 @@ protected: }; +/************************************************************************/ +/* Recent Inventory Panel related classes */ +/************************************************************************/ +class LLRecentInventoryBridgeBuilder; +/** + * Overridden version of the Inventory-Folder-View-Bridge for Folders + */ +class LLRecentItemsFolderBridge : public LLFolderBridge +{ + friend class LLRecentInventoryBridgeBuilder; + +public: + /** + * Creates context menu for Folders related to Recent Inventory Panel. + * + * It uses base logic and than removes from visible items "New..." menu items. + */ + /*virtual*/ void buildContextMenu(LLMenuGL& menu, U32 flags); + +protected: + LLRecentItemsFolderBridge(LLInventoryType::EType type, + LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid) : + LLFolderBridge(inventory, root, uuid) + { + mInvType = type; + } +}; + +/** + * Bridge builder to create Inventory-Folder-View-Bridge for Recent Inventory Panel + */ +class LLRecentInventoryBridgeBuilder : public LLInventoryFVBridgeBuilder +{ + /** + * Overrides FolderBridge for Recent Inventory Panel. + * + * It use base functionality for bridges other than FolderBridge. + */ + virtual LLInvFVBridge* createBridge(LLAssetType::EType asset_type, + LLAssetType::EType actual_asset_type, + LLInventoryType::EType inv_type, + LLInventoryPanel* inventory, + LLFolderView* root, + const LLUUID& uuid, + U32 flags = 0x00) const; + +}; + + + void wear_inventory_item_on_avatar(LLInventoryItem* item); void rez_attachment(LLViewerInventoryItem* item, diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 15c872a7c4..dd1e039cb1 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1001,3 +1001,30 @@ BOOL LLInventoryPanel::getIsHiddenFolderType(LLFolderType::EType folder_type) co { return (std::find(mHiddenFolderTypes.begin(), mHiddenFolderTypes.end(), folder_type) != mHiddenFolderTypes.end()); } + + +/************************************************************************/ +/* Recent Inventory Panel related class */ +/************************************************************************/ +class LLInventoryRecentItemsPanel; +static LLDefaultChildRegistry::Register<LLInventoryRecentItemsPanel> t_recent_inventory_panel("recent_inventory_panel"); + +static const LLRecentInventoryBridgeBuilder RECENT_ITEMS_BUILDER; +class LLInventoryRecentItemsPanel : public LLInventoryPanel +{ +public: + struct Params : public LLInitParam::Block<Params, LLInventoryPanel::Params> + {}; + +protected: + LLInventoryRecentItemsPanel (const Params&); + friend class LLUICtrlFactory; +}; + +LLInventoryRecentItemsPanel::LLInventoryRecentItemsPanel( const Params& params) +: LLInventoryPanel(params) +{ + // replace bridge builder to have necessary View bridges. + mInvFVBridgeBuilder = &RECENT_ITEMS_BUILDER; +} + diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 0ba373c51b..a84280c213 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -167,7 +167,7 @@ BOOL LLPanelMainInventory::postBuild() // Now load the stored settings from disk, if available. std::ostringstream filterSaveName; filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME); - llinfos << "LLPanelMainInventory::init: reading from " << filterSaveName << llendl; + llinfos << "LLPanelMainInventory::init: reading from " << filterSaveName.str() << llendl; llifstream file(filterSaveName.str()); LLSD savedFilterState; if (file.is_open()) @@ -492,6 +492,10 @@ void LLPanelMainInventory::onFilterSelected() { return; } + + BOOL recent_active = ("Recent Items" == mActivePanel->getName()); + childSetVisible("add_btn_panel", !recent_active); + setFilterSubString(mFilterSubString); LLInventoryFilter* filter = mActivePanel->getFilter(); LLFloaterInventoryFinder *finder = getFinder(); diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml index 46625144e1..d65b86f007 100644 --- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml @@ -84,7 +84,7 @@ sort_order_setting="InventorySortOrder" top="16" width="288" /> - <inventory_panel + <recent_inventory_panel bg_opaque_color="DkGray2" bg_alpha_color="DkGray2" background_visible="true" @@ -100,62 +100,94 @@ name="Recent Items" width="290" /> </tab_container> - - <panel - background_visible="true" + <layout_stack + animate="false" + background_visible="true" bevel_style="none" + border_size="0" follows="left|right|bottom" - height="27" + height="25" layout="topleft" - top_pad="-1" + orientation="horizontal" + top_pad="0" left="10" name="bottom_panel" - width="310"> - <button - follows="bottom|left" - tool_tip="Show additional options" - height="25" - image_hover_unselected="Toolbar_Left_Over" - image_overlay="OptionsMenu_Off" - image_selected="Toolbar_Left_Selected" - image_unselected="Toolbar_Left_Off" - layout="topleft" - left="0" - name="options_gear_btn" - top="1" - width="31" /> - <button - follows="bottom|left" - height="25" - image_hover_unselected="Toolbar_Middle_Over" - image_overlay="AddItem_Off" - image_selected="Toolbar_Middle_Selected" - image_unselected="Toolbar_Middle_Off" - layout="topleft" - left_pad="1" - name="add_btn" - tool_tip="Add new item" - width="31" /> - <icon - follows="bottom|left" - height="25" - image_name="Toolbar_Middle_Off" - layout="topleft" - left_pad="1" - name="dummy_icon" - width="209" - /> - <dnd_button - follows="bottom|left" - height="25" - image_hover_unselected="Toolbar_Right_Over" - image_overlay="TrashItem_Off" - image_selected="Toolbar_Right_Selected" - image_unselected="Toolbar_Right_Off" - left_pad="1" - layout="topleft" - name="trash_btn" - tool_tip="Remove selected item" - width="31"/> - </panel> + width="307"> + <layout_panel + auto_resize="false" + height="25" + layout="topleft" + name="options_gear_btn_panel" + width="32"> + <button + follows="bottom|left" + tool_tip="Show additional options" + height="25" + image_hover_unselected="Toolbar_Left_Over" + image_overlay="OptionsMenu_Off" + image_selected="Toolbar_Left_Selected" + image_unselected="Toolbar_Left_Off" + layout="topleft" + left="0" + name="options_gear_btn" + top="0" + width="31" /> + </layout_panel> + <layout_panel + auto_resize="false" + height="25" + layout="topleft" + name="add_btn_panel" + width="32"> + <button + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Middle_Over" + image_overlay="AddItem_Off" + image_selected="Toolbar_Middle_Selected" + image_unselected="Toolbar_Middle_Off" + layout="topleft" + left="0" + name="add_btn" + tool_tip="Add new item" + top="0" + width="31" /> + </layout_panel> + <layout_panel + auto_resize="true" + height="25" + layout="topleft" + name="dummy_panel" + width="212"> + <icon + follows="bottom|left|right" + height="25" + image_name="Toolbar_Middle_Off" + layout="topleft" + left="0" + top="0" + name="dummy_icon" + width="211" /> + </layout_panel> + <layout_panel + auto_resize="false" + height="25" + layout="topleft" + name="trash_btn_panel" + width="31"> + <dnd_button + follows="bottom|left" + height="25" + image_hover_unselected="Toolbar_Right_Over" + image_overlay="TrashItem_Off" + image_selected="Toolbar_Right_Selected" + image_unselected="Toolbar_Right_Off" + left="0" + layout="topleft" + name="trash_btn" + tool_tip="Remove selected item" + top="0" + width="31"/> + </layout_panel> + </layout_stack> </panel> |