wlfPanel cleanup and simplification

This commit is contained in:
Inusaito Sayori
2014-11-10 18:25:31 -05:00
parent e3d45d99da
commit 37412c8dd2
4 changed files with 27 additions and 38 deletions

View File

@@ -3,7 +3,7 @@
enabled="true" follows="left|bottom" height="20" left="0"
name="Adv_Settings" use_bounding_rect="true" width="30" >
<panel bottom="1" filename="panel_bg_tab.xml" height="22" left="0" width="30" />
<button bottom="1" height="22" label=""
<button bottom="1" height="22" label="" image_overlay="arrow_up.tga"
left="5" name="expand" scale_image="true" toggle="true"
tool_tip="Show the Settings Panel" width="22" />
</panel>

View File

@@ -28,5 +28,5 @@
<check_box bottom_delta="0" left_delta="110" label="Crossfade?" control_name="PhoenixInterpolateSky" height="16" name="Crossfade" tool_tip="If unchecked, Sky Windlight settings changes will apply immediately, without hesitation/animation."/>
<icon bottom_delta="-18" height="14" image_name="icon_day_cycle.tga" left="10" width="150"/>
<slider bottom_delta="-8" control_name="EnvTimeSlider" left="5" height="10" increment="0.00000001" label="" max_val="1" min_val="0" name="EnvTimeSlider" show_text="false" width="160"/>
<button bottom="1" height="22" label="" left="172" name="expand" scale_image="true" toggle="true" tool_tip="Hide the Settings Panel" width="22"/>
<button bottom="1" height="22" label="" left="172" name="expand" scale_image="true" image_overlay="arrow_down.tga" toggle="true" tool_tip="Hide the Settings Panel" width="22"/>
</panel>

View File

