summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneloutfitedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpaneloutfitedit.cpp')
-rw-r--r--indra/newview/llpaneloutfitedit.cpp117
1 files changed, 88 insertions, 29 deletions
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index 78de384cdc..42de6d1ef4 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -79,6 +79,70 @@ const U64 ALL_ITEMS_MASK = WEARABLE_MASK | ATTACHMENT_MASK;
static const std::string REVERT_BTN("revert_btn");
+class LLPanelOutfitEditGearMenu
+{
+public:
+ static LLMenuGL* create()
+ {
+ LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+
+ registrar.add("Wearable.Create", boost::bind(onCreate, _2));
+
+ LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(
+ "menu_cof_gear.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
+ llassert(menu);
+ if (menu)
+ {
+ populateCreateWearableSubmenus(menu);
+ menu->buildDrawLabels();
+ }
+
+ return menu;
+ }
+
+private:
+ static void onCreate(const LLSD& param)
+ {
+ LLWearableType::EType type = LLWearableType::typeNameToType(param.asString());
+ if (type == LLWearableType::WT_NONE)
+ {
+ llwarns << "Invalid wearable type" << llendl;
+ return;
+ }
+
+ LLAgentWearables::createWearable(type, true);
+ }
+
+ // Populate the menu with items like "New Skin", "New Pants", etc.
+ static void populateCreateWearableSubmenus(LLMenuGL* menu)
+ {
+ LLView* menu_clothes = gMenuHolder->findChildView("COF.Gear.New_Clothes", FALSE);
+ LLView* menu_bp = gMenuHolder->findChildView("COF.Geear.New_Body_Parts", FALSE);
+
+ if (!menu_clothes || !menu_bp)
+ {
+ llassert(menu_clothes && menu_bp);
+ return;
+ }
+
+ for (U8 i = LLWearableType::WT_SHAPE; i != (U8) LLWearableType::WT_COUNT; ++i)
+ {
+ LLWearableType::EType type = (LLWearableType::EType) i;
+ const std::string& type_name = LLWearableType::getTypeName(type);
+
+ LLMenuItemCallGL::Params p;
+ p.name = type_name;
+ p.label = LLWearableType::getTypeDefaultNewName(type);
+ p.on_click.function_name = "Wearable.Create";
+ p.on_click.parameter = LLSD(type_name);
+
+ LLView* parent = LLWearableType::getAssetType(type) == LLAssetType::AT_CLOTHING ?
+ menu_clothes : menu_bp;
+ LLUICtrlFactory::create<LLMenuItemCallGL>(p, parent);
+ }
+ }
+};
+
class LLCOFObserver : public LLInventoryObserver
{
public:
@@ -259,7 +323,6 @@ BOOL LLPanelOutfitEdit::postBuild()
mFolderViewBtn = getChild<LLButton>("folder_view_btn");
mListViewBtn = getChild<LLButton>("list_view_btn");
- mAddToOutfitBtn = getChild<LLButton>("add_to_outfit_btn");
childSetCommitCallback("filter_button", boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this), NULL);
childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::showFilteredFolderWearablesPanel, this), NULL);
@@ -275,8 +338,6 @@ BOOL LLPanelOutfitEdit::postBuild()
mCOFWearables->getCOFCallbacks().mMoveWearableCloser = boost::bind(&LLPanelOutfitEdit::moveWearable, this, true);
mCOFWearables->getCOFCallbacks().mMoveWearableFurther = boost::bind(&LLPanelOutfitEdit::moveWearable, this, false);
- mCOFWearables->childSetAction("add_btn", boost::bind(&LLPanelOutfitEdit::toggleAddWearablesPanel, this));
-
mAddWearablesPanel = getChild<LLPanel>("add_wearables_panel");
mInventoryItemsPanel = getChild<LLInventoryPanel>("inventory_items");
@@ -298,7 +359,8 @@ BOOL LLPanelOutfitEdit::postBuild()
mSearchFilter = getChild<LLFilterEditor>("look_item_filter");
mSearchFilter->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onSearchEdit, this, _2));
-
+
+ childSetAction("show_add_wearables_btn", boost::bind(&LLPanelOutfitEdit::toggleAddWearablesPanel, this));
childSetAction("add_to_outfit_btn", boost::bind(&LLPanelOutfitEdit::onAddToOutfitClicked, this));
mEditWearableBtn = getChild<LLButton>("edit_wearable_btn");
@@ -341,15 +403,28 @@ void LLPanelOutfitEdit::moveWearable(bool closer_to_body)
void LLPanelOutfitEdit::toggleAddWearablesPanel()
{
BOOL current_visibility = mAddWearablesPanel->getVisible();
- mAddWearablesPanel->setVisible(!current_visibility);
+ showAddWearablesPanel(!current_visibility);
+}
+
+void LLPanelOutfitEdit::showAddWearablesPanel(bool show_add_wearables)
+{
+ mAddWearablesPanel->setVisible(show_add_wearables);
+
+ childSetValue("show_add_wearables_btn", show_add_wearables);
- mFolderViewBtn->setVisible(!current_visibility);
- mListViewBtn->setVisible(!current_visibility);
- mAddToOutfitBtn->setVisible(!current_visibility);
+ childSetVisible("filter_wearables_combobox", show_add_wearables);
+ childSetVisible("filter_button", show_add_wearables);
- // Change right dummy icon to fill the toggled buttons space.
- childSetVisible("add_wearables_dummy_icon", !current_visibility);
- childSetVisible("dummy_right_icon", current_visibility);
+ //search filter should be disabled
+ if (!show_add_wearables)
+ {
+ childSetValue("filter_button", false);
+ showWearablesFilter();
+ }
+
+ //switching button bars
+ childSetVisible("no_add_wearables_button_bar", !show_add_wearables);
+ childSetVisible("add_wearables_button_bar", show_add_wearables);
}
void LLPanelOutfitEdit::showWearablesFilter()
@@ -708,34 +783,18 @@ void LLPanelOutfitEdit::onGearButtonClick(LLUICtrl* clicked_button)
{
if(!mGearMenu)
{
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
-
- registrar.add("Gear.OnClick", boost::bind(&LLPanelOutfitEdit::onGearMenuItemClick, this, _2));
-
- mGearMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(
- "menu_cof_gear.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
- mGearMenu->buildDrawLabels();
- mGearMenu->updateParent(LLMenuGL::sMenuContainer);
+ mGearMenu = LLPanelOutfitEditGearMenu::create();
}
S32 menu_y = mGearMenu->getRect().getHeight() + clicked_button->getRect().getHeight();
LLMenuGL::showPopup(clicked_button, mGearMenu, 0, menu_y);
}
-void LLPanelOutfitEdit::onGearMenuItemClick(const LLSD& data)
-{
- std::string param = data.asString();
- if("add" == param)
- {
- // TODO
- }
-}
-
void LLPanelOutfitEdit::showFilteredWearableItemsList(LLWearableType::EType type)
{
mWearableListTypeCollector->setType(type);
mWearableListManager->setFilterCollector(mWearableListTypeCollector);
- mAddWearablesPanel->setVisible(TRUE);
+ showAddWearablesPanel(true);
showFilteredWearablesPanel();
}