aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra')
-rw-r--r--linden/indra/llui/llscrolllistctrl.cpp38
-rw-r--r--linden/indra/llui/llscrolllistctrl.h4
-rw-r--r--linden/indra/newview/jcfloaterareasearch.cpp117
-rw-r--r--linden/indra/newview/jcfloaterareasearch.h17
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/menu_areasearch.xml16
5 files changed, 192 insertions, 0 deletions
diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp
index 9635f99..1248a9a 100644
--- a/linden/indra/llui/llscrolllistctrl.cpp
+++ b/linden/indra/llui/llscrolllistctrl.cpp
@@ -605,6 +605,7 @@ LLScrollListCtrl::LLScrollListCtrl(const std::string& name, const LLRect& rect,
605 mHighlightedColor( LLUI::sColorsGroup->getColor("ScrollHighlightedColor") ), 605 mHighlightedColor( LLUI::sColorsGroup->getColor("ScrollHighlightedColor") ),
606 mBorderThickness( 2 ), 606 mBorderThickness( 2 ),
607 mOnDoubleClickCallback( NULL ), 607 mOnDoubleClickCallback( NULL ),
608 mOnRightMouseDownCallback( NULL ),
608 mOnMaximumSelectCallback( NULL ), 609 mOnMaximumSelectCallback( NULL ),
609 mOnSortChangedCallback( NULL ), 610 mOnSortChangedCallback( NULL ),
610 mHighlightedItem(-1), 611 mHighlightedItem(-1),
@@ -2082,6 +2083,27 @@ BOOL LLScrollListCtrl::handleDoubleClick(S32 x, S32 y, MASK mask)
2082 return TRUE; 2083 return TRUE;
2083} 2084}
2084 2085
2086BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
2087{
2088 //BOOL handled = FALSE;
2089 BOOL handled = handleClick(x, y, mask);
2090
2091 if (!handled)
2092 {
2093 // Offer the click to the children, even if we aren't enabled
2094 // so the scroll bars will work.
2095 if (NULL == LLView::childrenHandleRightMouseDown(x, y, mask))
2096 {
2097 if( mCanSelect && mOnRightMouseDownCallback )
2098 {
2099 mOnRightMouseDownCallback( x, y, mCallbackUserData );
2100 }
2101 }
2102 }
2103
2104 return TRUE;
2105}
2106
2085BOOL LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask) 2107BOOL LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask)
2086{ 2108{
2087 // which row was clicked on? 2109 // which row was clicked on?
@@ -3631,6 +3653,22 @@ BOOL LLColumnHeader::handleDoubleClick(S32 x, S32 y, MASK mask)
3631 return TRUE; 3653 return TRUE;
3632} 3654}
3633 3655
3656BOOL LLColumnHeader::handleRightMouseDown(S32 x, S32 y, MASK mask)
3657{
3658 if (canResize() && mResizeBar->getRect().pointInRect(x, y))
3659 {
3660 // reshape column to max content width
3661 LLRect column_rect = getRect();
3662 column_rect.mRight = column_rect.mLeft + mColumn->mMaxContentWidth;
3663 userSetShape(column_rect);
3664 }
3665 else
3666 {
3667 onClick(this);
3668 }
3669 return TRUE;
3670}
3671
3634void LLColumnHeader::setImage(const std::string &image_name) 3672void LLColumnHeader::setImage(const std::string &image_name)
3635{ 3673{
3636 if (mButton) 3674 if (mButton)
diff --git a/linden/indra/llui/llscrolllistctrl.h b/linden/indra/llui/llscrolllistctrl.h
index e875d7a..4be7ff7 100644
--- a/linden/indra/llui/llscrolllistctrl.h
+++ b/linden/indra/llui/llscrolllistctrl.h
@@ -241,6 +241,7 @@ public:
241 241
242 /*virtual*/ void draw(); 242 /*virtual*/ void draw();
243 /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); 243 /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
244 /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
244 245
245 /*virtual*/ void showList(); 246 /*virtual*/ void showList();
246 /*virtual*/ LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding); 247 /*virtual*/ LLView* findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding);
@@ -431,6 +432,7 @@ public:
431 432
432 void highlightNthItem( S32 index ); 433 void highlightNthItem( S32 index );
433 void setDoubleClickCallback( void (*cb)(void*) ) { mOnDoubleClickCallback = cb; } 434 void setDoubleClickCallback( void (*cb)(void*) ) { mOnDoubleClickCallback = cb; }
435 void setRightMouseDownCallback( void (*cb)(S32 x, S32 y, void*) ) { mOnRightMouseDownCallback = cb; }
434 void setMaximumSelectCallback( void (*cb)(void*) ) { mOnMaximumSelectCallback = cb; } 436 void setMaximumSelectCallback( void (*cb)(void*) ) { mOnMaximumSelectCallback = cb; }
435 void setSortChangedCallback( void (*cb)(void*) ) { mOnSortChangedCallback = cb; } 437 void setSortChangedCallback( void (*cb)(void*) ) { mOnSortChangedCallback = cb; }
436 438
@@ -517,6 +519,7 @@ public:
517 /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); 519 /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
518 /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); 520 /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
519 /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); 521 /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
522 /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
520 /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); 523 /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
521 /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); 524 /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
522 /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); 525 /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char);
@@ -660,6 +663,7 @@ private:
660 663
661 S32 mBorderThickness; 664 S32 mBorderThickness;
662 void (*mOnDoubleClickCallback)(void* userdata); 665 void (*mOnDoubleClickCallback)(void* userdata);
666 void (*mOnRightMouseDownCallback)(S32 x, S32 y, void* userdata);
663 void (*mOnMaximumSelectCallback)(void* userdata ); 667 void (*mOnMaximumSelectCallback)(void* userdata );
664 void (*mOnSortChangedCallback)(void* userdata); 668 void (*mOnSortChangedCallback)(void* userdata);
665 669
diff --git a/linden/indra/newview/jcfloaterareasearch.cpp b/linden/indra/newview/jcfloaterareasearch.cpp
index ed00447..0918431 100644
--- a/linden/indra/newview/jcfloaterareasearch.cpp
+++ b/linden/indra/newview/jcfloaterareasearch.cpp
@@ -38,7 +38,14 @@
38#include "llscrolllistctrl.h" 38#include "llscrolllistctrl.h"
39 39
40#include "llagent.h" 40#include "llagent.h"
41
42#include "llfloatertools.h"
43#include "llmenugl.h"
44#include "llselectmgr.h"
45#include "lltoolcomp.h"
46#include "lltoolmgr.h"
41#include "lltracker.h" 47#include "lltracker.h"
48#include "llviewerjoystick.h"
42#include "llviewerobjectlist.h" 49#include "llviewerobjectlist.h"
43#include "llviewercontrol.h" 50#include "llviewercontrol.h"
44#include "jcfloaterareasearch.h" 51#include "jcfloaterareasearch.h"
@@ -63,6 +70,19 @@ mResultList(0)
63 llassert_always(sInstance == NULL); 70 llassert_always(sInstance == NULL);
64 sInstance = this; 71 sInstance = this;
65 mLastUpdateTimer.reset(); 72 mLastUpdateTimer.reset();
73
74
75 // Register event listeners for popup menu
76 mPopupMenuHandler = new PopupMenuHandler(this);
77 mPopupMenuHandler->registerListener(this, "Popup.HandleMenu");
78
79 LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_areasearch.xml", this);
80 if (!menu)
81 {
82 menu = new LLMenuGL(LLStringUtil::null);
83 }
84 menu->setVisible(FALSE);
85 mPopupMenuHandle = menu->getHandle();
66} 86}
67 87
68JCFloaterAreaSearch::~JCFloaterAreaSearch() 88JCFloaterAreaSearch::~JCFloaterAreaSearch()
@@ -90,6 +110,7 @@ BOOL JCFloaterAreaSearch::postBuild()
90 mResultList = getChild<LLScrollListCtrl>("result_list"); 110 mResultList = getChild<LLScrollListCtrl>("result_list");
91 mResultList->setCallbackUserData(this); 111 mResultList->setCallbackUserData(this);
92 mResultList->setDoubleClickCallback(onDoubleClick); 112 mResultList->setDoubleClickCallback(onDoubleClick);
113 mResultList->setRightMouseDownCallback(onRightMouseDown);
93 mResultList->sortByColumn("Name", TRUE); 114 mResultList->sortByColumn("Name", TRUE);
94 115
95 mCounterText = getChild<LLTextBox>("counter"); 116 mCounterText = getChild<LLTextBox>("counter");
@@ -159,6 +180,102 @@ void JCFloaterAreaSearch::onDoubleClick(void *userdata)
159 } 180 }
160} 181}
161 182
183//static
184void JCFloaterAreaSearch::onRightMouseDown(S32 x, S32 y, void *userdata)
185{
186 JCFloaterAreaSearch* self = (JCFloaterAreaSearch*)userdata;
187
188 self->setFocus( TRUE );
189 LLMenuGL* menu = (LLMenuGL*)self->mPopupMenuHandle.get();
190 if(menu)
191 {
192 if(menu->getVisible())
193 {
194 menu->setVisible(FALSE);
195 }
196 else
197 {
198 LLScrollListItem *item = self->mResultList->getFirstSelected();
199 if (item)
200 {
201 self->mSelectedItem = item;
202 menu->setVisible(TRUE);
203 menu->setFocus(TRUE);
204 menu->arrange();
205 menu->updateParent(LLMenuGL::sMenuContainer);
206 LLMenuGL::showPopup(self, menu, x, y+50);
207 }
208 else
209 {
210 self->mSelectedItem = NULL;
211 }
212 }
213 }
214
215}
216
217JCFloaterAreaSearch::PopupMenuHandler::PopupMenuHandler(const JCFloaterAreaSearch* instance)
218 : mInstance(instance)
219{
220
221}
222
223// static
224bool JCFloaterAreaSearch::PopupMenuHandler::handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
225{
226 std::string command = userdata.asString();
227 JCFloaterAreaSearch* self = (JCFloaterAreaSearch*)mInstance;
228
229 if (self && self->mSelectedItem && !command.empty())
230 {
231 LLUUID object_id = self->mSelectedItem->getUUID();
232 LLViewerObject* object = gObjectList.findObject(object_id);
233
234 if (object && !object->isAvatar())
235 {
236
237
238 if ("teleport" == command)
239 {
240 LLVector3d pos = object->getPositionGlobal();
241 gAgent.teleportViaLocation(pos);
242
243 }
244 else
245 {
246 if ("cam" || "edit" == command)
247 {
248
249 gAgent.setFocusOnAvatar(FALSE, FALSE);
250 gAgent.changeCameraToThirdPerson();
251 gAgent.setFocusGlobal(object->getPositionGlobal(), object_id);
252 gAgent.setCameraPosAndFocusGlobal(object->getPositionGlobal()
253 + LLVector3d(3.5,1.35,0.75) * object->getRotation(),
254 object->getPositionGlobal(),
255 object_id );
256 if ("edit" == command)
257 {
258 if(!object->isSelected())
259 {
260 LLSelectMgr::getInstance()->deselectAll();
261 LLSelectMgr::getInstance()->selectObjectAndFamily(object);
262 }
263
264 gFloaterTools->open();
265 LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
266 gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() );
267
268 LLViewerJoystick::getInstance()->moveObjects(true);
269 LLViewerJoystick::getInstance()->setNeedsReset(true);
270 }
271 }
272 }
273 }
274 }
275
276 return true;
277}
278
162// static 279// static
163void JCFloaterAreaSearch::cancel(void* data) 280void JCFloaterAreaSearch::cancel(void* data)
164{ 281{
diff --git a/linden/indra/newview/jcfloaterareasearch.h b/linden/indra/newview/jcfloaterareasearch.h
index 1512030..5bceb59 100644
--- a/linden/indra/newview/jcfloaterareasearch.h
+++ b/linden/indra/newview/jcfloaterareasearch.h
@@ -35,9 +35,11 @@
35#include "lluuid.h" 35#include "lluuid.h"
36#include "llstring.h" 36#include "llstring.h"
37#include "llframetimer.h" 37#include "llframetimer.h"
38#include "llmemberlistener.h"
38 39
39class LLTextBox; 40class LLTextBox;
40class LLScrollListCtrl; 41class LLScrollListCtrl;
42class LLScrollListItem;
41class LLViewerRegion; 43class LLViewerRegion;
42 44
43struct AObjectDetails 45struct AObjectDetails
@@ -71,6 +73,7 @@ private:
71 static void onCommitLine(LLLineEditor* line, void* user_data); 73 static void onCommitLine(LLLineEditor* line, void* user_data);
72 static void requestIfNeeded(LLViewerObject *objectp); 74 static void requestIfNeeded(LLViewerObject *objectp);
73 static void onDoubleClick(void *userdata); 75 static void onDoubleClick(void *userdata);
76 static void onRightMouseDown(S32 x, S32 y, void *userdata);
74 77
75 enum OBJECT_COLUMN_ORDER 78 enum OBJECT_COLUMN_ORDER
76 { 79 {
@@ -86,6 +89,7 @@ private:
86 89
87 LLTextBox* mCounterText; 90 LLTextBox* mCounterText;
88 LLScrollListCtrl* mResultList; 91 LLScrollListCtrl* mResultList;
92 LLScrollListItem* mSelectedItem;
89 LLFrameTimer mLastUpdateTimer; 93 LLFrameTimer mLastUpdateTimer;
90 94
91 static std::map<LLUUID, AObjectDetails> sObjectDetails; 95 static std::map<LLUUID, AObjectDetails> sObjectDetails;
@@ -96,4 +100,17 @@ private:
96 static std::string sSearchedGroup; 100 static std::string sSearchedGroup;
97 101
98 static LLViewerRegion* sLastRegion; 102 static LLViewerRegion* sLastRegion;
103
104 LLHandle<LLView> mPopupMenuHandle;
105
106 class PopupMenuHandler : public LLMemberListener<JCFloaterAreaSearch>
107 {
108 public: PopupMenuHandler(const JCFloaterAreaSearch* instance);
109
110 /*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata);
111
112 const JCFloaterAreaSearch* mInstance;
113 };
114
115 class PopupMenuHandler* mPopupMenuHandler;
99}; 116};
diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_areasearch.xml b/linden/indra/newview/skins/default/xui/en-us/menu_areasearch.xml
new file mode 100644
index 0000000..c55d1b3
--- /dev/null
+++ b/linden/indra/newview/skins/default/xui/en-us/menu_areasearch.xml
@@ -0,0 +1,16 @@
1<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
2<menu bottom="100" color="MenuDefaultBgColor" drop_shadow="true" height="101" left="100"
3 mouse_opaque="false" name="popup" opaque="true" width="128">
4 <menu_item_call bottom_delta="-18" height="18" label="Teleport to" left="0"
5 mouse_opaque="true" name="teleport" width="128">
6 <on_click function="Popup.HandleMenu" userdata="teleport" />
7 </menu_item_call>
8 <menu_item_call bottom_delta="-18" height="18" label="Cam to" left="0"
9 mouse_opaque="true" name="cam" width="128">
10 <on_click function="Popup.HandleMenu" userdata="cam" />
11 </menu_item_call>
12 <menu_item_call bottom_delta="-18" height="18" label="Edit" left="0"
13 mouse_opaque="true" name="edit" width="128">
14 <on_click function="Popup.HandleMenu" userdata="edit" />
15 </menu_item_call>
16</menu>