diff options
author | Rider Linden <rider@lindenlab.com> | 2018-07-09 17:06:24 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-07-09 17:06:24 -0700 |
commit | 26b6cc516076c55befff3fbd9c21f47565bbc390 (patch) | |
tree | c4bddc640a6ce1d07b2ae67ee19fb3e864bdd39c /indra | |
parent | 21d165011b81909c8cab944755b53f908e51ad16 (diff) |
MAINT-8821: Clean up some of the selection and enable/disable code, Add menu for adding settings.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloatermyenvironment.cpp | 564 | ||||
-rw-r--r-- | indra/newview/llfloatermyenvironment.h | 11 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.h | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_my_environments.xml | 20 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_settings_add.xml | 37 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_settings_gear.xml | 103 |
7 files changed, 205 insertions, 539 deletions
diff --git a/indra/newview/llfloatermyenvironment.cpp b/indra/newview/llfloatermyenvironment.cpp index 83cd726eb8..4863e4c471 100644 --- a/indra/newview/llfloatermyenvironment.cpp +++ b/indra/newview/llfloatermyenvironment.cpp @@ -47,6 +47,7 @@ #include "llviewerinventory.h" #include "llviewercontrol.h" #include "llfloaterperms.h" +#include "llenvironment.h" //========================================================================= namespace @@ -59,7 +60,6 @@ namespace const std::string BUTTON_NEWSETTINGS("btn_gear"); const std::string BUTTON_GEAR("btn_newsettings"); const std::string BUTTON_DELETE("btn_del"); - const std::string BUTTON_EDIT("btn_edit"); } @@ -137,7 +137,10 @@ LLFloaterMyEnvironment::LLFloaterMyEnvironment(const LLSD& key) : mTypeFilter((0x01 << static_cast<U64>(LLSettingsType::ST_DAYCYCLE)) | (0x01 << static_cast<U64>(LLSettingsType::ST_SKY)) | (0x01 << static_cast<U64>(LLSettingsType::ST_WATER))), mSelectedAsset() { - + mCommitCallbackRegistrar.add("MyEnvironments.DoCreate", [this](LLUICtrl *, const LLSD &userdata) { onDoCreate(userdata); }); + + mEnableCallbackRegistrar.add("MyEnvironments.EnvironmentEnabled", [](LLUICtrl *, const LLSD &) { return LLEnvironment::instance().isInventoryEnabled(); }); + #if 0 mObserver = new LLFloaterGestureObserver(this); LLGestureMgr::instance().addObserver(mObserver); @@ -171,7 +174,7 @@ BOOL LLFloaterMyEnvironment::postBuild() mInventoryList->setFilterTypes(filter_types); -// mInventoryList->setSelectCallback(boost::bind(&LLFloaterTexturePicker::onSelectionChange, this, _1, _2)); + mInventoryList->setSelectCallback([this](const std::deque<LLFolderViewItem*>&, BOOL) { onSelectionChange(); }); mInventoryList->setShowFolderState(mShowFolders); mInventoryList->setFilterSettingsTypes(mTypeFilter); } @@ -181,11 +184,7 @@ BOOL LLFloaterMyEnvironment::postBuild() childSetCommitCallback(CHECK_WATER, [this](LLUICtrl*, void*) { onFilterCheckChange(); }, nullptr); childSetCommitCallback(CHECK_SHOWFOLDERS, [this](LLUICtrl*, void*) { onShowFoldersChange(); }, nullptr); - /*TODO: Enable these*/ - getChild<LLUICtrl>(BUTTON_NEWSETTINGS)->setEnabled(false); - getChild<LLUICtrl>(BUTTON_GEAR)->setEnabled(false); - getChild<LLUICtrl>(BUTTON_DELETE)->setEnabled(false); - getChild<LLUICtrl>(BUTTON_EDIT)->setEnabled(false); + childSetCommitCallback(BUTTON_DELETE, [this](LLUICtrl *, void*) { onDeleteSelected(); }, nullptr); return TRUE; } @@ -198,11 +197,8 @@ void LLFloaterMyEnvironment::refresh() getChild<LLCheckBoxCtrl>(CHECK_SKIES)->setValue(LLSD::Boolean(mTypeFilter & (0x01 << static_cast<U64>(LLSettingsType::ST_SKY)))); getChild<LLCheckBoxCtrl>(CHECK_WATER)->setValue(LLSD::Boolean(mTypeFilter & (0x01 << static_cast<U64>(LLSettingsType::ST_WATER)))); -// if (mInventoryList) -// { -// LLUUID obj_id = findItemByAssetId(mSelectedAsset, false, false); -// mInventoryList->setSelection(obj_id, false); -// } + refreshButtonStates(); + } void LLFloaterMyEnvironment::onOpen(const LLSD& key) @@ -212,6 +208,13 @@ void LLFloaterMyEnvironment::onOpen(const LLSD& key) if (key.has("asset_id") && mInventoryList) { mSelectedAsset = key["asset_id"].asUUID(); + + if (!mSelectedAsset.isNull()) + { + LLUUID obj_id = findItemByAssetId(mSelectedAsset, false, false); + if (!obj_id.isNull()) + mInventoryList->setSelection(obj_id, false); + } } else { @@ -247,6 +250,63 @@ void LLFloaterMyEnvironment::onFilterCheckChange() mInventoryList->setFilterSettingsTypes(mTypeFilter); } +void LLFloaterMyEnvironment::onSelectionChange() +{ + refreshButtonStates(); +} + +void LLFloaterMyEnvironment::onDeleteSelected() +{ + uuid_vec_t selected; + + getSelectedIds(selected); + if (selected.empty()) + return; + + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + for (const LLUUID& itemid: selected) + { + LLInventoryItem* inv_item = gInventory.getItem(itemid); + + if (inv_item && inv_item->getInventoryType() == LLInventoryType::IT_SETTINGS) + { + LLInventoryModel::update_list_t update; + LLInventoryModel::LLCategoryUpdate old_folder(inv_item->getParentUUID(), -1); + update.push_back(old_folder); + LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1); + update.push_back(new_folder); + gInventory.accountForUpdate(update); + + LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item); + new_item->setParent(trash_id); + // no need to restamp it though it's a move into trash because + // it's a brand new item already. + new_item->updateParentOnServer(FALSE); + gInventory.updateItem(new_item); + } + } + gInventory.notifyObservers(); +} + + +void LLFloaterMyEnvironment::onDoCreate(const LLSD &data) +{ + menu_create_inventory_item(mInventoryList, NULL, data); +} + +//------------------------------------------------------------------------- +void LLFloaterMyEnvironment::refreshButtonStates() +{ + bool settings_ok = LLEnvironment::instance().isInventoryEnabled(); + + uuid_vec_t selected; + getSelectedIds(selected); + + getChild<LLUICtrl>(BUTTON_GEAR)->setEnabled(settings_ok); + getChild<LLUICtrl>(BUTTON_NEWSETTINGS)->setEnabled(true); + getChild<LLUICtrl>(BUTTON_DELETE)->setEnabled(settings_ok && !selected.empty()); +} + //------------------------------------------------------------------------- LLUUID LLFloaterMyEnvironment::findItemByAssetId(LLUUID asset_id, bool copyable_only, bool ignore_library) { @@ -293,477 +353,13 @@ LLUUID LLFloaterMyEnvironment::findItemByAssetId(LLUUID asset_id, bool copyable_ return LLUUID::null; } -#if 0 -void LLFloaterGesture::done() -{ - //this method can be called twice: for GestureFolder and once after loading all sudir of GestureFolder - if (gInventory.isCategoryComplete(mGestureFolderID)) - { - LL_DEBUGS("Gesture")<< "mGestureFolderID loaded" << LL_ENDL; - // we load only gesture folder without childred. - LLInventoryModel::cat_array_t* categories; - LLInventoryModel::item_array_t* items; - uuid_vec_t unloaded_folders; - LL_DEBUGS("Gesture")<< "Get subdirs of Gesture Folder...." << LL_ENDL; - gInventory.getDirectDescendentsOf(mGestureFolderID, categories, items); - if (categories->empty()) - { - gInventory.removeObserver(this); - LL_INFOS("Gesture")<< "Gesture dos NOT contains sub-directories."<< LL_ENDL; - return; - } - LL_DEBUGS("Gesture")<< "There are " << categories->size() << " Folders "<< LL_ENDL; - for (LLInventoryModel::cat_array_t::iterator it = categories->begin(); it != categories->end(); it++) - { - if (!gInventory.isCategoryComplete(it->get()->getUUID())) - { - unloaded_folders.push_back(it->get()->getUUID()); - LL_DEBUGS("Gesture")<< it->get()->getName()<< " Folder added to fetchlist"<< LL_ENDL; - } - - } - if (!unloaded_folders.empty()) - { - LL_DEBUGS("Gesture")<< "Fetching subdirectories....." << LL_ENDL; - setFetchIDs(unloaded_folders); - startFetch(); - } - else - { - LL_DEBUGS("Gesture")<< "All Gesture subdirectories have been loaded."<< LL_ENDL; - gInventory.removeObserver(this); - buildGestureList(); - } - } - else - { - LL_WARNS("Gesture")<< "Gesture list was NOT loaded"<< LL_ENDL; - } -} - -// virtual - -void LLFloaterGesture::refreshAll() -{ - if (!mGestureList) return; - - buildGestureList(); - - if (mSelectedID.isNull()) - { - mGestureList->selectFirstItem(); - } - else - { - if (! mGestureList->setCurrentByID(mSelectedID)) - { - mGestureList->selectFirstItem(); - } - } - - // Update button labels - onCommitList(); -} - -void LLFloaterGesture::buildGestureList() -{ - S32 scroll_pos = mGestureList->getScrollPos(); - uuid_vec_t selected_items; - getSelectedIds(selected_items); - LL_DEBUGS("Gesture")<< "Rebuilding gesture list "<< LL_ENDL; - mGestureList->deleteAllItems(); - - LLGestureMgr::item_map_t::const_iterator it; - const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures(); - for (it = active_gestures.begin(); it != active_gestures.end(); ++it) - { - addGesture(it->first,it->second, mGestureList); - } - if (gInventory.isCategoryComplete(mGestureFolderID)) - { - LLIsType is_gesture(LLAssetType::AT_GESTURE); - LLInventoryModel::cat_array_t categories; - LLInventoryModel::item_array_t items; - gInventory.collectDescendentsIf(mGestureFolderID, categories, items, - LLInventoryModel::EXCLUDE_TRASH, is_gesture); - - for (LLInventoryModel::item_array_t::iterator it = items.begin(); it!= items.end(); ++it) - { - LLInventoryItem* item = it->get(); - if (active_gestures.find(item->getUUID()) == active_gestures.end()) - { - // if gesture wasn't loaded yet, we can display only name - addGesture(item->getUUID(), NULL, mGestureList); - } - } - } - - // attempt to preserve scroll position through re-builds - // since we do re-build whenever something gets dirty - for(uuid_vec_t::iterator it = selected_items.begin(); it != selected_items.end(); it++) - { - mGestureList->selectByID(*it); - } - mGestureList->setScrollPos(scroll_pos); -} - -void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gesture,LLCtrlListInterface * list ) -{ - // Note: Can have NULL item if inventory hasn't arrived yet. - static std::string item_name = getString("loading"); - LLInventoryItem* item = gInventory.getItem(item_id); - if (item) - { - item_name = item->getName(); - } - - static std::string font_style = "NORMAL"; - // If gesture is playing, bold it - - LLSD element; - element["id"] = item_id; - - if (gesture) - { - if (gesture->mPlaying) - { - font_style = "BOLD"; - } - item_name = gesture->mName; - element["columns"][0]["column"] = "trigger"; - element["columns"][0]["value"] = gesture->mTrigger; - element["columns"][0]["font"]["name"] = "SANSSERIF"; - element["columns"][0]["font"]["style"] = font_style; - - std::string key_string; - std::string buffer; - - if (gesture->mKey == KEY_NONE) - { - buffer = "---"; - key_string = "~~~"; // alphabetize to end - } - else - { - key_string = LLKeyboard::stringFromKey(gesture->mKey); - buffer = LLKeyboard::stringFromAccelerator(gesture->mMask, - gesture->mKey); - } - - element["columns"][1]["column"] = "shortcut"; - element["columns"][1]["value"] = buffer; - element["columns"][1]["font"]["name"] = "SANSSERIF"; - element["columns"][1]["font"]["style"] = font_style; - - // hidden column for sorting - element["columns"][2]["column"] = "key"; - element["columns"][2]["value"] = key_string; - element["columns"][2]["font"]["name"] = "SANSSERIF"; - element["columns"][2]["font"]["style"] = font_style; - - // Only add "playing" if we've got the name, less confusing. JC - if (item && gesture->mPlaying) - { - item_name += " " + getString("playing"); - } - element["columns"][3]["column"] = "name"; - element["columns"][3]["value"] = item_name; - element["columns"][3]["font"]["name"] = "SANSSERIF"; - element["columns"][3]["font"]["style"] = font_style; - } - else - { - element["columns"][0]["column"] = "trigger"; - element["columns"][0]["value"] = ""; - element["columns"][0]["font"]["name"] = "SANSSERIF"; - element["columns"][0]["font"]["style"] = font_style; - element["columns"][1]["column"] = "shortcut"; - element["columns"][1]["value"] = "---"; - element["columns"][1]["font"]["name"] = "SANSSERIF"; - element["columns"][1]["font"]["style"] = font_style; - element["columns"][2]["column"] = "key"; - element["columns"][2]["value"] = "~~~"; - element["columns"][2]["font"]["name"] = "SANSSERIF"; - element["columns"][2]["font"]["style"] = font_style; - element["columns"][3]["column"] = "name"; - element["columns"][3]["value"] = item_name; - element["columns"][3]["font"]["name"] = "SANSSERIF"; - element["columns"][3]["font"]["style"] = font_style; - } - - LL_DEBUGS("Gesture") << "Added gesture [" << item_name << "]" << LL_ENDL; - - LLScrollListItem* sl_item = list->addElement(element, ADD_BOTTOM); - if(sl_item) - { - LLFontGL::StyleFlags style = LLGestureMgr::getInstance()->isGestureActive(item_id) ? LLFontGL::BOLD : LLFontGL::NORMAL; - // *TODO find out why ["font"]["style"] does not affect font style - ((LLScrollListText*)sl_item->getColumn(0))->setFontStyle(style); - } -} - -void LLFloaterGesture::getSelectedIds(uuid_vec_t& ids) -{ - std::vector<LLScrollListItem*> items = mGestureList->getAllSelected(); - for(std::vector<LLScrollListItem*>::const_iterator it = items.begin(); it != items.end(); it++) - { - ids.push_back((*it)->getUUID()); - } -} - -bool LLFloaterGesture::isActionEnabled(const LLSD& command) -{ - // paste copy_uuid edit_gesture - std::string command_name = command.asString(); - if("paste" == command_name) - { - if(!LLClipboard::instance().hasContents()) - return false; - - std::vector<LLUUID> ids; - LLClipboard::instance().pasteFromClipboard(ids); - for(std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++) - { - LLInventoryItem* item = gInventory.getItem(*it); - - if(item && item->getInventoryType() == LLInventoryType::IT_GESTURE) - { - return true; - } - } - return false; - } - else if("copy_uuid" == command_name || "edit_gesture" == command_name) - { - return mGestureList->getAllSelected().size() == 1; - } - return true; -} - -void LLFloaterGesture::onClickPlay() -{ - const LLUUID& item_id = mGestureList->getCurrentID(); - if(item_id.isNull()) return; - - LL_DEBUGS("Gesture")<<" Trying to play gesture id: "<< item_id <<LL_ENDL; - if(!LLGestureMgr::instance().isGestureActive(item_id)) - { - // we need to inform server about gesture activating to be consistent with LLPreviewGesture and LLGestureComboList. - BOOL inform_server = TRUE; - BOOL deactivate_similar = FALSE; - LLGestureMgr::instance().setGestureLoadedCallback(item_id, boost::bind(&LLFloaterGesture::playGesture, this, item_id)); - LLViewerInventoryItem *item = gInventory.getItem(item_id); - llassert(item); - if (item) - { - LLGestureMgr::instance().activateGestureWithAsset(item_id, item->getAssetUUID(), inform_server, deactivate_similar); - LL_DEBUGS("Gesture")<< "Activating gesture with inventory ID: " << item_id <<LL_ENDL; - } - } - else - { - playGesture(item_id); - } -} - -void LLFloaterGesture::onClickNew() -{ - LLPointer<LLInventoryCallback> cb = new GestureShowCallback(); - create_inventory_item(gAgent.getID(), - gAgent.getSessionID(), - LLUUID::null, - LLTransactionID::tnull, - "New Gesture", - "", - LLAssetType::AT_GESTURE, - LLInventoryType::IT_GESTURE, - NO_INV_SUBTYPE, - PERM_MOVE | LLFloaterPerms::getNextOwnerPerms("Gestures"), - cb); -} - -void LLFloaterGesture::onActivateBtnClick() +void LLFloaterMyEnvironment::getSelectedIds(uuid_vec_t& ids) const { - uuid_vec_t ids; - getSelectedIds(ids); - if(ids.empty()) - return; - - LLGestureMgr* gm = LLGestureMgr::getInstance(); - uuid_vec_t::const_iterator it = ids.begin(); - BOOL first_gesture_state = gm->isGestureActive(*it); - BOOL is_mixed = FALSE; - while( ++it != ids.end() ) - { - if(first_gesture_state != gm->isGestureActive(*it)) - { - is_mixed = TRUE; - break; - } - } - for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++) - { - if(is_mixed) - { - gm->activateGesture(*it); - } - else - { - if(first_gesture_state) - { - gm->deactivateGesture(*it); - } - else - { - gm->activateGesture(*it); - } - } - } -} + LLInventoryPanel::selected_items_t items = mInventoryList->getSelectedItems(); -void LLFloaterGesture::onCopyPasteAction(const LLSD& command) -{ - std::string command_name = command.asString(); - // Since we select this command, the inventory items must have already arrived - if("copy_gesture" == command_name) - { - uuid_vec_t ids; - getSelectedIds(ids); - // Make sure the clipboard is empty - LLClipboard::instance().reset(); - for(uuid_vec_t::iterator it = ids.begin(); it != ids.end(); it++) - { - LLInventoryItem* item = gInventory.getItem(*it); - if(item && item->getInventoryType() == LLInventoryType::IT_GESTURE) - { - LLWString item_name = utf8str_to_wstring(item->getName()); - LLClipboard::instance().addToClipboard(item_name, 0, item_name.size()); - } - } - } - else if ("paste" == command_name) - { - std::vector<LLUUID> ids; - LLClipboard::instance().pasteFromClipboard(ids); - if(ids.empty() || !gInventory.isCategoryComplete(mGestureFolderID)) - return; - LLInventoryCategory* gesture_dir = gInventory.getCategory(mGestureFolderID); - llassert(gesture_dir); - LLPointer<GestureCopiedCallback> cb = new GestureCopiedCallback(this); - - for(std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++) - { - LLInventoryItem* item = gInventory.getItem(*it); - if(gesture_dir && item && item->getInventoryType() == LLInventoryType::IT_GESTURE) - { - LLStringUtil::format_map_t string_args; - string_args["[COPY_NAME]"] = item->getName(); - LL_DEBUGS("Gesture")<< "Copying gesture " << item->getName() << " "<< item->getUUID() << " into " - << gesture_dir->getName() << " "<< gesture_dir->getUUID() << LL_ENDL; - copy_inventory_item(gAgent.getID(), item->getPermissions().getOwner(), item->getUUID(), - gesture_dir->getUUID(), getString("copy_name", string_args), cb); - } - } - LLClipboard::instance().reset(); - } - else if ("copy_uuid" == command_name) - { - LLClipboard::instance().copyToClipboard(mGestureList->getCurrentID(),LLAssetType::AT_GESTURE); - } -} - -void LLFloaterGesture::onClickEdit() -{ - const LLUUID& item_id = mGestureList->getCurrentID(); - - LLInventoryItem* item = gInventory.getItem(item_id); - if (!item) return; - - LLPreviewGesture* previewp = LLPreviewGesture::show(item_id, LLUUID::null); - if (!previewp->getHost()) - { - previewp->setRect(gFloaterView->findNeighboringPosition(this, previewp)); - } -} - -void LLFloaterGesture::onCommitList() -{ - const LLUUID& item_id = mGestureList->getCurrentID(); - - mSelectedID = item_id; - if (LLGestureMgr::instance().isGesturePlaying(item_id)) - { - getChildView("play_btn")->setVisible( false); - getChildView("stop_btn")->setVisible( true); - } - else - { - getChildView("play_btn")->setVisible( true); - getChildView("stop_btn")->setVisible( false); - } -} - -void LLFloaterGesture::onDeleteSelected() -{ - uuid_vec_t ids; - getSelectedIds(ids); - if(ids.empty()) - return; - - const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - LLGestureMgr* gm = LLGestureMgr::getInstance(); - for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++) - { - const LLUUID& selected_item = *it; - LLInventoryItem* inv_item = gInventory.getItem(selected_item); - if (inv_item && inv_item->getInventoryType() == LLInventoryType::IT_GESTURE) - { - if(gm->isGestureActive(selected_item)) - { - gm->deactivateGesture(selected_item); - } - LLInventoryModel::update_list_t update; - LLInventoryModel::LLCategoryUpdate old_folder(inv_item->getParentUUID(), -1); - update.push_back(old_folder); - LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1); - update.push_back(new_folder); - gInventory.accountForUpdate(update); - - LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item); - new_item->setParent(trash_id); - // no need to restamp it though it's a move into trash because - // it's a brand new item already. - new_item->updateParentOnServer(FALSE); - gInventory.updateItem(new_item); - } - } - gInventory.notifyObservers(); - buildGestureList(); -} - -void LLFloaterGesture::addToCurrentOutFit() -{ - uuid_vec_t ids; - getSelectedIds(ids); - LLAppearanceMgr* am = LLAppearanceMgr::getInstance(); - LLPointer<LLInventoryCallback> cb = new LLUpdateAppearanceOnDestroy; - for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++) - { - am->addCOFItemLink(*it, cb); - } -} - -void LLFloaterGesture::playGesture(LLUUID item_id) -{ - LL_DEBUGS("Gesture")<<"Playing gesture "<< item_id<<LL_ENDL; - - if (LLGestureMgr::instance().isGesturePlaying(item_id)) - { - LLGestureMgr::instance().stopGesture(item_id); - } - else - { - LLGestureMgr::instance().playGesture(item_id); - } + for (auto itemview : items) + { + LLFolderViewModelItemInventory* itemp = static_cast<LLFolderViewModelItemInventory*>(itemview->getViewModelItem()); + ids.push_back(itemp->getUUID()); + } } -#endif diff --git a/indra/newview/llfloatermyenvironment.h b/indra/newview/llfloatermyenvironment.h index f3ff9f779d..51a44ec1aa 100644 --- a/indra/newview/llfloatermyenvironment.h +++ b/indra/newview/llfloatermyenvironment.h @@ -60,13 +60,18 @@ public: private: LLInventoryPanel * mInventoryList; + U64 mTypeFilter; + LLInventoryFilter::EFolderShow mShowFolders; + LLUUID mSelectedAsset; void onShowFoldersChange(); void onFilterCheckChange(); + void onSelectionChange(); + void onDeleteSelected(); + void onDoCreate(const LLSD &data); - U64 mTypeFilter; - LLInventoryFilter::EFolderShow mShowFolders; - LLUUID mSelectedAsset; + void getSelectedIds(uuid_vec_t& ids) const; + void refreshButtonStates(); static LLUUID findItemByAssetId(LLUUID asset_id, bool copyable_only, bool ignore_library); diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index b60999e64a..d84ce16792 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1102,6 +1102,11 @@ void LLInventoryPanel::clearSelection() mSelectThisID.setNull(); } +LLInventoryPanel::selected_items_t LLInventoryPanel::getSelectedItems() const +{ + return mFolderRoot.get()->getSelectionList(); +} + void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& items, BOOL user_action) { // Schedule updating the folder view context menu when all selected items become complete (STORM-373). diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 79d39c8b82..e2da06b8d8 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -144,6 +144,8 @@ public: virtual ~LLInventoryPanel(); public: + typedef std::set<LLFolderViewItem*> selected_items_t; + LLInventoryModel* getModel() { return mInventory; } LLFolderViewModelInventory& getRootViewModel() { return mInventoryViewModel; } @@ -168,6 +170,8 @@ public: void setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus); void setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)>& cb); void clearSelection(); + selected_items_t getSelectedItems() const; + bool isSelectionRemovable(); LLInventoryFilter& getFilter(); const LLInventoryFilter& getFilter() const; diff --git a/indra/newview/skins/default/xui/en/floater_my_environments.xml b/indra/newview/skins/default/xui/en/floater_my_environments.xml index 74921e8b64..83416f60d7 100644 --- a/indra/newview/skins/default/xui/en/floater_my_environments.xml +++ b/indra/newview/skins/default/xui/en/floater_my_environments.xml @@ -110,13 +110,12 @@ top_pad="0" left_delta="-3" width="200" /> - </layout_panel> <layout_panel auto_resize="false" user_resize="true" tab_group="1" - height="62" + height="31" name="pnl_control" font="SansSerifBold"> <panel @@ -142,7 +141,7 @@ top="5" tool_tip="More options" width="18" /> - <button + <menu_button follows="bottom|left" font="SansSerifBigBold" height="18" @@ -151,8 +150,9 @@ image_disabled="AddItem_Disabled" layout="topleft" left_pad="5" + menu_filename="menu_settings_add.xml" name="btn_newsettings" - tool_tip="Make new gesture" + tool_tip="Make new setting" top_delta="0" width="18" /> <button @@ -165,20 +165,10 @@ layout="topleft" name="btn_del" right="-5" - tool_tip="Delete this gesture" + tool_tip="Delete this setting" top_delta="0" width="18" /> </panel> - <button - follows="top|left" - height="23" - label="Edit" - layout="topleft" - left="6" - name="btn_edit" - top_pad="5" - width="83" /> - </layout_panel> </layout_stack> </floater> diff --git a/indra/newview/skins/default/xui/en/menu_settings_add.xml b/indra/newview/skins/default/xui/en/menu_settings_add.xml new file mode 100644 index 0000000000..a4782cfdc3 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_settings_add.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<toggleable_menu + layout="topleft" + mouse_opaque="false" + name="menu_settings_add" + visible="false"> + <menu_item_call + label="New Sky" + layout="topleft" + name="New Sky"> + <menu_item_call.on_click + function="MyEnvironments.DoCreate" + parameter="sky"/> + <menu_item_call.on_enable + function="MyEnvironments.EnvironmentEnabled" /> + </menu_item_call> + <menu_item_call + label="New Water" + layout="topleft" + name="New Water"> + <menu_item_call.on_click + function="MyEnvironments.DoCreate" + parameter="water"/> + <menu_item_call.on_enable + function="MyEnvironments.EnvironmentEnabled" /> + </menu_item_call> + <menu_item_call + label="New Day Cycle" + layout="topleft" + name="New Day Cycle"> + <menu_item_call.on_click + function="MyEnvironments.DoCreate" + parameter="daycycle"/> + <menu_item_call.on_enable + function="MyEnvironments.EnvironmentEnabled" /> + </menu_item_call> +</toggleable_menu>
\ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/menu_settings_gear.xml b/indra/newview/skins/default/xui/en/menu_settings_gear.xml index 73fae4f693..41fd0fce2c 100644 --- a/indra/newview/skins/default/xui/en/menu_settings_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_settings_gear.xml @@ -1,57 +1,86 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <toggleable_menu - layout="topleft" - mouse_opaque="false" - name="menu_settings_gear" - visible="false"> + layout="topleft" + mouse_opaque="false" + name="menu_settings_gear" + visible="false"> <menu_item_call - label="Apply Selected Setting to Myself" - layout="topleft" - name="activate"> + label="Edit" + layout="topleft" + name="edit_settings"> <on_click - function="Gesture.Action.ToogleActiveState" /> + function="MyEnvironments.ShowPreview" /> + <on_enable + function="MyEnvironments.EnableAction" + parameter="edit_settings" /> </menu_item_call> + <menu_item_separator + layout="topleft" + name="Separator" /> <menu_item_call - label="Copy" - layout="topleft" - name="copy_settings"> - <on_click - function="Gesture.Action.CopyPaste" - parameter="copy_gesture" /> - <on_enable - function="Gesture.EnableAction" - parameter="copy_gesture" /> + name="Settings Apply Local" + layout="topleft" + label="Apply Only To Myself"> + <menu_item_call.on_click + function="MyEnvironments.DoApply" + parameter="local" /> + </menu_item_call> + <menu_item_call + name="Settings Apply Parcel" + layout="topleft" + label="Apply To Parcel"> + <menu_item_call.on_click + function="MyEnvironments.DoApply" + parameter="parcel" /> + <menu_item_call.on_enable + function="MyEnvironments.CanAppyl" + parameter="parcel"/> + </menu_item_call> + <menu_item_call + name="Settings Apply Region" + layout="topleft" + label="Apply To Region"> + <menu_item_call.on_click + function="MyEnvironments.DoToSelected" + parameter="region" /> + <menu_item_call.on_enable + function="MyEnvironments.CanAppyl" + parameter="region"/> </menu_item_call> + <menu_item_separator + layout="topleft" + name="Separator" /> <menu_item_call - label="Paste" - layout="topleft" - name="paste_settings"> + label="Copy" + layout="topleft" + name="copy_settings"> <on_click - function="Gesture.Action.CopyPaste" - parameter="paste" /> + function="MyEnvironments.CopyPaste" + parameter="copy" /> <on_enable - function="Gesture.EnableAction" - parameter="paste" /> + function="MyEnvironments.EnableAction" + parameter="copy" /> </menu_item_call> <menu_item_call - label="Copy UUID" - layout="topleft" - name="copy_uuid"> + label="Paste" + layout="topleft" + name="paste_settings"> <on_click - function="Gesture.Action.CopyPaste" - parameter="copy_uuid" /> + function="MyEnvironments.CopyPaste" + parameter="paste" /> <on_enable - function="Gesture.EnableAction" - parameter="copy_uuid" /> + function="MyEnvironments.EnableAction" + parameter="paste" /> </menu_item_call> <menu_item_call - label="Edit" - layout="topleft" - name="edit_settings"> + label="Copy UUID" + layout="topleft" + name="copy_uuid"> <on_click - function="Gesture.Action.ShowPreview" /> + function="MyEnvironments.CopyPaste" + parameter="copy_uuid" /> <on_enable - function="Gesture.EnableAction" - parameter="edit_settings" /> + function="MyEnvironments.EnableAction" + parameter="copy_uuid" /> </menu_item_call> </toggleable_menu> |