mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-18 09:08:08 +08:00
Casting and documentation fixes (#608)
Add `-wDocumentation` option. Fix the documentation. Fix c++20/c++17 confusion in tests. Co-authored-by: ArthurSonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
@@ -321,11 +321,11 @@ void Canvas::DrawPointEllipse(int x,
|
||||
}
|
||||
|
||||
/// @brief Draw an ellipse made of braille dots.
|
||||
/// @param x the x coordinate of the center of the ellipse.
|
||||
/// @param y the y coordinate of the center of the ellipse.
|
||||
/// @param x1 the x coordinate of the center of the ellipse.
|
||||
/// @param y1 the y coordinate of the center of the ellipse.
|
||||
/// @param r1 the radius of the ellipse along the x axis.
|
||||
/// @param r2 the radius of the ellipse along the y axis.
|
||||
/// @param style the style of the ellipse.
|
||||
/// @param s the style of the ellipse.
|
||||
void Canvas::DrawPointEllipse(int x1,
|
||||
int y1,
|
||||
int r1,
|
||||
@@ -361,8 +361,8 @@ void Canvas::DrawPointEllipse(int x1,
|
||||
}
|
||||
|
||||
/// @brief Draw a filled ellipse made of braille dots.
|
||||
/// @param x the x coordinate of the center of the ellipse.
|
||||
/// @param y the y coordinate of the center of the ellipse.
|
||||
/// @param x1 the x coordinate of the center of the ellipse.
|
||||
/// @param y1 the y coordinate of the center of the ellipse.
|
||||
/// @param r1 the radius of the ellipse along the x axis.
|
||||
/// @param r2 the radius of the ellipse along the y axis.
|
||||
void Canvas::DrawPointEllipseFilled(int x1, int y1, int r1, int r2) {
|
||||
@@ -370,8 +370,8 @@ void Canvas::DrawPointEllipseFilled(int x1, int y1, int r1, int r2) {
|
||||
}
|
||||
|
||||
/// @brief Draw a filled ellipse made of braille dots.
|
||||
/// @param x the x coordinate of the center of the ellipse.
|
||||
/// @param y the y coordinate of the center of the ellipse.
|
||||
/// @param x1 the x coordinate of the center of the ellipse.
|
||||
/// @param y1 the y coordinate of the center of the ellipse.
|
||||
/// @param r1 the radius of the ellipse along the x axis.
|
||||
/// @param r2 the radius of the ellipse along the y axis.
|
||||
/// @param color the color of the ellipse.
|
||||
@@ -385,11 +385,11 @@ void Canvas::DrawPointEllipseFilled(int x1,
|
||||
}
|
||||
|
||||
/// @brief Draw a filled ellipse made of braille dots.
|
||||
/// @param x the x coordinate of the center of the ellipse.
|
||||
/// @param y the y coordinate of the center of the ellipse.
|
||||
/// @param x1 the x coordinate of the center of the ellipse.
|
||||
/// @param y1 the y coordinate of the center of the ellipse.
|
||||
/// @param r1 the radius of the ellipse along the x axis.
|
||||
/// @param r2 the radius of the ellipse along the y axis.
|
||||
/// @param style the style of the ellipse.
|
||||
/// @param s the style of the ellipse.
|
||||
void Canvas::DrawPointEllipseFilled(int x1,
|
||||
int y1,
|
||||
int r1,
|
||||
@@ -410,11 +410,11 @@ void Canvas::DrawPointEllipseFilled(int x1,
|
||||
e2 = 2 * err;
|
||||
if (e2 >= dx) {
|
||||
x++;
|
||||
err += dx += 2 * (long)r2 * r2; // NOLINT
|
||||
err += dx += 2 * r2 * r2;
|
||||
}
|
||||
if (e2 <= dy) {
|
||||
y++;
|
||||
err += dy += 2 * (long)r1 * r1; // NOLINT
|
||||
err += dy += 2 * r1 * r1;
|
||||
}
|
||||
} while (x <= 0);
|
||||
|
||||
@@ -631,7 +631,7 @@ void Canvas::DrawBlockCircleFilled(int x,
|
||||
/// @param x the x coordinate of the center of the circle.
|
||||
/// @param y the y coordinate of the center of the circle.
|
||||
/// @param radius the radius of the circle.
|
||||
/// @param style the style of the circle.
|
||||
/// @param s the style of the circle.
|
||||
void Canvas::DrawBlockCircleFilled(int x,
|
||||
int y,
|
||||
int radius,
|
||||
@@ -664,11 +664,11 @@ void Canvas::DrawBlockEllipse(int x,
|
||||
}
|
||||
|
||||
/// @brief Draw an ellipse made of block characters.
|
||||
/// @param x the x coordinate of the center of the ellipse.
|
||||
/// @param y the y coordinate of the center of the ellipse.
|
||||
/// @param x1 the x coordinate of the center of the ellipse.
|
||||
/// @param y1 the y coordinate of the center of the ellipse.
|
||||
/// @param r1 the radius of the ellipse along the x axis.
|
||||
/// @param r2 the radius of the ellipse along the y axis.
|
||||
/// @param style the style of the ellipse.
|
||||
/// @param s the style of the ellipse.
|
||||
void Canvas::DrawBlockEllipse(int x1,
|
||||
int y1,
|
||||
int r1,
|
||||
@@ -730,11 +730,11 @@ void Canvas::DrawBlockEllipseFilled(int x,
|
||||
}
|
||||
|
||||
/// @brief Draw a filled ellipse made of block characters.
|
||||
/// @param x the x coordinate of the center of the ellipse.
|
||||
/// @param y the y coordinate of the center of the ellipse.
|
||||
/// @param x1 the x coordinate of the center of the ellipse.
|
||||
/// @param y1 the y coordinate of the center of the ellipse.
|
||||
/// @param r1 the radius of the ellipse along the x axis.
|
||||
/// @param r2 the radius of the ellipse along the y axis.
|
||||
/// @param style the style of the ellipse.
|
||||
/// @param s the style of the ellipse.
|
||||
void Canvas::DrawBlockEllipseFilled(int x1,
|
||||
int y1,
|
||||
int r1,
|
||||
|
@@ -328,8 +328,8 @@ void Compute3(Global& global) {
|
||||
line = Line();
|
||||
}
|
||||
|
||||
block.line = (int)lines.size();
|
||||
block.line_position = (int)line.blocks.size();
|
||||
block.line = lines.size();
|
||||
block.line_position = line.blocks.size();
|
||||
line.blocks.push_back(&block);
|
||||
x += block.min_size_x + global.config.gap_x;
|
||||
}
|
||||
|
@@ -36,10 +36,10 @@ Decorator focusPositionRelative(float x, float y) {
|
||||
requirement_.selection = Requirement::Selection::NORMAL;
|
||||
|
||||
Box& box = requirement_.selected_box;
|
||||
box.x_min = (int)((float)requirement_.min_x * x_);
|
||||
box.y_min = (int)((float)requirement_.min_y * y_);
|
||||
box.x_max = (int)((float)requirement_.min_x * x_);
|
||||
box.y_max = (int)((float)requirement_.min_y * y_);
|
||||
box.x_min = int(float(requirement_.min_x) * x_);
|
||||
box.y_min = int(float(requirement_.min_y) * y_);
|
||||
box.x_max = int(float(requirement_.min_x) * x_);
|
||||
box.y_max = int(float(requirement_.min_y) * y_);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@@ -99,9 +99,9 @@ class Gauge : public Node {
|
||||
// Draw the progress bar horizontally.
|
||||
{
|
||||
const float progress = invert ? 1.F - progress_ : progress_;
|
||||
const float limit =
|
||||
(float)box_.x_min + progress * (float)(box_.x_max - box_.x_min + 1);
|
||||
const int limit_int = (int)limit;
|
||||
const auto limit =
|
||||
float(box_.x_min) + progress * float(box_.x_max - box_.x_min + 1);
|
||||
const int limit_int = static_cast<int>(limit);
|
||||
int x = box_.x_min;
|
||||
while (x < limit_int) {
|
||||
screen.at(x++, y) = charset_horizontal[9]; // NOLINT
|
||||
@@ -130,8 +130,8 @@ class Gauge : public Node {
|
||||
{
|
||||
const float progress = invert ? progress_ : 1.F - progress_;
|
||||
const float limit =
|
||||
(float)box_.y_min + progress * (float)(box_.y_max - box_.y_min + 1);
|
||||
const int limit_int = (int)limit;
|
||||
float(box_.y_min) + progress * float(box_.y_max - box_.y_min + 1);
|
||||
const int limit_int = static_cast<int>(limit);
|
||||
int y = box_.y_min;
|
||||
while (y < limit_int) {
|
||||
screen.at(x, y++) = charset_vertical[8]; // NOLINT
|
||||
|
@@ -33,12 +33,12 @@ int Integrate(std::vector<int>& elements) {
|
||||
class GridBox : public Node {
|
||||
public:
|
||||
explicit GridBox(std::vector<Elements> lines) : lines_(std::move(lines)) {
|
||||
y_size = (int)lines_.size();
|
||||
y_size = lines_.size();
|
||||
for (const auto& line : lines_) {
|
||||
x_size = std::max(x_size, (int)line.size());
|
||||
x_size = std::max(x_size, int(line.size()));
|
||||
}
|
||||
for (auto& line : lines_) {
|
||||
while (line.size() < (size_t)x_size) {
|
||||
while (line.size() < size_t(x_size)) {
|
||||
line.push_back(filler());
|
||||
}
|
||||
}
|
||||
|
@@ -286,8 +286,8 @@ Element spinner(int charset_index, size_t image_index) {
|
||||
}
|
||||
return gauge(float(image_index) * 0.05F); // NOLINT
|
||||
}
|
||||
charset_index %= (int)elements.size();
|
||||
image_index %= (int)elements[charset_index].size();
|
||||
charset_index %= int(elements.size());
|
||||
image_index %= int(elements[charset_index].size());
|
||||
std::vector<Element> lines;
|
||||
for (const auto& it : elements[charset_index][image_index]) {
|
||||
lines.push_back(text(it));
|
||||
|
@@ -59,10 +59,10 @@ Table::Table(std::vector<std::vector<Element>> input) {
|
||||
}
|
||||
|
||||
void Table::Initialize(std::vector<std::vector<Element>> input) {
|
||||
input_dim_y_ = (int)input.size();
|
||||
input_dim_y_ = input.size();
|
||||
input_dim_x_ = 0;
|
||||
for (auto& row : input) {
|
||||
input_dim_x_ = std::max(input_dim_x_, (int)row.size());
|
||||
input_dim_x_ = std::max(input_dim_x_, int(row.size()));
|
||||
}
|
||||
|
||||
dim_y_ = 2 * input_dim_y_ + 1;
|
||||
|
Reference in New Issue
Block a user