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" enabled="true" follows="left|bottom" height="20" left="0"
name="Adv_Settings" use_bounding_rect="true" width="30" > name="Adv_Settings" use_bounding_rect="true" width="30" >
<panel bottom="1" filename="panel_bg_tab.xml" height="22" left="0" 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" left="5" name="expand" scale_image="true" toggle="true"
tool_tip="Show the Settings Panel" width="22" /> tool_tip="Show the Settings Panel" width="22" />
</panel> </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."/> <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"/> <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"/> <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> </panel>

View File

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

View File

@@ -56,7 +56,7 @@ public:
static void updateClass(); static void updateClass();
static void onClickExpandBtn(void* user_data); void onClickExpandBtn();
void onChangeCameraPreset(LLUICtrl* ctrl, const LLSD& param); void onChangeCameraPreset(LLUICtrl* ctrl, const LLSD& param);
void onChangeWWPresetName(const LLSD& value); void onChangeWWPresetName(const LLSD& value);
void onChangeWLPresetName(const LLSD& value); void onChangeWLPresetName(const LLSD& value);