Added selection of custom bed texture to bed shape dialog

This commit is contained in:
Enrico Turri 2019-07-18 11:12:11 +02:00
parent 75c53a53b6
commit 08d37aad06
10 changed files with 198 additions and 70 deletions

View file

@ -16,25 +16,32 @@ namespace GUI {
using ConfigOptionsGroupShp = std::shared_ptr<ConfigOptionsGroup>;
class BedShapePanel : public wxPanel
{
static const std::string NONE;
static const std::string EMPTY_STRING;
Bed_2D* m_canvas;
std::vector<Vec2d> m_loaded_bed_shape;
std::vector<Vec2d> m_shape;
std::vector<Vec2d> m_loaded_shape;
std::string m_custom_texture;
public:
BedShapePanel(wxWindow* parent) : wxPanel(parent, wxID_ANY) {}
~BedShapePanel() {}
void build_panel(const ConfigOptionPoints& default_pt);
BedShapePanel(wxWindow* parent) : wxPanel(parent, wxID_ANY), m_custom_texture(NONE) {}
~BedShapePanel() {}
void build_panel(const ConfigOptionPoints& default_pt, const ConfigOptionString& custom_texture);
// Returns the resulting bed shape polygon. This value will be stored to the ini file.
std::vector<Vec2d> get_bed_shape() { return m_canvas->m_bed_shape; }
const std::vector<Vec2d>& get_shape() const { return m_shape; }
const std::string& get_custom_texture() const { return (m_custom_texture != NONE) ? m_custom_texture : EMPTY_STRING; }
private:
ConfigOptionsGroupShp init_shape_options_page(const wxString& title);
wxPanel* init_texture_panel();
void set_shape(const ConfigOptionPoints& points);
void update_preview();
void update_shape();
void load_stl();
void load_texture();
wxChoicebook* m_shape_options_book;
std::vector <ConfigOptionsGroupShp> m_optgroups;
@ -49,8 +56,9 @@ public:
wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {}
~BedShapeDialog() {}
void build_dialog(const ConfigOptionPoints& default_pt);
std::vector<Vec2d> get_bed_shape() { return m_panel->get_bed_shape(); }
void build_dialog(const ConfigOptionPoints& default_pt, const ConfigOptionString& custom_texture);
const std::vector<Vec2d>& get_shape() const { return m_panel->get_shape(); }
const std::string& get_custom_texture() const { return m_panel->get_custom_texture(); }
protected:
void on_dpi_changed(const wxRect &suggested_rect) override;