aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpreviewlandmark.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llpreviewlandmark.cpp103
1 files changed, 27 insertions, 76 deletions
diff --git a/linden/indra/newview/llpreviewlandmark.cpp b/linden/indra/newview/llpreviewlandmark.cpp
index ac1bd3f..2d20fd5 100644
--- a/linden/indra/newview/llpreviewlandmark.cpp
+++ b/linden/indra/newview/llpreviewlandmark.cpp
@@ -48,6 +48,7 @@
48#include "lliconctrl.h" 48#include "lliconctrl.h"
49#include "lllandmarklist.h" 49#include "lllandmarklist.h"
50#include "lllineeditor.h" 50#include "lllineeditor.h"
51#include "llpanelplace.h"
51#include "llresmgr.h" 52#include "llresmgr.h"
52#include "llstatusbar.h" 53#include "llstatusbar.h"
53#include "lltextbox.h" 54#include "lltextbox.h"
@@ -89,26 +90,14 @@ LLPreviewLandmark::LLPreviewLandmark(const std::string& name,
89 mLandmark( NULL ) 90 mLandmark( NULL )
90{ 91{
91 92
92 if (show_keep_discard) 93 mFactoryMap["place_details_panel"] = LLCallbackMap(LLPreviewLandmark::createPlaceDetail, this);
93 { 94 gUICtrlFactory->buildFloater(this, "floater_preview_existing_landmark.xml", &getFactoryMap());
94 gUICtrlFactory->buildFloater(this,"floater_preview_new_landmark.xml");
95 childSetAction("Discard btn",onDiscardBtn,this);
96 }
97 else
98 {
99 gUICtrlFactory->buildFloater(this,"floater_preview_existing_landmark.xml");
100 childSetVisible("desc txt", FALSE);
101 childSetEnabled("desc", FALSE);
102 }
103
104 childSetAction("Teleport btn", onTeleportBtn,this);
105 childSetAction("Show on Map btn", onMapBtn,this);
106 95
107 const LLInventoryItem* item = getItem(); 96 /*
108 97 childSetCommitCallback("desc_editor", LLPreview::onText, this);
109 childSetCommitCallback("desc", LLPreview::onText, this); 98 childSetText("desc_editor", item->getDescription());
110 childSetText("desc", item->getDescription()); 99 childSetText("name_editor", item->getName());
111 childSetPrevalidate("desc", &LLLineEditor::prevalidatePrintableNotPipe); 100 childSetPrevalidate("desc_editor", &LLLineEditor::prevalidatePrintableNotPipe);
112 101
113 setTitle(title); 102 setTitle(title);
114 103
@@ -117,45 +106,10 @@ LLPreviewLandmark::LLPreviewLandmark(const std::string& name,
117 LLRect curRect = getRect(); 106 LLRect curRect = getRect();
118 translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop); 107 translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop);
119 } 108 }
120 109 */
121 LLPreviewLandmark::sOrderedInstances.push_back( this ); 110 LLPreviewLandmark::sOrderedInstances.push_back( this );
122} 111}
123 112
124// static
125void LLPreviewLandmark::onMapBtn( void* userdata )
126{
127 LLPreviewLandmark* self = (LLPreviewLandmark*) userdata;
128 gFocusMgr.setKeyboardFocus(NULL, NULL);
129
130 if( gFloaterWorldMap )
131 {
132 gFloaterWorldMap->trackLandmark( self->mItemUUID );
133 LLFloaterWorldMap::show(NULL, TRUE);
134
135 self->close();
136 }
137}
138
139// static
140void LLPreviewLandmark::onTeleportBtn( void* userdata )
141{
142 LLPreviewLandmark* self = (LLPreviewLandmark*) userdata;
143 gFocusMgr.setKeyboardFocus(NULL, NULL);
144
145 const LLInventoryItem *item = self->getItem();
146 if(item)
147 {
148 gAgent.teleportViaLandmark(item->getAssetUUID());
149
150 // we now automatically track the landmark you're teleporting to
151 // because you'll probably arrive at a telehub instead
152 if( gFloaterWorldMap )
153 {
154 gFloaterWorldMap->trackLandmark( self->mItemUUID );
155 }
156 }
157 self->close();
158}
159 113
160LLPreviewLandmark::~LLPreviewLandmark() 114LLPreviewLandmark::~LLPreviewLandmark()
161{ 115{
@@ -222,31 +176,17 @@ void LLPreviewLandmark::draw()
222 if( item && !mLandmark ) 176 if( item && !mLandmark )
223 { 177 {
224 mLandmark = gLandmarkList.getAsset( item->getAssetUUID() ); 178 mLandmark = gLandmarkList.getAsset( item->getAssetUUID() );
225 } 179 if(mLandmark && mPlacePanel)
226
227 if(mLandmark)
228 {
229 F32 degrees = 0;
230 F64 horiz_dist = 0;
231 F64 vert_dist = 0;
232 getDegreesAndDist( &degrees, &horiz_dist, &vert_dist);
233 S32 offset = 180 + (360/16);
234 if( S32(degrees) + offset >= 360 )
235 { 180 {
236 offset -= 360; 181 LLVector3 pos_region = mLandmark->getRegionPos(); // always have this
182 LLUUID landmark_asset_id = item->getAssetUUID(); // always have this
183 LLUUID region_id;
184 mLandmark->getRegionID(region_id); // might find null?
185 LLVector3d pos_global = getPositionGlobal(); // might be 0
186 mPlacePanel->displayParcelInfo(pos_region, landmark_asset_id, region_id, pos_global);
237 } 187 }
238#if _DEBUG
239 S32 dir_index = (S32(degrees) + offset) / (360/8);
240 llassert( 0 <= dir_index && dir_index <= 7 );
241#endif
242 // See also llfloatermap.cpp -> onLandmarkGo
243
244 childSetEnabled("Teleport btn", TRUE);
245 } 188 }
246 189
247 BOOL in_prelude = gAgent.inPrelude();
248 childSetEnabled("Show on Map btn", !in_prelude);
249
250 LLFloater::draw(); 190 LLFloater::draw();
251 } 191 }
252} 192}
@@ -271,3 +211,14 @@ LLPreview::EAssetStatus LLPreviewLandmark::getAssetStatus()
271 } 211 }
272 return mAssetStatus; 212 return mAssetStatus;
273} 213}
214// static
215void* LLPreviewLandmark::createPlaceDetail(void* userdata)
216{
217 LLPreviewLandmark *self = (LLPreviewLandmark*)userdata;
218 self->mPlacePanel = new LLPanelPlace();
219 gUICtrlFactory->buildPanel(self->mPlacePanel, "panel_place.xml");
220 const LLInventoryItem* item = self->getItem();
221 self->mPlacePanel->displayItemInfo(item);
222
223 return self->mPlacePanel;
224}