SL-20047 Indicate when gallery items are being cut

meow-7.2.2
Andrey Kleshchev 2023-07-21 00:47:14 +03:00
parent 4fb9a3f469
commit 0941fcd5a4
2 changed files with 37 additions and 7 deletions

View File

@ -2230,7 +2230,9 @@ LLInventoryGalleryItem::LLInventoryGalleryItem(const Params& p)
mHidden(false),
mGallery(NULL),
mType(LLAssetType::AT_NONE),
mSortGroup(SG_ITEM)
mSortGroup(SG_ITEM),
mCutGeneration(0),
mSelectedForCut(false)
{
buildFromFile("panel_inventory_gallery_item.xml");
}
@ -2328,13 +2330,24 @@ void LLInventoryGalleryItem::setThumbnail(LLUUID id)
void LLInventoryGalleryItem::draw()
{
LLPanel::draw();
if (isFadeItem())
{
// Fade out to indicate it's being cut
LLViewDrawContext context(0.5f);
LLPanel::draw();
}
else
{
LLPanel::draw();
// Draw border
LLUIColor border_color = LLUIColorTable::instance().getColor(mSelected ? "MenuItemHighlightBgColor" : "TextFgTentativeColor", LLColor4::white);
LLRect border = getChildView("preview_thumbnail")->getRect();
border.mRight = border.mRight + 1;
gl_rect_2d(border, border_color.get(), FALSE);
}
// Draw border
LLUIColor border_color = LLUIColorTable::instance().getColor(mSelected ? "MenuItemHighlightBgColor" : "TextFgTentativeColor", LLColor4::white);
LLRect border = getChildView("preview_thumbnail")->getRect();
border.mRight = border.mRight + 1;
gl_rect_2d(border, border_color.get(), FALSE);
}
void LLInventoryGalleryItem::setItemName(std::string name)
@ -2543,6 +2556,19 @@ void LLInventoryGalleryItem::updateNameText()
getChild<LLThumbnailCtrl>("preview_thumbnail")->setToolTip(mItemName + mPermSuffix + mWornSuffix);
}
bool LLInventoryGalleryItem::isFadeItem()
{
LLClipboard& clipboard = LLClipboard::instance();
if (mCutGeneration == clipboard.getGeneration())
{
return mSelectedForCut;
}
mCutGeneration = clipboard.getGeneration();
mSelectedForCut = clipboard.isCutMode() && clipboard.isOnClipboard(mUUID);
return mSelectedForCut;
}
//-----------------------------
// LLThumbnailsObserver
//-----------------------------

View File

@ -335,6 +335,8 @@ public:
void updateNameText();
private:
bool isFadeItem();
LLUUID mUUID;
LLTextBox* mNameText;
LLPanel* mTextBgPanel;
@ -344,6 +346,8 @@ private:
bool mHidden;
bool mIsFolder;
bool mIsLink;
S32 mCutGeneration;
bool mSelectedForCut;
std::string mAssetIDStr;
std::string mDesc;