Пример #1
0
void ElementInfo::BuildPropertiesRML(Core::String& property_rml, const NamedPropertyList& properties)
{
	Core::String last_source;
	int last_source_line = -1;

	for (size_t i = 0; i < properties.size(); ++i)
	{
		if (i == 0 ||
			last_source != properties[i].second->source ||
			last_source_line != properties[i].second->source_line_number)
		{
			last_source = properties[i].second->source;
			last_source_line = properties[i].second->source_line_number;

			property_rml.Append("<h4>");

			if (last_source.Empty() &&
				last_source_line == 0)
				property_rml.Append("<em>inline</em>");
			else
				property_rml.Append(Core::String(last_source.Length() + 32, "<em>%s</em>: %d", last_source.CString(), last_source_line));

			property_rml.Append("</h4>");
		}

		BuildPropertyRML(property_rml, properties[i].first, properties[i].second);
	}
}
Пример #2
0
void ElementInfo::RemoveTrailingZeroes(Core::String& string)
{
	if (string.Empty())
	{
		return;
	}

	// First, check for a decimal point. No point, no chance of trailing zeroes!
	size_t decimal_point_position = string.Find(".");
	if (decimal_point_position != Core::String::npos)
	{
		// Ok, so now we start at the back of the string and find the first
		// numeral. If the character we find is a zero, then we start counting
		// back till we find something that isn't a zero or a decimal point -
		// and then remove all that we've counted.
		size_t last_zero = string.Length() - 1;
		while ((string[last_zero] < '0' || string[last_zero] > '9') && string[last_zero] != '.')
		{
			if (last_zero == 0)
			{
				return;
			}
			if (string[last_zero] == '.')
			{
				break;
			}
			last_zero--;
		}

		if (!(string[last_zero] == '0' || string[last_zero] == '.'))
		{
			return;
		}

		// Now find the first character that isn't a zero (unless we're just
		// chopping off the dangling decimal point)
		size_t first_zero = last_zero;
		if (string[last_zero] == '0')
		{
			while (first_zero > 0 && string[first_zero - 1] == '0')
			{
				first_zero--;
			}

			// Check for a preceeding decimal point - if it's all zeroes until the
			// decimal, then we should remove it too.
			if (string[first_zero - 1] == '.')
			{
				first_zero--;
			}
		}

		// Now remove everything between first_zero and last_zero, inclusive.
		if (last_zero > first_zero)
			string.Erase(first_zero, (last_zero - first_zero) + 1);
	}
}
Пример #3
0
      //
      // PPTokenTBuf::IsNumFlt
      //
      bool PPTokenTBuf::IsNumFlt(Core::String str)
      {
         char const *itr = str.begin(), *end = str.end();

         itr = SkipFlt(itr, end);

         // floating-suffix(opt)
         if(itr == end) return true;
         return (*itr == 'F' || *itr == 'f' || *itr == 'L' || *itr == 'l') && ++itr == end;
      }
Пример #4
0
 static void var(core::String& name, core::String& value)
 {
     if(core::nil == value)
     {
         auto result = ::unsetenv(name.ascii());
         core::certify(!result);
     }
     else
     {
         auto result = ::setenv(name.ascii(), value.ascii(), true);
         core::certify(!result);
     }
 }
Пример #5
0
 static core::String var(core::String& name)
 {
     auto env = ::getenv(name.ascii());
     return env
         ? core::String(env)
         : core::nil;
 }
