void LLFloaterWindLight::onColorControlIMoved(LLUICtrl* ctrl, void* userData) { deactivateAnimator(); LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); WLColorControl * colorControl = static_cast<WLColorControl *>(userData); colorControl->i = sldrCtrl->getValueF32(); // only for sliders where we pass a name if(colorControl->hasSliderName) { // set it to the top F32 maxVal = std::max(std::max(colorControl->r, colorControl->g), colorControl->b); F32 iVal; if(colorControl->isSunOrAmbientColor) { iVal = colorControl->i * 3; } else if(colorControl->isBlueHorizonOrDensity) { iVal = colorControl->i * 2; } else { iVal = colorControl->i; } // get the names of the other sliders std::string rName = colorControl->mSliderName; rName.append("R"); std::string gName = colorControl->mSliderName; gName.append("G"); std::string bName = colorControl->mSliderName; bName.append("B"); // handle if at 0 if(iVal == 0) { colorControl->r = 0; colorControl->g = 0; colorControl->b = 0; // if all at the start // set them all to the intensity } else if (maxVal == 0) { colorControl->r = iVal; colorControl->g = iVal; colorControl->b = iVal; } else { // add delta amounts to each F32 delta = (iVal - maxVal) / maxVal; colorControl->r *= (1.0f + delta); colorControl->g *= (1.0f + delta); colorControl->b *= (1.0f + delta); } // divide sun color vals by three if(colorControl->isSunOrAmbientColor) { sWindLight->childSetValue(rName, colorControl->r/3); sWindLight->childSetValue(gName, colorControl->g/3); sWindLight->childSetValue(bName, colorControl->b/3); } else if(colorControl->isBlueHorizonOrDensity) { sWindLight->childSetValue(rName, colorControl->r/2); sWindLight->childSetValue(gName, colorControl->g/2); sWindLight->childSetValue(bName, colorControl->b/2); } else { // set the sliders to the new vals sWindLight->childSetValue(rName, colorControl->r); sWindLight->childSetValue(gName, colorControl->g); sWindLight->childSetValue(bName, colorControl->b); } } // now update the current parameters and send them to shaders colorControl->update(LLWLParamManager::instance()->mCurParams); LLWLParamManager::instance()->propagateParameters(); }
LLView* LLSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { std::string name("slider"); node->getAttributeString("name", name); std::string label; node->getAttributeString("label", label); LLRect rect; createRect(node, rect, parent, LLRect()); LLFontGL* font = LLView::selectFont(node); // HACK: Font might not be specified. if (!font) { font = LLFontGL::getFontSansSerifSmall(); } S32 label_width = 0; node->getAttributeS32("label_width", label_width); BOOL show_text = TRUE; node->getAttributeBOOL("show_text", show_text); BOOL can_edit_text = FALSE; node->getAttributeBOOL("can_edit_text", can_edit_text); BOOL volume = FALSE; node->getAttributeBOOL("volume", volume); F32 initial_value = 0.f; node->getAttributeF32("initial_val", initial_value); F32 min_value = 0.f; node->getAttributeF32("min_val", min_value); F32 max_value = 1.f; node->getAttributeF32("max_val", max_value); F32 increment = 0.1f; node->getAttributeF32("increment", increment); U32 precision = 3; node->getAttributeU32("decimal_digits", precision); S32 text_left = 0; if (show_text) { // calculate the size of the text box (log max_value is number of digits - 1 so plus 1) if ( max_value ) text_left = font->getWidth(std::string("0")) * ( static_cast < S32 > ( log10 ( max_value ) ) + precision + 1 ); if ( increment < 1.0f ) text_left += font->getWidth(std::string(".")); // (mostly) take account of decimal point in value if ( min_value < 0.0f || max_value < 0.0f ) text_left += font->getWidth(std::string("-")); // (mostly) take account of minus sign // padding to make things look nicer text_left += 8; } LLUICtrlCallback callback = NULL; if (label.empty()) { label.assign(node->getTextContents()); } LLSliderCtrl* slider = new LLSliderCtrl(name, rect, label, font, label_width, rect.getWidth() - text_left, show_text, can_edit_text, volume, callback, NULL, initial_value, min_value, max_value, increment); slider->setPrecision(precision); slider->initFromXML(node, parent); slider->updateText(); return slider; }
static void onFOVAdjust(LLUICtrl* source, void* data) { LLSliderCtrl* slider = dynamic_cast<LLSliderCtrl*>(source); LLViewerCamera::getInstance()->setDefaultFOV(slider->getValueF32()); }
void LLFloaterEnvSettings::syncMenu() { LLSliderCtrl* sldr; sldr = getChild<LLSliderCtrl>("EnvTimeSlider"); // sync the clock F32 val = (F32)LLWLParamManager::getInstance()->mAnimator.getDayTime(); std::string timeStr = timeToString(val); LLTextBox* textBox; textBox = getChild<LLTextBox>("EnvTimeText"); textBox->setValue(timeStr); // sync time slider which starts at 6 AM val -= 0.25; if(val < 0) { val++; } sldr->setValue(val); // sync cloud coverage bool err; childSetValue("EnvCloudSlider", LLWLParamManager::getInstance()->mCurParams.getFloat("cloud_shadow", err)); LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); // sync water params LLColor4 col = param_mgr->getFogColor(); LLColorSwatchCtrl* colCtrl = getChild<LLColorSwatchCtrl>("EnvWaterColor"); col.mV[3] = 1.0f; colCtrl->set(col); childSetValue("EnvWaterFogSlider", param_mgr->mFogDensity.mExp); param_mgr->setDensitySliderValue(param_mgr->mFogDensity.mExp); // turn off Use Estate Time button if it's already being used if(LLWLParamManager::getInstance()->mAnimator.getUseLindenTime()) { childDisable("EnvUseEstateTimeButton"); } else { childEnable("EnvUseEstateTimeButton"); } if(!gPipeline.canUseVertexShaders()) { childDisable("EnvWaterColor"); childDisable("EnvWaterColorText"); //childDisable("EnvAdvancedWaterButton"); } else { childEnable("EnvWaterColor"); childEnable("EnvWaterColorText"); //childEnable("EnvAdvancedWaterButton"); } // only allow access to these if they are using windlight if(!gPipeline.canUseWindLightShaders()) { childDisable("EnvCloudSlider"); childDisable("EnvCloudText"); //childDisable("EnvAdvancedSkyButton"); } else { childEnable("EnvCloudSlider"); childEnable("EnvCloudText"); //childEnable("EnvAdvancedSkyButton"); } }
LLPanelDebug::LLPanelDebug(const std::string& name, const LLRect& rect) : LLPanel(name, rect) { LLCheckboxCtrl* check = NULL; LLSliderCtrl *sliderctrl = NULL; const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ); const S32 HPAD = 10; const S32 VPAD = 4; const S32 TOP_PAD = 10; // alignment "rulers" for buttons const S32 SEGMENT_WIDTH = 128; const S32 LEFT = HPAD; const S32 RULER1 = LEFT + SEGMENT_WIDTH + 30; const S32 RULER2 = RULER1 + HPAD; const S32 RIGHT = RULER2 + SEGMENT_WIDTH; const S32 LABEL_OFFSET = 60; S32 cur_y = rect.getHeight() - TOP_PAD; sliderctrl = new LLSliderCtrl(std::string("Drop Shadow Floater"), LLRect( LEFT, cur_y, RIGHT, cur_y - SLIDERCTRL_HEIGHT ), std::string("Drop Shadow Floater"), font, LABEL_OFFSET, RULER2 + SPINCTRL_DEFAULT_LABEL_WIDTH + SPINCTRL_BTN_WIDTH, TRUE, TRUE, FALSE, NULL, NULL, (F32)gSavedSettings.getS32("DropShadowFloater"), 0.f, 10.f, 1.0f, std::string("DropShadowFloater")); sliderctrl->setFollowsTop(); sliderctrl->setFollowsLeft(); addChild(sliderctrl); cur_y -= VPAD + SLIDERCTRL_HEIGHT; sliderctrl = new LLSliderCtrl(std::string("Drop Shadow Button"), LLRect( LEFT, cur_y, RIGHT, cur_y - SLIDERCTRL_HEIGHT ), std::string("Drop Shadow Button"), font, LABEL_OFFSET, RULER2 + SPINCTRL_DEFAULT_LABEL_WIDTH + SPINCTRL_BTN_WIDTH, TRUE, TRUE, FALSE, NULL, NULL, (F32)gSavedSettings.getS32("DropShadowButton"), 0.f, 10.f, 1.0f, std::string("DropShadowButton")); sliderctrl->setFollowsTop(); sliderctrl->setFollowsLeft(); addChild(sliderctrl); cur_y -= VPAD + SLIDERCTRL_HEIGHT; check = new LLCheckboxCtrl(std::string("left click"), LLRect(LEFT, cur_y, RIGHT, cur_y - 20), std::string("Left Click Shows Menu Unless Interactive"), font, NULL, NULL, gSavedSettings.getBOOL("LeftClickShowMenu")); check->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP); addChild(check); mLeftClickCheck = check; cur_y -= VPAD+20; }
BOOL LLPanelEmerald::postBuild() { refresh(); LLComboBox* tagcombo = getChild<LLComboBox>("TagCombo"); tagcombo->setCommitCallback(onTagComboBoxCommit); for(LLSD::map_iterator itr = ModularSystemsLink::emerald_tags.beginMap(); itr != ModularSystemsLink::emerald_tags.endMap(); ++itr) { tagcombo->add(itr->first,itr->second, ADD_BOTTOM, TRUE); } tagcombo->setSimple(gSavedSettings.getString("EmeraldTagColor")); getChild<LLComboBox>("material")->setSimple(gSavedSettings.getString("EmeraldBuildPrefs_Material")); getChild<LLComboBox>("combobox shininess")->setSimple(gSavedSettings.getString("EmeraldBuildPrefs_Shiny")); LLSliderCtrl* mShapeScaleSlider = getChild<LLSliderCtrl>("EmeraldBeamShapeScale",TRUE,FALSE); mShapeScaleSlider->setCommitCallback(&LLPanelEmerald::beamUpdateCall); mShapeScaleSlider->setCallbackUserData(this); LLSliderCtrl* mBeamsPerSecondSlider = getChild<LLSliderCtrl>("EmeraldMaxBeamsPerSecond",TRUE,FALSE); mBeamsPerSecondSlider->setCommitCallback(&LLPanelEmerald::beamUpdateCall); mBeamsPerSecondSlider->setCallbackUserData(this); getChild<LLComboBox>("material")->setCommitCallback(onComboBoxCommit); getChild<LLComboBox>("combobox shininess")->setCommitCallback(onComboBoxCommit); getChild<LLComboBox>("EmeraldBeamShape_combo")->setCommitCallback(onComboBoxCommit); getChild<LLComboBox>("BeamColor_combo")->setCommitCallback(onComboBoxCommit); getChild<LLTextureCtrl>("texture control")->setDefaultImageAssetID(LLUUID("89556747-24cb-43ed-920b-47caed15465f")); getChild<LLTextureCtrl>("texture control")->setCommitCallback(onTexturePickerCommit); getChild<LLComboBox>("EmeraldSpellBase")->setCommitCallback(onSpellBaseComboBoxCommit); //childSetCommitCallback("material",onComboBoxCommit); //childSetCommitCallback("combobox shininess",onComboBoxCommit); getChild<LLButton>("keyword_allert")->setClickedCallback(onKeywordAllertButton,this); getChild<LLButton>("ac_button")->setClickedCallback(onAutoCorrectButton,this); getChild<LLButton>("EmSpell_EditCustom")->setClickedCallback(onSpellEditCustom, this); getChild<LLButton>("EmSpell_GetMore")->setClickedCallback(onSpellGetMore, this); getChild<LLButton>("EmSpell_Add")->setClickedCallback(onSpellAdd, this); getChild<LLButton>("EmSpell_Remove")->setClickedCallback(onSpellRemove, this); getChild<LLButton>("BeamColor_new")->setClickedCallback(onCustomBeamColor, this); getChild<LLButton>("BeamColor_refresh")->setClickedCallback(onRefresh,this); getChild<LLButton>("BeamColor_delete")->setClickedCallback(onBeamColorDelete,this); getChild<LLButton>("custom_beam_btn")->setClickedCallback(onCustomBeam, this); getChild<LLButton>("refresh_beams")->setClickedCallback(onRefresh,this); getChild<LLButton>("delete_beam")->setClickedCallback(onBeamDelete,this); getChild<LLButton>("revert_production_voice_btn")->setClickedCallback(onClickVoiceRevertProd, this); getChild<LLButton>("revert_debug_voice_btn")->setClickedCallback(onClickVoiceRevertDebug, this); getChild<LLButton>("EmeraldBreastReset")->setClickedCallback(onClickBoobReset, this); childSetCommitCallback("production_voice_field", onCommitApplyControl);//onCommitVoiceProductionServerName); childSetCommitCallback("debug_voice_field", onCommitApplyControl);//onCommitVoiceDebugServerName); childSetCommitCallback("EmeraldCmdLinePos", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineGround", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineHeight", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineTeleportHome", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineRezPlatform", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineMapTo", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineCalc", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineDrawDistance", onCommitApplyControl); childSetCommitCallback("EmeraldCmdTeleportToCam", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineKeyToName", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineOfferTp", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineTP2", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineAO", onCommitApplyControl); childSetCommitCallback("EmeraldCmdLineClearChat", onCommitApplyControl); childSetCommitCallback("X Modifier", onCommitAvatarModifier); childSetCommitCallback("Y Modifier", onCommitAvatarModifier); childSetCommitCallback("Z Modifier", onCommitAvatarModifier); if(gAgent.getID() != LLUUID::null) { getChild<LLSpinCtrl>("X Modifier")->set(gSavedPerAccountSettings.getF32("EmeraldAvatarXModifier")); getChild<LLSpinCtrl>("Y Modifier")->set(gSavedPerAccountSettings.getF32("EmeraldAvatarYModifier")); getChild<LLSpinCtrl>("Z Modifier")->set(gSavedPerAccountSettings.getF32("EmeraldAvatarZModifier")); }else { getChild<LLSpinCtrl>("X Modifier")->setEnabled(FALSE); getChild<LLSpinCtrl>("Y Modifier")->setEnabled(FALSE); getChild<LLSpinCtrl>("Z Modifier")->setEnabled(FALSE); } childSetValue("EmeraldUseOTR", LLSD((S32)gSavedSettings.getU32("EmeraldUseOTR"))); // [$PLOTR$] getChild<LLButton>("otr_help_btn")->setClickedCallback(onClickOtrHelp, this); // [/$PLOTR$] initHelpBtn("EmeraldHelp_TeleportLogin", "EmeraldHelp_TeleportLogin"); initHelpBtn("EmeraldHelp_Voice", "EmeraldHelp_Voice"); initHelpBtn("EmeraldHelp_Shields", "EmeraldHelp_Shields"); initHelpBtn("EmeraldHelp_IM", "EmeraldHelp_IM"); initHelpBtn("EmeraldHelp_Chat", "EmeraldHelp_Chat"); initHelpBtn("EmeraldHelp_Misc", "EmeraldHelp_Misc"); initHelpBtn("EmeraldHelp_CmdLine", "EmeraldHelp_CmdLine"); initHelpBtn("EmeraldHelp_Avatar", "EmeraldHelp_Avatar"); initHelpBtn("EmeraldHelp_Build", "EmeraldHelp_Build"); initHelpBtn("EmeraldHelp_IRC", "EmeraldHelp_IRC"); initHelpBtn("EmeraldHelp_UtilityStream", "EmeraldHelp_UtilityStream"); initHelpBtn("EmeraldHelp_Inventory", "EmeraldHelp_Inventory"); initHelpBtn("EmeraldHelp_Effects", "EmeraldHelp_Effects"); initHelpBtn("EmeraldHelp_SpellCheck", "EmeraldHelp_SpellCheck"); LLView *target_view = getChild<LLView>("im_give_drop_target_rect"); if(target_view) { if (mObjectDropTarget)//shouldn't happen { delete mObjectDropTarget; } mObjectDropTarget = new JCInvDropTarget("drop target", target_view->getRect(), IMAutoResponseItemDrop);//, mAvatarID); addChild(mObjectDropTarget); } target_view = getChild<LLView>("build_item_add_disp_rect"); if(target_view) { if (mBuildObjectDropTarget) delete mBuildObjectDropTarget; mBuildObjectDropTarget = new JCInvDropTarget("build drop target", target_view->getRect(),BuildAutoResponseItemDrop); addChild(mBuildObjectDropTarget); } if(LLStartUp::getStartupState() == STATE_STARTED) { LLUUID itemid = (LLUUID)gSavedPerAccountSettings.getString("EmeraldInstantMessageResponseItemData"); LLViewerInventoryItem* item = gInventory.getItem(itemid); if(item) { childSetValue("im_give_disp_rect_txt","Currently set to: "+item->getName()); }else if(itemid.isNull()) { childSetValue("im_give_disp_rect_txt","Currently not set"); }else { childSetValue("im_give_disp_rect_txt","Currently set to a item not on this account"); } itemid = (LLUUID)gSavedSettings.getString("EmeraldBuildPrefs_Item"); item = gInventory.getItem(itemid); if(item) { childSetValue("build_item_add_disp_rect_txt","Currently set to: "+item->getName()); }else if(itemid.isNull()) { childSetValue("build_item_add_disp_rect_txt","Currently not set"); }else { childSetValue("build_item_add_disp_rect_txt","Currently set to a item not on this account"); } }else { childSetValue("im_give_disp_rect_txt","Not logged in"); childSetValue("build_item_add_disp_rect_txt","Not logged in"); } LLWString auto_response = utf8str_to_wstring( gSavedPerAccountSettings.getString("EmeraldInstantMessageResponse") ); LLWStringUtil::replaceChar(auto_response, '^', '\n'); LLWStringUtil::replaceChar(auto_response, '%', ' '); childSetText("im_response", wstring_to_utf8str(auto_response)); childSetValue("EmeraldInstantMessageResponseFriends", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageResponseFriends")); childSetValue("EmeraldInstantMessageResponseMuted", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageResponseMuted")); childSetValue("EmeraldInstantMessageResponseAnyone", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageResponseAnyone")); childSetValue("EmeraldInstantMessageShowResponded", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageShowResponded")); childSetValue("EmeraldInstantMessageShowOnTyping", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageShowOnTyping")); childSetValue("EmeraldInstantMessageResponseRepeat", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageResponseRepeat" )); childSetValue("EmeraldInstantMessageResponseItem", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageResponseItem")); childSetValue("EmeraldInstantMessageAnnounceIncoming", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageAnnounceIncoming")); childSetValue("EmeraldInstantMessageAnnounceStealFocus", gSavedPerAccountSettings.getBOOL("EmeraldInstantMessageAnnounceStealFocus")); childSetValue("EmeraldShadowsON", gSavedSettings.getBOOL("EmeraldShadowsToggle")); childSetAction("set_mirror", onClickSetMirror, this); childSetCommitCallback("mirror_location", onCommitApplyControl); childSetAction("set_includeHDD", onClickSetHDDInclude, this); childSetCommitCallback("include_location", onCommitApplyControl); //EmeraldLSLExternalEditor childSetAction("set_xed", onClickSetXed, this); childSetCommitCallback("xed_location", onCommitApplyControl); childSetValue("xed_location", gSavedSettings.getString("EmeraldLSLExternalEditor")); getChild<LLCheckBoxCtrl>("telerequest_toggle")->setCommitCallback(onConditionalPreferencesChanged); getChild<LLCheckBoxCtrl>("mldct_toggle")->setCommitCallback(onConditionalPreferencesChanged); refresh(); return TRUE; }
// Color Moved void LLFloaterPostProcess::onColorControlIMoved(LLUICtrl* ctrl, void* userData) { char const * floatVariableName = (char const *)userData; LLSliderCtrl* sldrCtrl = static_cast<LLSliderCtrl*>(ctrl); gPostProcess->tweaks[floatVariableName][3] = sldrCtrl->getValue(); }
void LLPanelDisplay::updateSliderText(LLUICtrl* ctrl, void* user_data) { // get our UI widgets LLTextBox* text_box = (LLTextBox*)user_data; LLSliderCtrl* slider = (LLSliderCtrl*) ctrl; if(text_box == NULL || slider == NULL) { return; } //Hack to display 'Off' for avatar physics slider. if(slider->getName() == "AvatarPhysicsDetail" && !slider->getValueF32()) { text_box->setText(std::string("Off")); return; } // get range and points when text should change F32 range = slider->getMaxValue() - slider->getMinValue(); llassert(range > 0); F32 midPoint = slider->getMinValue() + range / 3.0f; F32 highPoint = slider->getMinValue() + (2.0f * range / 3.0f); // choose the right text if(slider->getValueF32() < midPoint) { text_box->setText(std::string("Low")); } else if (slider->getValueF32() < highPoint) { text_box->setText(std::string("Mid")); } else if(slider->getValueF32() < slider->getMaxValue()) { text_box->setText(std::string("High")); } else { text_box->setText(std::string("Max")); } }