From 44c07eb2c58c4898752ad813d46c224ccd7229f1 Mon Sep 17 00:00:00 2001 From: Armin Weatherwax Date: Mon, 8 Nov 2010 19:51:32 +0100 Subject: feature: add a tiny context menu to areasearch scroll list items rightclick one of the results and teleport or cam to the object or bring it in edit mode --- linden/indra/llui/llscrolllistctrl.cpp | 38 +++++++ linden/indra/llui/llscrolllistctrl.h | 4 + linden/indra/newview/jcfloaterareasearch.cpp | 117 +++++++++++++++++++++ linden/indra/newview/jcfloaterareasearch.h | 17 +++ .../skins/default/xui/en-us/menu_areasearch.xml | 16 +++ 5 files changed, 192 insertions(+) create mode 100644 linden/indra/newview/skins/default/xui/en-us/menu_areasearch.xml 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, mHighlightedColor( LLUI::sColorsGroup->getColor("ScrollHighlightedColor") ), mBorderThickness( 2 ), mOnDoubleClickCallback( NULL ), + mOnRightMouseDownCallback( NULL ), mOnMaximumSelectCallback( NULL ), mOnSortChangedCallback( NULL ), mHighlightedItem(-1), @@ -2082,6 +2083,27 @@ BOOL LLScrollListCtrl::handleDoubleClick(S32 x, S32 y, MASK mask) return TRUE; } +BOOL LLScrollListCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + //BOOL handled = FALSE; + BOOL handled = handleClick(x, y, mask); + + if (!handled) + { + // Offer the click to the children, even if we aren't enabled + // so the scroll bars will work. + if (NULL == LLView::childrenHandleRightMouseDown(x, y, mask)) + { + if( mCanSelect && mOnRightMouseDownCallback ) + { + mOnRightMouseDownCallback( x, y, mCallbackUserData ); + } + } + } + + return TRUE; +} + BOOL LLScrollListCtrl::handleClick(S32 x, S32 y, MASK mask) { // which row was clicked on? @@ -3631,6 +3653,22 @@ BOOL LLColumnHeader::handleDoubleClick(S32 x, S32 y, MASK mask) return TRUE; } +BOOL LLColumnHeader::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + if (canResize() && mResizeBar->getRect().pointInRect(x, y)) + { + // reshape column to max content width + LLRect column_rect = getRect(); + column_rect.mRight = column_rect.mLeft + mColumn->mMaxContentWidth; + userSetShape(column_rect); + } + else + { + onClick(this); + } + return TRUE; +} + void LLColumnHeader::setImage(const std::string &image_name) { 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: /*virtual*/ void draw(); /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ void showList(); /*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: void highlightNthItem( S32 index ); void setDoubleClickCallback( void (*cb)(void*) ) { mOnDoubleClickCallback = cb; } + void setRightMouseDownCallback( void (*cb)(S32 x, S32 y, void*) ) { mOnRightMouseDownCallback = cb; } void setMaximumSelectCallback( void (*cb)(void*) ) { mOnMaximumSelectCallback = cb; } void setSortChangedCallback( void (*cb)(void*) ) { mOnSortChangedCallback = cb; } @@ -517,6 +519,7 @@ public: /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleKeyHere(KEY key, MASK mask); /*virtual*/ BOOL handleUnicodeCharHere(llwchar uni_char); @@ -660,6 +663,7 @@ private: S32 mBorderThickness; void (*mOnDoubleClickCallback)(void* userdata); + void (*mOnRightMouseDownCallback)(S32 x, S32 y, void* userdata); void (*mOnMaximumSelectCallback)(void* userdata ); void (*mOnSortChangedCallback)(void* userdata); 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 @@ #include "llscrolllistctrl.h" #include "llagent.h" + +#include "llfloatertools.h" +#include "llmenugl.h" +#include "llselectmgr.h" +#include "lltoolcomp.h" +#include "lltoolmgr.h" #include "lltracker.h" +#include "llviewerjoystick.h" #include "llviewerobjectlist.h" #include "llviewercontrol.h" #include "jcfloaterareasearch.h" @@ -63,6 +70,19 @@ mResultList(0) llassert_always(sInstance == NULL); sInstance = this; mLastUpdateTimer.reset(); + + + // Register event listeners for popup menu + mPopupMenuHandler = new PopupMenuHandler(this); + mPopupMenuHandler->registerListener(this, "Popup.HandleMenu"); + + LLMenuGL* menu = LLUICtrlFactory::getInstance()->buildMenu("menu_areasearch.xml", this); + if (!menu) + { + menu = new LLMenuGL(LLStringUtil::null); + } + menu->setVisible(FALSE); + mPopupMenuHandle = menu->getHandle(); } JCFloaterAreaSearch::~JCFloaterAreaSearch() @@ -90,6 +110,7 @@ BOOL JCFloaterAreaSearch::postBuild() mResultList = getChild("result_list"); mResultList->setCallbackUserData(this); mResultList->setDoubleClickCallback(onDoubleClick); + mResultList->setRightMouseDownCallback(onRightMouseDown); mResultList->sortByColumn("Name", TRUE); mCounterText = getChild("counter"); @@ -159,6 +180,102 @@ void JCFloaterAreaSearch::onDoubleClick(void *userdata) } } +//static +void JCFloaterAreaSearch::onRightMouseDown(S32 x, S32 y, void *userdata) +{ + JCFloaterAreaSearch* self = (JCFloaterAreaSearch*)userdata; + + self->setFocus( TRUE ); + LLMenuGL* menu = (LLMenuGL*)self->mPopupMenuHandle.get(); + if(menu) + { + if(menu->getVisible()) + { + menu->setVisible(FALSE); + } + else + { + LLScrollListItem *item = self->mResultList->getFirstSelected(); + if (item) + { + self->mSelectedItem = item; + menu->setVisible(TRUE); + menu->setFocus(TRUE); + menu->arrange(); + menu->updateParent(LLMenuGL::sMenuContainer); + LLMenuGL::showPopup(self, menu, x, y+50); + } + else + { + self->mSelectedItem = NULL; + } + } + } + +} + +JCFloaterAreaSearch::PopupMenuHandler::PopupMenuHandler(const JCFloaterAreaSearch* instance) + : mInstance(instance) +{ + +} + +// static +bool JCFloaterAreaSearch::PopupMenuHandler::handleEvent(LLPointer event, const LLSD& userdata) +{ + std::string command = userdata.asString(); + JCFloaterAreaSearch* self = (JCFloaterAreaSearch*)mInstance; + + if (self && self->mSelectedItem && !command.empty()) + { + LLUUID object_id = self->mSelectedItem->getUUID(); + LLViewerObject* object = gObjectList.findObject(object_id); + + if (object && !object->isAvatar()) + { + + + if ("teleport" == command) + { + LLVector3d pos = object->getPositionGlobal(); + gAgent.teleportViaLocation(pos); + + } + else + { + if ("cam" || "edit" == command) + { + + gAgent.setFocusOnAvatar(FALSE, FALSE); + gAgent.changeCameraToThirdPerson(); + gAgent.setFocusGlobal(object->getPositionGlobal(), object_id); + gAgent.setCameraPosAndFocusGlobal(object->getPositionGlobal() + + LLVector3d(3.5,1.35,0.75) * object->getRotation(), + object->getPositionGlobal(), + object_id ); + if ("edit" == command) + { + if(!object->isSelected()) + { + LLSelectMgr::getInstance()->deselectAll(); + LLSelectMgr::getInstance()->selectObjectAndFamily(object); + } + + gFloaterTools->open(); + LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset); + gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() ); + + LLViewerJoystick::getInstance()->moveObjects(true); + LLViewerJoystick::getInstance()->setNeedsReset(true); + } + } + } + } + } + + return true; +} + // static void JCFloaterAreaSearch::cancel(void* data) { 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 @@ #include "lluuid.h" #include "llstring.h" #include "llframetimer.h" +#include "llmemberlistener.h" class LLTextBox; class LLScrollListCtrl; +class LLScrollListItem; class LLViewerRegion; struct AObjectDetails @@ -71,6 +73,7 @@ private: static void onCommitLine(LLLineEditor* line, void* user_data); static void requestIfNeeded(LLViewerObject *objectp); static void onDoubleClick(void *userdata); + static void onRightMouseDown(S32 x, S32 y, void *userdata); enum OBJECT_COLUMN_ORDER { @@ -86,6 +89,7 @@ private: LLTextBox* mCounterText; LLScrollListCtrl* mResultList; + LLScrollListItem* mSelectedItem; LLFrameTimer mLastUpdateTimer; static std::map sObjectDetails; @@ -96,4 +100,17 @@ private: static std::string sSearchedGroup; static LLViewerRegion* sLastRegion; + + LLHandle mPopupMenuHandle; + + class PopupMenuHandler : public LLMemberListener + { + public: PopupMenuHandler(const JCFloaterAreaSearch* instance); + + /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); + + const JCFloaterAreaSearch* mInstance; + }; + + class PopupMenuHandler* mPopupMenuHandler; }; 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 @@ + + + + + + + + + + + + -- cgit v1.1 From 88df6cce7308b86b1526bd253440a6538e337d44 Mon Sep 17 00:00:00 2001 From: Armin Weatherwax Date: Tue, 9 Nov 2010 23:34:29 +0100 Subject: fix: add missing settings for logging into Aurora Sim --- linden/indra/newview/app_settings/settings.xml | 38 +++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 22e4aa5..2f29b17 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -1,7 +1,43 @@ - + + + + TimeOffset + + Comment + difference in hours to UTC time + Persist + 0 + Type + S32 + Value + 0 + + UseTimeOffset + + Comment + Use debug setting TimeOffset + Persist + 0 + Type + Boolean + Value + 0 + + TimeOffsetDST + + Comment + TimeOffset has Day Light Savings + Persist + 0 + Type + Boolean + Value + 0 + + -- cgit v1.1 From 1e88050a4ab2d5e517fdb2cea4c0e2727791cffb Mon Sep 17 00:00:00 2001 From: Armin Weatherwax Date: Tue, 9 Nov 2010 23:54:35 +0100 Subject: fix: add missing AllowEditingOfTrees setting --- linden/indra/newview/app_settings/settings.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 2f29b17..33299ba 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -40,6 +40,18 @@ + AllowEditingOfTrees + + Comment + Allow editing of trees and grass + Persist + 1 + Type + Boolean + Value + 1 + + HighlightNickname01 -- cgit v1.1 From a99afc222d2e01d64663698740d1a9f937e8559b Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Wed, 10 Nov 2010 21:50:02 -0700 Subject: Added missing 'Plugin' entry in logcontrol.xml --- linden/indra/newview/app_settings/logcontrol.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/linden/indra/newview/app_settings/logcontrol.xml b/linden/indra/newview/app_settings/logcontrol.xml index 682bf64..c94fc51 100644 --- a/linden/indra/newview/app_settings/logcontrol.xml +++ b/linden/indra/newview/app_settings/logcontrol.xml @@ -66,6 +66,7 @@ + -- cgit v1.1