Пример #6
0
void ElementInfo::BuildPropertyRML(Core::String& property_rml, const Core::String& name, const Core::Property* property)
{
	Core::String property_value = property->ToString();
	RemoveTrailingZeroes(property_value);

	property_rml += Core::String(name.Length() + property_value.Length() + 32, "%s: <em>%s;</em><br />", name.CString(), property_value.CString());
}
Пример #7
0
      //
      // PPTokenTBuf::IsNumInt
      //
      bool PPTokenTBuf::IsNumInt(Core::String str)
      {
         char const *itr = str.begin(), *end = str.end();

         if(*itr == '0')
         {
            ++itr;

            // hexadecimal-constant
            if(*itr == 'X' || *itr == 'x')
               itr = SkipHex(itr, end);

            // octal-constant
            else
               itr = SkipOct(itr, end);
         }

         // decimal-constant
         else if('1' <= *itr && *itr <= '9')
            itr = SkipDec(++itr, end);

         else
            return false;

         // integer-suffix(opt)
         if(itr == end) return true;

         auto upr = [&itr](std::size_t i) {return std::toupper(itr[i]);};

         // unsigned-suffix long-suffix(opt)
         if(end - itr == 1 && upr(0) == 'U') return true;
         if(end - itr == 2 && upr(0) == 'U' && upr(1) == 'L') return true;

         // unsigned-suffix long-long-suffix
         if(end - itr == 3 && upr(0) == 'U' && upr(1) == 'L' && itr[2] == itr[1]) return true;

         // long-suffix unsigned-suffix(opt)
         if(end - itr == 1 && upr(0) == 'L') return true;
         if(end - itr == 2 && upr(0) == 'L' && upr(1) == 'U') return true;

         // long-long-suffix unsigned-suffix(opt)
         if(end - itr == 2 && upr(0) == 'L' && itr[1] == itr[0]) return true;
         if(end - itr == 3 && upr(0) == 'L' && itr[1] == itr[0] && upr(2) == 'U') return true;

         return false;
      }
Пример #8
0
      //
      // PPTokenTBuf::IsNumFix
      //
      bool PPTokenTBuf::IsNumFix(Core::String str)
      {
         char const *itr = str.begin(), *end = str.end();

         itr = SkipFlt(itr, end);

         // unsigned-suffix(opt)
         if(itr == end) return false;
         if(*itr == 'U' || *itr == 'u') ++itr;

         // fxp-suffix(opt)
         if(itr == end) return false;
         if(*itr == 'L' || *itr == 'l' || *itr == 'H' || *itr == 'h') ++itr;

         // fixed-qual
         if(itr == end) return false;
         return (*itr == 'K' || *itr == 'k' || *itr == 'R' || *itr == 'r') && ++itr == end;
      }
Пример #9
0
void ShowAssertWindow(Core::String msg)
{
	AssertWnd wnd;

	wnd.SetText(msg.CStrPtr());
	wnd.ShowModal();

	ExitProcess(1U);
}
Пример #10
0
void
CSS2Properties::
setProperty(const Core::String& n, const Core::String& v)
{
  if (v.Empty()) {
    getRocket()->RemoveProperty(n);
  } else {
    getRocket()->SetProperty(n, v);
  }
}
Пример #11
0
void ElementLog::OnRender()
{
	Core::ElementDocument::OnRender();

	if (dirty_logs)
	{
		// Set the log content:
		Core::String messages;
		if (message_content)
		{
			unsigned int log_pointers[Core::Log::LT_MAX];
			for (int i = 0; i < Core::Log::LT_MAX; i++)
				log_pointers[i] = 0;
			int next_type = FindNextEarliestLogType(log_pointers);
			int num_messages = 0;
			while (next_type != -1 && num_messages < MAX_LOG_MESSAGES)
			{
				messages.Append(Core::String(128, "<div class=\"log-entry\"><div class=\"icon %s\">%s</div><p class=\"message\">", log_types[next_type].class_name.CString(), log_types[next_type].alert_contents.CString()));
				messages.Append(log_types[next_type].log_messages[log_pointers[next_type]].message);
				messages.Append("</p></div>");
				
				log_pointers[next_type]++;
				next_type = FindNextEarliestLogType(log_pointers);
				num_messages++;
			}

			if (message_content->HasChildNodes())
			{
				float last_element_top = message_content->GetLastChild()->GetAbsoluteTop();
				auto_scroll = message_content->GetAbsoluteTop() + message_content->GetAbsoluteTop() > last_element_top;
			}
			else
				auto_scroll = true;

			message_content->SetInnerRML(messages);		

			dirty_logs = false;
		}
	}
}
Пример #12
0
	void split(core::String src, char c, core::Vector<core::String>& dst)
	{
		int index = src.find_first_not_of(' ');
		if(index == -1)
			return;
		do{

			int idx = src.find(c);
			if(idx != -1)
			{
				core::String sub = src.substr(0, idx);
				src = src.substr(idx+1, src.size());
				dst.push_back(sub);
			}
			else
			{
				dst.push_back(src);
				break;
			}

		}while(1);

	}
