Browse Source

Fix various typos and in-source documentation

Michael Ragazzon 1 year ago
parent
commit
14b06186b5

+ 4 - 4
Include/RmlUi/Core/Context.h

@@ -77,10 +77,10 @@ public:
 	/// @return The current dimensions of the context.
 	Vector2i GetDimensions() const;
 
-	/// Changes the size ratio of 'dp' unit to 'px' unit
+	/// Changes the ratio of the 'dp' unit to the 'px' unit.
 	/// @param[in] dp_ratio The new density-independent pixel ratio of the context.
-	void SetDensityIndependentPixelRatio(float density_independent_pixel_ratio);
-	/// Returns the size ratio of 'dp' unit to 'px' unit
+	void SetDensityIndependentPixelRatio(float dp_ratio);
+	/// Returns the ratio of the 'dp' unit to the 'px' unit.
 	/// @return The current density-independent pixel ratio of the context.
 	float GetDensityIndependentPixelRatio() const;
 
@@ -118,7 +118,7 @@ public:
 
 	/// Enable or disable handling of the mouse cursor from this context.
 	/// When enabled, changes to the cursor name is transmitted through the system interface.
-	/// @param[in] show True to enable mouse cursor handling, false to disable.
+	/// @param[in] enable True to enable mouse cursor handling, false to disable.
 	void EnableMouseCursor(bool enable);
 
 	/// Activate or deactivate a media theme. Themes can be used in RCSS media queries.

+ 3 - 3
Include/RmlUi/Core/Core.h

@@ -121,7 +121,7 @@ RMLUICORE_API bool RemoveContext(const String& name);
 /// @return The desired context, or nullptr if no context exists with the given name.
 RMLUICORE_API Context* GetContext(const String& name);
 /// Fetches a context by index.
-/// @param[in] index The index of the desired context. If this is outside of the valid range of contexts, it will be clamped.
+/// @param[in] index The index of the desired context. If this is outside the valid range of contexts, it will be clamped.
 /// @return The requested context, or nullptr if no contexts exist.
 RMLUICORE_API Context* GetContext(int index);
 /// Returns the number of active contexts.
@@ -132,7 +132,7 @@ RMLUICORE_API int GetNumContexts();
 /// @param[in] file_path The path to the file to load the face from. The path is passed directly to the file interface which is used to load the file.
 /// The default file interface accepts both absolute paths and paths relative to the working directory.
 /// @param[in] fallback_face True to use this font face for unknown characters in other font faces.
-/// @param[in] weight The weight to load when the font face contains multiple weights, otherwise the weight to register the font as. By default it
+/// @param[in] weight The weight to load when the font face contains multiple weights, otherwise the weight to register the font as. By default, it
 /// loads all found font weights.
 /// @return True if the face was loaded successfully, false otherwise.
 RMLUICORE_API bool LoadFontFace(const String& file_path, bool fallback_face = false, Style::FontWeight weight = Style::FontWeight::Auto);
