From 9c9b394862ae98d6f30d2db8fb470e0a2a084a4f Mon Sep 17 00:00:00 2001 From: Hazim Gazov Date: Sun, 15 Aug 2010 07:50:00 +0000 Subject: [PATCH] proper right click support for textures added --- indra/newview/lltexturectrl.cpp | 34 +++++++++++++++++++++++++++++---- indra/newview/lltexturectrl.h | 3 +++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 8af0f24f7..5db0881d6 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -1275,15 +1275,41 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask) } // + +//static +void LLTextureCtrl::handleClickOpenTexture(void* userdata) +{ + LLTextureCtrl* clickedTexture = static_cast(userdata); + + if(clickedTexture) + LLLocalInventory::addItem(clickedTexture->mImageAssetID.asString(), (int)LLAssetType::AT_TEXTURE, clickedTexture->mImageAssetID, true); +} + +//static +void LLTextureCtrl::handleClickCopyAssetID(void* userdata) +{ + LLTextureCtrl* clickedTexture = static_cast(userdata); + + if(clickedTexture) + gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(clickedTexture->mImageAssetID.asString())); +} + BOOL LLTextureCtrl::handleRightMouseDown(S32 x, S32 y, MASK mask) { - if( mask & MASK_SHIFT ) + BOOL handled = LLUICtrl::handleRightMouseDown( x, y , mask ); + if( handled ) { - LLLocalInventory::addItem(mImageAssetID.asString(), (int)LLAssetType::AT_TEXTURE, mImageAssetID, true); - return TRUE; + LLMenuGL* menu = new LLMenuGL(LLStringUtil::null); + menu->append(new LLMenuItemCallGL("Open", LLTextureCtrl::handleClickOpenTexture, NULL, this)); + menu->append(new LLMenuItemCallGL("Copy Asset UUID", LLTextureCtrl::handleClickCopyAssetID, NULL, this)); + menu->updateParent(LLMenuGL::sMenuContainer); + menu->setCanTearOff(FALSE); + LLMenuGL::showPopup(this, menu, x, y); } - return FALSE; + + return handled; } + // void LLTextureCtrl::onFloaterClose() diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index d856d23b1..407af3809 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -159,6 +159,9 @@ public: void setShowLoadingPlaceholder(BOOL showLoadingPlaceholder); + static void handleClickOpenTexture(void* userdata); + static void handleClickCopyAssetID(void* userdata); + private: BOOL allowDrop(LLInventoryItem* item); BOOL doDrop(LLInventoryItem* item);