void LLPanelEmerald::onClickBoobReset(void* data)
{
	LLPanelEmerald* self = (LLPanelEmerald*)data;
	LLControlVariable *var;

	var = self->findControl("EmeraldBoobMass");
	self->getChild<LLSliderCtrl>("EmeraldBoobMass")->setValue(var->getDefault());
	var->resetToDefault();

	var = self->findControl("EmeraldBoobHardness");
	self->getChild<LLSliderCtrl>("EmeraldBoobHardness")->setValue(var->getDefault());
	var->resetToDefault();

	var = self->findControl("EmeraldBoobVelMax");
	self->getChild<LLSliderCtrl>("EmeraldBoobVelMax")->setValue(var->getDefault());
	var->resetToDefault();

	var = self->findControl("EmeraldBoobFriction");
	self->getChild<LLSliderCtrl>("EmeraldBoobFriction")->setValue(var->getDefault());
	var->resetToDefault();

	var = self->findControl("EmeraldBoobVelMin");
	self->getChild<LLSliderCtrl>("EmeraldBoobVelMin")->setValue(var->getDefault());
	var->resetToDefault();
}
Esempio n. 2
0
void LLFloaterMap::handleZoom(const LLSD& userdata)
{
	std::string level = userdata.asString();
	
	F32 scale = 0.0f;

	if (level == std::string("default"))
	{
		LLControlVariable *pvar = gSavedSettings.getControl("MiniMapScale");
		if(pvar)
		{
			pvar->resetToDefault();
			scale = gSavedSettings.getF32("MiniMapScale");
		}
	}
	else if (level == std::string("close"))
		scale = LLNetMap::MAP_SCALE_MAX;
	else if (level == std::string("medium"))
		scale = LLNetMap::MAP_SCALE_MID;
	else if (level == std::string("far"))
		scale = LLNetMap::MAP_SCALE_MIN;
	if (scale != 0.0f)
	{
		mMap->setScale(scale);
	}
}
Esempio n. 3
0
void LLPanelDisplay::setHardwareDefaults(void* user_data)
{
	LLFeatureManager::getInstance()->applyRecommendedSettings();
	LLControlVariable* controlp = gSavedSettings.getControl("RenderAvatarMaxVisible");
	if (controlp)
	{
		controlp->resetToDefault(true);
	}
	LLFloaterPreference::refreshEnabledGraphics();
}
Esempio n. 4
0
// static
void LLFloaterSettingsDebug::onClickDefault()
{
	LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo");
	LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata();

	if (controlp)
	{
		controlp->resetToDefault(true);
		updateControl(controlp);
	}
}
Esempio n. 5
0
void LLControlGroup::resetToDefaults()
{
    ctrl_name_table_t::iterator control_iter;
    for (control_iter = mNameTable.begin();
            control_iter != mNameTable.end();
            ++control_iter)
    {
        LLControlVariable* control = (*control_iter).second;
        control->resetToDefault();
    }
}
// static
void LLFloaterSettingsDebug::onClickDefault(void* user_data)
{
	LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data;
	LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo");
	LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata();

	if (controlp)
	{
		controlp->resetToDefault();
		floaterp->updateControl(controlp);
	}
}
//static
void LLViewerControlListener::setDefault(LLControlGroup * controls, LLSD const & event_data)
{
	if(event_data.has("key"))
	{
		std::string key(event_data["key"]);

		if(controls->controlExists(key))
		{
			LLControlVariable * control = controls->getControl(key);
			control->resetToDefault();
		}
		else
		{
			llwarns << "requested unknown control: \"" << key << '\"' << llendl;
		}
	}
}
Esempio n. 8
0
U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_values, bool revert_if_not_found)
{
	std::string name;
	LLSD settings;
	LLSD control_map;
	llifstream infile;
	infile.open(filename);
	if(!infile.is_open())
	{
		llwarns << "Cannot find file " << filename << " to load." << llendl;
		return 0;
	}

	S32 ret = LLSDSerialize::fromXML(settings, infile);

	if (ret <= 0)
	{
		infile.close();
		llwarns << "Unable to open LLSD control file " << filename << ". Trying Legacy Method." << llendl;		
		return loadFromFileLegacy(filename, TRUE, TYPE_STRING);
	}

	U32	validitems = 0;
	bool hidefromsettingseditor = false;
	
	for(LLSD::map_const_iterator itr = settings.beginMap(); itr != settings.endMap(); ++itr)
	{
		bool persist = true;
		name = (*itr).first;
		control_map = (*itr).second;
		
		if(control_map.has("Persist")) 
		{
			persist = control_map["Persist"].asInteger();
		}
		
		// Sometimes we want to use the settings system to provide cheap persistence, but we
		// don't want the settings themselves to be easily manipulated in the UI because 
		// doing so can cause support problems. So we have this option:
		if(control_map.has("HideFromEditor"))
		{
			hidefromsettingseditor = control_map["HideFromEditor"].asInteger();
		}
		else
		{
			hidefromsettingseditor = false;
		}
		
		// If the control exists just set the value from the input file.
		LLControlVariable* existing_control = getControl(name);
		if(existing_control)
		{
			if(set_default_values)
			{
				// Override all previously set properties of this control.
				// ... except for type. The types must match.
				eControlType new_type = typeStringToEnum(control_map["Type"].asString());
				if(existing_control->isType(new_type))
				{
					existing_control->setDefaultValue(control_map["Value"]);
					existing_control->setPersist(persist);
					existing_control->setHiddenFromSettingsEditor(hidefromsettingseditor);
					existing_control->setComment(control_map["Comment"].asString());
				}
				else
				{
					llerrs << "Mismatched type of control variable '"
						   << name << "' found while loading '"
						   << filename << "'." << llendl;
				}
			}
			else if(existing_control->isPersisted())
			{
				
				existing_control->setValue(control_map["Value"]);
			}
			// *NOTE: If not persisted and not setting defaults, 
			// the value should not get loaded.
		}
		else
		{
			declareControl(name, 
						   typeStringToEnum(control_map["Type"].asString()), 
						   control_map["Value"], 
						   control_map["Comment"].asString(), 
						   persist,
						   hidefromsettingseditor
						   );
		}
		
		++validitems;
	}

	// [KITTY VIEWER]
	if(revert_if_not_found)
	{
		ctrl_name_table_t::iterator control_iter;
		for (control_iter = mNameTable.begin();
			 control_iter != mNameTable.end();
			 ++control_iter)
		{
			if(!settings.has((*control_iter).first))
			{
				LLControlVariable* control = (*control_iter).second;
				if(control->isPersisted() && !control->isDefault())
				{
					control->resetToDefault(true);
				}
			}
		}
	}
	// [/KITTY VIEWER]

	return validitems;
}