From 798d367d54a6c6379ad355bd8345fa40e31e7fe9 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sat, 6 Sep 2008 18:24:57 -0500 Subject: Second Life viewer sources 1.21.0-RC --- linden/indra/newview/llfloaterimagepreview.cpp | 31 +++++++++++++------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'linden/indra/newview/llfloaterimagepreview.cpp') 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 @@ #include "lldrawpoolavatar.h" #include "llrender.h" #include "llface.h" +#include "llfocusmgr.h" #include "lltextbox.h" #include "lltoolmgr.h" #include "llui.h" @@ -54,6 +55,7 @@ #include "pipeline.h" #include "lluictrlfactory.h" #include "llviewerimagelist.h" +#include "llstring.h" //static S32 LLFloaterImagePreview::sUploadAmount = 10; @@ -68,13 +70,13 @@ const S32 PREVIEW_TEXTURE_HEIGHT = 300; //----------------------------------------------------------------------------- // LLFloaterImagePreview() //----------------------------------------------------------------------------- -LLFloaterImagePreview::LLFloaterImagePreview(const char* filename) : +LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) : LLFloaterNameDesc(filename) { mLastMouseX = 0; mLastMouseY = 0; mGLName = 0; - loadImage(mFilenameAndPath.c_str()); + loadImage(mFilenameAndPath); } //----------------------------------------------------------------------------- @@ -314,28 +316,25 @@ void LLFloaterImagePreview::draw() //----------------------------------------------------------------------------- // loadImage() //----------------------------------------------------------------------------- -bool LLFloaterImagePreview::loadImage(const char *src_filename) +bool LLFloaterImagePreview::loadImage(const std::string& src_filename) { - // U32 length = strlen(src_filename); - const char* ext = strrchr(src_filename, '.'); - char error_message[MAX_STRING]; - error_message[0] = '\0'; - + std::string exten = gDirUtilp->getExtension(src_filename); + U32 codec = IMG_CODEC_INVALID; - LLString temp_str; - if( 0 == strnicmp(ext, ".bmp", 4) ) + std::string temp_str; + if( exten == "bmp") { codec = IMG_CODEC_BMP; } - else if( 0 == strnicmp(ext, ".tga", 4) ) + else if( exten == "tga") { codec = IMG_CODEC_TGA; } - else if( 0 == strnicmp(ext, ".jpg", 4) || 0 == strnicmp(ext, ".jpeg", 5)) + else if( exten == "jpg" || exten == "jpeg") { codec = IMG_CODEC_JPEG; } - else if( 0 == strnicmp(ext, ".png", 4) ) + else if( exten == "png" ) { codec = IMG_CODEC_PNG; } @@ -429,7 +428,7 @@ BOOL LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask) if (mPreviewRect.pointInRect(x, y)) { bringToFront( x, y ); - gViewerWindow->setMouseCapture(this); + gFocusMgr.setMouseCapture(this); gViewerWindow->hideCursor(); mLastMouseX = x; mLastMouseY = y; @@ -444,7 +443,7 @@ BOOL LLFloaterImagePreview::handleMouseDown(S32 x, S32 y, MASK mask) //----------------------------------------------------------------------------- BOOL LLFloaterImagePreview::handleMouseUp(S32 x, S32 y, MASK mask) { - gViewerWindow->setMouseCapture(FALSE); + gFocusMgr.setMouseCapture(FALSE); gViewerWindow->showCursor(); return LLFloater::handleMouseUp(x, y, mask); } @@ -629,7 +628,7 @@ LLImagePreviewAvatar::~LLImagePreviewAvatar() } -void LLImagePreviewAvatar::setPreviewTarget(const char* joint_name, const char* mesh_name, LLImageRaw* imagep, F32 distance, BOOL male) +void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male) { mTargetJoint = mDummyAvatar->mRoot.findJoint(joint_name); // clear out existing test mesh -- cgit v1.1