@@ -140,7 +140,7 @@ RMLUICORE_API bool LoadFontFace(const String& file_path, bool fallback_face = fa
 /// @param[in] data The font data.
 /// @param[in] family The family to register the font as.
 /// @param[in] style The style to register the font as.
-/// @param[in] weight The weight to load when the font face contains multiple weights, otherwise the weight to register the font as. By default it
+/// @param[in] weight The weight to load when the font face contains multiple weights, otherwise the weight to register the font as. By default, it
 /// loads all found font weights.
 /// @param[in] fallback_face True to use this font face for unknown characters in other font faces.
 /// @return True if the face was loaded successfully, false otherwise.

+ 4 - 2
Include/RmlUi/Core/Event.h

@@ -45,7 +45,7 @@ enum class EventPhase { None, Capture = 1, Target = 2, Bubble = 4 };
 enum class DefaultActionPhase { None, Target = (int)EventPhase::Target, TargetAndBubble = ((int)Target | (int)EventPhase::Bubble) };
 
 /**
-    An event that propogates through the element hierarchy. Events follow the DOM3 event specification. See
+    An event that propagates through the element hierarchy. Events follow the DOM3 event specification. See
     http://www.w3.org/TR/DOM-Level-3-Events/events.html.
 
     @author Lloyd Weehuizen
@@ -57,6 +57,7 @@ public:
 	Event();
 	/// Constructor
 	/// @param[in] target The target element of this event
+	/// @param[in] id The event id
 	/// @param[in] type The event type
 	/// @param[in] parameters The event parameters
 	/// @param[in] interruptible Can this event have is propagation stopped?
@@ -102,7 +103,8 @@ public:
 
 	/// Returns the value of one of the event's parameters.
 	/// @param key[in] The name of the desired parameter.
-	/// @return The value of the requested parameter.
+	/// @param default_value[in] The default value.
+	/// @return The value of the requested parameter, or the default value if the key does not exist.
 	template <typename T>
 	T GetParameter(const String& key, const T& default_value) const
 	{

+ 9 - 9
Include/RmlUi/Core/Math.h

@@ -97,7 +97,7 @@ namespace Math {
 
 	/// Evaluates if a number is, or close to, zero.
 	/// @param[in] value The number to compare to zero.
-	/// @return True if the number if zero or close to it, false otherwise.
+	/// @return True if the number is zero or close to it, false otherwise.
 	RMLUICORE_API bool IsCloseToZero(float value);
 
 	/// Calculates the absolute value of a number.
@@ -117,18 +117,18 @@ namespace Math {
 	/// @param[in] angle The angle to calculate the cosine of, in radians.
 	/// @return The cosine of the angle.
 	RMLUICORE_API float Cos(float angle);
-	/// Calculates the arc-cosine of an value.
-	/// @param[in] angle The value to calculate the arc-cosine of.
+	/// Calculates the arc-cosine of a value.
+	/// @param[in] value The value to calculate the arc-cosine of.
 	/// @return The angle, in radians.
 	RMLUICORE_API float ACos(float value);
 	/// Calculates the sine of an angle.
 	/// @param[in] angle The angle to calculate the sine of, in radians.
 	/// @return The sine of the angle.
 	RMLUICORE_API float Sin(float angle);
-	/// Calculates the arc-sine of an value.
-	/// @param[in] angle The value to calculate the arc-sine of.
+	/// Calculates the arc-sine of a value.
+	/// @param[in] value The value to calculate the arc-sine of.
 	/// @return The angle, in radians.
-	RMLUICORE_API float ASin(float angle);
+	RMLUICORE_API float ASin(float value);
 	/// Calculates the tangent of an angle.
 	/// @param[in] angle The angle to calculate the tangent of, in radians.
 	/// @return The tanget of the angle.
@@ -148,15 +148,15 @@ namespace Math {
 	RMLUICORE_API int Log2(int value);
 
 	/// Converts an angle from radians to degrees.
-	/// @param[in] The angle, in radians.
+	/// @param[in] angle The angle, in radians.
 	/// @return The angle converted to degrees.
 	RMLUICORE_API float RadiansToDegrees(float angle);
 	/// Converts an angle from degrees to radians.
-	/// @param[in] The angle, in degrees.
+	/// @param[in] angle The angle, in degrees.
 	/// @return The angle converted to radians.
 	RMLUICORE_API float DegreesToRadians(float angle);
 	/// Normalises an angle in radians to [0, 2pi).
-	/// @param[in] The angle, in radians.
+	/// @param[in] angle The angle, in radians.
 	/// @return The normalised angle.
 	RMLUICORE_API float NormaliseAngle(float angle);
 

+ 3 - 3
Source/Core/Context.cpp

@@ -149,11 +149,11 @@ Vector2i Context::GetDimensions() const
 	return dimensions;
 }
 
-void Context::SetDensityIndependentPixelRatio(float _density_independent_pixel_ratio)
+void Context::SetDensityIndependentPixelRatio(float dp_ratio)
 {
-	if (density_independent_pixel_ratio != _density_independent_pixel_ratio)
+	if (density_independent_pixel_ratio != dp_ratio)
 	{
-		density_independent_pixel_ratio = _density_independent_pixel_ratio;
+		density_independent_pixel_ratio = dp_ratio;
 
 		for (int i = 0; i < root->GetNumChildren(true); ++i)
 		{

+ 1 - 1
Source/Core/DataViewDefault.cpp

@@ -41,7 +41,7 @@
 namespace Rml {
 
 // Some data views need to offset the update order for proper behavior.
-//  'data-value' may need other attributes applied first, eg. min/max attributes.
+//  'data-value' may need other attributes applied first, e.g. min/max attributes.
 static constexpr int SortOffset_DataValue = 100;
 //  'data-checked' may need a value attribute already set.
 static constexpr int SortOffset_DataChecked = 110;

+ 2 - 2
Source/Core/Math.cpp

@@ -73,9 +73,9 @@ namespace Math {
 		return sinf(angle);
 	}
 
-	RMLUICORE_API float ASin(float angle)
+	RMLUICORE_API float ASin(float value)
 	{
-		return asinf(angle);
+		return asinf(value);
 	}
 
 	RMLUICORE_API float Tan(float angle)