diff options
author | Steven Bennetts <steve@lindenlab.com> | 2009-10-19 02:17:01 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2009-10-19 02:17:01 +0000 |
commit | ea1bfae838c59e24ec1a962f7d015d609b63d083 (patch) | |
tree | 4fb1bc94522313df13a6d329cd8fef29d099a46d /indra/newview/llpanelpicks.cpp | |
parent | 8103710c054ec6ea4a46f9732e569e543691184b (diff) |
Merging revisions 2070-2084 of https://svn.aws.productengine.com/secondlife/pe/stable-2 into P:\svn\viewer-2.0.0, respecting ancestry
* Bugs: EXT-792 EXT-1519 EXT-1514 EXT-1245 EXT-1600 EXT-1535 EXT-1174 EXT-1241
* Dev: EXT-1271 EXT-1601 EXT-1154
Diffstat (limited to 'indra/newview/llpanelpicks.cpp')
-rw-r--r-- | indra/newview/llpanelpicks.cpp | 165 |
1 files changed, 122 insertions, 43 deletions
diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 979e9618da..073da5cc06 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -35,6 +35,8 @@ #include "llagent.h" #include "llavatarconstants.h" #include "llflatlistview.h" +#include "llfloaterreg.h" +#include "llfloaterworldmap.h" #include "lltexturectrl.h" #include "llviewergenericmessage.h" // send_generic_message #include "llmenugl.h" @@ -69,6 +71,8 @@ LLPanelPicks::LLPanelPicks() mProfilePanel(NULL), mPickPanel(NULL), mPicksList(NULL) + , mPanelPickInfo(NULL) + , mPanelPickEdit(NULL) { } @@ -197,7 +201,7 @@ void LLPanelPicks::onOpen(const LLSD& key) mPopupMenu->setItemVisible("pick_separator", TRUE); } - if(getAvatarId() != key.asUUID()) + if(getAvatarId() != id) { mPicksList->goToTop(); } @@ -247,7 +251,13 @@ void LLPanelPicks::onClickTeleport() { LLPickItem* pick_item = getSelectedPickItem(); if (!pick_item) return; - LLPanelPick::teleport(pick_item->getPosGlobal()); + + LLVector3d pos = pick_item->getPosGlobal(); + if (!pos.isExactlyZero()) + { + gAgent.teleportViaLocation(pos); + LLFloaterWorldMap::getInstance()->trackLocation(pos); + } } //static @@ -255,7 +265,9 @@ void LLPanelPicks::onClickMap() { LLPickItem* pick_item = getSelectedPickItem(); if (!pick_item) return; - LLPanelPick::showOnMap(pick_item->getPosGlobal()); + + LLFloaterWorldMap::getInstance()->trackLocation(pick_item->getPosGlobal()); + LLFloaterReg::showInstance("world_map", "center"); } @@ -308,19 +320,18 @@ void LLPanelPicks::setProfilePanel(LLPanelProfile* profile_panel) void LLPanelPicks::buildPickPanel() { - if (mPickPanel == NULL) - { - mPickPanel = new LLPanelPick(); - mPickPanel->setExitCallback(boost::bind(&LLPanelPicks::onClickBack, this)); - } +// if (mPickPanel == NULL) +// { +// mPickPanel = new LLPanelPick(); +// mPickPanel->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, NULL)); +// } } void LLPanelPicks::onClickNew() { - buildPickPanel(); - mPickPanel->setEditMode(TRUE); - mPickPanel->prepareNewPick(); - getProfilePanel()->togglePanel(mPickPanel); + createPickEditPanel(); + + getProfilePanel()->openPanel(mPanelPickEdit, LLSD()); } void LLPanelPicks::onClickInfo() @@ -328,28 +339,98 @@ void LLPanelPicks::onClickInfo() LLSD selected_value = mPicksList->getSelectedValue(); if (selected_value.isUndefined()) return; - buildPickPanel(); - mPickPanel->reset(); - mPickPanel->init(selected_value[PICK_CREATOR_ID], selected_value[PICK_ID]); - getProfilePanel()->togglePanel(mPickPanel); + LLPickItem* pick = (LLPickItem*)mPicksList->getSelectedItem(); + + createPickInfoPanel(); + + LLSD params; + params["pick_id"] = pick->getPickId(); + params["avatar_id"] = pick->getCreatorId(); + params["snapshot_id"] = pick->getSnapshotId(); + params["pick_name"] = pick->getPickName(); + params["pick_desc"] = pick->getPickDesc(); + + getProfilePanel()->openPanel(mPanelPickInfo, params); } -void LLPanelPicks::onClickBack() +void LLPanelPicks::onPanelPickClose(LLPanel* panel) { - getProfilePanel()->togglePanel(mPickPanel); + panel->setVisible(FALSE); } -void LLPanelPicks::onClickMenuEdit() +void LLPanelPicks::createPickInfoPanel() +{ + if(!mPanelPickInfo) + { + mPanelPickInfo = LLPanelPickInfo::create(); + mPanelPickInfo->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelPickInfo)); + mPanelPickInfo->setEditPickCallback(boost::bind(&LLPanelPicks::onPanelPickEdit, this)); + mPanelPickInfo->setVisible(FALSE); + } +} + +void LLPanelPicks::createPickEditPanel() +{ + if(!mPanelPickEdit) + { + mPanelPickEdit = LLPanelPickEdit::create(); + mPanelPickEdit->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelPickEdit)); + mPanelPickEdit->setSaveCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelPickEdit)); + mPanelPickEdit->setCancelCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelPickEdit)); + mPanelPickEdit->setVisible(FALSE); + } +} + +// void LLPanelPicks::openPickEditPanel(LLPickItem* pick) +// { +// if(!pick) +// { +// return; +// } +// } + +// void LLPanelPicks::openPickInfoPanel(LLPickItem* pick) +// { +// if(!mPanelPickInfo) +// { +// mPanelPickInfo = LLPanelPickInfo::create(); +// mPanelPickInfo->setExitCallback(boost::bind(&LLPanelPicks::onPanelPickClose, this, mPanelPickInfo)); +// mPanelPickInfo->setEditPickCallback(boost::bind(&LLPanelPicks::onPanelPickEdit, this)); +// mPanelPickInfo->setVisible(FALSE); +// } +// +// LLSD params; +// params["pick_id"] = pick->getPickId(); +// params["avatar_id"] = pick->getCreatorId(); +// params["snapshot_id"] = pick->getSnapshotId(); +// params["pick_name"] = pick->getPickName(); +// params["pick_desc"] = pick->getPickDesc(); +// +// getProfilePanel()->openPanel(mPanelPickInfo, params); +// } + +void LLPanelPicks::onPanelPickEdit() { - //*TODO, refactor - most of that is similar to onClickInfo LLSD selected_value = mPicksList->getSelectedValue(); if (selected_value.isUndefined()) return; - buildPickPanel(); - mPickPanel->reset(); - mPickPanel->init(selected_value[PICK_CREATOR_ID], selected_value[PICK_ID]); - mPickPanel->setEditMode(TRUE); - getProfilePanel()->togglePanel(mPickPanel); + LLPickItem* pick = dynamic_cast<LLPickItem*>(mPicksList->getSelectedItem()); + + createPickEditPanel(); + + LLSD params; + params["pick_id"] = pick->getPickId(); + params["avatar_id"] = pick->getCreatorId(); + params["snapshot_id"] = pick->getSnapshotId(); + params["pick_name"] = pick->getPickName(); + params["pick_desc"] = pick->getPickDesc(); + + getProfilePanel()->openPanel(mPanelPickEdit, params); +} + +void LLPanelPicks::onClickMenuEdit() +{ + onPanelPickEdit(); } inline LLPanelProfile* LLPanelPicks::getProfilePanel() @@ -391,6 +472,10 @@ void LLPickItem::init(LLPickData* pick_data) setPickDesc(pick_data->desc); setSnapshotId(pick_data->snapshot_id); mPosGlobal = pick_data->pos_global; + mSimName = pick_data->sim_name; + mPickDescription = pick_data->desc; + mUserName = pick_data->user_name; + mOriginalName = pick_data->original_name; LLTextureCtrl* picture = getChild<LLTextureCtrl>("picture"); picture->setImageAssetID(pick_data->snapshot_id); @@ -445,38 +530,32 @@ const std::string LLPickItem::getDescription() void LLPickItem::update() { - mNeedData = true; + setNeedData(true); LLAvatarPropertiesProcessor::instance().sendPickInfoRequest(mCreatorID, mPickID); - mNeedData = false; } void LLPickItem::processProperties(void *data, EAvatarProcessorType type) { - if (APT_PICK_INFO != type) return; - if (!data) return; + if (APT_PICK_INFO != type) + { + return; + } LLPickData* pick_data = static_cast<LLPickData *>(data); - if (!pick_data) return; - if (mPickID != pick_data->pick_id) return; + if (!pick_data || mPickID != pick_data->pick_id) + { + return; + } init(pick_data); + setNeedData(false); LLAvatarPropertiesProcessor::instance().removeObserver(mCreatorID, this); } -// virtual -void LLPanelPicks::onClosePanel() -{ - // Toggle off Pick Info panel if it is visible. - if(mPickPanel && mPickPanel->getVisible()) - { - getProfilePanel()->togglePanel(mPickPanel); - } -} - BOOL LLPickItem::postBuild() { - setMouseEnterCallback(boost::bind(&LLPanelPick::childSetVisible, this, "hovered_icon", true)); - setMouseLeaveCallback(boost::bind(&LLPanelPick::childSetVisible, this, "hovered_icon", false)); + setMouseEnterCallback(boost::bind(&LLPanelPickInfo::childSetVisible, this, "hovered_icon", true)); + setMouseLeaveCallback(boost::bind(&LLPanelPickInfo::childSetVisible, this, "hovered_icon", false)); return TRUE; } |