Merge branch 'master' of git://github.com/Lirusaito/SingularityViewer into VoiceUpdate

Conflicts:
	indra/llui/lluictrl.cpp - Silly mergestuffs
	indra/newview/llfloatermediabrowser.cpp - deleted
	indra/newview/llpanellogin.cpp - updated functions went poof

Compile Fixies:
	indra/newview/llfloaterwater.cpp - I missed a spot with notificationsutil, it seems.
This commit is contained in:
Lirusaito
2013-06-26 12:37:31 -04:00
37 changed files with 1060 additions and 1533 deletions

View File

@@ -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;
}

View File

@@ -786,9 +786,9 @@ void LLPanel::childSetCommitCallback(const std::string& id, boost::function<void
}
}
void LLPanel::childSetValidate(const std::string& id, BOOL (*cb)(LLUICtrl*, void*))
void LLPanel::childSetValidate(const std::string& id, boost::function<bool (const LLSD& data)> cb)
{
LLUICtrl* child = getChild<LLUICtrl>(id, true);
LLUICtrl* child = findChild<LLUICtrl>(id);
if (child)
{
child->setValidateBeforeCommit(cb);

View File

@@ -178,7 +178,7 @@ public:
// a named callback and reference it in XML.
void childSetCommitCallback(const std::string& id, boost::function<void (LLUICtrl*,void*)> cb, void* data = NULL);
void childSetValidate(const std::string& id, BOOL (*cb)(LLUICtrl*, void*) );
void childSetValidate(const std::string& id, boost::function<bool (const LLSD& data)> cb );
void childSetColor(const std::string& id, const LLColor4& color);
void childSetAlpha(const std::string& id, F32 alpha);

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -140,7 +140,6 @@ private:
std::vector<S32> mLineLengthList;
callback_t mClickedCallback;
void* mCallbackUserData;
};
#endif

View File

@@ -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);
}
}

View File

@@ -52,9 +52,6 @@ public:
typedef boost::function<bool (LLUICtrl* ctrl, const LLSD& param)> enable_callback_t;
typedef boost::signals2::signal<bool (LLUICtrl* ctrl, const LLSD& param), boost_boolean_combiner> 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<void (LLUICtrl*,void*)> cb, void* data);
boost::signals2::connection setValidateBeforeCommit( boost::function<bool (const LLSD& data)> 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:

View File

@@ -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

View File

@@ -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<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
return TRUE;
}

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -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<std::string, LLUUID> mIDList;
static S32 sUploadAmount;
//<edit>
void* mItem;
//</edit>

View File

@@ -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"
// <edit>
#include "llviewercontrol.h"
// </edit>
#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);
}
// <edit>
LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename, void* item) :
LLFloaterNameDesc(filename, item),
// </edit>
mAvatarPreview(NULL),
mSculptedPreview(NULL),
mLastMouseX(0),
@@ -101,7 +85,6 @@ LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename, void*
{
loadImage(mFilenameAndPath);
}
// </edit>
//-----------------------------------------------------------------------------
// 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);
// <edit>
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<LLUICtrl>("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<LLImageRaw> 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);

View File

@@ -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);
// <edit>
LLFloaterImagePreview(const std::string& filename, void* item);
LLFloaterImagePreview(const std::string& filename, void* item = NULL);
// </edit>
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<LLViewerTexture> mImagep ;
static S32 sUploadAmount;
};
#endif // LL_LLFLOATERIMAGEPREVIEW_H

View File

@@ -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")),
// <edit>
mItem = NULL;
mItem(item),
// </edit>
mFilenameAndPath = filename;
mFilename = gDirUtilp->getBaseFileName(filename, false);
// SL-5521 Maintain capitalization of filename when making the inventory item. JC
//LLStringUtil::toLower(mFilename);
mIsAudio = FALSE;
}
// <edit>
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);
}
// </edit>
//-----------------------------------------------------------------------------
// 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<LLUICtrl>("name_form")->setCommitCallback(boost::bind(&LLFloaterNameDesc::doCommit, this));
getChild<LLUICtrl>("name_form")->setValue(LLSD(asset_name));
LLLineEditor *NameEditor = getChild<LLLineEditor>("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<LLUICtrl>("description_form")->setCommitCallback(boost::bind(&LLFloaterNameDesc::doCommit, this));
LLLineEditor *DescEditor = getChild<LLLineEditor>("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<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnCancel, this));
getChild<LLUICtrl>("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<LLUICtrl>("name_form")->getValue().asString(),
getChild<LLUICtrl>("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<LLUICtrl>("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<LLUICtrl>("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<LLUICtrl>("ok_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnOK, this));
return TRUE;
}

View File

@@ -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);
// <edit>
LLFloaterNameDesc(const std::string& filename, void* item);
LLFloaterNameDesc(const LLSD& filename, void* item = NULL);
// </edit>
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;
// <edit>
void* mItem;
// </edit>
};
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

View File

