aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llfloateranimpreview.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/llfloateranimpreview.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/llfloateranimpreview.cpp')
-rw-r--r--linden/indra/newview/llfloateranimpreview.cpp45
1 files changed, 24 insertions, 21 deletions
diff --git a/linden/indra/newview/llfloateranimpreview.cpp b/linden/indra/newview/llfloateranimpreview.cpp
index 41a1a35..66b7a56 100644
--- a/linden/indra/newview/llfloateranimpreview.cpp
+++ b/linden/indra/newview/llfloateranimpreview.cpp
@@ -38,6 +38,7 @@
38#include "lldir.h" 38#include "lldir.h"
39#include "llvfile.h" 39#include "llvfile.h"
40#include "llapr.h" 40#include "llapr.h"
41#include "llstring.h"
41 42
42#include "llagent.h" 43#include "llagent.h"
43#include "llbbox.h" 44#include "llbbox.h"
@@ -48,6 +49,7 @@
48#include "lldrawpoolavatar.h" 49#include "lldrawpoolavatar.h"
49#include "llrender.h" 50#include "llrender.h"
50#include "llface.h" 51#include "llface.h"
52#include "llfocusmgr.h"
51#include "llkeyframemotion.h" 53#include "llkeyframemotion.h"
52#include "lllineeditor.h" 54#include "lllineeditor.h"
53#include "llsliderctrl.h" 55#include "llsliderctrl.h"
@@ -81,7 +83,7 @@ const F32 BASE_ANIM_TIME_OFFSET = 5.f;
81//----------------------------------------------------------------------------- 83//-----------------------------------------------------------------------------
82// LLFloaterAnimPreview() 84// LLFloaterAnimPreview()
83//----------------------------------------------------------------------------- 85//-----------------------------------------------------------------------------
84LLFloaterAnimPreview::LLFloaterAnimPreview(const char* filename) : 86LLFloaterAnimPreview::LLFloaterAnimPreview(const std::string& filename) :
85 LLFloaterNameDesc(filename) 87 LLFloaterNameDesc(filename)
86{ 88{
87 mLastMouseX = 0; 89 mLastMouseX = 0;
@@ -175,28 +177,28 @@ BOOL LLFloaterAnimPreview::postBuild()
175 mPlayButton = getChild<LLButton>( "play_btn"); 177 mPlayButton = getChild<LLButton>( "play_btn");
176 if (!mPlayButton) 178 if (!mPlayButton)
177 { 179 {
178 mPlayButton = new LLButton("play_btn", LLRect(0,0,0,0)); 180 mPlayButton = new LLButton(std::string("play_btn"), LLRect(0,0,0,0));
179 } 181 }
180 mPlayButton->setClickedCallback(onBtnPlay); 182 mPlayButton->setClickedCallback(onBtnPlay);
181 mPlayButton->setCallbackUserData(this); 183 mPlayButton->setCallbackUserData(this);
182 184
183 mPlayButton->setImages("button_anim_play.tga", 185 mPlayButton->setImages(std::string("button_anim_play.tga"),
184 "button_anim_play_selected.tga"); 186 std::string("button_anim_play_selected.tga"));
185 mPlayButton->setDisabledImages("",""); 187 mPlayButton->setDisabledImages(LLStringUtil::null,LLStringUtil::null);
186 188
187 mPlayButton->setScaleImage(TRUE); 189 mPlayButton->setScaleImage(TRUE);
188 190
189 mStopButton = getChild<LLButton>( "stop_btn"); 191 mStopButton = getChild<LLButton>( "stop_btn");
190 if (!mStopButton) 192 if (!mStopButton)
191 { 193 {
192 mStopButton = new LLButton("stop_btn", LLRect(0,0,0,0)); 194 mStopButton = new LLButton(std::string("stop_btn"), LLRect(0,0,0,0));
193 } 195 }
194 mStopButton->setClickedCallback(onBtnStop); 196 mStopButton->setClickedCallback(onBtnStop);
195 mStopButton->setCallbackUserData(this); 197 mStopButton->setCallbackUserData(this);
196 198
197 mStopButton->setImages("button_anim_stop.tga", 199 mStopButton->setImages(std::string("button_anim_stop.tga"),
198 "button_anim_stop_selected.tga"); 200 std::string("button_anim_stop_selected.tga"));
199 mStopButton->setDisabledImages("",""); 201 mStopButton->setDisabledImages(LLStringUtil::null,LLStringUtil::null);
200 202
201 mStopButton->setScaleImage(TRUE); 203 mStopButton->setScaleImage(TRUE);
202 204
@@ -225,7 +227,8 @@ BOOL LLFloaterAnimPreview::postBuild()
225 //childSetCommitCallback("ease_out_time", onCommitEaseOut, this); 227 //childSetCommitCallback("ease_out_time", onCommitEaseOut, this);
226 //childSetValidate("ease_out_time", validateEaseOut); 228 //childSetValidate("ease_out_time", validateEaseOut);
227 229
228 if (!stricmp(strrchr(mFilename.c_str(), '.'), ".bvh")) 230 std::string exten = gDirUtilp->getExtension(mFilename);
231 if (exten == "bvh")
229 { 232 {
230 // loading a bvh file 233 // loading a bvh file
231 234
@@ -313,10 +316,10 @@ BOOL LLFloaterAnimPreview::postBuild()
313 childSetValue("ease_in_time", LLSD(motionp->getEaseInDuration())); 316 childSetValue("ease_in_time", LLSD(motionp->getEaseInDuration()));
314 childSetValue("ease_out_time", LLSD(motionp->getEaseOutDuration())); 317 childSetValue("ease_out_time", LLSD(motionp->getEaseOutDuration()));
315 setEnabled(TRUE); 318 setEnabled(TRUE);
316 char seconds_string[128]; /*Flawfinder: ignore*/ 319 std::string seconds_string;
317 snprintf(seconds_string, sizeof(seconds_string), " - %.2f seconds", motionp->getDuration()); /* Flawfinder: ignore */ 320 seconds_string = llformat(" - %.2f seconds", motionp->getDuration());
318 321
319 setTitle(mFilename + LLString(seconds_string)); 322 setTitle(mFilename + std::string(seconds_string));
320 } 323 }
321 else 324 else
322 { 325 {
@@ -450,7 +453,7 @@ BOOL LLFloaterAnimPreview::handleMouseDown(S32 x, S32 y, MASK mask)
450 if (mPreviewRect.pointInRect(x, y)) 453 if (mPreviewRect.pointInRect(x, y))
451 { 454 {
452 bringToFront( x, y ); 455 bringToFront( x, y );
453 gViewerWindow->setMouseCapture(this); 456 gFocusMgr.setMouseCapture(this);
454 gViewerWindow->hideCursor(); 457 gViewerWindow->hideCursor();
455 mLastMouseX = x; 458 mLastMouseX = x;
456 mLastMouseY = y; 459 mLastMouseY = y;
@@ -465,7 +468,7 @@ BOOL LLFloaterAnimPreview::handleMouseDown(S32 x, S32 y, MASK mask)
465//----------------------------------------------------------------------------- 468//-----------------------------------------------------------------------------
466BOOL LLFloaterAnimPreview::handleMouseUp(S32 x, S32 y, MASK mask) 469BOOL LLFloaterAnimPreview::handleMouseUp(S32 x, S32 y, MASK mask)
467{ 470{
468 gViewerWindow->setMouseCapture(FALSE); 471 gFocusMgr.setMouseCapture(FALSE);
469 gViewerWindow->showCursor(); 472 gViewerWindow->showCursor();
470 return LLFloater::handleMouseUp(x, y, mask); 473 return LLFloater::handleMouseUp(x, y, mask);
471} 474}
@@ -928,8 +931,8 @@ void LLFloaterAnimPreview::refresh()
928 if (avatarp->areAnimationsPaused()) 931 if (avatarp->areAnimationsPaused())
929 { 932 {
930 933
931 mPlayButton->setImages("button_anim_play.tga", 934 mPlayButton->setImages(std::string("button_anim_play.tga"),
932 "button_anim_play_selected.tga"); 935 std::string("button_anim_play_selected.tga"));
933 936
934 } 937 }
935 else 938 else
@@ -939,16 +942,16 @@ void LLFloaterAnimPreview::refresh()
939 F32 fraction_complete = motionp->getLastUpdateTime() / motionp->getDuration(); 942 F32 fraction_complete = motionp->getLastUpdateTime() / motionp->getDuration();
940 childSetValue("playback_slider", fraction_complete); 943 childSetValue("playback_slider", fraction_complete);
941 } 944 }
942 mPlayButton->setImages("button_anim_pause.tga", 945 mPlayButton->setImages(std::string("button_anim_pause.tga"),
943 "button_anim_pause_selected.tga"); 946 std::string("button_anim_pause_selected.tga"));
944 947
945 } 948 }
946 } 949 }
947 else 950 else
948 { 951 {
949 mPauseRequest = avatarp->requestPause(); 952 mPauseRequest = avatarp->requestPause();
950 mPlayButton->setImages("button_anim_play.tga", 953 mPlayButton->setImages(std::string("button_anim_play.tga"),
951 "button_anim_play_selected.tga"); 954 std::string("button_anim_play_selected.tga"));
952 955
953 mStopButton->setEnabled(TRUE); // stop also resets, leave enabled. 956 mStopButton->setEnabled(TRUE); // stop also resets, leave enabled.
954 } 957 }