2018-04-20 10:58:07 +00:00
|
|
|
#ifndef slic3r_2DBed_hpp_
|
|
|
|
#define slic3r_2DBed_hpp_
|
|
|
|
|
2018-01-25 12:46:04 +00:00
|
|
|
#include <wx/wx.h>
|
|
|
|
#include "Config.hpp"
|
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
namespace GUI {
|
|
|
|
|
|
|
|
class Bed_2D : public wxPanel
|
|
|
|
{
|
2018-04-10 08:31:58 +00:00
|
|
|
bool m_user_drawn_background = true;
|
2018-01-25 12:46:04 +00:00
|
|
|
|
|
|
|
bool m_painted = false;
|
2018-01-30 11:10:12 +00:00
|
|
|
bool m_interactive = false;
|
2018-01-25 12:46:04 +00:00
|
|
|
double m_scale_factor;
|
2018-08-21 19:05:24 +00:00
|
|
|
Vec2d m_shift = Vec2d::Zero();
|
|
|
|
Vec2d m_pos = Vec2d::Zero();
|
|
|
|
std::function<void(Vec2d)> m_on_move = nullptr;
|
2018-01-25 12:46:04 +00:00
|
|
|
|
2018-08-21 19:05:24 +00:00
|
|
|
Point to_pixels(Vec2d point);
|
|
|
|
Vec2d to_units(Point point);
|
2018-01-25 12:46:04 +00:00
|
|
|
void repaint();
|
2018-01-30 11:10:12 +00:00
|
|
|
void mouse_event(wxMouseEvent event);
|
2018-08-21 19:05:24 +00:00
|
|
|
void set_pos(Vec2d pos);
|
2018-01-30 11:10:12 +00:00
|
|
|
|
2018-01-25 12:46:04 +00:00
|
|
|
public:
|
|
|
|
Bed_2D(wxWindow* parent)
|
|
|
|
{
|
|
|
|
Create(parent, wxID_ANY, wxDefaultPosition, wxSize(250, -1), wxTAB_TRAVERSAL);
|
|
|
|
// m_user_drawn_background = $^O ne 'darwin';
|
2018-04-10 08:31:58 +00:00
|
|
|
#ifdef __APPLE__
|
|
|
|
m_user_drawn_background = false;
|
|
|
|
#endif /*__APPLE__*/
|
2018-01-30 11:10:12 +00:00
|
|
|
Bind(wxEVT_PAINT, ([this](wxPaintEvent e) { repaint(); }));
|
2018-01-25 12:46:04 +00:00
|
|
|
// EVT_ERASE_BACKGROUND($self, sub{}) if $self->{user_drawn_background};
|
2018-10-31 11:56:08 +00:00
|
|
|
// Bind(EVT_MOUSE_EVENTS, ([this](wxMouseEvent event) {/*mouse_event()*/; }));
|
|
|
|
Bind(wxEVT_LEFT_DOWN, ([this](wxMouseEvent event) { mouse_event(event); }));
|
|
|
|
Bind(wxEVT_MOTION, ([this](wxMouseEvent event) { mouse_event(event); }));
|
2018-01-30 11:10:12 +00:00
|
|
|
Bind(wxEVT_SIZE, ([this](wxSizeEvent e) { Refresh(); }));
|
2018-01-25 12:46:04 +00:00
|
|
|
}
|
2018-10-31 11:56:08 +00:00
|
|
|
~Bed_2D() {}
|
2018-01-25 12:46:04 +00:00
|
|
|
|
2018-08-21 19:05:24 +00:00
|
|
|
std::vector<Vec2d> m_bed_shape;
|
2018-01-25 12:46:04 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // GUI
|
|
|
|
} // Slic3r
|
2018-04-20 10:58:07 +00:00
|
|
|
|
|
|
|
#endif /* slic3r_2DBed_hpp_ */
|