Clean up and simplify wlf panel code

This commit is contained in:
Lirusaito
2019-02-25 08:05:37 -05:00
parent 7071ac29e8
commit e0b9f23dad
2 changed files with 21 additions and 59 deletions

View File

@@ -34,15 +34,11 @@
#include "wlfPanel_AdvSettings.h"
#include "llbutton.h"
#include "lluictrlfactory.h"
#include "llviewercontrol.h"
#include "lliconctrl.h"
#include "lloverlaybar.h"
#include "lltextbox.h"
#include "llcombobox.h"
#include "llsliderctrl.h"
#include "llcheckboxctrl.h"
#include "llstartup.h"
#include "llcombobox.h"
#include "llpostprocess.h"
#include "llsliderctrl.h"
#include "lluictrlfactory.h"
#include "llfloaterwindlight.h"
#include "llfloaterwater.h"
@@ -57,6 +53,10 @@
#include "llwlparamset.h"
#include "llwlparammanager.h"
// [RLVa:KB]
#include "rlvhandler.h"
// [/RLVa:KB]
// Hover funcs
void syncFromPreferenceSetting(LLSliderCtrl* sldrCtrl);
void onHoverSliderMoved(const LLSD& val);
@@ -171,10 +171,10 @@ BOOL wlfPanel_AdvSettings::postBuild()
//populateDayCyclePresetsList();
// next/prev buttons
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));
getChild<LLUICtrl>("WWnext")->setCommitCallback(boost::bind(wlfPanel_AdvSettings::onClickArrow, mWaterPresetCombo, true));
getChild<LLUICtrl>("WWprev")->setCommitCallback(boost::bind(wlfPanel_AdvSettings::onClickArrow, mWaterPresetCombo, false));
getChild<LLUICtrl>("WLnext")->setCommitCallback(boost::bind(wlfPanel_AdvSettings::onClickArrow, mSkyPresetCombo, true));
getChild<LLUICtrl>("WLprev")->setCommitCallback(boost::bind(wlfPanel_AdvSettings::onClickArrow, mSkyPresetCombo, false));
getChild<LLUICtrl>("EnvAdvancedSkyButton")->setCommitCallback(boost::bind(LLFloaterWindLight::show));
getChild<LLUICtrl>("EnvAdvancedWaterButton")->setCommitCallback(boost::bind(LLFloaterWater::show));
@@ -224,7 +224,7 @@ BOOL wlfPanel_AdvSettings::postBuild()
}
else
{
mHoverHeight = NULL;
mHoverHeight = nullptr;
}
return TRUE;
}
@@ -301,48 +301,13 @@ void wlfPanel_AdvSettings::onChangeWLPresetName(const LLSD& value)
}
}
void wlfPanel_AdvSettings::onClickWWNext()
void wlfPanel_AdvSettings::onClickArrow(LLComboBox* combo, bool next)
{
S32 index = mWaterPresetCombo->getCurrentIndex();
++index;
if (index == mWaterPresetCombo->getItemCount())
index = 0;
mWaterPresetCombo->setCurrentByIndex(index);
onChangeWWPresetName(mWaterPresetCombo->getSelectedValue());
}
void wlfPanel_AdvSettings::onClickWWPrev()
{
S32 index = mWaterPresetCombo->getCurrentIndex();
if (index == 0)
index = mWaterPresetCombo->getItemCount();
--index;
mWaterPresetCombo->setCurrentByIndex(index);
onChangeWWPresetName(mWaterPresetCombo->getSelectedValue());
}
void wlfPanel_AdvSettings::onClickWLNext()
{
S32 index = mSkyPresetCombo->getCurrentIndex();
++index;
if (index == mSkyPresetCombo->getItemCount())
index = 0;
mSkyPresetCombo->setCurrentByIndex(index);
onChangeWLPresetName(mSkyPresetCombo->getSelectedValue());
}
void wlfPanel_AdvSettings::onClickWLPrev()
{
S32 index = mSkyPresetCombo->getCurrentIndex();
if (index == 0)
index = mSkyPresetCombo->getItemCount();
--index;
mSkyPresetCombo->setCurrentByIndex(index);
onChangeWLPresetName(mSkyPresetCombo->getSelectedValue());
S32 index = combo->getCurrentIndex() + (next ? 1 : -1);
const auto too_far = next ? combo->getItemCount() : -1;
const auto wrap_around = next ? 0 : combo->getItemCount();
combo->setCurrentByIndex(index == too_far ? wrap_around : index);
combo->onCommit();
}
void wlfPanel_AdvSettings::onChangeDayTime(const LLSD& value)

View File

@@ -36,7 +36,7 @@
#include <boost/ptr_container/ptr_list.hpp>
// [RLVa:KB]
#include "rlvhandler.h"
#include "rlvdefines.h"
// [/RLVa:KB]
class LLComboBox;
@@ -66,10 +66,7 @@ protected:
void build();
void onUseRegionSettings(const LLSD& value);
void onClickWWNext();
void onClickWWPrev();
void onClickWLNext();
void onClickWLPrev();
static void onClickArrow(LLComboBox* combo, bool next);
void onChangeDayTime(const LLSD& value);
void refreshLists(); /// update controls with user prefs