diff options
Diffstat (limited to 'indra/newview/llpanelplaces.cpp')
| -rw-r--r-- | indra/newview/llpanelplaces.cpp | 231 |
1 files changed, 111 insertions, 120 deletions
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 66efb96fc7..b2e9110e96 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -57,10 +57,9 @@ #include "llinventorymodel.h" #include "lllandmarkactions.h" #include "lllandmarklist.h" -#include "llpanellandmarkinfo.h" +#include "llpanelplaceinfo.h" #include "llpanellandmarks.h" #include "llpanelpick.h" -#include "llpanelplaceprofile.h" #include "llpanelteleporthistory.h" #include "llteleporthistorystorage.h" #include "lltoggleablemenu.h" @@ -122,8 +121,7 @@ LLPanelPlaces::LLPanelPlaces() mFilterSubString(LLStringUtil::null), mActivePanel(NULL), mFilterEditor(NULL), - mPlaceProfile(NULL), - mLandmarkInfo(NULL), + mPlaceInfo(NULL), mPickPanel(NULL), mItem(NULL), mPlaceMenu(NULL), @@ -137,7 +135,7 @@ LLPanelPlaces::LLPanelPlaces() gInventory.addObserver(mInventoryObserver); LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback( - boost::bind(&LLPanelPlaces::updateVerbs, this)); + boost::bind(&LLPanelPlaces::onAgentParcelChange, this)); //LLUICtrlFactory::getInstance()->buildPanel(this, "panel_places.xml"); // Called from LLRegisterPanelClass::defaultPanelClassBuilder() } @@ -208,32 +206,25 @@ BOOL LLPanelPlaces::postBuild() mFilterEditor->setCommitCallback(boost::bind(&LLPanelPlaces::onFilterEdit, this, _2, false)); } - mPlaceProfile = getChild<LLPanelPlaceProfile>("panel_place_profile"); - mLandmarkInfo = getChild<LLPanelLandmarkInfo>("panel_landmark_info"); - if (!mPlaceProfile || !mLandmarkInfo) - return FALSE; + mPlaceInfo = getChild<LLPanelPlaceInfo>("panel_place_info"); - LLButton* back_btn = mPlaceProfile->getChild<LLButton>("back_btn"); + LLButton* back_btn = mPlaceInfo->getChild<LLButton>("back_btn"); back_btn->setClickedCallback(boost::bind(&LLPanelPlaces::onBackButtonClicked, this)); - back_btn = mLandmarkInfo->getChild<LLButton>("back_btn"); - back_btn->setClickedCallback(boost::bind(&LLPanelPlaces::onBackButtonClicked, this)); - - LLLineEditor* title_editor = mLandmarkInfo->getChild<LLLineEditor>("title_editor"); + LLLineEditor* title_editor = mPlaceInfo->getChild<LLLineEditor>("title_editor"); title_editor->setKeystrokeCallback(boost::bind(&LLPanelPlaces::onEditButtonClicked, this), NULL); - LLTextEditor* notes_editor = mLandmarkInfo->getChild<LLTextEditor>("notes_editor"); + LLTextEditor* notes_editor = mPlaceInfo->getChild<LLTextEditor>("notes_editor"); notes_editor->setKeystrokeCallback(boost::bind(&LLPanelPlaces::onEditButtonClicked, this)); - LLComboBox* folder_combo = mLandmarkInfo->getChild<LLComboBox>("folder_combo"); + LLComboBox* folder_combo = mPlaceInfo->getChild<LLComboBox>("folder_combo"); folder_combo->setSelectionCallback(boost::bind(&LLPanelPlaces::onEditButtonClicked, this)); - return TRUE; } void LLPanelPlaces::onOpen(const LLSD& key) { - if(!mPlaceProfile || !mLandmarkInfo || key.size() == 0) + if(mPlaceInfo == NULL || key.size() == 0) return; mFilterEditor->clear(); @@ -248,11 +239,11 @@ void LLPanelPlaces::onOpen(const LLSD& key) if (mPlaceInfoType == AGENT_INFO_TYPE) { - mPlaceProfile->setInfoType(LLPanelPlaceInfo::AGENT); + mPlaceInfo->setInfoType(LLPanelPlaceInfo::AGENT); } else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE) { - mLandmarkInfo->setInfoType(LLPanelPlaceInfo::CREATE_LANDMARK); + mPlaceInfo->setInfoType(LLPanelPlaceInfo::CREATE_LANDMARK); if (key.has("x") && key.has("y") && key.has("z")) { @@ -265,11 +256,11 @@ void LLPanelPlaces::onOpen(const LLSD& key) mPosGlobal = gAgent.getPositionGlobal(); } - mLandmarkInfo->displayParcelInfo(LLUUID(), mPosGlobal); + mPlaceInfo->displayParcelInfo(LLUUID(), mPosGlobal); } else if (mPlaceInfoType == LANDMARK_INFO_TYPE) { - mLandmarkInfo->setInfoType(LLPanelPlaceInfo::LANDMARK); + mPlaceInfo->setInfoType(LLPanelPlaceInfo::LANDMARK); LLInventoryItem* item = gInventory.getItem(key["id"].asUUID()); if (!item) @@ -279,12 +270,17 @@ void LLPanelPlaces::onOpen(const LLSD& key) } else if (mPlaceInfoType == REMOTE_PLACE_INFO_TYPE) { + if (mPlaceInfo->isMediaPanelVisible()) + { + toggleMediaPanel(); + } + mPosGlobal = LLVector3d(key["x"].asReal(), key["y"].asReal(), key["z"].asReal()); - mPlaceProfile->setInfoType(LLPanelPlaceInfo::PLACE); - mPlaceProfile->displayParcelInfo(LLUUID(), mPosGlobal); + mPlaceInfo->setInfoType(LLPanelPlaceInfo::PLACE); + mPlaceInfo->displayParcelInfo(LLUUID(), mPosGlobal); } else if (mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE) { @@ -295,9 +291,9 @@ void LLPanelPlaces::onOpen(const LLSD& key) mPosGlobal = hist_items[index].mGlobalPos; - mPlaceProfile->setInfoType(LLPanelPlaceInfo::TELEPORT_HISTORY); - mPlaceProfile->updateLastVisitedText(hist_items[index].mDate); - mPlaceProfile->displayParcelInfo(LLUUID(), mPosGlobal); + mPlaceInfo->setInfoType(LLPanelPlaceInfo::TELEPORT_HISTORY); + mPlaceInfo->updateLastVisitedText(hist_items[index].mDate); + mPlaceInfo->displayParcelInfo(LLUUID(), mPosGlobal); } LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance(); @@ -325,7 +321,7 @@ void LLPanelPlaces::onOpen(const LLSD& key) void LLPanelPlaces::setItem(LLInventoryItem* item) { - if (!mLandmarkInfo || !item) + if (!mPlaceInfo || !item) return; mItem = item; @@ -355,19 +351,19 @@ void LLPanelPlaces::setItem(LLInventoryItem* item) if (is_landmark_editable) { - if(!mLandmarkInfo->setLandmarkFolder(mItem->getParentUUID()) && !mItem->getParentUUID().isNull()) + if(!mPlaceInfo->setLandmarkFolder(mItem->getParentUUID()) && !mItem->getParentUUID().isNull()) { const LLViewerInventoryCategory* cat = gInventory.getCategory(mItem->getParentUUID()); - if (cat) + if(cat) { - std::string cat_fullname = LLPanelLandmarkInfo::getFullFolderName(cat); - LLComboBox* folderList = mLandmarkInfo->getChild<LLComboBox>("folder_combo"); - folderList->add(cat_fullname, cat->getUUID(), ADD_TOP); + std::string cat_fullname = LLPanelPlaceInfo::getFullFolderName(cat); + LLComboBox* folderList = mPlaceInfo->getChild<LLComboBox>("folder_combo"); + folderList->add(cat_fullname, cat->getUUID(),ADD_TOP); } } } - mLandmarkInfo->displayItemInfo(mItem); + mPlaceInfo->displayItemInfo(mItem); LLLandmark* lm = gLandmarkList.getAsset(mItem->getAssetUUID(), boost::bind(&LLPanelPlaces::onLandmarkLoaded, this, _1)); @@ -379,13 +375,13 @@ void LLPanelPlaces::setItem(LLInventoryItem* item) void LLPanelPlaces::onLandmarkLoaded(LLLandmark* landmark) { - if (!mLandmarkInfo) + if (!mPlaceInfo) return; LLUUID region_id; landmark->getRegionID(region_id); landmark->getGlobalPos(mPosGlobal); - mLandmarkInfo->displayParcelInfo(region_id, mPosGlobal); + mPlaceInfo->displayParcelInfo(region_id, mPosGlobal); } void LLPanelPlaces::onFilterEdit(const std::string& search_string, bool force_filter) @@ -422,8 +418,10 @@ void LLPanelPlaces::onShareButtonClicked() void LLPanelPlaces::onTeleportButtonClicked() { - LLPanelPlaceInfo* panel = getCurrentInfoPanel(); - if (panel && panel->getVisible()) + if (!mPlaceInfo) + return; + + if (mPlaceInfo->getVisible()) { if (mPlaceInfoType == LANDMARK_INFO_TYPE) { @@ -452,8 +450,10 @@ void LLPanelPlaces::onTeleportButtonClicked() void LLPanelPlaces::onShowOnMapButtonClicked() { - LLPanelPlaceInfo* panel = getCurrentInfoPanel(); - if (panel && panel->getVisible()) + if (!mPlaceInfo) + return; + + if (mPlaceInfo->getVisible()) { LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance(); if(!worldmap_instance) @@ -496,31 +496,31 @@ void LLPanelPlaces::onShowOnMapButtonClicked() void LLPanelPlaces::onEditButtonClicked() { - if (!mLandmarkInfo || isLandmarkEditModeOn) + if (!mPlaceInfo || isLandmarkEditModeOn) return; isLandmarkEditModeOn = true; - mLandmarkInfo->toggleLandmarkEditMode(TRUE); + mPlaceInfo->toggleLandmarkEditMode(TRUE); updateVerbs(); } void LLPanelPlaces::onSaveButtonClicked() { - if (!mLandmarkInfo || mItem.isNull()) + if (!mPlaceInfo || mItem.isNull()) return; - std::string current_title_value = mLandmarkInfo->getLandmarkTitle(); + std::string current_title_value = mPlaceInfo->getLandmarkTitle(); std::string item_title_value = mItem->getName(); - std::string current_notes_value = mLandmarkInfo->getLandmarkNotes(); + std::string current_notes_value = mPlaceInfo->getLandmarkNotes(); std::string item_notes_value = mItem->getDescription(); LLStringUtil::trim(current_title_value); LLStringUtil::trim(current_notes_value); LLUUID item_id = mItem->getUUID(); - LLUUID folder_id = mLandmarkInfo->getLandmarkFolder(); + LLUUID folder_id = mPlaceInfo->getLandmarkFolder(); LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(mItem); @@ -553,7 +553,7 @@ void LLPanelPlaces::onSaveButtonClicked() void LLPanelPlaces::onCancelButtonClicked() { - if (!mLandmarkInfo) + if (!mPlaceInfo) return; if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE) @@ -562,13 +562,13 @@ void LLPanelPlaces::onCancelButtonClicked() } else { - mLandmarkInfo->toggleLandmarkEditMode(FALSE); + mPlaceInfo->toggleLandmarkEditMode(FALSE); isLandmarkEditModeOn = false; updateVerbs(); // Reload the landmark properties. - mLandmarkInfo->displayItemInfo(mItem); + mPlaceInfo->displayItemInfo(mItem); } } @@ -597,7 +597,7 @@ void LLPanelPlaces::onOverflowButtonClicked() if (mItem.notNull()) { const LLUUID& item_id = mItem->getUUID(); - const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + const LLUUID& trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); is_landmark_removable = gInventory.isObjectDescendentOf(item_id, gInventory.getRootFolderID()) && !gInventory.isObjectDescendentOf(item_id, trash_id); } @@ -652,6 +652,9 @@ void LLPanelPlaces::onOverflowMenuItemClicked(const LLSD& param) } else if (item == "pick") { + if (!mPlaceInfo) + return; + if (mPickPanel == NULL) { mPickPanel = LLPanelPickEdit::create(); @@ -664,12 +667,7 @@ void LLPanelPlaces::onOverflowMenuItemClicked(const LLSD& param) togglePickPanel(TRUE); mPickPanel->onOpen(LLSD()); - - LLPanelPlaceInfo* panel = getCurrentInfoPanel(); - if (panel) - { - panel->createPick(mPosGlobal, mPickPanel); - } + mPlaceInfo->createPick(mPosGlobal, mPickPanel); LLRect rect = getRect(); mPickPanel->reshape(rect.getWidth(), rect.getHeight()); @@ -679,7 +677,7 @@ void LLPanelPlaces::onOverflowMenuItemClicked(const LLSD& param) { if ( mItem.notNull() ) { - const LLUUID& favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); + LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_FAVORITE); if ( favorites_id.notNull() ) { copy_inventory_item(gAgent.getID(), @@ -696,16 +694,39 @@ void LLPanelPlaces::onOverflowMenuItemClicked(const LLSD& param) void LLPanelPlaces::onBackButtonClicked() { - togglePlaceInfoPanel(FALSE); + if (!mPlaceInfo) + return; + + if (mPlaceInfo->isMediaPanelVisible()) + { + toggleMediaPanel(); + } + else + { + togglePlaceInfoPanel(FALSE); - // Resetting mPlaceInfoType when Place Info panel is closed. - mPlaceInfoType = LLStringUtil::null; + // Resetting mPlaceInfoType when Place Info panel is closed. + mPlaceInfoType = LLStringUtil::null; - isLandmarkEditModeOn = false; + isLandmarkEditModeOn = false; + } updateVerbs(); } +void LLPanelPlaces::toggleMediaPanel() +{ + if (!mPlaceInfo) + return; + + mPlaceInfo->toggleMediaPanel(!mPlaceInfo->isMediaPanelVisible()); + + // Refresh the current place info because + // the media panel controls can't refer to + // the remote parcel media. + onOpen(LLSD().insert("type", AGENT_INFO_TYPE)); +} + void LLPanelPlaces::togglePickPanel(BOOL visible) { setAllChildrenVisible(this, !visible); @@ -716,50 +737,26 @@ void LLPanelPlaces::togglePickPanel(BOOL visible) void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible) { - if (!mPlaceProfile || !mLandmarkInfo) + if (!mPlaceInfo) return; + mPlaceInfo->setVisible(visible); mFilterEditor->setVisible(!visible); mTabContainer->setVisible(!visible); - if (mPlaceInfoType == AGENT_INFO_TYPE || - mPlaceInfoType == REMOTE_PLACE_INFO_TYPE || - mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE) + if (visible) { - mPlaceProfile->setVisible(visible); + mPlaceInfo->resetLocation(); - if (visible) - { - mPlaceProfile->resetLocation(); - - LLRect rect = getRect(); - LLRect new_rect = LLRect(rect.mLeft, rect.mTop, rect.mRight, mTabContainer->getRect().mBottom); - mPlaceProfile->reshape(new_rect.getWidth(), new_rect.getHeight()); - - mLandmarkInfo->setVisible(FALSE); - } - } - else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE || - mPlaceInfoType == LANDMARK_INFO_TYPE) - { - mLandmarkInfo->setVisible(visible); - - if (visible) - { - mLandmarkInfo->resetLocation(); - - LLRect rect = getRect(); - LLRect new_rect = LLRect(rect.mLeft, rect.mTop, rect.mRight, mTabContainer->getRect().mBottom); - mLandmarkInfo->reshape(new_rect.getWidth(), new_rect.getHeight()); - - mPlaceProfile->setVisible(FALSE); - } + LLRect rect = getRect(); + LLRect new_rect = LLRect(rect.mLeft, rect.mTop, rect.mRight, mTabContainer->getRect().mBottom); + mPlaceInfo->reshape(new_rect.getWidth(),new_rect.getHeight()); } } void LLPanelPlaces::changedParcelSelection() { - if (!mPlaceProfile) + if (!mPlaceInfo) return; LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance(); @@ -785,8 +782,8 @@ void LLPanelPlaces::changedParcelSelection() } } - mPlaceProfile->resetLocation(); - mPlaceProfile->displaySelectedParcelInfo(parcel, region, mPosGlobal, is_current_parcel); + mPlaceInfo->resetLocation(); + mPlaceInfo->displaySelectedParcelInfo(parcel, region, mPosGlobal, is_current_parcel); updateVerbs(); } @@ -833,22 +830,30 @@ void LLPanelPlaces::changedInventory(U32 mask) gInventory.removeObserver(mInventoryObserver); } -void LLPanelPlaces::updateVerbs() +void LLPanelPlaces::onAgentParcelChange() { - bool is_place_info_visible; + if (!mPlaceInfo) + return; - LLPanelPlaceInfo* panel = getCurrentInfoPanel(); - if (panel) + if (mPlaceInfo->isMediaPanelVisible()) { - is_place_info_visible = panel->getVisible(); + onOpen(LLSD().insert("type", AGENT_INFO_TYPE)); } else { - is_place_info_visible = false; + updateVerbs(); } +} +void LLPanelPlaces::updateVerbs() +{ + if (!mPlaceInfo) + return; + + bool is_place_info_visible = mPlaceInfo->getVisible(); bool is_agent_place_info_visible = mPlaceInfoType == AGENT_INFO_TYPE; bool is_create_landmark_visible = mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE; + bool is_media_panel_visible = mPlaceInfo->isMediaPanelVisible(); mTeleportBtn->setVisible(!is_create_landmark_visible && !isLandmarkEditModeOn); mShowOnMapBtn->setVisible(!is_create_landmark_visible && !isLandmarkEditModeOn); @@ -859,7 +864,7 @@ void LLPanelPlaces::updateVerbs() mCancelBtn->setVisible(isLandmarkEditModeOn); mCloseBtn->setVisible(is_create_landmark_visible && !isLandmarkEditModeOn); - mOverflowBtn->setEnabled(is_place_info_visible && !is_create_landmark_visible); + mOverflowBtn->setEnabled(is_place_info_visible && !is_media_panel_visible && !is_create_landmark_visible); if (is_place_info_visible) { @@ -867,13 +872,16 @@ void LLPanelPlaces::updateVerbs() { // We don't need to teleport to the current location // so check if the location is not within the current parcel. - mTeleportBtn->setEnabled(!mPosGlobal.isExactlyZero() && + mTeleportBtn->setEnabled(!is_media_panel_visible && + !mPosGlobal.isExactlyZero() && !LLViewerParcelMgr::getInstance()->inAgentParcel(mPosGlobal)); } else if (mPlaceInfoType == LANDMARK_INFO_TYPE || mPlaceInfoType == REMOTE_PLACE_INFO_TYPE) { mTeleportBtn->setEnabled(TRUE); } + + mShowOnMapBtn->setEnabled(!is_media_panel_visible); } else { @@ -882,23 +890,6 @@ void LLPanelPlaces::updateVerbs() } } -LLPanelPlaceInfo* LLPanelPlaces::getCurrentInfoPanel() -{ - if (mPlaceInfoType == AGENT_INFO_TYPE || - mPlaceInfoType == REMOTE_PLACE_INFO_TYPE || - mPlaceInfoType == TELEPORT_HISTORY_INFO_TYPE) - { - return mPlaceProfile; - } - else if (mPlaceInfoType == CREATE_LANDMARK_INFO_TYPE || - mPlaceInfoType == LANDMARK_INFO_TYPE) - { - return mLandmarkInfo; - } - - return NULL; -} - static bool is_agent_in_selected_parcel(LLParcel* parcel) { LLViewerParcelMgr* parcel_mgr = LLViewerParcelMgr::getInstance(); |