@@ -67,54 +67,40 @@ wlfPanel_AdvSettings::wlfPanel_AdvSettings() : mExpanded(false)
//static
void wlfPanel_AdvSettings::updateClass()
{
if(!wlfPanel_AdvSettings::instanceExists())
return;
wlfPanel_AdvSettings::getInstance()->build();
if (!instanceExists()) return;
instance().build();
}
void wlfPanel_AdvSettings::build()
{
mConnections.clear();
deleteAllChildren();
std::string ButtonState;
if (gSavedSettings.getBOOL("wlfAdvSettingsPopup"))
{
mExpanded = true;
LLUICtrlFactory::getInstance()->buildPanel(this, "wlfPanel_AdvSettings_expanded.xml", &getFactoryMap());
ButtonState = "arrow_down.tga";
}
else
{
mExpanded = false;
LLUICtrlFactory::getInstance()->buildPanel(this, "wlfPanel_AdvSettings.xml", &getFactoryMap());
ButtonState = "arrow_up.tga";
}
getChild<LLButton>("expand")->setImageOverlay(ButtonState);
mExpanded = gSavedSettings.getBOOL("wlfAdvSettingsPopup");
LLUICtrlFactory::instance().buildPanel(this, mExpanded ? "wlfPanel_AdvSettings_expanded.xml" : "wlfPanel_AdvSettings.xml", &getFactoryMap());
}
// [RLVa:KB] - Checked: 2013-06-20
void wlfPanel_AdvSettings::updateRlvVisibility()
{
if(!mExpanded || !rlv_handler_t::isEnabled())
if (!mExpanded || !rlv_handler_t::isEnabled())
return;
bool enable = !gRlvHandler.hasBehaviour(RLV_BHVR_SETENV);
childSetEnabled("use_estate_wl", enable);
childSetEnabled("EnvAdvancedWaterButton", enable);
childSetEnabled("WLWaterPresetsCombo", enable);
mWaterPresetCombo->setEnabled(enable);
childSetEnabled("WWprev", enable);
childSetEnabled("WWnext", enable);
childSetEnabled("EnvAdvancedSkyButton", enable);
childSetEnabled("WLSkyPresetsCombo", enable);
mSkyPresetCombo->setEnabled(enable);
childSetEnabled("WLprev", enable);
childSetEnabled("WLnext", enable);
childSetEnabled("EnvTimeSlider", enable);
mTimeSlider->setEnabled(enable);
}
void wlfPanel_AdvSettings::onRlvBehaviorChange(ERlvBehaviour eBhvr, ERlvParamType eType)
{
if(eBhvr == RLV_BHVR_SETENV)
updateRlvVisibility();
if (eBhvr == RLV_BHVR_SETENV) updateRlvVisibility();
}
// [/RLVa:KB]
@@ -149,7 +135,8 @@ void wlfPanel_AdvSettings::refreshLists()
BOOL wlfPanel_AdvSettings::postBuild()
{
setVisible(true);
childSetAction("expand", onClickExpandBtn, this);
if (LLUICtrl* ctrl = findChild<LLUICtrl>("expand"))
ctrl->setCommitCallback(boost::bind(&wlfPanel_AdvSettings::onClickExpandBtn, this));
if (mExpanded)
{
@@ -208,9 +195,10 @@ wlfPanel_AdvSettings::~wlfPanel_AdvSettings ()
{
}
void wlfPanel_AdvSettings::onClickExpandBtn(void* user_data)
void wlfPanel_AdvSettings::onClickExpandBtn()
{
gSavedSettings.setBOOL("wlfAdvSettingsPopup",!gSavedSettings.getBOOL("wlfAdvSettingsPopup"));
LLControlVariable* ctrl = gSavedSettings.getControl("wlfAdvSettingsPopup");
ctrl->set(!ctrl->get());
}
void wlfPanel_AdvSettings::onChangeCameraPreset(LLUICtrl* ctrl, const LLSD& param)
@@ -277,7 +265,7 @@ void wlfPanel_AdvSettings::onClickWWNext()
index = 0;
mWaterPresetCombo->setCurrentByIndex(index);
wlfPanel_AdvSettings::onChangeWWPresetName(mWaterPresetCombo->getSelectedValue());
onChangeWWPresetName(mWaterPresetCombo->getSelectedValue());
}
void wlfPanel_AdvSettings::onClickWWPrev()
@@ -288,7 +276,7 @@ void wlfPanel_AdvSettings::onClickWWPrev()
--index;
mWaterPresetCombo->setCurrentByIndex(index);
wlfPanel_AdvSettings::onChangeWWPresetName(mWaterPresetCombo->getSelectedValue());
onChangeWWPresetName(mWaterPresetCombo->getSelectedValue());
}
void wlfPanel_AdvSettings::onClickWLNext()
@@ -299,7 +287,7 @@ void wlfPanel_AdvSettings::onClickWLNext()
index = 0;
mSkyPresetCombo->setCurrentByIndex(index);
wlfPanel_AdvSettings::onChangeWLPresetName(mSkyPresetCombo->getSelectedValue());
onChangeWLPresetName(mSkyPresetCombo->getSelectedValue());
}
void wlfPanel_AdvSettings::onClickWLPrev()
@@ -310,13 +298,14 @@ void wlfPanel_AdvSettings::onClickWLPrev()
--index;
mSkyPresetCombo->setCurrentByIndex(index);
wlfPanel_AdvSettings::onChangeWLPresetName(mSkyPresetCombo->getSelectedValue());
onChangeWLPresetName(mSkyPresetCombo->getSelectedValue());
}
void wlfPanel_AdvSettings::onChangeDayTime(const LLSD& value)
{
// deactivate animator
LLWLParamManager::getInstance()->mAnimator.deactivate();
LLWLParamManager& inst(LLWLParamManager::instance());
inst.mAnimator.deactivate();
F32 val = value.asFloat() + 0.25f;
if(val > 1.0)
@@ -324,8 +313,8 @@ void wlfPanel_AdvSettings::onChangeDayTime(const LLSD& value)
val--;
}
LLWLParamManager::getInstance()->mAnimator.setDayTime((F64)val);
LLWLParamManager::getInstance()->mAnimator.update(LLWLParamManager::getInstance()->mCurParams);
inst.mAnimator.setDayTime((F64)val);
inst.mAnimator.update(inst.mCurParams);
}
void wlfPanel_AdvSettings::populateWaterPresetsList()

View File

@@ -45,9 +45,9 @@ class LLSliderCtrl;
class wlfPanel_AdvSettings : public LLPanel, public LLSingleton<wlfPanel_AdvSettings>
{
public:
wlfPanel_AdvSettings ();
wlfPanel_AdvSettings();
~wlfPanel_AdvSettings ();
~wlfPanel_AdvSettings();
BOOL postBuild();
void draw();
@@ -56,7 +56,7 @@ public:
static void updateClass();
static void onClickExpandBtn(void* user_data);
void onClickExpandBtn();
void onChangeCameraPreset(LLUICtrl* ctrl, const LLSD& param);
void onChangeWWPresetName(const LLSD& value);
void onChangeWLPresetName(const LLSD& value);