mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 06:55:53 +08:00
Merge branch 'dev_native' of https://github.com/prusa3d/Slic3r into dev_native
This commit is contained in:
commit
46efaf6791
@ -1,6 +1,7 @@
|
|||||||
#ifndef slic3r_Events_hpp_
|
#ifndef slic3r_Events_hpp_
|
||||||
#define slic3r_Events_hpp_
|
#define slic3r_Events_hpp_
|
||||||
|
|
||||||
|
|
||||||
#include <wx/event.h>
|
#include <wx/event.h>
|
||||||
|
|
||||||
|
|
||||||
@ -11,11 +12,14 @@ namespace GUI {
|
|||||||
|
|
||||||
struct SimpleEvent : public wxEvent
|
struct SimpleEvent : public wxEvent
|
||||||
{
|
{
|
||||||
SimpleEvent(wxEventType type, int id = 0) : wxEvent(id, type) {}
|
SimpleEvent(wxEventType type, wxObject* origin = nullptr) : wxEvent(0, type)
|
||||||
|
{
|
||||||
|
SetEventObject(origin);
|
||||||
|
}
|
||||||
|
|
||||||
virtual wxEvent* Clone() const
|
virtual wxEvent* Clone() const
|
||||||
{
|
{
|
||||||
return new SimpleEvent(GetEventType(), GetId());
|
return new SimpleEvent(GetEventType(), GetEventObject());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -23,26 +27,30 @@ template<class T, size_t N> struct ArrayEvent : public wxEvent
|
|||||||
{
|
{
|
||||||
std::array<T, N> data;
|
std::array<T, N> data;
|
||||||
|
|
||||||
ArrayEvent(wxEventType type, std::array<T, N> data, int id = 0)
|
ArrayEvent(wxEventType type, std::array<T, N> data, wxObject* origin = nullptr)
|
||||||
: wxEvent(id, type), data(std::move(data))
|
: wxEvent(0, type), data(std::move(data))
|
||||||
{}
|
{
|
||||||
|
SetEventObject(origin);
|
||||||
|
}
|
||||||
|
|
||||||
virtual wxEvent* Clone() const
|
virtual wxEvent* Clone() const
|
||||||
{
|
{
|
||||||
return new ArrayEvent<T, N>(GetEventType(), data, GetId());
|
return new ArrayEvent<T, N>(GetEventType(), data, GetEventObject());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template<class T> struct ArrayEvent<T, 1> : public wxEvent
|
template<class T> struct ArrayEvent<T, 1> : public wxEvent
|
||||||
{
|
{
|
||||||
T data;
|
T data;
|
||||||
|
|
||||||
ArrayEvent(wxEventType type, T data, int id = 0)
|
ArrayEvent(wxEventType type, T data, wxObject* origin = nullptr)
|
||||||
: wxEvent(id, type), data(std::move(data))
|
: wxEvent(0, type), data(std::move(data))
|
||||||
{}
|
{
|
||||||
|
SetEventObject(origin);
|
||||||
|
}
|
||||||
|
|
||||||
virtual wxEvent* Clone() const
|
virtual wxEvent* Clone() const
|
||||||
{
|
{
|
||||||
return new ArrayEvent<T, 1>(GetEventType(), data, GetId());
|
return new ArrayEvent<T, 1>(GetEventType(), data, GetEventObject());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2007,8 +2007,9 @@ GLCanvas3D::~GLCanvas3D()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::post_event(const wxEvent &event)
|
void GLCanvas3D::post_event(wxEvent &&event)
|
||||||
{
|
{
|
||||||
|
event.SetEventObject(m_canvas);
|
||||||
wxPostEvent(m_canvas, event);
|
wxPostEvent(m_canvas, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,8 +86,8 @@ struct ObjectSelectEvent;
|
|||||||
wxDECLARE_EVENT(EVT_GLCANVAS_OBJECT_SELECT, ObjectSelectEvent);
|
wxDECLARE_EVENT(EVT_GLCANVAS_OBJECT_SELECT, ObjectSelectEvent);
|
||||||
struct ObjectSelectEvent : public ArrayEvent<ptrdiff_t, 2>
|
struct ObjectSelectEvent : public ArrayEvent<ptrdiff_t, 2>
|
||||||
{
|
{
|
||||||
ObjectSelectEvent(ptrdiff_t object_id, ptrdiff_t volume_id, int id = 0)
|
ObjectSelectEvent(ptrdiff_t object_id, ptrdiff_t volume_id, wxObject *origin = nullptr)
|
||||||
: ArrayEvent(EVT_GLCANVAS_OBJECT_SELECT, {object_id, volume_id}, id)
|
: ArrayEvent(EVT_GLCANVAS_OBJECT_SELECT, {object_id, volume_id}, origin)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
ptrdiff_t object_id() const { return data[0]; }
|
ptrdiff_t object_id() const { return data[0]; }
|
||||||
@ -546,7 +546,7 @@ class GLCanvas3D
|
|||||||
|
|
||||||
GCodePreviewVolumeIndex m_gcode_preview_volume_index;
|
GCodePreviewVolumeIndex m_gcode_preview_volume_index;
|
||||||
|
|
||||||
void post_event(const wxEvent &event);
|
void post_event(wxEvent &&event);
|
||||||
void viewport_changed();
|
void viewport_changed();
|
||||||
public:
|
public:
|
||||||
GLCanvas3D(wxGLCanvas* canvas);
|
GLCanvas3D(wxGLCanvas* canvas);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user