⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 region_node.cpp

📁 彩信浏览器
💻 CPP
📖 第 1 页 / 共 2 页
字号:
		sa = common::sa_right;	else {		lib::logger::get_logger()->trace("%s: Invalid soundAlign value: %s", m_node->get_sig().c_str(), soundalign_attr);		lib::logger::get_logger()->warn(gettext("Ignoring minor errors in document"));	}	AM_DBG lib::logger::get_logger()->debug("region_node::reset: soundAlign=%d", (int)sa);	if (sa != m_soundalign) {		changed = true;	}	set_soundalign(sa);		// backgroundImage		// Note: we simply share a reference to the char* in the DOM tree,	// so we should not free the memory when the region_node gets cleaned up	m_bgimage = m_node->get_attribute("backgroundImage");	// Don't need to set changed		// backgroundRepeat	const char *bgrepeat_attr = m_node->get_attribute("backgroundRepeat");		if (bgrepeat_attr == NULL) {		m_tiling = common::tiling_default;	} else if (strcmp(bgrepeat_attr, "repeat") == 0) {		m_tiling = common::tiling_both;	} else if (strcmp(bgrepeat_attr, "repeatX") == 0) {		m_tiling = common::tiling_horizontal;	} else if (strcmp(bgrepeat_attr, "repeatY") == 0) {		m_tiling = common::tiling_vertical;	} else if (strcmp(bgrepeat_attr, "noRepeat") == 0) {		m_tiling = common::tiling_none;	} else if (strcmp(bgrepeat_attr, "inherit") == 0) {		m_tiling = common::tiling_inherit;	} else {		lib::logger::get_logger()->trace("%s: Invalid backgroundRepeat value: %s", m_node->get_sig().c_str(), bgrepeat_attr);		lib::logger::get_logger()->warn(gettext("Ignoring minor errors in document"));	}	// Don't need to set changed		return changed;}lib::rectregion_node::get_rect() const {	const region_node *inherit_region = NULL;	const region_node *parent_node = up();	switch(m_dim_inherit) {	  case di_parent:		if (parent_node)			inherit_region = parent_node;		break;	  case di_rootlayout:		{			const region_node *root_node = get_root();			const region_node *rootlayout_node = root_node->get_first_child("root-layout");			if (rootlayout_node)				inherit_region = rootlayout_node;		}		break;	  case di_none:		break;	}	lib::rect rc;	if(inherit_region == NULL) {		rc = lib::rect(lib::size(common::default_layout_width, common::default_layout_height)); 	} else {		rc = inherit_region->get_rect();	}	common::region_evaluator re(rc.w, rc.h);	AM_DBG lib::logger::get_logger()->debug("HEIGHT=%s", repr(m_display_rds.height).c_str());	re.set(m_display_rds);	return re.get_rect();} std::stringregion_node::get_name() const {	const char *pid = m_node->get_attribute("id");	if (pid) return pid;	return "";}lib::color_tregion_node::get_bgcolor() const{	if(m_inherit_bgcolor) {		const region_node *parent_node = up();		if (parent_node)			return parent_node->get_bgcolor();	}	return m_display_bgcolor;	//return m_bgcolor;}boolregion_node::get_transparent() const{	return m_transparent;}boolregion_node::get_showbackground() const{	return m_showbackground;}common::tilingregion_node::get_tiling() const{	if(m_tiling == common::tiling_inherit) {		const region_node *inherit_node = NULL;		if (m_dim_inherit == di_parent) {			inherit_node = up();		} else {			const region_node *root_node = get_root();			inherit_node = root_node->get_first_child("root-layout");		}		if (inherit_node)			return inherit_node->get_tiling();	}	return m_tiling;}const char *region_node::get_bgimage() const{	const char *bgimage = m_bgimage;	if (bgimage && strcmp(bgimage, "inherit") == 0) {		const region_node *inherit_node;		if (m_dim_inherit == di_parent) {			inherit_node = up();		} else {			const region_node *root_node = get_root();			inherit_node = root_node->get_first_child("root-layout");		}		if (inherit_node)			bgimage = inherit_node->get_bgimage();		else			bgimage = NULL;	}	if (bgimage && strcmp(bgimage, "none") == 0)		bgimage = NULL;	return bgimage;}voidregion_node::set_bgcolor(lib::color_t c, bool transparent, bool inherit) { 	m_display_bgcolor = m_bgcolor = c;	m_transparent = transparent;	m_inherit_bgcolor = inherit;}// I don't like it that we need this one...region_node * region_node::get_first_child(const char *name) {	region_node *e = down();	if(!e) return 0;	if(e->m_node->get_local_name() == name) return e;	e = e->next();	while(e != 0) {		if(e->m_node->get_local_name() == name) 			return e;		e = e->next();	}	return 0;}const region_node * region_node::get_first_child(const char *name) const {	const region_node *e = down();	if(!e) return 0;	if(e->m_node->get_local_name() == name) return e;	e = e->next();	while(e != 0) {		if(e->m_node->get_local_name() == name) 			return e;		e = e->next();	}	return 0;}/////////////////////////// animation_destination interface// XXX: The implementations below are almost dummycommon::region_dim region_node::get_region_dim(const std::string& which, bool fromdom) const {	const common::region_dim_spec& myrds = fromdom?m_rds:m_display_rds;	if(which == "left") return myrds.left;	else if(which == "width") return myrds.width;	else if(which == "right") return myrds.right;	else if(which == "top") return myrds.top;	else if(which == "height") return myrds.height;	else if(which == "bottom") return myrds.bottom;	assert(false);	return common::region_dim();}lib::color_t region_node::get_region_color(const std::string& which, bool fromdom) const {	if(which == "backgroundColor") {		return fromdom?m_bgcolor:m_display_bgcolor;	}	return 0;}common::zindex_t region_node::get_region_zindex(bool fromdom) const {	return fromdom?m_zindex:m_display_zindex;}double region_node::get_region_soundlevel(bool fromdom) const {	return fromdom?m_soundlevel:m_display_soundlevel;}common::sound_alignment region_node::get_region_soundalign(bool fromdom) const {	return fromdom?m_soundalign:m_display_soundalign;}// Sets the display value of a region dimensionvoid region_node::set_region_dim(const std::string& which, const common::region_dim& rd) {	AM_DBG lib::logger::get_logger()->debug("region_node::set_region_dim(\"%s\", \"%s\") to %s", m_node->get_attribute("id"), which.c_str(), repr(rd).c_str());	common::region_dim_spec& myrds = m_display_rds;	if(which == "left") myrds.left = rd;	else if(which == "width") myrds.width = rd;	else if(which == "right") myrds.right = rd;	else if(which == "top") myrds.top = rd;	else if(which == "height") myrds.height = rd;	else if(which == "bottom") myrds.bottom = rd;}// Sets the display value of the backgroundColor or colorvoid region_node::set_region_color(const std::string& which, lib::color_t clr) {	AM_DBG lib::logger::get_logger()->debug("region_node::set_region_color(\"%s\", \"%s\")", m_node->get_attribute("id"), which.c_str());	if(which == "backgroundColor") m_display_bgcolor = clr;	//else if(which == "color") set_fgcolor(clr);}// Sets the display value of the z-indexvoid region_node::set_region_zindex(common::zindex_t z) {	AM_DBG lib::logger::get_logger()->debug("region_node::set_region_zindex()");	m_display_zindex = z;}// Sets the display value of the sound levelvoid region_node::set_region_soundlevel(double level) {	AM_DBG lib::logger::get_logger()->debug("region_node::set_region_zindex()");	m_display_soundlevel = level;}void region_node::set_region_soundalign(common::sound_alignment sa) {	AM_DBG lib::logger::get_logger()->debug("region_node::set_region_soundalign()");	m_display_soundalign = sa;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -