llfloaterurldisplay.cpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /**
  2. * @file llfloaterurldisplay.h
  3. * @brief Probably should be called LLFloaterTeleport, or LLFloaterLandmark
  4. * as it gives you a preview of a potential teleport location.
  5. *
  6. * $LicenseInfo:firstyear=2007&license=viewergpl$
  7. *
  8. * Copyright (c) 2007-2009, Linden Research, Inc.
  9. *
  10. * Second Life Viewer Source Code
  11. * The source code in this file ("Source Code") is provided by Linden Lab
  12. * to you under the terms of the GNU General Public License, version 2.0
  13. * ("GPL"), unless you have obtained a separate licensing agreement
  14. * ("Other License"), formally executed by you and Linden Lab. Terms of
  15. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  16. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  17. *
  18. * There are special exceptions to the terms and conditions of the GPL as
  19. * it is applied to this Source Code. View the full text of the exception
  20. * in the file doc/FLOSS-exception.txt in this software distribution, or
  21. * online at
  22. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  23. *
  24. * By copying, modifying or distributing this software, you acknowledge
  25. * that you have read and understood your obligations described above,
  26. * and agree to abide by those obligations.
  27. *
  28. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  29. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  30. * COMPLETENESS OR PERFORMANCE.
  31. * $/LicenseInfo$
  32. */
  33. #include "llviewerprecompiledheaders.h"
  34. #include "llfloaterurldisplay.h"
  35. #include "llpanelplace.h"
  36. #include "llregionhandle.h"
  37. #include "lluictrlfactory.h"
  38. LLFloaterURLDisplay::LLFloaterURLDisplay(const LLSD& sd)
  39. {
  40. mFactoryMap["place_details_panel"] = LLCallbackMap(LLFloaterURLDisplay::createPlaceDetail,
  41. this);
  42. LLUICtrlFactory::getInstance()->buildFloater(this,
  43. "floater_preview_url.xml",
  44. &getFactoryMap());
  45. this->setVisible(false);
  46. // If positioned at 0,0 the teleport button is behind the toolbar.
  47. LLRect r = getRect();
  48. if (r.mBottom == 0 && r.mLeft == 0)
  49. {
  50. // first use, center it
  51. center();
  52. }
  53. else
  54. {
  55. gFloaterViewp->adjustToFitScreen(this);
  56. }
  57. }
  58. void LLFloaterURLDisplay::displayParcelInfo(U64 region_handle,
  59. const LLVector3& pos_local)
  60. {
  61. mRegionHandle = region_handle;
  62. mRegionPosition = pos_local;
  63. LLVector3d pos_global = from_region_handle(region_handle);
  64. pos_global += (LLVector3d)pos_local;
  65. LLUUID region_id; // don't know this
  66. LLUUID landmark_asset_id; // don't know this either
  67. LLUUID landmark_item_id; // don't know this either
  68. mPlacePanel->displayParcelInfo(pos_local, landmark_asset_id,
  69. landmark_item_id, region_id, pos_global);
  70. this->setVisible(true);
  71. this->setFrontmost(true);
  72. }
  73. void LLFloaterURLDisplay::setSnapshotDisplay(const LLUUID& snapshot_id)
  74. {
  75. mPlacePanel->setSnapshot(snapshot_id);
  76. }
  77. void LLFloaterURLDisplay::setName(const std::string& name)
  78. { // Set the name and also clear description
  79. mPlacePanel->resetName(name);
  80. }
  81. void LLFloaterURLDisplay::setLocationString(const std::string& name)
  82. {
  83. mPlacePanel->setLocationString(name);
  84. }
  85. // static
  86. void* LLFloaterURLDisplay::createPlaceDetail(void* userdata)
  87. {
  88. LLFloaterURLDisplay *self = (LLFloaterURLDisplay*)userdata;
  89. self->mPlacePanel = new LLPanelPlace();
  90. LLUICtrlFactory::getInstance()->buildPanel(self->mPlacePanel,
  91. "panel_place.xml");
  92. return self->mPlacePanel;
  93. }