00001 00033 #include "llviewerprecompiledheaders.h" 00034 00035 #include "llfloaterurldisplay.h" 00036 00037 #include "llpanelplace.h" 00038 #include "lluictrlfactory.h" 00039 00040 #include "v3dmath.h" 00041 00043 // LLFloaterURLDisplay 00044 00045 00046 LLFloaterURLDisplay::LLFloaterURLDisplay(const LLSD& sd) 00047 { 00048 mFactoryMap["place_details_panel"] = LLCallbackMap(LLFloaterURLDisplay::createPlaceDetail, this); 00049 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_url.xml", &getFactoryMap()); 00050 this->setVisible(false); 00051 00052 // If positioned at 0,0 the teleport button is behind the toolbar. 00053 LLRect r = getRect(); 00054 if (r.mBottom == 0 && r.mLeft == 0) 00055 { 00056 // first use, center it 00057 center(); 00058 } 00059 else 00060 { 00061 gFloaterView->adjustToFitScreen(this, FALSE); 00062 } 00063 } 00064 00065 LLFloaterURLDisplay::~LLFloaterURLDisplay() 00066 { 00067 } 00068 00069 void LLFloaterURLDisplay::displayParcelInfo(U64 region_handle, const LLVector3& pos_local) 00070 { 00071 mRegionHandle = region_handle; 00072 mRegionPosition = pos_local; 00073 LLVector3d pos_global = from_region_handle(region_handle); 00074 pos_global += (LLVector3d)pos_local; 00075 00076 LLUUID region_id; // don't know this 00077 LLUUID landmark_asset_id; // don't know this either 00078 mPlacePanel->displayParcelInfo(pos_local, landmark_asset_id, region_id, pos_global); 00079 00080 this->setVisible(true); 00081 this->setFrontmost(true); 00082 } 00083 00084 void LLFloaterURLDisplay::setSnapshotDisplay(const LLUUID& snapshot_id) 00085 { 00086 mPlacePanel->setSnapshot(snapshot_id); 00087 } 00088 00089 void LLFloaterURLDisplay::setName(const std::string& name) 00090 { 00091 mPlacePanel->setName(name); 00092 } 00093 00094 void LLFloaterURLDisplay::setLocationString(const std::string& name) 00095 { 00096 mPlacePanel->setLocationString(name); 00097 } 00098 00099 // static 00100 void* LLFloaterURLDisplay::createPlaceDetail(void* userdata) 00101 { 00102 LLFloaterURLDisplay *self = (LLFloaterURLDisplay*)userdata; 00103 self->mPlacePanel = new LLPanelPlace(); 00104 LLUICtrlFactory::getInstance()->buildPanel(self->mPlacePanel, "panel_place.xml"); 00105 00106 return self->mPlacePanel; 00107 }