@@ -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<LLSliderCtrl*>(*child_it) || dynamic_cast<LLCheckBoxCtrl*>(*child_it))
{
LLUICtrl *ctrl = dynamic_cast<LLUICtrl*>(*child_it);
ctrl->setCommitCallback(boost::bind(&LLFloaterPostProcess::onControlChanged, _1, (void*)ctrl->getName().c_str()));
LLUICtrl* ctrl = static_cast<LLUICtrl*>(*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<LLComboBox>("PPEffectsCombo");
childSetAction("PPLoadEffect", &LLFloaterPostProcess::onLoadEffect, comboBox);
comboBox->setCommitCallback(onChangeEffectName);
getChild<LLUICtrl>("PPLoadEffect")->setCommitCallback(boost::bind(&LLFloaterPostProcess::onLoadEffect, this, comboBox));
comboBox->setCommitCallback(boost::bind(&LLFloaterPostProcess::onChangeEffectName, this, _1));
LLLineEditor* editBox = getChild<LLLineEditor>("PPEffectNameEditor");
childSetAction("PPSaveEffect", &LLFloaterPostProcess::onSaveEffect, editBox);
getChild<LLUICtrl>("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<LLComboBox*>(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<LLLineEditor*>(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<LLComboBox*>(ctrl);
LLLineEditor* editBox = sPostProcess->getChild<LLLineEditor>("PPEffectNameEditor");
LLLineEditor* editBox = getChild<LLLineEditor>("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;
}

View File

@@ -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();

View File

@@ -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<LLLineEditor>("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;

View File

@@ -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<char>(":"));
boost_tokenizer tokens(getString("WLDefaultWaterNames"), boost::char_separator<char>(":"));
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, &param_mgr->mFogColor);
LLWaterParamManager& water_mgr = LLWaterParamManager::instance();
//
//childSetCommitCallback("WaterGlow", onColorControlAMoved, &param_mgr->mFogColor);
getChild<LLUICtrl>("WaterFogColor")->setCommitCallback(boost::bind(&LLFloaterWater::onWaterFogColorMoved, this, _1, &water_mgr.mFogColor));
//getChild<LLUICtrl>("WaterGlow")->setCommitCallback(boost::bind(&LLFloaterWater::onColorControlAMoved, this, _1, &water_mgr.mFogColor));
// fog density
childSetCommitCallback("WaterFogDensity", onExpFloatControlMoved, &param_mgr->mFogDensity);
childSetCommitCallback("WaterUnderWaterFogMod", onFloatControlMoved, &param_mgr->mUnderWaterFogMod);
getChild<LLUICtrl>("WaterFogDensity")->setCommitCallback(boost::bind(&LLFloaterWater::onExpFloatControlMoved, this, _1, &water_mgr.mFogDensity));
getChild<LLUICtrl>("WaterUnderWaterFogMod")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &water_mgr.mUnderWaterFogMod));
// blue density
childSetCommitCallback("WaterNormalScaleX", onVector3ControlXMoved, &param_mgr->mNormalScale);
childSetCommitCallback("WaterNormalScaleY", onVector3ControlYMoved, &param_mgr->mNormalScale);
childSetCommitCallback("WaterNormalScaleZ", onVector3ControlZMoved, &param_mgr->mNormalScale);
getChild<LLUICtrl>("WaterNormalScaleX")->setCommitCallback(boost::bind(&LLFloaterWater::onVector3ControlXMoved, this, _1, &water_mgr.mNormalScale));
getChild<LLUICtrl>("WaterNormalScaleY")->setCommitCallback(boost::bind(&LLFloaterWater::onVector3ControlYMoved, this, _1, &water_mgr.mNormalScale));
getChild<LLUICtrl>("WaterNormalScaleZ")->setCommitCallback(boost::bind(&LLFloaterWater::onVector3ControlZMoved, this, _1, &water_mgr.mNormalScale));
// fresnel
childSetCommitCallback("WaterFresnelScale", onFloatControlMoved, &param_mgr->mFresnelScale);
childSetCommitCallback("WaterFresnelOffset", onFloatControlMoved, &param_mgr->mFresnelOffset);
getChild<LLUICtrl>("WaterFresnelScale")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &water_mgr.mFresnelScale));
getChild<LLUICtrl>("WaterFresnelOffset")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &water_mgr.mFresnelOffset));
// scale above/below
childSetCommitCallback("WaterScaleAbove", onFloatControlMoved, &param_mgr->mScaleAbove);
childSetCommitCallback("WaterScaleBelow", onFloatControlMoved, &param_mgr->mScaleBelow);
getChild<LLUICtrl>("WaterScaleAbove")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &water_mgr.mScaleAbove));
getChild<LLUICtrl>("WaterScaleBelow")->setCommitCallback(boost::bind(&LLFloaterWater::onFloatControlMoved, this, _1, &water_mgr.mScaleBelow));
// blur mult
childSetCommitCallback("WaterBlurMult", onFloatControlMoved, &param_mgr->mBlurMultiplier);
getChild<LLUICtrl>("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<LLUICtrl>("WaterLoadPreset")->setCommitCallback(boost::bind(&LLFloaterWater::onLoadPreset, this, mWaterPresetCombo));
getChild<LLUICtrl>("WaterNewPreset")->setCommitCallback(boost::bind(&LLFloaterWater::onNewPreset, this));
getChild<LLUICtrl>("WaterDeletePreset")->setCommitCallback(boost::bind(&LLFloaterWater::onDeletePreset, this));
getChild<LLUICtrl>("WaterSavePreset")->setCommitCallback(boost::bind(&LLFloaterWater::onSavePreset, this, _1));
// wave direction
childSetCommitCallback("WaterWave1DirX", onVector2ControlXMoved, &param_mgr->mWave1Dir);
childSetCommitCallback("WaterWave1DirY", onVector2ControlYMoved, &param_mgr->mWave1Dir);
childSetCommitCallback("WaterWave2DirX", onVector2ControlXMoved, &param_mgr->mWave2Dir);
childSetCommitCallback("WaterWave2DirY", onVector2ControlYMoved, &param_mgr->mWave2Dir);
getChild<LLUICtrl>("WaterWave1DirX")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlXMoved, this, _1, &water_mgr.mWave1Dir));
getChild<LLUICtrl>("WaterWave1DirY")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlYMoved, this, _1, &water_mgr.mWave1Dir));
getChild<LLUICtrl>("WaterWave2DirX")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlXMoved, this, _1, &water_mgr.mWave2Dir));
getChild<LLUICtrl>("WaterWave2DirY")->setCommitCallback(boost::bind(&LLFloaterWater::onVector2ControlYMoved, this, _1, &water_mgr.mWave2Dir));
LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("WaterNormalMap");
textCtrl->setDefaultImageAssetID(DEFAULT_WATER_NORMAL);
childSetCommitCallback("WaterNormalMap", onNormalMapPicked, NULL);
LLTextureCtrl* texture_ctrl = getChild<LLTextureCtrl>("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<LLUICtrl>("next")->setCommitCallback(boost::bind(&LLFloaterWater::onClickNext, this));
//getChild<LLUICtrl>("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<LLUICtrl>("WaterGlow")->setValue(col.mV[3]);
col.mV[3] = 1.0f;
LLColorSwatchCtrl* colCtrl = sWaterMenu->getChild<LLColorSwatchCtrl>("WaterFogColor");
colCtrl->set(col);
getChild<LLColorSwatchCtrl>("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<LLUICtrl>("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<LLUICtrl>("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<LLUICtrl>("WaterNormalScaleX")->setValue(water_mgr.mNormalScale.mX);
getChild<LLUICtrl>("WaterNormalScaleY")->setValue(water_mgr.mNormalScale.mY);
getChild<LLUICtrl>("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<LLUICtrl>("WaterFresnelScale")->setValue(water_mgr.mFresnelScale.mX);
water_mgr.mFresnelOffset.mX = current_params.getFloat(water_mgr.mFresnelOffset.mName, err);
getChild<LLUICtrl>("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<LLUICtrl>("WaterScaleAbove")->setValue(water_mgr.mScaleAbove.mX);
water_mgr.mScaleBelow.mX = current_params.getFloat(water_mgr.mScaleBelow.mName, err);
getChild<LLUICtrl>("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<LLUICtrl>("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<LLUICtrl>("WaterWave1DirX")->setValue(water_mgr.mWave1Dir.mX);
getChild<LLUICtrl>("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<LLUICtrl>("WaterWave2DirX")->setValue(water_mgr.mWave2Dir.mX);
getChild<LLUICtrl>("WaterWave2DirY")->setValue(water_mgr.mWave2Dir.mY);
LLTextureCtrl* textCtrl = sWaterMenu->getChild<LLTextureCtrl>("WaterNormalMap");
textCtrl->setImageAssetID(param_mgr->getNormalMapID());
LLTextureCtrl* textCtrl = getChild<LLTextureCtrl>("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<LLSliderCtrl*>(ctrl);
WaterVector3Control * vectorControl = static_cast<WaterVector3Control *>(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<LLSliderCtrl*>(ctrl);
WaterVector3Control * vectorControl = static_cast<WaterVector3Control *>(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<LLSliderCtrl*>(ctrl);
WaterVector3Control * vectorControl = static_cast<WaterVector3Control *>(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<LLSliderCtrl*>(ctrl);
WaterVector2Control * vectorControl = static_cast<WaterVector2Control *>(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<LLSliderCtrl*>(ctrl);
WaterVector2Control * vectorControl = static_cast<WaterVector2Control *>(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<LLSliderCtrl*>(ctrl);
WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(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<LLUICtrl>(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<LLSliderCtrl*>(ctrl);
WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(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<LLUICtrl>(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<LLSliderCtrl*>(ctrl);
WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(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<LLUICtrl>(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<LLSliderCtrl*>(ctrl);
WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(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<LLSliderCtrl*>(ctrl);
WaterColorControl * colorControl = static_cast<WaterColorControl *>(userData);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(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<LLUICtrl>(rName)->setValue(color_ctrl->mR);
getChild<LLUICtrl>(gName)->setValue(color_ctrl->mG);
getChild<LLUICtrl>(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<LLSliderCtrl*>(ctrl);
WaterExpFloatControl * expFloatControl = static_cast<WaterExpFloatControl *>(userData);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(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<LLSliderCtrl*>(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<LLSliderCtrl*>(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<LLSliderCtrl*>(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<LLSliderCtrl*>(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<LLSliderCtrl*>(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<LLSliderCtrl*>(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<LLSliderCtrl*>(ctrl);
WaterFloatControl * floatControl = static_cast<WaterFloatControl *>(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<LLColorSwatchCtrl*>(ctrl);
WaterColorControl * colorControl = static_cast<WaterColorControl *>(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<LLCheckBoxCtrl*>(ctrl);
bool value = cbCtrl->get();
(*(static_cast<BOOL *>(userData))) = value;
}
void LLFloaterWater::onNormalMapPicked(LLUICtrl* ctrl, void* userData)
void LLFloaterWater::onNormalMapPicked(LLUICtrl* ctrl)
{
LLTextureCtrl* textCtrl = static_cast<LLTextureCtrl*>(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<std::string>::iterator sIt = sDefaultPresets.find(
sWaterMenu->mWaterPresetCombo->getSelectedItemLabel());
std::set<std::string>::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<LLComboBox>("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<std::string>::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<LLComboBox*>(ctrl);
LLComboBox* combo_box = static_cast<LLComboBox*>(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()

View File

@@ -39,15 +39,16 @@
#include "llfloater.h"
#include <vector>
#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<std::string> sDefaultPresets;
static void onClickNext(void* user_data);
static void onClickPrev(void* user_data);
void onClickNext();
void onClickPrev();
void populateWaterPresetsList();

View File

@@ -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<std::string> LLFloaterWindLight::sDefaultPresets;
@@ -79,18 +63,16 @@ LLFloaterWindLight::LLFloaterWindLight() : LLFloater(std::string("windlight floa
// add the combo boxes
mSkyPresetCombo = getChild<LLComboBox>("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<char>(":"));
boost_tokenizer tokens(getString("WLDefaultSkyNames"), boost::char_separator<char>(":"));
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, &param_mgr->mBlueHorizon);
childSetCommitCallback("WLBlueHorizonG", onColorControlGMoved, &param_mgr->mBlueHorizon);
childSetCommitCallback("WLBlueHorizonB", onColorControlBMoved, &param_mgr->mBlueHorizon);
childSetCommitCallback("WLBlueHorizonI", onColorControlIMoved, &param_mgr->mBlueHorizon);
getChild<LLUICtrl>("WLBlueHorizonR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr.mBlueHorizon));
getChild<LLUICtrl>("WLBlueHorizonG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, &param_mgr.mBlueHorizon));
getChild<LLUICtrl>("WLBlueHorizonB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, &param_mgr.mBlueHorizon));
getChild<LLUICtrl>("WLBlueHorizonI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, &param_mgr.mBlueHorizon));
// haze density, horizon, mult, and altitude
childSetCommitCallback("WLHazeDensity", onFloatControlMoved, &param_mgr->mHazeDensity);
childSetCommitCallback("WLHazeHorizon", onFloatControlMoved, &param_mgr->mHazeHorizon);
childSetCommitCallback("WLDensityMult", onFloatControlMoved, &param_mgr->mDensityMult);
childSetCommitCallback("WLMaxAltitude", onFloatControlMoved, &param_mgr->mMaxAlt);
getChild<LLUICtrl>("WLHazeDensity")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, &param_mgr.mHazeDensity));
getChild<LLUICtrl>("WLHazeHorizon")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, &param_mgr.mHazeHorizon));
getChild<LLUICtrl>("WLDensityMult")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, &param_mgr.mDensityMult));
getChild<LLUICtrl>("WLMaxAltitude")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, &param_mgr.mMaxAlt));
// blue density
childSetCommitCallback("WLBlueDensityR", onColorControlRMoved, &param_mgr->mBlueDensity);
childSetCommitCallback("WLBlueDensityG", onColorControlGMoved, &param_mgr->mBlueDensity);
childSetCommitCallback("WLBlueDensityB", onColorControlBMoved, &param_mgr->mBlueDensity);
childSetCommitCallback("WLBlueDensityI", onColorControlIMoved, &param_mgr->mBlueDensity);
getChild<LLUICtrl>("WLBlueDensityR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr.mBlueDensity));
getChild<LLUICtrl>("WLBlueDensityG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, &param_mgr.mBlueDensity));
getChild<LLUICtrl>("WLBlueDensityB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, &param_mgr.mBlueDensity));
getChild<LLUICtrl>("WLBlueDensityI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, &param_mgr.mBlueDensity));
// Lighting
// sunlight
childSetCommitCallback("WLSunlightR", onColorControlRMoved, &param_mgr->mSunlight);
childSetCommitCallback("WLSunlightG", onColorControlGMoved, &param_mgr->mSunlight);
childSetCommitCallback("WLSunlightB", onColorControlBMoved, &param_mgr->mSunlight);
childSetCommitCallback("WLSunlightI", onColorControlIMoved, &param_mgr->mSunlight);
getChild<LLUICtrl>("WLSunlightR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr.mSunlight));
getChild<LLUICtrl>("WLSunlightG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, &param_mgr.mSunlight));
getChild<LLUICtrl>("WLSunlightB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, &param_mgr.mSunlight));
getChild<LLUICtrl>("WLSunlightI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, &param_mgr.mSunlight));
// glow
childSetCommitCallback("WLGlowR", onGlowRMoved, &param_mgr->mGlow);
childSetCommitCallback("WLGlowB", onGlowBMoved, &param_mgr->mGlow);
getChild<LLUICtrl>("WLGlowR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onGlowRMoved, this, _1, &param_mgr.mGlow));
getChild<LLUICtrl>("WLGlowB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onGlowBMoved, this, _1, &param_mgr.mGlow));
// ambient
childSetCommitCallback("WLAmbientR", onColorControlRMoved, &param_mgr->mAmbient);
childSetCommitCallback("WLAmbientG", onColorControlGMoved, &param_mgr->mAmbient);
childSetCommitCallback("WLAmbientB", onColorControlBMoved, &param_mgr->mAmbient);
childSetCommitCallback("WLAmbientI", onColorControlIMoved, &param_mgr->mAmbient);
getChild<LLUICtrl>("WLAmbientR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr.mAmbient));
getChild<LLUICtrl>("WLAmbientG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, &param_mgr.mAmbient));
getChild<LLUICtrl>("WLAmbientB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, &param_mgr.mAmbient));
getChild<LLUICtrl>("WLAmbientI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, &param_mgr.mAmbient));
// time of day
childSetCommitCallback("WLSunAngle", onSunMoved, &param_mgr->mLightnorm);
childSetCommitCallback("WLEastAngle", onSunMoved, &param_mgr->mLightnorm);
getChild<LLUICtrl>("WLSunAngle")->setCommitCallback(boost::bind(&LLFloaterWindLight::onSunMoved, this, _1, &param_mgr.mLightnorm));
getChild<LLUICtrl>("WLEastAngle")->setCommitCallback(boost::bind(&LLFloaterWindLight::onSunMoved, this, _1, &param_mgr.mLightnorm));
// Clouds
// Cloud Color
childSetCommitCallback("WLCloudColorR", onColorControlRMoved, &param_mgr->mCloudColor);
childSetCommitCallback("WLCloudColorG", onColorControlGMoved, &param_mgr->mCloudColor);
childSetCommitCallback("WLCloudColorB", onColorControlBMoved, &param_mgr->mCloudColor);
childSetCommitCallback("WLCloudColorI", onColorControlIMoved, &param_mgr->mCloudColor);
getChild<LLUICtrl>("WLCloudColorR")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr.mCloudColor));
getChild<LLUICtrl>("WLCloudColorG")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, &param_mgr.mCloudColor));
getChild<LLUICtrl>("WLCloudColorB")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, &param_mgr.mCloudColor));
getChild<LLUICtrl>("WLCloudColorI")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlIMoved, this, _1, &param_mgr.mCloudColor));
// Cloud
childSetCommitCallback("WLCloudX", onColorControlRMoved, &param_mgr->mCloudMain);
childSetCommitCallback("WLCloudY", onColorControlGMoved, &param_mgr->mCloudMain);
childSetCommitCallback("WLCloudDensity", onColorControlBMoved, &param_mgr->mCloudMain);
getChild<LLUICtrl>("WLCloudX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr.mCloudMain));
getChild<LLUICtrl>("WLCloudY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, &param_mgr.mCloudMain));
getChild<LLUICtrl>("WLCloudDensity")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, &param_mgr.mCloudMain));
// Cloud Detail
childSetCommitCallback("WLCloudDetailX", onColorControlRMoved, &param_mgr->mCloudDetail);
childSetCommitCallback("WLCloudDetailY", onColorControlGMoved, &param_mgr->mCloudDetail);
childSetCommitCallback("WLCloudDetailDensity", onColorControlBMoved, &param_mgr->mCloudDetail);
getChild<LLUICtrl>("WLCloudDetailX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlRMoved, this, _1, &param_mgr.mCloudDetail));
getChild<LLUICtrl>("WLCloudDetailY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlGMoved, this, _1, &param_mgr.mCloudDetail));
getChild<LLUICtrl>("WLCloudDetailDensity")->setCommitCallback(boost::bind(&LLFloaterWindLight::onColorControlBMoved, this, _1, &param_mgr.mCloudDetail));
// Cloud extras
childSetCommitCallback("WLCloudCoverage", onFloatControlMoved, &param_mgr->mCloudCoverage);
childSetCommitCallback("WLCloudScale", onFloatControlMoved, &param_mgr->mCloudScale);
childSetCommitCallback("WLCloudLockX", onCloudScrollXToggled, NULL);
childSetCommitCallback("WLCloudLockY", onCloudScrollYToggled, NULL);
childSetCommitCallback("WLCloudScrollX", onCloudScrollXMoved, NULL);
childSetCommitCallback("WLCloudScrollY", onCloudScrollYMoved, NULL);
childSetCommitCallback("WLDistanceMult", onFloatControlMoved, &param_mgr->mDistanceMult);
childSetCommitCallback("DrawClassicClouds", onCommitControlSetting(gSavedSettings), (void*)"SkyUseClassicClouds");
getChild<LLUICtrl>("WLCloudCoverage")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, &param_mgr.mCloudCoverage));
getChild<LLUICtrl>("WLCloudScale")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, &param_mgr.mCloudScale));
getChild<LLUICtrl>("WLCloudLockX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollXToggled, this, _2));
getChild<LLUICtrl>("WLCloudLockY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollYToggled, this, _2));
getChild<LLUICtrl>("WLCloudScrollX")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollXMoved, this, _2));
getChild<LLUICtrl>("WLCloudScrollY")->setCommitCallback(boost::bind(&LLFloaterWindLight::onCloudScrollYMoved, this, _2));
getChild<LLUICtrl>("WLDistanceMult")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, &param_mgr.mDistanceMult));
// WL Top
childSetAction("WLDayCycleMenuButton", onOpenDayCycle, NULL);
getChild<LLUICtrl>("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<LLUICtrl>("WLLoadPreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onLoadPreset, this, mSkyPresetCombo));
getChild<LLUICtrl>("WLNewPreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onNewPreset, this));
getChild<LLUICtrl>("WLDeletePreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onDeletePreset, this));
getChild<LLUICtrl>("WLSavePreset")->setCommitCallback(boost::bind(&LLFloaterWindLight::onSavePreset, this, _1));
// Dome
childSetCommitCallback("WLGamma", onFloatControlMoved, &param_mgr->mWLGamma);
childSetCommitCallback("WLStarAlpha", onStarAlphaMoved, NULL);
getChild<LLUICtrl>("WLGamma")->setCommitCallback(boost::bind(&LLFloaterWindLight::onFloatControlMoved, this, _1, &param_mgr.mWLGamma));
getChild<LLUICtrl>("WLStarAlpha")->setCommitCallback(boost::bind(&LLFloaterWindLight::onStarAlphaMoved, this, _1));
// next/prev buttons
//childSetAction("next", onClickNext, this);
//childSetAction("prev", onClickPrev, this);
//getChild<LLUICtrl>("next")->setCommitCallback(boost::bind(&LLFloaterWindLight::onClickNext, this));
//getChild<LLUICtrl>("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<LLComboBox>(
"WLKeyPresets");
keyCombo = sDayCycle->getChild<LLComboBox>("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<LLSliderCtrl*>(ctrl);
WLColorControl * color_ctrl = static_cast<WLColorControl *>(userData);
WLColorControl* color_ctrl = static_cast<WLColorControl *>(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<LLCheckBoxCtrl*>(ctrl);
bool value = cbCtrl->get();
(*(static_cast<BOOL *>(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<LLSliderCtrl>("WLSunAngle");
LLSliderCtrl* eastSldr = sWindLight->getChild<LLSliderCtrl>("WLEastAngle");
WLColorControl * color_ctrl = static_cast<WLColorControl *>(userData);
LLSliderCtrl* sun_sldr = getChild<LLSliderCtrl>("WLSunAngle");
LLSliderCtrl* east_sldr = getChild<LLSliderCtrl>("WLEastAngle");
WLColorControl* color_ctrl = static_cast<WLColorControl *>(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<LLSliderCtrl*>(ctrl);
F32 * tweak = static_cast<F32 *>(userData);
LLSliderCtrl* sldr_ctrl = static_cast<LLSliderCtrl*>(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<LLSliderCtrl*>(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<LLUICtrl>("WLCloudScrollX")->setEnabled(!lock);
}
void LLFloaterWindLight::onCloudScrollYToggled(const LLSD& value)
{
LLWLParamManager::getInstance()->mAnimator.deactivate();
bool lock = value.asBoolean();
LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollY(!lock);
getChild<LLUICtrl>("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<std::string>::iterator sIt = sDefaultPresets.find(
sWindLight->mSkyPresetCombo->getSelectedItemLabel());
std::set<std::string>::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<LLComboBox>("WLKeyPresets");
@@ -888,7 +876,7 @@ bool LLFloaterWindLight::deleteAlertCallback(const LLSD& notification, const LLS
std::set<std::string>::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<LLComboBox*>(ctrl);
LLComboBox* combo_box = static_cast<LLComboBox*>(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<LLSliderCtrl*>(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<LLSliderCtrl*>(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<LLCheckBoxCtrl*>(ctrl);
bool lock = cb_ctrl->get();
LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollX(!lock);
LLSliderCtrl* sldr = sWindLight->getChild<LLSliderCtrl>("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<LLCheckBoxCtrl*>(ctrl);
bool lock = cb_ctrl->get();
LLWLParamManager::getInstance()->mCurParams.setEnableCloudScrollY(!lock);
LLSliderCtrl* sldr = sWindLight->getChild<LLSliderCtrl>("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

View File

@@ -39,9 +39,6 @@
#include "llfloater.h"
#include <vector>
#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<std::string> sDefaultPresets;
static void onClickNext(void* user_data);
static void onClickPrev(void* user_data);
void onClickNext();
void onClickPrev();
void populateSkyPresetsList();
LLComboBox* mSkyPresetCombo;
};

View File

@@ -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<LLSliderCtrl*>(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<LLSliderCtrl>("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());

View File

@@ -88,8 +88,7 @@ BOOL LLPanelLandMedia::postBuild()
{
mMediaTextureCtrl = getChild<LLTextureCtrl>("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);

View File

@@ -239,7 +239,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
reshape(rect.getWidth(), rect.getHeight());
LLComboBox* name_combo = sInstance->getChild<LLComboBox>("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);

View File

@@ -209,7 +209,7 @@ BOOL LLInventoryView::postBuild()
if (mQuickFilterCombo)
{
mQuickFilterCombo->setCommitCallback(onQuickFilterCommit);
mQuickFilterCombo->setCommitCallback(boost::bind(LLInventoryView::onQuickFilterCommit, _1, this));
}

View File

@@ -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<LLComboBox>("custom_skin_combo")->setCommitCallback(onComboBoxCommit);
getChild<LLComboBox>("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;
}
}
}
}

View File

@@ -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;
};

View File

@@ -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<LLLineEditor>("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)

View File

@@ -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<LLEvent> 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<LLEvent> 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");

View File

@@ -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);

View File

@@ -58,7 +58,7 @@
<button
follows="left|bottom"
height="22"
label="Upload ([AMOUNT])"
label="Upload ([UPLOADFEE])"
layout="topleft"
left="45"
name="ok_btn"

View File

@@ -579,7 +579,7 @@
initial_val="0.5" label="" left="494" max_val="10" min_val="-10"
mouse_opaque="true" name="WLCloudScrollY" show_text="true" value="0.0"
width="200" />
<check_box bottom="-120" control_name="DrawClassicClouds" follows="left"
<check_box bottom="-120" control_name="SkyUseClassicClouds" follows="left"
font="SansSerifSmall" height="16" initial_value="false"
label="Draw Classic Clouds" left="480" mouse_opaque="true"
name="DrawClassicClouds" width="200" />

View File

@@ -150,16 +150,16 @@ BOOL wlfPanel_AdvSettings::postBuild()
if (mExpanded)
{
getChild<LLCheckBoxCtrl>("use_estate_wl")->setCommitCallback(onUseRegionSettings);
getChild<LLCheckBoxCtrl>("use_estate_wl")->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onUseRegionSettings, this, _2));
mWaterPresetCombo = getChild<LLComboBox>("WLWaterPresetsCombo");
mWaterPresetCombo->setCommitCallback(onChangeWWPresetName);
mWaterPresetCombo->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onChangeWWPresetName, this, _2));
mSkyPresetCombo = getChild<LLComboBox>("WLSkyPresetsCombo");
mSkyPresetCombo->setCommitCallback(onChangeWLPresetName);
mSkyPresetCombo->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onChangeWLPresetName, this, _2));
// mDayCyclePresetCombo = getChild<LLComboBox>("DCPresetsCombo");
// mDayCyclePresetCombo->setCommitCallback(onChangeDCPresetName);
// mDayCyclePresetCombo->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onChangeDCPresetName, this, _2));
LLEnvManagerNew::instance().setPreferencesChangeCallback(boost::bind(&wlfPanel_AdvSettings::refreshLists, this));
LLWaterParamManager::getInstance()->setPresetListChangeCallback(boost::bind(&wlfPanel_AdvSettings::populateWaterPresetsList, this));
@@ -171,16 +171,16 @@ BOOL wlfPanel_AdvSettings::postBuild()
//populateDayCyclePresetsList();
// next/prev buttons
childSetAction("WWnext", onClickWWNext, this);
childSetAction("WWprev", onClickWWPrev, this);
childSetAction("WLnext", onClickWLNext, this);
childSetAction("WLprev", onClickWLPrev, this);
getChild<LLUICtrl>("WWnext")->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onClickWWNext, this));
getChild<LLUICtrl>("WWprev")->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onClickWWPrev, this));
getChild<LLUICtrl>("WLnext")->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onClickWLNext, this));
getChild<LLUICtrl>("WLprev")->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onClickWLPrev, this));
childSetAction("EnvAdvancedSkyButton", onOpenAdvancedSky, NULL);
childSetAction("EnvAdvancedWaterButton", onOpenAdvancedWater, NULL);
getChild<LLUICtrl>("EnvAdvancedSkyButton")->setCommitCallback(boost::bind(LLFloaterWindLight::show));
getChild<LLUICtrl>("EnvAdvancedWaterButton")->setCommitCallback(boost::bind(LLFloaterWater::show));
mTimeSlider = getChild<LLSliderCtrl>("EnvTimeSlider");
mTimeSlider->setCommitCallback(onChangeDayTime);
mTimeSlider->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onChangeDayTime, this, _2));
updateTimeSlider();
updateRlvVisibility();
}
@@ -202,21 +202,15 @@ void wlfPanel_AdvSettings::onClickExpandBtn(void* user_data)
gSavedSettings.setBOOL("wlfAdvSettingsPopup",!gSavedSettings.getBOOL("wlfAdvSettingsPopup"));
}
void wlfPanel_AdvSettings::onUseRegionSettings(LLUICtrl* ctrl, void* userdata)
void wlfPanel_AdvSettings::onUseRegionSettings(const LLSD& value)
{
LLEnvManagerNew::instance().setUseRegionSettings(gSavedSettings.getBOOL("UseEnvironmentFromRegion"), gSavedSettings.getBOOL("PhoenixInterpolateSky"));
LLEnvManagerNew::instance().setUseRegionSettings(value.asBoolean(), gSavedSettings.getBOOL("PhoenixInterpolateSky"));
}
void wlfPanel_AdvSettings::onChangeWWPresetName(LLUICtrl* ctrl, void * userData)
void wlfPanel_AdvSettings::onChangeWWPresetName(const LLSD& value)
{
LLComboBox * combo_box = static_cast<LLComboBox*>(ctrl);
if(combo_box->getSimple() == "")
{
return;
}
const std::string& wwset = combo_box->getSelectedValue().asString();
const std::string& wwset = value.asString();
if (wwset.empty()) return;
if (LLWaterParamManager::getInstance()->hasParamSet(wwset))
{
LLEnvManagerNew::instance().setUseWaterPreset(wwset, gSavedSettings.getBOOL("PhoenixInterpolateWater"));
@@ -229,19 +223,14 @@ void wlfPanel_AdvSettings::onChangeWWPresetName(LLUICtrl* ctrl, void * userData)
}
}
void wlfPanel_AdvSettings::onChangeWLPresetName(LLUICtrl* ctrl, void * userData)
void wlfPanel_AdvSettings::onChangeWLPresetName(const LLSD& value)
{
LLComboBox * combo_box = static_cast<LLComboBox*>(ctrl);
if(combo_box->getSimple() == "")
{
return;
}
const LLWLParamKey key(combo_box->getSelectedValue().asString(), LLEnvKey::SCOPE_LOCAL);
const std::string& wlset = value.asString();
if (wlset.empty()) return;
const LLWLParamKey key(wlset, LLEnvKey::SCOPE_LOCAL);
if (LLWLParamManager::getInstance()->hasParamSet(key))
{
LLEnvManagerNew::instance().setUseSkyPreset(key.name, gSavedSettings.getBOOL("PhoenixInterpolateSky"));
LLEnvManagerNew::instance().setUseSkyPreset(wlset, gSavedSettings.getBOOL("PhoenixInterpolateSky"));
}
else
{
@@ -251,86 +240,63 @@ void wlfPanel_AdvSettings::onChangeWLPresetName(LLUICtrl* ctrl, void * userData)
}
}
void wlfPanel_AdvSettings::onClickWWNext(void* user_data)
void wlfPanel_AdvSettings::onClickWWNext()
{
wlfPanel_AdvSettings* self = (wlfPanel_AdvSettings*) user_data;
S32 index = self->mWaterPresetCombo->getCurrentIndex();
index++;
if (index == self->mWaterPresetCombo->getItemCount())
S32 index = mWaterPresetCombo->getCurrentIndex();
++index;
if (index == mWaterPresetCombo->getItemCount())
index = 0;
self->mWaterPresetCombo->setCurrentByIndex(index);
mWaterPresetCombo->setCurrentByIndex(index);
wlfPanel_AdvSettings::onChangeWWPresetName(self->mWaterPresetCombo, self);
wlfPanel_AdvSettings::onChangeWWPresetName(mWaterPresetCombo->getSelectedValue());
}
void wlfPanel_AdvSettings::onClickWWPrev(void* user_data)
void wlfPanel_AdvSettings::onClickWWPrev()
{
wlfPanel_AdvSettings* self = (wlfPanel_AdvSettings*) user_data;
S32 index = self->mWaterPresetCombo->getCurrentIndex();
S32 index = mWaterPresetCombo->getCurrentIndex();
if (index == 0)
index = self->mWaterPresetCombo->getItemCount();
index--;
self->mWaterPresetCombo->setCurrentByIndex(index);
index = mWaterPresetCombo->getItemCount();
--index;
mWaterPresetCombo->setCurrentByIndex(index);
wlfPanel_AdvSettings::onChangeWWPresetName(self->mWaterPresetCombo, self);
wlfPanel_AdvSettings::onChangeWWPresetName(mWaterPresetCombo->getSelectedValue());
}
void wlfPanel_AdvSettings::onClickWLNext(void* user_data)
void wlfPanel_AdvSettings::onClickWLNext()
{
wlfPanel_AdvSettings* self = (wlfPanel_AdvSettings*) user_data;
S32 index = self->mSkyPresetCombo->getCurrentIndex();
index++;
if (index == self->mSkyPresetCombo->getItemCount())
S32 index = mSkyPresetCombo->getCurrentIndex();
++index;
if (index == mSkyPresetCombo->getItemCount())
index = 0;
self->mSkyPresetCombo->setCurrentByIndex(index);
mSkyPresetCombo->setCurrentByIndex(index);
wlfPanel_AdvSettings::onChangeWLPresetName(self->mSkyPresetCombo, self);
wlfPanel_AdvSettings::onChangeWLPresetName(mSkyPresetCombo->getSelectedValue());
}
void wlfPanel_AdvSettings::onClickWLPrev(void* user_data)
void wlfPanel_AdvSettings::onClickWLPrev()
{
wlfPanel_AdvSettings* self = (wlfPanel_AdvSettings*) user_data;
S32 index = self->mSkyPresetCombo->getCurrentIndex();
S32 index = mSkyPresetCombo->getCurrentIndex();
if (index == 0)
index = self->mSkyPresetCombo->getItemCount();
index--;
self->mSkyPresetCombo->setCurrentByIndex(index);
index = mSkyPresetCombo->getItemCount();
--index;
mSkyPresetCombo->setCurrentByIndex(index);
wlfPanel_AdvSettings::onChangeWLPresetName(self->mSkyPresetCombo, self);
wlfPanel_AdvSettings::onChangeWLPresetName(mSkyPresetCombo->getSelectedValue());
}
void wlfPanel_AdvSettings::onOpenAdvancedSky(void* userData)
void wlfPanel_AdvSettings::onChangeDayTime(const LLSD& value)
{
LLFloaterWindLight::show();
}
// deactivate animator
LLWLParamManager::getInstance()->mAnimator.deactivate();
void wlfPanel_AdvSettings::onOpenAdvancedWater(void* userData)
{
LLFloaterWater::show();
}
void wlfPanel_AdvSettings::onChangeDayTime(LLUICtrl* ctrl, void* userData)
{
LLSliderCtrl* sldr = static_cast<LLSliderCtrl*>(ctrl);
if (sldr) {
// deactivate animator
LLWLParamManager::getInstance()->mAnimator.deactivate();
F32 val = sldr->getValueF32() + 0.25f;
if(val > 1.0)
{
val--;
}
LLWLParamManager::getInstance()->mAnimator.setDayTime((F64)val);
LLWLParamManager::getInstance()->mAnimator.update(
LLWLParamManager::getInstance()->mCurParams);
F32 val = value.asFloat() + 0.25f;
if(val > 1.0)
{
val--;
}
LLWLParamManager::getInstance()->mAnimator.setDayTime((F64)val);
LLWLParamManager::getInstance()->mAnimator.update(LLWLParamManager::getInstance()->mCurParams);
}
void wlfPanel_AdvSettings::populateWaterPresetsList()

View File

@@ -57,20 +57,18 @@ public:
static void updateClass();
static void onClickExpandBtn(void* user_data);
static void onChangeWWPresetName(LLUICtrl* ctrl, void* userData);
static void onChangeWLPresetName(LLUICtrl* ctrl, void* userData);
void onChangeWWPresetName(const LLSD& value);
void onChangeWLPresetName(const LLSD& value);
protected:
void build();
static void onUseRegionSettings(LLUICtrl* ctrl, void* userdata);
static void onClickWWNext(void* user_data);
static void onClickWWPrev(void* user_data);
static void onClickWLNext(void* user_data);
static void onClickWLPrev(void* user_data);
static void onOpenAdvancedSky(void* userData);
static void onOpenAdvancedWater(void* userData);
static void onChangeDayTime(LLUICtrl* ctrl, void* userData);
void onUseRegionSettings(const LLSD& value);
void onClickWWNext();
void onClickWWPrev();
void onClickWLNext();
void onClickWLPrev();
void onChangeDayTime(const LLSD& value);
void refreshLists(); /// update controls with user prefs