本文整理汇总了C++中LLMultiSliderCtrl::getCurSliderValue方法的典型用法代码示例。如果您正苦于以下问题:C++ LLMultiSliderCtrl::getCurSliderValue方法的具体用法?C++ LLMultiSliderCtrl::getCurSliderValue怎么用?C++ LLMultiSliderCtrl::getCurSliderValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLMultiSliderCtrl
的用法示例。
在下文中一共展示了LLMultiSliderCtrl::getCurSliderValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onKeyTimeChanged
void LLFloaterDayCycle::onKeyTimeChanged(LLUICtrl* ctrl, void* userData)
{
// if no keys, skipped
if(sSliderToKey.size() == 0) {
return;
}
LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>(
"WLCurKeyHour");
LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>(
"WLCurKeyMin");
F32 hour = hourSpin->get();
F32 min = minSpin->get();
F32 val = hour + min / 60.0f;
const std::string& curSldr = sldr->getCurSlider();
sldr->setCurSliderValue(val, TRUE);
F32 time = sldr->getCurSliderValue() / sHoursPerDay;
// now set the key's time in the sliderToKey map
std::string presetName = sSliderToKey[curSldr].presetName;
sSliderToKey[curSldr].time = time;
syncTrack();
}
示例2: syncTrack
void LLFloaterDayCycle::syncTrack()
{
// if no keys, do nothing
if(sSliderToKey.size() == 0)
{
return;
}
LLMultiSliderCtrl* sldr;
sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
llassert_always(sSliderToKey.size() == sldr->getValue().size());
LLMultiSliderCtrl* tSldr;
tSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
// create a new animation track
LLWLParamManager::getInstance()->mDay.clearKeys();
// add the keys one by one
std::map<std::string, LLWLSkyKey>::iterator mIt = sSliderToKey.begin();
for(; mIt != sSliderToKey.end(); mIt++)
{
LLWLParamManager::getInstance()->mDay.addKey(mIt->second.time / sHoursPerDay,
mIt->second.presetName);
}
// set the param manager's track to the new one
LLWLParamManager::getInstance()->resetAnimator(
tSldr->getCurSliderValue() / sHoursPerDay, false);
LLWLParamManager::getInstance()->mAnimator.update(
LLWLParamManager::getInstance()->mCurParams);
}
示例3: onTimeSliderMoved
void LLFloaterDayCycle::onTimeSliderMoved(LLUICtrl* ctrl, void* userData)
{
LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
/// get the slider value
F32 val = sldr->getCurSliderValue() / sHoursPerDay;
// set the value, turn off animation
LLWLParamManager::getInstance()->mAnimator.setDayTime((F64)val);
LLWLParamManager::getInstance()->mAnimator.deactivate();
// then call update once
LLWLParamManager::getInstance()->mAnimator.update(
LLWLParamManager::getInstance()->mCurParams);
}
示例4: onEditorCommit
// static
void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata )
{
LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
llassert( caller == self->mEditor );
BOOL success = FALSE;
F32 val = self->mCurValue;
F32 saved_val = self->mCurValue;
std::string text = self->mEditor->getText();
if( LLLineEditor::postvalidateFloat( text ) )
{
LLLocale locale(LLLocale::USER_LOCALE);
val = (F32) atof( text.c_str() );
if( self->mMultiSlider->getMinValue() <= val && val <= self->mMultiSlider->getMaxValue() )
{
if( self->mValidateCallback )
{
self->setCurSliderValue( val ); // set the value temporarily so that the callback can retrieve it.
if( self->mValidateCallback( self, self->mCallbackUserData ) )
{
success = TRUE;
}
}
else
{
self->setCurSliderValue( val );
success = TRUE;
}
}
}
if( success )
{
self->onCommit();
}
else
{
if( self->getCurSliderValue() != saved_val )
{
self->setCurSliderValue( saved_val );
}
self->reportInvalidData();
}
self->updateText();
}
示例5: onEditorCommit
// static
void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata)
{
llassert(ctrl);
if (!ctrl)
return;
LLMultiSliderCtrl* self = dynamic_cast<LLMultiSliderCtrl*>(ctrl->getParent());
llassert(self);
if (!self) // cast failed - wrong type! :O
return;
BOOL success = FALSE;
F32 val = self->mCurValue;
F32 saved_val = self->mCurValue;
std::string text = self->mEditor->getText();
if( LLLineEditor::postvalidateFloat( text ) )
{
LLLocale locale(LLLocale::USER_LOCALE);
val = (F32) atof( text.c_str() );
if( self->mMultiSlider->getMinValue() <= val && val <= self->mMultiSlider->getMaxValue() )
{
self->setCurSliderValue( val ); // set the value temporarily so that the callback can retrieve it.
if( !self->mValidateSignal || (*(self->mValidateSignal))( self, val ) )
{
success = TRUE;
}
}
}
if( success )
{
self->onCommit();
}
else
{
if( self->getCurSliderValue() != saved_val )
{
self->setCurSliderValue( saved_val );
}
self->reportInvalidData();
}
self->updateText();
}
示例6: onAddKey
void LLFloaterDayCycle::onAddKey(void* userData)
{
LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>(
"WLKeyPresets");
LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
LLMultiSliderCtrl* tSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
llassert_always(sSliderToKey.size() == kSldr->getValue().size());
// get the values
std::string newPreset(comboBox->getSelectedValue().asString());
// add the slider key
addSliderKey(tSldr->getCurSliderValue(), newPreset);
syncTrack();
}
示例7: onLoadDayCycle
void LLFloaterDayCycle::onLoadDayCycle(void* userData)
{
LLWLParamManager::instance()->mDay.loadDayCycleFromFile("Default.xml");
// sync it all up
syncSliderTrack();
syncMenu();
// set the param manager's track to the new one
LLMultiSliderCtrl* tSldr;
tSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLTimeSlider");
LLWLParamManager::instance()->resetAnimator(
tSldr->getCurSliderValue() / sHoursPerDay, false);
// and draw it
LLWLParamManager::instance()->mAnimator.update(
LLWLParamManager::instance()->mCurParams);
}
示例8: onKeyTimeMoved
void LLFloaterDayCycle::onKeyTimeMoved(LLUICtrl* ctrl, void* userData)
{
LLComboBox* comboBox = sDayCycle->getChild<LLComboBox>("WLKeyPresets");
LLMultiSliderCtrl* sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
LLSpinCtrl* hourSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyHour");
LLSpinCtrl* minSpin = sDayCycle->getChild<LLSpinCtrl>("WLCurKeyMin");
if(sldr->getValue().size() == 0) {
return;
}
// make sure we have a slider
const std::string& curSldr = sldr->getCurSlider();
if(curSldr == "") {
return;
}
F32 time = sldr->getCurSliderValue();
// check to see if a key exists
std::string presetName = sSliderToKey[curSldr].presetName;
sSliderToKey[curSldr].time = time;
// if it exists, turn on check box
comboBox->selectByValue(presetName);
// now set the spinners
F32 hour = (F32)((S32)time);
F32 min = (time - hour) * 60;
// handle imprecision
if(min >= 59) {
min = 0;
hour += 1;
}
hourSpin->set(hour);
minSpin->set(min);
syncTrack();
}
示例9: addSliderKey
void LLFloaterDayCycle::addSliderKey(F32 time, const std::string & presetName)
{
LLMultiSliderCtrl* kSldr = sDayCycle->getChild<LLMultiSliderCtrl>(
"WLDayCycleKeys");
// make a slider
const std::string& sldrName = kSldr->addSlider(time);
if(sldrName == "") {
return;
}
// set the key
LLWLSkyKey newKey;
newKey.presetName = presetName;
newKey.time = kSldr->getCurSliderValue();
llassert_always(sldrName != LLStringUtil::null);
// add to map
sSliderToKey.insert(std::pair<std::string, LLWLSkyKey>(sldrName, newKey));
llassert_always(sSliderToKey.size() == kSldr->getValue().size());
}
示例10: onRunAnimSky
void LLFloaterDayCycle::onRunAnimSky(void* userData)
{
// if no keys, do nothing
if(sSliderToKey.size() == 0)
{
return;
}
LLMultiSliderCtrl* sldr;
sldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLDayCycleKeys");
llassert_always(sSliderToKey.size() == sldr->getValue().size());
LLMultiSliderCtrl* tSldr;
tSldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLTimeSlider");
// turn off linden time
//LLWLParamManager::getInstance()->mAnimator.mUseLindenTime = false;
// set the param manager's track to the new one
LLWLParamManager::getInstance()->resetAnimator(
tSldr->getCurSliderValue() / sHoursPerDay, true);
llassert_always(LLWLParamManager::getInstance()->mAnimator.mTimeTrack.size() == sldr->getValue().size());
}
示例11: onChangePresetName
void LLFloaterDayCycle::onChangePresetName(LLUICtrl* ctrl)
{
LLComboBox * combo_box = static_cast<LLComboBox*>(ctrl);
if(combo_box->getSimple() == "")
{
return;
}
LLEnvManagerNew::getInstance()->useDayCycle(combo_box->getSelectedValue().asString(), LLEnvKey::SCOPE_LOCAL);
gSavedSettings.setString("AscentActiveDayCycle", combo_box->getSelectedValue().asString());
// sync it all up
syncSliderTrack();
syncMenu();
// set the param manager's track to the new one
LLMultiSliderCtrl* tSldr;
tSldr = sDayCycle->getChild<LLMultiSliderCtrl>("WLTimeSlider");
LLWLParamManager::getInstance()->resetAnimator(tSldr->getCurSliderValue() / sHoursPerDay, false);
// and draw it
LLWLParamManager::getInstance()->mAnimator.update(LLWLParamManager::getInstance()->mCurParams);
}