mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-06 23:31:19 +00:00
* 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.
75 lines
2.0 KiB
C++
75 lines
2.0 KiB
C++
#ifndef slic3r_GUI_DragCanvas_hpp_
|
|
#define slic3r_GUI_DragCanvas_hpp_
|
|
|
|
#include "wx/bitmap.h"
|
|
#include "wx/dragimag.h"
|
|
#include "wx/panel.h"
|
|
#include <wx/object.h>
|
|
#include <wx/gdicmn.h>
|
|
#include <vector>
|
|
#include <string>
|
|
#include <wx/event.h>
|
|
#include <wx/colour.h>
|
|
|
|
namespace Slic3r { namespace GUI {
|
|
|
|
class DragShape : public wxObject
|
|
{
|
|
public:
|
|
DragShape(const wxBitmap& bitmap, int index);
|
|
~DragShape() {}
|
|
|
|
wxPoint GetPosition() const { return m_pos; }
|
|
void SetPosition(const wxPoint& pos) { m_pos = pos; }
|
|
|
|
const wxBitmap& GetBitmap() const { return m_bitmap; }
|
|
void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
|
|
|
|
int get_index() { return m_index; }
|
|
|
|
bool hit_test(const wxPoint& pt) const;
|
|
void paint(wxDC& dc, bool highlight = false);
|
|
|
|
protected:
|
|
wxPoint m_pos;
|
|
wxBitmap m_bitmap;
|
|
int m_index;
|
|
};
|
|
|
|
|
|
enum class DragMode {
|
|
NONE,
|
|
DRAGGING,
|
|
};
|
|
class DragCanvas : public wxPanel
|
|
{
|
|
public:
|
|
DragCanvas(wxWindow* parent, const std::vector<std::string>& colors, const std::vector<int>& order);
|
|
~DragCanvas();
|
|
void set_shape_list(const std::vector<std::string>& colors, const std::vector<int>& order);
|
|
std::vector<int> get_shape_list_order();
|
|
std::vector<DragShape*> get_ordered_shape_list();
|
|
|
|
protected:
|
|
void on_paint(wxPaintEvent& event);
|
|
void on_erase(wxEraseEvent& event);
|
|
void on_mouse(wxMouseEvent& event);
|
|
DragShape* find_shape(const wxPoint& pt) const;
|
|
|
|
private:
|
|
std::vector<DragShape*> m_dragshape_list;
|
|
DragMode m_drag_mode;
|
|
DragShape* m_dragging_shape{ nullptr };
|
|
DragShape* m_slot_shape{ nullptr }; // The shape that's being highlighted
|
|
wxDragImage* m_drag_image{ nullptr };
|
|
wxPoint m_drag_start_pos;
|
|
wxBitmap m_arrow_bmp;
|
|
wxPoint m_max_shape_pos;
|
|
wxColour m_background_color; // ORCA
|
|
wxColour m_border_color; // ORCA
|
|
};
|
|
|
|
|
|
}}
|
|
#endif
|