当前位置: 首页>>代码示例>>C++>>正文


C++ LLXUIParser::writeXUI方法代码示例

本文整理汇总了C++中LLXUIParser::writeXUI方法的典型用法代码示例。如果您正苦于以下问题:C++ LLXUIParser::writeXUI方法的具体用法?C++ LLXUIParser::writeXUI怎么用?C++ LLXUIParser::writeXUI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LLXUIParser的用法示例。


在下文中一共展示了LLXUIParser::writeXUI方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: saveUserSettings

void LLUIColorTable::saveUserSettings() const
{
	Params params;

	for(string_color_map_t::const_iterator it = mUserSetColors.begin();
		it != mUserSetColors.end();
		++it)
	{
		ColorEntryParams color_entry;
		color_entry.name = it->first;
		color_entry.color.value = it->second;

		params.color_entries.add(color_entry);
	}

	LLXMLNodePtr output_node = new LLXMLNode("colors", false);
	LLXUIParser parser;
	parser.writeXUI(output_node, params);

	if(!output_node->isNull())
	{
		const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "colors.xml");
		LLFILE *fp = LLFile::fopen(filename, "w");

		if(fp != NULL)
		{
			LLXMLNode::writeHeaderToFile(fp);
			output_node->writeToFile(fp);

			fclose(fp);
		}
	}
}
开发者ID:HizWylder,项目名称:GIS,代码行数:33,代码来源:lluicolortable.cpp

示例2: saveToolbars

void LLToolBarView::saveToolbars() const
{
	if (!mToolbarsLoaded)
		return;
	
	// Build the parameter tree from the toolbar data
	LLToolBarView::ToolbarSet toolbar_set;
	if (mToolbars[TOOLBAR_LEFT])
	{
		toolbar_set.left_toolbar.button_display_mode = mToolbars[TOOLBAR_LEFT]->getButtonType();
		toolbar_set.left_toolbar.button_alignment = mToolbars[TOOLBAR_LEFT]->getAlignment();	// <FS_Zi>
		toolbar_set.left_toolbar.button_layout_style = mToolbars[TOOLBAR_LEFT]->getLayoutStyle();	// <FS_Zi>
		addToToolset(mToolbars[TOOLBAR_LEFT]->getCommandsList(), toolbar_set.left_toolbar);
	}
	if (mToolbars[TOOLBAR_RIGHT])
	{
		toolbar_set.right_toolbar.button_display_mode = mToolbars[TOOLBAR_RIGHT]->getButtonType();
		toolbar_set.right_toolbar.button_alignment = mToolbars[TOOLBAR_RIGHT]->getAlignment();	// <FS_Zi>
		toolbar_set.right_toolbar.button_layout_style = mToolbars[TOOLBAR_RIGHT]->getLayoutStyle();	// <FS_Zi>
		addToToolset(mToolbars[TOOLBAR_RIGHT]->getCommandsList(), toolbar_set.right_toolbar);
	}
	if (mToolbars[TOOLBAR_BOTTOM])
	{
		toolbar_set.bottom_toolbar.button_display_mode = mToolbars[TOOLBAR_BOTTOM]->getButtonType();
		toolbar_set.bottom_toolbar.button_alignment = mToolbars[TOOLBAR_BOTTOM]->getAlignment();	// <FS_Zi>
		toolbar_set.bottom_toolbar.button_layout_style = mToolbars[TOOLBAR_BOTTOM]->getLayoutStyle();	// <FS_Zi>
		addToToolset(mToolbars[TOOLBAR_BOTTOM]->getCommandsList(), toolbar_set.bottom_toolbar);
	}
	
	// Serialize the parameter tree
	LLXMLNodePtr output_node = new LLXMLNode("toolbars", false);
	LLXUIParser parser;
	parser.writeXUI(output_node, toolbar_set);
	
	// Write the resulting XML to file
	if(!output_node->isNull())
	{
		const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "toolbars.xml");
		LLFILE *fp = LLFile::fopen(filename, "w");
		if (fp != NULL)
		{
			LLXMLNode::writeHeaderToFile(fp);
			output_node->writeToFile(fp);
			fclose(fp);
		}
	}
}
开发者ID:JohnMcCaffery,项目名称:Armadillo-Phoenix,代码行数:47,代码来源:lltoolbarview.cpp

示例3: initPanelXML

BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr output_node, const LLPanel::Params& default_params)
{
	Params params(default_params);
	{
		LLFastTimer timer(FTM_PANEL_SETUP);

		LLXMLNodePtr referenced_xml;
		std::string xml_filename = mXMLFilename;
		
		// if the panel didn't provide a filename, check the node
		if (xml_filename.empty())
		{
			node->getAttributeString("filename", xml_filename);
			setXMLFilename(xml_filename);
		}

		LLXUIParser parser;

		if (!xml_filename.empty())
		{
			LLUICtrlFactory::instance().pushFileName(xml_filename);

			LLFastTimer timer(FTM_EXTERNAL_PANEL_LOAD);
			if (output_node)
			{
				//if we are exporting, we want to export the current xml
				//not the referenced xml
				parser.readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName());
				Params output_params(params);
				setupParamsForExport(output_params, parent);
				output_node->setName(node->getName()->mString);
				parser.writeXUI(output_node, output_params, &default_params);
				return TRUE;
			}
		
			if (!LLUICtrlFactory::getLayeredXMLNode(xml_filename, referenced_xml))
			{
				llwarns << "Couldn't parse panel from: " << xml_filename << llendl;

				return FALSE;
			}

			parser.readXUI(referenced_xml, params, LLUICtrlFactory::getInstance()->getCurFileName());

			// add children using dimensions from referenced xml for consistent layout
			setShape(params.rect);
			LLUICtrlFactory::createChildren(this, referenced_xml, child_registry_t::instance());

			LLUICtrlFactory::instance().popFileName();
		}

		// ask LLUICtrlFactory for filename, since xml_filename might be empty
		parser.readXUI(node, params, LLUICtrlFactory::getInstance()->getCurFileName());

		if (output_node)
		{
			Params output_params(params);
			setupParamsForExport(output_params, parent);
			output_node->setName(node->getName()->mString);
			parser.writeXUI(output_node, output_params, &default_params);
		}
		
		params.from_xui = true;
		applyXUILayout(params, parent);
		{
			LLFastTimer timer(FTM_PANEL_CONSTRUCTION);
			initFromParams(params);
		}

		// add children
		LLUICtrlFactory::createChildren(this, node, child_registry_t::instance(), output_node);

		// Connect to parent after children are built, because tab containers
		// do a reshape() on their child panels, which requires that the children
		// be built/added. JC
		if (parent)
		{
			S32 tab_group = params.tab_group.isProvided() ? params.tab_group() : parent->getLastTabGroup();
			parent->addChild(this, tab_group);
		}

		{
			LLFastTimer timer(FTM_PANEL_POSTBUILD);
			postBuild();
		}
	}
	return TRUE;
}
开发者ID:Krazy-Bish-Margie,项目名称:Thunderstorm,代码行数:88,代码来源:llpanel.cpp


注:本文中的LLXUIParser::writeXUI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。