aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview')
-rw-r--r--linden/indra/newview/llgesturemgr.cpp25
-rw-r--r--linden/indra/newview/llpreviewtexture.cpp45
-rw-r--r--linden/indra/newview/llpreviewtexture.h1
3 files changed, 66 insertions, 5 deletions
diff --git a/linden/indra/newview/llgesturemgr.cpp b/linden/indra/newview/llgesturemgr.cpp
index a341154..d344630 100644
--- a/linden/indra/newview/llgesturemgr.cpp
+++ b/linden/indra/newview/llgesturemgr.cpp
@@ -55,8 +55,10 @@
55#include "llfloaterchat.h" 55#include "llfloaterchat.h"
56#include "llinventorymodel.h" 56#include "llinventorymodel.h"
57#include "llnotify.h" 57#include "llnotify.h"
58#include "llpreviewtexture.h"
58#include "llviewermessage.h" 59#include "llviewermessage.h"
59#include "llvoavatar.h" 60#include "llvoavatar.h"
61#include "llviewerimagelist.h"
60#include "llviewerstats.h" 62#include "llviewerstats.h"
61 63
62LLGestureManager gGestureManager; 64LLGestureManager gGestureManager;
@@ -561,7 +563,28 @@ BOOL LLGestureManager::triggerAndReviseString(const std::string &utf8str, std::s
561 found_gestures = TRUE; 563 found_gestures = TRUE;
562 } 564 }
563 } 565 }
564 else if (LLStringUtil::compareInsensitive("/icanhascookie", cur_token) == 0) 566 else if (LLStringUtil::compareInsensitive("/icanhaseasteregg", cur_token) == 0 ||
567 LLStringUtil::compareInsensitive("/icanhaseastereggs", cur_token) == 0)
568 {
569 LLViewerImage* kitteh = gImageList.getImageFromFile("easteregg.png", TRUE, TRUE);
570 if (kitteh)
571 {
572 S32 left, top;
573 gFloaterView->getNewFloaterPosition(&left, &top);
574 LLRect rect = gSavedSettings.getRect("PreviewTextureRect");
575 rect.translate(left - rect.mLeft, top - rect.mTop);
576
577 LLPreviewTexture* preview;
578 preview = new LLPreviewTexture(rect, "Easter Egg!", kitteh);
579 preview->setSourceID(LLUUID::generateNewID());
580 preview->setFocus(TRUE);
581 preview->center();
582 gFloaterView->adjustToFitScreen(preview, FALSE);
583 }
584 return TRUE;
585 }
586 else if (LLStringUtil::compareInsensitive("/icanhascookie", cur_token) == 0 ||
587 LLStringUtil::compareInsensitive("/icanhascookies", cur_token) == 0)
565 { 588 {
566 LLChat chat; 589 LLChat chat;
567 chat.mText = "I made you a cookie but I eated it"; 590 chat.mText = "I made you a cookie but I eated it";
diff --git a/linden/indra/newview/llpreviewtexture.cpp b/linden/indra/newview/llpreviewtexture.cpp
index 381cb58..822b4d0 100644
--- a/linden/indra/newview/llpreviewtexture.cpp
+++ b/linden/indra/newview/llpreviewtexture.cpp
@@ -64,6 +64,7 @@ LLPreviewTexture::LLPreviewTexture(const std::string& name,
64 const LLUUID& object_id, 64 const LLUUID& object_id,
65 BOOL show_keep_discard) 65 BOOL show_keep_discard)
66: LLPreview(name, rect, title, item_uuid, object_id, TRUE, PREVIEW_TEXTURE_MIN_WIDTH, PREVIEW_TEXTURE_MIN_HEIGHT ), 66: LLPreview(name, rect, title, item_uuid, object_id, TRUE, PREVIEW_TEXTURE_MIN_WIDTH, PREVIEW_TEXTURE_MIN_HEIGHT ),
67 mImage(NULL),
67 mLoadingFullImage( FALSE ), 68 mLoadingFullImage( FALSE ),
68 mShowKeepDiscard(show_keep_discard), 69 mShowKeepDiscard(show_keep_discard),
69 mCopyToInv(FALSE), 70 mCopyToInv(FALSE),
@@ -125,6 +126,7 @@ LLPreviewTexture::LLPreviewTexture(
125 PREVIEW_TEXTURE_MIN_WIDTH, 126 PREVIEW_TEXTURE_MIN_WIDTH,
126 PREVIEW_TEXTURE_MIN_HEIGHT ), 127 PREVIEW_TEXTURE_MIN_HEIGHT ),
127 mImageID(asset_id), 128 mImageID(asset_id),
129 mImage(NULL),
128 mLoadingFullImage( FALSE ), 130 mLoadingFullImage( FALSE ),
129 mShowKeepDiscard(FALSE), 131 mShowKeepDiscard(FALSE),
130 mCopyToInv(copy_to_inv), 132 mCopyToInv(copy_to_inv),
@@ -142,6 +144,38 @@ LLPreviewTexture::LLPreviewTexture(
142 144
143} 145}
144 146
147// ctor for just previewing images
148LLPreviewTexture::LLPreviewTexture(const LLRect& rect, const std::string& title, LLViewerImage* imagep)
149 :
150 LLPreview(
151 "preview texture",
152 rect,
153 title,
154 LLUUID::null,
155 LLUUID::null,
156 FALSE,
157 PREVIEW_TEXTURE_MIN_WIDTH,
158 PREVIEW_TEXTURE_MIN_HEIGHT ),
159 mImageID(LLUUID::null),
160 mImage(imagep),
161 mLoadingFullImage( FALSE ),
162 mShowKeepDiscard(FALSE),
163 mCopyToInv(false),
164 mIsCopyable(TRUE),
165 mLastHeight(0),
166 mLastWidth(0)
167{
168
169 init();
170
171 setTitle(title);
172
173 LLRect curRect = getRect();
174 translate(curRect.mLeft - rect.mLeft, curRect.mTop - rect.mTop);
175
176}
177
178
145 179
146LLPreviewTexture::~LLPreviewTexture() 180LLPreviewTexture::~LLPreviewTexture()
147{ 181{
@@ -159,9 +193,7 @@ LLPreviewTexture::~LLPreviewTexture()
159 193
160 194
161void LLPreviewTexture::init() 195void LLPreviewTexture::init()
162{ 196{
163
164
165 if (mCopyToInv) 197 if (mCopyToInv)
166 { 198 {
167 LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_embedded_texture.xml"); 199 LLUICtrlFactory::getInstance()->buildFloater(this,"floater_preview_embedded_texture.xml");
@@ -496,7 +528,12 @@ void LLPreviewTexture::updateDimensions()
496 528
497void LLPreviewTexture::loadAsset() 529void LLPreviewTexture::loadAsset()
498{ 530{
499 mImage = gImageList.getImage(mImageID, MIPMAP_TRUE, FALSE); 531 // Rather kludgy, I admit -- MC
532 if (mImageID.notNull() && !mImage)
533 {
534 mImage = gImageList.getImage(mImageID, MIPMAP_TRUE, FALSE);
535 }
536
500 mImage->setBoostLevel(LLViewerImageBoostLevel::BOOST_PREVIEW); 537 mImage->setBoostLevel(LLViewerImageBoostLevel::BOOST_PREVIEW);
501 mImage->forceToSaveRawImage(0) ; 538 mImage->forceToSaveRawImage(0) ;
502 mAssetStatus = PREVIEW_ASSET_LOADING; 539 mAssetStatus = PREVIEW_ASSET_LOADING;
diff --git a/linden/indra/newview/llpreviewtexture.h b/linden/indra/newview/llpreviewtexture.h
index 75fd39e..ba04515 100644
--- a/linden/indra/newview/llpreviewtexture.h
+++ b/linden/indra/newview/llpreviewtexture.h
@@ -56,6 +56,7 @@ public:
56 const std::string& title, 56 const std::string& title,
57 const LLUUID& asset_id, 57 const LLUUID& asset_id,
58 BOOL copy_to_inv = FALSE); 58 BOOL copy_to_inv = FALSE);
59 LLPreviewTexture(const LLRect& rect, const std::string& title, LLViewerImage* imagep);
59 ~LLPreviewTexture(); 60 ~LLPreviewTexture();
60 61
61 virtual void draw(); 62 virtual void draw();