aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloaterimagepreview.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-09-06 18:24:57 -0500
committerJacek Antonelli2008-09-06 18:25:07 -0500
commit798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch)
tree1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/llfloaterimagepreview.cpp
parentSecond Life viewer sources 1.20.15 (diff)
downloadmeta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/newview/llfloaterimagepreview.cpp')
-rw-r--r--linden/indra/newview/llfloaterimagepreview.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/linden/indra/newview/llfloaterimagepreview.cpp b/linden/indra/newview/llfloaterimagepreview.cpp
index ccd7737..92e8ad1 100644
--- a/linden/indra/newview/llfloaterimagepreview.cpp
+++ b/linden/indra/newview/llfloaterimagepreview.cpp
@@ -45,6 +45,7 @@
45#include "lldrawpoolavatar.h" 45#include "lldrawpoolavatar.h"
46#include "llrender.h" 46#include "llrender.h"
47#include "llface.h" 47#include "llface.h"
48#include "llfocusmgr.h"
48#include "lltextbox.h" 49#include "lltextbox.h"
49#include "lltoolmgr.h" 50#include "lltoolmgr.h"
50#include "llui.h" 51#include "llui.h"
@@ -54,6 +55,7 @@
54#include "pipeline.h" 55#include "pipeline.h"
55#include "lluictrlfactory.h" 56#include "lluictrlfactory.h"
56#include "llviewerimagelist.h" 57#include "llviewerimagelist.h"
58#include "llstring.h"
57 59
58//static 60//static
59S32 LLFloaterImagePreview::sUploadAmount = 10; 61S32 LLFloaterImagePreview::sUploadAmount = 10;
@@ -68,13 +70,13 @@ const S32 PREVIEW_TEXTURE_HEIGHT = 300;
68//----------------------------------------------------------------------------- 70//-----------------------------------------------------------------------------
69// LLFloaterImagePreview() 71// LLFloaterImagePreview()
70//----------------------------------------------------------------------------- 72//-----------------------------------------------------------------------------
71LLFloaterImagePreview::LLFloaterImagePreview(const char* filename) : 73LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) :
72 LLFloaterNameDesc(filename) 74 LLFloaterNameDesc(filename)
73{ 75{
74 mLastMouseX = 0; 76 mLastMouseX = 0;
75 mLastMouseY = 0; 77 mLastMouseY = 0;
76 mGLName = 0; 78 mGLName = 0;
77 loadImage(mFilenameAndPath.c_str()); 79 loadImage(mFilenameAndPath);
78} 80}
79 81
80//----------------------------------------------------------------------------- 82//-----------------------------------------------------------------------------
@@ -314,28 +316,25 @@ void LLFloaterImagePreview::draw()
314//----------------------------------------------------------------------------- 316//-----------------------------------------------------------------------------
315// loadImage() 317// loadImage()
316//----------------------------------------------------------------------------- 318//-----------------------------------------------------------------------------
317bool LLFloaterImagePreview::loadImage(const char *src_filename) 319bool LLFloaterImagePreview::loadImage(const std::string& src_filename)
318{ 320{
319 // U32 length = strlen(src_filename); 321 std::string exten = gDirUtilp->getExtension(src_filename);
320 const char* ext = strrchr(src_filename, '.'); 322
321 char error_message[MAX_STRING];
322 error_message[0] = '\0';
323
324 U32 codec = IMG_CODEC_INVALID; 323 U32 codec = IMG_CODEC_INVALID;
325 LLString temp_str; 324 std::string temp_str;
326 if( 0 == strnicmp(ext, ".bmp", 4) ) 325 if( exten == "bmp")
327 { 326 {
328 codec = IMG_CODEC_BMP; 327 codec = IMG_CODEC_BMP;
329 } 328 }
330 else if( 0 == strnicmp(ext, ".tga", 4) ) 329 else if( exten == "tga")
331 { 330 {
332 codec = IMG_CODEC_TGA; 331 codec = IMG_CODEC_TGA;
333 } 332 }
334 else if( 0 == strnicmp(ext, ".jpg", 4) || 0 == strnicmp(ext, ".jpeg", 5)) 333 else if( exten == "jpg" || exten == "jpeg")
335 { 334 {
336 codec = IMG_CODEC_JPEG; 335 codec = IMG_CODEC_JPEG;
337 } 336 }
338 else if( 0 == strnicmp(ext, ".png", 4) ) 337 else if( exten == "png" )
339 { 338 {
340 codec = IMG_CODEC_PNG; 339 codec = IMG_CODEC_PNG;
341 } 340 }
@@ -429,7 +428,7 @@ BOOL LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask)
429 if (mPreviewRect.pointInRect(x, y)) 428 if (mPreviewRect.pointInRect(x, y))
430 { 429 {
431 bringToFront( x, y ); 430 bringToFront( x, y );
432 gViewerWindow->setMouseCapture(this); 431 gFocusMgr.setMouseCapture(this);
433 gViewerWindow->hideCursor(); 432 gViewerWindow->hideCursor();
434 mLastMouseX = x; 433 mLastMouseX = x;
435 mLastMouseY = y; 434 mLastMouseY = y;
@@ -444,7 +443,7 @@ BOOL LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask)
444//----------------------------------------------------------------------------- 443//-----------------------------------------------------------------------------
445BOOL LLFloaterImagePreview::handleMouseUp(S32 x, S32 y, MASK mask) 444BOOL LLFloaterImagePreview::handleMouseUp(S32 x, S32 y, MASK mask)
446{ 445{
447 gViewerWindow->setMouseCapture(FALSE); 446 gFocusMgr.setMouseCapture(FALSE);
448 gViewerWindow->showCursor(); 447 gViewerWindow->showCursor();
449 return LLFloater::handleMouseUp(x, y, mask); 448 return LLFloater::handleMouseUp(x, y, mask);
450} 449}
@@ -629,7 +628,7 @@ LLImagePreviewAvatar::~LLImagePreviewAvatar()
629} 628}
630 629
631 630
632void LLImagePreviewAvatar::setPreviewTarget(const char* joint_name, const char* mesh_name, LLImageRaw* imagep, F32 distance, BOOL male) 631void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male)
633{ 632{
634 mTargetJoint = mDummyAvatar->mRoot.findJoint(joint_name); 633 mTargetJoint = mDummyAvatar->mRoot.findJoint(joint_name);
635 // clear out existing test mesh 634 // clear out existing test mesh