diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index 06de6f937..50da07787 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -291,9 +291,8 @@ void LLMultiSliderCtrl::onEditorCommit(const LLSD& value) val = (F32) atof( text.c_str() ); if( mMultiSlider->getMinValue() <= val && val <= mMultiSlider->getMaxValue() ) { - setCurSliderValue( val ); - if( (!mValidateCallback || mValidateCallback( this, mCallbackUserData )) && - (!mValidateSignal || (*(mValidateSignal))(this, val))) + setCurSliderValue( val ); // set the value temporarily so that the callback can retrieve it. + if( !mValidateSignal || (*(mValidateSignal))( this, val ) ) { success = TRUE; } @@ -322,8 +321,7 @@ void LLMultiSliderCtrl::onSliderCommit(const LLSD& value) F32 new_val = mMultiSlider->getCurSliderValue(); mCurValue = new_val; // set the value temporarily so that the callback can retrieve it. - if( (!mValidateCallback || mValidateCallback( this, mCallbackUserData )) && - (!mValidateSignal || (*mValidateSignal)(this, new_val ) )) + if( !mValidateSignal || (*(mValidateSignal))( this, new_val ) ) { success = TRUE; } diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 70cd043d5..9435f65bb 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -786,9 +786,9 @@ void LLPanel::childSetCommitCallback(const std::string& id, boost::function cb) { - LLUICtrl* child = getChild(id, true); + LLUICtrl* child = findChild(id); if (child) { child->setValidateBeforeCommit(cb); diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index b8253f471..d2ca151e5 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -178,7 +178,7 @@ public: // a named callback and reference it in XML. void childSetCommitCallback(const std::string& id, boost::function cb, void* data = NULL); - void childSetValidate(const std::string& id, BOOL (*cb)(LLUICtrl*, void*) ); + void childSetValidate(const std::string& id, boost::function cb ); void childSetColor(const std::string& id, const LLColor4& color); void childSetAlpha(const std::string& id, F32 alpha); diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index 42c72a2f5..594a2d890 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -227,9 +227,8 @@ void LLSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata ) val = (F32) atof( text.c_str() ); if( self->mSlider->getMinValue() <= val && val <= self->mSlider->getMaxValue() ) { - self->setValue( val ); - if( (!self->mValidateCallback || self->mValidateCallback( self, self->mCallbackUserData )) && - (!self->mValidateSignal || (*(self->mValidateSignal))( self, val ))) + self->setValue( val ); // set the value temporarily so that the callback can retrieve it. + if( !self->mValidateSignal || (*(self->mValidateSignal))( self, val ) ) { success = TRUE; } @@ -263,8 +262,7 @@ void LLSliderCtrl::onSliderCommit( LLUICtrl* ctrl, const LLSD& userdata ) F32 new_val = self->mSlider->getValueF32(); self->mValue = new_val; // set the value temporarily so that the callback can retrieve it. - if( (!self->mValidateCallback || self->mValidateCallback( self, self->mCallbackUserData )) && - (!self->mValidateSignal || (*(self->mValidateSignal))( self, new_val ))) + if( !self->mValidateSignal || (*(self->mValidateSignal))( self, new_val ) ) { success = TRUE; } diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index 37244e640..489f71282 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -198,8 +198,7 @@ void LLSpinCtrl::onUpBtn( const LLSD& data ) F32 saved_val = (F32)getValue().asReal(); setValue(val); - if( (mValidateCallback && !mValidateCallback( this, mCallbackUserData ) ) || - (mValidateSignal && !(*mValidateSignal)( this, val ) )) + if( mValidateSignal && !(*mValidateSignal)( this, val ) ) { setValue( saved_val ); reportInvalidData(); @@ -227,8 +226,7 @@ void LLSpinCtrl::onDownBtn( const LLSD& data ) F32 saved_val = (F32)getValue().asReal(); setValue(val); - if( (mValidateCallback && !mValidateCallback( this, mCallbackUserData ) ) || - (mValidateSignal && !(*mValidateSignal)( this, val ) )) + if( mValidateSignal && !(*mValidateSignal)( this, val ) ) { setValue( saved_val ); reportInvalidData(); @@ -317,9 +315,7 @@ void LLSpinCtrl::onEditorCommit( const LLSD& data ) F32 saved_val = mValue; mValue = val; - - if( (!mValidateCallback || mValidateCallback( this, mCallbackUserData )) && - (!mValidateSignal || (*mValidateSignal)(this, val) )) + if( !mValidateSignal || (*mValidateSignal)( this, val ) ) { success = TRUE; onCommit(); diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h index ce9f71aff..738ec3b06 100644 --- a/indra/llui/lltextbox.h +++ b/indra/llui/lltextbox.h @@ -140,7 +140,6 @@ private: std::vector mLineLengthList; callback_t mClickedCallback; - void* mCallbackUserData; }; #endif diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index 803cb7f0f..7dbca795d 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -45,9 +45,6 @@ LLUICtrl::LLUICtrl() : mViewModel(LLViewModelPtr(new LLViewModel)), mCommitSignal(NULL), mValidateSignal(NULL), - mCommitCallback(NULL), - mValidateCallback(NULL), - mCallbackUserData(NULL), mMouseEnterSignal(NULL), mMouseLeaveSignal(NULL), mTentative(FALSE), @@ -64,10 +61,7 @@ LLUICtrl::LLUICtrl(const std::string& name, const LLRect rect, BOOL mouse_opaque LLView( name, rect, mouse_opaque, reshape ), mCommitSignal(NULL), mValidateSignal(NULL), - mCommitCallback(NULL), mViewModel(LLViewModelPtr(new LLViewModel)), - mValidateCallback( NULL ), - mCallbackUserData( NULL ), mMouseEnterSignal(NULL), mMouseLeaveSignal(NULL), mTentative( FALSE ), @@ -113,10 +107,6 @@ void LLUICtrl::onMouseLeave(S32 x, S32 y, MASK mask) void LLUICtrl::onCommit() { - if( mCommitCallback ) - { - mCommitCallback( this, mCallbackUserData ); - } if (mCommitSignal) (*mCommitSignal)(this, getValue()); } @@ -641,4 +631,4 @@ boost::signals2::connection LLUICtrl::setMouseLeaveCallback( const commit_signal { if (!mMouseLeaveSignal) mMouseLeaveSignal = new commit_signal_t(); return mMouseLeaveSignal->connect(cb); -} \ No newline at end of file +} diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index 6109214cd..79d8fd8fc 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -52,9 +52,6 @@ public: typedef boost::function enable_callback_t; typedef boost::signals2::signal enable_signal_t; - typedef void (*LLUICtrlCallback)(LLUICtrl* ctrl, void* userdata); - typedef BOOL (*LLUICtrlValidate)(LLUICtrl* ctrl, void* userdata); - LLUICtrl(); LLUICtrl( const std::string& name, const LLRect rect = LLRect(), BOOL mouse_opaque = TRUE, commit_callback_t commit_callback = NULL, @@ -133,13 +130,6 @@ public: boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb ); // *TODO: Deprecate; for backwards compatability only: - //Keeping userdata around with legacy setCommitCallback because it's used ALL OVER THE PLACE. - void* getCallbackUserData() const { return mCallbackUserData; } - void setCallbackUserData( void* data ) { mCallbackUserData = data; } - - void setCommitCallback( void (*cb)(LLUICtrl*, void*) ) { mCommitCallback = cb; } - void setValidateBeforeCommit( BOOL(*cb)(LLUICtrl*, void*) ) { mValidateCallback = cb; } - // *TODO: Deprecate; for backwards compatability only: boost::signals2::connection setCommitCallback( boost::function cb, void* data); boost::signals2::connection setValidateBeforeCommit( boost::function cb ); @@ -171,10 +161,6 @@ protected: commit_signal_t* mMouseLeaveSignal; LLViewModelPtr mViewModel; - void (*mCommitCallback)( LLUICtrl* ctrl, void* userdata ); - BOOL (*mValidateCallback)( LLUICtrl* ctrl, void* userdata ); - - void* mCallbackUserData; private: diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index d82550fdd..623106533 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -172,7 +172,6 @@ set(viewer_SOURCE_FILES llflexibleobject.cpp llfloaterabout.cpp llfloateractivespeakers.cpp - llfloateranimpreview.cpp llfloaterauction.cpp llfloateravatarinfo.cpp llfloateravatarlist.cpp @@ -685,7 +684,6 @@ set(viewer_HEADER_FILES llflexibleobject.h llfloaterabout.h llfloateractivespeakers.h - llfloateranimpreview.h llfloaterauction.h llfloateravatarinfo.h llfloateravatarlist.h diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp deleted file mode 100644 index 8fdfc1a93..000000000 --- a/indra/newview/llfloateranimpreview.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file llfloateranimpreview.cpp - * @brief LLFloaterAnimPreview class implementation - * - * Copyright (c) 2012, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" -#include "llfloateranimpreview.h" - -LLFloaterAnimPreview::LLFloaterAnimPreview(LLSD const& filename) : LLFloaterNameDesc(filename) -{ -} - -BOOL LLFloaterAnimPreview::postBuild() -{ - if (!LLFloaterNameDesc::postBuild()) - { - return FALSE; - } - getChild("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); - return TRUE; -} diff --git a/indra/newview/llfloateranimpreview.h b/indra/newview/llfloateranimpreview.h deleted file mode 100644 index 7603286e7..000000000 --- a/indra/newview/llfloateranimpreview.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @file llfloateranimpreview.h - * @brief LLFloaterAnimPreview class definition - * - * Copyright (c) 2012, Linden Research, Inc. - * - * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 - * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. - * $/LicenseInfo$ - */ - -#ifndef LL_LLFLOATERANIMPREVIEW_H -#define LL_LLFLOATERANIMPREVIEW_H - -#include "llfloaternamedesc.h" - -class LLFloaterAnimPreview : public LLFloaterNameDesc { - public: - LLFloaterAnimPreview(LLSD const& filename); - virtual BOOL postBuild(void); -}; - -#endif // LL_LLFLOATERANIMPREVIEW_H diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index a5eb65b01..2544f6788 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -3,10 +3,9 @@ * @brief LLFloaterBvhPreview class implementation * * $LicenseInfo:firstyear=2004&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2004-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -37,6 +36,7 @@ #include "llbvhloader.h" #include "lldatapacker.h" #include "lldir.h" +#include "lleconomy.h" #include "llnotificationsutil.h" #include "llvfile.h" #include "llapr.h" @@ -68,7 +68,6 @@ #include "llvoavatarself.h" #include "pipeline.h" #include "lluictrlfactory.h" -#include "llviewercontrol.h" #include "hippogridmanager.h" @@ -76,8 +75,6 @@ #include "llinventorymodel.h" // gInventoryModel // -S32 LLFloaterBvhPreview::sUploadAmount = 10; - const S32 PREVIEW_BORDER_WIDTH = 2; const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH; const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE; @@ -143,17 +140,15 @@ std::string STATUS[] = "E_ST_BAD_ROOT" }; - //----------------------------------------------------------------------------- // LLFloaterBvhPreview() //----------------------------------------------------------------------------- LLFloaterBvhPreview::LLFloaterBvhPreview(const std::string& filename, void* item) : - LLFloaterNameDesc(filename) + LLFloaterNameDesc(filename, item) { // mItem = item; // - mLastMouseX = 0; mLastMouseY = 0; @@ -189,27 +184,27 @@ LLFloaterBvhPreview::LLFloaterBvhPreview(const std::string& filename, void* item //----------------------------------------------------------------------------- void LLFloaterBvhPreview::setAnimCallbacks() { - childSetCommitCallback("playback_slider", onSliderMove, this); + getChild("playback_slider")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onSliderMove, this)); - childSetCommitCallback("preview_base_anim", onCommitBaseAnim, this); - childSetValue("preview_base_anim", "Standing"); + getChild("preview_base_anim")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitBaseAnim, this)); + getChild("preview_base_anim")->setValue("Standing"); - childSetCommitCallback("priority", onCommitPriority, this); - childSetCommitCallback("loop_check", onCommitLoop, this); - childSetCommitCallback("loop_in_point", onCommitLoopIn, this); - childSetValidate("loop_in_point", validateLoopIn); - childSetCommitCallback("loop_out_point", onCommitLoopOut, this); - childSetValidate("loop_out_point", validateLoopOut); + getChild("priority")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitPriority, this)); + getChild("loop_check")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitLoop, this)); + getChild("loop_in_point")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitLoopIn, this)); + getChild("loop_in_point")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateLoopIn, this, _1)); + getChild("loop_out_point")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitLoopOut, this)); + getChild("loop_out_point")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateLoopOut, this, _1)); - childSetCommitCallback("hand_pose_combo", onCommitHandPose, this); + getChild("hand_pose_combo")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitHandPose, this)); - childSetCommitCallback("emote_combo", onCommitEmote, this); - childSetValue("emote_combo", "[None]"); + getChild("emote_combo")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitEmote, this)); + getChild("emote_combo")->setValue("[None]"); - childSetCommitCallback("ease_in_time", onCommitEaseIn, this); - childSetValidate("ease_in_time", validateEaseIn); - childSetCommitCallback("ease_out_time", onCommitEaseOut, this); - childSetValidate("ease_out_time", validateEaseOut); + getChild("ease_in_time")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitEaseIn, this)); + getChild("ease_in_time")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateEaseIn, this, _1)); + getChild("ease_out_time")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitEaseOut, this)); + getChild("ease_out_time")->setValidateBeforeCommit( boost::bind(&LLFloaterBvhPreview::validateEaseOut, this, _1)); } //----------------------------------------------------------------------------- @@ -228,11 +223,11 @@ BOOL LLFloaterBvhPreview::postBuild() mInWorld = gSavedSettings.getBOOL("PreviewAnimInWorld"); - childSetCommitCallback("name_form", onCommitName, this); + getChild("name_form")->setCommitCallback(boost::bind(&LLFloaterBvhPreview::onCommitName, this)); if (gSavedSettings.getBOOL("AscentPowerfulWizard")) { - childSetMaxValue("priority", 7); + getChild("priority")->setMaxValue(7); } childSetLabelArg("ok_btn", "[UPLOADFEE]", gHippoGridManager->getConnectedGrid()->getUploadFee()); @@ -244,12 +239,12 @@ BOOL LLFloaterBvhPreview::postBuild() r = getRect(); translate(0, 230); reshape(r.getWidth(), r.getHeight() - 230); - childSetValue("bad_animation_text", getString("in_world")); - childShow("bad_animation_text"); + getChild("bad_animation_text")->setValue(getString("in_world")); + getChildView("bad_animation_text")->setVisible(TRUE); } else { - childHide("bad_animation_text"); + getChildView("bad_animation_text")->setVisible(FALSE); } mPreviewRect.set(PREVIEW_HPAD, @@ -263,10 +258,6 @@ BOOL LLFloaterBvhPreview::postBuild() r.set( btn_left, y, btn_left + 32, y - BTN_HEIGHT ); mPlayButton = getChild( "play_btn"); - if (!mPlayButton) - { - mPlayButton = new LLButton("play_btn"); - } mPlayButton->setClickedCallback(boost::bind(&LLFloaterBvhPreview::onBtnPlay,this)); mPlayButton->setImages(std::string("button_anim_play.tga"), @@ -278,10 +269,6 @@ BOOL LLFloaterBvhPreview::postBuild() mPlayButton->setScaleImage(TRUE); mStopButton = getChild( "stop_btn"); - if (!mStopButton) - { - mStopButton = new LLButton("stop_btn"); - } mStopButton->setClickedCallback(boost::bind(&LLFloaterBvhPreview::onBtnStop, this)); mStopButton->setImages(std::string("button_anim_stop.tga"), @@ -293,27 +280,6 @@ BOOL LLFloaterBvhPreview::postBuild() mStopButton->setScaleImage(TRUE); r.set(r.mRight + PREVIEW_HPAD, y, getRect().getWidth() - PREVIEW_HPAD, y - BTN_HEIGHT); - //childSetCommitCallback("playback_slider", onSliderMove, this); - - //childSetCommitCallback("preview_base_anim", onCommitBaseAnim, this); - //childSetValue("preview_base_anim", "Standing"); - - //childSetCommitCallback("priority", onCommitPriority, this); - //childSetCommitCallback("loop_check", onCommitLoop, this); - //childSetCommitCallback("loop_in_point", onCommitLoopIn, this); - //childSetValidate("loop_in_point", validateLoopIn); - //childSetCommitCallback("loop_out_point", onCommitLoopOut, this); - //childSetValidate("loop_out_point", validateLoopOut); - - //childSetCommitCallback("hand_pose_combo", onCommitHandPose, this); - - //childSetCommitCallback("emote_combo", onCommitEmote, this); - //childSetValue("emote_combo", "[None]"); - - //childSetCommitCallback("ease_in_time", onCommitEaseIn, this); - //childSetValidate("ease_in_time", validateEaseIn); - //childSetCommitCallback("ease_out_time", onCommitEaseOut, this); - //childSetValidate("ease_out_time", validateEaseOut); // moved declaration from below BOOL success = false; @@ -364,6 +330,7 @@ BOOL LLFloaterBvhPreview::postBuild() // moved everything bvh from below if(loaderp && loaderp->isInitialized() && loaderp->getDuration() <= MAX_ANIM_DURATION) { + // generate unique id for this motion mTransactionID.generate(); mMotionID = mTransactionID.makeAssetID(gAgent.getSecureSessionID()); @@ -373,13 +340,9 @@ BOOL LLFloaterBvhPreview::postBuild() // this motion will not request an asset transfer until next update, so we have a chance to // load the keyframe data locally if (mInWorld) - { motionp = (LLKeyframeMotion*)gAgentAvatarp->createMotion(mMotionID); - } else - { motionp = (LLKeyframeMotion*)mAnimPreview->getDummyAvatar()->createMotion(mMotionID); - } // create data buffer for keyframe initialization S32 buffer_size = loaderp->getOutputSize(); @@ -476,21 +439,20 @@ BOOL LLFloaterBvhPreview::postBuild() mAnimPreview->setZoom(camera_zoom); } - motionp->setName(childGetValue("name_form").asString()); + motionp->setName(getChild("name_form")->getValue().asString()); if (!mInWorld) - { mAnimPreview->getDummyAvatar()->startMotion(mMotionID); - } - childSetMinValue("playback_slider", 0.0); - childSetMaxValue("playback_slider", 1.0); - childSetValue("loop_check", LLSD(motionp->getLoop())); - childSetValue("loop_in_point", LLSD(motionp->getLoopIn() / motionp->getDuration() * 100.f)); - childSetValue("loop_out_point", LLSD(motionp->getLoopOut() / motionp->getDuration() * 100.f)); - childSetValue("priority", LLSD((F32)motionp->getPriority())); - childSetValue("hand_pose_combo", LLHandMotion::getHandPoseName(motionp->getHandPose())); - childSetValue("ease_in_time", LLSD(motionp->getEaseInDuration())); - childSetValue("ease_out_time", LLSD(motionp->getEaseOutDuration())); + getChild("playback_slider")->setMinValue(0.0); + getChild("playback_slider")->setMaxValue(1.0); + + getChild("loop_check")->setValue(LLSD(motionp->getLoop())); + getChild("loop_in_point")->setValue(LLSD(motionp->getLoopIn() / motionp->getDuration() * 100.f)); + getChild("loop_out_point")->setValue(LLSD(motionp->getLoopOut() / motionp->getDuration() * 100.f)); + getChild("priority")->setValue(LLSD((F32)motionp->getPriority())); + getChild("hand_pose_combo")->setValue(LLHandMotion::getHandPoseName(motionp->getHandPose())); + getChild("ease_in_time")->setValue(LLSD(motionp->getEaseInDuration())); + getChild("ease_out_time")->setValue(LLSD(motionp->getEaseOutDuration())); setEnabled(TRUE); std::string seconds_string; seconds_string = llformat(" - %.2f seconds", motionp->getDuration()); @@ -501,7 +463,7 @@ BOOL LLFloaterBvhPreview::postBuild() { mAnimPreview = NULL; mMotionID.setNull(); - childSetValue("bad_animation_text", getString("failed_to_initialize")); + getChild("bad_animation_text")->setValue(getString("failed_to_initialize")); } @@ -587,38 +549,37 @@ void LLFloaterBvhPreview::draw() void LLFloaterBvhPreview::resetMotion() { LLVOAvatar* avatarp; - if (mInWorld) - { + if (mInWorld && gAgentAvatarp) avatarp = gAgentAvatarp; - } - else - { + else if (mAnimPreview) avatarp = mAnimPreview->getDummyAvatar(); - } - if (!avatarp) - { + else return; - } BOOL paused = avatarp->areAnimationsPaused(); - // *TODO: Fix awful casting hack - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); + LLKeyframeMotion* motionp = dynamic_cast(avatarp->findMotion(mMotionID)); + if( motionp ) + { + // Set emotion + std::string emote = getChild("emote_combo")->getValue().asString(); + motionp->setEmote(mIDList[emote]); + } - // Set emotion - std::string emote = childGetValue("emote_combo").asString(); - motionp->setEmote(mIDList[emote]); - - LLUUID base_id = mIDList[childGetValue("preview_base_anim").asString()]; + LLUUID base_id = mIDList[getChild("preview_base_anim")->getValue().asString()]; avatarp->deactivateAllMotions(); - avatarp->startMotion(base_id, BASE_ANIM_TIME_OFFSET); avatarp->startMotion(mMotionID, 0.0f); - childSetValue("playback_slider", 0.0f); + avatarp->startMotion(base_id, BASE_ANIM_TIME_OFFSET); + getChild("playback_slider")->setValue(0.0f); // Set pose - std::string handpose = childGetValue("hand_pose_combo").asString(); + std::string handpose = getChild("hand_pose_combo")->getValue().asString(); avatarp->startMotion( ANIM_AGENT_HAND_MOTION, 0.0f ); - motionp->setHandPose(LLHandMotion::getHandPose(handpose)); + + if( motionp ) + { + motionp->setHandPose(LLHandMotion::getHandPose(handpose)); + } if (paused) { @@ -667,9 +628,7 @@ BOOL LLFloaterBvhPreview::handleMouseUp(S32 x, S32 y, MASK mask) BOOL LLFloaterBvhPreview::handleHover(S32 x, S32 y, MASK mask) { if (mInWorld) - { return TRUE; - } MASK local_mask = mask & ~MASK_ALT; @@ -726,11 +685,12 @@ BOOL LLFloaterBvhPreview::handleHover(S32 x, S32 y, MASK mask) //----------------------------------------------------------------------------- BOOL LLFloaterBvhPreview::handleScrollWheel(S32 x, S32 y, S32 clicks) { - if (!mInWorld) - { - mAnimPreview->zoom((F32)clicks * -0.2f); - mAnimPreview->requestUpdate(); - } + if (mInWorld || !mAnimPreview) + return false; + + mAnimPreview->zoom((F32)clicks * -0.2f); + mAnimPreview->requestUpdate(); + return TRUE; } @@ -740,9 +700,7 @@ BOOL LLFloaterBvhPreview::handleScrollWheel(S32 x, S32 y, S32 clicks) void LLFloaterBvhPreview::onMouseCaptureLost() { if (!mInWorld) - { gViewerWindow->showCursor(); - } } //----------------------------------------------------------------------------- @@ -756,38 +714,25 @@ void LLFloaterBvhPreview::onBtnPlay() if (mMotionID.notNull()) { LLVOAvatar* avatarp; - if (mInWorld) - { - if (!gAgentAvatarp) - { - return; - } + if (mInWorld && gAgentAvatarp) avatarp = gAgentAvatarp; - } - else - { - if (!mAnimPreview) - { - return; - } + else if (mAnimPreview) avatarp = mAnimPreview->getDummyAvatar(); - } + else + return; if(!avatarp->isMotionActive(mMotionID)) { resetMotion(); mPauseRequest = NULL; } - else + else if (avatarp->areAnimationsPaused()) { - if (avatarp->areAnimationsPaused()) - { - mPauseRequest = NULL; - } - else - { - mPauseRequest = avatarp->requestPause(); - } + mPauseRequest = NULL; + } + else //onBtnPause() does this in v3 + { + mPauseRequest = avatarp->requestPause(); } } } @@ -803,22 +748,12 @@ void LLFloaterBvhPreview::onBtnStop() if (mMotionID.notNull()) { LLVOAvatar* avatarp; - if (mInWorld) - { - if (!gAgentAvatarp) - { - return; - } + if (mInWorld && gAgentAvatarp) avatarp = gAgentAvatarp; - } - else - { - if (!mAnimPreview) - { - return; - } + else if (mAnimPreview) avatarp = mAnimPreview->getDummyAvatar(); - } + else + return; resetMotion(); mPauseRequest = avatarp->requestPause(); } @@ -827,435 +762,320 @@ void LLFloaterBvhPreview::onBtnStop() //----------------------------------------------------------------------------- // onSliderMove() //----------------------------------------------------------------------------- -void LLFloaterBvhPreview::onSliderMove(LLUICtrl* ctrl, void*user_data) +void LLFloaterBvhPreview::onSliderMove() { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)user_data; - if (!previewp->getEnabled()) + if (!getEnabled()) return; LLVOAvatar* avatarp; - if (previewp->mInWorld) - { - if (!gAgentAvatarp) - { - return; - } + if (mInWorld && gAgentAvatarp) avatarp = gAgentAvatarp; - } + else if (mAnimPreview) + avatarp = mAnimPreview->getDummyAvatar(); else - { - if (!previewp->mAnimPreview) - { - return; - } - avatarp = previewp->mAnimPreview->getDummyAvatar(); - } - F32 slider_value = (F32)previewp->childGetValue("playback_slider").asReal(); - LLUUID base_id = previewp->mIDList[previewp->childGetValue("preview_base_anim").asString()]; - LLMotion* motionp = avatarp->findMotion(previewp->mMotionID); + return; + + F32 slider_value = (F32)getChild("playback_slider")->getValue().asReal(); + LLUUID base_id = mIDList[getChild("preview_base_anim")->getValue().asString()]; + LLMotion* motionp = avatarp->findMotion(mMotionID); F32 duration = motionp->getDuration();// + motionp->getEaseOutDuration(); F32 delta_time = duration * slider_value; avatarp->deactivateAllMotions(); avatarp->startMotion(base_id, delta_time + BASE_ANIM_TIME_OFFSET); - avatarp->startMotion(previewp->mMotionID, delta_time); - previewp->mPauseRequest = avatarp->requestPause(); - previewp->refresh(); + avatarp->startMotion(mMotionID, delta_time); + mPauseRequest = avatarp->requestPause(); + refresh(); } //----------------------------------------------------------------------------- // onCommitBaseAnim() //----------------------------------------------------------------------------- -void LLFloaterBvhPreview::onCommitBaseAnim(LLUICtrl* ctrl, void* data) +void LLFloaterBvhPreview::onCommitBaseAnim() { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)data; - if (!previewp->getEnabled()) + if (!getEnabled()) return; LLVOAvatar* avatarp; - if (previewp->mInWorld) - { - if (!gAgentAvatarp) - { - return; - } + if (mInWorld && gAgentAvatarp) avatarp = gAgentAvatarp; - } + else if (mAnimPreview) + avatarp = mAnimPreview->getDummyAvatar(); else - { - if (!previewp->mAnimPreview) - { - return; - } - avatarp = previewp->mAnimPreview->getDummyAvatar(); - } + return; BOOL paused = avatarp->areAnimationsPaused(); // stop all other possible base motions - avatarp->stopMotion(ANIM_AGENT_STAND, TRUE); - avatarp->stopMotion(ANIM_AGENT_WALK, TRUE); - avatarp->stopMotion(ANIM_AGENT_SIT, TRUE); - avatarp->stopMotion(ANIM_AGENT_HOVER, TRUE); + avatarp->stopMotion(mIDList["Standing"], TRUE); + avatarp->stopMotion(mIDList["Walking"], TRUE); + avatarp->stopMotion(mIDList["Sitting"], TRUE); + avatarp->stopMotion(mIDList["Flying"], TRUE); - previewp->resetMotion(); + resetMotion(); if (!paused) { - previewp->mPauseRequest = NULL; + mPauseRequest = NULL; } } //----------------------------------------------------------------------------- // onCommitLoop() //----------------------------------------------------------------------------- -void LLFloaterBvhPreview::onCommitLoop(LLUICtrl* ctrl, void* data) +void LLFloaterBvhPreview::onCommitLoop() { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)data; - if (!previewp->getEnabled()) + if (!getEnabled()) return; - + LLVOAvatar* avatarp; - if (previewp->mInWorld) - { - if (!gAgentAvatarp) - { - return; - } + if (mInWorld && gAgentAvatarp) avatarp = gAgentAvatarp; - } + else if (mAnimPreview) + avatarp = mAnimPreview->getDummyAvatar(); else - { - if (!previewp->mAnimPreview) - { - return; - } - avatarp = previewp->mAnimPreview->getDummyAvatar(); - } - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); + return; + + LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); if (motionp) { - motionp->setLoop(previewp->childGetValue("loop_check").asBoolean()); - motionp->setLoopIn((F32)previewp->childGetValue("loop_in_point").asReal() * 0.01f * motionp->getDuration()); - motionp->setLoopOut((F32)previewp->childGetValue("loop_out_point").asReal() * 0.01f * motionp->getDuration()); + motionp->setLoop(getChild("loop_check")->getValue().asBoolean()); + motionp->setLoopIn((F32)getChild("loop_in_point")->getValue().asReal() * 0.01f * motionp->getDuration()); + motionp->setLoopOut((F32)getChild("loop_out_point")->getValue().asReal() * 0.01f * motionp->getDuration()); } } //----------------------------------------------------------------------------- // onCommitLoopIn() //----------------------------------------------------------------------------- -void LLFloaterBvhPreview::onCommitLoopIn(LLUICtrl* ctrl, void* data) +void LLFloaterBvhPreview::onCommitLoopIn() { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)data; - if (!previewp->getEnabled()) + if (!getEnabled()) return; LLVOAvatar* avatarp; - if (previewp->mInWorld) - { - if (!gAgentAvatarp) - { - return; - } + if (mInWorld && gAgentAvatarp) avatarp = gAgentAvatarp; - } + else if (mAnimPreview) + avatarp = mAnimPreview->getDummyAvatar(); else - { - if (!previewp->mAnimPreview) - { - return; - } - avatarp = previewp->mAnimPreview->getDummyAvatar(); - } - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); + return; + + LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); if (motionp) { - motionp->setLoopIn((F32)previewp->childGetValue("loop_in_point").asReal() / 100.f); - previewp->resetMotion(); - previewp->childSetValue("loop_check", LLSD(TRUE)); - onCommitLoop(ctrl, data); + motionp->setLoopIn((F32)getChild("loop_in_point")->getValue().asReal() / 100.f); + resetMotion(); + getChild("loop_check")->setValue(LLSD(TRUE)); + onCommitLoop(); } } //----------------------------------------------------------------------------- // onCommitLoopOut() //----------------------------------------------------------------------------- -void LLFloaterBvhPreview::onCommitLoopOut(LLUICtrl* ctrl, void* data) +void LLFloaterBvhPreview::onCommitLoopOut() { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)data; - if (!previewp->getEnabled()) + if (!getEnabled()) return; LLVOAvatar* avatarp; - if (previewp->mInWorld) - { - if (!gAgentAvatarp) - { - return; - } + if (mInWorld && gAgentAvatarp) avatarp = gAgentAvatarp; - } + else if (mAnimPreview) + avatarp = mAnimPreview->getDummyAvatar(); else - { - if (!previewp->mAnimPreview) - { - return; - } - avatarp = previewp->mAnimPreview->getDummyAvatar(); - } - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); + return; + + LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); if (motionp) { - motionp->setLoopOut((F32)previewp->childGetValue("loop_out_point").asReal() * 0.01f * motionp->getDuration()); - previewp->resetMotion(); - previewp->childSetValue("loop_check", LLSD(TRUE)); - onCommitLoop(ctrl, data); + motionp->setLoopOut((F32)getChild("loop_out_point")->getValue().asReal() * 0.01f * motionp->getDuration()); + resetMotion(); + getChild("loop_check")->setValue(LLSD(TRUE)); + onCommitLoop(); } } //----------------------------------------------------------------------------- // onCommitName() //----------------------------------------------------------------------------- -void LLFloaterBvhPreview::onCommitName(LLUICtrl* ctrl, void* data) +void LLFloaterBvhPreview::onCommitName() { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)data; - if (!previewp->getEnabled()) + if (!getEnabled()) return; LLVOAvatar* avatarp; - if (previewp->mInWorld) - { - if (!gAgentAvatarp) - { - return; - } + if (mInWorld && gAgentAvatarp) avatarp = gAgentAvatarp; - } + else if (mAnimPreview) + avatarp = mAnimPreview->getDummyAvatar(); else - { - if (!previewp->mAnimPreview) - { - return; - } - avatarp = previewp->mAnimPreview->getDummyAvatar(); - } - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); + return; + + LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); if (motionp) { - motionp->setName(previewp->childGetValue("name_form").asString()); + motionp->setName(getChild("name_form")->getValue().asString()); } - LLFloaterNameDesc::doCommit(ctrl, data); + doCommit(); } //----------------------------------------------------------------------------- // onCommitHandPose() //----------------------------------------------------------------------------- -void LLFloaterBvhPreview::onCommitHandPose(LLUICtrl* ctrl, void* data) +void LLFloaterBvhPreview::onCommitHandPose() { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)data; - if (!previewp->getEnabled()) + if (!getEnabled()) return; - previewp->resetMotion(); // sets hand pose + resetMotion(); // sets hand pose } //----------------------------------------------------------------------------- // onCommitEmote() //----------------------------------------------------------------------------- -void LLFloaterBvhPreview::onCommitEmote(LLUICtrl* ctrl, void* data) +void LLFloaterBvhPreview::onCommitEmote() { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)data; - if (!previewp->getEnabled()) + if (!getEnabled()) return; - previewp->resetMotion(); // ssts emote + resetMotion(); // ssts emote } //----------------------------------------------------------------------------- // onCommitPriority() //----------------------------------------------------------------------------- -void LLFloaterBvhPreview::onCommitPriority(LLUICtrl* ctrl, void* data) +void LLFloaterBvhPreview::onCommitPriority() { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)data; - if (!previewp->getEnabled()) + if (!getEnabled()) return; LLVOAvatar* avatarp; - if (previewp->mInWorld) - { - if (!gAgentAvatarp) - { - return; - } + if (mInWorld && gAgentAvatarp) avatarp = gAgentAvatarp; - } + else if (mAnimPreview) + avatarp = mAnimPreview->getDummyAvatar(); else - { - if (!previewp->mAnimPreview) - { - return; - } - avatarp = previewp->mAnimPreview->getDummyAvatar(); - } - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); + return; - motionp->setPriority(llfloor((F32)previewp->childGetValue("priority").asReal())); + LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); + + motionp->setPriority(llfloor((F32)getChild("priority")->getValue().asReal())); } //----------------------------------------------------------------------------- // onCommitEaseIn() //----------------------------------------------------------------------------- -void LLFloaterBvhPreview::onCommitEaseIn(LLUICtrl* ctrl, void* data) +void LLFloaterBvhPreview::onCommitEaseIn() { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)data; - if (!previewp->getEnabled()) + if (!getEnabled()) return; LLVOAvatar* avatarp; - if (previewp->mInWorld) - { - if (!gAgentAvatarp) - { - return; - } + if (mInWorld && gAgentAvatarp) avatarp = gAgentAvatarp; - } + else if (mAnimPreview) + avatarp = mAnimPreview->getDummyAvatar(); else - { - if (!previewp->mAnimPreview) - { - return; - } - avatarp = previewp->mAnimPreview->getDummyAvatar(); - } - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); + return; - motionp->setEaseIn((F32)previewp->childGetValue("ease_in_time").asReal()); - previewp->resetMotion(); + LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); + + motionp->setEaseIn((F32)getChild("ease_in_time")->getValue().asReal()); + resetMotion(); } //----------------------------------------------------------------------------- // onCommitEaseOut() //----------------------------------------------------------------------------- -void LLFloaterBvhPreview::onCommitEaseOut(LLUICtrl* ctrl, void* data) +void LLFloaterBvhPreview::onCommitEaseOut() { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)data; - if (!previewp->getEnabled()) + if (!getEnabled()) return; LLVOAvatar* avatarp; - if (previewp->mInWorld) - { - if (!gAgentAvatarp) - { - return; - } + if (mInWorld && gAgentAvatarp) avatarp = gAgentAvatarp; - } + else if (mAnimPreview) + avatarp = mAnimPreview->getDummyAvatar(); else - { - if (!previewp->mAnimPreview) - { - return; - } - avatarp = previewp->mAnimPreview->getDummyAvatar(); - } - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); + return; - motionp->setEaseOut((F32)previewp->childGetValue("ease_out_time").asReal()); - previewp->resetMotion(); + LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); + + motionp->setEaseOut((F32)getChild("ease_out_time")->getValue().asReal()); + resetMotion(); } //----------------------------------------------------------------------------- // validateEaseIn() //----------------------------------------------------------------------------- -BOOL LLFloaterBvhPreview::validateEaseIn(LLUICtrl* spin, void* data) +bool LLFloaterBvhPreview::validateEaseIn(const LLSD& data) { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)data; - if (!previewp->getEnabled()) - return FALSE; + if (!getEnabled()) + return false; LLVOAvatar* avatarp; - if (previewp->mInWorld) - { - if (!gAgentAvatarp) - { - return FALSE; - } + if (mInWorld && gAgentAvatarp) avatarp = gAgentAvatarp; - } + else if (mAnimPreview) + avatarp = mAnimPreview->getDummyAvatar(); else - { - if (!previewp->mAnimPreview) - { - return FALSE; - } - avatarp = previewp->mAnimPreview->getDummyAvatar(); - } - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); + return false; + + LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); if (!motionp->getLoop()) { - F32 new_ease_in = llclamp((F32)previewp->childGetValue("ease_in_time").asReal(), 0.f, motionp->getDuration() - motionp->getEaseOutDuration()); - previewp->childSetValue("ease_in_time", LLSD(new_ease_in)); + F32 new_ease_in = llclamp((F32)getChild("ease_in_time")->getValue().asReal(), 0.f, motionp->getDuration() - motionp->getEaseOutDuration()); + getChild("ease_in_time")->setValue(LLSD(new_ease_in)); } - return TRUE; + return true; } //----------------------------------------------------------------------------- // validateEaseOut() //----------------------------------------------------------------------------- -BOOL LLFloaterBvhPreview::validateEaseOut(LLUICtrl* spin, void* data) +bool LLFloaterBvhPreview::validateEaseOut(const LLSD& data) { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)data; - - if (!previewp->getEnabled()) - return FALSE; + if (!getEnabled()) + return false; LLVOAvatar* avatarp; - if (previewp->mInWorld) - { - if (!gAgentAvatarp) - { - return FALSE; - } + if (mInWorld && gAgentAvatarp) avatarp = gAgentAvatarp; - } + else if (mAnimPreview) + avatarp = mAnimPreview->getDummyAvatar(); else - { - if (!previewp->mAnimPreview) - { - return FALSE; - } - avatarp = previewp->mAnimPreview->getDummyAvatar(); - } - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); + return false; + + LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); if (!motionp->getLoop()) { - F32 new_ease_out = llclamp((F32)previewp->childGetValue("ease_out_time").asReal(), 0.f, motionp->getDuration() - motionp->getEaseInDuration()); - previewp->childSetValue("ease_out_time", LLSD(new_ease_out)); + F32 new_ease_out = llclamp((F32)getChild("ease_out_time")->getValue().asReal(), 0.f, motionp->getDuration() - motionp->getEaseInDuration()); + getChild("ease_out_time")->setValue(LLSD(new_ease_out)); } - return TRUE; + return true; } //----------------------------------------------------------------------------- // validateLoopIn() //----------------------------------------------------------------------------- -BOOL LLFloaterBvhPreview::validateLoopIn(LLUICtrl* ctrl, void* data) +bool LLFloaterBvhPreview::validateLoopIn(const LLSD& data) { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)data; - if (!previewp->getEnabled()) - return FALSE; + if (!getEnabled()) + return false; - F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal(); - F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal(); + F32 loop_in_value = (F32)getChild("loop_in_point")->getValue().asReal(); + F32 loop_out_value = (F32)getChild("loop_out_point")->getValue().asReal(); if (loop_in_value < 0.f) { @@ -1270,21 +1090,20 @@ BOOL LLFloaterBvhPreview::validateLoopIn(LLUICtrl* ctrl, void* data) loop_in_value = loop_out_value; } - previewp->childSetValue("loop_in_point", LLSD(loop_in_value)); - return TRUE; + getChild("loop_in_point")->setValue(LLSD(loop_in_value)); + return true; } //----------------------------------------------------------------------------- // validateLoopOut() //----------------------------------------------------------------------------- -BOOL LLFloaterBvhPreview::validateLoopOut(LLUICtrl* spin, void* data) +bool LLFloaterBvhPreview::validateLoopOut(const LLSD& data) { - LLFloaterBvhPreview* previewp = (LLFloaterBvhPreview*)data; - if (!previewp->getEnabled()) - return FALSE; + if (!getEnabled()) + return false; - F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal(); - F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal(); + F32 loop_out_value = (F32)getChild("loop_out_point")->getValue().asReal(); + F32 loop_in_value = (F32)getChild("loop_in_point")->getValue().asReal(); if (loop_out_value < 0.f) { @@ -1299,8 +1118,8 @@ BOOL LLFloaterBvhPreview::validateLoopOut(LLUICtrl* spin, void* data) loop_out_value = loop_in_value; } - previewp->childSetValue("loop_out_point", LLSD(loop_out_value)); - return TRUE; + getChild("loop_out_point")->setValue(LLSD(loop_out_value)); + return true; } @@ -1309,66 +1128,59 @@ BOOL LLFloaterBvhPreview::validateLoopOut(LLUICtrl* spin, void* data) //----------------------------------------------------------------------------- void LLFloaterBvhPreview::refresh() { + // Are we showing the play button (default) or the pause button? + bool show_play = true; if (!mAnimPreview) { - childShow("bad_animation_text"); + getChildView("bad_animation_text")->setVisible(TRUE); + // play button visible but disabled mPlayButton->setEnabled(FALSE); mStopButton->setEnabled(FALSE); - childDisable("ok_btn"); + getChildView("ok_btn")->setEnabled(FALSE); } else { if (!mInWorld) - { - childHide("bad_animation_text"); - } + getChildView("bad_animation_text")->setVisible(FALSE); + // re-enabled in case previous animation was bad mPlayButton->setEnabled(TRUE); + mStopButton->setEnabled(TRUE); LLVOAvatar* avatarp; - if (mInWorld) - { + if (mInWorld && gAgentAvatarp) avatarp = gAgentAvatarp; - } - else - { + else if (mAnimPreview) avatarp = mAnimPreview->getDummyAvatar(); - } + else + return; if (avatarp->isMotionActive(mMotionID)) { mStopButton->setEnabled(TRUE); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); - if (avatarp->areAnimationsPaused()) - { - - mPlayButton->setImages(std::string("button_anim_play.tga"), - std::string("button_anim_play_selected.tga")); - - } - else + if (!avatarp->areAnimationsPaused()) { + // animation is playing if (motionp) { F32 fraction_complete = motionp->getLastUpdateTime() / motionp->getDuration(); - childSetValue("playback_slider", fraction_complete); + getChild("playback_slider")->setValue(fraction_complete); } - mPlayButton->setImages(std::string("button_anim_pause.tga"), - std::string("button_anim_pause_selected.tga")); - + show_play = false; } } else { + // Motion just finished playing mPauseRequest = avatarp->requestPause(); - mPlayButton->setImages(std::string("button_anim_play.tga"), - std::string("button_anim_play_selected.tga")); - - mStopButton->setEnabled(TRUE); // stop also resets, leave enabled. } - childEnable("ok_btn"); + getChildView("ok_btn")->setEnabled(TRUE); if (!mInWorld) - { mAnimPreview->requestUpdate(); - } } + if (show_play) + mPlayButton->setImages(std::string("button_anim_play.tga"), std::string("button_anim_play_selected.tga")); + else + mPlayButton->setImages(std::string("button_anim_pause.tga"), std::string("button_anim_pause_selected.tga")); + } //----------------------------------------------------------------------------- @@ -1403,10 +1215,10 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata) file.setMaxSize(size); if (file.write((U8*)buffer, size)) { - std::string name = floaterp->childGetValue("name_form").asString(); - std::string desc = floaterp->childGetValue("description_form").asString(); + std::string name = floaterp->getChild("name_form")->getValue().asString(); + std::string desc = floaterp->getChild("description_form")->getValue().asString(); LLAssetStorage::LLStoreAssetCallback callback = NULL; - S32 expected_upload_cost = sUploadAmount; + S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); void *userdata = NULL; // @@ -1572,9 +1384,13 @@ BOOL LLPreviewAnimation::render() LLVertexBuffer::unbind(); LLGLDepthTest gls_depth(GL_TRUE); - LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool(); - avatarp->dirtyMesh(); - avatarPoolp->renderAvatars(avatarp); // renders only one avatar + LLFace* face = avatarp->mDrawable->getFace(0); + if (face) + { + LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)face->getPool(); + avatarp->dirtyMesh(); + avatarPoolp->renderAvatars(avatarp); // renders only one avatar + } } gGL.color4f(1,1,1,1); diff --git a/indra/newview/llfloaterbvhpreview.h b/indra/newview/llfloaterbvhpreview.h index 78b9db6a0..7f31054c0 100644 --- a/indra/newview/llfloaterbvhpreview.h +++ b/indra/newview/llfloaterbvhpreview.h @@ -3,10 +3,9 @@ * @brief LLFloaterBvhPreview class definition * * $LicenseInfo:firstyear=2004&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2004-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -92,22 +91,21 @@ public: void onBtnPlay(); void onBtnStop(); - static void setUploadAmount(S32 amount) { sUploadAmount = amount; } - static void onSliderMove(LLUICtrl*, void*); - static void onCommitBaseAnim(LLUICtrl*, void*); - static void onCommitLoop(LLUICtrl*, void*); - static void onCommitLoopIn(LLUICtrl*, void*); - static void onCommitLoopOut(LLUICtrl*, void*); - static BOOL validateLoopIn(LLUICtrl*, void*); - static BOOL validateLoopOut(LLUICtrl*, void*); - static void onCommitName(LLUICtrl*, void*); - static void onCommitHandPose(LLUICtrl*, void*); - static void onCommitEmote(LLUICtrl*, void*); - static void onCommitPriority(LLUICtrl*, void*); - static void onCommitEaseIn(LLUICtrl*, void*); - static void onCommitEaseOut(LLUICtrl*, void*); - static BOOL validateEaseIn(LLUICtrl*, void*); - static BOOL validateEaseOut(LLUICtrl*, void*); + void onSliderMove(); + void onCommitBaseAnim(); + void onCommitLoop(); + void onCommitLoopIn(); + void onCommitLoopOut(); + bool validateLoopIn(const LLSD& data); + bool validateLoopOut(const LLSD& data); + void onCommitName(); + void onCommitHandPose(); + void onCommitEmote(); + void onCommitPriority(); + void onCommitEaseIn(); + void onCommitEaseOut(); + bool validateEaseIn(const LLSD& data); + bool validateEaseOut(const LLSD& data); static void onBtnOK(void*); static void onSaveComplete(const LLUUID& asset_uuid, LLAssetType::EType type, @@ -129,14 +127,10 @@ protected: LLRectf mPreviewImageRect; LLAssetID mMotionID; LLTransactionID mTransactionID; - BOOL mEnabled; BOOL mInWorld; LLAnimPauseRequest mPauseRequest; std::map mIDList; - - static S32 sUploadAmount; - // void* mItem; // diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index a46790763..74093f243 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -3,10 +3,9 @@ * @brief LLFloaterImagePreview class implementation * * $LicenseInfo:firstyear=2004&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2004-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -60,15 +59,9 @@ #include "llviewershadermgr.h" #include "llviewertexturelist.h" #include "llstring.h" -// -#include "llviewercontrol.h" -// #include "hippogridmanager.h" -//static -S32 LLFloaterImagePreview::sUploadAmount = 10; - const S32 PREVIEW_BORDER_WIDTH = 2; const S32 PREVIEW_RESIZE_HANDLE_SIZE = S32(RESIZE_HANDLE_WIDTH * OO_SQRT2) + PREVIEW_BORDER_WIDTH; const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE; @@ -79,20 +72,11 @@ const S32 PREVIEW_TEXTURE_HEIGHT = 300; //----------------------------------------------------------------------------- // LLFloaterImagePreview() //----------------------------------------------------------------------------- -LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) : - LLFloaterNameDesc(filename), - mAvatarPreview(NULL), - mSculptedPreview(NULL), - mLastMouseX(0), - mLastMouseY(0), - mImagep(NULL) -{ - loadImage(mFilenameAndPath); -} - // LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename, void* item) : LLFloaterNameDesc(filename, item), +// + mAvatarPreview(NULL), mSculptedPreview(NULL), mLastMouseX(0), @@ -101,7 +85,6 @@ LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename, void* { loadImage(mFilenameAndPath); } -// //----------------------------------------------------------------------------- // postBuild() @@ -114,7 +97,6 @@ BOOL LLFloaterImagePreview::postBuild() } childSetLabelArg("ok_btn", "[UPLOADFEE]", gHippoGridManager->getConnectedGrid()->getUploadFee()); - childSetAction("ok_btn", onBtnOK, this); LLCtrlSelectionInterface* iface = childGetSelectionInterface("clothing_type_combo"); if (iface) @@ -129,7 +111,7 @@ BOOL LLFloaterImagePreview::postBuild() PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); mPreviewImageRect.set(0.f, 1.f, 1.f, 0.f); - childHide("bad_image_text"); + getChildView("bad_image_text")->setVisible(FALSE); if (mRawImagep.notNull() && gAgent.getRegion() != NULL) { @@ -140,7 +122,7 @@ BOOL LLFloaterImagePreview::postBuild() mSculptedPreview->setPreviewTarget(mRawImagep, 2.0f); if (mRawImagep->getWidth() * mRawImagep->getHeight () <= LL_IMAGE_REZ_LOSSLESS_CUTOFF * LL_IMAGE_REZ_LOSSLESS_CUTOFF) - childEnable("lossless_check"); + getChildView("lossless_check")->setEnabled(TRUE); // gSavedSettings.setBOOL("TemporaryUpload",FALSE); @@ -151,11 +133,13 @@ BOOL LLFloaterImagePreview::postBuild() { mAvatarPreview = NULL; mSculptedPreview = NULL; - childShow("bad_image_text"); - childDisable("clothing_type_combo"); - childDisable("ok_btn"); + getChildView("bad_image_text")->setVisible(TRUE); + getChildView("clothing_type_combo")->setEnabled(FALSE); + getChildView("ok_btn")->setEnabled(FALSE); } + getChild("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); + return TRUE; } @@ -169,7 +153,6 @@ LLFloaterImagePreview::~LLFloaterImagePreview() mRawImagep = NULL; mAvatarPreview = NULL; mSculptedPreview = NULL; - mImagep = NULL ; } @@ -352,7 +335,6 @@ void LLFloaterImagePreview::draw() bool LLFloaterImagePreview::loadImage(const std::string& src_filename) { std::string exten = gDirUtilp->getExtension(src_filename); - U32 codec = LLImageBase::getCodecFromExtension(exten); LLPointer raw_image = new LLImageRaw; @@ -771,7 +753,6 @@ BOOL LLImagePreviewAvatar::render() LLVertexBuffer::unbind(); avatarp->updateLOD(); - if (avatarp->mDrawable.notNull()) { LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); @@ -918,7 +899,6 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance) BOOL LLImagePreviewSculpted::render() { mNeedsUpdate = FALSE; - LLGLSUIDefault def; LLGLDisable no_blend(GL_BLEND); LLGLEnable cull(GL_CULL_FACE); diff --git a/indra/newview/llfloaterimagepreview.h b/indra/newview/llfloaterimagepreview.h index e55ea7f45..c2186450a 100644 --- a/indra/newview/llfloaterimagepreview.h +++ b/indra/newview/llfloaterimagepreview.h @@ -3,10 +3,9 @@ * @brief LLFloaterImagePreview class definition * * $LicenseInfo:firstyear=2004&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2004-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -115,9 +114,8 @@ protected: class LLFloaterImagePreview : public LLFloaterNameDesc { public: - LLFloaterImagePreview(const std::string& filename); // - LLFloaterImagePreview(const std::string& filename, void* item); + LLFloaterImagePreview(const std::string& filename, void* item = NULL); // virtual ~LLFloaterImagePreview(); @@ -129,7 +127,6 @@ public: BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); static void onMouseCaptureLostImagePreview(LLMouseHandler*); - static void setUploadAmount(S32 amount) { sUploadAmount = amount; } void clearAllPreviewTextures(); @@ -146,8 +143,6 @@ protected: LLRect mPreviewRect; LLRectf mPreviewImageRect; LLPointer mImagep ; - - static S32 sUploadAmount; }; #endif // LL_LLFLOATERIMAGEPREVIEW_H diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index 9ac324468..3d0645b7c 100644 --- a/indra/newview/llfloaternamedesc.cpp +++ b/indra/newview/llfloaternamedesc.cpp @@ -3,10 +3,9 @@ * @brief LLFloaterNameDesc class implementation * * $LicenseInfo:firstyear=2002&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2002-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -70,31 +69,16 @@ const S32 PREF_BUTTON_HEIGHT = 16; //----------------------------------------------------------------------------- // LLFloaterNameDesc() //----------------------------------------------------------------------------- -LLFloaterNameDesc::LLFloaterNameDesc(const std::string& filename ) - : LLFloater(std::string("Name/Description Floater")) -{ +LLFloaterNameDesc::LLFloaterNameDesc(const LLSD& filename, void* item ) + : LLFloater(std::string("Name/Description Floater")), // - mItem = NULL; + mItem(item), // - mFilenameAndPath = filename; - mFilename = gDirUtilp->getBaseFileName(filename, false); - // SL-5521 Maintain capitalization of filename when making the inventory item. JC - //LLStringUtil::toLower(mFilename); - mIsAudio = FALSE; -} - -// -LLFloaterNameDesc::LLFloaterNameDesc(const std::string& filename, void* item ) - : LLFloater(std::string("Name/Description Floater")) + mIsAudio(FALSE) { - mItem = item; - mFilenameAndPath = filename; - mFilename = gDirUtilp->getBaseFileName(filename, false); - // SL-5521 Maintain capitalization of filename when making the inventory item. JC - //LLStringUtil::toLower(mFilename); - mIsAudio = FALSE; + mFilenameAndPath = filename.asString(); + mFilename = gDirUtilp->getBaseFileName(mFilenameAndPath, false); } -// //----------------------------------------------------------------------------- // postBuild() @@ -109,11 +93,6 @@ BOOL LLFloaterNameDesc::postBuild() LLStringUtil::stripNonprintable(asset_name); LLStringUtil::trim(asset_name); - std::string exten = gDirUtilp->getExtension(asset_name); - if (exten == "wav") - { - mIsAudio = TRUE; - } asset_name = gDirUtilp->getBaseFileName(asset_name, true); // no extsntion setTitle(mFilename); @@ -128,8 +107,8 @@ BOOL LLFloaterNameDesc::postBuild() r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT ); - childSetCommitCallback("name_form", doCommit, this); - childSetValue("name_form", LLSD(asset_name)); + getChild("name_form")->setCommitCallback(boost::bind(&LLFloaterNameDesc::doCommit, this)); + getChild("name_form")->setValue(LLSD(asset_name)); LLLineEditor *NameEditor = getChild("name_form"); if (NameEditor) @@ -142,7 +121,7 @@ BOOL LLFloaterNameDesc::postBuild() y -= PREVIEW_LINE_HEIGHT; r.setLeftTopAndSize( PREVIEW_HPAD, y, line_width, PREVIEW_LINE_HEIGHT ); - childSetCommitCallback("description_form", doCommit, this); + getChild("description_form")->setCommitCallback(boost::bind(&LLFloaterNameDesc::doCommit, this)); LLLineEditor *DescEditor = getChild("description_form"); if (DescEditor) { @@ -153,14 +132,10 @@ BOOL LLFloaterNameDesc::postBuild() y -= llfloor(PREVIEW_LINE_HEIGHT * 1.2f); // Cancel button - childSetAction("cancel_btn", onBtnCancel, this); + getChild("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnCancel, this)); + + getChild("ok_btn")->setLabelArg("[UPLOADFEE]", llformat("%s%d", gHippoGridManager->getConnectedGrid()->getCurrencySymbol().c_str(), LLGlobalEconomy::Singleton::getInstance()->getPriceUpload())); - // OK button - childSetLabelArg("ok_btn", "[UPLOADFEE]", gHippoGridManager->getConnectedGrid()->getUploadFee()); - if (exten == "wav") - { - childSetAction("ok_btn", onBtnOK, this); - } setDefaultBtn("ok_btn"); return TRUE; @@ -182,45 +157,99 @@ void LLFloaterNameDesc::onCommit() { } -// static //----------------------------------------------------------------------------- // onCommit() //----------------------------------------------------------------------------- -void LLFloaterNameDesc::doCommit( class LLUICtrl *, void* userdata ) +void LLFloaterNameDesc::doCommit() { - LLFloaterNameDesc* self = (LLFloaterNameDesc*) userdata; - self->onCommit(); + onCommit(); } -// static //----------------------------------------------------------------------------- // onBtnOK() //----------------------------------------------------------------------------- -void LLFloaterNameDesc::onBtnOK( void* userdata ) +void LLFloaterNameDesc::onBtnOK() { - LLFloaterNameDesc *fp =(LLFloaterNameDesc *)userdata; - - fp->childDisable("ok_btn"); // don't allow inadvertent extra uploads + getChildView("ok_btn")->setEnabled(FALSE); // don't allow inadvertent extra uploads LLAssetStorage::LLStoreAssetCallback callback = NULL; S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass). void *nruserdata = NULL; std::string display_name = LLStringUtil::null; - upload_new_resource(fp->mFilenameAndPath, // file - fp->childGetValue("name_form").asString(), - fp->childGetValue("description_form").asString(), + upload_new_resource(mFilenameAndPath, // file + getChild("name_form")->getValue().asString(), + getChild("description_form")->getValue().asString(), 0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE, LLFloaterPerms::getNextOwnerPerms(), LLFloaterPerms::getGroupPerms(), LLFloaterPerms::getEveryonePerms(), display_name, callback, expected_upload_cost, nruserdata); - fp->close(false); + close(false); } -// static //----------------------------------------------------------------------------- // onBtnCancel() //----------------------------------------------------------------------------- -void LLFloaterNameDesc::onBtnCancel( void* userdata ) +void LLFloaterNameDesc::onBtnCancel() { - LLFloaterNameDesc *fp =(LLFloaterNameDesc *)userdata; - fp->close(false); + close(false); +} + + +//----------------------------------------------------------------------------- +// LLFloaterSoundPreview() +//----------------------------------------------------------------------------- + +LLFloaterSoundPreview::LLFloaterSoundPreview(const LLSD& filename, void* item ) + : LLFloaterNameDesc(filename, item) +{ + mIsAudio = TRUE; +} + +BOOL LLFloaterSoundPreview::postBuild() +{ + if (!LLFloaterNameDesc::postBuild()) + { + return FALSE; + } + getChild("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); + return TRUE; +} + + +//----------------------------------------------------------------------------- +// LLFloaterAnimPreview() +//----------------------------------------------------------------------------- + +LLFloaterAnimPreview::LLFloaterAnimPreview(const LLSD& filename, void* item ) + : LLFloaterNameDesc(filename, item) +{ +} + +BOOL LLFloaterAnimPreview::postBuild() +{ + if (!LLFloaterNameDesc::postBuild()) + { + return FALSE; + } + getChild("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); + return TRUE; +} + +//----------------------------------------------------------------------------- +// LLFloaterScriptPreview() +//----------------------------------------------------------------------------- + +LLFloaterScriptPreview::LLFloaterScriptPreview(const LLSD& filename, void* item ) + : LLFloaterNameDesc(filename, item) +{ + mIsText = TRUE; +} + +BOOL LLFloaterScriptPreview::postBuild() +{ + if (!LLFloaterNameDesc::postBuild()) + { + return FALSE; + } + getChild("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this)); + return TRUE; } diff --git a/indra/newview/llfloaternamedesc.h b/indra/newview/llfloaternamedesc.h index 4febf390b..ad7472d4f 100644 --- a/indra/newview/llfloaternamedesc.h +++ b/indra/newview/llfloaternamedesc.h @@ -3,10 +3,9 @@ * @brief LLFloaterNameDesc class definition * * $LicenseInfo:firstyear=2002&license=viewergpl$ - * + * Second Life Viewer Source Code * Copyright (c) 2002-2009, Linden Research, Inc. * - * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab * to you under the terms of the GNU General Public License, version 2.0 * ("GPL"), unless you have obtained a separate licensing agreement @@ -44,29 +43,49 @@ class LLRadioGroup; class LLFloaterNameDesc : public LLFloater { public: - LLFloaterNameDesc(const std::string& filename); // - LLFloaterNameDesc(const std::string& filename, void* item); + LLFloaterNameDesc(const LLSD& filename, void* item = NULL); // virtual ~LLFloaterNameDesc(); virtual BOOL postBuild(); - static void doCommit(class LLUICtrl *, void* userdata); + void onBtnOK(); + void onBtnCancel(); + void doCommit(); + protected: virtual void onCommit(); protected: BOOL mIsAudio; + bool mIsText; std::string mFilenameAndPath; std::string mFilename; - // void* mItem; // +}; - static void onBtnOK(void*); - static void onBtnCancel(void*); +class LLFloaterSoundPreview : public LLFloaterNameDesc +{ +public: + LLFloaterSoundPreview(const LLSD& filename, void* item = NULL ); + virtual BOOL postBuild(); +}; + +class LLFloaterAnimPreview : public LLFloaterNameDesc +{ +public: + LLFloaterAnimPreview(const LLSD& filename, void* item = NULL ); + virtual BOOL postBuild(); +}; + +class LLFloaterScriptPreview : public LLFloaterNameDesc +{ +public: + LLFloaterScriptPreview(const LLSD& filename, void* item = NULL ); + virtual BOOL postBuild(); }; #endif // LL_LLFLOATERNAMEDESC_H diff --git a/indra/newview/llfloaterpostprocess.cpp b/indra/newview/llfloaterpostprocess.cpp index fd42f6d02..22a89e015 100644 --- a/indra/newview/llfloaterpostprocess.cpp +++ b/indra/newview/llfloaterpostprocess.cpp @@ -75,8 +75,8 @@ LLFloaterPostProcess::LLFloaterPostProcess() : LLFloater(std::string("Post-Proce //Hacky, but for now checkboxes and sliders are assumed to link to shader uniforms. if(dynamic_cast(*child_it) || dynamic_cast(*child_it)) { - LLUICtrl *ctrl = dynamic_cast(*child_it); - ctrl->setCommitCallback(boost::bind(&LLFloaterPostProcess::onControlChanged, _1, (void*)ctrl->getName().c_str())); + LLUICtrl* ctrl = static_cast(*child_it); + ctrl->setCommitCallback(boost::bind(&LLFloaterPostProcess::onControlChanged, _1, _2)); } } } @@ -84,14 +84,13 @@ LLFloaterPostProcess::LLFloaterPostProcess() : LLFloater(std::string("Post-Proce // Effect loading and saving. LLComboBox* comboBox = getChild("PPEffectsCombo"); - childSetAction("PPLoadEffect", &LLFloaterPostProcess::onLoadEffect, comboBox); - comboBox->setCommitCallback(onChangeEffectName); + getChild("PPLoadEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onLoadEffect, this, comboBox)); + comboBox->setCommitCallback(boost::bind(&LLFloaterPostProcess::onChangeEffectName, this, _1)); LLLineEditor* editBox = getChild("PPEffectNameEditor"); - childSetAction("PPSaveEffect", &LLFloaterPostProcess::onSaveEffect, editBox); + getChild("PPSaveEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onSaveEffect, this, editBox)); syncMenu(); - } LLFloaterPostProcess::~LLFloaterPostProcess() @@ -113,47 +112,42 @@ LLFloaterPostProcess* LLFloaterPostProcess::instance() } -void LLFloaterPostProcess::onControlChanged(LLUICtrl* ctrl, void* userData) +void LLFloaterPostProcess::onControlChanged(LLUICtrl* ctrl, const LLSD& v) { - LLSD v = ctrl->getValue(); - LLPostProcess::getInstance()->setSelectedEffectValue((char const *)userData, v); + LLPostProcess::getInstance()->setSelectedEffectValue(ctrl->getName(), v); } -void LLFloaterPostProcess::onLoadEffect(void* userData) +void LLFloaterPostProcess::onLoadEffect(LLComboBox* comboBox) { - LLComboBox* comboBox = static_cast(userData); - LLSD::String effectName(comboBox->getSelectedValue().asString()); LLPostProcess::getInstance()->setSelectedEffect(effectName); - sPostProcess->syncMenu(); + syncMenu(); } -void LLFloaterPostProcess::onSaveEffect(void* userData) +void LLFloaterPostProcess::onSaveEffect(LLLineEditor* editBox) { - LLLineEditor* editBox = static_cast(userData); - std::string effectName(editBox->getValue().asString()); if (LLPostProcess::getInstance()->getAllEffectInfo().has(effectName)) { LLSD payload; payload["effect_name"] = effectName; - LLNotificationsUtil::add("PPSaveEffectAlert", LLSD(), payload, &LLFloaterPostProcess::saveAlertCallback); + LLNotificationsUtil::add("PPSaveEffectAlert", LLSD(), payload, boost::bind(&LLFloaterPostProcess::saveAlertCallback, this, _1, _2)); } else { LLPostProcess::getInstance()->saveEffectAs(effectName); - sPostProcess->syncMenu(); + syncMenu(); } } -void LLFloaterPostProcess::onChangeEffectName(LLUICtrl* ctrl, void * userData) +void LLFloaterPostProcess::onChangeEffectName(LLUICtrl* ctrl) { // get the combo box and name LLComboBox * comboBox = static_cast(ctrl); - LLLineEditor* editBox = sPostProcess->getChild("PPEffectNameEditor"); + LLLineEditor* editBox = getChild("PPEffectNameEditor"); // set the parameter's new name editBox->setValue(comboBox->getSelectedValue()); @@ -168,7 +162,7 @@ bool LLFloaterPostProcess::saveAlertCallback(const LLSD& notification, const LLS { LLPostProcess::getInstance()->saveEffectAs(notification["payload"]["effect_name"].asString()); - sPostProcess->syncMenu(); + syncMenu(); } return false; } diff --git a/indra/newview/llfloaterpostprocess.h b/indra/newview/llfloaterpostprocess.h index 4f0ef7a63..f49a33981 100644 --- a/indra/newview/llfloaterpostprocess.h +++ b/indra/newview/llfloaterpostprocess.h @@ -36,6 +36,8 @@ #include "llfloater.h" class LLButton; +class LLComboBox; +class LLLineEditor; class LLSliderCtrl; class LLTabContainer; class LLPanelPermissions; @@ -58,13 +60,13 @@ public: static LLFloaterPostProcess* instance(); /// post process callbacks - static void onControlChanged(LLUICtrl* ctrl, void* userData); - static void onLoadEffect(void* userData); - static void onSaveEffect(void* userData); - static void onChangeEffectName(LLUICtrl* ctrl, void * userData); + static void onControlChanged(LLUICtrl* ctrl, const LLSD& v); + void onLoadEffect(LLComboBox* comboBox); + void onSaveEffect(LLLineEditor* editBox); + void onChangeEffectName(LLUICtrl* ctrl); /// prompts a user when overwriting an effect - static bool saveAlertCallback(const LLSD& notification, const LLSD& response); + bool saveAlertCallback(const LLSD& notification, const LLSD& response); /// show off our menu static void show(); diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index 46757f75b..6b181433d 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -126,16 +126,14 @@ BOOL LLFloaterTopObjects::postBuild() if (line_editor) { line_editor->setCommitOnFocusLost(FALSE); - line_editor->setCommitCallback(onGetByOwnerName); - line_editor->setCallbackUserData(this); + line_editor->setCommitCallback(onGetByOwnerName, this); } line_editor = getChild("object_name_editor"); if (line_editor) { line_editor->setCommitOnFocusLost(FALSE); - line_editor->setCommitCallback(onGetByObjectName); - line_editor->setCallbackUserData(this); + line_editor->setCommitCallback(onGetByObjectName, this); }*/ mCurrentMode = STAT_REPORT_TOP_SCRIPTS; diff --git a/indra/newview/llfloaterwater.cpp b/indra/newview/llfloaterwater.cpp index bb938e94a..f444a7cbc 100644 --- a/indra/newview/llfloaterwater.cpp +++ b/indra/newview/llfloaterwater.cpp @@ -34,36 +34,22 @@ #include "llfloaterwater.h" -#include "pipeline.h" -#include "llsky.h" - -#include "llsliderctrl.h" -#include "llspinctrl.h" -#include "llcolorswatch.h" +// libs #include "llcheckboxctrl.h" +#include "llcolorswatch.h" +#include "llcombobox.h" +#include "llnotificationsutil.h" +#include "llsliderctrl.h" #include "lltexturectrl.h" #include "lluictrlfactory.h" -#include "llviewercamera.h" -#include "llcombobox.h" -#include "lllineeditor.h" #include "llfloaterdaycycle.h" -#include "llboost.h" -#include "llmultisliderctrl.h" +// newview #include "llagent.h" -#include "llinventorymodel.h" -#include "llviewerinventory.h" - -#include "v4math.h" -#include "llviewerdisplay.h" -#include "llviewercontrol.h" -#include "llviewerwindow.h" -#include "llsavedsettingsglue.h" - -#include "llwaterparamset.h" #include "llwaterparammanager.h" +#include "llwaterparamset.h" -#undef max +#undef max // Fixes a Windows compiler error LLFloaterWater* LLFloaterWater::sWaterMenu = NULL; @@ -79,15 +65,13 @@ LLFloaterWater::LLFloaterWater() : LLFloater(std::string("water floater")) if (mWaterPresetCombo != NULL) { populateWaterPresetsList(); - mWaterPresetCombo->setCommitCallback(onChangePresetName); + mWaterPresetCombo->setCommitCallback(boost::bind(&LLFloaterWater::onChangePresetName, this, _1)); } - std::string def_water = getString("WLDefaultWaterNames"); - // no editing or deleting of the blank string sDefaultPresets.insert(""); - boost_tokenizer tokens(def_water, boost::char_separator(":")); + boost_tokenizer tokens(getString("WLDefaultWaterNames"), boost::char_separator(":")); for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) { std::string tok(*token_iter); @@ -102,7 +86,8 @@ LLFloaterWater::~LLFloaterWater() { } -void LLFloaterWater::initCallbacks(void) { +void LLFloaterWater::initCallbacks(void) +{ // help buttons initHelpBtn("WaterFogColorHelp", "HelpWaterFogColor"); @@ -121,52 +106,52 @@ void LLFloaterWater::initCallbacks(void) { initHelpBtn("WaterWave1Help", "HelpWaterWave1"); initHelpBtn("WaterWave2Help", "HelpWaterWave2"); - LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); + //------------------------------------------------------------------------- - childSetCommitCallback("WaterFogColor", onWaterFogColorMoved, ¶m_mgr->mFogColor); + LLWaterParamManager& water_mgr = LLWaterParamManager::instance(); - // - //childSetCommitCallback("WaterGlow", onColorControlAMoved, ¶m_mgr->mFogColor); + getChild("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterWater::onWaterFogColorMoved, this, _1, &water_mgr.mFogColor)); + //getChild("WaterGlow")->setCommitCallback(boost::bind(&LLFloaterWater::onColorControlAMoved, this, _1, &water_mgr.mFogColor)); // fog density - childSetCommitCallback("WaterFogDensity", onExpFloatControlMoved, ¶m_mgr->mFogDensity); - childSetCommitCallback("WaterUnderWaterFogMod", onFloatControlMoved, ¶m_mgr->mUnderWaterFogMod); + getChild("WaterFogDensity")->setCommitCallback(boost::bind(&LLFloaterWater::onExpFloatControlMoved, this, _1, &water_mgr.mFogDensity)); + getChild("WaterUnderWaterFogMod")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &water_mgr.mUnderWaterFogMod)); // blue density - childSetCommitCallback("WaterNormalScaleX", onVector3ControlXMoved, ¶m_mgr->mNormalScale); - childSetCommitCallback("WaterNormalScaleY", onVector3ControlYMoved, ¶m_mgr->mNormalScale); - childSetCommitCallback("WaterNormalScaleZ", onVector3ControlZMoved, ¶m_mgr->mNormalScale); + getChild("WaterNormalScaleX")->setCommitCallback(boost::bind(&LLFloaterWater::onVector3ControlXMoved, this, _1, &water_mgr.mNormalScale)); + getChild("WaterNormalScaleY")->setCommitCallback(boost::bind(&LLFloaterWater::onVector3ControlYMoved, this, _1, &water_mgr.mNormalScale)); + getChild("WaterNormalScaleZ")->setCommitCallback(boost::bind(&LLFloaterWater::onVector3ControlZMoved, this, _1, &water_mgr.mNormalScale)); // fresnel - childSetCommitCallback("WaterFresnelScale", onFloatControlMoved, ¶m_mgr->mFresnelScale); - childSetCommitCallback("WaterFresnelOffset", onFloatControlMoved, ¶m_mgr->mFresnelOffset); + getChild("WaterFresnelScale")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &water_mgr.mFresnelScale)); + getChild("WaterFresnelOffset")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &water_mgr.mFresnelOffset)); // scale above/below - childSetCommitCallback("WaterScaleAbove", onFloatControlMoved, ¶m_mgr->mScaleAbove); - childSetCommitCallback("WaterScaleBelow", onFloatControlMoved, ¶m_mgr->mScaleBelow); + getChild("WaterScaleAbove")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &water_mgr.mScaleAbove)); + getChild("WaterScaleBelow")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &water_mgr.mScaleBelow)); // blur mult - childSetCommitCallback("WaterBlurMult", onFloatControlMoved, ¶m_mgr->mBlurMultiplier); + getChild("WaterBlurMult")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &water_mgr.mBlurMultiplier)); // Load/save - //childSetAction("WaterLoadPreset", onLoadPreset, mWaterPresetCombo); - childSetAction("WaterNewPreset", onNewPreset, mWaterPresetCombo); - childSetAction("WaterDeletePreset", onDeletePreset, mWaterPresetCombo); - childSetCommitCallback("WaterSavePreset", onSavePreset, this); + //getChild("WaterLoadPreset")->setCommitCallback(boost::bind(&LLFloaterWater::onLoadPreset, this, mWaterPresetCombo)); + getChild("WaterNewPreset")->setCommitCallback(boost::bind(&LLFloaterWater::onNewPreset, this)); + getChild("WaterDeletePreset")->setCommitCallback(boost::bind(&LLFloaterWater::onDeletePreset, this)); + getChild("WaterSavePreset")->setCommitCallback(boost::bind(&LLFloaterWater::onSavePreset, this, _1)); // wave direction - childSetCommitCallback("WaterWave1DirX", onVector2ControlXMoved, ¶m_mgr->mWave1Dir); - childSetCommitCallback("WaterWave1DirY", onVector2ControlYMoved, ¶m_mgr->mWave1Dir); - childSetCommitCallback("WaterWave2DirX", onVector2ControlXMoved, ¶m_mgr->mWave2Dir); - childSetCommitCallback("WaterWave2DirY", onVector2ControlYMoved, ¶m_mgr->mWave2Dir); + getChild("WaterWave1DirX")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlXMoved, this, _1, &water_mgr.mWave1Dir)); + getChild("WaterWave1DirY")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlYMoved, this, _1, &water_mgr.mWave1Dir)); + getChild("WaterWave2DirX")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlXMoved, this, _1, &water_mgr.mWave2Dir)); + getChild("WaterWave2DirY")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlYMoved, this, _1, &water_mgr.mWave2Dir)); - LLTextureCtrl* textCtrl = getChild("WaterNormalMap"); - textCtrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL); - childSetCommitCallback("WaterNormalMap", onNormalMapPicked, NULL); + LLTextureCtrl* texture_ctrl = getChild("WaterNormalMap"); + texture_ctrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL); + texture_ctrl->setCommitCallback(boost::bind(&LLFloaterWater::onNormalMapPicked, this, _1)); // next/prev buttons - //childSetAction("next", onClickNext, this); - //childSetAction("prev", onClickPrev, this); + //getChild("next")->setCommitCallback(boost::bind(&LLFloaterWater::onClickNext, this)); + //getChild("prev")->setCommitCallback(boost::bind(&LLFloaterWater::onClickPrev, this)); } void LLFloaterWater::onClickHelp(void* data) @@ -185,14 +170,14 @@ void LLFloaterWater::initHelpBtn(const std::string& name, const std::string& xml bool LLFloaterWater::newPromptCallback(const LLSD& notification, const LLSD& response) { std::string text = response["message"].asString(); - S32 option = LLNotification::getSelectedOption(notification, response); - - if(text == "") + if(text.empty()) { return false; } - if(option == 0) { + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if(option == 0) + { LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); // add the current parameters to the list @@ -201,10 +186,9 @@ bool LLFloaterWater::newPromptCallback(const LLSD& notification, const LLSD& res if(!LLWaterParamManager::getInstance()->hasParamSet(text)) { param_mgr->addParamSet(text, param_mgr->mCurParams); - sWaterMenu->mWaterPresetCombo->add(text); - sWaterMenu->mWaterPresetCombo->sortByName(); - - sWaterMenu->mWaterPresetCombo->selectByValue(text); + mWaterPresetCombo->add(text); + mWaterPresetCombo->sortByName(); + mWaterPresetCombo->selectByValue(text); param_mgr->savePreset(text); @@ -214,7 +198,7 @@ bool LLFloaterWater::newPromptCallback(const LLSD& notification, const LLSD& res } else { - LLNotifications::instance().add("ExistsWaterPresetAlert"); + LLNotificationsUtil::add("ExistsWaterPresetAlert"); } } return false; @@ -224,9 +208,9 @@ void LLFloaterWater::syncMenu() { bool err; - LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); + LLWaterParamManager& water_mgr = LLWaterParamManager::instance(); - LLWaterParamSet & current_params = param_mgr->mCurParams; + LLWaterParamSet& current_params = water_mgr.mCurParams; if (mWaterPresetCombo->getSelectedItemLabel() != LLEnvManagerNew::instance().getWaterPresetName()) { @@ -234,58 +218,56 @@ void LLFloaterWater::syncMenu() } // blue horizon - param_mgr->mFogColor = current_params.getVector4(param_mgr->mFogColor.mName, err); + water_mgr.mFogColor = current_params.getVector4(water_mgr.mFogColor.mName, err); - LLColor4 col = param_mgr->getFogColor(); - //childSetValue("WaterGlow", col.mV[3]); + LLColor4 col = water_mgr.getFogColor(); + //getChild("WaterGlow")->setValue(col.mV[3]); col.mV[3] = 1.0f; - LLColorSwatchCtrl* colCtrl = sWaterMenu->getChild("WaterFogColor"); - - colCtrl->set(col); + getChild("WaterFogColor")->set(col); // fog and wavelets - param_mgr->mFogDensity.mExp = - log(current_params.getFloat(param_mgr->mFogDensity.mName, err)) / - log(param_mgr->mFogDensity.mBase); - param_mgr->setDensitySliderValue(param_mgr->mFogDensity.mExp); - childSetValue("WaterFogDensity", param_mgr->mFogDensity.mExp); + water_mgr.mFogDensity.mExp = + log(current_params.getFloat(water_mgr.mFogDensity.mName, err)) / + log(water_mgr.mFogDensity.mBase); + water_mgr.setDensitySliderValue(water_mgr.mFogDensity.mExp); + getChild("WaterFogDensity")->setValue(water_mgr.mFogDensity.mExp); - param_mgr->mUnderWaterFogMod.mX = - current_params.getFloat(param_mgr->mUnderWaterFogMod.mName, err); - childSetValue("WaterUnderWaterFogMod", param_mgr->mUnderWaterFogMod.mX); + water_mgr.mUnderWaterFogMod.mX = + current_params.getFloat(water_mgr.mUnderWaterFogMod.mName, err); + getChild("WaterUnderWaterFogMod")->setValue(water_mgr.mUnderWaterFogMod.mX); - param_mgr->mNormalScale = current_params.getVector3(param_mgr->mNormalScale.mName, err); - childSetValue("WaterNormalScaleX", param_mgr->mNormalScale.mX); - childSetValue("WaterNormalScaleY", param_mgr->mNormalScale.mY); - childSetValue("WaterNormalScaleZ", param_mgr->mNormalScale.mZ); + water_mgr.mNormalScale = current_params.getVector3(water_mgr.mNormalScale.mName, err); + getChild("WaterNormalScaleX")->setValue(water_mgr.mNormalScale.mX); + getChild("WaterNormalScaleY")->setValue(water_mgr.mNormalScale.mY); + getChild("WaterNormalScaleZ")->setValue(water_mgr.mNormalScale.mZ); // Fresnel - param_mgr->mFresnelScale.mX = current_params.getFloat(param_mgr->mFresnelScale.mName, err); - childSetValue("WaterFresnelScale", param_mgr->mFresnelScale.mX); - param_mgr->mFresnelOffset.mX = current_params.getFloat(param_mgr->mFresnelOffset.mName, err); - childSetValue("WaterFresnelOffset", param_mgr->mFresnelOffset.mX); + water_mgr.mFresnelScale.mX = current_params.getFloat(water_mgr.mFresnelScale.mName, err); + getChild("WaterFresnelScale")->setValue(water_mgr.mFresnelScale.mX); + water_mgr.mFresnelOffset.mX = current_params.getFloat(water_mgr.mFresnelOffset.mName, err); + getChild("WaterFresnelOffset")->setValue(water_mgr.mFresnelOffset.mX); // Scale Above/Below - param_mgr->mScaleAbove.mX = current_params.getFloat(param_mgr->mScaleAbove.mName, err); - childSetValue("WaterScaleAbove", param_mgr->mScaleAbove.mX); - param_mgr->mScaleBelow.mX = current_params.getFloat(param_mgr->mScaleBelow.mName, err); - childSetValue("WaterScaleBelow", param_mgr->mScaleBelow.mX); + water_mgr.mScaleAbove.mX = current_params.getFloat(water_mgr.mScaleAbove.mName, err); + getChild("WaterScaleAbove")->setValue(water_mgr.mScaleAbove.mX); + water_mgr.mScaleBelow.mX = current_params.getFloat(water_mgr.mScaleBelow.mName, err); + getChild("WaterScaleBelow")->setValue(water_mgr.mScaleBelow.mX); // blur mult - param_mgr->mBlurMultiplier.mX = current_params.getFloat(param_mgr->mBlurMultiplier.mName, err); - childSetValue("WaterBlurMult", param_mgr->mBlurMultiplier.mX); + water_mgr.mBlurMultiplier.mX = current_params.getFloat(water_mgr.mBlurMultiplier.mName, err); + getChild("WaterBlurMult")->setValue(water_mgr.mBlurMultiplier.mX); // wave directions - param_mgr->mWave1Dir = current_params.getVector2(param_mgr->mWave1Dir.mName, err); - childSetValue("WaterWave1DirX", param_mgr->mWave1Dir.mX); - childSetValue("WaterWave1DirY", param_mgr->mWave1Dir.mY); + water_mgr.mWave1Dir = current_params.getVector2(water_mgr.mWave1Dir.mName, err); + getChild("WaterWave1DirX")->setValue(water_mgr.mWave1Dir.mX); + getChild("WaterWave1DirY")->setValue(water_mgr.mWave1Dir.mY); - param_mgr->mWave2Dir = current_params.getVector2(param_mgr->mWave2Dir.mName, err); - childSetValue("WaterWave2DirX", param_mgr->mWave2Dir.mX); - childSetValue("WaterWave2DirY", param_mgr->mWave2Dir.mY); + water_mgr.mWave2Dir = current_params.getVector2(water_mgr.mWave2Dir.mName, err); + getChild("WaterWave2DirX")->setValue(water_mgr.mWave2Dir.mX); + getChild("WaterWave2DirY")->setValue(water_mgr.mWave2Dir.mY); - LLTextureCtrl* textCtrl = sWaterMenu->getChild("WaterNormalMap"); - textCtrl->setImageAssetID(param_mgr->getNormalMapID()); + LLTextureCtrl* textCtrl = getChild("WaterNormalMap"); + textCtrl->setImageAssetID(water_mgr.getNormalMapID()); } @@ -342,276 +324,257 @@ void LLFloaterWater::onClose(bool app_quitting) } } -// vector control callbacks -void LLFloaterWater::onVector3ControlXMoved(LLUICtrl* ctrl, void* userData) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WaterVector3Control * vectorControl = static_cast(userData); - - vectorControl->mX = sldrCtrl->getValueF32(); - - vectorControl->update(LLWaterParamManager::getInstance()->mCurParams); - - LLWaterParamManager::getInstance()->propagateParameters(); -} - -// vector control callbacks -void LLFloaterWater::onVector3ControlYMoved(LLUICtrl* ctrl, void* userData) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WaterVector3Control * vectorControl = static_cast(userData); - - vectorControl->mY = sldrCtrl->getValueF32(); - - vectorControl->update(LLWaterParamManager::getInstance()->mCurParams); - - LLWaterParamManager::getInstance()->propagateParameters(); -} - -// vector control callbacks -void LLFloaterWater::onVector3ControlZMoved(LLUICtrl* ctrl, void* userData) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WaterVector3Control * vectorControl = static_cast(userData); - - vectorControl->mZ = sldrCtrl->getValueF32(); - - vectorControl->update(LLWaterParamManager::getInstance()->mCurParams); - - LLWaterParamManager::getInstance()->propagateParameters(); -} - - -// vector control callbacks -void LLFloaterWater::onVector2ControlXMoved(LLUICtrl* ctrl, void* userData) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WaterVector2Control * vectorControl = static_cast(userData); - - vectorControl->mX = sldrCtrl->getValueF32(); - - vectorControl->update(LLWaterParamManager::getInstance()->mCurParams); - - LLWaterParamManager::getInstance()->propagateParameters(); -} - -// vector control callbacks -void LLFloaterWater::onVector2ControlYMoved(LLUICtrl* ctrl, void* userData) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WaterVector2Control * vectorControl = static_cast(userData); - - vectorControl->mY = sldrCtrl->getValueF32(); - - vectorControl->update(LLWaterParamManager::getInstance()->mCurParams); - - LLWaterParamManager::getInstance()->propagateParameters(); -} - // color control callbacks -void LLFloaterWater::onColorControlRMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onColorControlRMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl) { - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WaterColorControl * colorControl = static_cast(userData); + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - colorControl->mR = sldrCtrl->getValueF32(); + color_ctrl->mR = sldr_ctrl->getValueF32(); // move i if it's the max - if(colorControl->mR >= colorControl->mG - && colorControl->mR >= colorControl->mB - && colorControl->mHasSliderName) + if (color_ctrl->mR >= color_ctrl->mG + && color_ctrl->mR >= color_ctrl->mB + && color_ctrl->mHasSliderName) { - colorControl->mI = colorControl->mR; - std::string name = colorControl->mSliderName; + color_ctrl->mI = color_ctrl->mR; + std::string name = color_ctrl->mSliderName; name.append("I"); - sWaterMenu->childSetValue(name, colorControl->mR); + getChild(name)->setValue(color_ctrl->mR); } - colorControl->update(LLWaterParamManager::getInstance()->mCurParams); + color_ctrl->update(LLWaterParamManager::getInstance()->mCurParams); LLWaterParamManager::getInstance()->propagateParameters(); } -void LLFloaterWater::onColorControlGMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onColorControlGMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl) { - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WaterColorControl * colorControl = static_cast(userData); + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - colorControl->mG = sldrCtrl->getValueF32(); + color_ctrl->mG = sldr_ctrl->getValueF32(); // move i if it's the max - if(colorControl->mG >= colorControl->mR - && colorControl->mG >= colorControl->mB - && colorControl->mHasSliderName) + if (color_ctrl->mG >= color_ctrl->mR + && color_ctrl->mG >= color_ctrl->mB + && color_ctrl->mHasSliderName) { - colorControl->mI = colorControl->mG; - std::string name = colorControl->mSliderName; + color_ctrl->mI = color_ctrl->mG; + std::string name = color_ctrl->mSliderName; name.append("I"); - sWaterMenu->childSetValue(name, colorControl->mG); + getChild(name)->setValue(color_ctrl->mG); } - colorControl->update(LLWaterParamManager::getInstance()->mCurParams); + color_ctrl->update(LLWaterParamManager::getInstance()->mCurParams); LLWaterParamManager::getInstance()->propagateParameters(); } -void LLFloaterWater::onColorControlBMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onColorControlBMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl) { - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WaterColorControl * colorControl = static_cast(userData); + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - colorControl->mB = sldrCtrl->getValueF32(); + color_ctrl->mB = sldr_ctrl->getValueF32(); // move i if it's the max - if(colorControl->mB >= colorControl->mR - && colorControl->mB >= colorControl->mG - && colorControl->mHasSliderName) + if (color_ctrl->mB >= color_ctrl->mR + && color_ctrl->mB >= color_ctrl->mG + && color_ctrl->mHasSliderName) { - colorControl->mI = colorControl->mB; - std::string name = colorControl->mSliderName; + color_ctrl->mI = color_ctrl->mB; + std::string name = color_ctrl->mSliderName; name.append("I"); - sWaterMenu->childSetValue(name, colorControl->mB); + getChild(name)->setValue(color_ctrl->mB); } - colorControl->update(LLWaterParamManager::getInstance()->mCurParams); + color_ctrl->update(LLWaterParamManager::getInstance()->mCurParams); LLWaterParamManager::getInstance()->propagateParameters(); } -void LLFloaterWater::onColorControlAMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onColorControlAMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl) { - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WaterColorControl * colorControl = static_cast(userData); + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - colorControl->mA = sldrCtrl->getValueF32(); + color_ctrl->mA = sldr_ctrl->getValueF32(); - colorControl->update(LLWaterParamManager::getInstance()->mCurParams); + color_ctrl->update(LLWaterParamManager::getInstance()->mCurParams); LLWaterParamManager::getInstance()->propagateParameters(); } -void LLFloaterWater::onColorControlIMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onColorControlIMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl) { - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WaterColorControl * colorControl = static_cast(userData); + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - colorControl->mI = sldrCtrl->getValueF32(); + color_ctrl->mI = sldr_ctrl->getValueF32(); // only for sliders where we pass a name - if(colorControl->mHasSliderName) + if (color_ctrl->mHasSliderName) { // set it to the top - F32 maxVal = std::max(std::max(colorControl->mR, colorControl->mG), colorControl->mB); + F32 maxVal = std::max(std::max(color_ctrl->mR, color_ctrl->mG), color_ctrl->mB); F32 iVal; - iVal = colorControl->mI; + iVal = color_ctrl->mI; // get the names of the other sliders - std::string rName = colorControl->mSliderName; + std::string rName = color_ctrl->mSliderName; rName.append("R"); - std::string gName = colorControl->mSliderName; + std::string gName = color_ctrl->mSliderName; gName.append("G"); - std::string bName = colorControl->mSliderName; + std::string bName = color_ctrl->mSliderName; bName.append("B"); // handle if at 0 if(iVal == 0) { - colorControl->mR = 0; - colorControl->mG = 0; - colorControl->mB = 0; + color_ctrl->mR = 0; + color_ctrl->mG = 0; + color_ctrl->mB = 0; // if all at the start // set them all to the intensity } else if (maxVal == 0) { - colorControl->mR = iVal; - colorControl->mG = iVal; - colorControl->mB = iVal; + color_ctrl->mR = iVal; + color_ctrl->mG = iVal; + color_ctrl->mB = iVal; } else { // add delta amounts to each F32 delta = (iVal - maxVal) / maxVal; - colorControl->mR *= (1.0f + delta); - colorControl->mG *= (1.0f + delta); - colorControl->mB *= (1.0f + delta); + color_ctrl->mR *= (1.0f + delta); + color_ctrl->mG *= (1.0f + delta); + color_ctrl->mB *= (1.0f + delta); } // set the sliders to the new vals - sWaterMenu->childSetValue(rName, colorControl->mR); - sWaterMenu->childSetValue(gName, colorControl->mG); - sWaterMenu->childSetValue(bName, colorControl->mB); + getChild(rName)->setValue(color_ctrl->mR); + getChild(gName)->setValue(color_ctrl->mG); + getChild(bName)->setValue(color_ctrl->mB); } // now update the current parameters and send them to shaders - colorControl->update(LLWaterParamManager::getInstance()->mCurParams); + color_ctrl->update(LLWaterParamManager::getInstance()->mCurParams); LLWaterParamManager::getInstance()->propagateParameters(); } -void LLFloaterWater::onExpFloatControlMoved(LLUICtrl* ctrl, void* userData) +// vector control callbacks +void LLFloaterWater::onVector3ControlXMoved(LLUICtrl* ctrl, WaterVector3Control* vector_ctrl) { - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WaterExpFloatControl * expFloatControl = static_cast(userData); + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - F32 val = sldrCtrl->getValueF32(); + vector_ctrl->mX = sldr_ctrl->getValueF32(); + + vector_ctrl->update(LLWaterParamManager::getInstance()->mCurParams); + + LLWaterParamManager::getInstance()->propagateParameters(); +} + +// vector control callbacks +void LLFloaterWater::onVector3ControlYMoved(LLUICtrl* ctrl, WaterVector3Control* vector_ctrl) +{ + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + + vector_ctrl->mY = sldr_ctrl->getValueF32(); + + vector_ctrl->update(LLWaterParamManager::getInstance()->mCurParams); + + LLWaterParamManager::getInstance()->propagateParameters(); +} + +// vector control callbacks +void LLFloaterWater::onVector3ControlZMoved(LLUICtrl* ctrl, WaterVector3Control* vector_ctrl) +{ + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + + vector_ctrl->mZ = sldr_ctrl->getValueF32(); + + vector_ctrl->update(LLWaterParamManager::getInstance()->mCurParams); + + LLWaterParamManager::getInstance()->propagateParameters(); +} + + +// vector control callbacks +void LLFloaterWater::onVector2ControlXMoved(LLUICtrl* ctrl, WaterVector2Control* vector_ctrl) +{ + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + + vector_ctrl->mX = sldr_ctrl->getValueF32(); + + vector_ctrl->update(LLWaterParamManager::getInstance()->mCurParams); + + LLWaterParamManager::getInstance()->propagateParameters(); +} + +// vector control callbacks +void LLFloaterWater::onVector2ControlYMoved(LLUICtrl* ctrl, WaterVector2Control* vector_ctrl) +{ + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + + vector_ctrl->mY = sldr_ctrl->getValueF32(); + + vector_ctrl->update(LLWaterParamManager::getInstance()->mCurParams); + + LLWaterParamManager::getInstance()->propagateParameters(); +} + +void LLFloaterWater::onFloatControlMoved(LLUICtrl* ctrl, WaterFloatControl* floatControl) +{ + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + + floatControl->mX = sldr_ctrl->getValueF32() / floatControl->mMult; + + floatControl->update(LLWaterParamManager::getInstance()->mCurParams); + LLWaterParamManager::getInstance()->propagateParameters(); +} + +void LLFloaterWater::onExpFloatControlMoved(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl) +{ + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); + + F32 val = sldr_ctrl->getValueF32(); expFloatControl->mExp = val; LLWaterParamManager::getInstance()->setDensitySliderValue(val); expFloatControl->update(LLWaterParamManager::getInstance()->mCurParams); LLWaterParamManager::getInstance()->propagateParameters(); } - -void LLFloaterWater::onFloatControlMoved(LLUICtrl* ctrl, void* userData) -{ - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - WaterFloatControl * floatControl = static_cast(userData); - - floatControl->mX = sldrCtrl->getValueF32() / floatControl->mMult; - - floatControl->update(LLWaterParamManager::getInstance()->mCurParams); - LLWaterParamManager::getInstance()->propagateParameters(); -} -void LLFloaterWater::onWaterFogColorMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onWaterFogColorMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl) { LLColorSwatchCtrl* swatch = static_cast(ctrl); - WaterColorControl * colorControl = static_cast(userData); - *colorControl = swatch->get(); + *color_ctrl = swatch->get(); - colorControl->update(LLWaterParamManager::getInstance()->mCurParams); + color_ctrl->update(LLWaterParamManager::getInstance()->mCurParams); LLWaterParamManager::getInstance()->propagateParameters(); } -void LLFloaterWater::onBoolToggle(LLUICtrl* ctrl, void* userData) -{ - LLCheckBoxCtrl* cbCtrl = static_cast(ctrl); - - bool value = cbCtrl->get(); - (*(static_cast(userData))) = value; -} - -void LLFloaterWater::onNormalMapPicked(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onNormalMapPicked(LLUICtrl* ctrl) { LLTextureCtrl* textCtrl = static_cast(ctrl); LLUUID textID = textCtrl->getImageAssetID(); LLWaterParamManager::getInstance()->setNormalMapID(textID); } -void LLFloaterWater::onNewPreset(void* userData) +//============================================================================= + +void LLFloaterWater::onNewPreset() { - LLNotifications::instance().add("NewWaterPreset", LLSD(), LLSD(), newPromptCallback); + LLNotificationsUtil::add("NewWaterPreset", LLSD(), LLSD(), boost::bind(&LLFloaterWater::newPromptCallback, this, _1, _2)); } -void LLFloaterWater::onSavePreset(LLUICtrl* ctrl, void* userData) +void LLFloaterWater::onSavePreset(LLUICtrl* ctrl) { // don't save the empty name - if(sWaterMenu->mWaterPresetCombo->getSelectedItemLabel() == "") + if(mWaterPresetCombo->getSelectedItemLabel().empty()) { return; } @@ -622,25 +585,23 @@ void LLFloaterWater::onSavePreset(LLUICtrl* ctrl, void* userData) } else { - LLWaterParamManager::getInstance()->mCurParams.mName = - sWaterMenu->mWaterPresetCombo->getSelectedItemLabel(); + LLWaterParamManager::getInstance()->mCurParams.mName = mWaterPresetCombo->getSelectedItemLabel(); // check to see if it's a default and shouldn't be overwritten - std::set::iterator sIt = sDefaultPresets.find( - sWaterMenu->mWaterPresetCombo->getSelectedItemLabel()); + std::set::iterator sIt = sDefaultPresets.find(mWaterPresetCombo->getSelectedItemLabel()); if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("WaterEditPresets")) { - LLNotifications::instance().add("WLNoEditDefault"); + LLNotificationsUtil::add("WLNoEditDefault"); return; } - LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback); + LLNotificationsUtil::add("WLSavePresetAlert", LLSD(), LLSD(), boost::bind(&LLFloaterWater::saveAlertCallback, this, _1, _2)); } } bool LLFloaterWater::saveNotecardCallback(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); // if they choose save, do it. Otherwise, don't do anything if(option == 0) { @@ -653,15 +614,13 @@ bool LLFloaterWater::saveNotecardCallback(const LLSD& notification, const LLSD& bool LLFloaterWater::saveAlertCallback(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); // if they choose save, do it. Otherwise, don't do anything if(option == 0) { - LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); + LLWaterParamManager* param_mgr = LLWaterParamManager::getInstance(); - param_mgr->setParamSet( - param_mgr->mCurParams.mName, - param_mgr->mCurParams); + param_mgr->setParamSet(param_mgr->mCurParams.mName, param_mgr->mCurParams); // comment this back in to save to file param_mgr->savePreset(param_mgr->mCurParams.mName); @@ -669,22 +628,23 @@ bool LLFloaterWater::saveAlertCallback(const LLSD& notification, const LLSD& res return false; } -void LLFloaterWater::onDeletePreset(void* userData) +void LLFloaterWater::onDeletePreset() { - if(sWaterMenu->mWaterPresetCombo->getSelectedValue().asString() == "") + if(mWaterPresetCombo->getSelectedValue().asString().empty()) { return; } LLSD args; - args["SKY"] = sWaterMenu->mWaterPresetCombo->getSelectedValue().asString(); - LLNotifications::instance().add("WLDeletePresetAlert", args, LLSD(), deleteAlertCallback); + args["SKY"] = mWaterPresetCombo->getSelectedValue().asString(); + LLNotificationsUtil::add("WLDeletePresetAlert", args, LLSD(), boost::bind(&LLFloaterWater::deleteAlertCallback, this, _1, _2)); } bool LLFloaterWater::deleteAlertCallback(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); - // if they choose delete, do it. Otherwise, don't do anything + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + // If they choose delete, do it. Otherwise, don't do anything if(option == 0) { LLFloaterDayCycle* day_cycle = NULL; @@ -696,22 +656,22 @@ bool LLFloaterWater::deleteAlertCallback(const LLSD& notification, const LLSD& r key_combo = day_cycle->getChild("WaterKeyPresets"); } - std::string name = sWaterMenu->mWaterPresetCombo->getSelectedValue().asString(); + std::string name = mWaterPresetCombo->getSelectedValue().asString(); // check to see if it's a default and shouldn't be deleted std::set::iterator sIt = sDefaultPresets.find(name); if(sIt != sDefaultPresets.end()) { - LLNotifications::instance().add("WaterNoEditDefault"); + LLNotificationsUtil::add("WaterNoEditDefault"); return false; } LLWaterParamManager::getInstance()->removeParamSet(name, true); // remove and choose another - S32 new_index = sWaterMenu->mWaterPresetCombo->getCurrentIndex(); + S32 new_index = mWaterPresetCombo->getCurrentIndex(); - sWaterMenu->mWaterPresetCombo->remove(name); + mWaterPresetCombo->remove(name); if(key_combo != NULL) { @@ -724,23 +684,22 @@ bool LLFloaterWater::deleteAlertCallback(const LLSD& notification, const LLSD& r // pick the previously selected index after delete if(new_index > 0) { - new_index--; + --new_index; } - if(sWaterMenu->mWaterPresetCombo->getItemCount() > 0) + if(mWaterPresetCombo->getItemCount() > 0) { - sWaterMenu->mWaterPresetCombo->setCurrentByIndex(new_index); + mWaterPresetCombo->setCurrentByIndex(new_index); } } return false; } - -void LLFloaterWater::onChangePresetName(LLUICtrl* ctrl, void * userData) +void LLFloaterWater::onChangePresetName(LLUICtrl* ctrl) { - LLComboBox * combo_box = static_cast(ctrl); + LLComboBox* combo_box = static_cast(ctrl); - if(combo_box->getSimple() == "") + if(combo_box->getSimple().empty()) { return; } @@ -756,29 +715,29 @@ void LLFloaterWater::onChangePresetName(LLUICtrl* ctrl, void * userData) // LLEnvManagerNew::instance().useRegionWater(); LLEnvManagerNew::instance().setUseWaterPreset("Default"); } - sWaterMenu->syncMenu(); + syncMenu(); } -void LLFloaterWater::onClickNext(void* user_data) +void LLFloaterWater::onClickNext() { - S32 index = sWaterMenu->mWaterPresetCombo->getCurrentIndex(); - index++; - if (index == sWaterMenu->mWaterPresetCombo->getItemCount()) + S32 index = mWaterPresetCombo->getCurrentIndex(); + ++index; + if (index == mWaterPresetCombo->getItemCount()) index = 0; - sWaterMenu->mWaterPresetCombo->setCurrentByIndex(index); + mWaterPresetCombo->setCurrentByIndex(index); - LLFloaterWater::onChangePresetName(sWaterMenu->mWaterPresetCombo, sWaterMenu); + LLFloaterWater::onChangePresetName(mWaterPresetCombo); } -void LLFloaterWater::onClickPrev(void* user_data) +void LLFloaterWater::onClickPrev() { - S32 index = sWaterMenu->mWaterPresetCombo->getCurrentIndex(); + S32 index = mWaterPresetCombo->getCurrentIndex(); if (index == 0) - index = sWaterMenu->mWaterPresetCombo->getItemCount(); - index--; - sWaterMenu->mWaterPresetCombo->setCurrentByIndex(index); + index = mWaterPresetCombo->getItemCount(); + --index; + mWaterPresetCombo->setCurrentByIndex(index); - LLFloaterWater::onChangePresetName(sWaterMenu->mWaterPresetCombo, sWaterMenu); + LLFloaterWater::onChangePresetName(mWaterPresetCombo); } void LLFloaterWater::populateWaterPresetsList() diff --git a/indra/newview/llfloaterwater.h b/indra/newview/llfloaterwater.h index fbd7e26a9..fd6da0f30 100644 --- a/indra/newview/llfloaterwater.h +++ b/indra/newview/llfloaterwater.h @@ -39,15 +39,16 @@ #include "llfloater.h" -#include #include "llwlparamset.h" #include "llwlparammanager.h" // for LLWLParamKey -struct WaterColorControl; -struct WaterloatControl; - class LLComboBox; +struct WaterVector2Control; +struct WaterVector3Control; +struct WaterColorControl; +struct WaterFloatControl; +struct WaterExpFloatControl; /// Menuing system for all of windlight's functionality class LLFloaterWater : public LLFloater @@ -67,53 +68,54 @@ public: static void onClickHelp(void* data); void initHelpBtn(const std::string& name, const std::string& xml_alert); - static bool newPromptCallback(const LLSD& notification, const LLSD& response); + //-- WL stuff begins ------------------------------------------------------ - /// general purpose callbacks for dealing with color controllers - static void onColorControlRMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlGMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlBMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlAMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlIMoved(LLUICtrl* ctrl, void* userData); + bool newPromptCallback(const LLSD& notification, const LLSD& response); - static void onVector3ControlXMoved(LLUICtrl* ctrl, void* userData); - static void onVector3ControlYMoved(LLUICtrl* ctrl, void* userData); - static void onVector3ControlZMoved(LLUICtrl* ctrl, void* userData); + // general purpose callbacks for dealing with color controllers + void onColorControlRMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl); + void onColorControlGMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl); + void onColorControlBMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl); + void onColorControlAMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl); + void onColorControlIMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl); - static void onVector2ControlXMoved(LLUICtrl* ctrl, void* userData); - static void onVector2ControlYMoved(LLUICtrl* ctrl, void* userData); + void onVector3ControlXMoved(LLUICtrl* ctrl, WaterVector3Control* vector_ctrl); + void onVector3ControlYMoved(LLUICtrl* ctrl, WaterVector3Control* vector_ctrl); + void onVector3ControlZMoved(LLUICtrl* ctrl, WaterVector3Control* vector_ctrl); - static void onFloatControlMoved(LLUICtrl* ctrl, void* userData); + void onVector2ControlXMoved(LLUICtrl* ctrl, WaterVector2Control* vector_ctrl); + void onVector2ControlYMoved(LLUICtrl* ctrl, WaterVector2Control* vector_ctrl); - static void onExpFloatControlMoved(LLUICtrl* ctrl, void* userData); + void onFloatControlMoved(LLUICtrl* ctrl, WaterFloatControl* floatControl); - static void onWaterFogColorMoved(LLUICtrl* ctrl, void* userData); + void onExpFloatControlMoved(LLUICtrl* ctrl, WaterExpFloatControl* expFloatControl); - static void onBoolToggle(LLUICtrl* ctrl, void* userData); + void onWaterFogColorMoved(LLUICtrl* ctrl, WaterColorControl* color_ctrl); - /// handle if they choose a new normal map - static void onNormalMapPicked(LLUICtrl* ctrl, void* userData); + void onNormalMapPicked(LLUICtrl* ctrl); /// handle if they choose a new normal map + + //-- WL stuff ends -------------------------------------------------------- /// when user hits the load preset button - static void onNewPreset(void* userData); + void onNewPreset(); /// when user hits the save preset button - static void onSavePreset(LLUICtrl* ctrl, void* userData); + void onSavePreset(LLUICtrl* ctrl); /// prompts a user when overwriting a preset notecard - static bool saveNotecardCallback(const LLSD& notification, const LLSD& response); + bool saveNotecardCallback(const LLSD& notification, const LLSD& response); /// prompts a user when overwriting a preset - static bool saveAlertCallback(const LLSD& notification, const LLSD& response); + bool saveAlertCallback(const LLSD& notification, const LLSD& response); /// when user hits the save preset button - static void onDeletePreset(void* userData); + void onDeletePreset(); /// prompts a user when overwriting a preset - static bool deleteAlertCallback(const LLSD& notification, const LLSD& response); + bool deleteAlertCallback(const LLSD& notification, const LLSD& response); /// what to do when you change the preset name - static void onChangePresetName(LLUICtrl* ctrl, void* userData); + void onChangePresetName(LLUICtrl* ctrl); //// menu management @@ -135,8 +137,8 @@ private: static std::set sDefaultPresets; - static void onClickNext(void* user_data); - static void onClickPrev(void* user_data); + void onClickNext(); + void onClickPrev(); void populateWaterPresetsList(); diff --git a/indra/newview/llfloaterwindlight.cpp b/indra/newview/llfloaterwindlight.cpp index 278f9c084..7e9eb6a1f 100644 --- a/indra/newview/llfloaterwindlight.cpp +++ b/indra/newview/llfloaterwindlight.cpp @@ -34,37 +34,21 @@ #include "llfloaterwindlight.h" -#include "pipeline.h" -#include "llsky.h" - -#include "llsliderctrl.h" -#include "llmultislider.h" -#include "llmultisliderctrl.h" -#include "llspinctrl.h" +// libs #include "llcheckboxctrl.h" -#include "lluictrlfactory.h" -#include "llviewercamera.h" #include "llcombobox.h" -#include "lllineeditor.h" +#include "llmultisliderctrl.h" +#include "llnotificationsutil.h" +#include "llsliderctrl.h" #include "llfloaterdaycycle.h" #include "lltabcontainer.h" -#include "llboost.h" +#include "lluictrlfactory.h" +// newview #include "llagent.h" -#include "llinventorymodel.h" -#include "llviewerinventory.h" - -#include "v4math.h" -#include "llviewerdisplay.h" -#include "llviewercontrol.h" -#include "llviewerwindow.h" -#include "llsavedsettingsglue.h" - #include "llwlparamset.h" #include "llwlparammanager.h" -#undef max - LLFloaterWindLight* LLFloaterWindLight::sWindLight = NULL; std::set LLFloaterWindLight::sDefaultPresets; @@ -79,18 +63,16 @@ LLFloaterWindLight::LLFloaterWindLight() : LLFloater(std::string("windlight floa // add the combo boxes mSkyPresetCombo = getChild("WLPresetsCombo"); - - if(mSkyPresetCombo != NULL) { + if (mSkyPresetCombo) + { populateSkyPresetsList(); - mSkyPresetCombo->setCommitCallback(onChangePresetName); + mSkyPresetCombo->setCommitCallback(boost::bind(&LLFloaterWindLight::onChangePresetName, this, _1)); } // add the list of presets - std::string def_days = getString("WLDefaultSkyNames"); - // no editing or deleting of the blank string sDefaultPresets.insert(""); - boost_tokenizer tokens(def_days, boost::char_separator(":")); + boost_tokenizer tokens(getString("WLDefaultSkyNames"), boost::char_separator(":")); for (boost_tokenizer::iterator token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter) { std::string tok(*token_iter); @@ -105,7 +87,8 @@ LLFloaterWindLight::~LLFloaterWindLight() { } -void LLFloaterWindLight::initCallbacks(void) { +void LLFloaterWindLight::initCallbacks(void) +{ // help buttons initHelpBtn("WLBlueHorizonHelp", "HelpBlueHorizon"); @@ -137,93 +120,92 @@ void LLFloaterWindLight::initCallbacks(void) { initHelpBtn("WLClassicCloudsHelp", "HelpClassicClouds"); - LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); + LLWLParamManager& param_mgr = LLWLParamManager::instance(); // blue horizon - childSetCommitCallback("WLBlueHorizonR", onColorControlRMoved, ¶m_mgr->mBlueHorizon); - childSetCommitCallback("WLBlueHorizonG", onColorControlGMoved, ¶m_mgr->mBlueHorizon); - childSetCommitCallback("WLBlueHorizonB", onColorControlBMoved, ¶m_mgr->mBlueHorizon); - childSetCommitCallback("WLBlueHorizonI", onColorControlIMoved, ¶m_mgr->mBlueHorizon); + getChild("WLBlueHorizonR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr.mBlueHorizon)); + getChild("WLBlueHorizonG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr.mBlueHorizon)); + getChild("WLBlueHorizonB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr.mBlueHorizon)); + getChild("WLBlueHorizonI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, ¶m_mgr.mBlueHorizon)); // haze density, horizon, mult, and altitude - childSetCommitCallback("WLHazeDensity", onFloatControlMoved, ¶m_mgr->mHazeDensity); - childSetCommitCallback("WLHazeHorizon", onFloatControlMoved, ¶m_mgr->mHazeHorizon); - childSetCommitCallback("WLDensityMult", onFloatControlMoved, ¶m_mgr->mDensityMult); - childSetCommitCallback("WLMaxAltitude", onFloatControlMoved, ¶m_mgr->mMaxAlt); + getChild("WLHazeDensity")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr.mHazeDensity)); + getChild("WLHazeHorizon")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr.mHazeHorizon)); + getChild("WLDensityMult")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr.mDensityMult)); + getChild("WLMaxAltitude")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr.mMaxAlt)); // blue density - childSetCommitCallback("WLBlueDensityR", onColorControlRMoved, ¶m_mgr->mBlueDensity); - childSetCommitCallback("WLBlueDensityG", onColorControlGMoved, ¶m_mgr->mBlueDensity); - childSetCommitCallback("WLBlueDensityB", onColorControlBMoved, ¶m_mgr->mBlueDensity); - childSetCommitCallback("WLBlueDensityI", onColorControlIMoved, ¶m_mgr->mBlueDensity); + getChild("WLBlueDensityR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr.mBlueDensity)); + getChild("WLBlueDensityG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr.mBlueDensity)); + getChild("WLBlueDensityB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr.mBlueDensity)); + getChild("WLBlueDensityI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, ¶m_mgr.mBlueDensity)); // Lighting // sunlight - childSetCommitCallback("WLSunlightR", onColorControlRMoved, ¶m_mgr->mSunlight); - childSetCommitCallback("WLSunlightG", onColorControlGMoved, ¶m_mgr->mSunlight); - childSetCommitCallback("WLSunlightB", onColorControlBMoved, ¶m_mgr->mSunlight); - childSetCommitCallback("WLSunlightI", onColorControlIMoved, ¶m_mgr->mSunlight); + getChild("WLSunlightR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr.mSunlight)); + getChild("WLSunlightG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr.mSunlight)); + getChild("WLSunlightB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr.mSunlight)); + getChild("WLSunlightI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, ¶m_mgr.mSunlight)); // glow - childSetCommitCallback("WLGlowR", onGlowRMoved, ¶m_mgr->mGlow); - childSetCommitCallback("WLGlowB", onGlowBMoved, ¶m_mgr->mGlow); + getChild("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onGlowRMoved, this, _1, ¶m_mgr.mGlow)); + getChild("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onGlowBMoved, this, _1, ¶m_mgr.mGlow)); // ambient - childSetCommitCallback("WLAmbientR", onColorControlRMoved, ¶m_mgr->mAmbient); - childSetCommitCallback("WLAmbientG", onColorControlGMoved, ¶m_mgr->mAmbient); - childSetCommitCallback("WLAmbientB", onColorControlBMoved, ¶m_mgr->mAmbient); - childSetCommitCallback("WLAmbientI", onColorControlIMoved, ¶m_mgr->mAmbient); + getChild("WLAmbientR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr.mAmbient)); + getChild("WLAmbientG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr.mAmbient)); + getChild("WLAmbientB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr.mAmbient)); + getChild("WLAmbientI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, ¶m_mgr.mAmbient)); // time of day - childSetCommitCallback("WLSunAngle", onSunMoved, ¶m_mgr->mLightnorm); - childSetCommitCallback("WLEastAngle", onSunMoved, ¶m_mgr->mLightnorm); + getChild("WLSunAngle")->setCommitCallback(boost::bind(&LLFloaterWindLight::onSunMoved, this, _1, ¶m_mgr.mLightnorm)); + getChild("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterWindLight::onSunMoved, this, _1, ¶m_mgr.mLightnorm)); // Clouds // Cloud Color - childSetCommitCallback("WLCloudColorR", onColorControlRMoved, ¶m_mgr->mCloudColor); - childSetCommitCallback("WLCloudColorG", onColorControlGMoved, ¶m_mgr->mCloudColor); - childSetCommitCallback("WLCloudColorB", onColorControlBMoved, ¶m_mgr->mCloudColor); - childSetCommitCallback("WLCloudColorI", onColorControlIMoved, ¶m_mgr->mCloudColor); + getChild("WLCloudColorR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr.mCloudColor)); + getChild("WLCloudColorG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr.mCloudColor)); + getChild("WLCloudColorB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr.mCloudColor)); + getChild("WLCloudColorI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, ¶m_mgr.mCloudColor)); // Cloud - childSetCommitCallback("WLCloudX", onColorControlRMoved, ¶m_mgr->mCloudMain); - childSetCommitCallback("WLCloudY", onColorControlGMoved, ¶m_mgr->mCloudMain); - childSetCommitCallback("WLCloudDensity", onColorControlBMoved, ¶m_mgr->mCloudMain); + getChild("WLCloudX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr.mCloudMain)); + getChild("WLCloudY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr.mCloudMain)); + getChild("WLCloudDensity")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr.mCloudMain)); // Cloud Detail - childSetCommitCallback("WLCloudDetailX", onColorControlRMoved, ¶m_mgr->mCloudDetail); - childSetCommitCallback("WLCloudDetailY", onColorControlGMoved, ¶m_mgr->mCloudDetail); - childSetCommitCallback("WLCloudDetailDensity", onColorControlBMoved, ¶m_mgr->mCloudDetail); + getChild("WLCloudDetailX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, ¶m_mgr.mCloudDetail)); + getChild("WLCloudDetailY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, ¶m_mgr.mCloudDetail)); + getChild("WLCloudDetailDensity")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, ¶m_mgr.mCloudDetail)); // Cloud extras - childSetCommitCallback("WLCloudCoverage", onFloatControlMoved, ¶m_mgr->mCloudCoverage); - childSetCommitCallback("WLCloudScale", onFloatControlMoved, ¶m_mgr->mCloudScale); - childSetCommitCallback("WLCloudLockX", onCloudScrollXToggled, NULL); - childSetCommitCallback("WLCloudLockY", onCloudScrollYToggled, NULL); - childSetCommitCallback("WLCloudScrollX", onCloudScrollXMoved, NULL); - childSetCommitCallback("WLCloudScrollY", onCloudScrollYMoved, NULL); - childSetCommitCallback("WLDistanceMult", onFloatControlMoved, ¶m_mgr->mDistanceMult); - childSetCommitCallback("DrawClassicClouds", onCommitControlSetting(gSavedSettings), (void*)"SkyUseClassicClouds"); + getChild("WLCloudCoverage")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr.mCloudCoverage)); + getChild("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr.mCloudScale)); + getChild("WLCloudLockX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollXToggled, this, _2)); + getChild("WLCloudLockY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollYToggled, this, _2)); + getChild("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollXMoved, this, _2)); + getChild("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollYMoved, this, _2)); + getChild("WLDistanceMult")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr.mDistanceMult)); // WL Top - childSetAction("WLDayCycleMenuButton", onOpenDayCycle, NULL); - + getChild("WLDayCycleMenuButton")->setCommitCallback(boost::bind(LLFloaterDayCycle::show)); + // Load/save - //childSetAction("WLLoadPreset", onLoadPreset, mSkyPresetCombo); - childSetAction("WLNewPreset", onNewPreset, mSkyPresetCombo); - childSetAction("WLDeletePreset", onDeletePreset, mSkyPresetCombo); - childSetCommitCallback("WLSavePreset", onSavePreset, this); + //getChild("WLLoadPreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onLoadPreset, this, mSkyPresetCombo)); + getChild("WLNewPreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onNewPreset, this)); + getChild("WLDeletePreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onDeletePreset, this)); + getChild("WLSavePreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onSavePreset, this, _1)); // Dome - childSetCommitCallback("WLGamma", onFloatControlMoved, ¶m_mgr->mWLGamma); - childSetCommitCallback("WLStarAlpha", onStarAlphaMoved, NULL); + getChild("WLGamma")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, ¶m_mgr.mWLGamma)); + getChild("WLStarAlpha")->setCommitCallback(boost::bind(&LLFloaterWindLight::onStarAlphaMoved, this, _1)); // next/prev buttons - //childSetAction("next", onClickNext, this); - //childSetAction("prev", onClickPrev, this); + //getChild("next")->setCommitCallback(boost::bind(&LLFloaterWindLight::onClickNext, this)); + //getChild("prev")->setCommitCallback(boost::bind(&LLFloaterWindLight::onClickPrev, this)); } void LLFloaterWindLight::onClickHelp(void* data) @@ -242,22 +224,20 @@ void LLFloaterWindLight::initHelpBtn(const std::string& name, const std::string& bool LLFloaterWindLight::newPromptCallback(const LLSD& notification, const LLSD& response) { std::string text = response["message"].asString(); - S32 option = LLNotification::getSelectedOption(notification, response); - - if(text == "") + if(text.empty()) { return false; } + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if(option == 0) { LLFloaterDayCycle* sDayCycle = NULL; LLComboBox* keyCombo = NULL; - if(LLFloaterDayCycle::isOpen()) + if(LLFloaterDayCycle::isOpen()) { sDayCycle = LLFloaterDayCycle::instance(); - keyCombo = sDayCycle->getChild( - "WLKeyPresets"); + keyCombo = sDayCycle->getChild("WLKeyPresets"); } // add the current parameters to the list @@ -268,20 +248,19 @@ bool LLFloaterWindLight::newPromptCallback(const LLSD& notification, const LLSD& // if not there, add a new one if(!LLWLParamManager::getInstance()->hasParamSet(key)) { - LLWLParamManager::getInstance()->addParamSet(key, - LLWLParamManager::getInstance()->mCurParams); - sWindLight->mSkyPresetCombo->add(text); - sWindLight->mSkyPresetCombo->sortByName(); + LLWLParamManager::getInstance()->addParamSet(key, LLWLParamManager::getInstance()->mCurParams); + mSkyPresetCombo->add(text); + mSkyPresetCombo->sortByName(); // add a blank to the bottom - sWindLight->mSkyPresetCombo->selectFirstItem(); - if(sWindLight->mSkyPresetCombo->getSimple() == "") + mSkyPresetCombo->selectFirstItem(); + if(mSkyPresetCombo->getSimple().empty()) { - sWindLight->mSkyPresetCombo->remove(0); + mSkyPresetCombo->remove(0); } - sWindLight->mSkyPresetCombo->add(LLStringUtil::null); + mSkyPresetCombo->add(LLStringUtil::null); - sWindLight->mSkyPresetCombo->selectByValue(text); + mSkyPresetCombo->selectByValue(text); if(LLFloaterDayCycle::isOpen()) { @@ -294,10 +273,10 @@ bool LLFloaterWindLight::newPromptCallback(const LLSD& notification, const LLSD& LLEnvManagerNew::instance().setUseSkyPreset(text); // otherwise, send a message to the user - } - else + } + else { - LLNotifications::instance().add("ExistsSkyPresetAlert"); + LLNotificationsUtil::add("ExistsSkyPresetAlert"); } } return false; @@ -385,7 +364,6 @@ void LLFloaterWindLight::syncMenu() bool lockY = !param_mgr->mCurParams.getEnableCloudScrollY(); childSetValue("WLCloudLockX", lockX); childSetValue("WLCloudLockY", lockY); - childSetValue("DrawClassicClouds", gSavedSettings.getBOOL("SkyUseClassicClouds")); // disable if locked, enable if not if (lockX) @@ -423,16 +401,17 @@ void LLFloaterWindLight::syncMenu() void LLFloaterWindLight::setColorSwatch(const std::string& name, const WLColorControl& from_ctrl, F32 k) { std::string child_name(name); + const size_t end = child_name.length(); LLVector4 color_vec = from_ctrl; color_vec/=k; - + child_name.push_back('R'); childSetValue(name.data(), color_vec[0]); - child_name.replace(child_name.length()-1,1,1,'G'); + child_name.replace(end,1,1,'G'); childSetValue(child_name, color_vec[1]); - child_name.replace(child_name.length()-1,1,1,'B'); + child_name.replace(end,1,1,'B'); childSetValue(child_name, color_vec[2]); - child_name.replace(child_name.length()-1,1,1,'I'); + child_name.replace(end,1,1,'I'); childSetValue(child_name, llmax(color_vec.mV[0], color_vec.mV[1], color_vec.mV[2])); } @@ -516,15 +495,15 @@ void LLFloaterWindLight::onColorControlRMoved(LLUICtrl* ctrl, void* userdata) if (color_ctrl->isSunOrAmbientColor) { - sWindLight->childSetValue(name, color_ctrl->r / WL_SUN_AMBIENT_SLIDER_SCALE); + childSetValue(name, color_ctrl->r / WL_SUN_AMBIENT_SLIDER_SCALE); } else if (color_ctrl->isBlueHorizonOrDensity) { - sWindLight->childSetValue(name, color_ctrl->r / WL_BLUE_HORIZON_DENSITY_SCALE); + childSetValue(name, color_ctrl->r / WL_BLUE_HORIZON_DENSITY_SCALE); } else { - sWindLight->childSetValue(name, color_ctrl->r); + childSetValue(name, color_ctrl->r); } } @@ -559,15 +538,15 @@ void LLFloaterWindLight::onColorControlGMoved(LLUICtrl* ctrl, void* userdata) if (color_ctrl->isSunOrAmbientColor) { - sWindLight->childSetValue(name, color_ctrl->g / WL_SUN_AMBIENT_SLIDER_SCALE); + childSetValue(name, color_ctrl->g / WL_SUN_AMBIENT_SLIDER_SCALE); } else if (color_ctrl->isBlueHorizonOrDensity) { - sWindLight->childSetValue(name, color_ctrl->g / WL_BLUE_HORIZON_DENSITY_SCALE); + childSetValue(name, color_ctrl->g / WL_BLUE_HORIZON_DENSITY_SCALE); } else { - sWindLight->childSetValue(name, color_ctrl->g); + childSetValue(name, color_ctrl->g); } } @@ -602,15 +581,15 @@ void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, void* userdata) if (color_ctrl->isSunOrAmbientColor) { - sWindLight->childSetValue(name, color_ctrl->b / WL_SUN_AMBIENT_SLIDER_SCALE); + childSetValue(name, color_ctrl->b / WL_SUN_AMBIENT_SLIDER_SCALE); } else if (color_ctrl->isBlueHorizonOrDensity) { - sWindLight->childSetValue(name, color_ctrl->b / WL_BLUE_HORIZON_DENSITY_SCALE); + childSetValue(name, color_ctrl->b / WL_BLUE_HORIZON_DENSITY_SCALE); } else { - sWindLight->childSetValue(name, color_ctrl->b); + childSetValue(name, color_ctrl->b); } } @@ -619,28 +598,27 @@ void LLFloaterWindLight::onColorControlBMoved(LLUICtrl* ctrl, void* userdata) LLWLParamManager::getInstance()->propagateParameters(); } -void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userdata) { LLWLParamManager::getInstance()->mAnimator.deactivate(); LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - WLColorControl * color_ctrl = static_cast(userData); + WLColorControl* color_ctrl = static_cast(userdata); color_ctrl->i = sldr_ctrl->getValueF32(); // only for sliders where we pass a name if(color_ctrl->hasSliderName) { - // set it to the top - F32 maxVal = std::max(std::max(color_ctrl->r, color_ctrl->g), color_ctrl->b); - + F32 maxVal = llmax(llmax(color_ctrl->r, color_ctrl->g), color_ctrl->b); + F32 scale = 1.f; if(color_ctrl->isSunOrAmbientColor) scale = WL_SUN_AMBIENT_SLIDER_SCALE; else if(color_ctrl->isBlueHorizonOrDensity) scale = WL_BLUE_HORIZON_DENSITY_SCALE; - + F32 iVal = color_ctrl->i * scale; // handle if at 0 @@ -658,7 +636,6 @@ void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userData) color_ctrl->r = iVal; color_ctrl->g = iVal; color_ctrl->b = iVal; - } else { @@ -671,12 +648,13 @@ void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userData) // set the sliders to the new vals std::string child_name(color_ctrl->mSliderName); + const size_t end = child_name.length(); child_name.push_back('R'); - sWindLight->childSetValue(child_name, color_ctrl->r/scale); - child_name.replace(child_name.length()-1,1,1,'G'); - sWindLight->childSetValue(child_name, color_ctrl->g/scale); - child_name.replace(child_name.length()-1,1,1,'B'); - sWindLight->childSetValue(child_name, color_ctrl->b/scale); + childSetValue(child_name, color_ctrl->r/scale); + child_name.replace(end,1,1,'G'); + childSetValue(child_name, color_ctrl->g/scale); + child_name.replace(end,1,1,'B'); + childSetValue(child_name, color_ctrl->b/scale); } // now update the current parameters and send them to shaders @@ -727,34 +705,23 @@ void LLFloaterWindLight::onFloatControlMoved(LLUICtrl* ctrl, void* userdata) LLWLParamManager::getInstance()->propagateParameters(); } -void LLFloaterWindLight::onBoolToggle(LLUICtrl* ctrl, void* userData) -{ - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLCheckBoxCtrl* cbCtrl = static_cast(ctrl); - - bool value = cbCtrl->get(); - (*(static_cast(userData))) = value; -} - // Lighting callbacks // time of day -void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, void* userdata) { LLWLParamManager::getInstance()->mAnimator.deactivate(); - LLSliderCtrl* sunSldr = sWindLight->getChild("WLSunAngle"); - LLSliderCtrl* eastSldr = sWindLight->getChild("WLEastAngle"); - - WLColorControl * color_ctrl = static_cast(userData); + LLSliderCtrl* sun_sldr = getChild("WLSunAngle"); + LLSliderCtrl* east_sldr = getChild("WLEastAngle"); + WLColorControl* color_ctrl = static_cast(userdata); // get the two angles LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); - param_mgr->mCurParams.setSunAngle(F_TWO_PI * sunSldr->getValueF32()); - param_mgr->mCurParams.setEastAngle(F_TWO_PI * eastSldr->getValueF32()); + param_mgr->mCurParams.setSunAngle(F_TWO_PI * sun_sldr->getValueF32()); + param_mgr->mCurParams.setEastAngle(F_TWO_PI * east_sldr->getValueF32()); // set the sun vector color_ctrl->r = -sin(param_mgr->mCurParams.getEastAngle()) * @@ -768,35 +735,59 @@ void LLFloaterWindLight::onSunMoved(LLUICtrl* ctrl, void* userData) param_mgr->propagateParameters(); } -void LLFloaterWindLight::onFloatTweakMoved(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onStarAlphaMoved(LLUICtrl* ctrl) { LLWLParamManager::getInstance()->mAnimator.deactivate(); - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - F32 * tweak = static_cast(userData); + LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - (*tweak) = sldrCtrl->getValueF32(); - LLWLParamManager::getInstance()->propagateParameters(); + LLWLParamManager::getInstance()->mCurParams.setStarBrightness(sldr_ctrl->getValueF32()); } -void LLFloaterWindLight::onStarAlphaMoved(LLUICtrl* ctrl, void* userData) +// Clouds +void LLFloaterWindLight::onCloudScrollXMoved(const LLSD& value) { LLWLParamManager::getInstance()->mAnimator.deactivate(); - LLSliderCtrl* sldrCtrl = static_cast(ctrl); - - LLWLParamManager::getInstance()->mCurParams.setStarBrightness(sldrCtrl->getValueF32()); + // *HACK all cloud scrolling is off by an additive of 10. + LLWLParamManager::getInstance()->mCurParams.setCloudScrollX(value.asFloat() + 10.0f); } -void LLFloaterWindLight::onNewPreset(void* userData) +void LLFloaterWindLight::onCloudScrollYMoved(const LLSD& value) { - LLNotifications::instance().add("NewSkyPreset", LLSD(), LLSD(), newPromptCallback); + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + // *HACK all cloud scrolling is off by an additive of 10. + LLWLParamManager::getInstance()->mCurParams.setCloudScrollY(value.asFloat() + 10.0f); } -void LLFloaterWindLight::onSavePreset(LLUICtrl* ctrl, void* userData) +void LLFloaterWindLight::onCloudScrollXToggled(const LLSD& value) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + bool lock = value.asBoolean(); + LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollX(!lock); + getChild("WLCloudScrollX")->setEnabled(!lock); +} + +void LLFloaterWindLight::onCloudScrollYToggled(const LLSD& value) +{ + LLWLParamManager::getInstance()->mAnimator.deactivate(); + + bool lock = value.asBoolean(); + LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollY(!lock); + getChild("WLCloudScrollY")->setEnabled(!lock); +} + +void LLFloaterWindLight::onNewPreset() +{ + LLNotificationsUtil::add("NewSkyPreset", LLSD(), LLSD(), boost::bind(&LLFloaterWindLight::newPromptCallback, this, _1, _2)); +} + +void LLFloaterWindLight::onSavePreset(LLUICtrl* ctrl) { // don't save the empty name - if(sWindLight->mSkyPresetCombo->getSelectedItemLabel() == "") + if(mSkyPresetCombo->getSelectedItemLabel().empty()) { return; } @@ -808,24 +799,22 @@ void LLFloaterWindLight::onSavePreset(LLUICtrl* ctrl, void* userData) else { // check to see if it's a default and shouldn't be overwritten - std::set::iterator sIt = sDefaultPresets.find( - sWindLight->mSkyPresetCombo->getSelectedItemLabel()); + std::set::iterator sIt = sDefaultPresets.find(mSkyPresetCombo->getSelectedItemLabel()); if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("SkyEditPresets")) { - LLNotifications::instance().add("WLNoEditDefault"); + LLNotificationsUtil::add("WLNoEditDefault"); return; } - LLWLParamManager::getInstance()->mCurParams.mName = - sWindLight->mSkyPresetCombo->getSelectedItemLabel(); + LLWLParamManager::getInstance()->mCurParams.mName = mSkyPresetCombo->getSelectedItemLabel(); - LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback); + LLNotificationsUtil::add("WLSavePresetAlert", LLSD(), LLSD(), boost::bind(&LLFloaterWindLight::saveAlertCallback, this, _1, _2)); } } bool LLFloaterWindLight::saveNotecardCallback(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); // if they choose save, do it. Otherwise, don't do anything if(option == 0) { @@ -838,9 +827,9 @@ bool LLFloaterWindLight::saveNotecardCallback(const LLSD& notification, const LL bool LLFloaterWindLight::saveAlertCallback(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); // if they choose save, do it. Otherwise, don't do anything - if(option == 0) + if(option == 0) { LLWLParamManager * param_mgr = LLWLParamManager::getInstance(); @@ -853,30 +842,29 @@ bool LLFloaterWindLight::saveAlertCallback(const LLSD& notification, const LLSD& return false; } -void LLFloaterWindLight::onDeletePreset(void* userData) +void LLFloaterWindLight::onDeletePreset() { - if(sWindLight->mSkyPresetCombo->getSelectedValue().asString() == "") + if(mSkyPresetCombo->getSelectedValue().asString().empty()) { return; } LLSD args; - args["SKY"] = sWindLight->mSkyPresetCombo->getSelectedValue().asString(); - LLNotifications::instance().add("WLDeletePresetAlert", args, LLSD(), - boost::bind(&LLFloaterWindLight::deleteAlertCallback, sWindLight, _1, _2)); + args["SKY"] = mSkyPresetCombo->getSelectedValue().asString(); + LLNotificationsUtil::add("WLDeletePresetAlert", args, LLSD(), boost::bind(&LLFloaterWindLight::deleteAlertCallback, this, _1, _2)); } bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); // if they choose delete, do it. Otherwise, don't do anything - if(option == 0) + if(option == 0) { LLFloaterDayCycle* day_cycle = NULL; LLComboBox* key_combo = NULL; - if(LLFloaterDayCycle::isOpen()) + if(LLFloaterDayCycle::isOpen()) { day_cycle = LLFloaterDayCycle::instance(); key_combo = day_cycle->getChild("WLKeyPresets"); @@ -888,7 +876,7 @@ bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLS std::set::iterator sIt = sDefaultPresets.find(name); if(sIt != sDefaultPresets.end()) { - LLNotifications::instance().add("WLNoEditDefault"); + LLNotificationsUtil::add("WLNoEditDefault"); return false; } @@ -907,12 +895,12 @@ bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLS } // pick the previously selected index after delete - if(new_index > 0) + if(new_index > 0) { - new_index--; + --new_index; } - if(mSkyPresetCombo->getItemCount() > 0) + if(mSkyPresetCombo->getItemCount() > 0) { mSkyPresetCombo->setCurrentByIndex(new_index); @@ -929,11 +917,11 @@ bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLS } -void LLFloaterWindLight::onChangePresetName(LLUICtrl* ctrl, void * userData) +void LLFloaterWindLight::onChangePresetName(LLUICtrl* ctrl) { - LLComboBox * combo_box = static_cast(ctrl); + LLComboBox* combo_box = static_cast(ctrl); - if(combo_box->getSimple() == "") + if(combo_box->getSimple().empty()) { return; } @@ -951,97 +939,30 @@ void LLFloaterWindLight::onChangePresetName(LLUICtrl* ctrl, void * userData) } //LL_INFOS("WindLight") << "Current inventory ID: " << LLWLParamManager::getInstance()->mCurParams.mInventoryID << LL_ENDL; - sWindLight->syncMenu(); -} - -void LLFloaterWindLight::onOpenDayCycle(void* userData) -{ - LLFloaterDayCycle::show(); -} - -// Clouds -void LLFloaterWindLight::onCloudScrollXMoved(LLUICtrl* ctrl, void* userData) -{ - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - // *HACK all cloud scrolling is off by an additive of 10. - LLWLParamManager::getInstance()->mCurParams.setCloudScrollX(sldr_ctrl->getValueF32() + 10.0f); -} - -void LLFloaterWindLight::onCloudScrollYMoved(LLUICtrl* ctrl, void* userData) -{ - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLSliderCtrl* sldr_ctrl = static_cast(ctrl); - - // *HACK all cloud scrolling is off by an additive of 10. - LLWLParamManager::getInstance()->mCurParams.setCloudScrollY(sldr_ctrl->getValueF32() + 10.0f); -} - -void LLFloaterWindLight::onCloudScrollXToggled(LLUICtrl* ctrl, void* userData) -{ - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLCheckBoxCtrl* cb_ctrl = static_cast(ctrl); - - bool lock = cb_ctrl->get(); - LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollX(!lock); - - LLSliderCtrl* sldr = sWindLight->getChild("WLCloudScrollX"); - - if (cb_ctrl->get()) - { - sldr->setEnabled(false); - } - else - { - sldr->setEnabled(true); - } - -} - -void LLFloaterWindLight::onCloudScrollYToggled(LLUICtrl* ctrl, void* userData) -{ - LLWLParamManager::getInstance()->mAnimator.deactivate(); - - LLCheckBoxCtrl* cb_ctrl = static_cast(ctrl); - bool lock = cb_ctrl->get(); - LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollY(!lock); - - LLSliderCtrl* sldr = sWindLight->getChild("WLCloudScrollY"); - - if (cb_ctrl->get()) - { - sldr->setEnabled(false); - } - else - { - sldr->setEnabled(true); - } + syncMenu(); } -void LLFloaterWindLight::onClickNext(void* user_data) +void LLFloaterWindLight::onClickNext() { - S32 index = sWindLight->mSkyPresetCombo->getCurrentIndex(); - index++; - if (index == sWindLight->mSkyPresetCombo->getItemCount()) + S32 index = mSkyPresetCombo->getCurrentIndex(); + ++index; + if (index == mSkyPresetCombo->getItemCount()) index = 0; - sWindLight->mSkyPresetCombo->setCurrentByIndex(index); + mSkyPresetCombo->setCurrentByIndex(index); - LLFloaterWindLight::onChangePresetName(sWindLight->mSkyPresetCombo, sWindLight); + onChangePresetName(mSkyPresetCombo); } -void LLFloaterWindLight::onClickPrev(void* user_data) +void LLFloaterWindLight::onClickPrev() { - S32 index = sWindLight->mSkyPresetCombo->getCurrentIndex(); + S32 index = mSkyPresetCombo->getCurrentIndex(); if (index == 0) - index = sWindLight->mSkyPresetCombo->getItemCount(); - index--; - sWindLight->mSkyPresetCombo->setCurrentByIndex(index); + index = mSkyPresetCombo->getItemCount(); + --index; + mSkyPresetCombo->setCurrentByIndex(index); - LLFloaterWindLight::onChangePresetName(sWindLight->mSkyPresetCombo, sWindLight); + onChangePresetName(mSkyPresetCombo); } //static diff --git a/indra/newview/llfloaterwindlight.h b/indra/newview/llfloaterwindlight.h index c4828bf7f..2d3578702 100644 --- a/indra/newview/llfloaterwindlight.h +++ b/indra/newview/llfloaterwindlight.h @@ -39,9 +39,6 @@ #include "llfloater.h" -#include -#include "llwlparamset.h" - struct WLColorControl; struct WLFloatControl; @@ -55,84 +52,76 @@ public: LLFloaterWindLight(); virtual ~LLFloaterWindLight(); - /// initialize all + // initialize all void initCallbacks(void); - /// one and one instance only + // one and one instance only static LLFloaterWindLight* instance(); // help button stuff static void onClickHelp(void* data); void initHelpBtn(const std::string& name, const std::string& xml_alert); - static bool newPromptCallback(const LLSD& notification, const LLSD& response); + bool newPromptCallback(const LLSD& notification, const LLSD& response); void setColorSwatch(const std::string& name, const WLColorControl& from_ctrl, F32 k); - /// general purpose callbacks for dealing with color controllers - static void onColorControlRMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlGMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlBMoved(LLUICtrl* ctrl, void* userData); - static void onColorControlIMoved(LLUICtrl* ctrl, void* userData); - static void onFloatControlMoved(LLUICtrl* ctrl, void* userData); - static void onBoolToggle(LLUICtrl* ctrl, void* userData); + // general purpose callbacks for dealing with color controllers + void onColorControlRMoved(LLUICtrl* ctrl, void* userdata); + void onColorControlGMoved(LLUICtrl* ctrl, void* userdata); + void onColorControlBMoved(LLUICtrl* ctrl, void* userdata); + void onColorControlIMoved(LLUICtrl* ctrl, void* userdata); + void onFloatControlMoved(LLUICtrl* ctrl, void* userdata); - /// lighting callbacks for glow - static void onGlowRMoved(LLUICtrl* ctrl, void* userData); - //static void onGlowGMoved(LLUICtrl* ctrl, void* userData); - static void onGlowBMoved(LLUICtrl* ctrl, void* userData); + // lighting callbacks for glow + void onGlowRMoved(LLUICtrl* ctrl, void* userdata); + void onGlowBMoved(LLUICtrl* ctrl, void* userdata); - /// lighting callbacks for sun - static void onSunMoved(LLUICtrl* ctrl, void* userData); + // lighting callbacks for sun + void onSunMoved(LLUICtrl* ctrl, void* userdata); - /// handle if float is changed - static void onFloatTweakMoved(LLUICtrl* ctrl, void* userData); + // for handling when the star slider is moved to adjust the alpha + void onStarAlphaMoved(LLUICtrl* ctrl); - /// for handling when the star slider is moved to adjust the alpha - static void onStarAlphaMoved(LLUICtrl* ctrl, void* userData); + // when user hits the load preset button + void onNewPreset(); - /// when user hits the load preset button - static void onNewPreset(void* userData); - - /// when user hits the save to file button - static void onSavePreset(LLUICtrl* ctrl, void* userData); + // when user hits the save to file button + void onSavePreset(LLUICtrl* ctrl); - /// prompts a user when overwriting a preset notecard - static bool saveNotecardCallback(const LLSD& notification, const LLSD& response); + // prompts a user when overwriting a preset notecard + bool saveNotecardCallback(const LLSD& notification, const LLSD& response); - /// prompts a user when overwriting a preset - static bool saveAlertCallback(const LLSD& notification, const LLSD& response); + // prompts a user when overwriting a preset + bool saveAlertCallback(const LLSD& notification, const LLSD& response); - /// when user hits the save preset button - static void onDeletePreset(void* userData); + // when user hits the save preset button + void onDeletePreset(); - /// prompts a user when overwriting a preset + // prompts a user when overwriting a preset bool deleteAlertCallback(const LLSD& notification, const LLSD& response); - /// what to do when you change the preset name - static void onChangePresetName(LLUICtrl* ctrl, void* userData); + // what to do when you change the preset name + void onChangePresetName(LLUICtrl* ctrl); - /// when user hits the save preset button - static void onOpenDayCycle(void* userData); - - /// handle cloud scrolling - static void onCloudScrollXMoved(LLUICtrl* ctrl, void* userData); - static void onCloudScrollYMoved(LLUICtrl* ctrl, void* userData); - static void onCloudScrollXToggled(LLUICtrl* ctrl, void* userData); - static void onCloudScrollYToggled(LLUICtrl* ctrl, void* userData); + // handle cloud scrolling + void onCloudScrollXMoved(const LLSD& value); + void onCloudScrollYMoved(const LLSD& value); + void onCloudScrollXToggled(const LLSD& value); + void onCloudScrollYToggled(const LLSD& value); //// menu management - /// show off our menu + // show off our menu static void show(); - /// return if the menu exists or not + // return if the menu exists or not static bool isOpen(); - /// stuff to do on exit + // stuff to do on exit virtual void onClose(bool app_quitting); - /// sync up sliders with parameters + // sync up sliders with parameters void syncMenu(); @@ -144,11 +133,11 @@ private: static std::set sDefaultPresets; - static void onClickNext(void* user_data); - static void onClickPrev(void* user_data); - + void onClickNext(); + void onClickPrev(); + void populateSkyPresetsList(); - + LLComboBox* mSkyPresetCombo; }; diff --git a/indra/newview/llpanelinput.cpp b/indra/newview/llpanelinput.cpp index 685f9a7fb..41287c4d7 100644 --- a/indra/newview/llpanelinput.cpp +++ b/indra/newview/llpanelinput.cpp @@ -45,10 +45,9 @@ LLPanelInput::LLPanelInput() LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_input.xml"); } -static void onFOVAdjust(LLUICtrl* source, void* data) +static void onFOVAdjust(const LLSD& value) { - LLSliderCtrl* slider = dynamic_cast(source); - LLViewerCamera::getInstance()->setDefaultFOV(slider->getValueF32()); + LLViewerCamera::getInstance()->setDefaultFOV(value.asFloat()); } BOOL LLPanelInput::postBuild() @@ -68,7 +67,7 @@ BOOL LLPanelInput::postBuild() childSetValue("first_person_avatar_visible", gSavedSettings.getBOOL("FirstPersonAvatarVisible")); LLSliderCtrl* fov_slider = getChild("camera_fov"); - fov_slider->setCommitCallback(&onFOVAdjust); + fov_slider->setCommitCallback(boost::bind(onFOVAdjust, _2)); fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView()); fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView()); fov_slider->setValue(LLViewerCamera::getInstance()->getView()); diff --git a/indra/newview/llpanellandmedia.cpp b/indra/newview/llpanellandmedia.cpp index 07fc30553..a515eadc7 100644 --- a/indra/newview/llpanellandmedia.cpp +++ b/indra/newview/llpanellandmedia.cpp @@ -88,8 +88,7 @@ BOOL LLPanelLandMedia::postBuild() { mMediaTextureCtrl = getChild("media texture"); - mMediaTextureCtrl->setCommitCallback( onCommitAny ); - mMediaTextureCtrl->setCallbackUserData( this ); + mMediaTextureCtrl->setCommitCallback( onCommitAny, this ); mMediaTextureCtrl->setAllowNoTexture ( TRUE ); mMediaTextureCtrl->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); mMediaTextureCtrl->setDnDFilterPermMask(PERM_COPY | PERM_TRANSFER); diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index e6fed8486..0986ac024 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -239,7 +239,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, reshape(rect.getWidth(), rect.getHeight()); LLComboBox* name_combo = sInstance->getChild("name_combo"); - name_combo->setCommitCallback(onSelectLoginEntry); + name_combo->setCommitCallback(boost::bind(LLPanelLogin::onSelectLoginEntry, _1, this)); name_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLoginComboLostFocus, this, name_combo)); name_combo->setPrevalidate(LLLineEditor::prevalidatePrintableNotPipe); name_combo->setSuppressTentative(true); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index eb5e430b8..7983b445a 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -209,7 +209,7 @@ BOOL LLInventoryView::postBuild() if (mQuickFilterCombo) { - mQuickFilterCombo->setCommitCallback(onQuickFilterCommit); + mQuickFilterCombo->setCommitCallback(boost::bind(LLInventoryView::onQuickFilterCommit, _1, this)); } diff --git a/indra/newview/llpanelskins.cpp b/indra/newview/llpanelskins.cpp index 3d5958a5f..610c8249d 100644 --- a/indra/newview/llpanelskins.cpp +++ b/indra/newview/llpanelskins.cpp @@ -48,24 +48,20 @@ #include "llsdserialize.h" -LLPanelSkins* LLPanelSkins::sInstance; LLPanelSkins::LLPanelSkins() { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_skins.xml"); - if(sInstance)delete sInstance; - sInstance = this; } LLPanelSkins::~LLPanelSkins() { - sInstance = NULL; } BOOL LLPanelSkins::postBuild() { mSkin = gSavedSettings.getString("SkinCurrent"); oldSkin=mSkin; - getChild("custom_skin_combo")->setCommitCallback(onComboBoxCommit); + getChild("custom_skin_combo")->setCommitCallback(boost::bind(&LLPanelSkins::onComboBoxCommit, this, _2)); refresh(); return TRUE; } @@ -159,27 +155,21 @@ void LLPanelSkins::cancel() gSavedSettings.setString("SkinCurrent", oldSkin); } -//static -void LLPanelSkins::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) +void LLPanelSkins::onComboBoxCommit(const LLSD& value) { - LLComboBox* box = (LLComboBox*)ctrl; - if(box) + const std::string skinName = value.asString(); + for(int i = 0; i < (int)datas.size(); ++i) { - std::string skinName = box->getValue().asString(); - for(int i =0;i<(int)sInstance->datas.size();i++) + const LLSD tdata = datas[i]; + if (tdata["skin_name"].asString() == skinName) { - LLSD tdata=sInstance->datas[i]; - std::string tempName = tdata["skin_name"].asString(); - if(tempName==skinName) - { - std::string newFolder(tdata["folder_name"].asString()); - gSavedSettings.setString("SkinCurrent",newFolder); - sInstance->mSkin=newFolder; + std::string newFolder(tdata["folder_name"].asString()); + gSavedSettings.setString("SkinCurrent", newFolder); + mSkin = newFolder; - if(sInstance)sInstance->refresh(); - return; - } + refresh(); + return; } - } + } } diff --git a/indra/newview/llpanelskins.h b/indra/newview/llpanelskins.h index 0208309e1..030668834 100644 --- a/indra/newview/llpanelskins.h +++ b/indra/newview/llpanelskins.h @@ -48,11 +48,10 @@ public: void refresh(); void apply(); void cancel(); - static void onComboBoxCommit(LLUICtrl* ctrl, void* userdata); + void onComboBoxCommit(const LLSD& value); std::string mSkin; private: - static LLPanelSkins* sInstance; std::string oldSkin; }; diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index c31f53538..c5ffefffe 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -414,7 +414,6 @@ BOOL LLPreviewGesture::postBuild() edit->setKeystrokeCallback(boost::bind(&onKeystrokeCommit,_1,this)); edit->setCommitCallback(boost::bind(&LLPreviewGesture::onCommitSetDirty,this)); edit->setCommitOnFocusLost(TRUE); - edit->setIgnoreTab(TRUE); mReplaceEditor = edit; @@ -479,10 +478,8 @@ BOOL LLPreviewGesture::postBuild() edit = getChild("chat_editor"); edit->setVisible(FALSE); edit->setCommitCallback(boost::bind(&LLPreviewGesture::onCommitChat,this)); - //edit->setKeystrokeCallback(onKeystrokeCommit); - //edit->setCallbackUserData(this); + //edit->setKeystrokeCallback(onKeystrokeCommit, this); edit->setCommitOnFocusLost(TRUE); - edit->setIgnoreTab(TRUE); mChatEditor = edit; @@ -500,11 +497,9 @@ BOOL LLPreviewGesture::postBuild() edit->setEnabled(FALSE); edit->setVisible(FALSE); edit->setPrevalidate(LLLineEditor::prevalidateFloat); -// edit->setKeystrokeCallback(onKeystrokeCommit); - //edit->setCallbackUserData(this); +// edit->setKeystrokeCallback(onKeystrokeCommit, this); edit->setCommitOnFocusLost(TRUE); edit->setCommitCallback(boost::bind(&LLPreviewGesture::onCommitWaitTime,this)); - edit->setIgnoreTab(TRUE); mWaitTimeEditor = edit; @@ -528,7 +523,6 @@ BOOL LLPreviewGesture::postBuild() addAnimations(); addSounds(); - const LLInventoryItem* item = getItem(); if (item) diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 7492ea725..46cebc7b5 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -37,7 +37,6 @@ #include "llagent.h" #include "llagentcamera.h" #include "statemachine/aifilepicker.h" -#include "llfloateranimpreview.h" #include "llfloaterbvhpreview.h" #include "llfloaterimagepreview.h" #include "llfloatermodelpreview.h" @@ -217,7 +216,7 @@ bool AIFileUpload::is_valid(std::string const& filename, ELoadFilter type) // No extension LLSD args; args["FILE"] = short_name; - LLNotifications::instance().add("NoFileExtension", args); + LLNotificationsUtil::add("NoFileExtension", args); return false; } else @@ -260,7 +259,7 @@ bool AIFileUpload::is_valid(std::string const& filename, ELoadFilter type) LLSD args; args["EXTENSION"] = ext; args["VALIDS"] = valid_extensions; - LLNotifications::instance().add("InvalidFileExtension", args); + LLNotificationsUtil::add("InvalidFileExtension", args); return false; } }//end else (non-null extension) @@ -279,7 +278,7 @@ bool AIFileUpload::is_valid(std::string const& filename, ELoadFilter type) llinfos << error_msg << ": " << filename << llendl; LLSD args; args["FILE"] = filename; - LLNotifications::instance().add( error_msg, args ); + LLNotificationsUtil::add( error_msg, args ); return false; } }//end if a wave/sound file @@ -331,9 +330,7 @@ class LLFileUploadSound : public view_listener_t, public AIFileUpload // Inherited from AIFileUpload. /*virtual*/ void handle_event(std::string const& filename) { - LLFloaterNameDesc* floaterp = new LLFloaterNameDesc(filename); - LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_sound_preview.xml"); - floaterp->childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%d", LLGlobalEconomy::Singleton::getInstance()->getPriceUpload() )); + LLUICtrlFactory::getInstance()->buildFloater(new LLFloaterSoundPreview(LLSD(filename)), "floater_sound_preview.xml"); } }; @@ -349,20 +346,34 @@ class LLFileUploadAnim : public view_listener_t, public AIFileUpload // Inherited from AIFileUpload. /*virtual*/ void handle_event(std::string const& filename) { - int len = filename.size(); - if (len >= 5 && filename.substr(len - 5, 5) == ".anim") + if (filename.rfind(".anim") != std::string::npos) { - LLFloaterAnimPreview* floaterp = new LLFloaterAnimPreview(filename); - LLUICtrlFactory::getInstance()->buildFloater(floaterp, "floater_animation_anim_preview.xml"); - floaterp->childSetLabelArg("ok_btn", "[AMOUNT]", llformat("%s%d", gHippoGridManager->getConnectedGrid()->getCurrencySymbol().c_str(), LLGlobalEconomy::Singleton::getInstance()->getPriceUpload())); + LLUICtrlFactory::getInstance()->buildFloater(new LLFloaterAnimPreview(LLSD(filename)), "floater_animation_anim_preview.xml"); } else { - LLUICtrlFactory::getInstance()->buildFloater(new LLFloaterBvhPreview(filename), "floater_animation_bvh_preview.xml"); + LLUICtrlFactory::getInstance()->buildFloater(new LLFloaterBvhPreview(LLSD(filename)), "floater_animation_bvh_preview.xml"); } } }; +/* Singu TODO? LL made a class to upload scripts, but never actually hooked everything up, it'd be nice for us to offer such a thing. +class LLFileUploadScript : public view_listener_t, public AIFileUpload +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + start_filepicker(FFLOAD_SCRIPT, "script"); + return true; + } + + protected: + // Inherited from AIFileUpload. + virtual void handle_event(std::string const& filename) + { + LLUICtrlFactory::getInstance()->buildFloater(new LLFloaterScriptPreview(LLSD(filename)), "floater_script_preview.xml"); + } +};*/ + class LLFileUploadBulk : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -386,13 +397,13 @@ class LLFileUploadBulk : public view_listener_t const char* notification_type = expected_upload_cost ? "BulkTemporaryUpload" : "BulkTemporaryUploadFree"; LLSD args; args["UPLOADCOST"] = gHippoGridManager->getConnectedGrid()->getUploadFee(); - LLNotifications::instance().add(notification_type, args, LLSD(), onConfirmBulkUploadTemp); + LLNotificationsUtil::add(notification_type, args, LLSD(), onConfirmBulkUploadTemp); return true; } static bool onConfirmBulkUploadTemp(const LLSD& notification, const LLSD& response ) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); bool enabled; if (option == 0) // yes enabled = true; @@ -446,7 +457,7 @@ class LLFileUploadBulk : public view_listener_t void upload_error(const std::string& error_message, const std::string& label, const std::string& filename, const LLSD& args) { llwarns << error_message << llendl; - LLNotifications::instance().add(label, args); + LLNotificationsUtil::add(label, args); if(LLFile::remove(filename) == -1) { lldebugs << "unable to remove temp file" << llendl; @@ -1361,6 +1372,7 @@ void init_menu_file() (new LLFileUploadImage())->registerListener(gMenuHolder, "File.UploadImage"); (new LLFileUploadSound())->registerListener(gMenuHolder, "File.UploadSound"); (new LLFileUploadAnim())->registerListener(gMenuHolder, "File.UploadAnim"); + //(new LLFileUploadScript())->registerListener(gMenuHolder, "File.UploadScript"); // Singu TODO? (new LLFileUploadModel())->registerListener(gMenuHolder, "File.UploadModel"); (new LLFileUploadBulk())->registerListener(gMenuHolder, "File.UploadBulk"); (new LLFileCloseWindow())->registerListener(gMenuHolder, "File.CloseWindow"); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 1fc40806c..2a09ccbd7 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -55,12 +55,10 @@ #include "llagentcamera.h" #include "llcallingcard.h" #include "llfirstuse.h" -#include "llfloaterbvhpreview.h" #include "llfloaterbump.h" #include "llfloaterbuycurrency.h" #include "llfloaterbuyland.h" #include "llfloaterchat.h" -#include "llfloaterimagepreview.h" #include "llfloaterland.h" #include "llfloaterregioninfo.h" #include "llfloaterlandholdings.h" @@ -6647,9 +6645,6 @@ void process_economy_data(LLMessageSystem *msg, void** /*user_data*/) LL_INFOS_ONCE("Messaging") << "EconomyData message arrived; upload cost is L$" << upload_cost << LL_ENDL; - LLFloaterImagePreview::setUploadAmount(upload_cost); - LLFloaterBvhPreview::setUploadAmount(upload_cost); - std::string fee = gHippoGridManager->getConnectedGrid()->getUploadFee(); gMenuHolder->childSetLabelArg("Upload Image", "[UPLOADFEE]", fee); gMenuHolder->childSetLabelArg("Upload Sound", "[UPLOADFEE]", fee); diff --git a/indra/newview/skins/default/xui/en-us/floater_animation_anim_preview.xml b/indra/newview/skins/default/xui/en-us/floater_animation_anim_preview.xml index 785a80334..ff1f59c89 100644 --- a/indra/newview/skins/default/xui/en-us/floater_animation_anim_preview.xml +++ b/indra/newview/skins/default/xui/en-us/floater_animation_anim_preview.xml @@ -58,7 +58,7 @@