LLXMLNodePtr LLRNGWriter::createCardinalityNode(LLXMLNodePtr parent_node, S32 min_count, S32 max_count) { // unlinked by default, meaning this attribute is forbidden LLXMLNodePtr count_node = new LLXMLNode(); if (min_count == 0) { if (max_count == 1) { count_node = parent_node->createChild("optional", false); } else if (max_count > 1) { count_node = parent_node->createChild("zeroOrMore", false); } } else if (min_count >= 1) { if (max_count == 1 && min_count == 1) { // just add raw element, will count as 1 and only 1 count_node = parent_node; } else { count_node = parent_node->createChild("oneOrMore", false); } } return count_node; }
// virtual LLXMLNodePtr LLComboBox::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); node->setName(LL_COMBO_BOX_TAG); // Attributes node->createChild("allow_text_entry", TRUE)->setBoolValue(mAllowTextEntry); node->createChild("max_chars", TRUE)->setIntValue(mMaxChars); // Contents std::vector<LLScrollListItem*> data_list = mList->getAllData(); std::vector<LLScrollListItem*>::iterator data_itor; for (data_itor = data_list.begin(); data_itor != data_list.end(); ++data_itor) { LLScrollListItem* item = *data_itor; LLScrollListCell* cell = item->getColumn(0); if (cell) { LLXMLNodePtr item_node = node->createChild("combo_item", FALSE); LLSD value = item->getValue(); item_node->createChild("value", TRUE)->setStringValue(value.asString()); item_node->createChild("enabled", TRUE)->setBoolValue(item->getEnabled()); item_node->setStringValue(cell->getValue().asString()); } } return node; }
// virtual LLXMLNodePtr LLRadioGroup::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); node->setName(LL_RADIO_GROUP_TAG); // Attributes node->createChild("draw_border", TRUE)->setBoolValue(mHasBorder); node->createChild("allow_deselect", TRUE)->setBoolValue(mAllowDeselect); // Contents for (button_list_t::const_iterator iter = mRadioButtons.begin(); iter != mRadioButtons.end(); ++iter) { LLRadioCtrl* radio = *iter; LLXMLNodePtr child_node = radio->getXML(); node->addChild(child_node); } return node; }
// virtual LLXMLNodePtr LLSliderCtrl::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); node->setName(LL_SLIDER_CTRL_TAG); node->createChild("show_text", TRUE)->setBoolValue(mShowText); node->createChild("can_edit_text", TRUE)->setBoolValue(mCanEditText); node->createChild("volume", TRUE)->setBoolValue(mVolumeSlider); node->createChild("decimal_digits", TRUE)->setIntValue(mPrecision); if (mLabelBox) { node->createChild("label", TRUE)->setStringValue(mLabelBox->getText()); } // TomY TODO: Do we really want to export the transient state of the slider? node->createChild("value", TRUE)->setFloatValue(mValue); if (mSlider) { node->createChild("initial_val", TRUE)->setFloatValue(mSlider->getInitialValue()); node->createChild("min_val", TRUE)->setFloatValue(mSlider->getMinValue()); node->createChild("max_val", TRUE)->setFloatValue(mSlider->getMaxValue()); node->createChild("increment", TRUE)->setFloatValue(mSlider->getIncrement()); } addColorXML(node, mTextEnabledColor, "text_enabled_color", "LabelTextColor"); addColorXML(node, mTextDisabledColor, "text_disabled_color", "LabelDisabledColor"); return node; }
// virtual LLXMLNodePtr LLSlider::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); node->createChild("initial_val", TRUE)->setFloatValue(getInitialValue()); node->createChild("min_val", TRUE)->setFloatValue(getMinValue()); node->createChild("max_val", TRUE)->setFloatValue(getMaxValue()); node->createChild("increment", TRUE)->setFloatValue(getIncrement()); node->createChild("volume", TRUE)->setBoolValue(mVolumeSlider); return node; }
// virtual LLXMLNodePtr LLIconCtrl::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); if (mImageName != "") { node->createChild("image_name", TRUE)->setStringValue(mImageName); } node->createChild("color", TRUE)->setFloatValue(4, mColor.mV); return node; }
// virtual LLXMLNodePtr LLMultiSlider::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); node->setName(LL_MULTI_SLIDER_TAG); node->createChild("initial_val", TRUE)->setFloatValue(getInitialValue()); node->createChild("min_val", TRUE)->setFloatValue(getMinValue()); node->createChild("max_val", TRUE)->setFloatValue(getMaxValue()); node->createChild("increment", TRUE)->setFloatValue(getIncrement()); return node; }
// virtual LLXMLNodePtr LLSpinCtrl::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); node->setName(LL_SPIN_CTRL_TAG); node->createChild("decimal_digits", TRUE)->setIntValue(mPrecision); if (mLabelBox) { node->createChild("label", TRUE)->setStringValue(mLabelBox->getText()); node->createChild("label_width", TRUE)->setIntValue(mLabelBox->getRect().getWidth()); if (node->hasAttribute("font")) { node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mFontGL)); } } node->createChild("initial_val", TRUE)->setFloatValue(mInitialValue); node->createChild("min_val", TRUE)->setFloatValue(mMinValue); node->createChild("max_val", TRUE)->setFloatValue(mMaxValue); node->createChild("increment", TRUE)->setFloatValue(mIncrement); addColorXML(node, mTextEnabledColor, "text_enabled_color", "LabelTextColor"); addColorXML(node, mTextDisabledColor, "text_disabled_color", "LabelDisabledColor"); return node; }
LLXMLNodePtr LLJoystick::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(getHAlign())); node->createChild("quadrant", TRUE)->setStringValue(nameFromQuadrant(mInitialQuadrant)); addImageAttributeToXML(node,getImageUnselectedName(),getImageUnselectedID(),std::string("image_unselected")); addImageAttributeToXML(node,getImageSelectedName(),getImageSelectedID(),std::string("image_selected")); node->createChild("scale_image", TRUE)->setBoolValue(getScaleImage()); return node; }
void LLButton::addImageAttributeToXML(LLXMLNodePtr node, const std::string& image_name, const LLUUID& image_id, const std::string& xml_tag_name) const { if( !image_name.empty() ) { node->createChild(xml_tag_name.c_str(), TRUE)->setStringValue(image_name); } else if( image_id != LLUUID::null ) { node->createChild((xml_tag_name + "_id").c_str(), TRUE)->setUUIDValue(image_id); } }
void LLRNGWriter::writeRNG(const std::string& type_name, LLXMLNodePtr node, const LLInitParam::BaseBlock& block, const std::string& xml_namespace) { mGrammarNode = node; mGrammarNode->setName("grammar"); mGrammarNode->createChild("xmlns", true)->setStringValue("http://relaxng.org/ns/structure/1.0"); mGrammarNode->createChild("datatypeLibrary", true)->setStringValue("http://www.w3.org/2001/XMLSchema-datatypes"); mGrammarNode->createChild("ns", true)->setStringValue(xml_namespace); node = mGrammarNode->createChild("start", false); node = node->createChild("ref", false); node->createChild("name", true)->setStringValue(type_name); addDefinition(type_name, block); }
void LLRNGWriter::addDefinition(const std::string& type_name, const LLInitParam::BaseBlock& block) { if (mDefinedElements.find(type_name) != mDefinedElements.end()) return; mDefinedElements.insert(type_name); LLXMLNodePtr node = mGrammarNode->createChild("define", false); node->createChild("name", true)->setStringValue(type_name); mElementNode = node->createChild("element", false); mElementNode->createChild("name", true)->setStringValue(type_name); mChildrenNode = mElementNode->createChild("zeroOrMore", false)->createChild("choice", false); mAttributesWritten.first = mElementNode; mAttributesWritten.second.clear(); mElementsWritten.clear(); block.inspectBlock(*this); // add includes for all possible children const std::type_info* type = *LLWidgetTypeRegistry::instance().getValue(type_name); const widget_registry_t* widget_registryp = LLChildRegistryRegistry::instance().getValue(type); // add include declarations for all valid children for (widget_registry_t::Registrar::registry_map_t::const_iterator it = widget_registryp->currentRegistrar().beginItems(); it != widget_registryp->currentRegistrar().endItems(); ++it) { std::string child_name = it->first; if (child_name == type_name) { continue; } LLXMLNodePtr old_element_node = mElementNode; LLXMLNodePtr old_child_node = mChildrenNode; //FIXME: add LLDefaultParamBlockRegistry back when working on schema generation //addDefinition(child_name, (*LLDefaultParamBlockRegistry::instance().getValue(type))()); mElementNode = old_element_node; mChildrenNode = old_child_node; mChildrenNode->createChild("ref", false)->createChild("name", true)->setStringValue(child_name); } if (mChildrenNode->mChildren.isNull()) { // remove unused children node mChildrenNode->mParent->mParent->deleteChild(mChildrenNode->mParent); } }
// virtual LLXMLNodePtr LLNameListCtrl::getXML(bool save_children) const { LLXMLNodePtr node = LLScrollListCtrl::getXML(); node->createChild("allow_calling_card_drop", TRUE)->setBoolValue(mAllowCallingCardDrop); if (mNameColumnIndex != 0) { node->createChild("name_column_index", TRUE)->setIntValue(mNameColumnIndex); } // Don't save contents, probably filled by code return node; }
// virtual LLXMLNodePtr LLPanel::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); node->setName(LL_PANEL_TAG); if (mBorder && mBorder->getVisible()) { node->createChild("border", TRUE)->setBoolValue(TRUE); } if (!mRectControl.empty()) { node->createChild("rect_control", TRUE)->setStringValue(mRectControl); } if (!mLabel.empty()) { node->createChild("label", TRUE)->setStringValue(mLabel); } ui_string_map_t::const_iterator i = mUIStrings.begin(); ui_string_map_t::const_iterator end = mUIStrings.end(); for (; i != end; ++i) { LLXMLNodePtr child_node = node->createChild("string", FALSE); child_node->setStringValue(i->second); child_node->createChild("name", TRUE)->setStringValue(i->first); } if (save_children) { LLView::child_list_const_reverse_iter_t rit; for (rit = getChildList()->rbegin(); rit != getChildList()->rend(); ++rit) { LLView* childp = *rit; if (childp->getSaveToXML()) { LLXMLNodePtr xml_node = childp->getXML(); node->addChild(xml_node); } } } return node; }
LLXMLNodePtr LLUICtrl::getXML(bool save_children) const { LLXMLNodePtr node = LLView::getXML(save_children); node->createChild("tab_stop", TRUE)->setBoolValue(hasTabStop()); return node; }
// virtual LLXMLNodePtr LLTextureCtrl::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); node->setName(LL_TEXTURE_CTRL_TAG); node->createChild("label", TRUE)->setStringValue(getLabel()); node->createChild("default_image_name", TRUE)->setStringValue(getDefaultImageName()); node->createChild("allow_no_texture", TRUE)->setBoolValue(mAllowNoTexture); node->createChild("can_apply_immediately", TRUE)->setBoolValue(mCanApplyImmediately ); return node; }
// virtual LLXMLNodePtr LLCheckBoxCtrl::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); node->createChild("label", TRUE)->setStringValue(mLabel->getText()); LLString control_name = mButton->getControlName(); node->createChild("initial_value", TRUE)->setBoolValue(mInitialValue); node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mFont)); node->createChild("radio_style", TRUE)->setBoolValue(mRadioStyle); return node; }
// virtual LLXMLNodePtr LLColorSwatchCtrl::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); node->createChild("color", TRUE)->setFloatValue(4, mColor.mV); node->createChild("border_color", TRUE)->setFloatValue(4, mBorderColor.mV); if (mCaption) { node->createChild("label", TRUE)->setStringValue(mCaption->getText()); } node->createChild("can_apply_immediately", TRUE)->setBoolValue(mCanApplyImmediately); return node; }
void LLRNGWriter::addTypeNode(LLXMLNodePtr parent_node, const std::string& type, const std::vector<std::string>* possible_values) { if (possible_values) { LLXMLNodePtr enum_node = parent_node->createChild("choice", false); for (std::vector<std::string>::const_iterator it = possible_values->begin(); it != possible_values->end(); ++it) { enum_node->createChild("value", false)->setStringValue(*it); } } else { parent_node->createChild("data", false)->createChild("type", true)->setStringValue(type); } }
LLXMLNodePtr LLJoystick::getXML(bool save_children) const { LLXMLNodePtr node = LLButton::getXML(); node->createChild("quadrant", TRUE)->setStringValue(nameFromQuadrant(mInitialQuadrant)); return node; }
// virtual LLXMLNodePtr LLInventoryPanel::getXML(bool save_children) const { LLXMLNodePtr node = LLPanel::getXML(false); // Do not print out children node->createChild("allow_multi_select", TRUE)->setBoolValue(mFolders->getAllowMultiSelect()); return node; }
// virtual LLXMLNodePtr LLIconCtrl::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); node->setName(LL_ICON_CTRL_TAG); if (!getImageName().empty()) { node->createChild("image_name", TRUE)->setStringValue(getImageName()); } if (mMinWidth) node->createChild("min_width", true)->setIntValue(mMinWidth); if (mMinHeight) node->createChild("min_height", true)->setIntValue(mMinHeight); node->createChild("color", TRUE)->setFloatValue(4, mColor.mV); return node; }
// virtual LLXMLNodePtr LLTabContainer::getXML(bool save_children) const { LLXMLNodePtr node = LLPanel::getXML(); node->setName(LL_TAB_CONTAINER_COMMON_TAG); node->createChild("tab_position", TRUE)->setStringValue((getTabPosition() == TOP ? "top" : "bottom")); return node; }
// virtual LLXMLNodePtr LLRadioCtrl::getXML(bool save_children) const { LLXMLNodePtr node = LLCheckBoxCtrl::getXML(); node->setName(LL_RADIO_ITEM_TAG); node->createChild("value", TRUE)->setStringValue(mPayload); return node; }
// virtual LLXMLNodePtr LLButton::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); node->createChild("label", TRUE)->setStringValue(getLabelUnselected()); node->createChild("label_selected", TRUE)->setStringValue(getLabelSelected()); node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mGLFont)); node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign)); addImageAttributeToXML(node,mImageUnselectedName,mImageUnselectedID,std::string("image_unselected")); addImageAttributeToXML(node,mImageSelectedName,mImageSelectedID,std::string("image_selected")); addImageAttributeToXML(node,mImageHoverSelectedName,mImageHoverSelectedID,std::string("image_hover_selected")); addImageAttributeToXML(node,mImageHoverUnselectedName,mImageHoverUnselectedID,std::string("image_hover_unselected")); addImageAttributeToXML(node,mImageDisabledName,mImageDisabledID,std::string("image_disabled")); addImageAttributeToXML(node,mImageDisabledSelectedName,mImageDisabledSelectedID,std::string("image_disabled_selected")); node->createChild("scale_image", TRUE)->setBoolValue(mScaleImage); return node; }
// virtual LLXMLNodePtr LLSlider::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); if (mVolumeSlider) { node->setName(LL_VOLUME_SLIDER_CTRL_TAG); } else { node->setName(LL_SLIDER_TAG); } node->createChild("initial_val", TRUE)->setFloatValue(getInitialValue()); node->createChild("min_val", TRUE)->setFloatValue(getMinValue()); node->createChild("max_val", TRUE)->setFloatValue(getMaxValue()); node->createChild("increment", TRUE)->setFloatValue(getIncrement()); node->createChild("volume", TRUE)->setBoolValue(mVolumeSlider); return node; }
// virtual LLXMLNodePtr LLTextBox::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); // Attributes node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mFontGL)); node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign)); addColorXML(node, mTextColor, "text_color", "LabelTextColor"); addColorXML(node, mDisabledColor, "disabled_color", "LabelDisabledColor"); addColorXML(node, mBackgroundColor, "bg_color", "DefaultBackgroundColor"); addColorXML(node, mBorderColor, "border_color", "DefaultHighlightLight"); node->createChild("bg_visible", TRUE)->setBoolValue(mBackgroundVisible); node->createChild("border_visible", TRUE)->setBoolValue(mBorderVisible); node->createChild("border_drop_shadow_visible", TRUE)->setBoolValue(mBorderDropShadowVisible); node->createChild("h_pad", TRUE)->setIntValue(mHPad); node->createChild("v_pad", TRUE)->setIntValue(mVPad); // Contents node->setStringValue(mText); return node; }
// virtual LLXMLNodePtr LLScrollableContainerView::getXML(bool save_children) const { LLXMLNodePtr node = LLUICtrl::getXML(); node->setName(LL_SCROLLABLE_CONTAINER_VIEW_TAG); // Attributes node->createChild("opaque", TRUE)->setBoolValue(mIsOpaque); if (mIsOpaque) { node->createChild("color", TRUE)->setFloatValue(4, mBackgroundColor.mV); } // Contents LLXMLNodePtr child_node = mScrolledView->getXML(); node->addChild(child_node); return node; }
LLXMLNodePtr LLLayoutStack::getXML(bool save_children) const { LLXMLNodePtr node = LLView::getXML(); node->setName(LL_LAYOUT_STACK_TAG); if (mOrientation == HORIZONTAL) { node->createChild("orientation", TRUE)->setStringValue("horizontal"); } else { node->createChild("orientation", TRUE)->setStringValue("vertical"); } if (save_children) { LLView::child_list_const_reverse_iter_t rit; for (rit = getChildList()->rbegin(); rit != getChildList()->rend(); ++rit) { LLView* childp = *rit; if (childp->getSaveToXML()) { LLXMLNodePtr xml_node = childp->getXML(); if (xml_node->hasName(LL_PANEL_TAG)) { xml_node->setName(LL_LAYOUT_PANEL_TAG); } node->addChild(xml_node); } } } return node; }
// virtual LLXMLNodePtr LLPanel::getXML(bool save_children) const { LLXMLNodePtr node = LLView::getXML(); if (mBorder && mBorder->getVisible()) { node->createChild("border", TRUE)->setBoolValue(TRUE); } if (!mRectControl.empty()) { node->createChild("rect_control", TRUE)->setStringValue(mRectControl); } if (!mLabel.empty()) { node->createChild("label", TRUE)->setStringValue(mLabel); } if (save_children) { LLView::child_list_const_reverse_iter_t rit; for (rit = getChildList()->rbegin(); rit != getChildList()->rend(); ++rit) { LLView* childp = *rit; if (childp->getSaveToXML()) { LLXMLNodePtr xml_node = childp->getXML(); node->addChild(xml_node); } } } return node; }