Пример #13
0
   //
   // Info::lenString
   //
   std::size_t Info::lenString(Core::String s)
   {
      std::size_t len = 0;

      for(auto i = s.begin(), e = s.end(); i != e; ++i) switch(*i)
      {
      case '\0':
         if('0' <= i[1] && i[1] <= '7')
            len += 4;
         else
            len += 2;
         break;

      case '\\':
         len += 2;
         break;

      default:
         len += 1;
         break;
      }

      return len + 1;
   }
// Strips all \n and \r characters from the string.
void WidgetTextInputSingleLine::SanitiseValue(Core::String& value)
{
    Core::String new_value;
    for (Core::String::size_type i = 0; i < value.Length(); ++i)
    {
        switch (value[i])
        {
        case '\n':
        case '\r':
        case '\t':
            break;

        default:
            new_value += value[i];
        }
    }

    value = new_value;
}
Пример #15
0
	const wxString Common::PunkStringToWxString(const Core::String& value) {
		return wxString((wchar_t*)value.Data(), value.Length());
	}
Пример #16
0
 static core::int64 execute(core::String& command)
 {
     return ::system(command.ascii());
 }
Пример #17
0
		//------------------------------------------------------------------------------------
		// Creates the terrain shader code for deferred shading
		//------------------------------------------------------------------------------------
		void TileTerrain2::CreateDeferredShaderCode( core::String &VertexCode, core::String &PixelCode )
		{
			// Create vertex shader
			VertexCode = "float4x4 matViewProjection;\n"\
				"float4x4 matView;\n";
			VertexCode += "struct VS_INPUT\n"\
				"{\n"\
				"float4 Position : POSITION0;\n"\
				"float3 Normal : NORMAL;\n"\
				"float2 Texcoord : TEXCOORD0;\n"\
				"float4 color : COLOR0;\n";
			if (m_pMaterial[0].ppTexture[1])
			{
				VertexCode += "   float3 Binormal : BINORMAL0;\n"\
					"   float3 Tangent :  TANGENT0;\n";
			}
			VertexCode += "};\n"\
				"struct VS_OUTPUT \n"\
				"{\n"\
				"float4 Position : POSITION0;\n"\
				"float2 Texcoord : TEXCOORD0;\n"\
				"float	Height: TEXCOORD2;\n"\
				"float3	Normal: TEXCOORD3;\n"\
				"float4 depth: TEXCOORD4;\n"\
				"float4 color : COLOR0;\n";
			if (m_pMaterial[0].ppTexture[1])
			{
				VertexCode +=    
					"float3	BiNormal: TEXCOORD5;\n"\
					"float3	Tangent: TEXCOORD6;\n";
			}

			VertexCode += "};\n"\
				"VS_OUTPUT main( VS_INPUT Input )\n"\
				"{\n"\
				"VS_OUTPUT Output;\n"\
				"Output.Position = mul( Input.Position, matViewProjection );\n"\
				"Output.depth = mul( Input.Position, matView );\n"\
				"Output.Texcoord = Input.Texcoord;\n"\
				"Output.Height = Input.Position.y / 25.0;\n"\
				"Output.color = Input.color;\n";
			if (m_pMaterial[0].ppTexture[1])
			{
 				VertexCode +=    
 					"Output.Normal         = Input.Normal;\n"\
 					"Output.BiNormal       = Input.Binormal;\n"\
 					"Output.Tangent        = Input.Tangent;\n";
			}
			else
			{
				VertexCode +=    
					"Output.Normal         = Input.Normal;\n";

			}

			VertexCode += 	"return( Output );\n"\
				"}";



			// Create pixel shader
			PixelCode  = "sampler2D baseMap;\n"\
				"sampler2D BlendMap;\n"\
				"sampler2D TextureBlend: register(s2);\n"\
				"sampler2D TextureID: register(s3);\n"\
				"sampler2D TextureUnder: register(s4);\n";

			if (m_pMaterial[0].ppTexture[1])
			{
				PixelCode += "sampler2D bumpMap: register(s1);\n";
			}

			/// This function evaluates the mipmap LOD level for a 2D texture using the given texture coordinates
			/// and texture size (in pixels)
			PixelCode +=
				"float mipmapLevel(float2 uv, float textureSize)\n"\
				"{\n"\
				"    float2 dx = ddx(uv * textureSize);\n"\
				"    float2 dy = ddy(uv * textureSize);\n"\
				"    float d = max(dot(dx, dx), dot(dy, dy));\n"\
				"    return 0.5 * log2(d);\n"\
				"}\n";
			/// This function samples a texture with tiling and mipmapping from within a texture pack of the given
			/// attributes
			/// - tex is the texture pack from which to sample a tile
			/// - uv are the texture coordinates of the pixel *inside the tile*
			/// - tile are the coordinates of the tile within the pack (ex.: 2, 1)
			/// - packTexFactors are some constants to perform the mipmapping and tiling
			/// Texture pack factors:
			/// - inverse of the number of horizontal tiles (ex.: 4 tiles -> 0.25)
			/// - inverse of the number of vertical tiles (ex.: 2 tiles -> 0.5)
			/// - size of a tile in pixels (ex.: 1024)
			/// - amount of bits representing the power-of-2 of the size of a tile (ex.: a 1024 tile is 10 bits).
			PixelCode +=
				"float4 sampleTexturePackMipWrapped(in float2 uv, const in float2 tile,\n"\
				"	const in float4 packTexFactors)\n"\
				"{\n"\
				" 	/// estimate mipmap/LOD level\n"\
				"	float lod = mipmapLevel(uv, packTexFactors.z);\n"\
				"	lod = clamp(lod, 0.0, packTexFactors.w);\n"\
				"\n"\
				"	/// get width/height of the whole pack texture for the current lod level\n"\
				"	float size = pow(2.0, packTexFactors.w - lod);\n"\
				"	float sizex = size / packTexFactors.x; // width in pixels\n"\
				"	float sizey = size / packTexFactors.y; // height in pixels\n"\
				"\n"\
				"	/// perform tiling\n"\
				"	uv = frac(uv);\n"\
				"\n"\
				"	/// tweak pixels for correct bilinear filtering, and add offset for the wanted tile\n"\
				"	uv.x = uv.x * ((sizex * packTexFactors.x - 1.0) / sizex) + 0.5 / sizex + packTexFactors.x * tile.x;\n"\
				"	uv.y = uv.y * ((sizey * packTexFactors.y - 1.0) / sizey) + 0.5 / sizey + packTexFactors.y * tile.y;\n"\
				"\n"\
				"    return float4(uv, lod, 0);\n"\
				"}\n";

			PixelCode += 
				"struct PS_OUTPUT \n"\
				"{\n"\
				"	float4 outpos: COLOR0;\n"\
				"	float4 outdif: COLOR1;\n"\
				"	float4 outnor: COLOR2;\n"\
				"};\n"\
				"struct PS_INPUT \n"\
				"{\n"\
				"	float2 Texcoord : TEXCOORD0;\n"\
				"	float	Height: TEXCOORD2;\n"\
				"	float3	Normal: TEXCOORD3;\n"\
				"	float4 depth: TEXCOORD4;\n"\
				"   float4 color : COLOR0;\n";
			if (m_pMaterial[0].ppTexture[1])
			{
				PixelCode += 
					"float3	BiNormal: TEXCOORD5;\n"\
					"float3	Tangent: TEXCOORD6;\n";
			}
			PixelCode += "};\n"\
				"half4 encode (half3 n)\n"\
				"{\n"\
				"	half p = sqrt(n.z*8+8);\n"\
				"	return half4(n.xy/p + 0.5,0,0);\n"\
				"}\n"\
				"PS_OUTPUT main( PS_INPUT Input )\n"\
				"{\n"\
				"	PS_OUTPUT outps;\n";
			// if want under water coloring
			if (m_bWater)
			{
				PixelCode += "	float4 c1 = float4(";
				PixelCode += m_cStart.c[0];
				PixelCode += ", ";
				PixelCode += m_cStart.c[1];
				PixelCode += ", ";
				PixelCode += m_cStart.c[2];
				PixelCode += ", 1);\n"\
					"	float4 c2 = float4(";
				PixelCode += m_cEnd.c[0];
				PixelCode += ", ";
				PixelCode += m_cEnd.c[1];
				PixelCode += ", ";
				PixelCode += m_cEnd.c[2];
				PixelCode += ", 1);\n";			
			}

			//------------------------------------------------------------------------------------
			// Testing start
			//------------------------------------------------------------------------------------
			// finding the tileid
			PixelCode += "	float4 id = tex2D(TextureID, (Input.Texcoord % 64.0) / 64.0);//return id.ragb;\n"\
				"	int2 tileid; tileid = id.ra * 64.0;\n"\
				"	float4 f4TileID; f4TileID.xz = tileid % ";
			PixelCode += m_iTileH / m_iTileSizeInPixel;
			PixelCode += "; f4TileID.yw = tileid / ";
			PixelCode += m_iTileW / m_iTileSizeInPixel;
			PixelCode += ";\n";
			// Calculate the UVs.
			PixelCode += "	float4 c = sampleTexturePackMipWrapped(Input.Texcoord *";
			float fUV  = 1.0 / (m_iTileSizeInPixel / 64.0);
			PixelCode += fUV;
			PixelCode += "\n, f4TileID.xy, float4(";
			PixelCode += m_fHTilesCountInverse;
			PixelCode += ", ";
			PixelCode += m_fVTilesCountInverse;
			PixelCode += ", ";
			PixelCode += m_iTileSizeInPixel;
			PixelCode += ", ";
			PixelCode += m_iBitCount;
			PixelCode += "));\n"\
				"	float4 d = sampleTexturePackMipWrapped(Input.Texcoord *";
			PixelCode += fUV;
			PixelCode += "\n, f4TileID.zw, float4(";
			PixelCode += m_fHTilesCountInverse;
			PixelCode += ", ";
			PixelCode += m_fVTilesCountInverse;
			PixelCode += ", ";
			PixelCode += m_iTileSizeInPixel;
			PixelCode += ", ";
			PixelCode += m_iBitCount;
			PixelCode += "));\n"\
				"	float4 a = tex2D(TextureBlend, frac(Input.Texcoord * 0.015625));//return a.a;\n";
			// Normal map
			if (m_pMaterial[0].ppTexture[1])
			{
				PixelCode += 
					"float3 fvNormal         = tex2Dlod( bumpMap, c ).wyz;\n"\
					"fvNormal = (1 - a.a) * fvNormal + a.a * tex2Dlod( bumpMap, d ).wyz;\n"\
					"fvNormal = fvNormal - float3(0.5,0.5,0.5);\n"\
					"float3 Nn = normalize(Input.Normal);\n"\
					"float3 Tn = normalize(Input.Tangent);\n"\
					"float3 Bn = normalize(Input.BiNormal);\n"\
					"Nn = Nn + fvNormal.x*Tn + fvNormal.y*Bn;\n"\
					"Nn = normalize(Nn);\n"\
					"//fvNormal = normalize(fvNormal.x * Input.Tangent + fvNormal.y * Input.BiNormal + fvNormal.z * Input.Normal);\n"\
					"outps.outpos = float4(length(Input.depth), Nn.z, 0.0, 0.0);\n"\
					"outps.outnor = Nn.xyxy;\n";
			}
			PixelCode += "	float4 b1 = tex2Dlod(baseMap, c);\n"\
				"	float4 b2 = tex2Dlod(baseMap, d);\n"\
				"	float4 r = b2 * a.a + (1 - a.a) * b1;\n";
			if (m_bWater || m_bCaustics)
			{
				PixelCode += "	float4 col = float4(1, 1, 1, 1);\n"\
					"	if (Input.Height < 0.0)\n"\
					"	{\n"\
					"		Input.Height *= -1.0;\n";
				if (m_bWater)
				{
					PixelCode += "	col = lerp(c1, c2, Input.Height);\n";
				}
				if (m_bCaustics)
				{
					PixelCode += "	float4 under = tex2D(TextureUnder, Input.Texcoord * 0.1);\n";
					if (m_bWater)
						PixelCode += "	col += under / ((Input.Height * 0.2 + 1.5) );\n";
					else
						PixelCode += "	col = under / ((Input.Height * 0.2 + 1.5) * 0.5);\n";
				}				
				PixelCode += "	}\n";
			}
			//  			if (m_bReceiveShadow)
			//  			{
			//  				PixelCode += "Input.ProjTex.xy /=  Input.ProjTex.w;\n"\
			//  					"Input.ProjTex.x   =  0.5f * Input.ProjTex.x + 0.5f;\n"\
			//  					"Input.ProjTex.y   = -0.5f * Input.ProjTex.y + 0.5f;\n";
			//  			}
			PixelCode += "	outps.outdif = r * Input.color ";
			if (m_bWater || m_bCaustics)
			{
				PixelCode += " * col";
			}
			PixelCode += ";\n"\
				"	return outps;\n"\
				"}\n";

			io::Logger::Log(VertexCode.ToCharPointer());
			io::Logger::Log(PixelCode.ToCharPointer());
			// 			io::File f;
			// 			f.Open("e:/ter2ps.txt", true);
			// 			f.write((void*)PixelCode.ToCharPointer(), PixelCode.GetLenght());
			// 			f.Open("e:/ter2vs.txt", true);
			// 			f.write((void*)VertexCode.ToCharPointer(), VertexCode.GetLenght());

		} // CreateDeferredShaderCode
