LLColor4 LLControlGroup::getColor(const std::string& name)
{
	ctrl_name_table_t::const_iterator i = mNameTable.find(name);

	if (i != mNameTable.end())
	{
		LLControlVariable* control = i->second;

		switch(control->mType)
		{
		case TYPE_COL4:
			{
				return LLColor4(control->get());
			}
		case TYPE_COL4U:
			{
				return LLColor4(LLColor4U(control->get()));
			}
		default:
			{
				CONTROL_ERRS << "Control " << name << " not a color" << llendl;
				return LLColor4::white;
			}
		}
	}
	else
	{
		CONTROL_ERRS << "Invalid getColor control " << name << llendl;
		return LLColor4::white;
	}
}
Ejemplo n.º 2
0
std::string LLControlGroup::findString(const std::string& name)
{
    LLControlVariable* control = getControl(name);

    if (control && control->isType(TYPE_STRING))
        return control->get().asString();
    return LLStringUtil::null;
}
LLColor3 LLControlGroup::getColor3(const std::string& name)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_COL3))
		return control->get();
	else
	{
		CONTROL_ERRS << "Invalid LLColor3 control " << name << llendl;
		return LLColor3::white;
	}
}
LLRect LLControlGroup::getRect(const std::string& name)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_RECT))
		return control->get();
	else
	{
		CONTROL_ERRS << "Invalid rect control " << name << llendl;
		return LLRect::null;
	}
}
std::string LLControlGroup::getString(const std::string& name)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_STRING))
		return control->get().asString();
	else
	{
		CONTROL_ERRS << "Invalid string control " << name << llendl;
		return LLStringUtil::null;
	}
}
LLVector3d LLControlGroup::getVector3d(const std::string& name)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_VEC3D))
		return control->get();
	else
	{
		CONTROL_ERRS << "Invalid LLVector3d control " << name << llendl;
		return LLVector3d::zero;
	}
}
F32 LLControlGroup::getF32(const std::string& name)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_F32))
		return (F32) control->get().asReal();
	else
	{
		CONTROL_ERRS << "Invalid F32 control " << name << llendl;
		return 0.0f;
	}
}
U32 LLControlGroup::getU32(const std::string& name)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_U32))		
		return control->get().asInteger();
	else
	{
		CONTROL_ERRS << "Invalid U32 control " << name << llendl;
		return 0;
	}
}
BOOL LLControlGroup::getBOOL(const std::string& name)
{
	LLControlVariable* control = getControl(name);
	
	if (control && control->isType(TYPE_BOOLEAN))
		return control->get().asBoolean();
	else
	{
		CONTROL_ERRS << "Invalid BOOL control " << name << llendl;
		return FALSE;
	}
}
//static
void LLViewerControlListener::toggleControl(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);
			if(control->isType(TYPE_BOOLEAN))
			{
				control->set(!control->get().asBoolean());
			}
			else
			{
				llwarns << "requested toggle of non-boolean control: \"" << key << "\", type is " << control->type() << llendl;
			}
		}
		else
		{
			llwarns << "requested unknown control: \"" << key << '\"' << llendl;
		}
	}
}
void wlfPanel_AdvSettings::onClickExpandBtn()
{
	LLControlVariable* ctrl = gSavedSettings.getControl("wlfAdvSettingsPopup");
	ctrl->set(!ctrl->get());
}
Ejemplo n.º 12
0
static void toggle_time_value()
{
	LLControlVariable* control = gSavedSettings.getControl("LiruLocalTime");
	control->set(!control->get());
}