Files
OrcaSlicer/src/slic3r/GUI/GLSelectionRectangle.hpp
T
HanifKoh 1a5f91d727 Add Missing Includes Across src/slic3r/GUI (#16048)
* Add Missing Includes Across src/slic3r/GUI

Every GUI source and header now directly includes the headers declaring what it uses, rather than relying on the precompiled header or transitive includes. Generated with clang-tidy misc-include-cleaner, plus one hand edit making CalibrationPanel.hpp self-contained.

* Drop the OS-Specific Includes Added Outside Their Platform Guards

GLib, GTK, D-Bus and POSIX headers are only used inside platform #if blocks, which already include them. Added unconditionally at the top of the file they broke the Windows build.

* Add the clang-tidy Configuration That Generated These Includes

Only misc-include-cleaner's missing-include check, with the headers it must never suggest: per-platform, internal and OS-specific ones that would break other platforms or are not meant to be included directly.

* Match Windows Paths in the clang-tidy Ignore List

Header paths use backslashes on Windows, so every / in a pattern is now [/\\]. The Windows SDK headers are ignored alongside the other OS-specific ones, and the list is one pattern per line. Suggested by @raistlin7447 from a Windows clang-cl run.
2026-10-02 14:56:56 +08:00

64 lines
1.8 KiB
C++

#ifndef slic3r_GLSelectionRectangle_hpp_
#define slic3r_GLSelectionRectangle_hpp_
#include "libslic3r/Point.hpp"
#include "GLModel.hpp"
#include <vector>
#include <cstdlib>
#include <algorithm>
namespace Slic3r {
namespace GUI {
struct Camera;
class GLCanvas3D;
class GLSelectionRectangle {
public:
enum EState {
Off,
Select,
Deselect
};
// Initiates the rectangle.
void start_dragging(const Vec2d& mouse_position, EState state);
// To be called on mouse move.
void dragging(const Vec2d& mouse_position);
// Given a vector of points in world coordinates, the function returns indices of those
// that are in the rectangle.
std::vector<unsigned int> contains(const std::vector<Vec3d>& points) const;
// Disables the rectangle.
void stop_dragging();
void render(const GLCanvas3D& canvas);
bool is_dragging() const { return m_state != Off; }
EState get_state() const { return m_state; }
float get_width() const { return std::abs(m_start_corner.x() - m_end_corner.x()); }
float get_height() const { return std::abs(m_start_corner.y() - m_end_corner.y()); }
float get_left() const { return std::min(m_start_corner.x(), m_end_corner.x()); }
float get_right() const { return std::max(m_start_corner.x(), m_end_corner.x()); }
float get_top() const { return std::max(m_start_corner.y(), m_end_corner.y()); }
float get_bottom() const { return std::min(m_start_corner.y(), m_end_corner.y()); }
private:
EState m_state{ Off };
Vec2d m_start_corner{ Vec2d::Zero() };
Vec2d m_end_corner{ Vec2d::Zero() };
GLModel m_rectangle;
Vec2d m_old_start_corner{ Vec2d::Zero() };
Vec2d m_old_end_corner{ Vec2d::Zero() };
};
} // namespace GUI
} // namespace Slic3r
#endif // slic3r_GLGizmoSlaSupports_hpp_