Пример #18
0
void ElementInfo::BuildElementPropertiesRML(Core::String& property_rml, Core::Element* element, Core::Element* primary_element)
{
	NamedPropertyMap property_map;

	int property_index = 0;
	Core::String property_name;
	Core::PseudoClassList property_pseudo_classes;
	const Core::Property* property;

	while (element->IterateProperties(property_index, property_pseudo_classes, property_name, property))
	{
		// Check that this property isn't overridden or just not inherited.
		if (primary_element->GetProperty(property_name) != property)
			continue;

		NamedPropertyMap::iterator i = property_map.find(property_pseudo_classes);
		if (i == property_map.end())
			property_map[property_pseudo_classes] = NamedPropertyList(1, NamedProperty(property_name, property));
		else
		{
			// Find a place in this list of properties to insert the new one.
			NamedPropertyList& properties = (*i).second;
			NamedPropertyList::iterator insert_iterator = properties.begin();
			while (insert_iterator != properties.end())
			{
				int source_cmp = strcasecmp((*insert_iterator).second->source.CString(), property->source.CString());
				if (source_cmp > 0 ||
					(source_cmp == 0 && (*insert_iterator).second->source_line_number >= property->source_line_number))
					break;

				++insert_iterator;
			}

			(*i).second.insert(insert_iterator, NamedProperty(property_name, property));
		}
	}

	if (!property_map.empty())
	{
		// Print the 'inherited from ...' header if we're not the primary element.
		if (element != primary_element)
			property_rml += Core::String(element->GetTagName().Length() + 32, "<h3>inherited from %s</h3>", element->GetTagName().CString());

		NamedPropertyMap::iterator base_properties = property_map.find(Core::PseudoClassList());
		if (base_properties != property_map.end())
			BuildPropertiesRML(property_rml, (*base_properties).second);

		for (NamedPropertyMap::iterator i = property_map.begin(); i != property_map.end(); ++i)
		{
			// Skip the base property list, we've already printed it.
			if (i == base_properties)
				continue;

			// Print the pseudo-class header.
			property_rml.Append("<h3>");

			for (Core::PseudoClassList::const_iterator j = (*i).first.begin(); j != (*i).first.end(); ++j)
			{
				property_rml.Append(" :");
				property_rml.Append(*j);
			}

			property_rml.Append("</h3>");

			BuildPropertiesRML(property_rml, (*i).second);
		}
	}

	if (element->GetParentNode() != NULL)
		BuildElementPropertiesRML(property_rml, element->GetParentNode(), primary_element);
}
Пример #19
0
void ElementInfo::UpdateSourceElement()
{
	// Set the title:
	Core::Element* title_content = GetElementById("title-content");
	if (title_content != NULL)
	{
		if (source_element != NULL)
			title_content->SetInnerRML(source_element->GetTagName());
		else
			title_content->SetInnerRML("Element Information");
	}

	// Set the attributes:
	Core::Element* attributes_content = GetElementById("attributes-content");
	if (attributes_content)
	{
		int index = 0;
		Core::String name;
		Core::String value;
		Core::String attributes;

		if (source_element != NULL)
		{
			while (source_element->IterateAttributes(index, name, value))
				attributes.Append(Core::String(name.Length() + value.Length() + 32, "%s: <em>%s</em><br />", name.CString(), value.CString()));
		}

		if (attributes.Empty())
		{
			while (attributes_content->HasChildNodes())
				attributes_content->RemoveChild(attributes_content->GetChild(0));
		}
		else
			attributes_content->SetInnerRML(attributes);
	}

	// Set the properties:
	Core::Element* properties_content = GetElementById("properties-content");
	if (properties_content)
	{
		Core::String properties;
		if (source_element != NULL)
			BuildElementPropertiesRML(properties, source_element, source_element);

		if (properties.Empty())
		{
			while (properties_content->HasChildNodes())
				properties_content->RemoveChild(properties_content->GetChild(0));
		}
		else
			properties_content->SetInnerRML(properties);
	}

	// Set the position:
	Core::Element* position_content = GetElementById("position-content");
	if (position_content)
	{
		// left, top, width, height.
		if (source_element != NULL)
		{
			Core::Vector2f element_offset = source_element->GetRelativeOffset(Core::Box::BORDER);
			Core::Vector2f element_size = source_element->GetBox().GetSize(Core::Box::BORDER);

			Core::String positions;
			positions.Append(Core::String(64, "left: <em>%.0fpx</em><br />", element_offset.x));
			positions.Append(Core::String(64, "top: <em>%.0fpx</em><br />", element_offset.y));
			positions.Append(Core::String(64, "width: <em>%.0fpx</em><br />", element_size.x));
			positions.Append(Core::String(64, "height: <em>%.0fpx</em><br />", element_size.y));

			position_content->SetInnerRML(positions);
		}
		else
		{
			while (position_content->HasChildNodes())
				position_content->RemoveChild(position_content->GetFirstChild());
		}
	}

	// Set the ancestors:
	Core::Element* ancestors_content = GetElementById("ancestors-content");
	if (ancestors_content)
	{
		Core::String ancestors;
		Core::Element* element_ancestor = NULL;
		if (source_element != NULL)
			element_ancestor = source_element->GetParentNode();

		int ancestor_depth = 1;
		while (element_ancestor)
		{
			Core::String ancestor_name = element_ancestor->GetTagName();
			const Core::String ancestor_id = element_ancestor->GetId();
			if (!ancestor_id.Empty())
			{
				ancestor_name += "#";
				ancestor_name += ancestor_id;
			}

			ancestors.Append(Core::String(ancestor_name.Length() + 32, "<p id=\"a %d\">%s</p>", ancestor_depth, ancestor_name.CString()));
			element_ancestor = element_ancestor->GetParentNode();
			ancestor_depth++;
		}

		if (ancestors.Empty())
		{
			while (ancestors_content->HasChildNodes())
				ancestors_content->RemoveChild(ancestors_content->GetFirstChild());
		}
		else
			ancestors_content->SetInnerRML(ancestors);
	}

	// Set the children:
	Core::Element* children_content = GetElementById("children-content");
	if (children_content)
	{
		Core::String children;
		if (source_element != NULL)
		{
			for (int i = 0; i < source_element->GetNumChildren(); i++)
			{
				Core::Element* child = source_element->GetChild(i);

				// If this is a debugger document, do not show it.
				if (IsDebuggerElement(child))
					continue;

				Core::String child_name = child->GetTagName();
				const Core::String child_id = child->GetId();
				if (!child_id.Empty())
				{
					child_name += "#";
					child_name += child_id;
				}

				children.Append(Core::String(child_name.Length() + 32, "<p id=\"c %d\">%s</p>", i, child_name.CString()));
			}
		}

		if (children.Empty())
		{
			while (children_content->HasChildNodes())
				children_content->RemoveChild(children_content->GetChild(0));
		}
		else
			children_content->SetInnerRML(children);
	}
}